Changeset 16854
- Timestamp:
- 12/10/2010 08:20:46 AM (14 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/query.php
r16853 r16854 1472 1472 1473 1473 /* 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. 1475 1475 * 1476 1476 * @access protected … … 1478 1478 * 1479 1479 * @param array &$q The query variables 1480 * @return array tax query1480 * @return WP_Tax_Query 1481 1481 */ 1482 1482 function parse_tax_query( &$q ) { -
trunk/wp-includes/taxonomy.php
r16850 r16854 507 507 508 508 /* 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. 510 510 * 511 511 * @since 3.1.0 512 512 * 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 525 516 * @param string $primary_table 526 517 * @param string $primary_id_column … … 532 523 } 533 524 525 /** 526 * Container class for a multiple taxonomy query. 527 * 528 * @since 3.1.0 529 */ 534 530 class 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 */ 536 549 var $queries = array(); 537 550 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 ) { 539 586 if ( isset( $tax_query['relation'] ) && strtoupper( $tax_query['relation'] ) == 'OR' ) { 540 587 $this->relation = 'OR'; … … 563 610 } 564 611 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 */ 565 622 function get_sql( $primary_table, $primary_id_column ) { 566 623 global $wpdb; … … 641 698 } 642 699 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 */ 643 711 function _transform_terms( &$terms, $taxonomy, $field, $resulting_field ) { 644 712 global $wpdb;
Note: See TracChangeset
for help on using the changeset viewer.