12 $this->target = $config->get(
'URI.' . $this->name);
14 $this->doEmbed = $config->get(
'URI.MungeResources');
15 $this->secretKey = $config->get(
'URI.MungeSecretKey');
18 public function filter(&$uri, $config, $context) {
19 if ($context->get(
'EmbeddedURI',
true) && !
$this->doEmbed)
return true;
21 $scheme_obj = $uri->getSchemeObj($config, $context);
22 if (!$scheme_obj)
return true;
23 if (!$scheme_obj->browsable)
return true;
24 if ($uri->isBenign($config, $context))
return true;
27 $this->replace = array_map(
'rawurlencode', $this->replace);
29 $new_uri = strtr($this->target, $this->replace);
30 $new_uri = $this->parser->parse($new_uri);
33 if ($uri->host === $new_uri->host)
return true;
39 $string = $uri->toString();
41 $this->replace[
'%s'] = $string;
42 $this->replace[
'%r'] = $context->get(
'EmbeddedURI',
true);
43 $token = $context->get(
'CurrentToken',
true);
44 $this->replace[
'%n'] = $token ? $token->name : null;
45 $this->replace[
'%m'] = $context->get(
'CurrentAttr',
true);
46 $this->replace[
'%p'] = $context->get(
'CurrentCSSProperty',
true);
48 if ($this->secretKey) $this->replace[
'%t'] = sha1($this->secretKey .
':' . $string);