| @@ -191,8 +191,27 @@ | ||
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /** |
| 195 | + * Get Default Search Parameters. | |
| 196 | + * | |
| 197 | + * @return array | |
| 198 | + */ | |
| 199 | + public function get_default_arr_search() { | |
| 200 | + return array( | |
| 201 | + 'period' => '3', | |
| 202 | + 'member_column' => array( '', '' ), | |
| 203 | + 'member_word' => array( '', '' ), | |
| 204 | + 'member_word_term' => array( 'contain', 'contain' ), | |
| 205 | + 'member_term' => 'AND', | |
| 206 | + 'order_column' => array( '', '' ), | |
| 207 | + 'order_word' => array( '', '' ), | |
| 208 | + 'order_word_term' => array( 'contain', 'contain' ), | |
| 209 | + 'order_term' => 'AND', | |
| 210 | + ); | |
| 211 | + } | |
| 212 | + | |
| 213 | + /** | |
| 195 | 214 | * Default Parameters. |
| 196 | 215 | */ |
| 197 | 216 | public function SetDefaultParam() { |
| 198 | 217 | $this->startRow = isset( $this->data_cookie['startRow'] ) ? $this->data_cookie['startRow'] : 0; |
| @@ -202,19 +221,9 @@ | ||
| 202 | 221 | $this->searchHaving = ( isset( $this->data_cookie['searchHaving'] ) ) ? $this->data_cookie['searchHaving'] : ''; |
| 203 | 222 | if ( isset( $this->data_cookie['arr_search'] ) ) { |
| 204 | 223 | $this->arr_search = $this->data_cookie['arr_search']; |
| 205 | 224 | } else { |
| 206 | - $this->arr_search = array( | |
| 207 | - 'period' => '3', | |
| 208 | - 'member_column' => array( '', '' ), | |
| 209 | - 'member_word' => array( '', '' ), | |
| 210 | - 'member_word_term' => array( 'contain', 'contain' ), | |
| 211 | - 'member_term' => 'AND', | |
| 212 | - 'order_column' => array( '', '' ), | |
| 213 | - 'order_word' => array( '', '' ), | |
| 214 | - 'order_word_term' => array( 'contain', 'contain' ), | |
| 215 | - 'order_term' => 'AND', | |
| 216 | - ); | |
| 225 | + $this->arr_search = $this->get_default_arr_search(); | |
| 217 | 226 | } |
| 218 | 227 | if ( isset( $this->data_cookie['sortSwitchs'] ) ) { |
| 219 | 228 | $this->sortSwitchs = $this->data_cookie['sortSwitchs']; |
| 220 | 229 | foreach ( $this->csmb_meta as $key => $value ) { |
| @@ -394,8 +403,10 @@ | ||
| 394 | 403 | /** |
| 395 | 404 | * Validation Search Parameters. |
| 396 | 405 | */ |
| 397 | 406 | public function validationSearchParameters() { |
| 407 | + $this->arr_search = wp_parse_args( (array) $this->arr_search, $this->get_default_arr_search() ); | |
| 408 | + | |
| 398 | 409 | $default_member_word_term = [ 'contain', 'notcontain', 'equal', 'morethan', 'lessthan' ]; |
| 399 | 410 | $default_order_word_term = [ 'contain', 'notcontain', 'equal', 'morethan', 'lessthan' ]; |
| 400 | 411 | $default_order_term = [ 'AND', 'OR' ]; |
| 401 | 412 | $default_member_term = [ 'AND', 'OR' ]; |