PluginProbe
The WP Remote WordPress Plugin / 5.42
The WP Remote WordPress Plugin v5.42
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 5.73 All 53 releases
wpremote / protect / fw / rule / functions / request.php

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

413 lines 8.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH') && !defined('MCDATAPATH')) exit;
3
4 if (!trait_exists('WPRProtectFWRuleRequestFunc_V542')) :
5 trait WPRProtectFWRuleRequestFunc_V542 {
6 private function _rf_getAction() {
7 $args = $this->processRuleFunctionParams(
8 'getAction',
9 func_num_args(),
10 func_get_args()
11 );
12
13 return $this->request->getAction();
14 }
15
16 private function _rf_getPath() {
17 $args = $this->processRuleFunctionParams(
18 'getPath',
19 func_num_args(),
20 func_get_args()
21 );
22
23 return $this->request->getPath();
24 }
25
26 private function _rf_getServerValue() {
27 $args = $this->processRuleFunctionParams(
28 'getServerValue',
29 func_num_args(),
30 func_get_args(),
31 1
32 );
33 $key = $args[0];
34
35 return $this->request->getServerValue($key);
36 }
37
38 private function _rf_getHeader() {
39 $args = $this->processRuleFunctionParams(
40 'getHeader',
41 func_num_args(),
42 func_get_args(),
43 1
44 );
45 $key = $args[0];
46
47 return $this->request->getHeader($key);
48 }
49
50 private function _rf_getHeaders() {
51 $args = $this->processRuleFunctionParams(
52 'getHeaders',
53 func_num_args(),
54 func_get_args()
55 );
56
57 return $this->request->getHeaders();
58 }
59
60 private function _rf_getPostParams() {
61 $args = $this->processRuleFunctionParams(
62 'getPostParams',
63 func_num_args(),
64 func_get_args()
65 );
66
67 if (!empty($args)) {
68 return $this->request->getPostParams($args);
69 }
70
71 return $this->request->getPostParams();
72 }
73
74 private function _rf_getReqMethod() {
75 $args = $this->processRuleFunctionParams(
76 'getReqMethod',
77 func_num_args(),
78 func_get_args()
79 );
80
81 return $this->request->getMethod();
82 }
83
84 private function _rf_getGetParams() {
85 $args = $this->processRuleFunctionParams(
86 'getGetParams',
87 func_num_args(),
88 func_get_args()
89 );
90
91 if (!empty($args)) {
92 return $this->request->getGetParams($args);
93 }
94
95 return $this->request->getGetParams();
96 }
97
98 private function _rf_getCookies() {
99 $args = $this->processRuleFunctionParams(
100 'getCookies',
101 func_num_args(),
102 func_get_args()
103 );
104
105 if (!empty($args)) {
106 return $this->request->getCookies($args);
107 }
108
109 return $this->request->getCookies();
110 }
111
112 private function _rf_getFiles() {
113 $args = $this->processRuleFunctionParams(
114 'getFiles',
115 func_num_args(),
116 func_get_args()
117 );
118
119 if (!empty($args)) {
120 return $this->request->getFiles($args);
121 }
122
123 return $this->request->getFiles();
124 }
125
126 private function _rf_getFileNames() {
127 $args = $this->processRuleFunctionParams(
128 'getFileNames',
129 func_num_args(),
130 func_get_args()
131 );
132
133 if (!empty($args)) {
134 return $this->request->getFileNames($args);
135 }
136
137 return $this->request->getFileNames();
138 }
139
140 private function _rf_getHost() {
141 $args = $this->processRuleFunctionParams(
142 'getHost',
143 func_num_args(),
144 func_get_args()
145 );
146
147 return $this->request->host;
148 }
149
150 private function _rf_getURI() {
151 $args = $this->processRuleFunctionParams(
152 'getURI',
153 func_num_args(),
154 func_get_args()
155 );
156
157 return $this->request->getURI();
158 }
159
160 private function _rf_getIP() {
161 $args = $this->processRuleFunctionParams(
162 'getIP',
163 func_num_args(),
164 func_get_args()
165 );
166
167 return $this->request->getIP();
168 }
169
170 private function _rf_getTimestamp() {
171 $args = $this->processRuleFunctionParams(
172 'getTimestamp',
173 func_num_args(),
174 func_get_args()
175 );
176
177 return $this->request->getTimeStamp();
178 }
179
180 private function _rf_getAllParams() {
181 $args = $this->processRuleFunctionParams(
182 'getAllParams',
183 func_num_args(),
184 func_get_args()
185 );
186
187 return $this->request->getAllParams();
188 }
189
190 private function _rf_getPostParamValV2() {
191 $args = $this->processRuleFunctionParams(
192 'getPostParamValV2',
193 func_num_args(),
194 func_get_args(),
195 1
196 );
197 $key = $args[0];
198
199 return $this->_rf_getArrayVal($this->_rf_getPostParamsV2(), $key);
200 }
201
202 private function _rf_digPostParamsV2() {
203 $args = $this->processRuleFunctionParams(
204 'digPostParamsV2',
205 func_num_args(),
206 func_get_args(),
207 1
208 );
209 $keys = $args[0];
210
211 return $this->_rf_digArray($this->_rf_getPostParamsV2(), $keys);
212 }
213
214 private function _rf_getGetParamValV2() {
215 $args = $this->processRuleFunctionParams(
216 'getGetParamValV2',
217 func_num_args(),
218 func_get_args(),
219 1
220 );
221 $key = $args[0];
222
223 return $this->_rf_getArrayVal($this->_rf_getGetParamsV2(), $key);
224 }
225
226 private function _rf_digGetParamsV2() {
227 $args = $this->processRuleFunctionParams(
228 'digGetParamsV2',
229 func_num_args(),
230 func_get_args(),
231 1
232 );
233 $keys = $args[0];
234
235 return $this->_rf_digArray($this->_rf_getGetParamsV2(), $keys);
236 }
237
238 private function _rf_getCookiesV2() {
239 $this->processRuleFunctionParams(
240 'getCookiesV2',
241 func_num_args(),
242 func_get_args()
243 );
244
245 return $this->request->getCookiesV2();
246 }
247
248 private function _rf_getFilesV2() {
249 $this->processRuleFunctionParams(
250 'getFilesV2',
251 func_num_args(),
252 func_get_args()
253 );
254
255 return $this->request->getFilesV2();
256 }
257
258 private function _rf_getFileNamesV2() {
259 $this->processRuleFunctionParams(
260 'getFileNamesV2',
261 func_num_args(),
262 func_get_args()
263 );
264
265 return $this->request->getFileNamesV2();
266 }
267
268 private function _rf_getHeadersV2() {
269 $this->processRuleFunctionParams(
270 'getHeadersV2',
271 func_num_args(),
272 func_get_args()
273 );
274
275 return $this->request->getHeadersV2();
276 }
277
278 private function _rf_getGetParamsV2() {
279 $this->processRuleFunctionParams(
280 'getGetParamsV2',
281 func_num_args(),
282 func_get_args()
283 );
284
285 return $this->request->getGetParamsV2();
286 }
287
288 private function _rf_getPostParamsV2() {
289 $this->processRuleFunctionParams(
290 'getPostParamsV2',
291 func_num_args(),
292 func_get_args()
293 );
294
295 return $this->request->getPostParamsV2();
296 }
297
298 private function _rf_wpUserRoleLevel() {
299 $args = $this->processRuleFunctionParams(
300 'wpUserRoleLevel',
301 func_num_args(),
302 func_get_args()
303 );
304
305 $wp_user_role_level = isset($this->request->wp_user) ? $this->request->wp_user->role_level : 0;
306
307 return $wp_user_role_level;
308 }
309
310 private function _rf_isWPUserRoleLevel() {
311 $args = $this->processRuleFunctionParams(
312 'isWPUserRoleLevel',
313 func_num_args(),
314 func_get_args(),
315 1,
316 ["integer"]
317 );
318 $role_level = $args[0];
319
320 return ($role_level === $this->_rf_wpUserRoleLevel());
321 }
322
323 private function _rf_wpUserInfo() {
324 $args = $this->processRuleFunctionParams(
325 'wpUserInfo',
326 func_num_args(),
327 func_get_args()
328 );
329
330 $wp_user_info = isset($this->request->wp_user) ? $this->request->wp_user->getInfo() : array();
331
332 return $wp_user_info;
333 }
334
335 private function _rf_wpUserCapabilities() {
336 $args = $this->processRuleFunctionParams(
337 'wpUserCapabilities',
338 func_num_args(),
339 func_get_args()
340 );
341
342 if (isset($this->request->wp_user)) {
343 return $this->request->wp_user->capability_names;
344 }
345
346 return $this->_rf_getCurrentWPUserCapabilities();
347 }
348
349 private function _rf_wpUserRole() {
350 $args = $this->processRuleFunctionParams(
351 'wpUserRole',
352 func_num_args(),
353 func_get_args()
354 );
355
356 $wp_user_role = isset($this->request->wp_user) ? $this->request->wp_user->role : null;
357
358 return $wp_user_role;
359 }
360
361 private function _rf_wpUserId() {
362 $args = $this->processRuleFunctionParams(
363 'wpUserId',
364 func_num_args(),
365 func_get_args()
366 );
367
368 if (isset($this->request->wp_user)) {
369 return $this->request->wp_user->id;
370 }
371
372 $user = $this->_rf_getCurrentWPUser();
373
374 if (!array_key_exists('ID', $user)) {
375 throw new WPRProtectRuleError_V542(
376 $this->addExState("wpUserId: user's id doesn't exist")
377 );
378 }
379
380 return $user['ID'];
381 }
382
383 private function _rf_isWPUserLoggedIn() {
384 $args = $this->processRuleFunctionParams(
385 'isWPUserLoggedIn',
386 func_num_args(),
387 func_get_args()
388 );
389
390 $is_user_logged_in = isset($this->request->wp_user) ? $this->request->wp_user->isLoggedIn() :
391 $this->_rf_isUserLoggedIn();
392
393 return $is_user_logged_in;
394 }
395
396 private function _rf_wpUserCan() {
397 $args = $this->processRuleFunctionParams(
398 'wpUserCan',
399 func_num_args(),
400 func_get_args(),
401 1,
402 ['string']
403 );
404 $capability = $args[0];
405
406 if (isset($this->request->wp_user)) {
407 return $this->_rf_inArray($capability, $this->_rf_wpUserCapabilities(), true);
408 }
409
410 return $this->_rf_currentUserCan($capability);
411 }
412 }
413 endif;