CSS Version

@param string $fileName

@return string
341031
public function cssVersion($fileName)
    {
        $filePath = sprintf("%s/../web%s", $this->kernelRootDir, $fileName);

        if (true === file_exists($filePath)) {
            return sprintf("%s?v=%s", $fileName, substr(md5_file($filePath), 0, 5));
        }

        return sprintf("%s?v=%s", $fileName, substr(sha1(microtime()), 0, 6));
    }
1329718
protected function prepareCssForLess($componentName, $fileName = null)
    {
        if ($fileName === null) {
            $fileName = $componentName;
        }

        // Add component data to minifier if it is enabled
        if ($this->components[$componentName] === true) {
            return "@import \"{$fileName}.less\";";
        }

        return '';
    }
437547
protected function setCssFileCDN($cssFileName)
    {
        $patternFound = null;
        if (strpos(pathinfo($cssFileName)['basename'], 'font-awesome-') !== false) {
            $patternFound = $this->setCssFileCDNforFontAwesome($cssFileName);
        }
        if (is_null($patternFound)) {
            $patternFound = [false, $this->sanitizeString($cssFileName)];
        }
        return $patternFound;
    }
1009842
public function getMimeType($filename)
    {
        $extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION));

        if (isset($this->mimeTypes[$extension])) {
            return $this->mimeTypes[$extension];
        }

        return 'text/plain';
    }
740340
public function url($filename)
    {
        // If no Theme set, return /$filename
        if (!$this->current()) {
            return "/" . ltrim($filename, '/');
        }

        return $this->current()->url($filename);
    }
123407
public function getNameWithoutExtension($fileName)
    {
        $lastDot = strrpos($fileName, '.');

        if (!$lastDot) {
            return $fileName;
        }

        return substr($fileName, 0, $lastDot);
    }
855358
public function getCssContent(string $fileName, bool $minify): string
    {
        $content = file_get_contents($fileName);

        if ($content === false) {
            throw new RuntimeException(sprintf('File could be read: %s', $fileName));
        }

        if ($minify === true) {
            $compressor = new CssMinifier();
            $content = $compressor->run($content);
        }

        return $content;
    }
703035
public static function getMediaTypeFromFilename(string $filename): string
    {
        $pathinfo = pathinfo(strtolower($filename));
        if (!isset($pathinfo['extension'])) {
            return 'application/octet-stream';
        }
        return self::$extensionToMediaType[$pathinfo['extension']] ?? 'application/octet-stream';
    }
1118458
public static function getMimeTypeFromFilename($fileName)
    {
        $ext = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
        if (array_key_exists($ext, self::$customMimeTypes)) {
            return self::$customMimeTypes[$ext];
        } else if (array_key_exists($ext, self::$mimeTypes)) {
            return self::$mimeTypes[$ext];
        }
        return 'application/octet-stream';
    }
127116
public function getThemeBootstrapVersion($themeName = null)
    {
        if (null === $themeName) {
            if (null !== $this->bootstrapVersion) {
                return $this->bootstrapVersion;
            }

            $themeName = $this->getActiveThemeBackend()->getThemeName();
        }

        $this->bootstrapVersion = $this->container->getParameter('red_kite_cms.bootstrap_version');

        if ( ! $this->container->hasParameter('red_kite_labs_theme_engine.bootstrap_themes')) {
            return $this->bootstrapVersion;
        }

        $themes = $this->container->getParameter('red_kite_labs_theme_engine.bootstrap_themes');
        if (array_key_exists($themeName, $themes)) {
            $this->bootstrapVersion = $themes[$themeName];
        }

        return $this->bootstrapVersion;
    }
71671
protected function checkFileName($fileName)
    {
        $extension = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));

        $allow = $this->getWhitelistedExtensions();
        $block = $this->getBlacklistedExtensions();

        return  (   (false === $allow || in_array($extension, $allow))
                &&  (false === $block || ! in_array($extension, $block))
                );
    }
34598
public function getTemplateFilePath($filename)
    {
        $filepath = $this->locateTemplateFilePath($filename);

        if (!file_exists($filepath)) {
            return false;
        }

        return $filepath;
    }
888266
public static function safeFilename($filename)
    {
        Deprecated::method(3.0);

        $filename = rawurlencode($filename); // Use 'rawurlencode', because we prefer '%20' over '+' for spaces.
        $filename = str_replace('%2F', '/', $filename);

        if (substr($filename, 0, 1) == '/') {
            $filename = substr($filename, 1);
        }

        return $filename;
    }
1305014
public function getFilePath($filename)
    {
        if (modules()) {
            $filePaths = modules()->getDirs('Views');
        } else {
            $filePaths = array_reverse($this->filePaths);
        }

        foreach ($filePaths as $filePath) {
            if (is_file($filePath . $filename . '.phtml')) {
                return $filePath . $filename . '.phtml';
                break;
            } elseif (is_file($filePath . 'errors' . DIRECTORY_SEPARATOR . $filename . '.phtml')) {
                return $filePath . 'errors' . DIRECTORY_SEPARATOR . $filename . '.phtml';
                break;
            }
        }
    }
820133
public function RemoveCssFile($FileName) {
      foreach ($this->_CssFiles as $Key => $FileInfo) {
         if ($FileInfo['FileName'] == $FileName) {
            unset($this->_CssFiles[$Key]);
            return;
         }
      }
   }
752912
function minifycss($file)
    {
        $minifiedFileName = $this->checkIfFileWasUpdated($file);
        if ($minifiedFileName) {
            $fileContent = file_get_contents(ROOTPATH . $file);
            $cssmin = new CSSmin();
            file_put_contents(ROOTPATH . $minifiedFileName, $cssmin->run($fileContent));
            return $minifiedFileName;
        }
        return $file;
    }
1044241
public function version($file)
    {
        if (file_exists($this->assetFullPath . '/hot')) {
            return '//localhost:8080/' . $file;
        }

        try {
            $manifest = $this->readManifestFile();
        } catch (Exception $e) {
            Craft::info('Mix: ' . printf($e->getMessage()), __METHOD__);
        }

        $fileKey = '/' . ltrim($file, '/');
        if (is_array($manifest) && isset($manifest[$fileKey])) {
            $file = $manifest[$fileKey];
        }

        return '/' . implode('/', array_filter([
            $this->assetPath,
            ltrim($file, '/')
        ]));
    }