Make WordPress Core

Changeset 16854


Ignore:
Timestamp:
12/10/2010 08:20:46 AM (13 years ago)
Author:
scribu
Message:

Inline docs for WP_Tax_Query. See #15752

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/query.php

    r16853 r16854  
    14721472
    14731473    /*
    1474      * Parses various taxonomy related query vars and sets the appropriate query flags
     1474     * Parses various taxonomy related query vars and sets the appropriate query flags.
    14751475     *
    14761476     * @access protected
     
    14781478     *
    14791479     * @param array &$q The query variables
    1480      * @return array tax query
     1480     * @return WP_Tax_Query
    14811481     */
    14821482    function parse_tax_query( &$q ) {
  • trunk/wp-includes/taxonomy.php

    r16850 r16854  
    507507
    508508/*
    509  * Given a taxonomy query, generates SQL to be appended to a main query
     509 * Given a taxonomy query, generates SQL to be appended to a main query.
    510510 *
    511511 * @since 3.1.0
    512512 *
    513  * @param array $tax_query List of taxonomy queries. A single taxonomy query is an associative array:
    514  * - 'taxonomy' string The taxonomy being queried
    515  * - 'terms' string|array The list of terms
    516  * - 'field' string (optional) Which term field is being used.
    517  *      Possible values: 'term_id', 'slug' or 'name'
    518  *      Default: 'term_id'
    519  * - 'operator' string (optional)
    520  *      Possible values: 'IN' and 'NOT IN'.
    521  *      Default: 'IN'
    522  * - 'include_children' bool (optional) Whether to include child terms.
    523  *      Default: true
    524  *
     513 * @see WP_Tax_Query
     514 *
     515 * @param array $tax_query A compact tax query
    525516 * @param string $primary_table
    526517 * @param string $primary_id_column
     
    532523}
    533524
     525/**
     526 * Container class for a multiple taxonomy query.
     527 *
     528 * @since 3.1.0
     529 */
    534530class WP_Tax_Query {
    535     var $relation = '';
     531
     532    /**
     533     * List of taxonomy queries. A single taxonomy query is an associative array:
     534     * - 'taxonomy' string The taxonomy being queried
     535     * - 'terms' string|array The list of terms
     536     * - 'field' string (optional) Which term field is being used.
     537     *      Possible values: 'term_id', 'slug' or 'name'
     538     *      Default: 'term_id'
     539     * - 'operator' string (optional)
     540     *      Possible values: 'IN' and 'NOT IN'.
     541     *      Default: 'IN'
     542     * - 'include_children' bool (optional) Whether to include child terms.
     543     *      Default: true
     544     *
     545     * @since 3.1.0
     546     * @access public
     547     * @var array
     548     */
    536549    var $queries = array();
    537550
    538     function WP_Tax_Query( &$tax_query ) {
     551    /**
     552     * The relation between the queries. Can be one of 'AND' or 'OR'.
     553     *
     554     * @since 3.1.0
     555     * @access public
     556     * @var string
     557     */
     558    var $relation;
     559
     560    /**
     561     * PHP4 type constructor.
     562     *
     563     * Parses a compact tax query and sets defaults.
     564     *
     565     * @since 3.1.0
     566     * @access public
     567     *
     568     * @param array $tax_query A compact tax query:
     569     *  array(
     570     *    'relation' => 'OR',
     571     *    array(
     572     *      'taxonomy' => 'tax1',
     573     *      'terms' => array( 'term1', 'term2' ),
     574     *      'field' => 'slug',
     575     *    ),
     576     *    array(
     577     *      'taxonomy' => 'tax2',
     578     *      'terms' => array( 'term-a', 'term-b' ),
     579     *      'field' => 'slug',
     580     *    ),
     581     *  )
     582     *
     583     * @return WP_Tax_Query
     584     */
     585    function WP_Tax_Query( $tax_query ) {
    539586        if ( isset( $tax_query['relation'] ) && strtoupper( $tax_query['relation'] ) == 'OR' ) {
    540587            $this->relation = 'OR';
     
    563610    }
    564611
     612    /**
     613     * Generates SQL clauses to be appended to a main query.
     614     *
     615     * @since 3.1.0
     616     * @access public
     617     *
     618     * @param string $primary_table
     619     * @param string $primary_id_column
     620     * @return array
     621     */
    565622    function get_sql( $primary_table, $primary_id_column ) {
    566623        global $wpdb;
     
    641698    }
    642699
     700    /**
     701     * Transforms a list of terms, from one field to another.
     702     *
     703     * @since 3.1.0
     704     * @access private
     705     *
     706     * @param array &$terms The list of terms
     707     * @param string $taxonomy The taxonomy of the terms
     708     * @param string $field The initial field
     709     * @param string $resulting_field The resulting field   
     710     */
    643711    function _transform_terms( &$terms, $taxonomy, $field, $resulting_field ) {
    644712        global $wpdb;
Note: See TracChangeset for help on using the changeset viewer.