Pobiera zawartość CSS
@param string $fileName
@return string
169065
protected function _getStyleContent($fileName)
    {
        //wczytanie stylu z cache
        if (null !== ($cache = $this->view->getCache()) && (null !== ($content = $cache->load($cacheKey = 'Head-Style-Css-' . md5($fileName))))) {
            //zwrot z cache
            return $content;
        }
        //rendering i zapis cache
        $cache->save($content = $this->_filterCssFile($fileName), $cacheKey, 0);
        return $content;
    }
1273866
public function getFilePathWithFallback($filename)
    {
        $emailPath = $this->getOutputFolder() . DIRECTORY_SEPARATOR . $filename;
        $archivePath = $this->getArchiveFolder() . DIRECTORY_SEPARATOR . $filename;
        return is_file($emailPath) ? $emailPath : $archivePath;
    }
969825
protected function _getUri($filename): string {
        $this->_verifyPath();
        // Note: AWS SDK does not want the URI to start with a slash, as opposed to the old Zend
        // Framework implementation.
        $path = trim($this->_config['path'], '/');
        return $path . '/' . $filename;
    }
52580
public function mimeContentType($filename)
    {

        $mimeTypes = array(
            'txt' => 'text/plain',
            'htm' => 'text/html',
            'html' => 'text/html',
            'php' => 'text/html',
            'css' => 'text/css',
            'js' => 'application/javascript',
            'json' => 'application/json',
            'xml' => 'application/xml',
            'swf' => 'application/x-shockwave-flash',
            'flv' => 'video/x-flv',
            // images
            'png' => 'image/png',
            'jpe' => 'image/jpeg',
            'jpeg' => 'image/jpeg',
            'jpg' => 'image/jpeg',
            'gif' => 'image/gif',
            'bmp' => 'image/bmp',
            'ico' => 'image/vnd.microsoft.icon',
            'tiff' => 'image/tiff',
            'tif' => 'image/tiff',
            'svg' => 'image/svg+xml',
            'svgz' => 'image/svg+xml',
            // archives
            'zip' => 'application/zip',
            'rar' => 'application/x-rar-compressed',
            'exe' => 'application/x-msdownload',
            'msi' => 'application/x-msdownload',
            'cab' => 'application/vnd.ms-cab-compressed',
            // audio/video
            'mp3' => 'audio/mpeg',
            'qt' => 'video/quicktime',
            'mov' => 'video/quicktime',
            // adobe
            'pdf' => 'application/pdf',
            'psd' => 'image/vnd.adobe.photoshop',
            'ai' => 'application/postscript',
            'eps' => 'application/postscript',
            'ps' => 'application/postscript',
            // ms office
            'doc' => 'application/msword',
            'rtf' => 'application/rtf',
            'xls' => 'application/vnd.ms-excel',
            'ppt' => 'application/vnd.ms-powerpoint',
            // open office
            'odt' => 'application/vnd.oasis.opendocument.text',
            'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
        );

        if (!file_exists($filename)) {
            throw new Error404Exception();
        }

        $ext = substr(strrchr($filename, "."), 1);
        if (array_key_exists($ext, $mimeTypes)) {
            return $mimeTypes[$ext];
        } elseif (function_exists('finfo_open')) {
            $finfo = finfo_open(FILEINFO_MIME);
            $mimetype = finfo_file($finfo, $filename);
            finfo_close($finfo);
            return $mimetype;
        } else {
            return 'application/octet-stream';
        }
    }
1175089
public function stylesheetLinkTag($filename, $attributes)
    {
        $webPaths = array();
        $absolutePaths = $this->parser->stylesheetFiles($filename);

        foreach ($absolutePaths as $absolutePath)
        {
            $webPaths[] = $this->parser->absolutePathToWebPath($absolutePath);
        }

        $config = $this->getConfig();
        $composer = $config['stylesheet_link_tag'];

        return $composer->process($webPaths, $absolutePaths, $attributes);
    }
114340
public function buildThumbFilename($filename)
	{
		$extension = pathinfo($filename, PATHINFO_EXTENSION);

		if (! $extension) {

			$filename .= '.' . pathinfo($this->relative, PATHINFO_EXTENSION);
		}

		return $this->getThumbFolder() . '/' . $filename;
	}
86989
protected function _fileNameToId($fileName)
    {
        $instance = self::getInstance();
        $prefix = $instance->_options['file_name_prefix'];
        return preg_replace('/^' . $prefix . '---(.*)$/', '$1', $fileName);
    }
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;
    }
1331118
public function addCssElixir($filename = 'css/all.css', $dependency = null, array $attributes = [])
    {
        return $this->addCss($filename, elixir($filename), $dependency, $attributes);
    }
1232761
public function file($filename): string
    {
        $options = ['multipart' =>  [
            [
                'name' => 'file',
                'filename' => File::getFilename($filename),
                'contents' => fopen($filename, 'rb'),
                'headers' => [
                    'Content-Type' => mime_content_type($filename)
                ]
            ]
        ]];

        /** @var JsonStream $stream */
        $stream = $this->client
            ->post(UserApi::generateUrl('file.json'), $options)
            ->getBody();

        return $stream->jsonSerialize()['fileKey'];
    }
1260235
protected function getTemplateName($fileName)
    {
        $pathFn = function ($dir) use ($fileName) {
            return static::$widgetTemplateDir . '/' . $dir . '/' . $fileName;
        };

        $pathToCheckFn = function ($path) {
            return APP_DIR . '/templates/' . $path . '.mustache';
        };

        $path = $pathFn($this->className);
        $pathToCheck = $pathToCheckFn($path);

        // If doesn't exists just take it by default from current APP
        if (!file_exists($pathToCheck)) {

            $path = $pathFn(static::$widgetTemplateDirDefault);
            $pathToCheck = $pathToCheckFn($path);

            // If doesn't exists take it by default from Knob-base
            if (!file_exists($pathToCheck)) {
                $path = '../../vendor/chemaclass/knob-base/src/templates/' . $path;
            }
        }

        return $path;
    }
257089
public function process($filename, $actualFileName)
    {
        // Check if the processing should be done
        if(!$this->shouldProcess($filename))
        {
            // No need to process the file, so bypass
            return $this->getFinalName($filename);
        }

        // Get an instance of the minifier with the settings
        $css = new \CssMinifier(file_get_contents($filename));

        // Otherwise write the file and return the new file name
        return $this->write($css->getMinified(), $actualFileName);
    }
1189922
private function normalizeFileName($fileName)
    {
        if (!is_array($fileName)) {
            return $fileName;
        }

        return isset($fileName['filename']) ? $fileName['filename']
            : isset($fileName['file']) ? $fileName['file'] : ''
        ;
    }
75067
public function getFilePath($fileName = null)
    {
        if ($fileName === null) {
            $fileName = $this->fileName;
        }

        return $this->theme->getPath().'/'.$this->getObjectTypeDirName().'/'.$fileName;
    }
61306
protected function getCssAsset(string $filename, string $newExtension): string
    {
        $extensionlessFilename = pathinfo($filename, PATHINFO_FILENAME);
        /** @var int $filenamePosition */
        $filenamePosition = strrpos($filename, $extensionlessFilename);
        $relativePath = substr($filename, 0, $filenamePosition);
        return "$relativePath$extensionlessFilename.$newExtension";
    }
627409
public static function mimeContentType($filename) {
        static $mime_types = [
            'html'    => 'text/html;charset=UTF-8',
            'htm'     => 'text/html;charset=UTF-8',
            'shtml'   => 'text/html;charset=UTF-8',
            'css'     => 'text/css',
            'xml'     => 'text/xml',
            'gif'     => 'image/gif',
            'jpeg'    => 'image/jpeg',
            'jpg'     => 'image/jpeg',
            'js'      => 'application/javascript',
            'atom'    => 'application/atom+xml',
            'rss'     => 'application/rss+xml',
            'mml'     => 'text/mathml',
            'txt'     => 'text/plain;charset=UTF-8',
            'jad'     => 'text/vnd.sun.j2me.app-descriptor',
            'wml'     => 'text/vnd.wap.wml',
            'htc'     => 'text/x-component',
            'png'     => 'image/png',
            'svg'     => 'image/svg+xml',
            'svgz'    => 'image/svg+xml',
            'tif'     => 'image/tiff',
            'tiff'    => 'image/tiff',
            'wbmp'    => 'image/vnd.wap.wbmp',
            'webp'    => 'image/webp',
            'ico'     => 'image/x-icon',
            'jng'     => 'image/x-jng',
            'bmp'     => 'image/x-ms-bmp',
            'woff'    => 'font/woff',
            'woff2'   => 'font/woff2',
            'jar'     => 'application/java-archive',
            'war'     => 'application/java-archive',
            'ear'     => 'application/java-archive',
            'json'    => 'application/json',
            'hqx'     => 'application/mac-binhex40',
            'doc'     => 'application/msword',
            'pdf'     => 'application/pdf',
            'ps'      => 'application/postscript',
            'eps'     => 'application/postscript',
            'ai'      => 'application/postscript',
            'rtf'     => 'application/rtf',
            'm3u8'    => 'application/vnd.apple.mpegurl',
            'kml'     => 'application/vnd.google-earth.kml+xml',
            'kmz'     => 'application/vnd.google-earth.kmz',
            'xls'     => 'application/vnd.ms-excel',
            'eot'     => 'application/vnd.ms-fontobject',
            'ppt'     => 'application/vnd.ms-powerpoint',
            'odg'     => 'application/vnd.oasis.opendocument.graphics',
            'odp'     => 'application/vnd.oasis.opendocument.presentation',
            'ods'     => 'application/vnd.oasis.opendocument.spreadsheet',
            'odt'     => 'application/vnd.oasis.opendocument.text',
            'pptx'    => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
            'xlsx'    => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
            'docx'    => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
            'wmlc'    => 'application/vnd.wap.wmlc',
            '7z'      => 'application/x-7z-compressed',
            'cco'     => 'application/x-cocoa',
            'jardiff' => 'application/x-java-archive-diff',
            'jnlp'    => 'application/x-java-jnlp-file',
            'run'     => 'application/x-makeself',
            'pl'      => 'application/x-perl',
            'pm'      => 'application/x-perl',
            'prc'     => 'application/x-pilot',
            'pdb'     => 'application/x-pilot',
            'rar'     => 'application/x-rar-compressed',
            'rpm'     => 'application/x-redhat-package-manager',
            'sea'     => 'application/x-sea',
            'swf'     => 'application/x-shockwave-flash',
            'sit'     => 'application/x-stuffit',
            'tcl'     => 'application/x-tcl',
            'tk'      => 'application/x-tcl',
            'der'     => 'application/x-x509-ca-cert',
            'pem'     => 'application/x-x509-ca-cert',
            'crt'     => 'application/x-x509-ca-cert',
            'xpi'     => 'application/x-xpinstall',
            'xhtml'   => 'application/xhtml+xml;charset=UTF-8',
            'xspf'    => 'application/xspf+xml',
            'zip'     => 'application/zip',
            'bin'     => 'application/octet-stream',
            'exe'     => 'application/octet-stream',
            'dll'     => 'application/octet-stream',
            'deb'     => 'application/octet-stream',
            'dmg'     => 'application/octet-stream',
            'iso'     => 'application/octet-stream',
            'img'     => 'application/octet-stream',
            'msi'     => 'application/octet-stream',
            'msp'     => 'application/octet-stream',
            'msm'     => 'application/octet-stream',
            'mid'     => 'audio/midi',
            'midi'    => 'audio/midi',
            'kar'     => 'audio/midi',
            'mp3'     => 'audio/mpeg',
            'ogg'     => 'audio/ogg',
            'm4a'     => 'audio/x-m4a',
            'ra'      => 'audio/x-realaudio',
            '3gpp'    => 'video/3gpp',
            '3gp'     => 'video/3gpp',
            'ts'      => 'video/mp2t',
            'mp4'     => 'video/mp4',
            'mpeg'    => 'video/mpeg',
            'mpg'     => 'video/mpeg',
            'mov'     => 'video/quicktime',
            'webm'    => 'video/webm',
            'flv'     => 'video/x-flv',
            'm4v'     => 'video/x-m4v',
            'mng'     => 'video/x-mng',
            'asx'     => 'video/x-ms-asf',
            'asf'     => 'video/x-ms-asf',
            'wmv'     => 'video/x-ms-wmv',
            'avi'     => 'video/x-msvideo'
        ];
        $chks = explode('.', $filename);
        $ext  = strtolower(array_pop($chks));
        if (array_key_exists($ext, $mime_types)) {
            return $mime_types[ $ext ];
        } else if (is_file($filename) && function_exists('finfo_open')) {
            $finfo    = finfo_open(FILEINFO_MIME);
            $mimetype = finfo_file($finfo, $filename);
            finfo_close($finfo);

            return $mimetype;
        } else {
            return 'application/octet-stream';
        }
    }
650615
protected function resolveDispositionHeaderFilename($filename)
    {
        $userAgent = $this->request->headers->get('User-Agent');

        if (preg_match('#MSIE|Safari|Konqueror#', $userAgent)) {
            return "filename=".rawurlencode($filename);
        }

        return "filename*=UTF-8''".rawurlencode($filename);
    }