Make WordPress Core


Ignore:
Timestamp:
05/07/2015 06:13:27 AM (10 years ago)
Author:
DrewAPicture
Message:

Fix a wide variety of syntactical, spacing, wording, and other issues in wp-includes/taxonomy.php.

See #32246.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/taxonomy.php

    r32452 r32453  
    210210 * @global array $wp_taxonomies The registered taxonomies.
    211211 *
    212  * @param string $taxonomy Name of taxonomy object to return
    213  * @return object|bool The Taxonomy Object or false if $taxonomy doesn't exist
     212 * @param string $taxonomy Name of taxonomy object to return.
     213 * @return object|bool The Taxonomy Object or false if $taxonomy doesn't exist.
    214214 */
    215215function get_taxonomy( $taxonomy ) {
     
    231231 * @global array $wp_taxonomies The registered taxonomies.
    232232 *
    233  * @param string $taxonomy Name of taxonomy object
     233 * @param string $taxonomy Name of taxonomy object.
    234234 * @return bool Whether the taxonomy exists.
    235235 */
     
    250250 * @since 2.3.0
    251251 *
    252  * @param string $taxonomy Name of taxonomy object
    253  * @return bool Whether the taxonomy is hierarchical
     252 * @param string $taxonomy Name of taxonomy object.
     253 * @return bool Whether the taxonomy is hierarchical.
    254254 */
    255255function is_taxonomy_hierarchical($taxonomy) {
     
    320320 * - _builtin - true if this taxonomy is a native or "built-in" taxonomy. THIS IS FOR INTERNAL USE ONLY!
    321321 *
     322 * @todo Document $args as a hash notation.
     323 *
    322324 * @since 2.3.0
    323325 * @since 4.2.0 Introduced `show_in_quick_edit` argument.
     
    474476 * Above, the first default value is for non-hierarchical taxonomies (like tags) and the second one is for hierarchical taxonomies (like categories).
    475477 *
     478 * @todo Better documentation for the labels array.
     479 *
    476480 * @since 3.0.0
    477481 *
    478  * @param object $tax Taxonomy object
    479  * @return object object with all the labels as member variables
     482 * @param object $tax Taxonomy object.
     483 * @return object object with all the labels as member variables.
    480484 */
    481485
     
    519523 * @global array $wp_taxonomies The registered taxonomies.
    520524 *
    521  * @param string $taxonomy Name of taxonomy object
    522  * @param string $object_type Name of the object type
    523  * @return bool True if successful, false if not
     525 * @param string $taxonomy    Name of taxonomy object.
     526 * @param string $object_type Name of the object type.
     527 * @return bool True if successful, false if not.
    524528 */
    525529function register_taxonomy_for_object_type( $taxonomy, $object_type) {
     
    589593 * @global wpdb $wpdb WordPress database abstraction object.
    590594 *
    591  * @param int|array $term_ids Term id or array of term ids of terms that will be used
    592  * @param string|array $taxonomies String of taxonomy name or Array of string values of taxonomy names
    593  * @param array|string $args Change the order of the object_ids, either ASC or DESC
    594  * @return WP_Error|array If the taxonomy does not exist, then WP_Error will be returned. On success
     595 * @param int|array $term_ids Term id or array of term ids of terms that will be used.
     596 * @param string|array $taxonomies String of taxonomy name or Array of string values of taxonomy names.
     597 * @param array|string $args Change the order of the object_ids, either ASC or DESC.
     598 * @return WP_Error|array If the taxonomy does not exist, then WP_Error will be returned. On success.
    595599 *  the array can be empty meaning that there are no $object_ids found or it will return the $object_ids found.
    596600 */
     
    648652 * Class for generating SQL clauses that filter a primary query according to object taxonomy terms.
    649653 *
    650  * `WP_Tax_Query` is a helper that allows primary query classes, such as {@see WP_Query}, to filter
     654 * `WP_Tax_Query` is a helper that allows primary query classes, such as WP_Query, to filter
    651655 * their results by object metadata, by generating `JOIN` and `WHERE` subclauses to be attached
    652656 * to the primary SQL query string.
     
    698702     *
    699703     * We store this data in a flat array because they are referenced in a
    700      * number of places by {@see WP_Query}.
     704     * number of places by WP_Query.
    701705     *
    702706     * @since 4.1.0
     
    897901     * Generate SQL clauses to be appended to a main query.
    898902     *
    899      * Called by the public {@see WP_Tax_Query::get_sql()}, this method
     903     * Called by the public WP_Tax_Query::get_sql(), this method
    900904     * is abstracted out to maintain parity with the other Query classes.
    901905     *
     
    10181022     * @global wpdb $wpdb The WordPress database abstraction object.
    10191023     *
    1020      * @param array $clause       Query clause, passed by reference
     1024     * @param array $clause       Query clause, passed by reference.
    10211025     * @param array $parent_query Parent query array.
    10221026     * @return array {
     
    11361140     * (ie, it's under the scope of the same relation), and (b) the combination
    11371141     * of operator and relation between the clauses allows for a shared table
    1138      * join. In the case of {@see WP_Tax_Query}, this only applies to 'IN'
     1142     * join. In the case of WP_Tax_Query, this only applies to 'IN'
    11391143     * clauses that are connected by the relation 'OR'.
    11401144     *
     
    12301234     * @param array  &$query          The single query.
    12311235     * @param string $resulting_field The resulting field. Accepts 'slug', 'name', 'term_taxonomy_id',
    1232      *                                or 'term_id'. Default: 'term_id'.
     1236     *                                or 'term_id'. Default 'term_id'.
    12331237     */
    12341238    public function transform_query( &$query, $resulting_field ) {
     
    13091313 * return a Term object.
    13101314 *
    1311  * 'get_term' hook - Takes two parameters the term Object and the taxonomy name.
     1315 * {@see 'get_term'} hook - Takes two parameters the term Object and the taxonomy name.
    13121316 * Must return term object. Used in get_term() as a catch-all filter for every
    13131317 * $term.
    13141318 *
    1315  * 'get_$taxonomy' hook - Takes two parameters the term Object and the taxonomy
     1319 * {@see 'get_$taxonomy'} hook - Takes two parameters the term Object and the taxonomy
    13161320 * name. Must return term object. $taxonomy will be the taxonomy name, so for
    13171321 * example, if 'category', it would be 'get_category' as the filter name. Useful
    13181322 * for custom taxonomies or plugging into default taxonomies.
     1323 *
     1324 * @todo Better formatting for DocBlock
    13191325 *
    13201326 * @since 2.3.0
     
    14071413 * If $value does not exist, the return value will be false. If $taxonomy exists
    14081414 * and $field and $value combinations exist, the Term will be returned.
     1415 *
     1416 * @todo Better formatting for DocBlock.
    14091417 *
    14101418 * @since 2.3.0
     
    14801488 * @since 2.3.0
    14811489 *
    1482  * @param string $term_id ID of Term to get children
    1483  * @param string $taxonomy Taxonomy Name
    1484  * @return array|WP_Error List of Term IDs. WP_Error returned if $taxonomy does not exist
     1490 * @param string $term_id  ID of Term to get children.
     1491 * @param string $taxonomy Taxonomy Name.
     1492 * @return array|WP_Error List of Term IDs. WP_Error returned if `$taxonomy` does not exist.
    14851493 */
    14861494function get_term_children( $term_id, $taxonomy ) {
     
    15181526 * @since 2.3.0
    15191527 *
    1520  * @param string $field Term field to fetch
    1521  * @param int $term Term ID
    1522  * @param string $taxonomy Taxonomy Name
    1523  * @param string $context Optional, default is display. Look at sanitize_term_field() for available options.
     1528 * @param string $field    Term field to fetch.
     1529 * @param int    $term     Term ID.
     1530 * @param string $taxonomy Taxonomy Name.
     1531 * @param string $context  Optional, default is display. Look at sanitize_term_field() for available options.
    15241532 * @return mixed Will return an empty string if $term is not an object or if $field is not set in $term.
    15251533 */
     
    15471555 * @since 2.3.0
    15481556 *
    1549  * @param int|object $id Term ID or Object
    1550  * @param string $taxonomy Taxonomy Name
     1557 * @param int|object $id       Term ID or object.
     1558 * @param string     $taxonomy Taxonomy name.
    15511559 * @return mixed|null|WP_Error Will return empty string if $term is not an object.
    15521560 */
     
    15691577 * well as control the output with a filter.
    15701578 *
    1571  * The 'get_terms' filter will be called when the cache has the term and will
     1579 * The {@see 'get_terms'} filter will be called when the cache has the term and will
    15721580 * pass the found term along with the array of $taxonomies and array of $args.
    15731581 * This filter is also called before the array of terms is passed and will pass
    15741582 * the array of terms, along with the $taxonomies and $args.
    15751583 *
    1576  * The 'list_terms_exclusions' filter passes the compiled exclusions along with
     1584 * The {@see 'list_terms_exclusions'} filter passes the compiled exclusions along with
    15771585 * the $args.
    15781586 *
    1579  * The 'get_terms_orderby' filter passes the ORDER BY clause for the query
     1587 * The {@see 'get_terms_orderby'} filter passes the `ORDER BY` clause for the query
    15801588 * along with the $args array.
    15811589 *
     
    16931701     * @since 3.1.0
    16941702     *
    1695      * @param array $args       An array of arguments.
     1703     * @param array $args       An array of get_term() arguments.
    16961704     * @param array $taxonomies An array of taxonomies.
    16971705     */
     
    17251733    }
    17261734
    1727     // $args can be whatever, only use the args defined in defaults to compute the key
     1735    // $args can be whatever, only use the args defined in defaults to compute the key.
    17281736    $filter_key = ( has_filter('list_terms_exclusions') ) ? serialize($GLOBALS['wp_filter']['list_terms_exclusions']) : '';
    17291737    $key = md5( serialize( wp_array_slice_assoc( $args, array_keys( $defaults ) ) ) . serialize( $taxonomies ) . $filter_key );
     
    17441752         * @param array $cache      Cached array of terms for the given taxonomy.
    17451753         * @param array $taxonomies An array of taxonomies.
    1746          * @param array $args       An array of arguments to get terms.
     1754         * @param array $args       An array of get_terms() arguments.
    17471755         */
    17481756        $cache = apply_filters( 'get_terms', $cache, $taxonomies, $args );
     
    17711779        $orderby = 't.name';
    17721780    }
     1781
    17731782    /**
    17741783     * Filter the ORDERBY clause of the terms query.
     
    17761785     * @since 2.8.0
    17771786     *
    1778      * @param string $orderby    ORDERBY clause of the terms query.
     1787     * @param string $orderby    `ORDERBY` clause of the terms query.
    17791788     * @param array  $args       An array of terms query arguments.
    17801789     * @param array  $taxonomies An array of taxonomies.
     
    18481857     * @since 2.3.0
    18491858     *
    1850      * @param string $exclusions NOT IN clause of the terms query.
     1859     * @param string $exclusions `NOT IN` clause of the terms query.
    18511860     * @param array  $args       An array of terms query arguments.
    18521861     * @param array  $taxonomies An array of taxonomies.
     
    19011910    $offset = $args['offset'];
    19021911
    1903     // don't limit the query results when we have to descend the family tree
     1912    // Don't limit the query results when we have to descend the family tree.
    19041913    if ( $number && ! $hierarchical && ! $child_of && '' === $parent ) {
    19051914        if ( $offset ) {
     
    19761985     */
    19771986    $clauses = apply_filters( 'terms_clauses', compact( $pieces ), $taxonomies, $args );
     1987
    19781988    $fields = isset( $clauses[ 'fields' ] ) ? $clauses[ 'fields' ] : '';
    19791989    $join = isset( $clauses[ 'join' ] ) ? $clauses[ 'join' ] : '';
     
    20332043                }
    20342044
    2035                 // It really is empty
     2045                // It really is empty.
    20362046                unset($terms[$k]);
    20372047            }
     
    21502160 * @since 3.4.0
    21512161 *
    2152  * @param int|object $term1 ID or object to check if this is the parent term.
    2153  * @param int|object $term2 The child term.
    2154  * @param string $taxonomy Taxonomy name that $term1 and $term2 belong to.
    2155  * @return bool Whether $term2 is child of $term1
     2162 * @param int|object $term1    ID or object to check if this is the parent term.
     2163 * @param int|object $term2    The child term.
     2164 * @param string     $taxonomy Taxonomy name that $term1 and `$term2` belong to.
     2165 * @return bool Whether `$term2` is a child of `$term1`.
    21562166 */
    21572167function term_is_ancestor_of( $term1, $term2, $taxonomy ) {
     
    21802190 * @since 2.3.0
    21812191 *
    2182  * @param array|object $term The term to check
    2183  * @param string $taxonomy The taxonomy name to use
    2184  * @param string $context Default is 'display'.
    2185  * @return array|object Term with all fields sanitized
     2192 * @param array|object $term     The term to check.
     2193 * @param string       $taxonomy The taxonomy name to use.
     2194 * @param string       $context  Optional. Context in which to sanitize the term. Accepts 'edit', 'db',
     2195 *                               'display', 'attribute', or 'js'. Default 'display'.
     2196 * @return array|object Term with all fields sanitized.
    21862197 */
    21872198function sanitize_term($term, $taxonomy, $context = 'display') {
     
    22282239 * @global wpdb $wpdb WordPress database abstraction object.
    22292240 *
    2230  * @param string $field Term field to sanitize
    2231  * @param string $value Search for this term value
    2232  * @param int $term_id Term ID
    2233  * @param string $taxonomy Taxonomy Name
    2234  * @param string $context Either edit, db, display, attribute, or js.
    2235  * @return mixed sanitized field
     2241 * @param string $field    Term field to sanitize.
     2242 * @param string $value    Search for this term value.
     2243 * @param int    $term_id  Term ID.
     2244 * @param string $taxonomy Taxonomy Name.
     2245 * @param string $context  Context in which to sanitize the term field. Accepts 'edit', 'db', 'display',
     2246 *                         'attribute', or 'js'.
     2247 * @return mixed Sanitized field.
    22362248 */
    22372249function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) {
     
    22732285         */
    22742286        $value = apply_filters( "edit_{$taxonomy}_{$field}", $value, $term_id );
     2287
    22752288        if ( 'description' == $field )
    22762289            $value = esc_html($value); // textarea_escaped
     
    23022315         */
    23032316        $value = apply_filters( "pre_{$taxonomy}_{$field}", $value );
     2317
    23042318        // Back compat filters
    23052319        if ( 'slug' == $field ) {
     
    23332347         * Filter the taxonomy field for use in RSS.
    23342348         *
    2335          * The dynamic portions of the hook name, `$taxonomy`, and $field, refer
     2349         * The dynamic portions of the hook name, `$taxonomy`, and `$field`, refer
    23362350         * to the taxonomy slug and field name, respectively.
    23372351         *
     
    23612375         * Filter the taxonomy field sanitized for display.
    23622376         *
    2363          * The dynamic portions of the filter name, `$taxonomy`, and $field, refer
     2377         * The dynamic portions of the filter name, `$taxonomy`, and `$field`, refer
    23642378         * to the taxonomy slug and taxonomy field, respectively.
    23652379         *
     
    23862400 * Default $args is 'hide_empty' which can be 'hide_empty=true' or array('hide_empty' => true).
    23872401 *
     2402 * @todo Document $args as a hash notation.
     2403 *
    23882404 * @since 2.3.0
    23892405 *
     
    24162432 * @since 2.3.0
    24172433 *
    2418  * @param int $object_id The term Object Id that refers to the term
     2434 * @param int $object_id The term Object Id that refers to the term.
    24192435 * @param string|array $taxonomies List of Taxonomy Names or single Taxonomy name.
    24202436 */
     
    24382454 * that term's parent.
    24392455 *
    2440  * The $args 'default' will only override the terms found, if there is only one
     2456 * The `$args` 'default' will only override the terms found, if there is only one
    24412457 * term found. Any other and the found terms are used.
    24422458 *
     
    24442460 * assigned even if the object was not going to be termless
    24452461 *
     2462 * @todo Document $args as a hash notation.
     2463 *
    24462464 * @since 2.3.0
    24472465 *
    24482466 * @global wpdb $wpdb WordPress database abstraction object.
    24492467 *
    2450  * @param int $term Term ID
    2451  * @param string $taxonomy Taxonomy Name
    2452  * @param array|string $args Optional. Change 'default' term id and override found term ids.
     2468 * @param int          $term     Term ID.
     2469 * @param string       $taxonomy Taxonomy Name.
     2470 * @param array|string $args     Optional. Change 'default' term id and override found term ids.
    24532471 * @return bool|WP_Error Returns false if not term; true if completes delete action.
    24542472 */
     
    25142532         */
    25152533        do_action( 'edit_term_taxonomies', $edit_tt_ids );
     2534
    25162535        $wpdb->update( $wpdb->term_taxonomy, compact( 'parent' ), array( 'parent' => $term_obj->term_id) + compact( 'taxonomy' ) );
    25172536
     
    25452564    }
    25462565
    2547     // Clean the relationship caches for all object types using this term
     2566    // Clean the relationship caches for all object types using this term.
    25482567    $tax_object = get_taxonomy( $taxonomy );
    25492568    foreach ( $tax_object->object_type as $object_type )
     
    26022621     * @param int     $tt_id        Term taxonomy ID.
    26032622     * @param mixed   $deleted_term Copy of the already-deleted term, in the form specified
    2604      *                              by the parent function. {@see WP_Error} otherwise.
     2623     *                              by the parent function. WP_Error otherwise.
    26052624     */
    26062625    do_action( "delete_$taxonomy", $term, $tt_id, $deleted_term );
     
    31993218 * @since 3.6.0
    32003219 *
    3201  * @param int $object_id The ID of the object to which the terms will be added.
    3202  * @param array|int|string $terms The slug(s) or ID(s) of the term(s) to add.
    3203  * @param array|string $taxonomy Taxonomy name.
     3220 * @param int              $object_id The ID of the object to which the terms will be added.
     3221 * @param array|int|string $terms     The slug(s) or ID(s) of the term(s) to add.
     3222 * @param array|string     $taxonomy Taxonomy name.
    32043223 * @return array|WP_Error Affected Term IDs
    32053224 */
     
    32153234 * @global wpdb $wpdb WordPress database abstraction object.
    32163235 *
    3217  * @param int $object_id The ID of the object from which the terms will be removed.
    3218  * @param array|int|string $terms The slug(s) or ID(s) of the term(s) to remove.
    3219  * @param array|string $taxonomy Taxonomy name.
     3236 * @param int              $object_id The ID of the object from which the terms will be removed.
     3237 * @param array|int|string $terms     The slug(s) or ID(s) of the term(s) to remove.
     3238 * @param array|string     $taxonomy Taxonomy name.
    32203239 * @return bool|WP_Error True on success, false or WP_Error on failure.
    32213240 */
     
    32773296         */
    32783297        do_action( 'deleted_term_relationships', $object_id, $tt_ids );
     3298
    32793299        wp_update_term_count( $tt_ids, $taxonomy );
    32803300
     
    32883308 * Will make slug unique, if it isn't already.
    32893309 *
    3290  * The $slug has to be unique global to every taxonomy, meaning that one
     3310 * The `$slug` has to be unique global to every taxonomy, meaning that one
    32913311 * taxonomy term can't have a matching slug with another taxonomy term. Each
    32923312 * slug has to be globally unique for every taxonomy.
     
    32983318 * until it finds a number that is truly unique.
    32993319 *
    3300  * The only purpose for $term is for appending a parent, if one exists.
     3320 * The only purpose for `$term` is for appending a parent, if one exists.
    33013321 *
    33023322 * @since 2.3.0
     
    33043324 * @global wpdb $wpdb WordPress database abstraction object.
    33053325 *
    3306  * @param string $slug The string that will be tried for a unique slug
    3307  * @param object $term The term object that the $slug will belong too
     3326 * @param string $slug The string that will be tried for a unique slug.
     3327 * @param object $term The term object that the $slug will belong too.
    33083328 * @return string Will return a true unique slug.
    33093329 */
    3310 function wp_unique_term_slug($slug, $term) {
     3330function wp_unique_term_slug( $slug, $term ) {
    33113331    global $wpdb;
    33123332
     
    33193339    }
    33203340
    3321     // If the taxonomy supports hierarchy and the term has a parent, make the slug unique
    3322     // by incorporating parent slugs.
     3341    /*
     3342     * If the taxonomy supports hierarchy and the term has a parent, make the slug unique
     3343     * by incorporating parent slugs.
     3344     */
    33233345    if ( is_taxonomy_hierarchical($term->taxonomy) && !empty($term->parent) ) {
    33243346        $the_parent = $term->parent;
     
    33743396 * will be created for you.
    33753397 *
    3376  * For what can be overrode in $args, check the term scheme can contain and stay
     3398 * For what can be overrode in `$args`, check the term scheme can contain and stay
    33773399 * away from the term keys.
    33783400 *
     
    33813403 * @global wpdb $wpdb WordPress database abstraction object.
    33823404 *
    3383  * @param int $term_id The ID of the term
    3384  * @param string $taxonomy The context in which to relate the term to the object.
    3385  * @param array|string $args Overwrite term field values
     3405 * @param int          $term_id The ID of the term
     3406 * @param string       $taxonomy The context in which to relate the term to the object.
     3407 * @param array|string $args     Optional. Array of get_terms() arguments. Default empty array.
    33863408 * @return array|WP_Error Returns Term ID and Taxonomy Term ID
    33873409 */
     
    35303552     */
    35313553    do_action( 'edit_term_taxonomy', $tt_id, $taxonomy );
     3554
    35323555    $wpdb->update( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent' ), array( 'term_taxonomy_id' => $tt_id ) );
    35333556
     
    35423565    do_action( 'edited_term_taxonomy', $tt_id, $taxonomy );
    35433566
    3544     // Clean the relationship caches for all object types using this term
     3567    // Clean the relationship caches for all object types using this term.
    35453568    $objects = $wpdb->get_col( $wpdb->prepare( "SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $tt_id ) );
    35463569    $tax_object = get_taxonomy( $taxonomy );
     
    36393662 * @global wpdb $wpdb WordPress database abstraction object.
    36403663 *
    3641  * @param int|array $terms The term_taxonomy_id of the terms
    3642  * @param string $taxonomy The context of the term.
     3664 * @param int|array $terms    The term_taxonomy_id of the terms.
     3665 * @param string    $taxonomy The context of the term.
    36433666 * @return bool If no terms will return false, and if successful will return true.
    36443667 */
     
    36743697 * @since 2.5.0
    36753698 *
    3676  * @param array $terms The term_taxonomy_id of terms to update.
     3699 * @param array  $terms    The term_taxonomy_id of terms to update.
    36773700 * @param string $taxonomy The context of the term.
    36783701 * @return bool Always true when complete.
     
    37123735 * Removes the taxonomy relationship to terms from the cache.
    37133736 *
    3714  * Will remove the entire taxonomy relationship containing term $object_id. The
    3715  * term IDs have to exist within the taxonomy $object_type for the deletion to
     3737 * Will remove the entire taxonomy relationship containing term `$object_id`. The
     3738 * term IDs have to exist within the taxonomy `$object_type` for the deletion to
    37163739 * take place.
    37173740 *
    37183741 * @since 2.3.0
    37193742 *
    3720  * @see get_object_taxonomies() for more on $object_type
    3721  *
    3722  * @param int|array $object_ids Single or list of term object ID(s)
    3723  * @param array|string $object_type The taxonomy object type
     3743 * @see get_object_taxonomies() for more on $object_type.
     3744 *
     3745 * @param int|array    $object_ids  Single or list of term object ID(s).
     3746 * @param array|string $object_type The taxonomy object type.
    37243747 */
    37253748function clean_object_term_cache($object_ids, $object_type) {
     
    37533776 * @global wpdb $wpdb WordPress database abstraction object.
    37543777 *
    3755  * @param int|array $ids Single or list of Term IDs
    3756  * @param string $taxonomy Can be empty and will assume tt_ids, else will use for context.
    3757  * @param bool $clean_taxonomy Whether to clean taxonomy wide caches (true), or just individual term object caches (false). Default is true.
     3778 * @param int|array $ids            Single or list of Term IDs.
     3779 * @param string    $taxonomy       Optional. Can be empty and will assume `tt_ids`, else will use for context.
     3780 *                                  Default empty.
     3781 * @param bool      $clean_taxonomy Optional. Whether to clean taxonomy wide caches (true), or just individual
     3782 *                                  term object caches (false). Default true.
    37583783 */
    37593784function clean_term_cache($ids, $taxonomy = '', $clean_taxonomy = true) {
     
    38133838 * @since 2.3.0
    38143839 *
    3815  * @param int    $id       Term object ID
    3816  * @param string $taxonomy Taxonomy Name
    3817  * @return bool|array Empty array if $terms found, but not $taxonomy. False if nothing is in cache for $taxonomy and $id.
    3818  */
    3819 function get_object_term_cache($id, $taxonomy) {
     3840 * @param int    $id       Term object ID.
     3841 * @param string $taxonomy Taxonomy name.
     3842 * @return bool|array Empty array if $terms found, but not `$taxonomy`. False if nothing is in cache
     3843 *                    for `$taxonomy` and `$id`.
     3844 */
     3845function get_object_term_cache( $id, $taxonomy ) {
    38203846    $cache = wp_cache_get($id, "{$taxonomy}_relationships");
    38213847    return $cache;
     
    38343860 * @since 2.3.0
    38353861 *
    3836  * @param string|array $object_ids  Comma-separated list or array of term object IDs..
     3862 * @param string|array $object_ids  Comma-separated list or array of term object IDs.
    38373863 * @param array|string $object_type The taxonomy object type.
    38383864 * @return null|false Null if `$object_ids` is empty, false if all of the terms in
     
    38913917 * @since 2.3.0
    38923918 *
    3893  * @param array $terms List of Term objects to change
    3894  * @param string $taxonomy Optional. Update Term to this taxonomy in cache
    3895  */
    3896 function update_term_cache($terms, $taxonomy = '') {
     3919 * @param array  $terms    List of term objects to change.
     3920 * @param string $taxonomy Optional. Update Term to this taxonomy in cache. Default empty.
     3921 */
     3922function update_term_cache( $terms, $taxonomy = '' ) {
    38973923    foreach ( (array) $terms as $term ) {
    38983924        $term_taxonomy = $taxonomy;
     
    39113937 * Retrieves children of taxonomy as Term IDs.
    39123938 *
    3913  * @access private
     3939 * @ignore
    39143940 * @since 2.3.0
    39153941 *
    3916  * @param string $taxonomy Taxonomy Name
     3942 * @param string $taxonomy Taxonomy name.
    39173943 * @return array Empty if $taxonomy isn't hierarchical or returns children as Term IDs.
    39183944 */
    3919 function _get_term_hierarchy($taxonomy) {
     3945function _get_term_hierarchy( $taxonomy ) {
    39203946    if ( !is_taxonomy_hierarchical($taxonomy) )
    39213947        return array();
     
    39383964 * Get the subset of $terms that are descendants of $term_id.
    39393965 *
    3940  * If $terms is an array of objects, then _get_term_children returns an array of objects.
    3941  * If $terms is an array of IDs, then _get_term_children returns an array of IDs.
     3966 * If `$terms` is an array of objects, then _get_term_children() returns an array of objects.
     3967 * If `$terms` is an array of IDs, then _get_term_children() returns an array of IDs.
    39423968 *
    39433969 * @access private
    39443970 * @since 2.3.0
    39453971 *
    3946  * @param int $term_id The ancestor term: all returned terms should be descendants of $term_id.
     3972 * @param int    $term_id   The ancestor term: all returned terms should be descendants of `$term_id`.
    39473973 * @param array  $terms     The set of terms - either an array of term objects or term IDs - from which those that
    39483974 *                          are descendants of $term_id will be chosen.
    39493975 * @param string $taxonomy  The taxonomy which determines the hierarchy of the terms.
    3950  * @param array  $ancestors Term ancestors that have already been identified. Passed by reference, to keep track of
    3951  *                          found terms when recursing the hierarchy. The array of located ancestors is used to prevent
    3952  *                          infinite recursion loops. For performance, term_ids are used as array keys, with 1 as value.
     3976 * @param array  $ancestors Optional. Term ancestors that have already been identified. Passed by reference, to keep
     3977 *                          track of found terms when recursing the hierarchy. The array of located ancestors is used
     3978 *                          to prevent infinite recursion loops. For performance, `term_ids` are used as array keys,
     3979 *                          with 1 as value. Default empty array.
    39533980 * @return array The subset of $terms that are descendants of $term_id.
    39543981 */
     
    40134040 * @global wpdb $wpdb WordPress database abstraction object.
    40144041 *
    4015  * @param array $terms List of Term IDs
    4016  * @param string $taxonomy Term Context
     4042 * @param array  $terms    List of term IDs, passed by reference.
     4043 * @param string $taxonomy Term context.
    40174044 * @return null Will break from function if conditions are not met.
    40184045 */
    4019 function _pad_term_counts(&$terms, $taxonomy) {
     4046function _pad_term_counts( &$terms, $taxonomy ) {
    40204047    global $wpdb;
    40214048
     
    40384065    }
    40394066
    4040     // Get the object and term ids and stick them in a lookup table
     4067    // Get the object and term ids and stick them in a lookup table.
    40414068    $tax_obj = get_taxonomy($taxonomy);
    40424069    $object_types = esc_sql($tax_obj->object_type);
     
    40474074    }
    40484075
    4049     // Touch every ancestor's lookup row for each post in each term
     4076    // Touch every ancestor's lookup row for each post in each term.
    40504077    foreach ( $term_ids as $term_id ) {
    40514078        $child = $term_id;
     
    40654092    }
    40664093
    4067     // Transfer the touched cells
     4094    // Transfer the touched cells.
    40684095    foreach ( (array) $term_items as $id => $items )
    40694096        if ( isset($terms_by_id[$id]) )
     
    40864113 * @global wpdb $wpdb WordPress database abstraction object.
    40874114 *
    4088  * @param array $terms List of Term taxonomy IDs
    4089  * @param object $taxonomy Current taxonomy object of terms
     4115 * @param array $terms List of Term taxonomy IDs.
     4116 * @param object $taxonomy Current taxonomy object of terms.
    40904117 */
    40914118function _update_post_term_count( $terms, $taxonomy ) {
     
    41104137        $count = 0;
    41114138
    4112         // Attachments can be 'inherit' status, we need to base count off the parent's status if so
     4139        // Attachments can be 'inherit' status, we need to base count off the parent's status if so.
    41134140        if ( $check_attachments )
    41144141            $count += (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts p1 WHERE p1.ID = $wpdb->term_relationships.object_id AND ( post_status = 'publish' OR ( post_status = 'inherit' AND post_parent > 0 AND ( SELECT post_status FROM $wpdb->posts WHERE ID = p1.post_parent ) = 'publish' ) ) AND post_type = 'attachment' AND term_taxonomy_id = %d", $term ) );
     
    41294156 * Will update term count based on number of objects.
    41304157 *
    4131  * Default callback for the link_category taxonomy.
     4158 * Default callback for the 'link_category' taxonomy.
    41324159 *
    41334160 * @since 3.3.0
     
    41354162 * @global wpdb $wpdb WordPress database abstraction object.
    41364163 *
    4137  * @param array $terms List of Term taxonomy IDs
    4138  * @param object $taxonomy Current taxonomy object of terms
     4164 * @param array $terms List of term taxonomy IDs.
     4165 * @param object $taxonomy Current taxonomy object of terms.
    41394166 */
    41404167function _update_generic_term_count( $terms, $taxonomy ) {
     
    43564383 * @return string|WP_Error HTML link to taxonomy term archive on success, WP_Error if term does not exist.
    43574384 */
    4358 function get_term_link( $term, $taxonomy = '') {
     4385function get_term_link( $term, $taxonomy = '' ) {
    43594386    global $wp_rewrite;
    43604387
     
    44534480 *
    44544481 * @param array $args {
    4455  *     Arguments about which post to use and how to format the output. Shares all of the arguments supported by
    4456  *     {@link get_the_taxonomies()}, in addition to the following.
     4482 *     Arguments about which post to use and how to format the output. Shares all of the arguments
     4483 *     supported by get_the_taxonomies(), in addition to the following.
    44574484 *
    44584485 *     @type  int|WP_Post $post   Post ID or object to get taxonomies of. Default current post.
     
    44864513 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
    44874514 * @param array $args {
    4488  *     Arguments about how to format the list of taxonomies.
     4515 *     Optional. Arguments about how to format the list of taxonomies. Default empty array.
    44894516 *
    44904517 *     @type string $template      Template for displaying a taxonomy label and list of terms.
     
    45644591 * @since 2.7.0
    45654592 *
    4566  * @param int $object_id ID of the object (post ID, link ID, ...)
    4567  * @param string $taxonomy Single taxonomy name
    4568  * @param int|string|array $terms Optional. Term term_id, name, slug or array of said
     4593 * @param int              $object_id ID of the object (post ID, link ID, ...).
     4594 * @param string           $taxonomy  Single taxonomy name.
     4595 * @param int|string|array $terms     Optional. Term term_id, name, slug or array of said. Default null.
    45694596 * @return bool|WP_Error WP_Error on input error.
    45704597 */
     
    46174644 * @since 3.0.0
    46184645 *
    4619  * @param string $object_type Object type string
    4620  * @param string $taxonomy Single taxonomy name
     4646 * @param string $object_type Object type string.
     4647 * @param string $taxonomy    Single taxonomy name.
    46214648 * @return bool True if object is associated with the taxonomy, otherwise false.
    46224649 */
     
    46904717
    46914718/**
    4692  * Returns the term's parent's term_ID
     4719 * Returns the term's parent's term_ID.
    46934720 *
    46944721 * @since 3.1.0
    46954722 *
    4696  * @param int $term_id
    4697  * @param string $taxonomy
    4698  *
    4699  * @return int|bool false on error
     4723 * @param int    $term_id  Term ID.
     4724 * @param string $taxonomy Taxonomy name.
     4725 * @return int|bool False on error.
    47004726 */
    47014727function wp_get_term_taxonomy_parent_id( $term_id, $taxonomy ) {
     
    47104736 * Prevents loops from forming and breaks those that it finds.
    47114737 *
    4712  * Attached to the wp_update_term_parent filter.
     4738 * Attached to the {@see 'wp_update_term_parent'} filter.
    47134739 *
    47144740 * @since 3.1.0
    47154741 *
    4716  * @param int $parent term_id of the parent for the term we're checking.
    4717  * @param int $term_id The term we're checking.
     4742 * @param int    $parent   `term_id` of the parent for the term we're checking.
     4743 * @param int    $term_id The term we're checking.
    47184744 * @param string $taxonomy The taxonomy of the term we're checking.
    47194745 *
     
    47254751        return 0;
    47264752
    4727     // Can't be its own parent
     4753    // Can't be its own parent.
    47284754    if ( $parent == $term_id )
    47294755        return 0;
    47304756
    4731     // Now look for larger loops
    4732 
     4757    // Now look for larger loops.
    47334758    if ( !$loop = wp_find_hierarchy_loop( 'wp_get_term_taxonomy_parent_id', $term_id, $parent, array( $taxonomy ) ) )
    47344759        return $parent; // No loop
    47354760
    4736     // Setting $parent to the given value causes a loop
     4761    // Setting $parent to the given value causes a loop.
    47374762    if ( isset( $loop[$term_id] ) )
    47384763        return 0;
Note: See TracChangeset for help on using the changeset viewer.