Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.1/wp-includes/post.php

    r18368 r18023  
    24112411
    24122412    $postarr = wp_parse_args($postarr, $defaults);
    2413 
    2414     unset( $postarr[ 'filter' ] );
    2415 
    24162413    $postarr = sanitize_post($postarr, 'db');
    24172414
     
    34253422    $where_post_type = $wpdb->prepare( "post_type = '%s' AND post_status = '%s'", $post_type, $post_status );
    34263423
    3427     $orderby_array = array();
    3428     $allowed_keys = array('author', 'post_author', 'date', 'post_date', 'title', 'post_title', 'modified',
    3429                           'post_modified', 'modified_gmt', 'post_modified_gmt', 'menu_order', 'parent', 'post_parent',
    3430                           'ID', 'rand', 'comment_count');
    3431     foreach ( explode( ',', $sort_column ) as $orderby ) {
    3432         $orderby = trim( $orderby );
    3433         if ( !in_array( $orderby, $allowed_keys ) )
    3434             continue;
    3435 
    3436         switch ( $orderby ) {
    3437             case 'menu_order':
    3438                 break;
    3439             case 'ID':
    3440                 $orderby = "$wpdb->posts.ID";
    3441                 break;
    3442             case 'rand':
    3443                 $orderby = 'RAND()';
    3444                 break;
    3445             case 'comment_count':
    3446                 $orderby = "$wpdb->posts.comment_count";
    3447                 break;
    3448             default:
    3449                 if ( 0 === strpos( $orderby, 'post_' ) )
    3450                     $orderby = "$wpdb->posts." . $orderby;
    3451                 else
    3452                     $orderby = "$wpdb->posts.post_" . $orderby;
    3453         }
    3454 
    3455         $orderby_array[] = $orderby;
    3456 
    3457     }
    3458     $sort_column = ! empty( $orderby_array ) ? implode( ',', $orderby_array ) : "$wpdb->posts.post_title";
    3459 
    3460     $sort_order = strtoupper( $sort_order );
    3461     if ( '' !== $sort_order && !in_array( $sort_order, array( 'ASC', 'DESC' ) ) )
    3462         $sort_order = 'ASC';
    3463 
    34643424    $query = "SELECT * FROM $wpdb->posts $join WHERE ($where_post_type) $where ";
    34653425    $query .= $author_query;
     
    35873547    if ( !empty($parent) )
    35883548        $object['post_parent'] = $parent;
    3589 
    3590     unset( $object[ 'filter' ] );
    35913549
    35923550    $object = sanitize_post($object, 'db');
Note: See TracChangeset for help on using the changeset viewer.