51        parent::__construct(
$config, $reserved);
 
   59                if ($value === 
'%replace') {
 
   60                    $this->replace = 
true;
 
   61                } elseif ($value === 
'%remove') {
 
   67            } elseif (
$name === 
'pattern') {
 
   69                $this->pattern = $value;
 
   70            } elseif (
$name === 
'replacement') {
 
   72                $this->replacement = $value;
 
   73            } elseif (
$name === 
'subject') {
 
   75                $this->subject = $value;
 
   76            } elseif (
$name === 
'target') {
 
   78                $this->target = $value;
 
   93        assert(array_key_exists(
'Attributes', 
$request));
 
   99        if (empty($this->pattern) || empty($this->subject)) {
 
  103        if (!$this->replace && !$this->
remove && $this->replacement === 
false) {
 
  105                "'%remove' are set.");
 
  108        if (!$this->replace && $this->replacement === 
null) {
 
  112        if ($this->replace && $this->
remove) {
 
  116        if (empty($this->target)) {
 
  121        if ($this->subject !== $this->target && $this->
remove) {
 
  125        if (!array_key_exists($this->subject, 
$attributes)) {
 
  130        if ($this->replace) { 
 
  133                if (preg_match($this->pattern, $value, $matches) > 0) {
 
  134                    $new_value = $matches[0];
 
  136                    if ($this->replacement !== FALSE) {
 
  140                    if ($this->subject === $this->target) {
 
  147        } elseif ($this->
remove) { 
 
  148            $removedAttrs = array();
 
  151                if (preg_match($this->pattern, $value, $matches) > 0) {
 
  152                    $removedAttrs[] = $value;
 
  161            if ($this->subject === $this->target) {
 
  163                    $this->pattern, $this->replacement,
 
foreach($paths as $path) $request
An exception for terminatinating execution or to throw for unit testing.
$target
Attribute to place the result in.
process(&$request)
Apply the filter to modify attributes.
$subject
Attribute to search in.
$remove
Should the value found be removed?
__construct($config, $reserved)
Initialize this filter.
$pattern
Pattern to search for.
$replace
Should the pattern found be replaced?
$replacement
String to replace the pattern found with.
if(array_key_exists('yes', $_REQUEST)) $attributes