PluginProbe
The WP Remote WordPress Plugin / 6.76
The WP Remote WordPress Plugin v6.76
6.76 6.72 6.69 6.65 6.62 6.48 6.47 4.87 4.97 5.05 5.09 5.16 5.22 5.24 5.25 5.38 5.41 5.42 5.45 5.47 5.53 5.56 5.65 5.68 5.72 All 54 releases
← All changes | protect/fw/rule/engine.php +32 -32 6.726.76 View file →
@@ -1,17 +1,17 @@
1 1 <?php
2 2 // phpcs:disable WordPress.Security.EscapeOutput.ExceptionNotEscaped
3 3 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
4 4
5 -if (!class_exists('WPRProtectFWRuleEngine_V672')) :
5 +if (!class_exists('WPRProtectFWRuleEngine_V676')) :
6 6 require_once dirname( __FILE__ ) . '/functions.php';
7 7
8 -class WPRProtectFWRuleEngine_V672 {
9 - use WPRProtectFWRuleStringFunc_V672;
10 - use WPRProtectFWRuleArrayFunc_V672;
11 - use WPRProtectFWRuleMiscFunc_V672;
12 - use WPRProtectFWRuleRequestFunc_V672;
13 - use WPRProtectFWRuleWPFunc_V672;
8 +class WPRProtectFWRuleEngine_V676 {
9 + use WPRProtectFWRuleStringFunc_V676;
10 + use WPRProtectFWRuleArrayFunc_V676;
11 + use WPRProtectFWRuleMiscFunc_V676;
12 + use WPRProtectFWRuleRequestFunc_V676;
13 + use WPRProtectFWRuleWPFunc_V676;
14 14
15 15 private $request;
16 16 private $variables;
17 17
@@ -24,9 +24,9 @@
24 24 const MAX_DEPTH_TO_ALLOWED_TYPE_FUNC = 8;
25 25 const MAX_ARRAY_KEYS_TO_TRAVERSE = 10000;
26 26 const WILDCARD_KEY = '*';
27 27 const FUNC_NAME_PREFIX = '_rf_';
28 - const CONST_NAME_PREFIX = 'WPRProtectFWRule_V672::';
28 + const CONST_NAME_PREFIX = 'WPRProtectFWRule_V676::';
29 29 const ALLOWED_EXT_CONSTANTS = [
30 30 'DOING_CRON'
31 31 ];
32 32
@@ -51,9 +51,9 @@
51 51
52 52 public function evaluate($rule) {
53 53 try {
54 54 return $this->executeStmt($rule->logic);
55 - } catch (WPRProtectRuleError_V672 $e) {
55 + } catch (WPRProtectRuleError_V676 $e) {
56 56 $this->error = $e;
57 57 }
58 58 }
59 59
@@ -122,9 +122,9 @@
122 122 }
123 123
124 124 private function getValue($stmt) {
125 125 if (!is_array($stmt) || empty($stmt["type"])) {
126 - throw new WPRProtectRuleError_V672(
126 + throw new WPRProtectRuleError_V676(
127 127 $this->addExState("InvalidStatementError: Malformed value statement"));
128 128 }
129 129
130 130 $this->incrOpCnt();
@@ -131,9 +131,9 @@
131 131
132 132 switch ($stmt["type"]) {
133 133 case "NUMBER":
134 134 if (!isset($stmt["value"]) || !is_int($stmt["value"])) {
135 - throw new WPRProtectRuleError_V672(
135 + throw new WPRProtectRuleError_V676(
136 136 $this->addExState("TypeError: Value is not a number")
137 137 );
138 138 }
139 139
@@ -139,9 +139,9 @@
139 139
140 140 return $stmt["value"];
141 141 case "STRING":
142 142 if (!isset($stmt["value"]) || !is_string($stmt["value"])) {
143 - throw new WPRProtectRuleError_V672(
143 + throw new WPRProtectRuleError_V676(
144 144 $this->addExState("TypeError: Value is not a string")
145 145 );
146 146 }
147 147
@@ -147,9 +147,9 @@
147 147
148 148 return $stmt["value"];
149 149 case "BOOL":
150 150 if (!isset($stmt["value"]) || !is_bool($stmt["value"])) {
151 - throw new WPRProtectRuleError_V672(
151 + throw new WPRProtectRuleError_V676(
152 152 $this->addExState("TypeError: Value is not a boolean")
153 153 );
154 154 }
155 155
@@ -155,9 +155,9 @@
155 155
156 156 return $stmt["value"];
157 157 case "CONST":
158 158 if (!isset($stmt["value"]) || !is_string($stmt["value"])) {
159 - throw new WPRProtectRuleError_V672(
159 + throw new WPRProtectRuleError_V676(
160 160 $this->addExState("TypeError: Invalid constant name")
161 161 );
162 162 }
163 163
@@ -167,9 +167,9 @@
167 167 $name = self::CONST_NAME_PREFIX . $name;
168 168 }
169 169
170 170 if (!defined($name)) {
171 - throw new WPRProtectRuleError_V672(
171 + throw new WPRProtectRuleError_V676(
172 172 $this->addExState("TypeError: Undefined constant" . $stmt["value"])
173 173 );
174 174 }
175 175
@@ -175,9 +175,9 @@
175 175
176 176 return constant($name);
177 177 case "ARRAY":
178 178 if (!isset($stmt["value"]) || !is_array($stmt["value"])) {
179 - throw new WPRProtectRuleError_V672(
179 + throw new WPRProtectRuleError_V676(
180 180 $this->addExState("TypeError: Value is not a array")
181 181 );
182 182 }
183 183
@@ -206,9 +206,9 @@
206 206 }
207 207
208 208 private function executeStmt($stmt) {
209 209 if (!is_array($stmt) || empty($stmt["type"])) {
210 - throw new WPRProtectRuleError_V672(
210 + throw new WPRProtectRuleError_V676(
211 211 $this->addExState("InvalidStatementError: Malformed logic statement")
212 212 );
213 213 }
214 214
@@ -218,9 +218,9 @@
218 218
219 219 switch ($stmt["type"]) {
220 220 case "AND":
221 221 if (empty($stmt["left_operand"]) || empty($stmt["right_operand"])) {
222 - throw new WPRProtectRuleError_V672(
222 + throw new WPRProtectRuleError_V676(
223 223 $this->addExState("InvalidOperandError: Malformed operand(s)")
224 224 );
225 225 }
226 226
@@ -227,9 +227,9 @@
227 227 $return_val = $this->getValue($stmt["left_operand"]) && $this->getValue($stmt["right_operand"]);
228 228 break;
229 229 case "OR":
230 230 if (empty($stmt["left_operand"]) || empty($stmt["right_operand"])) {
231 - throw new WPRProtectRuleError_V672(
231 + throw new WPRProtectRuleError_V676(
232 232 $this->addExState("InvalidOperandError: Malformed operand(s)")
233 233 );
234 234 }
235 235
@@ -236,9 +236,9 @@
236 236 $return_val = $this->getValue($stmt["left_operand"]) || $this->getValue($stmt["right_operand"]);
237 237 break;
238 238 case "NOT":
239 239 if (empty($stmt["value"])) {
240 - throw new WPRProtectRuleError_V672(
240 + throw new WPRProtectRuleError_V676(
241 241 $this->addExState("InvalidOperandError: Malformed operand")
242 242 );
243 243 }
244 244
@@ -245,9 +245,9 @@
245 245 $return_val = !$this->getValue($stmt["value"]);
246 246 break;
247 247 case "FUNCTION":
248 248 if (empty($stmt["name"]) || !is_string($stmt["name"])) {
249 - throw new WPRProtectRuleError_V672(
249 + throw new WPRProtectRuleError_V676(
250 250 $this->addExState("InvalidFunctionName: Malformed name")
251 251 );
252 252 }
253 253
@@ -254,15 +254,15 @@
254 254 $name = self::FUNC_NAME_PREFIX . $stmt["name"];
255 255 $handler = array($this, $name);
256 256
257 257 if (!is_callable($handler)) {
258 - throw new WPRProtectRuleError_V672(
258 + throw new WPRProtectRuleError_V676(
259 259 $this->addExState("UndefinedFunctionCall: " . $stmt["name"])
260 260 );
261 261 }
262 262
263 263 if (!array_key_exists('args', $stmt) || !is_array($stmt['args'])) {
264 - throw new WPRProtectRuleError_V672(
264 + throw new WPRProtectRuleError_V676(
265 265 $this->addExState("InvalidArguments: Malformed args")
266 266 );
267 267 }
268 268
@@ -273,9 +273,9 @@
273 273
274 274 $return_val = self::toAllowedType(call_user_func_array($handler, $args));
275 275 break;
276 276 default:
277 - throw new WPRProtectRuleError_V672(
277 + throw new WPRProtectRuleError_V676(
278 278 $this->addExState("UnknownOperation: -")
279 279 );
280 280 }
281 281
@@ -284,9 +284,9 @@
284 284 }
285 285
286 286 private function processRuleFunctionParams($func_name, $args_cnt, $args, $required_params = 0, $param_types = array()) {
287 287 if (($args_cnt < $required_params)) {
288 - throw new WPRProtectRuleError_V672(
288 + throw new WPRProtectRuleError_V676(
289 289 $this->addExState("ArgumentCountError: Too few arguments for " . $func_name)
290 290 );
291 291 }
292 292
@@ -291,9 +291,9 @@
291 291 }
292 292
293 293 foreach ($param_types as $pos => $type) {
294 294 if (!is_int($pos)) {
295 - throw new WPRProtectRuleError_V672(
295 + throw new WPRProtectRuleError_V676(
296 296 $this->addExState("InvalidParamType: " . $pos)
297 297 );
298 298 }
299 299
@@ -299,9 +299,9 @@
299 299
300 300 switch ($type) {
301 301 case "string":
302 302 if (!isset($args[$pos]) || !is_string($args[$pos])) {
303 - throw new WPRProtectRuleError_V672(
303 + throw new WPRProtectRuleError_V676(
304 304 $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not a string.")
305 305 );
306 306 }
307 307 break;
@@ -306,9 +306,9 @@
306 306 }
307 307 break;
308 308 case 'integer':
309 309 if (!isset($args[$pos]) || !is_int($args[$pos])) {
310 - throw new WPRProtectRuleError_V672(
310 + throw new WPRProtectRuleError_V676(
311 311 $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not a integer.")
312 312 );
313 313 }
314 314 break;
@@ -313,9 +313,9 @@
313 313 }
314 314 break;
315 315 case 'double':
316 316 if (!isset($args[$pos]) || !is_double($args[$pos])) {
317 - throw new WPRProtectRuleError_V672(
317 + throw new WPRProtectRuleError_V676(
318 318 $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not a double.")
319 319 );
320 320 }
321 321 break;
@@ -320,9 +320,9 @@
320 320 }
321 321 break;
322 322 case 'boolean':
323 323 if (!isset($args[$pos]) || !is_bool($args[$pos])) {
324 - throw new WPRProtectRuleError_V672(
324 + throw new WPRProtectRuleError_V676(
325 325 $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not a boolean.")
326 326 );
327 327 }
328 328 break;
@@ -327,9 +327,9 @@
327 327 }
328 328 break;
329 329 case 'array':
330 330 if (!isset($args[$pos]) || !is_array($args[$pos])) {
331 - throw new WPRProtectRuleError_V672(
331 + throw new WPRProtectRuleError_V676(
332 332 $this->addExState("TypeError: " . $func_name . " param at " . $pos . " is not an array.")
333 333 );
334 334 }
335 335 break;
@@ -335,9 +335,9 @@
335 335 break;
336 336 case 'mixed':
337 337 break;
338 338 default:
339 - throw new WPRProtectRuleError_V672(
339 + throw new WPRProtectRuleError_V676(
340 340 $this->addExState("InvalidParamTypeError: Invalid type at " . $pos . " for " . $func_name)
341 341 );
342 342 }
343 343 }