WordPress.org

Make WordPress Core

Changeset 8574


Ignore:
Timestamp:
08/06/2008 09:01:46 PM (10 years ago)
Author:
markjaquith
Message:

Whitespacing/coding standards cleanup for category-template.php

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/category-template.php

    r8572 r8574  
    11<?php
    22
    3 function get_category_children($id, $before = '/', $after = '', $visited=array()) {
     3function get_category_children( $id, $before = '/', $after = '', $visited = array() ) {
    44    if ( 0 == $id )
    55        return '';
     
    1212            continue;
    1313
    14         $category = get_category($cat_id);
     14        $category = get_category( $cat_id );
    1515        if ( is_wp_error( $category ) )
    1616            return $category;
    17         if ( $category->parent == $id && !in_array($category->term_id, $visited) ) {
     17        if ( $category->parent == $id && !in_array( $category->term_id, $visited ) ) {
    1818            $visited[] = $category->term_id;
    1919            $chain .= $before.$category->term_id.$after;
    20             $chain .= get_category_children($category->term_id, $before, $after);
     20            $chain .= get_category_children( $category->term_id, $before, $after );
    2121        }
    2222    }
     
    2424}
    2525
    26 function get_category_link($category_id) {
     26function get_category_link( $category_id ) {
    2727    global $wp_rewrite;
    2828    $catlink = $wp_rewrite->get_category_permastruct();
    2929
    30     if ( empty($catlink) ) {
    31         $file = get_option('home') . '/';
     30    if ( empty( $catlink ) ) {
     31        $file = get_option( 'home' ) . '/';
    3232        $catlink = $file . '?cat=' . $category_id;
    3333    } else {
    34         $category = &get_category($category_id);
     34        $category = &get_category( $category_id );
    3535        if ( is_wp_error( $category ) )
    3636            return $category;
     
    3838
    3939        if ( $parent = $category->parent )
    40             $category_nicename = get_category_parents($parent, false, '/', true) . $category_nicename;
    41 
    42         $catlink = str_replace('%category%', $category_nicename, $catlink);
    43         $catlink = get_option('home') . user_trailingslashit($catlink, 'category');
    44     }
    45     return apply_filters('category_link', $catlink, $category_id);
    46 }
    47 
    48 function get_category_parents($id, $link = FALSE, $separator = '/', $nicename = FALSE, $visited = array()){
     40            $category_nicename = get_category_parents( $parent, false, '/', true ) . $category_nicename;
     41
     42        $catlink = str_replace( '%category%', $category_nicename, $catlink );
     43        $catlink = get_option( 'home' ) . user_trailingslashit( $catlink, 'category' );
     44    }
     45    return apply_filters( 'category_link', $catlink, $category_id );
     46}
     47
     48function get_category_parents( $id, $link = FALSE, $separator = '/', $nicename = FALSE, $visited = array() ) {
    4949    $chain = '';
    50     $parent = &get_category($id);
     50    $parent = &get_category( $id );
    5151    if ( is_wp_error( $parent ) )
    5252        return $parent;
     
    5757        $name = $parent->cat_name;
    5858
    59     if ( $parent->parent && ($parent->parent != $parent->term_id) && !in_array($parent->parent, $visited) ) {
     59    if ( $parent->parent && ( $parent->parent != $parent->term_id ) && !in_array( $parent->parent, $visited ) ) {
    6060        $visited[] = $parent->parent;
    61         $chain .= get_category_parents($parent->parent, $link, $separator, $nicename, $visited);
     61        $chain .= get_category_parents( $parent->parent, $link, $separator, $nicename, $visited );
    6262    }
    6363
    6464    if ( $link )
    65         $chain .= '<a href="' . get_category_link($parent->term_id) . '" title="' . sprintf(__("View all posts in %s"), $parent->cat_name) . '">'.$name.'</a>' . $separator;
     65        $chain .= '<a href="' . get_category_link( $parent->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $parent->cat_name ) . '">'.$name.'</a>' . $separator;
    6666    else
    6767        $chain .= $name.$separator;
     
    6969}
    7070
    71 function get_the_category($id = false) {
     71function get_the_category( $id = false ) {
    7272    global $post;
    7373
     
    7676        $id = (int) $post->ID;
    7777
    78     $categories = get_object_term_cache($id, 'category');
     78    $categories = get_object_term_cache( $id, 'category' );
    7979    if ( false === $categories )
    80         $categories = wp_get_object_terms($id, 'category');
    81 
    82     if ( !empty($categories) )
    83         usort($categories, '_usort_terms_by_name');
     80        $categories = wp_get_object_terms( $id, 'category' );
     81
     82    if ( !empty( $categories ) )
     83        usort( $categories, '_usort_terms_by_name' );
    8484    else
    8585        $categories = array();
    8686
    87     foreach( (array) array_keys($categories) as $key) {
    88         _make_cat_compat($categories[$key]);
     87    foreach ( (array) array_keys( $categories ) as $key ) {
     88        _make_cat_compat( $categories[$key] );
    8989    }
    9090
     
    9292}
    9393
    94 function _usort_terms_by_name($a, $b) {
    95     return strcmp($a->name, $b->name);
    96 }
    97 
    98 function _usort_terms_by_ID($a, $b) {
     94function _usort_terms_by_name( $a, $b ) {
     95    return strcmp( $a->name, $b->name );
     96}
     97
     98function _usort_terms_by_ID( $a, $b ) {
    9999    if ( $a->term_id > $b->term_id )
    100100        return 1;
     
    105105}
    106106
    107 function get_the_category_by_ID($cat_ID) {
     107function get_the_category_by_ID( $cat_ID ) {
    108108    $cat_ID = (int) $cat_ID;
    109     $category = &get_category($cat_ID);
     109    $category = &get_category( $cat_ID );
    110110    if ( is_wp_error( $category ) )
    111111        return $category;
     
    113113}
    114114
    115 function get_the_category_list($separator = '', $parents='', $post_id = false) {
     115function get_the_category_list( $separator = '', $parents='', $post_id = false ) {
    116116    global $wp_rewrite;
    117     $categories = get_the_category($post_id);
    118     if (empty($categories))
    119         return apply_filters('the_category', __('Uncategorized'), $separator, $parents);
    120 
    121     $rel = ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() ) ? 'rel="category tag"' : 'rel="category"';
     117    $categories = get_the_category( $post_id );
     118    if ( empty( $categories ) )
     119        return apply_filters( 'the_category', __( 'Uncategorized' ), $separator, $parents );
     120
     121    $rel = ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) ? 'rel="category tag"' : 'rel="category"';
    122122
    123123    $thelist = '';
     
    126126        foreach ( $categories as $category ) {
    127127            $thelist .= "\n\t<li>";
    128             switch ( strtolower($parents) ) {
     128            switch ( strtolower( $parents ) ) {
    129129                case 'multiple':
    130                     if ($category->parent)
    131                         $thelist .= get_category_parents($category->parent, TRUE);
    132                     $thelist .= '<a href="' . get_category_link($category->term_id) . '" title="' . sprintf(__("View all posts in %s"), $category->name) . '" ' . $rel . '>' . $category->name.'</a></li>';
     130                    if ( $category->parent )
     131                        $thelist .= get_category_parents( $category->parent, TRUE );
     132                    $thelist .= '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . $rel . '>' . $category->name.'</a></li>';
    133133                    break;
    134134                case 'single':
    135                     $thelist .= '<a href="' . get_category_link($category->term_id) . '" title="' . sprintf(__("View all posts in %s"), $category->name) . '" ' . $rel . '>';
    136                     if ($category->parent)
    137                         $thelist .= get_category_parents($category->parent, FALSE);
     135                    $thelist .= '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . $rel . '>';
     136                    if ( $category->parent )
     137                        $thelist .= get_category_parents( $category->parent, FALSE );
    138138                    $thelist .= $category->name.'</a></li>';
    139139                    break;
    140140                case '':
    141141                default:
    142                     $thelist .= '<a href="' . get_category_link($category->term_id) . '" title="' . sprintf(__("View all posts in %s"), $category->name) . '" ' . $rel . '>' . $category->cat_name.'</a></li>';
     142                    $thelist .= '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . $rel . '>' . $category->cat_name.'</a></li>';
    143143            }
    144144        }
     
    149149            if ( 0 < $i )
    150150                $thelist .= $separator . ' ';
    151             switch ( strtolower($parents) ) {
     151            switch ( strtolower( $parents ) ) {
    152152                case 'multiple':
    153153                    if ( $category->parent )
    154                         $thelist .= get_category_parents($category->parent, TRUE);
    155                     $thelist .= '<a href="' . get_category_link($category->term_id) . '" title="' . sprintf(__("View all posts in %s"), $category->name) . '" ' . $rel . '>' . $category->cat_name.'</a>';
     154                        $thelist .= get_category_parents( $category->parent, TRUE );
     155                    $thelist .= '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . $rel . '>' . $category->cat_name.'</a>';
    156156                    break;
    157157                case 'single':
    158                     $thelist .= '<a href="' . get_category_link($category->term_id) . '" title="' . sprintf(__("View all posts in %s"), $category->name) . '" ' . $rel . '>';
     158                    $thelist .= '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . $rel . '>';
    159159                    if ( $category->parent )
    160                         $thelist .= get_category_parents($category->parent, FALSE);
     160                        $thelist .= get_category_parents( $category->parent, FALSE );
    161161                    $thelist .= "$category->cat_name</a>";
    162162                    break;
    163163                case '':
    164164                default:
    165                     $thelist .= '<a href="' . get_category_link($category->term_id) . '" title="' . sprintf(__("View all posts in %s"), $category->name) . '" ' . $rel . '>' . $category->name.'</a>';
     165                    $thelist .= '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . $rel . '>' . $category->name.'</a>';
    166166            }
    167167            ++$i;
    168168        }
    169169    }
    170     return apply_filters('the_category', $thelist, $separator, $parents);
     170    return apply_filters( 'the_category', $thelist, $separator, $parents );
    171171}
    172172
     
    186186    global $post;
    187187
    188     if ( empty($category) )
     188    if ( empty( $category ) )
    189189        return false;
    190190
    191191    // If category is not an int, check to see if it's a name
    192     if ( ! is_int($category) ) {
    193         $cat_ID = get_cat_ID($category);
     192    if ( ! is_int( $category ) ) {
     193        $cat_ID = get_cat_ID( $category );
    194194        if ( $cat_ID )
    195195            $category = $cat_ID;
    196196    }
    197197
    198     $categories = get_object_term_cache($post->ID, 'category');
     198    $categories = get_object_term_cache( $post->ID, 'category' );
    199199    if ( false === $categories )
    200         $categories = wp_get_object_terms($post->ID, 'category');
    201     if ( array_key_exists($category, $categories) )
     200        $categories = wp_get_object_terms( $post->ID, 'category' );
     201    if ( array_key_exists( $category, $categories ) )
    202202        return true;
    203203    else
     
    205205}
    206206
    207 function the_category($separator = '', $parents='', $post_id = false) {
    208     echo get_the_category_list($separator, $parents, $post_id);
    209 }
    210 
    211 function category_description($category = 0) {
     207function the_category( $separator = '', $parents='', $post_id = false ) {
     208    echo get_the_category_list( $separator, $parents, $post_id );
     209}
     210
     211function category_description( $category = 0 ) {
    212212    global $cat;
    213213    if ( !$category )
    214214        $category = $cat;
    215215
    216     return get_term_field('description', $category, 'category');
    217 }
    218 
    219 function wp_dropdown_categories($args = '') {
     216    return get_term_field( 'description', $category, 'category' );
     217}
     218
     219function wp_dropdown_categories( $args = '' ) {
    220220    $defaults = array(
    221221        'show_option_all' => '', 'show_option_none' => '',
     
    229229    );
    230230
    231     $defaults['selected'] = ( is_category() ) ? get_query_var('cat') : 0;
     231    $defaults['selected'] = ( is_category() ) ? get_query_var( 'cat' ) : 0;
    232232
    233233    $r = wp_parse_args( $args, $defaults );
     
    239239        $tab_index_attribute = " tabindex=\"$tab_index\"";
    240240
    241     $categories = get_categories($r);
     241    $categories = get_categories( $r );
    242242
    243243    $output = '';
    244     if ( ! empty($categories) ) {
     244    if ( ! empty( $categories ) ) {
    245245        $output = "<select name='$name' id='$name' class='$class' $tab_index_attribute>\n";
    246246
    247247        if ( $show_option_all ) {
    248             $show_option_all = apply_filters('list_cats', $show_option_all);
     248            $show_option_all = apply_filters( 'list_cats', $show_option_all );
    249249            $output .= "\t<option value='0'>$show_option_all</option>\n";
    250250        }
    251251
    252         if ( $show_option_none) {
    253             $show_option_none = apply_filters('list_cats', $show_option_none);
     252        if ( $show_option_none ) {
     253            $show_option_none = apply_filters( 'list_cats', $show_option_none );
    254254            $output .= "\t<option value='-1'>$show_option_none</option>\n";
    255255        }
     
    260260            $depth = -1; // Flat.
    261261
    262         $output .= walk_category_dropdown_tree($categories, $depth, $r);
     262        $output .= walk_category_dropdown_tree( $categories, $depth, $r );
    263263        $output .= "</select>\n";
    264264    }
    265265
    266     $output = apply_filters('wp_dropdown_cats', $output);
     266    $output = apply_filters( 'wp_dropdown_cats', $output );
    267267
    268268    if ( $echo )
     
    272272}
    273273
    274 function wp_list_categories($args = '') {
     274function wp_list_categories( $args = '' ) {
    275275    $defaults = array(
    276276        'show_option_all' => '', 'orderby' => 'name',
     
    280280        'child_of' => 0, 'feed' => '', 'feed_type' => '',
    281281        'feed_image' => '', 'exclude' => '', 'current_category' => 0,
    282         'hierarchical' => true, 'title_li' => __('Categories'),
     282        'hierarchical' => true, 'title_li' => __( 'Categories' ),
    283283        'echo' => 1, 'depth' => 0
    284284    );
     
    296296    extract( $r );
    297297
    298     $categories = get_categories($r);
     298    $categories = get_categories( $r );
    299299
    300300    $output = '';
     
    302302            $output = '<li class="categories">' . $r['title_li'] . '<ul>';
    303303
    304     if ( empty($categories) ) {
     304    if ( empty( $categories ) ) {
    305305        if ( 'list' == $style )
    306             $output .= '<li>' . __("No categories") . '</li>';
     306            $output .= '<li>' . __( "No categories" ) . '</li>';
    307307        else
    308             $output .= __("No categories");
     308            $output .= __( "No categories" );
    309309    } else {
    310310        global $wp_query;
    311311
    312         if( !empty($show_option_all) )
    313             if ('list' == $style )
    314                 $output .= '<li><a href="' .  get_bloginfo('url')  . '">' . $show_option_all . '</a></li>';
     312        if( !empty( $show_option_all ) )
     313            if ( 'list' == $style )
     314                $output .= '<li><a href="' .  get_bloginfo( 'url' )  . '">' . $show_option_all . '</a></li>';
    315315            else
    316                 $output .= '<a href="' .  get_bloginfo('url')  . '">' . $show_option_all . '</a>';
     316                $output .= '<a href="' .  get_bloginfo( 'url' )  . '">' . $show_option_all . '</a>';
    317317
    318318        if ( empty( $r['current_category'] ) && is_category() )
     
    324324            $depth = -1; // Flat.
    325325
    326         $output .= walk_category_tree($categories, $depth, $r);
     326        $output .= walk_category_tree( $categories, $depth, $r );
    327327    }
    328328
     
    330330        $output .= '</ul></li>';
    331331
    332     $output = apply_filters('wp_list_categories', $output);
     332    $output = apply_filters( 'wp_list_categories', $output );
    333333
    334334    if ( $echo )
     
    346346    $args = wp_parse_args( $args, $defaults );
    347347
    348     $tags = get_tags( array_merge($args, array('orderby' => 'count', 'order' => 'DESC')) ); // Always query top tags
    349 
    350     if ( empty($tags) )
     348    $tags = get_tags( array_merge( $args, array( 'orderby' => 'count', 'order' => 'DESC' ) ) ); // Always query top tags
     349
     350    if ( empty( $tags ) )
    351351        return;
    352352
     
    374374 *
    375375 * TODO: Complete
    376  * 
    377  * @since 2.6 
     376 *
     377 * @since 2.6
    378378 *
    379379 * $tags = array of objects with the properties 'name', 'link', 'id', and 'count'
     
    389389    );
    390390    $args = wp_parse_args( $args, $defaults );
    391     extract($args);
    392 
    393     if ( empty($tags) )
     391    extract( $args );
     392
     393    if ( empty( $tags ) )
    394394        return;
    395395
     
    398398        $counts[ $key ] = $tag->count;
    399399
    400     $min_count = min($counts);
    401     $spread = max($counts) - $min_count;
     400    $min_count = min( $counts );
     401    $spread = max( $counts ) - $min_count;
    402402    if ( $spread <= 0 )
    403403        $spread = 1;
     
    409409    // SQL cannot save you; this is a second (potentially different) sort on a subset of data.
    410410    if ( 'name' == $orderby )
    411         uksort($counts, 'strnatcasecmp');
    412     else
    413         asort($counts);
     411        uksort( $counts, 'strnatcasecmp' );
     412    else
     413        asort( $counts );
    414414
    415415    if ( 'DESC' == $order )
    416416        $counts = array_reverse( $counts, true );
    417417    elseif ( 'RAND' == $order ) {
    418         $keys = array_rand( $counts, count($counts) );
     418        $keys = array_rand( $counts, count( $counts ) );
    419419        foreach ( $keys as $key )
    420420            $temp[$key] = $counts[$key];
    421421        $counts = $temp;
    422         unset($temp);
     422        unset( $temp );
    423423    }
    424424
    425425    $a = array();
    426426
    427     $rel = ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() ) ? ' rel="tag"' : '';
     427    $rel = ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) ? ' rel="tag"' : '';
    428428
    429429    foreach ( $counts as $key => $count ) {
     
    431431        $tag_id = $tags[ $key ]->id;
    432432        $tag_name = $tags[ $key ]->name;
    433        
    434         $a[] = "<a href='$tag_link' class='tag-link-$tag_id' title='" . attribute_escape( sprintf( __ngettext($single_text, $multiple_text, $count), $count ) ) . "'$rel style='font-size: " .
     433        $a[] = "<a href='$tag_link' class='tag-link-$tag_id' title='" . attribute_escape( sprintf( __ngettext( $single_text, $multiple_text, $count ), $count ) ) . "'$rel style='font-size: " .
    435434            ( $smallest + ( ( $count - $min_count ) * $font_step ) )
    436435            . "$unit;'>$tag_name</a>";
     
    443442    case 'list' :
    444443        $return = "<ul class='wp-tag-cloud'>\n\t<li>";
    445         $return .= join("</li>\n\t<li>", $a);
     444        $return .= join( "</li>\n\t<li>", $a );
    446445        $return .= "</li>\n</ul>\n";
    447446        break;
    448447    default :
    449         $return = join("\n", $a);
     448        $return = join( "\n", $a );
    450449        break;
    451450    endswitch;
     
    461460    $walker = new Walker_Category;
    462461    $args = func_get_args();
    463     return call_user_func_array(array(&$walker, 'walk'), $args);
     462    return call_user_func_array(array( &$walker, 'walk' ), $args );
    464463}
    465464
     
    467466    $walker = new Walker_CategoryDropdown;
    468467    $args = func_get_args();
    469     return call_user_func_array(array(&$walker, 'walk'), $args);
     468    return call_user_func_array(array( &$walker, 'walk' ), $args );
    470469}
    471470
     
    478477    $taglink = $wp_rewrite->get_tag_permastruct();
    479478
    480     $tag = &get_term($tag_id, 'post_tag');
     479    $tag = &get_term( $tag_id, 'post_tag' );
    481480    if ( is_wp_error( $tag ) )
    482481        return $tag;
    483482    $slug = $tag->slug;
    484483
    485     if ( empty($taglink) ) {
    486         $file = get_option('home') . '/';
     484    if ( empty( $taglink ) ) {
     485        $file = get_option( 'home' ) . '/';
    487486        $taglink = $file . '?tag=' . $slug;
    488487    } else {
    489         $taglink = str_replace('%tag%', $slug, $taglink);
    490         $taglink = get_option('home') . user_trailingslashit($taglink, 'category');
    491     }
    492     return apply_filters('tag_link', $taglink, $tag_id);
     488        $taglink = str_replace( '%tag%', $slug, $taglink );
     489        $taglink = get_option( 'home' ) . user_trailingslashit( $taglink, 'category' );
     490    }
     491    return apply_filters( 'tag_link', $taglink, $tag_id );
    493492}
    494493
    495494function get_the_tags( $id = 0 ) {
    496     return apply_filters( 'get_the_tags', get_the_terms($id, 'post_tag') );
     495    return apply_filters( 'get_the_tags', get_the_terms( $id, 'post_tag' ) );
    497496}
    498497
    499498function get_the_tag_list( $before = '', $sep = '', $after = '' ) {
    500     return apply_filters( 'the_tags', get_the_term_list(0, 'post_tag', $before, $sep, $after) );
     499    return apply_filters( 'the_tags', get_the_term_list( 0, 'post_tag', $before, $sep, $after ) );
    501500}
    502501
     
    516515        $id = (int) $post->ID;
    517516
    518     $terms = get_object_term_cache($id, $taxonomy);
     517    $terms = get_object_term_cache( $id, $taxonomy );
    519518    if ( false === $terms )
    520         $terms = wp_get_object_terms($id, $taxonomy);
     519        $terms = wp_get_object_terms( $id, $taxonomy );
    521520
    522521    if ( empty( $terms ) )
     
    527526
    528527function get_the_term_list( $id = 0, $taxonomy, $before = '', $sep = '', $after = '' ) {
    529     $terms = get_the_terms($id, $taxonomy);
    530 
    531     if ( is_wp_error($terms) )
     528    $terms = get_the_terms( $id, $taxonomy );
     529
     530    if ( is_wp_error( $terms ) )
    532531        return $terms;
    533532
     
    536535
    537536    foreach ( $terms as $term ) {
    538         $link = get_term_link($term, $taxonomy);
     537        $link = get_term_link( $term, $taxonomy );
    539538        if ( is_wp_error( $link ) )
    540539            return $link;
     
    544543    $term_links = apply_filters( "term_links-$taxonomy", $term_links );
    545544
    546     return $before . join($sep, $term_links) . $after;
     545    return $before . join( $sep, $term_links ) . $after;
    547546}
    548547
    549548function the_terms( $id, $taxonomy, $before = '', $sep = '', $after = '' ) {
    550     $return = get_the_term_list($id, $taxonomy, $before, $sep, $after);
     549    $return = get_the_term_list( $id, $taxonomy, $before, $sep, $after );
    551550    if ( is_wp_error( $return ) )
    552551        return false;
     
    566565 * @return bool True if the current post has the given tag, or any tag, if no tag specified
    567566 */
    568 function has_tag($tag = '') {
     567function has_tag( $tag = '' ) {
    569568    global $post;
    570569    $taxonomy = 'post_tag';
     
    574573    $post_id = (int) $post->ID;
    575574
    576     $terms = get_object_term_cache($post_id, $taxonomy);
    577     if (empty($terms))
    578          $terms = wp_get_object_terms($post_id, $taxonomy);
    579     if (empty($terms)) return false;
    580 
    581     if (empty($tag)) return (!empty($terms));
     575    $terms = get_object_term_cache( $post_id, $taxonomy );
     576    if ( empty( $terms ) )
     577         $terms = wp_get_object_terms( $post_id, $taxonomy );
     578    if ( empty( $terms ) ) return false;
     579
     580    if ( empty( $tag ) ) return ( !empty( $terms ) );
    582581
    583582    $tag = (array) $tag;
    584583
    585     foreach($terms as $term) {
     584    foreach ( $terms as $term ) {
    586585        if ( in_array( $term->term_id, $tag ) ) return true;
    587586        if ( in_array( $term->name, $tag ) ) return true;
Note: See TracChangeset for help on using the changeset viewer.