From 71f1b7557fe46f2f3fab8e3b2fa8a8b2ce9d3c5b Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Tue, 18 Nov 2008 17:25:43 +0000 Subject: [PATCH] Cat row filtering cleanup from jhodgdon. see #8146 git-svn-id: https://develop.svn.wordpress.org/trunk@9757 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/edit-link-categories.php | 1 - wp-admin/includes/template.php | 63 ++++++++++++++----------------- 2 files changed, 28 insertions(+), 36 deletions(-) diff --git a/wp-admin/edit-link-categories.php b/wp-admin/edit-link-categories.php index 2b2427ecd4..7ceb5c16a4 100644 --- a/wp-admin/edit-link-categories.php +++ b/wp-admin/edit-link-categories.php @@ -143,7 +143,6 @@ if ( $categories ) { foreach ( $categories as $category ) { $output .= link_cat_row($category); } - $output = apply_filters('cat_rows', $output); echo $output; unset($category); } diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index ae95d9f46d..631cd4875d 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -95,8 +95,6 @@ function _cat_rows( $categories, &$count, $parent = 0, $level = 0, $page = 1, $p $output = ob_get_contents(); ob_end_clean(); - $output = apply_filters('cat_rows', $output); - echo $output; } @@ -113,17 +111,14 @@ function _cat_rows( $categories, &$count, $parent = 0, $level = 0, $page = 1, $p function _cat_row( $category, $level, $name_override = false ) { static $row_class; - $category = get_category( $category ); - $catname = sanitize_term_field( 'name', $category->name, $category->term_id, 'category', 'display' ); - $catdesc = sanitize_term_field( 'description', $category->description, $category->term_id, 'category', 'display' ); - $qe_name = sanitize_term_field( 'name', $category->name, $category->term_id, 'category', 'edit' ); + $category = get_category( $category, OBJECT, 'display' ); $default_cat_id = (int) get_option( 'default_category' ); $pad = str_repeat( '— ', $level ); - $name = ( $name_override ? $name_override : $pad . ' ' . $catname ); + $name = ( $name_override ? $name_override : $pad . ' ' . $category->name ); $edit_link = "categories.php?action=edit&cat_ID=$category->term_id"; if ( current_user_can( 'manage_categories' ) ) { - $edit = "" . attribute_escape( $name ) . '
'; + $edit = "name)) . "'>" . attribute_escape( $name ) . '
'; $actions = array(); $actions['edit'] = '' . __('Edit') . ''; $actions['inline hide-if-no-js'] = '' . __('Quick Edit') . ''; @@ -141,6 +136,8 @@ function _cat_row( $category, $level, $name_override = false ) { } $row_class = 'alternate' == $row_class ? '' : 'alternate'; + $qe_data = get_category_to_edit($category->term_id); + $category->count = number_format_i18n( $category->count ); $posts_count = ( $category->count > 0 ) ? "$category->count" : $category->count; $output = ""; @@ -168,13 +165,13 @@ function _cat_row( $category, $level, $name_override = false ) { break; case 'name': $output .= "$edit"; - $output .= ''; + $output .= ''; break; case 'description': - $output .= "$catdesc"; + $output .= "$category->description"; break; case 'slug': $output .= "$category->slug"; @@ -186,7 +183,7 @@ function _cat_row( $category, $level, $name_override = false ) { } $output .= ''; - return apply_filters('cat_row', $output); + return $output; } /** @@ -274,20 +271,16 @@ function inline_edit_term_row($type) { function link_cat_row( $category, $name_override = false ) { global $class; - if ( !$category = get_term( $category, 'link_category' ) ) + if ( !$category = get_term( $category, 'link_category', OBJECT, 'display' ) ) return false; if ( is_wp_error( $category ) ) return $category; - $catname = sanitize_term_field( 'name', $category->name, $category->term_id, 'category', 'display' ); - $catdesc = sanitize_term_field( 'description', $category->description, $category->term_id, 'category', 'display' ); - $qe_name = sanitize_term_field( 'name', $category->name, $category->term_id, 'category', 'edit' ); - $default_cat_id = (int) get_option( 'default_link_category' ); - $name = ( $name_override ? $name_override : $catname ); + $name = ( $name_override ? $name_override : $category->name ); $edit_link = "link-category.php?action=edit&cat_ID=$category->term_id"; if ( current_user_can( 'manage_categories' ) ) { - $edit = "$name
"; + $edit = "name)) . "'>$name
"; $actions = array(); $actions['edit'] = '' . __('Edit') . ''; $actions['inline hide-if-no-js'] = '' . __('Quick Edit') . ''; @@ -305,6 +298,8 @@ function link_cat_row( $category, $name_override = false ) { } $class = 'alternate' == $class ? '' : 'alternate'; + $qe_data = get_term_to_edit($category->term_id, 'link_category'); + $category->count = number_format_i18n( $category->count ); $count = ( $category->count > 0 ) ? "$category->count" : $category->count; $output = ""; @@ -331,13 +326,13 @@ function link_cat_row( $category, $name_override = false ) { break; case 'name': $output .= "$edit"; - $output .= ''; + $output .= ''; break; case 'description': - $output .= "$catdesc"; + $output .= "$category->description"; break; case 'links': $attributes = 'class="links column-links num"' . $style; @@ -346,7 +341,7 @@ function link_cat_row( $category, $name_override = false ) { } $output .= ''; - return apply_filters( 'link_cat_row', $output ); + return $output; } /** @@ -579,12 +574,11 @@ function wp_link_category_checklist( $link_id = 0 ) { * @return unknown */ function _tag_row( $tag, $class = '' ) { - $count = number_format_i18n( $tag->count ); $count = ( $count > 0 ) ? "$count" : $count; - $tagname = sanitize_term_field( 'name', $tag->name, $tag->term_id, 'tag', 'display' ); - $qe_name = sanitize_term_field( 'name', $tag->name, $tag->term_id, 'tag', 'edit' ); + $name = apply_filters( 'term_name', $tag->name ); + $qe_data = get_term($tag->term_id, 'post_tag', object, 'edit'); $edit_link = "edit-tags.php?action=edit&tag_ID=$tag->term_id"; $out = ''; $out .= ''; @@ -604,7 +598,7 @@ function _tag_row( $tag, $class = '' ) { $out .= ' '; break; case 'name': - $out .= '' . $tagname . '
'; + $out .= '' . $name . '
'; $actions = array(); $actions['edit'] = '' . __('Edit') . ''; $actions['inline hide-if-no-js'] = '' . __('Quick Edit') . ''; @@ -616,9 +610,9 @@ function _tag_row( $tag, $class = '' ) { ( $i == $action_count ) ? $sep = '' : $sep = ' | '; $out .= "$link$sep"; } - $out .= ''; + $out .= ''; break; case 'slug': $out .= "$tag->slug"; @@ -668,7 +662,6 @@ function tag_rows( $page = 1, $pagesize = 20, $searchterms = '' ) { $out .= _tag_row( $tag, ++$count % 2 ? ' class="iedit alternate"' : ' class="iedit"' ); // filter and send to screen - $out = apply_filters('tag_rows', $out); echo $out; return $count; }