| @@ -372,8 +372,29 @@ | ||
| 372 | 372 | } |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | /** |
| 376 | + * Get Default Search Parameters. | |
| 377 | + * | |
| 378 | + * @return array | |
| 379 | + */ | |
| 380 | + public function get_default_arr_search() { | |
| 381 | + $arr_search = array( | |
| 382 | + 'period' => array( '', '' ), | |
| 383 | + 'order_column' => array( '', '' ), | |
| 384 | + 'order_word' => array( '', '' ), | |
| 385 | + 'order_word_term' => array( 'contain', 'contain' ), | |
| 386 | + 'order_term' => 'AND', | |
| 387 | + 'product_column' => array( '', '' ), | |
| 388 | + 'product_word' => array( '', '' ), | |
| 389 | + 'product_word_term' => array( 'contain', 'contain' ), | |
| 390 | + 'option_word' => array( '', '' ), | |
| 391 | + 'product_term' => 'AND', | |
| 392 | + ); | |
| 393 | + return apply_filters( 'usces_filter_order_list_arr_search', $arr_search, $this ); | |
| 394 | + } | |
| 395 | + | |
| 396 | + /** | |
| 376 | 397 | * Default Parameters. |
| 377 | 398 | */ |
| 378 | 399 | public function SetDefaultParam() { |
| 379 | 400 | $this->startRow = isset( $this->data_cookie['startRow'] ) ? $this->data_cookie['startRow'] : 0; |
| @@ -384,21 +405,9 @@ | ||
| 384 | 405 | $this->searchSwitchStatus = ( isset( $this->data_cookie['searchSwitchStatus'] ) ) ? $this->data_cookie['searchSwitchStatus'] : 'OFF'; |
| 385 | 406 | if ( isset( $this->data_cookie['arr_search'] ) ) { |
| 386 | 407 | $this->arr_search = $this->data_cookie['arr_search']; |
| 387 | 408 | } else { |
| 388 | - $arr_search = array( | |
| 389 | - 'period' => array( '', '' ), | |
| 390 | - 'order_column' => array( '', '' ), | |
| 391 | - 'order_word' => array( '', '' ), | |
| 392 | - 'order_word_term' => array( 'contain', 'contain' ), | |
| 393 | - 'order_term' => 'AND', | |
| 394 | - 'product_column' => array( '', '' ), | |
| 395 | - 'product_word' => array( '', '' ), | |
| 396 | - 'product_word_term' => array( 'contain', 'contain' ), | |
| 397 | - 'option_word' => array( '', '' ), | |
| 398 | - 'product_term' => 'AND', | |
| 399 | - ); | |
| 400 | - $this->arr_search = apply_filters( 'usces_filter_order_list_arr_search', $arr_search, $this ); | |
| 409 | + $this->arr_search = $this->get_default_arr_search(); | |
| 401 | 410 | } |
| 402 | 411 | if ( isset( $this->data_cookie['sortSwitchs'] ) ) { |
| 403 | 412 | $this->sortSwitchs = $this->data_cookie['sortSwitchs']; |
| 404 | 413 | } else { |
| @@ -572,8 +581,10 @@ | ||
| 572 | 581 | /** |
| 573 | 582 | * Validation Search Parameters. |
| 574 | 583 | */ |
| 575 | 584 | public function validationSearchParameters() { |
| 585 | + $this->arr_search = wp_parse_args( (array) $this->arr_search, $this->get_default_arr_search() ); | |
| 586 | + | |
| 576 | 587 | $default_order_word_term = [ 'contain', 'notcontain', 'equal', 'morethan', 'lessthan' ]; |
| 577 | 588 | $default_product_word_term = [ 'contain', 'notcontain', 'equal', 'morethan', 'lessthan' ]; |
| 578 | 589 | $default_order_term = [ 'AND', 'OR' ]; |
| 579 | 590 | $default_product_term = [ 'AND', 'OR' ]; |