mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-03 04:04:35 +00:00
Move get() and set() methods from WP_Query to WP_Object_Query. See #15032
git-svn-id: https://develop.svn.wordpress.org/trunk@16018 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -192,9 +192,22 @@ function get_comments( $args = '' ) {
|
||||
return $query->query( $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* WordPress Comment Query class.
|
||||
*
|
||||
* @since 3.1.0
|
||||
*/
|
||||
class WP_Comment_Query extends WP_Object_Query {
|
||||
|
||||
function query( $args ) {
|
||||
/**
|
||||
* Execute the query
|
||||
*
|
||||
* @since 3.1.0
|
||||
*
|
||||
* @param string|array $query_vars
|
||||
* @return int|array
|
||||
*/
|
||||
function query( $query_vars ) {
|
||||
global $wpdb;
|
||||
|
||||
$defaults = array(
|
||||
@@ -215,8 +228,9 @@ class WP_Comment_Query extends WP_Object_Query {
|
||||
'count' => false
|
||||
);
|
||||
|
||||
$args = wp_parse_args( $args, $defaults );
|
||||
extract( $args, EXTR_SKIP );
|
||||
$this->query_vars = wp_parse_args( $query_vars, $defaults );
|
||||
|
||||
extract( $this->query_vars, EXTR_SKIP );
|
||||
|
||||
// $args can be whatever, only use the args defined in defaults to compute the key
|
||||
$key = md5( serialize( compact(array_keys($defaults)) ) );
|
||||
|
||||
Reference in New Issue
Block a user