Returns HTML link to editor.

@param string   $file
@param int|null $line

@return string
969968
public static function editorLink(string $file, int $line = null): string
    {
        $file = \strtr($origFile = $file, Debugger::$editorMapping);
        if ($editor = self::editorUri($origFile, $line)) {
            $file = \str_replace('\\', '/', $file);
            if (\preg_match('#(^[a-z]:)?/.{1,50}$#i', $file, $m) && \strlen($file) > \strlen($m[0])) {
                $file = '...' . $m[0];
            }
            $file = \str_replace('/', DIRECTORY_SEPARATOR, $file);

            return self::formatHtml('<a href="%" title="%">%<b>%</b>%</a>',
                $editor,
                $file . ($line ? ":$line" : ''),
                \rtrim(\dirname($file), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR,
                \basename($file),
                $line ? ":$line" : ''
            );
        }

        return self::formatHtml('<span>%</span>', $file . ($line ? ":$line" : ''));
    }
869150
public function getXdebugLink($file, $line = 1)
    {
        if (count($this->xdebugReplacements)) {
            $file = strtr($file, $this->xdebugReplacements);
        }

        $url = strtr($this->getXdebugLinkTemplate(), ['%f' => $file, '%l' => $line]);
        if ($url) {
            return ['url' => $url, 'ajax' => $this->getXdebugShouldUseAjax()];
        }
    }
1038361
public function current($file = null)
    {
        $splFileInfo = $file ?: parent::current();

        return $this->transformer->transform($splFileInfo);
    }
65596
public static function rpath(String $file = NULL) : String
    {
        $config = Config::get('Filesystem', 'file', self::$access);

        self::$access = NULL;

        if( $config['parentDirectoryAccess'] === false )
        {
            $file = str_replace('../', '', $file);
        }

        if( $config['realPath'] === true )
        {
            $file = Base::prefix(self::originpath($file), REAL_BASE_DIR);
        }

        return $file;
    }
1051185
public static String getWebViewLink(File file) {
    if (file == null) {
      logger.log(Level.SEVERE, "Could not get file url for null file");
      return null;
    }
    
    return file.getWebViewLink();
  }
858180
public function build($file = null)
    {
        $prepared = preg_replace_callback('/%.*%/U', function ($m) {
            if ($m[0] === '%phpdoc%') {
                $string = '/**';
                foreach ($this->components as $name => $classes) {
                    $string .= PHP_EOL . ' * @property ' . implode('|', $classes) . ' $' . $name;
                }
                $string .= PHP_EOL . ' */';
                return $string;
            }
            return $m[0];
        }, $this->template);
        if ($file === null) {
            return $prepared;
        }
        return (bool)file_put_contents($file, $prepared);
    }
121224
public Result<String> convertToHtml(File file) throws IOException {
        return new InternalDocumentConverter(options).convertToHtml(file).toResult();
    }
1034913
public function updateFileAction(File $file)
    {
        $collection = new ResourceCollection(array($file->getResourceNode()));
        $this->checkAccess('EDIT', $collection);
        $request = $this->get('request');
        $form = $this->get('form.factory')->create(new UpdateFileType(), new File());
        $form->handleRequest($request);

        if ($form->isValid()) {
            $tmpFile = $form->get('file')->getData();
            $this->get('claroline.manager.file_manager')->changeFile($file, $tmpFile);

            if ($this->get('claroline.twig.home_extension')->isDesktop()) {
                $url = $this->generateUrl('claro_desktop_open_tool', array('toolName' => 'resource_manager'));
            } else {
                $url = $this->generateUrl(
                    'claro_workspace_open_tool',
                    array(
                        'toolName' => 'resource_manager',
                        'workspaceId' => $file->getResourceNode()->getWorkspace()->getId()
                    )
                );
            }

            return $this->redirect($url);
        }

        return array(
            'form' => $form->createView(),
            'resourceType' => 'file',
            'file' => $file,
            '_resource' => $file
        );
    }
1244665
public function gist($link, $file=null) {
		$matches = array();
		if (preg_match('/[0-9]+/', $link, $matches)>0) {
			$gist_id = $matches[0];
			$link = "https://gist.github.com/$gist_id.js";
			if (!is_null($file)) {
				$link .= "?file=" . urlencode($file);
			}
		}

		return "<script src='$link'></script>";
	}
376177
public function getContent($file)
    {
        $content = $file instanceof File ? $file->getString() : file_get_contents($file);

        // Yes, yes, regex'ing HTML is evil.
        // Since we don't care about well-formedness or markup here, it does the job.
        $content = preg_replace(
            [
                // Remove invisible content
                '@<head[^>]*?>.*?</head>@siu',
                '@<style[^>]*?>.*?</style>@siu',
                '@<script[^>]*?.*?</script>@siu',
                '@<object[^>]*?.*?</object>@siu',
                '@<embed[^>]*?.*?</embed>@siu',
                '@<applet[^>]*?.*?</applet>@siu',
                '@<noframes[^>]*?.*?</noframes>@siu',
                '@<noscript[^>]*?.*?</noscript>@siu',
                '@<noembed[^>]*?.*?</noembed>@siu',
                // Add line breaks before and after blocks
                '@</?((address)|(blockquote)|(center)|(del))@iu',
                '@</?((div)|(h[1-9])|(ins)|(isindex)|(p)|(pre))@iu',
                '@</?((dir)|(dl)|(dt)|(dd)|(li)|(menu)|(ol)|(ul))@iu',
                '@</?((table)|(th)|(td)|(caption))@iu',
                '@</?((form)|(button)|(fieldset)|(legend)|(input))@iu',
                '@</?((label)|(select)|(optgroup)|(option)|(textarea))@iu',
                '@</?((frameset)|(frame)|(iframe))@iu',
            ],
            [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', "$0", "$0", "$0", "$0", "$0", "$0", "$0", "$0"],
            $content
        );

        return strip_tags($content);
    }
1349094
protected function formLocalFileUrl($file)
    {
        $config = \OxidEsales\Eshop\Core\Registry::getConfig();
        $parts = explode('?', $file);
        $url = $config->getResourceUrl($parts[0], $config->isAdmin());
        $parameters = $parts[1];
        if (empty($parameters)) {
            $path = $config->getResourcePath($file, $config->isAdmin());
            $parameters = filemtime($path);
        }

        if (empty($url) && $config->getConfigParam('iDebug') != 0) {
            $error = "{oxstyle} resource not found: " . getStr()->htmlspecialchars($file);
            trigger_error($error, E_USER_WARNING);
        }

        return $url ? "$url?$parameters" : '';
    }
585839
public function render( $file = null ) 
	{
		if ( !is_null( $file ) )
		{
			$this->file( $file );
		}
		
		$path = $this->view_path( $this->file() );
		
		// extract the view data
		extract( $this->_data );
			
		// extract globals if they exists
		if ( !empty( static::$_globals ) ) 
		{
			extract( static::$_globals, EXTR_PREFIX_SAME, 'global' );
		}
			
		ob_start();
		
		require( $path );

		return ob_get_clean();
	}
676853
def get_editor(self, file):
        

        for editor in self.__model.list_editors():
            if editor.file == file:
                return editor
422204
private function getFullPath(string $file = null): string
	{
		return $this->getBasePath() . $this->path . ($file !== null ? DIRECTORY_SEPARATOR . $file : '');
	}
730124
protected function getFileContents($file, $markLine = null)
    {
        if (is_readable($file) === false) {
            return "Unable to read “{$file}”.";
        }

        $raw = file($file, FILE_IGNORE_NEW_LINES);

        foreach ($raw as $index => &$line) {
            $line = htmlspecialchars($line);

            if ($index + 1 === $markLine) {
                $line = sprintf('<mark class="highlight-line">%s</mark>', $line);
            }

            $line .= "\n";
        }

        if ($this->isExcerptOnly() === true) {
            $raw = array_slice(
                $raw,
                $this->getExcerptStart($markLine) - 1,
                $this->getExcerptSize(),
                true
            );
        }

        return join('', $raw);
    }
91454
private static function get_event_file( $event, &$line ) {
		if ( method_exists( $event, 'getScenario' ) ) {
			$scenario_feature = $event->getScenario();
		} elseif ( method_exists( $event, 'getFeature' ) ) {
			$scenario_feature = $event->getFeature();
		} elseif ( method_exists( $event, 'getOutline' ) ) {
			$scenario_feature = $event->getOutline();
		} else {
			return null;
		}
		$line = $scenario_feature->getLine();
		return $scenario_feature->getFile();
	}
401236
public function getFileLink($file, $line)
    {
        if ($fmt = $this->fileLinkFormat) {
            return \is_string($fmt) ? strtr($fmt, ['%f' => $file, '%l' => $line]) : $fmt->format($file, $line);
        }

        return false;
    }