Changeset 15755
- Timestamp:
- 10/08/2010 02:27:22 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/classes.php
r15750 r15755 276 276 if ( !empty( $this->query_vars[$wpvar] ) ) { 277 277 if ( ! is_array( $this->query_vars[$wpvar] ) ) { 278 $this->query_vars[$wpvar] = (string) $this->query_vars[$wpvar]; 278 $this->query_vars[$wpvar] = (string) $this->query_vars[$wpvar]; 279 279 } else { 280 280 foreach ( $this->query_vars[$wpvar] as $vkey => $v ) … … 551 551 * - 'key' string The meta key 552 552 * - 'value' string|array The meta value 553 * - 'compare' (optional) string How to compare the key to the value. 554 * Possible values: '=', '!=', '>', '>=', '<', '<=', 'LIKE', ' IN', 'BETWEEN'.553 * - 'compare' (optional) string How to compare the key to the value. 554 * Possible values: '=', '!=', '>', '>=', '<', '<=', 'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN'. 555 555 * Default: '=' 556 556 * - 'type' string (optional) The type of the value. 557 * Possible values: 'NUMERIC', 'BINARY', 'CHAR', 'DATE', 'DATETIME', 'DECIMAL', 'SIGNED', 'TIME', 'UNSIGNED'. 557 * Possible values: 'NUMERIC', 'BINARY', 'CHAR', 'DATE', 'DATETIME', 'DECIMAL', 'SIGNED', 'TIME', 'UNSIGNED'. 558 558 * Default: 'CHAR' 559 559 * … … 574 574 * Default: 'slug' 575 575 * - 'operator' string (optional) 576 * Possible values: 'IN' and 'NOT IN'. 576 * Possible values: 'IN' and 'NOT IN'. 577 577 * Default: 'IN' 578 * - 'include_children' bool (optional) Wether to include child terms. 578 * - 'include_children' bool (optional) Wether to include child terms. 579 579 * Default: true 580 580 * … … 637 637 $meta_type = isset( $q['type'] ) ? strtoupper( $q['type'] ) : 'CHAR'; 638 638 639 if ( ! in_array( $meta_compare, array( '=', '!=', '>', '>=', '<', '<=', 'LIKE', ' IN', 'BETWEEN' ) ) )639 if ( ! in_array( $meta_compare, array( '=', '!=', '>', '>=', '<', '<=', 'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ) ) ) 640 640 $meta_compare = '='; 641 641 … … 659 659 $where .= $wpdb->prepare( " AND $alias.meta_key = %s", $meta_key ); 660 660 661 if ( in_array( $meta_compare, array( 'IN', ' BETWEEN' ) ) ) {661 if ( in_array( $meta_compare, array( 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ) ) ) { 662 662 if ( ! is_array( $meta_value ) ) 663 663 $meta_value = preg_split( '/[,\s]+/', $meta_value ); … … 669 669 continue; 670 670 671 if ( 'IN' == $meta_compare) {671 if ( 'IN' == substr( $meta_compare, -2) ) { 672 672 $meta_field_types = substr( str_repeat( ',%s', count( $meta_value ) ), 1 ); 673 673 $meta_compare_string = "($meta_field_types)"; 674 674 unset( $meta_field_types ); 675 } elseif ( 'BETWEEN' == $meta_compare) {675 } elseif ( 'BETWEEN' == substr( $meta_compare, -7) ) { 676 676 $meta_value = array_slice( $meta_value, 0, 2 ); 677 677 $meta_compare_string = '%s AND %s'; 678 } elseif ( 'LIKE' == $meta_compare) {678 } elseif ( 'LIKE' == substr( $meta_compare, -4 ) ) { 679 679 $meta_value = '%' . like_escape( $meta_value ) . '%'; 680 680 $meta_compare_string = '%s'; … … 709 709 710 710 $query['do_query'] = false; 711 711 712 712 $sql_single = get_objects_in_term( $query['terms'], $query['taxonomy'], $query ); 713 713
Note: See TracChangeset
for help on using the changeset viewer.