Lime\Helper\Utils::fixRelativeUrls PHP Метод

fixRelativeUrls() публичный Метод

public fixRelativeUrls ( $content, $base = '/' )
    public function fixRelativeUrls($content, $base = '/')
    {
        $protocols = '[a-zA-Z0-9\\-]+:';
        $regex = '#\\s+(src|href|poster)="(?!/|' . $protocols . '|\\#|\')([^"]*)"#m';
        $content = preg_replace($regex, " \$1=\"{$base}\$2\"", $content);
        // Background image.
        $regex = '#style\\s*=\\s*[\'\\"](.*):\\s*url\\s*\\([\'\\"]?(?!/|' . $protocols . '|\\#)([^\\)\'\\"]+)[\'\\"]?\\)#m';
        $content = preg_replace($regex, 'style="$1: url(\'' . $base . '$2$3\')', $content);
        return $content;
    }