Make WordPress Core

Changeset 2616


Ignore:
Timestamp:
05/27/2005 06:10:41 AM (21 years ago)
Author:
matt
Message:

Bad cat ID cleanup

Location:
trunk/wp-includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r2612 r2616  
    543543    if ( empty($category) )
    544544        return null;
     545
     546    $category = (int) $category;
    545547
    546548    if ( ! isset($cache_categories))
  • trunk/wp-includes/template-functions-category.php

    r2608 r2616  
    102102
    103103function get_the_category_by_ID($cat_ID) {
     104    $cat_ID = (int) $cat_ID;
    104105    $category = &get_category($cat_ID);
    105106    return $category->cat_name;
  • trunk/wp-includes/template-functions-general.php

    r2513 r2616  
    206206
    207207function single_cat_title($prefix = '', $display = true ) {
    208       $cat = get_query_var('cat');
    209     if(!empty($cat) && !(strtoupper($cat) == 'ALL')) {
    210         $my_cat_name = get_the_category_by_ID($cat);
    211         if(!empty($my_cat_name)) {
    212             if ($display)
    213                 echo $prefix.strip_tags($my_cat_name);
    214             else
    215                 return strip_tags($my_cat_name);
    216         }
    217     }
     208    $cat = intval( get_query_var('cat') );
     209    if( !empty($cat) && !(strtoupper($cat) == 'ALL') ) {
     210        $my_cat_name = get_the_category_by_ID($cat);
     211        if( !empty($my_cat_name) ) {
     212            if ($display)
     213                echo $prefix.strip_tags($my_cat_name);
     214            else
     215                return strip_tags($my_cat_name);
     216        }
     217    }
    218218}
    219219
Note: See TracChangeset for help on using the changeset viewer.