WordPress.org

Make WordPress Core

Changeset 9751


Ignore:
Timestamp:
11/18/2008 07:15:32 AM (12 years ago)
Author:
azaozz
Message:

Fix QE data filtering for tags and categories, props jhodgdon fixes #8146

Location:
trunk/wp-admin
Files:
3 edited

Legend:

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

    r9746 r9751  
    142142    $output = '';
    143143    foreach ( $categories as $category ) {
    144         $category = sanitize_term($category, 'link_category', 'display');
    145144        $output .= link_cat_row($category);
    146145    }
  • trunk/wp-admin/includes/template.php

    r9735 r9751  
    115115
    116116    $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' );
    117120
    118121    $default_cat_id = (int) get_option( 'default_category' );
    119122    $pad = str_repeat( '— ', $level );
    120     $name = ( $name_override ? $name_override : $pad . ' ' . $category->name );
     123    $name = ( $name_override ? $name_override : $pad . ' ' . $catname );
    121124    $edit_link = "categories.php?action=edit&cat_ID=$category->term_id";
    122125    if ( current_user_can( 'manage_categories' ) ) {
    123         $edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>" . attribute_escape( $name ) . '</a><br />';
     126        $edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $catname)) . "'>" . attribute_escape( $name ) . '</a><br />';
    124127        $actions = array();
    125128        $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
     
    139142
    140143    $row_class = 'alternate' == $row_class ? '' : 'alternate';
    141     $qe_data = get_category_to_edit($category->term_id);
    142 
    143144    $category->count = number_format_i18n( $category->count );
    144145    $posts_count = ( $category->count > 0 ) ? "<a href='edit.php?cat=$category->term_id'>$category->count</a>" : $category->count;
     
    168169            case 'name':
    169170                $output .= "<td $attributes>$edit";
    170                 $output .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
    171                 $output .= '<div class="name">' . $qe_data->name . '</div>';
    172                 $output .= '<div class="slug">' . $qe_data->slug . '</div>';
    173                 $output .= '<div class="cat_parent">' . $qe_data->parent . '</div></div></td>';
     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>';
    174175                break;
    175176            case 'description':
    176                 $output .= "<td $attributes>$category->description</td>";
     177                $output .= "<td $attributes>$catdesc</td>";
    177178                break;
    178179            case 'slug':
     
    279280        return $category;
    280281
     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
    281286    $default_cat_id = (int) get_option( 'default_link_category' );
    282     $name = ( $name_override ? $name_override : $category->name );
     287    $name = ( $name_override ? $name_override : $catname );
    283288    $edit_link = "link-category.php?action=edit&amp;cat_ID=$category->term_id";
    284289    if ( current_user_can( 'manage_categories' ) ) {
    285         $edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>$name</a><br />";
     290        $edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $catname)) . "'>$name</a><br />";
    286291        $actions = array();
    287292        $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
     
    301306
    302307    $class = 'alternate' == $class ? '' : 'alternate';
    303     $qe_data = get_term_to_edit($category->term_id, 'link_category');
    304 
    305308    $category->count = number_format_i18n( $category->count );
    306309    $count = ( $category->count > 0 ) ? "<a href='link-manager.php?cat_id=$category->term_id'>$category->count</a>" : $category->count;
     
    329332            case 'name':
    330333                $output .= "<td $attributes>$edit";
    331                 $output .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
    332                 $output .= '<div class="name">' . $qe_data->name . '</div>';
    333                 $output .= '<div class="slug">' . $qe_data->slug . '</div>';
    334                 $output .= '<div class="cat_parent">' . $qe_data->parent . '</div></div></td>';
     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>';
    335338                break;
    336339            case 'description':
    337                 $output .= "<td $attributes>$category->description</td>";
     340                $output .= "<td $attributes>$catdesc</td>";
    338341                break;
    339342            case 'links':
     
    577580 */
    578581function _tag_row( $tag, $class = '' ) {
     582
    579583        $count = number_format_i18n( $tag->count );
    580584        $count = ( $count > 0 ) ? "<a href='edit.php?tag=$tag->slug'>$count</a>" : $count;
    581 
    582         $name = apply_filters( 'term_name', $tag->name );
    583         $qe_data = get_term($tag->term_id, 'post_tag', object, 'edit');
     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
    584588        $edit_link = "edit-tags.php?action=edit&amp;tag_ID=$tag->term_id";
    585589        $out = '';
     
    601605                    break;
    602606                case 'name':
    603                     $out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . attribute_escape(sprintf(__('Edit "%s"'), $name)) . '">' . $name . '</a></strong><br />';
     607                    $out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . attribute_escape(sprintf(__('Edit "%s"'), $tagname)) . '">' . $tagname . '</a></strong><br />';
    604608                    $actions = array();
    605609                    $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
     
    613617                        $out .= "<span class='$action'>$link$sep</span>";
    614618                    }
    615                     $out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
    616                     $out .= '<div class="name">' . $qe_data->name . '</div>';
    617                     $out .= '<div class="slug">' . $qe_data->slug . '</div></div></td>';
     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>';
    618622                    break;
    619623                case 'slug':
  • trunk/wp-admin/wp-admin.css

    r9746 r9751  
    13291329    vertical-align: bottom;
    13301330    float: left;
    1331     margin: -3px 3px 8px;
     1331    margin: -8px 3px 12px;
    13321332}
    13331333
     
    13351335    border-bottom: none;
    13361336    border: 1px solid #fff;
    1337     font-size: 1px;
    1338     line-height: 1px;
     1337    height: 10px;
     1338    line-height: 20px;
     1339    width: 10px;
    13391340}
    13401341
     
    16581659    float: right;
    16591660    width: 23px;
    1660     height: 27px;
     1661    height: 26px;
    16611662}
    16621663
Note: See TracChangeset for help on using the changeset viewer.