Pass arg array to get_categories filters. Props ryanscheuermann. fixes #2934

git-svn-id: https://develop.svn.wordpress.org/trunk@4013 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2006-07-11 03:33:25 +00:00
parent 49769340ca
commit 9b1204792a
1 changed files with 9 additions and 9 deletions

View File

@ -28,8 +28,8 @@ function &get_categories($args = '') {
$where = 'cat_ID > 0'; $where = 'cat_ID > 0';
$inclusions = ''; $inclusions = '';
if ( !empty($include) ) { if ( !empty($include) ) {
$child_of = 0; //ignore child_of and exclude params if using include $child_of = 0; //ignore child_of and exclude params if using include
$exclude = ''; $exclude = '';
$incategories = preg_split('/[\s,]+/',$include); $incategories = preg_split('/[\s,]+/',$include);
if ( count($incategories) ) { if ( count($incategories) ) {
foreach ( $incategories as $incat ) { foreach ( $incategories as $incat ) {
@ -40,8 +40,8 @@ function &get_categories($args = '') {
} }
} }
} }
if (!empty($inclusions)) if (!empty($inclusions))
$inclusions .= ')'; $inclusions .= ')';
$where .= $inclusions; $where .= $inclusions;
$exclusions = ''; $exclusions = '';
@ -57,9 +57,9 @@ function &get_categories($args = '') {
} }
} }
} }
if (!empty($exclusions)) if (!empty($exclusions))
$exclusions .= ')'; $exclusions .= ')';
$exclusions = apply_filters('list_cats_exclusions', $exclusions ); $exclusions = apply_filters('list_cats_exclusions', $exclusions, $r );
$where .= $exclusions; $where .= $exclusions;
$having = ''; $having = '';
@ -85,7 +85,7 @@ function &get_categories($args = '') {
function stamp_cat($cat) { function stamp_cat($cat) {
global $cat_stamps; global $cat_stamps;
$cat->last_update_timestamp = $cat_stamps[$cat->cat_ID]; $cat->last_update_timestamp = $cat_stamps[$cat->cat_ID];
return $cat; return $cat;
} }
$categories = array_map('stamp_cat', $categories); $categories = array_map('stamp_cat', $categories);
unset($cat_stamps); unset($cat_stamps);
@ -94,7 +94,7 @@ function &get_categories($args = '') {
if ( $child_of || $hierarchical ) if ( $child_of || $hierarchical )
$categories = & _get_cat_children($child_of, $categories); $categories = & _get_cat_children($child_of, $categories);
return apply_filters('get_categories', $categories); return apply_filters('get_categories', $categories, $r);
} }
// Retrieves category data given a category ID or category object. // Retrieves category data given a category ID or category object.
@ -141,7 +141,7 @@ function get_category_by_path($category_path, $full_match = true, $output = OBJE
$categories = $wpdb->get_results("SELECT cat_ID, category_nicename, category_parent FROM $wpdb->categories WHERE category_nicename = '$leaf_path'"); $categories = $wpdb->get_results("SELECT cat_ID, category_nicename, category_parent FROM $wpdb->categories WHERE category_nicename = '$leaf_path'");
if ( empty($categories) ) if ( empty($categories) )
return NULL; return NULL;
foreach ($categories as $category) { foreach ($categories as $category) {