Make WordPress Core

Ticket #9882: 9882.patch

File 9882.patch, 1.9 KB (added by ramiy, 15 years ago)
  • wp-admin/includes/taxonomy.php

     
    136136        if ( $parent < 0 )
    137137                $parent = 0;
    138138
    139         if ( empty($parent) || !category_exists( $parent ) || ($cat_ID && cat_is_ancestor_of($cat_ID, $parent) ) )
     139        if ( empty($parent) || !category_exists( $parent ) || ($cat_ID && is_category_ancestor_of($cat_ID, $parent) ) )
    140140                $parent = 0;
    141141
    142142        $args = compact('name', 'slug', 'parent', 'description');
  • wp-includes/category.php

     
    194194 * use an integer the category will be retrieved.
    195195 *
    196196 * @since 2.1.0
     197 * @deprecated 2.8.1
     198 * @deprecated Use is_category_ancestor_of()
     199 */
     200function cat_is_ancestor_of( $cat1, $cat2 ) {
     201        _deprecated_function(__FUNCTION__, '2.8.1', 'is_category_ancestor_of()' );
     202        return is_category_ancestor_of( $cat1, $cat2 );
     203}
     204
     205/**
     206 * Check if a category is an ancestor of another category.
    197207 *
     208 * You can use either an id or the category object for both parameters. If you
     209 * use an integer the category will be retrieved.
     210 *
     211 * @since 2.8.1
     212 *
    198213 * @param int|object $cat1 ID or object to check if this is the parent category.
    199214 * @param int|object $cat2 The child category.
    200215 * @return bool Whether $cat2 is child of $cat1
    201216 */
    202 function cat_is_ancestor_of( $cat1, $cat2 ) {
     217function is_category_ancestor_of( $cat1, $cat2 ) {
    203218        if ( ! isset($cat1->term_id) )
    204219                $cat1 = &get_category( $cat1 );
    205220        if ( ! isset($cat2->parent) )
     
    210225        if ( $cat2->parent == $cat1->term_id )
    211226                return true;
    212227
    213         return cat_is_ancestor_of( $cat1, get_category( $cat2->parent ) );
     228        return is_category_ancestor_of( $cat1, get_category( $cat2->parent ) );
    214229}
    215230
    216231