24 if (strpos($uri_string,
'url(') !== 0)
return false;
25 $uri_string = substr($uri_string, 4);
26 $new_length = strlen($uri_string) - 1;
27 if ($uri_string[$new_length] !=
')')
return false;
28 $uri = trim(substr($uri_string, 0, $new_length));
30 if (!empty($uri) && ($uri[0] ==
"'" || $uri[0] ==
'"')) {
32 $new_length = strlen($uri) - 1;
33 if ($uri[$new_length] !== $quote)
return false;
34 $uri = substr($uri, 1, $new_length - 1);
37 $keys = array(
'(',
')',
',',
' ',
'"',
"'");
38 $values = array(
'\\(',
'\\)',
'\\,',
'\\ ',
'\\"',
"\\'");
39 $uri = str_replace($values, $keys, $uri);
43 if ($result ===
false)
return false;
48 $result = str_replace($keys, $values, $result);
50 return "url($result)";