mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 15:08:10 +01:00
Kill WP_Object_Query. See #15032
git-svn-id: http://svn.automattic.com/wordpress/trunk@16353 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
cd60463f36
commit
40b2c5b6c5
@ -1,36 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* WordPress Query class.
|
|
||||||
*
|
|
||||||
* Abstract class for handling advanced queries
|
|
||||||
*
|
|
||||||
* @package WordPress
|
|
||||||
* @since 3.1.0
|
|
||||||
*/
|
|
||||||
class WP_Object_Query {
|
|
||||||
/*
|
|
||||||
* Populates the $meta_query property
|
|
||||||
*
|
|
||||||
* @access protected
|
|
||||||
* @since 3.1.0
|
|
||||||
*
|
|
||||||
* @param array $qv The query variables
|
|
||||||
*/
|
|
||||||
function parse_meta_query( &$qv ) {
|
|
||||||
$meta_query = array();
|
|
||||||
|
|
||||||
// Simple query needs to be first for orderby=meta_value to work correctly
|
|
||||||
foreach ( array( 'key', 'value', 'compare', 'type' ) as $key ) {
|
|
||||||
if ( !empty( $qv[ "meta_$key" ] ) )
|
|
||||||
$meta_query[0][ $key ] = $qv[ "meta_$key" ];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !empty( $qv['meta_query'] ) && is_array( $qv['meta_query'] ) ) {
|
|
||||||
$meta_query = array_merge( $meta_query, $qv['meta_query'] );
|
|
||||||
}
|
|
||||||
|
|
||||||
$qv['meta_query'] = $meta_query;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
@ -197,7 +197,7 @@ function get_comments( $args = '' ) {
|
|||||||
*
|
*
|
||||||
* @since 3.1.0
|
* @since 3.1.0
|
||||||
*/
|
*/
|
||||||
class WP_Comment_Query extends WP_Object_Query {
|
class WP_Comment_Query {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the query
|
* Execute the query
|
||||||
|
@ -444,6 +444,30 @@ function get_meta_sql( $meta_query, $meta_type, $primary_table, $primary_id_colu
|
|||||||
return apply_filters_ref_array( 'get_meta_sql', array( compact( 'join', 'where' ), $meta_query, $meta_type, $primary_table, $primary_id_column, &$context ) );
|
return apply_filters_ref_array( 'get_meta_sql', array( compact( 'join', 'where' ), $meta_query, $meta_type, $primary_table, $primary_id_column, &$context ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Populates the $meta_query property
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @since 3.1.0
|
||||||
|
*
|
||||||
|
* @param array $qv The query variables
|
||||||
|
*/
|
||||||
|
function _parse_meta_query( &$qv ) {
|
||||||
|
$meta_query = array();
|
||||||
|
|
||||||
|
// Simple query needs to be first for orderby=meta_value to work correctly
|
||||||
|
foreach ( array( 'key', 'value', 'compare', 'type' ) as $key ) {
|
||||||
|
if ( !empty( $qv[ "meta_$key" ] ) )
|
||||||
|
$meta_query[0][ $key ] = $qv[ "meta_$key" ];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !empty( $qv['meta_query'] ) && is_array( $qv['meta_query'] ) ) {
|
||||||
|
$meta_query = array_merge( $meta_query, $qv['meta_query'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
$qv['meta_query'] = $meta_query;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the name of the metadata table for the specified object type.
|
* Retrieve the name of the metadata table for the specified object type.
|
||||||
*
|
*
|
||||||
|
@ -688,7 +688,7 @@ function the_comment() {
|
|||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*/
|
*/
|
||||||
class WP_Query extends WP_Object_Query {
|
class WP_Query {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query vars set by the user
|
* Query vars set by the user
|
||||||
@ -1347,7 +1347,7 @@ class WP_Query extends WP_Object_Query {
|
|||||||
|
|
||||||
$this->parse_tax_query( $qv );
|
$this->parse_tax_query( $qv );
|
||||||
|
|
||||||
$this->parse_meta_query( $qv );
|
_parse_meta_query( $qv );
|
||||||
|
|
||||||
if ( empty($qv['author']) || ($qv['author'] == '0') ) {
|
if ( empty($qv['author']) || ($qv['author'] == '0') ) {
|
||||||
$this->is_author = false;
|
$this->is_author = false;
|
||||||
|
@ -330,7 +330,7 @@ function delete_user_option( $user_id, $option_name, $global = false ) {
|
|||||||
*
|
*
|
||||||
* @since 3.1.0
|
* @since 3.1.0
|
||||||
*/
|
*/
|
||||||
class WP_User_Query extends WP_Object_Query {
|
class WP_User_Query {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of found user ids
|
* List of found user ids
|
||||||
@ -463,7 +463,7 @@ class WP_User_Query extends WP_Object_Query {
|
|||||||
$this->query_where .= $this->get_search_sql( $search, $search_columns, $wild );
|
$this->query_where .= $this->get_search_sql( $search, $search_columns, $wild );
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->parse_meta_query( $qv );
|
_parse_meta_query( $qv );
|
||||||
|
|
||||||
$role = trim( $qv['role'] );
|
$role = trim( $qv['role'] );
|
||||||
$blog_id = absint( $qv['blog_id'] );
|
$blog_id = absint( $qv['blog_id'] );
|
||||||
|
@ -103,7 +103,6 @@ wp_not_installed();
|
|||||||
// Load most of WordPress.
|
// Load most of WordPress.
|
||||||
require( ABSPATH . WPINC . '/class-wp-walker.php' );
|
require( ABSPATH . WPINC . '/class-wp-walker.php' );
|
||||||
require( ABSPATH . WPINC . '/class-wp-ajax-response.php' );
|
require( ABSPATH . WPINC . '/class-wp-ajax-response.php' );
|
||||||
require( ABSPATH . WPINC . '/class-wp-object-query.php' );
|
|
||||||
require( ABSPATH . WPINC . '/formatting.php' );
|
require( ABSPATH . WPINC . '/formatting.php' );
|
||||||
require( ABSPATH . WPINC . '/capabilities.php' );
|
require( ABSPATH . WPINC . '/capabilities.php' );
|
||||||
require( ABSPATH . WPINC . '/query.php' );
|
require( ABSPATH . WPINC . '/query.php' );
|
||||||
|
Loading…
Reference in New Issue
Block a user