]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/category.php
WordPress 3.4.2
[autoinstalls/wordpress.git] / wp-includes / category.php
index 4d022774178209526d4fccf5f0c5e692c2ca9d6c..17283d01a9186b587bce76b76e7fb25d992a5a50 100644 (file)
@@ -160,7 +160,6 @@ function get_category_by_slug( $slug  ) {
        return $category;
 }
 
-
 /**
  * Retrieve the ID of a category from its name.
  *
@@ -176,7 +175,6 @@ function get_cat_ID( $cat_name='General' ) {
        return 0;
 }
 
-
 /**
  * Retrieve the name of a category from its ID.
  *
@@ -193,7 +191,6 @@ function get_cat_name( $cat_id ) {
        return $category->name;
 }
 
-
 /**
  * Check if a category is an ancestor of another category.
  *
@@ -207,20 +204,9 @@ function get_cat_name( $cat_id ) {
  * @return bool Whether $cat2 is child of $cat1
  */
 function cat_is_ancestor_of( $cat1, $cat2 ) {
-       if ( ! isset($cat1->term_id) )
-               $cat1 = &get_category( $cat1 );
-       if ( ! isset($cat2->parent) )
-               $cat2 = &get_category( $cat2 );
-
-       if ( empty($cat1->term_id) || empty($cat2->parent) )
-               return false;
-       if ( $cat2->parent == $cat1->term_id )
-               return true;
-
-       return cat_is_ancestor_of( $cat1, get_category( $cat2->parent ) );
+       return term_is_ancestor_of( $cat1, $cat2, 'category' );
 }
 
-
 /**
  * Sanitizes category data based on context.
  *
@@ -235,7 +221,6 @@ function sanitize_category( $category, $context = 'display' ) {
        return sanitize_term( $category, 'category', $context );
 }
 
-
 /**
  * Sanitizes data in single category key field.
  *
@@ -254,7 +239,6 @@ function sanitize_category_field( $field, $value, $cat_id, $context ) {
 
 /* Tags */
 
-
 /**
  * Retrieves all post tags.
  *
@@ -277,7 +261,6 @@ function &get_tags( $args = '' ) {
        return $tags;
 }
 
-
 /**
  * Retrieve post tag by tag ID or tag object.
  *
@@ -301,10 +284,8 @@ function &get_tag( $tag, $output = OBJECT, $filter = 'raw' ) {
        return get_term( $tag, 'post_tag', $output, $filter );
 }
 
-
 /* Cache */
 
-
 /**
  * Remove the category cache data based on ID.
  *
@@ -317,7 +298,6 @@ function clean_category_cache( $id ) {
        clean_term_cache( $id, 'category' );
 }
 
-
 /**
  * Update category structure to old pre 2.3 from new taxonomy structure.
  *
@@ -354,6 +334,3 @@ function _make_cat_compat( &$category ) {
                $category['category_parent'] = &$category['parent'];
        }
 }
-
-
-?>