PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.8
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.8
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
← All changes | inc/class-lp-request-handler.php +38 -19 4.1.6.9.24.4.8 View file →
@@ -40,8 +40,35 @@
40 40
41 41 add_action( 'wp_loaded', array( 'LP_Forms_Handler', 'init' ), 10 );
42 42 }
43 43
44 + /**
45 + * Get value by key from $_REQUEST
46 + *
47 + * @param string $key
48 + * @param mixed $default_value
49 + * @param string $sanitize_type
50 + * @param string $method
51 + *
52 + * @since 4.1.7.2
53 + * @version 1.0.0
54 + * @return array|float|int|string
55 + */
56 + public static function get_param( string $key, $default_value = '', string $sanitize_type = 'text', string $method = '' ) {
57 + switch ( strtolower( $method ) ) {
58 + case 'post':
59 + $values = $_POST ?? [];
60 + break;
61 + case 'get':
62 + $values = $_GET ?? [];
63 + break;
64 + default:
65 + $values = $_REQUEST ?? [];
66 + }
67 +
68 + return LP_Helper::sanitize_params_submitted( $values[ $key ] ?? $default_value, $sanitize_type );
69 + }
70 +
44 71 public static function get_header() {
45 72 ob_start();
46 73 }
47 74
@@ -148,9 +175,9 @@
148 175 if ( ! defined( 'LP_DOING_AJAX' ) ) {
149 176 define( 'LP_DOING_AJAX', true );
150 177 }
151 178
152 - LP_Gateways::instance()->get_available_payment_gateways();
179 + //LP_Gateways::instance()->get_available_payment_gateways();
153 180
154 181 if ( has_filter( 'learn-press/ajax/verify-none/' . $action ) ) {
155 182 if ( ! self::verify_nonce( $action ) ) {
156 183 die( '0' );
@@ -179,9 +206,9 @@
179 206 }
180 207 }
181 208
182 209 public static function verify_nonce( $action, $nonce = '' ) {
183 - return wp_verify_nonce( $nonce ? $nonce : self::get_string( "{$action}-nonce" ), $action );
210 + return wp_verify_nonce( $nonce ? $nonce : self::get_param( "{$action}-nonce" ), $action );
184 211 }
185 212
186 213 public static function parse_action( $action ) {
187 214 $args = explode( ':', $action );
@@ -207,16 +234,17 @@
207 234 * @param string $type
208 235 * @param string $env
209 236 *
210 237 * @return mixed
238 + * @deprecated 4.2.1
211 239 */
212 240 public static function get( $var, $default = false, $type = '', $env = 'request' ) {
213 241 switch ( strtolower( $env ) ) {
214 242 case 'post':
215 - $env = $_POST;
243 + $env = LP_Helper::sanitize_params_submitted( $_POST );
216 244 break;
217 245 case 'get':
218 - $env = $_GET;
246 + $env = LP_Helper::sanitize_params_submitted( $_GET );
219 247 break;
220 248 case 'put':
221 249 case 'delete':
222 250 $data = file_get_contents( 'php://input' );
@@ -227,9 +255,9 @@
227 255 global $wp;
228 256 $env = $wp->query_vars;
229 257 break;
230 258 default:
231 - $env = $_REQUEST;
259 + $env = LP_Helper::sanitize_params_submitted( $_REQUEST );
232 260 }
233 261
234 262 $return = array_key_exists( $var, $env ) ? $env[ $var ] : $default;
235 263 switch ( $type ) {
@@ -274,8 +302,9 @@
274 302 * @param mixed $default
275 303 * @param string $env
276 304 *
277 305 * @return int
306 + * @deprecated
278 307 */
279 308 public static function get_int( $var, $default = false, $env = 'request' ) {
280 309 return self::get( $var, $default, 'int', $env );
281 310 }
@@ -313,8 +342,9 @@
313 342 * @param mixed $default
314 343 * @param string $env
315 344 *
316 345 * @return string
346 + * @deprecated 4.2.7.4
317 347 */
318 348 public static function get_string( $var, $default = false, $env = 'request' ) {
319 349 return self::get( $var, $default, 'string', $env );
320 350 }
@@ -482,18 +512,12 @@
482 512 return $redirect;
483 513 }
484 514
485 515 public static function get_cookie( $name, $def = false, $global = false ) {
486 - if ( $global ) {
487 - return $_COOKIE[ $name ] ?? $def;
488 - }
489 -
490 - $cookie = isset( $_COOKIE['LP'] ) ? (array) json_decode( stripslashes( $_COOKIE['LP'] ) ) : array();
491 -
492 - return $cookie[ $name ] ?? $def;
516 + return $_COOKIE[ $name ] ?? $def;
493 517 }
494 518
495 - public static function set_cookie( $name, $value, $expires = '', $domain = '', $path = '', $secure = false ) {
519 + /*public static function set_cookie( $name, $value, $expires = '', $domain = '', $path = '', $secure = false ) {
496 520 if ( func_num_args() > 2 ) {
497 521 learn_press_setcookie( $name, $value, $expires, $secure );
498 522 } else {
499 523 $cookie = isset( $_COOKIE['LP'] ) ? maybe_unserialize( $_COOKIE['LP'] ) : array();
@@ -500,13 +524,8 @@
500 524
501 525 $cookie[ $name ] = $value;
502 526 learn_press_setcookie( 'LP', $value );
503 527 }
504 - }
528 + }*/
505 529 }
506 530
507 531 LP_Request::init();
508 -
509 -// Backward compatibility for 2.x.x
510 -class LP_Request_Handler extends LP_Request {
511 -
512 -}