Bad cat ID cleanup

git-svn-id: http://svn.automattic.com/wordpress/trunk@2616 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
matt 2005-05-27 06:10:41 +00:00
parent a185b7376e
commit b3a5117b6d
3 changed files with 13 additions and 10 deletions

View File

@ -543,6 +543,8 @@ function &get_category(&$category, $output = OBJECT) {
if ( empty($category) )
return null;
$category = (int) $category;
if ( ! isset($cache_categories))
update_category_cache();

View File

@ -101,6 +101,7 @@ function the_category($separator = '', $parents='') {
}
function get_the_category_by_ID($cat_ID) {
$cat_ID = (int) $cat_ID;
$category = &get_category($cat_ID);
return $category->cat_name;
}

View File

@ -205,16 +205,16 @@ function single_post_title($prefix = '', $display = true) {
}
function single_cat_title($prefix = '', $display = true ) {
$cat = get_query_var('cat');
if(!empty($cat) && !(strtoupper($cat) == 'ALL')) {
$my_cat_name = get_the_category_by_ID($cat);
if(!empty($my_cat_name)) {
if ($display)
echo $prefix.strip_tags($my_cat_name);
else
return strip_tags($my_cat_name);
}
}
$cat = intval( get_query_var('cat') );
if( !empty($cat) && !(strtoupper($cat) == 'ALL') ) {
$my_cat_name = get_the_category_by_ID($cat);
if( !empty($my_cat_name) ) {
if ($display)
echo $prefix.strip_tags($my_cat_name);
else
return strip_tags($my_cat_name);
}
}
}
function single_month_title($prefix = '', $display = true ) {