WordPress.org

Make WordPress Core

Changeset 9757


Ignore:
Timestamp:
11/18/2008 05:25:43 PM (12 years ago)
Author:
ryan
Message:

Cat row filtering cleanup from jhodgdon. see #8146

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-link-categories.php

    r9751 r9757  
    144144        $output .= link_cat_row($category);
    145145    }
    146     $output = apply_filters('cat_rows', $output);
    147146    echo $output;
    148147    unset($category);
  • trunk/wp-admin/includes/template.php

    r9751 r9757  
    9696    ob_end_clean();
    9797
    98     $output = apply_filters('cat_rows', $output);
    99 
    10098    echo $output;
    10199}
     
    114112    static $row_class;
    115113
    116     $category = get_category( $category );
    117     $catname = sanitize_term_field( 'name', $category->name, $category->term_id, 'category', 'display' );
    118     $catdesc = sanitize_term_field( 'description', $category->description, $category->term_id, 'category', 'display' );
    119     $qe_name = sanitize_term_field( 'name', $category->name, $category->term_id, 'category', 'edit' );
     114    $category = get_category( $category, OBJECT, 'display' );
    120115
    121116    $default_cat_id = (int) get_option( 'default_category' );
    122117    $pad = str_repeat( '— ', $level );
    123     $name = ( $name_override ? $name_override : $pad . ' ' . $catname );
     118    $name = ( $name_override ? $name_override : $pad . ' ' . $category->name );
    124119    $edit_link = "categories.php?action=edit&cat_ID=$category->term_id";
    125120    if ( current_user_can( 'manage_categories' ) ) {
    126         $edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $catname)) . "'>" . attribute_escape( $name ) . '</a><br />';
     121        $edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>" . attribute_escape( $name ) . '</a><br />';
    127122        $actions = array();
    128123        $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
     
    142137
    143138    $row_class = 'alternate' == $row_class ? '' : 'alternate';
     139    $qe_data = get_category_to_edit($category->term_id);
     140
    144141    $category->count = number_format_i18n( $category->count );
    145142    $posts_count = ( $category->count > 0 ) ? "<a href='edit.php?cat=$category->term_id'>$category->count</a>" : $category->count;
     
    169166            case 'name':
    170167                $output .= "<td $attributes>$edit";
    171                 $output .= '<div class="hidden" id="inline_' . $category->term_id . '">';
    172                 $output .= '<div class="name">' . $qe_name . '</div>';
    173                 $output .= '<div class="slug">' . $category->slug . '</div>';
    174                 $output .= '<div class="cat_parent">' . $category->parent . '</div></div></td>';
     168                $output .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
     169                $output .= '<div class="name">' . $qe_data->name . '</div>';
     170                $output .= '<div class="slug">' . $qe_data->slug . '</div>';
     171                $output .= '<div class="cat_parent">' . $qe_data->parent . '</div></div></td>';
    175172                break;
    176173            case 'description':
    177                 $output .= "<td $attributes>$catdesc</td>";
     174                $output .= "<td $attributes>$category->description</td>";
    178175                break;
    179176            case 'slug':
     
    187184    $output .= '</tr>';
    188185
    189     return apply_filters('cat_row', $output);
     186    return $output;
    190187}
    191188
     
    275272    global $class;
    276273
    277     if ( !$category = get_term( $category, 'link_category' ) )
     274    if ( !$category = get_term( $category, 'link_category', OBJECT, 'display' ) )
    278275        return false;
    279276    if ( is_wp_error( $category ) )
    280277        return $category;
    281278
    282     $catname = sanitize_term_field( 'name', $category->name, $category->term_id, 'category', 'display' );
    283     $catdesc = sanitize_term_field( 'description', $category->description, $category->term_id, 'category', 'display' );
    284     $qe_name = sanitize_term_field( 'name', $category->name, $category->term_id, 'category', 'edit' );
    285 
    286279    $default_cat_id = (int) get_option( 'default_link_category' );
    287     $name = ( $name_override ? $name_override : $catname );
     280    $name = ( $name_override ? $name_override : $category->name );
    288281    $edit_link = "link-category.php?action=edit&amp;cat_ID=$category->term_id";
    289282    if ( current_user_can( 'manage_categories' ) ) {
    290         $edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $catname)) . "'>$name</a><br />";
     283        $edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>$name</a><br />";
    291284        $actions = array();
    292285        $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
     
    306299
    307300    $class = 'alternate' == $class ? '' : 'alternate';
     301    $qe_data = get_term_to_edit($category->term_id, 'link_category');
     302
    308303    $category->count = number_format_i18n( $category->count );
    309304    $count = ( $category->count > 0 ) ? "<a href='link-manager.php?cat_id=$category->term_id'>$category->count</a>" : $category->count;
     
    332327            case 'name':
    333328                $output .= "<td $attributes>$edit";
    334                 $output .= '<div class="hidden" id="inline_' . $category->term_id . '">';
    335                 $output .= '<div class="name">' . $qe_name . '</div>';
    336                 $output .= '<div class="slug">' . $category->slug . '</div>';
    337                 $output .= '<div class="cat_parent">' . $category->parent . '</div></div></td>';
     329                $output .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
     330                $output .= '<div class="name">' . $qe_data->name . '</div>';
     331                $output .= '<div class="slug">' . $qe_data->slug . '</div>';
     332                $output .= '<div class="cat_parent">' . $qe_data->parent . '</div></div></td>';
    338333                break;
    339334            case 'description':
    340                 $output .= "<td $attributes>$catdesc</td>";
     335                $output .= "<td $attributes>$category->description</td>";
    341336                break;
    342337            case 'links':
     
    347342    $output .= '</tr>';
    348343
    349     return apply_filters( 'link_cat_row', $output );
     344    return $output;
    350345}
    351346
     
    580575 */
    581576function _tag_row( $tag, $class = '' ) {
    582 
    583577        $count = number_format_i18n( $tag->count );
    584578        $count = ( $count > 0 ) ? "<a href='edit.php?tag=$tag->slug'>$count</a>" : $count;
    585         $tagname = sanitize_term_field( 'name', $tag->name, $tag->term_id, 'tag', 'display' );
    586         $qe_name = sanitize_term_field( 'name', $tag->name, $tag->term_id, 'tag', 'edit' );
    587 
     579
     580        $name = apply_filters( 'term_name', $tag->name );
     581        $qe_data = get_term($tag->term_id, 'post_tag', object, 'edit');
    588582        $edit_link = "edit-tags.php?action=edit&amp;tag_ID=$tag->term_id";
    589583        $out = '';
     
    605599                    break;
    606600                case 'name':
    607                     $out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . attribute_escape(sprintf(__('Edit "%s"'), $tagname)) . '">' . $tagname . '</a></strong><br />';
     601                    $out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . attribute_escape(sprintf(__('Edit "%s"'), $name)) . '">' . $name . '</a></strong><br />';
    608602                    $actions = array();
    609603                    $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
     
    617611                        $out .= "<span class='$action'>$link$sep</span>";
    618612                    }
    619                     $out .= '<div class="hidden" id="inline_' . $tag->term_id . '">';
    620                     $out .= '<div class="name">' . $qe_name . '</div>';
    621                     $out .= '<div class="slug">' . $tag->slug . '</div></div></td>';
     613                    $out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
     614                    $out .= '<div class="name">' . $qe_data->name . '</div>';
     615                    $out .= '<div class="slug">' . $qe_data->slug . '</div></div></td>';
    622616                    break;
    623617                case 'slug':
     
    669663
    670664    // filter and send to screen
    671     $out = apply_filters('tag_rows', $out);
    672665    echo $out;
    673666    return $count;
Note: See TracChangeset for help on using the changeset viewer.