Changeset 25248 for trunk/src/wp-includes/query.php
- Timestamp:
- 09/04/2013 09:32:11 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/query.php
r25239 r25248 1397 1397 , 'cat' 1398 1398 , 'tag_id' 1399 , 'author' 1399 1400 , 'author_name' 1400 1401 , 'feed' … … 1417 1418 1418 1419 $array_keys = array( 'category__in', 'category__not_in', 'category__and', 'post__in', 'post__not_in', 1419 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'post_parent__in', 'post_parent__not_in' ); 1420 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'post_parent__in', 'post_parent__not_in', 1421 'author__in', 'author__not_in' ); 1420 1422 1421 1423 foreach ( $array_keys as $key ) { … … 1458 1460 $qv['paged'] = absint($qv['paged']); 1459 1461 $qv['cat'] = preg_replace( '|[^0-9,-]|', '', $qv['cat'] ); // comma separated list of positive or negative integers 1462 $qv['author'] = preg_replace( '|[^0-9,-]|', '', $qv['author'] ); // comma separated list of positive or negative integers 1460 1463 $qv['pagename'] = trim( $qv['pagename'] ); 1461 1464 $qv['name'] = trim( $qv['name'] ); … … 1770 1773 unset( $q['category__and'] ); 1771 1774 } 1772 1775 1773 1776 if ( ! empty( $q['category__in'] ) ) { 1774 $q['category__in'] = array_map( 'absint', array_unique( (array) $q['category__in'] ) ); 1777 $q['category__in'] = array_map( 'absint', array_unique( (array) $q['category__in'] ) ); 1775 1778 $tax_query[] = array( 1776 1779 'taxonomy' => 'category', … … 2334 2337 // Author/user stuff 2335 2338 2336 if ( empty($q['author']) || ($q['author'] == '0') ) { 2337 $whichauthor = ''; 2338 } else { 2339 $q['author'] = (string)urldecode($q['author']); 2340 $q['author'] = addslashes_gpc($q['author']); 2341 if ( strpos($q['author'], '-') !== false ) { 2342 $eq = '!='; 2343 $andor = 'AND'; 2344 $q['author'] = explode('-', $q['author']); 2345 $q['author'] = (string)absint($q['author'][1]); 2346 } else { 2347 $eq = '='; 2348 $andor = 'OR'; 2349 } 2350 $author_array = preg_split('/[,\s]+/', $q['author']); 2351 $_author_array = array(); 2352 foreach ( $author_array as $key => $_author ) 2353 $_author_array[] = "$wpdb->posts.post_author " . $eq . ' ' . absint($_author); 2354 $whichauthor .= ' AND (' . implode(" $andor ", $_author_array) . ')'; 2355 unset($author_array, $_author_array); 2339 if ( ! empty( $q['author'] ) && $q['author'] != '0' ) { 2340 $q['author'] = addslashes_gpc( '' . urldecode( $q['author'] ) ); 2341 $authors = array_unique( array_map( 'intval', preg_split( '/[,\s]+/', $q['author'] ) ) ); 2342 foreach ( $authors as $author ) { 2343 $key = $author > 0 ? 'author__in' : 'author__not_in'; 2344 $q[$key][] = abs( $author ); 2345 } 2346 $q['author'] = implode( ',', $authors ); 2347 } 2348 2349 if ( ! empty( $q['author__not_in'] ) ) { 2350 $author__not_in = implode( ',', array_map( 'absint', array_unique( (array) $q['author__not_in'] ) ) ); 2351 $where .= " AND {$wpdb->posts}.post_author NOT IN ($author__not_in) "; 2352 } elseif ( ! empty( $q['author__in'] ) ) { 2353 $author__in = implode( ',', array_map( 'absint', array_unique( (array) $q['author__in'] ) ) ); 2354 $where .= " AND {$wpdb->posts}.post_author IN ($author__in) "; 2356 2355 } 2357 2356 … … 2458 2457 if ( empty( $in_search_post_types ) ) 2459 2458 $where .= ' AND 1=0 '; 2460 else 2459 else 2461 2460 $where .= " AND $wpdb->posts.post_type IN ('" . join("', '", $in_search_post_types ) . "')"; 2462 2461 } elseif ( !empty( $post_type ) && is_array( $post_type ) ) {
Note: See TracChangeset
for help on using the changeset viewer.