| @@ -44,9 +44,9 @@ | ||
| 44 | 44 | /** |
| 45 | 45 | * Get value by key from $_REQUEST |
| 46 | 46 | * |
| 47 | 47 | * @param string $key |
| 48 | - * @param mixed $default | |
| 48 | + * @param mixed $default_value | |
| 49 | 49 | * @param string $sanitize_type |
| 50 | 50 | * @param string $method |
| 51 | 51 | * |
| 52 | 52 | * @since 4.1.7.2 |
| @@ -52,10 +52,10 @@ | ||
| 52 | 52 | * @since 4.1.7.2 |
| 53 | 53 | * @version 1.0.0 |
| 54 | 54 | * @return array|float|int|string |
| 55 | 55 | */ |
| 56 | - public static function get_param( string $key, $default = '', string $sanitize_type = 'text', string $method = '' ) { | |
| 57 | - switch ( $method ) { | |
| 56 | + public static function get_param( string $key, $default_value = '', string $sanitize_type = 'text', string $method = '' ) { | |
| 57 | + switch ( strtolower( $method ) ) { | |
| 58 | 58 | case 'post': |
| 59 | 59 | $values = $_POST ?? []; |
| 60 | 60 | break; |
| 61 | 61 | case 'get': |
| @@ -64,9 +64,9 @@ | ||
| 64 | 64 | default: |
| 65 | 65 | $values = $_REQUEST ?? []; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - return LP_Helper::sanitize_params_submitted( $values[ $key ] ?? $default, $sanitize_type ); | |
| 68 | + return LP_Helper::sanitize_params_submitted( $values[ $key ] ?? $default_value, $sanitize_type ); | |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | public static function get_header() { |
| 72 | 72 | ob_start(); |
| @@ -175,9 +175,9 @@ | ||
| 175 | 175 | if ( ! defined( 'LP_DOING_AJAX' ) ) { |
| 176 | 176 | define( 'LP_DOING_AJAX', true ); |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - LP_Gateways::instance()->get_available_payment_gateways(); | |
| 179 | + //LP_Gateways::instance()->get_available_payment_gateways(); | |
| 180 | 180 | |
| 181 | 181 | if ( has_filter( 'learn-press/ajax/verify-none/' . $action ) ) { |
| 182 | 182 | if ( ! self::verify_nonce( $action ) ) { |
| 183 | 183 | die( '0' ); |
| @@ -206,9 +206,9 @@ | ||
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | public static function verify_nonce( $action, $nonce = '' ) { |
| 210 | - 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 ); | |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | public static function parse_action( $action ) { |
| 214 | 214 | $args = explode( ':', $action ); |
| @@ -234,8 +234,9 @@ | ||
| 234 | 234 | * @param string $type |
| 235 | 235 | * @param string $env |
| 236 | 236 | * |
| 237 | 237 | * @return mixed |
| 238 | + * @deprecated 4.2.1 | |
| 238 | 239 | */ |
| 239 | 240 | public static function get( $var, $default = false, $type = '', $env = 'request' ) { |
| 240 | 241 | switch ( strtolower( $env ) ) { |
| 241 | 242 | case 'post': |
| @@ -301,8 +302,9 @@ | ||
| 301 | 302 | * @param mixed $default |
| 302 | 303 | * @param string $env |
| 303 | 304 | * |
| 304 | 305 | * @return int |
| 306 | + * @deprecated | |
| 305 | 307 | */ |
| 306 | 308 | public static function get_int( $var, $default = false, $env = 'request' ) { |
| 307 | 309 | return self::get( $var, $default, 'int', $env ); |
| 308 | 310 | } |
| @@ -340,8 +342,9 @@ | ||
| 340 | 342 | * @param mixed $default |
| 341 | 343 | * @param string $env |
| 342 | 344 | * |
| 343 | 345 | * @return string |
| 346 | + * @deprecated 4.2.7.4 | |
| 344 | 347 | */ |
| 345 | 348 | public static function get_string( $var, $default = false, $env = 'request' ) { |
| 346 | 349 | return self::get( $var, $default, 'string', $env ); |
| 347 | 350 | } |
| @@ -509,18 +512,12 @@ | ||
| 509 | 512 | return $redirect; |
| 510 | 513 | } |
| 511 | 514 | |
| 512 | 515 | public static function get_cookie( $name, $def = false, $global = false ) { |
| 513 | - if ( $global ) { | |
| 514 | - return $_COOKIE[ $name ] ?? $def; | |
| 515 | - } | |
| 516 | - | |
| 517 | - $cookie = isset( $_COOKIE['LP'] ) ? (array) json_decode( stripslashes( $_COOKIE['LP'] ) ) : array(); | |
| 518 | - | |
| 519 | - return $cookie[ $name ] ?? $def; | |
| 516 | + return $_COOKIE[ $name ] ?? $def; | |
| 520 | 517 | } |
| 521 | 518 | |
| 522 | - 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 ) { | |
| 523 | 520 | if ( func_num_args() > 2 ) { |
| 524 | 521 | learn_press_setcookie( $name, $value, $expires, $secure ); |
| 525 | 522 | } else { |
| 526 | 523 | $cookie = isset( $_COOKIE['LP'] ) ? maybe_unserialize( $_COOKIE['LP'] ) : array(); |
| @@ -527,13 +524,8 @@ | ||
| 527 | 524 | |
| 528 | 525 | $cookie[ $name ] = $value; |
| 529 | 526 | learn_press_setcookie( 'LP', $value ); |
| 530 | 527 | } |
| 531 | - } | |
| 528 | + }*/ | |
| 532 | 529 | } |
| 533 | 530 | |
| 534 | 531 | LP_Request::init(); |
| 535 | - | |
| 536 | -// Backward compatibility for 2.x.x | |
| 537 | -class LP_Request_Handler extends LP_Request { | |
| 538 | - | |
| 539 | -} | |