Contao\Combiner::getCombinedFileUrl PHP Метод

getCombinedFileUrl() защищенный Метод

Generate the combined file and return its path
protected getCombinedFileUrl ( string $strUrl = null ) : string
$strUrl string An optional URL to prepend
Результат string The path to the combined file
    protected function getCombinedFileUrl($strUrl = null)
    {
        if ($strUrl === null) {
            $strUrl = TL_ASSETS_URL;
        }
        $strTarget = substr($this->strMode, 1);
        $strKey = substr(md5($this->strKey), 0, 12);
        // Load the existing file
        if (file_exists(TL_ROOT . '/assets/' . $strTarget . '/' . $strKey . $this->strMode)) {
            return $strUrl . 'assets/' . $strTarget . '/' . $strKey . $this->strMode;
        }
        // Create the file
        $objFile = new \File('assets/' . $strTarget . '/' . $strKey . $this->strMode);
        $objFile->truncate();
        foreach ($this->arrFiles as $arrFile) {
            $content = file_get_contents(TL_ROOT . '/' . $arrFile['name']);
            // HOOK: modify the file content
            if (isset($GLOBALS['TL_HOOKS']['getCombinedFile']) && is_array($GLOBALS['TL_HOOKS']['getCombinedFile'])) {
                foreach ($GLOBALS['TL_HOOKS']['getCombinedFile'] as $callback) {
                    $this->import($callback[0]);
                    $content = $this->{$callback[0]}->{$callback[1]}($content, $strKey, $this->strMode, $arrFile);
                }
            }
            if ($arrFile['extension'] == self::CSS) {
                $content = $this->handleCss($content, $arrFile);
            } elseif ($arrFile['extension'] == self::SCSS || $arrFile['extension'] == self::LESS) {
                $content = $this->handleScssLess($content, $arrFile);
            }
            $objFile->append($content);
        }
        unset($content);
        $objFile->close();
        // Create a gzipped version
        if (\Config::get('gzipScripts') && function_exists('gzencode')) {
            \File::putContent('assets/' . $strTarget . '/' . $strKey . $this->strMode . '.gz', gzencode(file_get_contents(TL_ROOT . '/assets/' . $strTarget . '/' . $strKey . $this->strMode), 9));
        }
        return $strUrl . 'assets/' . $strTarget . '/' . $strKey . $this->strMode;
    }