File "class-wp-comment-query.php"
Full Path: /home/ycoalition/public_html/blog/wp-includes/blocks/html/class-wp-comment-query.php
File size: 8 KB
MIME-type: text/x-php
Charset: utf-8
<?php
/**
* Comment API: WP_Comment_Query class
*
* @package WordPress
* @subpackage Comments
* @since 4.4.0
*/
/**
* Core class used for querying comments.
*
* @since 3.1.0
*
* @see WP_Comment_Query::__construct() for accepted arguments.
*/
#[AllowDynamicProperties]
class WP_Comment_Query {
/**
* SQL for database query.
*
* @since 4.0.1
* @var string
*/
public $request;
/**
* Metadata query container
*
* @since 3.5.0
* @var WP_Meta_Query A meta query instance.
*/
public $meta_query = false;
/**
* Metadata query clauses.
*
* @since 4.4.0
* @var array
*/
protected $meta_query_clauses;
/**
* SQL query clauses.
*
* @since 4.4.0
* @var array
*/
protected $sql_clauses = array(
'select' => '',
'from' => '',
'where' => array(),
'groupby' => '',
'orderby' => '',
'limits' => '',
);
/**
* SQL WHERE clause.
*
* Stored after the {@see 'comments_clauses'} filter is run on the compiled WHERE sub-clauses.
*
* @since 4.4.2
* @var string
*/
protected $filtered_where_clause;
/**
* Date query container
*
* @since 3.7.0
* @var WP_Date_Query A date query instance.
*/
public $date_query = false;
/**
* Query vars set by the user.
*
* @since 3.1.0
* @var array
*/
public $query_vars;
/**
* Default values for query vars.
*
* @since 4.2.0
* @var array
*/
public $query_var_defaults;
/**
* List of comments located by the query.
*
* @since 4.0.0
* @var int[]|WP_Comment[]
*/
public $comments;
/**
* The amount of found comments for the current query.
*
* @since 4.4.0
* @var int
*/
public $found_comments = 0;
/**
* The number of pages.
*
* @since 4.4.0
* @var int
*/
public $max_num_pages = 0;
/**
* Make private/protected methods readable for backward compatibility.
*
* @since 4.0.0
*
* @param string $name Method to call.
* @param array $arguments Arguments to pass when calling.
* @return mixed|false Return value of the callback, false otherwise.
*/
public function __call( $name, $arguments ) {
if ( 'get_search_sql' === $name ) {
return $this->get_search_sql( ...$arguments );
}
return false;
}
/**
* Constructor.
*
* Sets up the comment query, based on the query vars passed.
*
* @since 4.2.0
* @since 4.4.0 `$parent__in` and `$parent__not_in` were added.
* @since 4.4.0 Order by `comment__in` was added. `$update_comment_meta_cache`, `$no_found_rows`,
* `$hierarchical`, and `$update_comment_post_cache` were added.
* @since 4.5.0 Introduced the `$author_url` argument.
* @since 4.6.0 Introduced the `$cache_domain` argument.
* @since 4.9.0 Introduced the `$paged` argument.
* @since 5.1.0 Introduced the `$meta_compare_key` argument.
* @since 5.3.0 Introduced the `$meta_type_key` argument.
*
* @param string|array $query {
* Optional. Array or query string of comment query parameters. Default empty.
*
* @type string $author_email Comment author email address. Default empty.
* @type string $author_url Comment author URL. Default empty.
* @type int[] $author__in Array of author IDs to include comments for. Default empty.
* @type int[] $author__not_in Array of author IDs to exclude comments for. Default empty.
* @type int[] $comment__in Array of comment IDs to include. Default empty.
* @type int[] $comment__not_in Array of comment IDs to exclude. Default empty.
* @type bool $count Whether to return a comment count (true) or array of
* comment objects (false). Default false.
* @type array $date_query Date query clauses to limit comments by. See WP_Date_Query.
* Default null.
* @type string $fields Comment fields to return. Accepts 'ids' for comment IDs
* only or empty for all fields. Default empty.
* @type array $include_unapproved Array of IDs or email addresses of users whose unapproved
* comments will be returned by the query regardless of
* `$status`. Default empty.
* @type int $karma Karma score to retrieve matching comments for.
* Default empty.
* @type string|string[] $meta_key Meta key or keys to filter by.
* @type string|string[] $meta_value Meta value or values to filter by.
* @type string $meta_compare MySQL operator used for comparing the meta value.
* See WP_Meta_Query::__construct() for accepted values and default value.
* @type string $meta_compare_key MySQL operator used for comparing the meta key.
* See WP_Meta_Query::__construct() for accepted values and default value.
* @type string $meta_type MySQL data type that the meta_value column will be CAST to for comparisons.
* See WP_Meta_Query::__construct() for accepted values and default value.
* @type string $meta_type_key MySQL data type that the meta_key column will be CAST to for comparisons.
* See WP_Meta_Query::__construct() for accepted values and default value.
* @type array $meta_query An associative array of WP_Meta_Query arguments.
* See WP_Meta_Query::__construct() for accepted values.
* @type int $number Maximum number of comments to retrieve.
* Default empty (no limit).
* @type int $paged When used with `$number`, defines the page of results to return.
* When used with `$offset`, `$offset` takes precedence. Default 1.
* @type int $offset Number of comments to offset the query. Used to build
* LIMIT clause. Default 0.
* @type bool $no_found_rows Whether to disable the `SQL_CALC_FOUND_ROWS` query.
* Default: true.
* @type string|array $orderby Comment status or array of statuses. To use 'meta_value'
* or 'meta_value_num', `$meta_key` must also be defined.
* To sort by a specific `$meta_query` clause, use that
* clause's array key. Accepts:
* - 'comment_agent'
* - 'comment_approved'
* - 'comment_author'
* - 'comment_author_email'
* - 'comment_author_IP'
* - 'comment_author_url'
* - 'comment_content'
* - 'comment_date'
* - 'comment_date_gmt'
* - 'comment_ID'
* - 'comment_karma'
*