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