Changeset 31087
- Timestamp:
- 01/08/2015 06:25:40 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/taxonomy.php
r31035 r31087 766 766 767 767 // First-order clause. 768 } else 768 } elseif ( self::is_first_order_clause( $query ) ) { 769 769 770 770 $cleaned_clause = array_merge( $defaults, $query ); … … 796 796 797 797 // Otherwise, it's a nested query, so we recurse. 798 } else 798 } elseif ( is_array( $query ) ) { 799 799 $cleaned_subquery = $this->sanitize_query( $query ); 800 800 … … 940 940 if ( 'relation' === $key ) { 941 941 $relation = $query['relation']; 942 } else 942 } elseif ( is_array( $clause ) ) { 943 943 944 944 // This is a first-order clause. … … 949 949 if ( ! $where_count ) { 950 950 $sql_chunks['where'][] = ''; 951 } else 951 } elseif ( 1 === $where_count ) { 952 952 $sql_chunks['where'][] = $clause_sql['where'][0]; 953 953 } else { … … 1394 1394 if ( empty($value) ) 1395 1395 return false; 1396 } else 1396 } elseif ( 'name' == $field ) { 1397 1397 // Assume already escaped 1398 1398 $value = wp_unslash($value); 1399 1399 $field = 't.name'; 1400 } else 1400 } elseif ( 'term_taxonomy_id' == $field ) { 1401 1401 $value = (int) $value; 1402 1402 $field = 'tt.term_taxonomy_id'; … … 1700 1700 if ( 'count' == $_orderby ) { 1701 1701 $orderby = 'tt.count'; 1702 } else 1702 } elseif ( 'name' == $_orderby ) { 1703 1703 $orderby = 't.name'; 1704 } else 1704 } elseif ( 'slug' == $_orderby ) { 1705 1705 $orderby = 't.slug'; 1706 } else 1706 } elseif ( 'include' == $_orderby && ! empty( $args['include'] ) ) { 1707 1707 $include = implode( ',', array_map( 'absint', $args['include'] ) ); 1708 1708 $orderby = "FIELD( t.term_id, $include )"; 1709 } else 1709 } elseif ( 'term_group' == $_orderby ) { 1710 1710 $orderby = 't.term_group'; 1711 } else 1711 } elseif ( 'none' == $_orderby ) { 1712 1712 $orderby = ''; 1713 1713 } elseif ( empty($_orderby) || 'id' == $_orderby ) { … … 2207 2207 else 2208 2208 $value = esc_attr($value); 2209 } else 2209 } elseif ( 'db' == $context ) { 2210 2210 2211 2211 /** … … 2246 2246 } 2247 2247 2248 } else 2248 } elseif ( 'rss' == $context ) { 2249 2249 2250 2250 /** … … 2303 2303 } 2304 2304 2305 if ( 'attribute' == $context ) 2305 if ( 'attribute' == $context ) { 2306 2306 $value = esc_attr($value); 2307 else if ( 'js' == $context )2307 } elseif ( 'js' == $context ) { 2308 2308 $value = esc_js($value); 2309 2309 } 2310 2310 return $value; 2311 2311 } … … 2623 2623 $fields = $args['fields']; 2624 2624 2625 if ( 'count' == $orderby ) 2625 if ( 'count' == $orderby ) { 2626 2626 $orderby = 'tt.count'; 2627 else if ( 'name' == $orderby )2627 } elseif ( 'name' == $orderby ) { 2628 2628 $orderby = 't.name'; 2629 else if ( 'slug' == $orderby )2629 } elseif ( 'slug' == $orderby ) { 2630 2630 $orderby = 't.slug'; 2631 else if ( 'term_group' == $orderby )2631 } elseif ( 'term_group' == $orderby ) { 2632 2632 $orderby = 't.term_group'; 2633 else if ( 'term_order' == $orderby )2633 } elseif ( 'term_order' == $orderby ) { 2634 2634 $orderby = 'tr.term_order'; 2635 elseif ( 'none' == $orderby ) {2635 } elseif ( 'none' == $orderby ) { 2636 2636 $orderby = ''; 2637 2637 $order = ''; … … 2655 2655 2656 2656 $select_this = ''; 2657 if ( 'all' == $fields ) 2657 if ( 'all' == $fields ) { 2658 2658 $select_this = 't.*, tt.*'; 2659 else if ( 'ids' == $fields )2659 } elseif ( 'ids' == $fields ) { 2660 2660 $select_this = 't.term_id'; 2661 else if ( 'names' == $fields )2661 } elseif ( 'names' == $fields ) { 2662 2662 $select_this = 't.name'; 2663 else if ( 'slugs' == $fields )2663 } elseif ( 'slugs' == $fields ) { 2664 2664 $select_this = 't.slug'; 2665 else if ( 'all_with_object_id' == $fields )2665 } elseif ( 'all_with_object_id' == $fields ) { 2666 2666 $select_this = 't.*, tt.*, tr.object_id'; 2667 2667 } 2668 2668 $query = "SELECT $select_this FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN $wpdb->term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tr.object_id IN ($object_ids) $orderby $order"; 2669 2669 … … 2677 2677 update_term_cache( $terms ); 2678 2678 $objects = true; 2679 } else 2679 } elseif ( 'ids' == $fields || 'names' == $fields || 'slugs' == $fields ) { 2680 2680 $_terms = $wpdb->get_col( $query ); 2681 2681 $_field = ( 'ids' == $fields ) ? 'term_id' : 'name'; … … 2684 2684 } 2685 2685 $terms = array_merge( $terms, $_terms ); 2686 } else 2686 } elseif ( 'tt_ids' == $fields ) { 2687 2687 $terms = $wpdb->get_col("SELECT tr.term_taxonomy_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tr.object_id IN ($object_ids) AND tt.taxonomy IN ($taxonomies) $orderby $order"); 2688 2688 foreach ( $terms as $key => $tt_id ) { … … 2823 2823 // The alias we want is already in a group, so let's use that one. 2824 2824 $term_group = $alias->term_group; 2825 } else 2825 } elseif ( ! empty( $alias->term_id ) ) { 2826 2826 /* 2827 2827 * The alias is not in a group, so we create a new one … … 3335 3335 // The alias we want is already in a group, so let's use that one. 3336 3336 $term_group = $alias->term_group; 3337 } else 3337 } elseif ( ! empty( $alias->term_id ) ) { 3338 3338 /* 3339 3339 * The alias is not in a group, so we create a new one … … 4330 4330 if ( is_taxonomy_hierarchical( $object_type ) ) { 4331 4331 $resource_type = 'taxonomy'; 4332 } else 4332 } elseif ( post_type_exists( $object_type ) ) { 4333 4333 $resource_type = 'post_type'; 4334 4334 }
Note: See TracChangeset
for help on using the changeset viewer.