protected function _parseUrls($text, array $paths)
    {
        $matches = array();
        $replaces = array();

        $finder = $this->getService('anahita:file.pathfinder')
                ->addSearchDirs(array_reverse($paths));
        $starting_path = $paths[0];

        if (preg_match_all('/url\((.*?)\)/', $text, $matches)) {
            foreach ($matches[1] as $match) {
                $match = str_replace(array('"', "'"), '', $match);

                if ($path = $finder->getPath($match)) {
                    $path = AnHelperFile::getTravelPath($starting_path, $path);
                    $path = str_replace(DS, '/', $path);
                    $replaces[$match] = $path;
                }
            }
        }

        $text = str_replace(array_keys($replaces), array_values($replaces), $text);

        return $text;
    }
protected function _parseUrls($text, array $paths)
    {
        $matches = array();
        $replaces = array();

        $finder = $this->getService('anahita:file.pathfinder')
                ->addSearchDirs(array_reverse($paths));
        $starting_path = $paths[0];

        if (preg_match_all('/url\((.*?)\)/', $text, $matches)) {
            foreach ($matches[1] as $match) {
                $match = str_replace(array('"', "'"), '', $match);

                if ($path = $finder->getPath($match)) {
                    $path = AnHelperFile::getTravelPath($starting_path, $path);
                    $path = str_replace(DS, '/', $path);
                    $replaces[$match] = $path;
                }
            }
        }

        $text = str_replace(array_keys($replaces), array_values($replaces), $text);

        return $text;
    }
protected function _parseUrls ( $ text , array $ paths ) { $ matches = array ( ) ; $ replaces = array ( ) ; $ finder = $ this -> getService ( 'anahita:file.pathfinder' ) -> addSearchDirs ( array_reverse ( $ paths ) ) ; $ starting_path = $ paths [ 0 ] ; if ( preg_match_all ( '/url\((.*?)\)/' , $ text , $ matches ) ) { foreach ( $ matches [ 1 ] as $ match ) { $ match = str_replace ( array ( '"' , "'" ) , '' , $ match ) ; if ( $ path = $ finder -> getPath ( $ match ) ) { $ path = AnHelperFile :: getTravelPath ( $ starting_path , $ path ) ; $ path = str_replace ( DS , '/' , $ path ) ; $ replaces [ $ match ] = $ path ; } } } $ text = str_replace ( array_keys ( $ replaces ) , array_values ( $ replaces ) , $ text ) ; return $ text ; }
Parse URLs.

@param string $text  The compiled css text
@param array  $paths An array of paths to look for assets

@return string
Parse URLs .