protected function maybeFilterCssUrls($css)
    {
        if (!($css = (string) $css)) {
            return $css; // Nothing to do.
        }
        if (!$this->hook_api->hasFilter('css_url()')) {
            return $css; // No reason to do this.
        }
        $import_without_url_regex = '/(?P<import>@(?:\-(?:'.$this->regex_vendor_css_prefixes.')\-)?import\s*)(?P<open_encap>["\'])(?P<url>.+?)(?P<close_encap>\\2)/ui';
        $any_url_regex            = '/(?P<url_>url\s*)(?P<open_bracket>\(\s*)(?P<open_encap>["\']?)(?P<url>.+?)(?P<close_encap>\\3)(?P<close_bracket>\s*\))/ui';

        $css = preg_replace_callback($import_without_url_regex, [$this, 'filterCssUrlImportCb'], $css);
        $css = preg_replace_callback($any_url_regex, [$this, 'filterCssUrlCb'], $css);

        return $css;
    }
protected function maybeFilterCssUrls($css)
    {
        if (!($css = (string) $css)) {
            return $css; // Nothing to do.
        }
        if (!$this->hook_api->hasFilter('css_url()')) {
            return $css; // No reason to do this.
        }
        $import_without_url_regex = '/(?P<import>@(?:\-(?:'.$this->regex_vendor_css_prefixes.')\-)?import\s*)(?P<open_encap>["\'])(?P<url>.+?)(?P<close_encap>\\2)/ui';
        $any_url_regex            = '/(?P<url_>url\s*)(?P<open_bracket>\(\s*)(?P<open_encap>["\']?)(?P<url>.+?)(?P<close_encap>\\3)(?P<close_bracket>\s*\))/ui';

        $css = preg_replace_callback($import_without_url_regex, [$this, 'filterCssUrlImportCb'], $css);
        $css = preg_replace_callback($any_url_regex, [$this, 'filterCssUrlCb'], $css);

        return $css;
    }
protected function maybeFilterCssUrls ( $ css ) { if ( ! ( $ css = ( string ) $ css ) ) { return $ css ; // Nothing to do. } if ( ! $ this -> hook_api -> hasFilter ( 'css_url()' ) ) { return $ css ; // No reason to do this. } $ import_without_url_regex = '/(?P<import>@(?:\-(?:' . $ this -> regex_vendor_css_prefixes . ')\-)?import\s*)(?P<open_encap>["\'])(?P<url>.+?)(?P<close_encap>\\2)/ui' ; $ any_url_regex = '/(?P<url_>url\s*)(?P<open_bracket>\(\s*)(?P<open_encap>["\']?)(?P<url>.+?)(?P<close_encap>\\3)(?P<close_bracket>\s*\))/ui' ; $ css = preg_replace_callback ( $ import_without_url_regex , [ $ this , 'filterCssUrlImportCb' ] , $ css ) ; $ css = preg_replace_callback ( $ any_url_regex , [ $ this , 'filterCssUrlCb' ] , $ css ) ; return $ css ; }
Maybe filter URLs in CSS code.

@since 150821 Adding URL filter support.

@param string $css CSS code.

@return string CSS code after having filtered all URLs.
Maybe filter URLs in CSS code .