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
wpremote / protect / fw / rule / functions / request.php

request.php in The WP Remote WordPress Plugin 6.76, at protect/fw/rule/functions/request.php

537 lines 10.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // phpcs:disable WordPress.Security.EscapeOutput.ExceptionNotEscaped
3 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
4
5 if (!trait_exists('WPRProtectFWRuleRequestFunc_V676')) :
6 trait WPRProtectFWRuleRequestFunc_V676 {
7 private function _rf_getAction() {
8 $args = $this->processRuleFunctionParams(
9 'getAction',
10 func_num_args(),
11 func_get_args()
12 );
13
14 return $this->request->getAction();
15 }
16
17 private function _rf_getPath() {
18 $args = $this->processRuleFunctionParams(
19 'getPath',
20 func_num_args(),
21 func_get_args()
22 );
23
24 return $this->request->getPath();
25 }
26
27 private function _rf_getServerValue() {
28 $args = $this->processRuleFunctionParams(
29 'getServerValue',
30 func_num_args(),
31 func_get_args(),
32 1
33 );
34 $key = $args[0];
35
36 return $this->request->getServerValue($key);
37 }
38
39 private function _rf_getHeader() {
40 $args = $this->processRuleFunctionParams(
41 'getHeader',
42 func_num_args(),
43 func_get_args(),
44 1
45 );
46 $key = $args[0];
47
48 return $this->request->getHeader($key);
49 }
50
51 private function _rf_getHeaders() {
52 $args = $this->processRuleFunctionParams(
53 'getHeaders',
54 func_num_args(),
55 func_get_args()
56 );
57
58 if (!empty($args)) {
59 return $this->request->getHeaders(...$args);
60 }
61
62 return $this->request->getHeaders();
63 }
64
65 private function _rf_getPostParams() {
66 $args = $this->processRuleFunctionParams(
67 'getPostParams',
68 func_num_args(),
69 func_get_args()
70 );
71
72 if (!empty($args)) {
73 return $this->request->getPostParams(...$args);
74 }
75
76 return $this->request->getPostParams();
77 }
78
79 private function _rf_getReqMethod() {
80 $args = $this->processRuleFunctionParams(
81 'getReqMethod',
82 func_num_args(),
83 func_get_args()
84 );
85
86 return $this->request->getMethod();
87 }
88
89 private function _rf_getGetParams() {
90 $args = $this->processRuleFunctionParams(
91 'getGetParams',
92 func_num_args(),
93 func_get_args()
94 );
95
96 if (!empty($args)) {
97 return $this->request->getGetParams(...$args);
98 }
99
100 return $this->request->getGetParams();
101 }
102
103 private function _rf_getCookies() {
104 $args = $this->processRuleFunctionParams(
105 'getCookies',
106 func_num_args(),
107 func_get_args()
108 );
109
110 if (!empty($args)) {
111 return $this->request->getCookies(...$args);
112 }
113
114 return $this->request->getCookies();
115 }
116
117 private function _rf_getFiles() {
118 $args = $this->processRuleFunctionParams(
119 'getFiles',
120 func_num_args(),
121 func_get_args()
122 );
123
124 if (!empty($args)) {
125 return $this->request->getFiles(...$args);
126 }
127
128 return $this->request->getFiles();
129 }
130
131 private function _rf_getFileNames() {
132 $args = $this->processRuleFunctionParams(
133 'getFileNames',
134 func_num_args(),
135 func_get_args()
136 );
137
138 if (!empty($args)) {
139 return $this->request->getFileNames(...$args);
140 }
141
142 return $this->request->getFileNames();
143 }
144
145 private function _rf_getHost() {
146 $args = $this->processRuleFunctionParams(
147 'getHost',
148 func_num_args(),
149 func_get_args()
150 );
151
152 return $this->request->host;
153 }
154
155 private function _rf_getURI() {
156 $args = $this->processRuleFunctionParams(
157 'getURI',
158 func_num_args(),
159 func_get_args()
160 );
161
162 return $this->request->getURI();
163 }
164
165 private function _rf_getIP() {
166 $args = $this->processRuleFunctionParams(
167 'getIP',
168 func_num_args(),
169 func_get_args()
170 );
171
172 return $this->request->getIP();
173 }
174
175 private function _rf_getTimestamp() {
176 $args = $this->processRuleFunctionParams(
177 'getTimestamp',
178 func_num_args(),
179 func_get_args()
180 );
181
182 return $this->request->getTimeStamp();
183 }
184
185 private function _rf_getContentType() {
186 $args = $this->processRuleFunctionParams(
187 'getContentType',
188 func_num_args(),
189 func_get_args()
190 );
191
192 return $this->request->getContentType();
193 }
194
195 private function _rf_getAllParams() {
196 $args = $this->processRuleFunctionParams(
197 'getAllParams',
198 func_num_args(),
199 func_get_args()
200 );
201
202 return $this->request->getAllParams();
203 }
204
205 private function _rf_getPostParamValV2() {
206 $args = $this->processRuleFunctionParams(
207 'getPostParamValV2',
208 func_num_args(),
209 func_get_args(),
210 1
211 );
212 $key = $args[0];
213
214 return $this->_rf_getArrayVal($this->_rf_getPostParamsV2(), $key);
215 }
216
217 private function _rf_digPostParamsV2() {
218 $args = $this->processRuleFunctionParams(
219 'digPostParamsV2',
220 func_num_args(),
221 func_get_args(),
222 1
223 );
224 $keys = $args[0];
225
226 return $this->_rf_digArray($this->_rf_getPostParamsV2(), $keys);
227 }
228
229 private function _rf_getGetParamValV2() {
230 $args = $this->processRuleFunctionParams(
231 'getGetParamValV2',
232 func_num_args(),
233 func_get_args(),
234 1
235 );
236 $key = $args[0];
237
238 return $this->_rf_getArrayVal($this->_rf_getGetParamsV2(), $key);
239 }
240
241 private function _rf_digGetParamsV2() {
242 $args = $this->processRuleFunctionParams(
243 'digGetParamsV2',
244 func_num_args(),
245 func_get_args(),
246 1
247 );
248 $keys = $args[0];
249
250 return $this->_rf_digArray($this->_rf_getGetParamsV2(), $keys);
251 }
252
253 private function _rf_getCookiesV2() {
254 $this->processRuleFunctionParams(
255 'getCookiesV2',
256 func_num_args(),
257 func_get_args()
258 );
259
260 return $this->request->getCookiesV2();
261 }
262
263 private function _rf_getFilesV2() {
264 $this->processRuleFunctionParams(
265 'getFilesV2',
266 func_num_args(),
267 func_get_args()
268 );
269
270 return $this->request->getFilesV2();
271 }
272
273 private function _rf_getFileNamesV2() {
274 $this->processRuleFunctionParams(
275 'getFileNamesV2',
276 func_num_args(),
277 func_get_args()
278 );
279
280 return $this->request->getFileNamesV2();
281 }
282
283 private function _rf_getHeadersV2() {
284 $this->processRuleFunctionParams(
285 'getHeadersV2',
286 func_num_args(),
287 func_get_args()
288 );
289
290 return $this->request->getHeadersV2();
291 }
292
293 private function _rf_getGetParamsV2() {
294 $this->processRuleFunctionParams(
295 'getGetParamsV2',
296 func_num_args(),
297 func_get_args()
298 );
299
300 return $this->request->getGetParamsV2();
301 }
302
303 private function _rf_getPostParamsV2() {
304 $this->processRuleFunctionParams(
305 'getPostParamsV2',
306 func_num_args(),
307 func_get_args()
308 );
309
310 return $this->request->getPostParamsV2();
311 }
312
313 private function _rf_getJsonParams() {
314 $this->processRuleFunctionParams(
315 'getJsonParams',
316 func_num_args(),
317 func_get_args()
318 );
319
320 return $this->request->getJsonParams();
321 }
322
323 private function _rf_getRawBody() {
324 $this->processRuleFunctionParams(
325 'getRawBody',
326 func_num_args(),
327 func_get_args()
328 );
329
330 return $this->request->getRawBody();
331 }
332
333 private function _rf_getUploadedFileContent() {
334 $args = $this->processRuleFunctionParams(
335 'getUploadedFileContent',
336 func_num_args(),
337 func_get_args(),
338 2
339 );
340
341 return $this->request->getUploadedFileContent(
342 $args[0],
343 $args[1],
344 isset($args[2]) ? $args[2] : null
345 );
346 }
347
348 private function _rf_getUploadedFileName() {
349 $args = $this->processRuleFunctionParams(
350 'getUploadedFileName',
351 func_num_args(),
352 func_get_args(),
353 1
354 );
355
356 return $this->request->getUploadedFileMeta(
357 $args[0],
358 'name',
359 isset($args[1]) ? $args[1] : null
360 );
361 }
362
363 private function _rf_getUploadedFileType() {
364 $args = $this->processRuleFunctionParams(
365 'getUploadedFileType',
366 func_num_args(),
367 func_get_args(),
368 1
369 );
370
371 return $this->request->getUploadedFileMeta(
372 $args[0],
373 'type',
374 isset($args[1]) ? $args[1] : null
375 );
376 }
377
378 private function _rf_getUploadedFileSize() {
379 $args = $this->processRuleFunctionParams(
380 'getUploadedFileSize',
381 func_num_args(),
382 func_get_args(),
383 1
384 );
385
386 return $this->request->getUploadedFileMeta(
387 $args[0],
388 'size',
389 isset($args[1]) ? $args[1] : null
390 );
391 }
392
393 private function _rf_getUploadedFileError() {
394 $args = $this->processRuleFunctionParams(
395 'getUploadedFileError',
396 func_num_args(),
397 func_get_args(),
398 1
399 );
400
401 return $this->request->getUploadedFileMeta(
402 $args[0],
403 'error',
404 isset($args[1]) ? $args[1] : null
405 );
406 }
407
408 private function _rf_getUploadedFileContentStatus() {
409 $args = $this->processRuleFunctionParams(
410 'getUploadedFileContentStatus',
411 func_num_args(),
412 func_get_args()
413 );
414
415 return $this->request->getUploadedFileContentStatus(
416 isset($args[0]) ? $args[0] : null,
417 isset($args[1]) ? $args[1] : null
418 );
419 }
420
421 private function _rf_wpUserRoleLevel() {
422 $args = $this->processRuleFunctionParams(
423 'wpUserRoleLevel',
424 func_num_args(),
425 func_get_args()
426 );
427
428 $wp_user_role_level = isset($this->request->wp_user) ? $this->request->wp_user->role_level : 0;
429
430 return $wp_user_role_level;
431 }
432
433 private function _rf_isWPUserRoleLevel() {
434 $args = $this->processRuleFunctionParams(
435 'isWPUserRoleLevel',
436 func_num_args(),
437 func_get_args(),
438 1,
439 ["integer"]
440 );
441 $role_level = $args[0];
442
443 return ($role_level === $this->_rf_wpUserRoleLevel());
444 }
445
446 private function _rf_wpUserInfo() {
447 $args = $this->processRuleFunctionParams(
448 'wpUserInfo',
449 func_num_args(),
450 func_get_args()
451 );
452
453 $wp_user_info = isset($this->request->wp_user) ? $this->request->wp_user->getInfo() : array();
454
455 return $wp_user_info;
456 }
457
458 private function _rf_wpUserCapabilities() {
459 $args = $this->processRuleFunctionParams(
460 'wpUserCapabilities',
461 func_num_args(),
462 func_get_args()
463 );
464
465 if (isset($this->request->wp_user)) {
466 return $this->request->wp_user->capability_names;
467 }
468
469 return $this->_rf_getCurrentWPUserCapabilities();
470 }
471
472 private function _rf_wpUserRole() {
473 $args = $this->processRuleFunctionParams(
474 'wpUserRole',
475 func_num_args(),
476 func_get_args()
477 );
478
479 $wp_user_role = isset($this->request->wp_user) ? $this->request->wp_user->role : null;
480
481 return $wp_user_role;
482 }
483
484 private function _rf_wpUserId() {
485 $args = $this->processRuleFunctionParams(
486 'wpUserId',
487 func_num_args(),
488 func_get_args()
489 );
490
491 if (isset($this->request->wp_user)) {
492 return $this->request->wp_user->id;
493 }
494
495 $user = $this->_rf_getCurrentWPUser();
496
497 if (!array_key_exists('ID', $user)) {
498 throw new WPRProtectRuleError_V676(
499 $this->addExState("wpUserId: user's id doesn't exist")
500 );
501 }
502
503 return $user['ID'];
504 }
505
506 private function _rf_isWPUserLoggedIn() {
507 $args = $this->processRuleFunctionParams(
508 'isWPUserLoggedIn',
509 func_num_args(),
510 func_get_args()
511 );
512
513 $is_user_logged_in = isset($this->request->wp_user) ? $this->request->wp_user->isLoggedIn() :
514 $this->_rf_isUserLoggedIn();
515
516 return $is_user_logged_in;
517 }
518
519 private function _rf_wpUserCan() {
520 $args = $this->processRuleFunctionParams(
521 'wpUserCan',
522 func_num_args(),
523 func_get_args(),
524 1,
525 ['string']
526 );
527 $capability = $args[0];
528
529 if (isset($this->request->wp_user)) {
530 return $this->_rf_inArray($capability, $this->_rf_wpUserCapabilities(), true);
531 }
532
533 return $this->_rf_currentUserCan($capability);
534 }
535 }
536 endif;
537