Ticket #34988: 34988.4.patch
File 34988.4.patch, 12.1 KB (added by , 9 years ago) |
---|
-
src/wp-admin/edit-tag-form.php
10 10 if ( !defined('ABSPATH') ) 11 11 die('-1'); 12 12 13 if ( empty( $tag_ID) ) { ?>13 if ( empty( $term_id ) ) { ?> 14 14 <div class="wrap"> 15 15 <h1><?php echo $tax->labels->edit_item; ?></h1> 16 16 <div id="message" class="notice notice-warning"><p><strong><?php _e( 'You did not select an item for editing.' ); ?></strong></p></div> … … 27 27 * @since 2.1.0 28 28 * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead. 29 29 * 30 * @param object $t agCurrent category term object.30 * @param object $term Current category term object. 31 31 */ 32 do_action( 'edit_category_form_pre', $t ag);32 do_action( 'edit_category_form_pre', $term ); 33 33 } elseif ( 'link_category' == $taxonomy ) { 34 34 /** 35 35 * Fires before the Edit Link Category form. … … 37 37 * @since 2.3.0 38 38 * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead. 39 39 * 40 * @param object $t agCurrent link category term object.40 * @param object $term Current link category term object. 41 41 */ 42 do_action( 'edit_link_category_form_pre', $t ag);42 do_action( 'edit_link_category_form_pre', $term ); 43 43 } else { 44 44 /** 45 45 * Fires before the Edit Tag form. … … 47 47 * @since 2.5.0 48 48 * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead. 49 49 * 50 * @param object $t agCurrent tag term object.50 * @param object $term Current tag term object. 51 51 */ 52 do_action( 'edit_tag_form_pre', $t ag);52 do_action( 'edit_tag_form_pre', $term ); 53 53 } 54 54 55 55 /** … … 57 57 */ 58 58 wp_reset_vars( array( 'wp_http_referer' ) ); 59 59 60 $wp_http_referer = remove_query_arg( array( 'action', 'message', 't ag_ID' ), $wp_http_referer );60 $wp_http_referer = remove_query_arg( array( 'action', 'message', 'term_id' ), $wp_http_referer ); 61 61 62 62 /** Also used by Edit Tags */ 63 63 require_once( ABSPATH . 'wp-admin/includes/edit-tag-messages.php' ); … … 70 70 * 71 71 * @since 3.0.0 72 72 * 73 * @param object $t agCurrent taxonomy term object.73 * @param object $term Current taxonomy term object. 74 74 * @param string $taxonomy Current $taxonomy slug. 75 75 */ 76 do_action( "{$taxonomy}_pre_edit_form", $t ag, $taxonomy ); ?>76 do_action( "{$taxonomy}_pre_edit_form", $term, $taxonomy ); ?> 77 77 78 78 <div class="wrap"> 79 79 <h1><?php echo $tax->labels->edit_item; ?></h1> … … 103 103 */ 104 104 do_action( "{$taxonomy}_term_edit_form_tag" ); 105 105 ?>> 106 <input type="hidden" name="action" value="editedtag" /> 107 <input type="hidden" name="tag_ID" value="<?php echo esc_attr($tag->term_id) ?>" /> 108 <input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy) ?>" /> 109 <?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-tag_' . $tag_ID); ?> 106 <input type="hidden" name="action" value="editedtag"/> 107 <input type="hidden" name="tag_ID" value="<?php echo esc_attr( $term_id ) ?>"/> 108 <input type="hidden" name="taxonomy" value="<?php echo esc_attr( $taxonomy ) ?>"/> 109 <?php 110 wp_original_referer_field( true, 'previous' ); 111 wp_nonce_field( 'update-tag_' . $term_id ); 112 ?> 110 113 <table class="form-table"> 111 114 <tr class="form-field form-required term-name-wrap"> 112 115 <th scope="row"><label for="name"><?php _ex( 'Name', 'term name' ); ?></label></th> 113 <td><input name="name" id="name" type="text" value="<?php if ( isset( $t ag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" />116 <td><input name="name" id="name" type="text" value="<?php if ( isset( $term->name ) ) echo esc_attr($term->name); ?>" size="40" aria-required="true" /> 114 117 <p class="description"><?php _e('The name is how it appears on your site.'); ?></p></td> 115 118 </tr> 116 119 <?php if ( !global_terms_enabled() ) { ?> … … 124 127 * post URIs and term slugs. 125 128 * 126 129 * @since 2.6.0 127 * @since 4.4.0 The `$t ag` parameter was added.130 * @since 4.4.0 The `$term` parameter was added. 128 131 * 129 132 * @param string $slug The editable slug. Will be either a term slug or post URI depending 130 133 * upon the context in which it is evaluated. 131 * @param object|WP_Post $t agTerm or WP_Post object.134 * @param object|WP_Post $term Term or WP_Post object. 132 135 */ 133 $slug = isset( $t ag->slug ) ? apply_filters( 'editable_slug', $tag->slug, $tag) : '';136 $slug = isset( $term->slug ) ? apply_filters( 'editable_slug', $term->slug, $term ) : ''; 134 137 ?> 135 138 <td><input name="slug" id="slug" type="text" value="<?php echo esc_attr( $slug ); ?>" size="40" /> 136 139 <p class="description"><?php _e('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td> 137 140 </tr> 138 141 <?php } ?> 139 <?php if ( is_taxonomy_hierarchical( $taxonomy) ) : ?>142 <?php if ( is_taxonomy_hierarchical( $taxonomy ) ) : ?> 140 143 <tr class="form-field term-parent-wrap"> 141 144 <th scope="row"><label for="parent"><?php _ex( 'Parent', 'term parent' ); ?></label></th> 142 145 <td> … … 147 150 'taxonomy' => $taxonomy, 148 151 'name' => 'parent', 149 152 'orderby' => 'name', 150 'selected' => $t ag->parent,151 'exclude_tree' => $t ag->term_id,153 'selected' => $term->parent, 154 'exclude_tree' => $term->term_id, 152 155 'hierarchical' => true, 153 156 'show_option_none' => __( 'None' ), 154 157 ); … … 164 167 <?php endif; // is_taxonomy_hierarchical() ?> 165 168 <tr class="form-field term-description-wrap"> 166 169 <th scope="row"><label for="description"><?php _e( 'Description' ); ?></label></th> 167 <td><textarea name="description" id="description" rows="5" cols="50" class="large-text"><?php echo $t ag->description; // textarea_escaped ?></textarea>170 <td><textarea name="description" id="description" rows="5" cols="50" class="large-text"><?php echo $term->description; // textarea_escaped ?></textarea> 168 171 <p class="description"><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></p></td> 169 172 </tr> 170 173 <?php … … 176 179 * @since 2.9.0 177 180 * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead. 178 181 * 179 * @param object $t agCurrent category term object.182 * @param object $term Current category term object. 180 183 */ 181 do_action( 'edit_category_form_fields', $t ag);184 do_action( 'edit_category_form_fields', $term ); 182 185 } elseif ( 'link_category' == $taxonomy ) { 183 186 /** 184 187 * Fires after the Edit Link Category form fields are displayed. … … 186 189 * @since 2.9.0 187 190 * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead. 188 191 * 189 * @param object $t agCurrent link category term object.192 * @param object $term Current link category term object. 190 193 */ 191 do_action( 'edit_link_category_form_fields', $t ag);194 do_action( 'edit_link_category_form_fields', $term ); 192 195 } else { 193 196 /** 194 197 * Fires after the Edit Tag form fields are displayed. … … 196 199 * @since 2.9.0 197 200 * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead. 198 201 * 199 * @param object $t agCurrent tag term object.202 * @param object $term Current tag term object. 200 203 */ 201 do_action( 'edit_tag_form_fields', $t ag);204 do_action( 'edit_tag_form_fields', $term ); 202 205 } 203 206 /** 204 207 * Fires after the Edit Term form fields are displayed. … … 208 211 * 209 212 * @since 3.0.0 210 213 * 211 * @param object $t agCurrent taxonomy term object.214 * @param object $term Current taxonomy term object. 212 215 * @param string $taxonomy Current taxonomy slug. 213 216 */ 214 do_action( "{$taxonomy}_edit_form_fields", $t ag, $taxonomy );217 do_action( "{$taxonomy}_edit_form_fields", $term, $taxonomy ); 215 218 ?> 216 219 </table> 217 220 <?php 218 221 // Back compat hooks 219 222 if ( 'category' == $taxonomy ) { 220 223 /** This action is documented in wp-admin/edit-tags.php */ 221 do_action( 'edit_category_form', $t ag);224 do_action( 'edit_category_form', $term ); 222 225 } elseif ( 'link_category' == $taxonomy ) { 223 226 /** This action is documented in wp-admin/edit-tags.php */ 224 do_action( 'edit_link_category_form', $t ag);227 do_action( 'edit_link_category_form', $term ); 225 228 } else { 226 229 /** 227 230 * Fires at the end of the Edit Term form. … … 229 232 * @since 2.5.0 230 233 * @deprecated 3.0.0 Use {$taxonomy}_edit_form instead. 231 234 * 232 * @param object $t agCurrent taxonomy term object.235 * @param object $term Current taxonomy term object. 233 236 */ 234 do_action( 'edit_tag_form', $t ag);237 do_action( 'edit_tag_form', $term ); 235 238 } 236 239 /** 237 240 * Fires at the end of the Edit Term form for all taxonomies. … … 240 243 * 241 244 * @since 3.0.0 242 245 * 243 * @param object $t agCurrent taxonomy term object.246 * @param object $term Current taxonomy term object. 244 247 * @param string $taxonomy Current taxonomy slug. 245 248 */ 246 do_action( "{$taxonomy}_edit_form", $t ag, $taxonomy );249 do_action( "{$taxonomy}_edit_form", $term, $taxonomy ); 247 250 248 251 submit_button( __('Update') ); 249 252 ?> -
src/wp-admin/edit-tags.php
156 156 break; 157 157 } 158 158 159 $t ag_ID= (int) $_REQUEST['tag_ID'];159 $term_id = (int) $_REQUEST['tag_ID']; 160 160 161 $tag = get_term( $tag_ID, $taxonomy, OBJECT, 'edit' ); 162 if ( ! $tag ) 161 if ( ! get_term( $tag_ID ) ) { 163 162 wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); 164 require_once( ABSPATH . 'wp-admin/admin-header.php' ); 165 include( ABSPATH . 'wp-admin/edit-tag-form.php' ); 166 include( ABSPATH . 'wp-admin/admin-footer.php' ); 163 } 167 164 165 wp_safe_redirect( get_edit_term_link( $term_id, $taxonomy, $post_type ) ); 168 166 exit; 169 167 170 168 case 'editedtag': -
src/wp-admin/term.php
1 <?php 2 /** 3 * Edit Term Administration Screen. 4 * 5 * @package WordPress 6 * @subpackage Administration 7 */ 8 9 /** WordPress Administration Bootstrap */ 10 require_once( dirname( __FILE__ ) . '/admin.php' ); 11 12 if ( ! $taxnow ) { 13 wp_die( __( 'Invalid taxonomy' ) ); 14 } 15 16 $tax = get_taxonomy( $taxnow ); 17 18 if ( ! $tax ) { 19 wp_die( __( 'Invalid term' ) ); 20 } 21 22 $taxonomy = $tax->name; 23 24 if ( ! in_array( $taxonomy, get_taxonomies( array( 'show_ui' => true ) ) ) ) { 25 wp_die( __( 'You are not allowed to manage this item.' ) ); 26 } 27 28 if ( ! current_user_can( $tax->cap->manage_terms ) ) { 29 wp_die( 30 '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . 31 '<p>' . __( 'You are not allowed to manage this item.' ) . '</p>', 32 403 33 ); 34 } 35 36 $post_type = get_current_screen()->post_type; 37 38 if ( 'post' != $post_type ) { 39 $parent_file = ( 'attachment' == $post_type ) ? 'upload.php' : "edit.php?post_type=$post_type"; 40 $submenu_file = "edit-tags.php?taxonomy=$taxonomy&post_type=$post_type"; 41 } elseif ( 'link_category' == $taxonomy ) { 42 $parent_file = 'link-manager.php'; 43 $submenu_file = 'edit-tags.php?taxonomy=link_category'; 44 } else { 45 $parent_file = 'edit.php'; 46 $submenu_file = "edit-tags.php?taxonomy=$taxonomy"; 47 } 48 49 get_current_screen()->set_screen_reader_content( array( 50 'heading_pagination' => $tax->labels->items_list_navigation, 51 'heading_list' => $tax->labels->items_list, 52 ) ); 53 54 $term_id = (int) $_REQUEST['term_id']; 55 $term = get_term( $term_id, $taxonomy, OBJECT, 'edit' ); 56 57 if ( ! $term ) { 58 wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); 59 } 60 61 require_once( ABSPATH . 'wp-admin/admin-header.php' ); 62 include( ABSPATH . 'wp-admin/edit-tag-form.php' ); 63 include( ABSPATH . 'wp-admin/admin-footer.php' ); -
src/wp-includes/link-template.php
926 926 } 927 927 928 928 $args = array( 929 'action' => 'edit',930 929 'taxonomy' => $taxonomy, 931 't ag_ID'=> $term->term_id,930 'term_id' => $term->term_id, 932 931 ); 933 932 934 933 if ( $object_type ) { … … 938 937 } 939 938 940 939 if ( $tax->show_ui ) { 941 $location = add_query_arg( $args, admin_url( ' edit-tags.php' ) );940 $location = add_query_arg( $args, admin_url( 'term.php' ) ); 942 941 } else { 943 942 $location = ''; 944 943 }