Ticket #26758: 26758.2.patch
File 26758.2.patch, 5.1 KB (added by , 9 years ago) |
---|
-
src/wp-admin/edit-tag-form.php
48 48 */ 49 49 do_action( 'edit_tag_form_pre', $tag ); 50 50 } 51 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 $messages = array(); 60 // 0 = unused. Messages start at index 1. 61 $messages['_item'] = array( 62 0 => '', 63 1 => __( 'Item added.' ), 64 2 => __( 'Item deleted.' ), 65 3 => __( 'Item updated.' ), 66 4 => __( 'Item not added.' ), 67 5 => __( 'Item not updated.' ), 68 6 => __( 'Items deleted.' ), 69 ); 70 $messages['category'] = array( 71 0 => '', 72 1 => __( 'Category added.' ), 73 2 => __( 'Category deleted.' ), 74 3 => __( 'Category updated.' ), 75 4 => __( 'Category not added.' ), 76 5 => __( 'Category not updated.' ), 77 6 => __( 'Categories deleted.' ), 78 ); 79 $messages['post_tag'] = array( 80 0 => '', 81 1 => __( 'Tag added.' ), 82 2 => __( 'Tag deleted.' ), 83 3 => __( 'Tag updated.' ), 84 4 => __( 'Tag not added.' ), 85 5 => __( 'Tag not updated.' ), 86 6 => __( 'Tags deleted.' ), 87 ); 88 89 90 /** 91 * Filter the messages displayed when a tag is updated. 92 * 93 * @since 4.1.0 94 * 95 * @param array $messages The messages to be displayed. 96 */ 97 $messages = apply_filters( 'term_updated_messages', $messages ); 98 99 $message = false; 100 if ( isset( $_REQUEST['message'] ) && ( $msg = (int) $_REQUEST['message'] ) ) { 101 if ( isset( $messages[ $taxonomy ][ $msg ] ) ) { 102 $message = $messages[ $taxonomy ][ $msg ]; 103 } elseif ( ! isset( $messages[ $taxonomy ] ) && isset( $messages['_item'][ $msg ] ) ) { 104 $message = $messages['_item'][ $msg ]; 105 } 106 } 107 108 109 /** 52 110 * Fires before the Edit Term form for all taxonomies. 53 111 * 54 112 * The dynamic portion of the hook name, `$taxonomy`, refers to … … 63 121 64 122 <div class="wrap"> 65 123 <h1><?php echo $tax->labels->edit_item; ?></h1> 124 125 <?php if ( $message ) : ?> 126 <div id="message" class="updated"> 127 <p><strong><?php echo $message; ?></strong></p> 128 <?php if ( $wp_http_referer ) { ?> 129 <p><a href="<?php echo esc_url( $wp_http_referer ); ?>"><?php printf( __( '← Back to %s' ), $tax->labels->name ); ?></a></p> 130 <?php } else { ?> 131 <p><a href="<?php echo esc_url( wp_get_referer() ); ?>"><?php printf( __( '← Back to %s' ), $tax->labels->name ); ?></a></p> 132 <?php } ?> 133 </div> 134 <?php endif; ?> 135 66 136 <div id="ajax-response"></div> 137 67 138 <form name="edittag" id="edittag" method="post" action="edit-tags.php" class="validate" 68 139 <?php 69 140 /** -
src/wp-admin/edit-tags.php
71 71 if ( 'post' != $post_type ) 72 72 $location .= '&post_type=' . $post_type; 73 73 74 if ( $referer = wp_get_ original_referer() ) {74 if ( $referer = wp_get_referer() ) { 75 75 if ( false !== strpos( $referer, 'edit-tags.php' ) ) 76 76 $location = $referer; 77 77 } … … 177 177 if ( 'post' != $post_type ) 178 178 $location .= '&post_type=' . $post_type; 179 179 180 if ( $referer = wp_get_ original_referer() ) {180 if ( $referer = wp_get_referer() ) { 181 181 if ( false !== strpos( $referer, 'edit-tags.php' ) ) 182 182 $location = $referer; 183 183 } -
src/wp-admin/includes/class-wp-terms-list-table.php
359 359 $name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag ); 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 362 363 $doing_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX; 364 365 $uri = $doing_ajax ? wp_get_referer() : $_SERVER['REQUEST_URI']; 366 367 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $uri ) ), get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) ) ); 368 364 369 $out = '<strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit “%s”' ), $name ) ) . '">' . $name . '</a></strong><br />'; 365 370 366 371 $out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">'; … … 405 410 $tax = get_taxonomy( $taxonomy ); 406 411 $default_term = get_option( 'default_' . $taxonomy ); 407 412 408 $ edit_link = esc_url( get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) );413 $doing_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX; 409 414 415 $uri = $doing_ajax ? wp_get_referer() : $_SERVER['REQUEST_URI']; 416 417 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $uri ) ), get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) ) ); 418 410 419 $actions = array(); 411 420 if ( current_user_can( $tax->cap->edit_terms ) ) { 412 421 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';