Classes/Parser/AbstractParser.php
public function _postCompile($string)
    {
        /**
         * $relativePath seems to be unused?
         *
         * @todo missing declaration of inputFilename
         */
        $relativePath = dirname(substr($this->inputFilename, strlen(PATH_site))).'/';

        /*
         * find all matches of url() and adjust uris
         */
        preg_match_all('|url[\s]*\([\s]*(?<url>[^\)]*)[\s]*\)[\s]*|Ui', $string, $matches, PREG_SET_ORDER);

        if (is_array($matches) && count($matches)) {
            foreach ($matches as $key => $value) {
                // Don't modify inline SVGs
                if (strpos($value['url'], 'data:image') === false) {
                    $url = trim($value[0], '\'"');
                    $orgPath = trim($value['url'], '\'"');
                    $newPath = $this->resolveUrlInCss($orgPath);
                    $string = str_replace($url, 'url("' . $newPath . '")', $string);
                }
            }
        }

        /*
         * find all matches of src= and adjust uris
         */
        preg_match_all('|src=([\'"])(?<url>[^\'"]*)\1|Ui', $string, $matches, PREG_SET_ORDER);

        if (is_array($matches) && count($matches)) {
            foreach ($matches as $key => $value) {
                $url = trim($value['url'], '\'"');
                $newPath = $this->resolveUrlInCss($url);
                $string = str_replace($url, $newPath, $string);
            }
        }

        return $string;
    }
public function _postCompile($string)
    {
        /**
         * $relativePath seems to be unused?
         *
         * @todo missing declaration of inputFilename
         */
        $relativePath = dirname(substr($this->inputFilename, strlen(PATH_site))).'/';

        /*
         * find all matches of url() and adjust uris
         */
        preg_match_all('|url[\s]*\([\s]*(?<url>[^\)]*)[\s]*\)[\s]*|Ui', $string, $matches, PREG_SET_ORDER);

        if (is_array($matches) && count($matches)) {
            foreach ($matches as $key => $value) {
                // Don't modify inline SVGs
                if (strpos($value['url'], 'data:image') === false) {
                    $url = trim($value[0], '\'"');
                    $orgPath = trim($value['url'], '\'"');
                    $newPath = $this->resolveUrlInCss($orgPath);
                    $string = str_replace($url, 'url("' . $newPath . '")', $string);
                }
            }
        }

        /*
         * find all matches of src= and adjust uris
         */
        preg_match_all('|src=([\'"])(?<url>[^\'"]*)\1|Ui', $string, $matches, PREG_SET_ORDER);

        if (is_array($matches) && count($matches)) {
            foreach ($matches as $key => $value) {
                $url = trim($value['url'], '\'"');
                $newPath = $this->resolveUrlInCss($url);
                $string = str_replace($url, $newPath, $string);
            }
        }

        return $string;
    }
public function _postCompile ( $ string ) { /**
         * $relativePath seems to be unused?
         *
         * @todo missing declaration of inputFilename
         */ $ relativePath = dirname ( substr ( $ this -> inputFilename , strlen ( PATH_site ) ) ) . '/' ; /*
         * find all matches of url() and adjust uris
         */ preg_match_all ( '|url[\s]*\([\s]*(?<url>[^\)]*)[\s]*\)[\s]*|Ui' , $ string , $ matches , PREG_SET_ORDER ) ; if ( is_array ( $ matches ) && count ( $ matches ) ) { foreach ( $ matches as $ key => $ value ) { // Don't modify inline SVGs if ( strpos ( $ value [ 'url' ] , 'data:image' ) === false ) { $ url = trim ( $ value [ 0 ] , '\'"' ) ; $ orgPath = trim ( $ value [ 'url' ] , '\'"' ) ; $ newPath = $ this -> resolveUrlInCss ( $ orgPath ) ; $ string = str_replace ( $ url , 'url("' . $ newPath . '")' , $ string ) ; } } } /*
         * find all matches of src= and adjust uris
         */ preg_match_all ( '|src=([\'"])(?<url>[^\'"]*)\1|Ui' , $ string , $ matches , PREG_SET_ORDER ) ; if ( is_array ( $ matches ) && count ( $ matches ) ) { foreach ( $ matches as $ key => $ value ) { $ url = trim ( $ value [ 'url' ] , '\'"' ) ; $ newPath = $ this -> resolveUrlInCss ( $ url ) ; $ string = str_replace ( $ url , $ newPath , $ string ) ; } } return $ string ; }
Fixes pathes to compliant with original location of the file.

@param $string

@return mixed

@todo add typehinting
Fixes pathes to compliant with original location of the file .