Changeset 34202
- Timestamp:
- 09/15/2015 03:58:04 PM (9 years ago)
- Location:
- trunk/src/wp-admin
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/edit-tag-form.php
r32974 r34202 49 49 do_action( 'edit_tag_form_pre', $tag ); 50 50 } 51 52 /** 53 * Use with caution, see http://codex.wordpress.org/Function_Reference/wp_reset_vars 54 */ 55 wp_reset_vars( array( 'wp_http_referer' ) ); 56 57 $wp_http_referer = remove_query_arg( array( 'action', 'message', 'tag_ID' ), $wp_http_referer ); 58 59 /** Also used by Edit Tags */ 60 require_once( ABSPATH . 'wp-admin/includes/edit-tag-messages.php' ); 61 51 62 /** 52 63 * Fires before the Edit Term form for all taxonomies. … … 64 75 <div class="wrap"> 65 76 <h1><?php echo $tax->labels->edit_item; ?></h1> 77 78 <?php if ( $message ) : ?> 79 <div id="message" class="updated"> 80 <p><strong><?php echo $message; ?></strong></p> 81 <?php if ( $wp_http_referer ) { ?> 82 <p><a href="<?php echo esc_url( $wp_http_referer ); ?>"><?php printf( __( '← Back to %s' ), $tax->labels->name ); ?></a></p> 83 <?php } else { ?> 84 <p><a href="<?php echo esc_url( wp_get_referer() ); ?>"><?php printf( __( '← Back to %s' ), $tax->labels->name ); ?></a></p> 85 <?php } ?> 86 </div> 87 <?php endif; ?> 88 66 89 <div id="ajax-response"></div> 90 67 91 <form name="edittag" id="edittag" method="post" action="edit-tags.php" class="validate" 68 92 <?php -
trunk/src/wp-admin/edit-tags.php
r33917 r34202 52 52 53 53 $location = false; 54 $referer = wp_get_referer(); 54 55 55 56 switch ( $wp_list_table->current_action() ) { … … 72 73 $location .= '&post_type=' . $post_type; 73 74 74 if ( $referer = wp_get_original_referer() ) { 75 if ( false !== strpos( $referer, 'edit-tags.php' ) ) 76 $location = $referer; 75 if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) { 76 $location = $referer; 77 77 } 78 78 … … 88 88 if ( 'post' != $post_type ) 89 89 $location .= '&post_type=' . $post_type; 90 if ( $referer = wp_get_referer() ) { 91 if ( false !== strpos( $referer, 'edit-tags.php' ) )92 90 91 if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) { 92 $location = $referer; 93 93 } 94 94 … … 133 133 if ( 'post' != $post_type ) 134 134 $location .= '&post_type=' . $post_type; 135 if ( $referer = wp_get_referer() ) { 136 if ( false !== strpos( $referer, 'edit-tags.php' ) ) 137 $location = $referer; 135 if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) { 136 $location = $referer; 138 137 } 139 138 … … 178 177 $location .= '&post_type=' . $post_type; 179 178 180 if ( $referer = wp_get_original_referer() ) { 181 if ( false !== strpos( $referer, 'edit-tags.php' ) ) 182 $location = $referer; 179 if ( $referer && false !== strpos( $referer, 'edit-tags.php' ) ) { 180 $location = $referer; 183 181 } 184 182 … … 286 284 } 287 285 288 $messages = array(); 289 $messages['_item'] = array( 290 0 => '', // Unused. Messages start at index 1. 291 1 => __( 'Item added.' ), 292 2 => __( 'Item deleted.' ), 293 3 => __( 'Item updated.' ), 294 4 => __( 'Item not added.' ), 295 5 => __( 'Item not updated.' ), 296 6 => __( 'Items deleted.' ) 297 ); 298 $messages['category'] = array( 299 0 => '', // Unused. Messages start at index 1. 300 1 => __( 'Category added.' ), 301 2 => __( 'Category deleted.' ), 302 3 => __( 'Category updated.' ), 303 4 => __( 'Category not added.' ), 304 5 => __( 'Category not updated.' ), 305 6 => __( 'Categories deleted.' ) 306 ); 307 $messages['post_tag'] = array( 308 0 => '', // Unused. Messages start at index 1. 309 1 => __( 'Tag added.' ), 310 2 => __( 'Tag deleted.' ), 311 3 => __( 'Tag updated.' ), 312 4 => __( 'Tag not added.' ), 313 5 => __( 'Tag not updated.' ), 314 6 => __( 'Tags deleted.' ) 315 ); 316 317 /** 318 * Filter the messages displayed when a tag is updated. 319 * 320 * @since 3.7.0 321 * 322 * @param array $messages The messages to be displayed. 323 */ 324 $messages = apply_filters( 'term_updated_messages', $messages ); 325 326 $message = false; 327 if ( isset( $_REQUEST['message'] ) && ( $msg = (int) $_REQUEST['message'] ) ) { 328 if ( isset( $messages[ $taxonomy ][ $msg ] ) ) 329 $message = $messages[ $taxonomy ][ $msg ]; 330 elseif ( ! isset( $messages[ $taxonomy ] ) && isset( $messages['_item'][ $msg ] ) ) 331 $message = $messages['_item'][ $msg ]; 332 } 286 /** Also used by the Edit Tag form */ 287 require_once( ABSPATH . 'wp-admin/includes/edit-tag-messages.php' ); 333 288 334 289 $class = ( isset( $_REQUEST['error'] ) ) ? 'error' : 'updated'; -
trunk/src/wp-admin/includes/class-wp-terms-list-table.php
r34059 r34202 360 360 361 361 $qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' ); 362 $edit_link = esc_url( get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) ); 363 364 $out = '<strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit “%s”' ), $name ) ) . '">' . $name . '</a></strong><br />'; 362 363 $uri = ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ? wp_get_referer() : $_SERVER['REQUEST_URI']; 364 365 $edit_link = add_query_arg( 366 'wp_http_referer', 367 urlencode( wp_unslash( $uri ) ), 368 get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) 369 ); 370 371 $out = '<strong><a class="row-title" href="' . esc_url( $edit_link ) . '" title="' . esc_attr( sprintf( __( 'Edit “%s”' ), $name ) ) . '">' . $name . '</a></strong><br />'; 365 372 366 373 $out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">'; … … 406 413 $default_term = get_option( 'default_' . $taxonomy ); 407 414 408 $edit_link = esc_url( get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) ); 415 $uri = ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ? wp_get_referer() : $_SERVER['REQUEST_URI']; 416 417 $edit_link = add_query_arg( 418 'wp_http_referer', 419 urlencode( wp_unslash( $uri ) ), 420 get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) 421 ); 409 422 410 423 $actions = array(); 411 424 if ( current_user_can( $tax->cap->edit_terms ) ) { 412 $actions['edit'] = '<a href="' . $edit_link. '">' . __( 'Edit' ) . '</a>';425 $actions['edit'] = '<a href="' . esc_url( $edit_link ) . '">' . __( 'Edit' ) . '</a>'; 413 426 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick Edit' ) . '</a>'; 414 427 }
Note: See TracChangeset
for help on using the changeset viewer.