Make WordPress Core

Ticket #9882: 9882.2.patch

File 9882.2.patch, 2.3 KB (added by johnbillion, 14 years ago)

refreshed patch for 3.0

  • 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_cat_ancestor_of($cat_ID, $parent) ) )
    140140                $parent = 0;
    141141
    142142        $args = compact('name', 'slug', 'parent', 'description');
  • wp-includes/category.php

     
    200200 * You can use either an id or the category object for both parameters. If you
    201201 * use an integer the category will be retrieved.
    202202 *
    203  * @since 2.1.0
     203 * @since 3.0
    204204 *
    205205 * @param int|object $cat1 ID or object to check if this is the parent category.
    206206 * @param int|object $cat2 The child category.
    207207 * @return bool Whether $cat2 is child of $cat1
    208208 */
    209 function cat_is_ancestor_of( $cat1, $cat2 ) {
     209function is_cat_ancestor_of( $cat1, $cat2 ) {
    210210        if ( ! isset($cat1->term_id) )
    211211                $cat1 = &get_category( $cat1 );
    212212        if ( ! isset($cat2->parent) )
     
    217217        if ( $cat2->parent == $cat1->term_id )
    218218                return true;
    219219
    220         return cat_is_ancestor_of( $cat1, get_category( $cat2->parent ) );
     220        return is_cat_ancestor_of( $cat1, get_category( $cat2->parent ) );
    221221}
    222222
    223223
  • wp-includes/deprecated.php

     
    25132513        _deprecated_function( __FUNCTION__, '3.0' );
    25142514        return '';
    25152515}
     2516
     2517/**
     2518 * Check if a category is an ancestor of another category.
     2519 *
     2520 * @since 2.1.0
     2521 * @deprecated 3.0
     2522 * @deprecated Use is_cat_ancestor_of()
     2523 * @see is_cat_ancestor_of()
     2524 *
     2525 * @param int|object $cat1 ID or object to check if this is the parent category.
     2526 * @param int|object $cat2 The child category.
     2527 * @return bool Whether $cat2 is child of $cat1
     2528 */
     2529function cat_is_ancestor_of( $cat1, $cat2 ) {
     2530        _deprecated_function( __FUNCTION__, '3.0', 'is_cat_ancestor_of()' );
     2531
     2532        return is_cat_ancestor_of( $cat1, $cat2 );
     2533}
     2534