Ticket #34988: 34988.3.patch
File 34988.3.patch, 12.8 KB (added by , 9 years ago) |
---|
-
src/wp-admin/edit-tag-form.php
diff --git src/wp-admin/edit-tag-form.php src/wp-admin/edit-tag-form.php index 8b5c61b..556c554 100644
10 10 if ( !defined('ABSPATH') ) 11 11 die('-1'); 12 12 13 if ( empty( $tag_ID) ) { ?>13 if ( empty( $term_id ) ) { ?> 14 14 <div id="message" class="updated notice is-dismissible"><p><strong><?php _e( 'You did not select an item for editing.' ); ?></strong></p></div> 15 15 <?php 16 16 return; … … if ( 'category' == $taxonomy ) { 24 24 * @since 2.1.0 25 25 * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead. 26 26 * 27 * @param object $t agCurrent category term object.27 * @param object $term Current category term object. 28 28 */ 29 do_action( 'edit_category_form_pre', $t ag);29 do_action( 'edit_category_form_pre', $term ); 30 30 } elseif ( 'link_category' == $taxonomy ) { 31 31 /** 32 32 * Fires before the Edit Link Category form. … … if ( 'category' == $taxonomy ) { 34 34 * @since 2.3.0 35 35 * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead. 36 36 * 37 * @param object $t agCurrent link category term object.37 * @param object $term Current link category term object. 38 38 */ 39 do_action( 'edit_link_category_form_pre', $t ag);39 do_action( 'edit_link_category_form_pre', $term ); 40 40 } else { 41 41 /** 42 42 * Fires before the Edit Tag form. … … if ( 'category' == $taxonomy ) { 44 44 * @since 2.5.0 45 45 * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead. 46 46 * 47 * @param object $t agCurrent tag term object.47 * @param object $term Current tag term object. 48 48 */ 49 do_action( 'edit_tag_form_pre', $t ag);49 do_action( 'edit_tag_form_pre', $term ); 50 50 } 51 51 52 52 /** … … if ( 'category' == $taxonomy ) { 54 54 */ 55 55 wp_reset_vars( array( 'wp_http_referer' ) ); 56 56 57 $wp_http_referer = remove_query_arg( array( 'action', 'message', 't ag_ID' ), $wp_http_referer );57 $wp_http_referer = remove_query_arg( array( 'action', 'message', 'term_id' ), $wp_http_referer ); 58 58 59 59 /** Also used by Edit Tags */ 60 60 require_once( ABSPATH . 'wp-admin/includes/edit-tag-messages.php' ); … … require_once( ABSPATH . 'wp-admin/includes/edit-tag-messages.php' ); 67 67 * 68 68 * @since 3.0.0 69 69 * 70 * @param object $t agCurrent taxonomy term object.70 * @param object $term Current taxonomy term object. 71 71 * @param string $taxonomy Current $taxonomy slug. 72 72 */ 73 do_action( "{$taxonomy}_pre_edit_form", $t ag, $taxonomy ); ?>73 do_action( "{$taxonomy}_pre_edit_form", $term, $taxonomy ); ?> 74 74 75 75 <div class="wrap"> 76 76 <h1><?php echo $tax->labels->edit_item; ?></h1> … … do_action( "{$taxonomy}_pre_edit_form", $tag, $taxonomy ); ?> 100 100 */ 101 101 do_action( "{$taxonomy}_term_edit_form_tag" ); 102 102 ?>> 103 <input type="hidden" name="action" value="editedtag" /> 104 <input type="hidden" name="tag_ID" value="<?php echo esc_attr($tag->term_id) ?>" /> 105 <input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy) ?>" /> 106 <?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-tag_' . $tag_ID); ?> 103 <input type="hidden" name="action" value="editedtag"/> 104 <input type="hidden" name="tag_ID" value="<?php echo esc_attr( $term_id ) ?>"/> 105 <input type="hidden" name="taxonomy" value="<?php echo esc_attr( $taxonomy ) ?>"/> 106 <?php 107 wp_original_referer_field( true, 'previous' ); 108 wp_nonce_field( 'update-tag_' . $term_id ); 109 ?> 107 110 <table class="form-table"> 108 111 <tr class="form-field form-required term-name-wrap"> 109 112 <th scope="row"><label for="name"><?php _ex( 'Name', 'term name' ); ?></label></th> 110 <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" />113 <td><input name="name" id="name" type="text" value="<?php if ( isset( $term->name ) ) echo esc_attr($term->name); ?>" size="40" aria-required="true" /> 111 114 <p class="description"><?php _e('The name is how it appears on your site.'); ?></p></td> 112 115 </tr> 113 116 <?php if ( !global_terms_enabled() ) { ?> … … do_action( "{$taxonomy}_term_edit_form_tag" ); 121 124 * post URIs and term slugs. 122 125 * 123 126 * @since 2.6.0 124 * @since 4.4.0 The `$t ag` parameter was added.127 * @since 4.4.0 The `$term` parameter was added. 125 128 * 126 129 * @param string $slug The editable slug. Will be either a term slug or post URI depending 127 130 * upon the context in which it is evaluated. 128 * @param object|WP_Post $t agTerm or WP_Post object.131 * @param object|WP_Post $term Term or WP_Post object. 129 132 */ 130 $slug = isset( $t ag->slug ) ? apply_filters( 'editable_slug', $tag->slug, $tag) : '';133 $slug = isset( $term->slug ) ? apply_filters( 'editable_slug', $term->slug, $term ) : ''; 131 134 ?> 132 135 <td><input name="slug" id="slug" type="text" value="<?php echo esc_attr( $slug ); ?>" size="40" /> 133 136 <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> 134 137 </tr> 135 138 <?php } ?> 136 <?php if ( is_taxonomy_hierarchical( $taxonomy) ) : ?>139 <?php if ( is_taxonomy_hierarchical( $taxonomy ) ) : ?> 137 140 <tr class="form-field term-parent-wrap"> 138 141 <th scope="row"><label for="parent"><?php _ex( 'Parent', 'term parent' ); ?></label></th> 139 142 <td> … … do_action( "{$taxonomy}_term_edit_form_tag" ); 144 147 'taxonomy' => $taxonomy, 145 148 'name' => 'parent', 146 149 'orderby' => 'name', 147 'selected' => $t ag->parent,148 'exclude_tree' => $t ag->term_id,150 'selected' => $term->parent, 151 'exclude_tree' => $term->term_id, 149 152 'hierarchical' => true, 150 153 'show_option_none' => __( 'None' ), 151 154 ); … … do_action( "{$taxonomy}_term_edit_form_tag" ); 161 164 <?php endif; // is_taxonomy_hierarchical() ?> 162 165 <tr class="form-field term-description-wrap"> 163 166 <th scope="row"><label for="description"><?php _e( 'Description' ); ?></label></th> 164 <td><textarea name="description" id="description" rows="5" cols="50" class="large-text"><?php echo $t ag->description; // textarea_escaped ?></textarea>167 <td><textarea name="description" id="description" rows="5" cols="50" class="large-text"><?php echo $term->description; // textarea_escaped ?></textarea> 165 168 <p class="description"><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></p></td> 166 169 </tr> 167 170 <?php … … do_action( "{$taxonomy}_term_edit_form_tag" ); 173 176 * @since 2.9.0 174 177 * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead. 175 178 * 176 * @param object $t agCurrent category term object.179 * @param object $term Current category term object. 177 180 */ 178 do_action( 'edit_category_form_fields', $t ag);181 do_action( 'edit_category_form_fields', $term ); 179 182 } elseif ( 'link_category' == $taxonomy ) { 180 183 /** 181 184 * Fires after the Edit Link Category form fields are displayed. … … do_action( "{$taxonomy}_term_edit_form_tag" ); 183 186 * @since 2.9.0 184 187 * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead. 185 188 * 186 * @param object $t agCurrent link category term object.189 * @param object $term Current link category term object. 187 190 */ 188 do_action( 'edit_link_category_form_fields', $t ag);191 do_action( 'edit_link_category_form_fields', $term ); 189 192 } else { 190 193 /** 191 194 * Fires after the Edit Tag form fields are displayed. … … do_action( "{$taxonomy}_term_edit_form_tag" ); 193 196 * @since 2.9.0 194 197 * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead. 195 198 * 196 * @param object $t agCurrent tag term object.199 * @param object $term Current tag term object. 197 200 */ 198 do_action( 'edit_tag_form_fields', $t ag);201 do_action( 'edit_tag_form_fields', $term ); 199 202 } 200 203 /** 201 204 * Fires after the Edit Term form fields are displayed. … … do_action( "{$taxonomy}_term_edit_form_tag" ); 205 208 * 206 209 * @since 3.0.0 207 210 * 208 * @param object $t agCurrent taxonomy term object.211 * @param object $term Current taxonomy term object. 209 212 * @param string $taxonomy Current taxonomy slug. 210 213 */ 211 do_action( "{$taxonomy}_edit_form_fields", $t ag, $taxonomy );214 do_action( "{$taxonomy}_edit_form_fields", $term, $taxonomy ); 212 215 ?> 213 216 </table> 214 217 <?php 215 218 // Back compat hooks 216 219 if ( 'category' == $taxonomy ) { 217 220 /** This action is documented in wp-admin/edit-tags.php */ 218 do_action( 'edit_category_form', $t ag);221 do_action( 'edit_category_form', $term ); 219 222 } elseif ( 'link_category' == $taxonomy ) { 220 223 /** This action is documented in wp-admin/edit-tags.php */ 221 do_action( 'edit_link_category_form', $t ag);224 do_action( 'edit_link_category_form', $term ); 222 225 } else { 223 226 /** 224 227 * Fires at the end of the Edit Term form. … … if ( 'category' == $taxonomy ) { 226 229 * @since 2.5.0 227 230 * @deprecated 3.0.0 Use {$taxonomy}_edit_form instead. 228 231 * 229 * @param object $t agCurrent taxonomy term object.232 * @param object $term Current taxonomy term object. 230 233 */ 231 do_action( 'edit_tag_form', $t ag);234 do_action( 'edit_tag_form', $term ); 232 235 } 233 236 /** 234 237 * Fires at the end of the Edit Term form for all taxonomies. … … if ( 'category' == $taxonomy ) { 237 240 * 238 241 * @since 3.0.0 239 242 * 240 * @param object $t agCurrent taxonomy term object.243 * @param object $term Current taxonomy term object. 241 244 * @param string $taxonomy Current taxonomy slug. 242 245 */ 243 do_action( "{$taxonomy}_edit_form", $t ag, $taxonomy );246 do_action( "{$taxonomy}_edit_form", $term, $taxonomy ); 244 247 245 248 submit_button( __('Update') ); 246 249 ?> -
src/wp-admin/edit-tags.php
diff --git src/wp-admin/edit-tags.php src/wp-admin/edit-tags.php index 6ff9e37..b73c16d 100644
case 'bulk-delete': 152 152 case 'edit': 153 153 $title = $tax->labels->edit_item; 154 154 155 $t ag_ID= (int) $_REQUEST['tag_ID'];155 $term_id = (int) $_REQUEST['tag_ID']; 156 156 157 $tag = get_term( $tag_ID, $taxonomy, OBJECT, 'edit' ); 158 if ( ! $tag ) 157 if ( ! get_term( $tag_ID ) ) { 159 158 wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); 160 require_once( ABSPATH . 'wp-admin/admin-header.php' ); 161 include( ABSPATH . 'wp-admin/edit-tag-form.php' ); 162 include( ABSPATH . 'wp-admin/admin-footer.php' ); 159 } 163 160 161 wp_safe_redirect( get_edit_term_link( $term_id, $taxonomy, $post_type ) ); 164 162 exit; 165 163 166 164 case 'editedtag': -
new file src/wp-admin/term.php
diff --git src/wp-admin/term.php src/wp-admin/term.php new file mode 100644 index 0000000..8579cdd
- + 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 taxonomy' ) ); 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->name&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
diff --git src/wp-includes/link-template.php src/wp-includes/link-template.php index 5aabffa..4a689f4 100644
function get_edit_term_link( $term_id, $taxonomy, $object_type = '' ) { 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 ) { … … function get_edit_term_link( $term_id, $taxonomy, $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 }