Returns the files version with the appropriate tag.

@param  string  $file
@param  bool  $inline  (optional)
@return string
548555
public function withTag($file, $inline = false)
    {
        $versionedFile = $this->version($file);
        $extension = pathinfo($file, PATHINFO_EXTENSION);

        if ($inline) {
            $versionedFile = strtok($versionedFile, '?');
            $absoluteFile = implode('/', array_filter([
                $this->rootPath,
                $this->publicPath,
                ltrim($versionedFile, '/')
            ]));
            if (file_exists($absoluteFile)) {
                $content = file_get_contents($absoluteFile);

                if ($extension === 'js') {
                    return '<script>' . $content . '</script>';
                }

                return '<style>' . $content . '</style>';
            }
        }

        if ($extension === 'js') {
            return '<script src="' . $versionedFile . '"></script>';
        }

        return '<link rel="stylesheet" href="' . $versionedFile . '">';
    }
533137
public function getDiffFile($file)
    {
        $args = [
            '-r', '-p', '-m', '-M', '--no-commit-id', '--full-index', $this->revision,
            '--', $this->repository->getWikiDir().$file,
        ];

        $diff = Diff::parse($this->repository->run('diff-tree', $args));
        $diff->setRepository($this->repository);

        return $diff;
    }
616419
public static function get(
        $file
    ) {
        if (is_string($file)) {
            $file = new \SplFileInfo($file);
        }

        $extension = mb_strtolower($file->getExtension());
        if ('' === $extension) {
            return static::MIME_TYPE_IF_UNKNOWN;
        }

        if (array_key_exists($extension, static::$mimeTypes)) {
            return static::$mimeTypes[$extension];
        }

        if (function_exists('finfo_open') && $file->isFile()) {
            $path = $file->getPath();

            $fileInfo = finfo_open(FILEINFO_MIME);
            $mimeType = finfo_file($fileInfo, $path);
            finfo_close($fileInfo);

            return $mimeType;
        }

        return static::MIME_TYPE_IF_UNKNOWN;
    }
970724
static String getVersionForFile(final File file)  {
        try {
            final PluginMeta pluginMeta = loadMeta(file);
            return pluginMeta.getVersion();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
933208
public final function loadFile($file) {
        $f = $this->getPath($file);
        if (is_file($f) && is_readable($f)) {
            return @file_get_contents($f);
        }

        return false;
    }
617505
public function images( $file, $version = '' ) {

		if ( empty( $version ) ) {
			$version = '?ver=' . Kecik::$version;
		}

		return $this->BaseUrl . Config::get( 'path.assets' ) . '/images/' . $file . $version;
	}
497023
public static function getExtension($file){

		$file = trim($file);
		$extension = strtolower(substr(strrchr($file, '.'), 1));

		if($extension == $file){

			return '';
		}
		else{

			return $extension;
		}
	}
539053
private function get_po_revision( $file ) {
		$file        = $this->language_files_dir . '/' . $file;
		$headers     = array( 'PO-Revision-Date' => '"PO-Revision-Date' );
		$all_headers = array();

		$fp = fopen( $file, 'r' );

		// Pull only the first 1kiB of the file in.
		$contents = fread( $fp, 1024 );

		fclose( $fp );

		foreach ( $headers as $field => $regex ) {
			if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $contents, $match ) && $match[1] ) {
				$value                 = $this->_cleanup_header_comment( $match[1] );
				$value                 = preg_replace( '~(\\\n)?"$~', '', $value );
				$all_headers[ $field ] = $value;
			} else {
				$all_headers[ $field ] = '';
			}
		}

		return $all_headers['PO-Revision-Date'];
	}
1098968
public function getFileContent($file)
    {
        // we can continue only when given file is really file and not a directory
        if ($this->fileInfo->getIsFile()) {
            $className = 'TeaminmediasPluswerk\KeSearch\Indexer\Filetypes\\' . ucfirst($this->fileInfo->getExtension());

            // check if class exists
            if (class_exists($className)) {
                // make instance
                $fileObj = GeneralUtility::makeInstance($className, $this->pObj);

                // check if new object has interface implemented
                if ($fileObj instanceof FileIndexerInterface) {
                    // Do the check if a file has already been indexed at this early point in order
                    // to skip the time expensive "get content" process which includes calls to external tools
                    // fetch the file content directly from the index
                    $fileContent = $this->getFileContentFromIndex($this->getUniqueHashForFile());

                    // if there's no matching index entry, we execute the  "get file content" method of our new object
                    if (!$fileContent) {
                        $fileContent = $fileObj->getContent($file);
                        $this->addError($fileObj->getErrors());
                    }

                    // remove line breaks from content in order to identify
                    // additional content (which will have trailing linebreaks)
                    $fileContent = str_replace("\n", ' ', $fileContent);

                    return $fileContent;
                } else {
                    return false;
                }
            } else {
                // if no indexer for this type of file exists, we do a fallback:
                // we return an empty content. Doing this at least the FAL metadata
                // can be indexed. So this makes only sense when using FAL.
                if ($this->pObj->indexerConfig['fal_storage'] > 0) {
                    return '';
                } else {
                    $errorMessage = 'No indexer for this type of file. (class ' . $className . ' does not exist).';
                    $this->pObj->logger->error($errorMessage);
                    $this->addError($errorMessage);
                    return false;
                }
            }
        } else {
            $errorMessage = $file . ' is not a file.';
            $this->pObj->logger->error($errorMessage);
            $this->addError($errorMessage);
            return false;
        }
    }
1272178
protected function getFileInfo($file)
    {
        $normalized = [
            'type'      => 'file',
            'path'      => $file->getName(),
            'timestamp' => substr($file->getUploadTimestamp(), 0, -3),
            'size'      => $file->getSize(),
        ];

        return $normalized;
    }
1117070
private function getType(string $file): string
	{
		$css = '/\.(css|less)$/';
		$js = '/\.js$/';

		if (preg_match($css, $file)) {
			return self::CSS;
		} elseif (preg_match($js, $file)) {
			return self::JS;
		}
		throw new InvalidArgumentException("Unknown assets file '$file'");
	}
540001
public static function getFormat(SplFileInfo $file)
    {
        $name = $file->getRelativePathname();
        $ext  = substr($name, strrpos($name, '.') + 1);

        switch ($ext) {
            case 'md':
                return 'markdown';

            case 'yml':
                return 'yaml';

            default:
                return $ext;
        }
    }
776877
public function file($file)
    {
        $filePaths = loader()->getPublicDirs(true);

        foreach ($filePaths as $filePath) {
            if (is_file($filePath . $file)) {
                return path_to_url($filePath . $file);
                break;
            }
        }
    }
292912
private function _getExtension($file = null)
	{
		if (!is_null($file))
		{
			$dot = strrpos($file, '.') + 1;

			return strtolower(substr($file, $dot));
		}

		return '##INVALID_FILE##';
	}
730779
protected function _fileGetContents($file)
    {
        if (!is_file($file)) {
            return false;
        }

        if ($this->_options['mode'] == 1) {
            $f = @fopen($file, 'r');
            @$data = fread($f, filesize($file));
            @fclose($f);
            return unserialize($data);
        } else {
            return include $file;
        }
    }
1242234
public function getFileIcon($file = '')
    {
        $extension = File::extension($file);

        foreach ($this->fileTypes as $type => $regex) {
            if (preg_match("/^($regex)$/i", $extension) !== 0) {
                return "fa-file-{$type}-o";
            }
        }

        return 'fa-file-o';
    }
546179
private function getFileContents($file) {
    if (file_exists($file) === FALSE) {
      return NULL;
    }

    $contents = file_get_contents($file);
    if ($contents === FALSE) {
      return NULL;
    }

    return $contents;
  }