34
34
$uri = substr($uri, 1, $new_length - 1);
37
$keys = array( '(', ')', ',', ' ', '"', "'");
38
$values = array('\\(', '\\)', '\\,', '\\ ', '\\"', "\\'");
39
$uri = str_replace($values, $keys, $uri);
37
$uri = $this->expandCSSEscape($uri);
41
39
$result = parent::validate($uri, $config, $context);
43
41
if ($result === false) return false;
45
// escape necessary characters according to CSS spec
46
// except for the comma, none of these should appear in the
48
$result = str_replace($keys, $values, $result);
43
// extra sanity check; should have been done by URI
44
$result = str_replace(array('"', "\\", "\n", "\x0c", "\r"), "", $result);
50
return "url($result)";
46
return "url(\"$result\")";