Apply the filter to modify attributes.
Modify existing attributes with the configured values.
91 {
93 assert(array_key_exists(
'Attributes',
$request));
94
95
97
98
99 if (empty($this->pattern) || empty($this->subject)) {
101 }
102
103 if (!$this->replace && !$this->remove && $this->replacement === false) {
105 "'%remove' are set.");
106 }
107
108 if (!$this->replace && $this->replacement === null) {
110 }
111
112 if ($this->replace && $this->remove) {
114 }
115
116 if (empty($this->target)) {
117
119 }
120
121 if ($this->subject !== $this->target && $this->remove) {
123 }
124
125 if (!array_key_exists($this->subject,
$attributes)) {
126
127 return;
128 }
129
130 if ($this->replace) {
132 $matches = array();
133 if (preg_match($this->pattern, $value, $matches) > 0) {
134 $new_value = $matches[0];
135
136 if ($this->replacement !== FALSE) {
138 }
139
140 if ($this->subject === $this->target) {
141 $value = $new_value;
142 } else {
144 }
145 }
146 }
147 } elseif ($this->remove) {
148 $removedAttrs = array();
150 $matches = array();
151 if (preg_match($this->pattern, $value, $matches) > 0) {
152 $removedAttrs[] = $value;
153 }
154 }
156
159 }
160 } else {
161 if ($this->subject === $this->target) {
163 $this->pattern, $this->replacement,
165 );
166 } else {
168 preg_replace(
169 $this->pattern,
170 $this->replacement,
172 ),
174 );
175 }
176 }
177 }
foreach($paths as $path) $request
$target
Attribute to place the result in.
$subject
Attribute to search in.
$replacement
String to replace the pattern found with.
if(array_key_exists('yes', $_REQUEST)) $attributes