Ticket #37699: 37699.2.diff
File 37699.2.diff, 4.3 KB (added by , 8 years ago) |
---|
-
src/wp-admin/includes/ajax-actions.php
79 79 * Ajax handler for fetching a list table. 80 80 * 81 81 * @since 3.1.0 82 *83 * @global WP_List_Table $wp_list_table84 82 */ 85 83 function wp_ajax_fetch_list() { 86 global $wp_list_table;87 88 84 $list_class = $_GET['list_args']['class']; 89 85 check_ajax_referer( "fetch-list-$list_class", '_ajax_fetch_list_nonce' ); 90 86 91 87 $wp_list_table = _get_list_table( $list_class, array( 'screen' => $_GET['list_args']['screen']['id'] ) ); 92 if ( ! $wp_list_table ) 88 if ( ! $wp_list_table ) { 93 89 wp_die( 0 ); 90 } 94 91 95 if ( ! $wp_list_table->ajax_user_can() ) 92 if ( ! $wp_list_table->ajax_user_can() ) { 96 93 wp_die( -1 ); 94 } 97 95 98 96 $wp_list_table->ajax_response(); 99 97 … … 829 827 * Ajax handler to add a tag. 830 828 * 831 829 * @since 3.1.0 832 *833 * @global WP_List_Table $wp_list_table834 830 */ 835 831 function wp_ajax_add_tag() { 836 global $wp_list_table;837 838 832 check_ajax_referer( 'add-tag', '_wpnonce_add-tag' ); 839 833 $taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag'; 840 834 $tax = get_taxonomy($taxonomy); … … 933 927 * 934 928 * @since 3.1.0 935 929 * 936 * @global WP_List_Table $wp_list_table937 930 * @global int $post_id 938 931 * 939 932 * @param string $action Action to perform. 940 933 */ 941 934 function wp_ajax_get_comments( $action ) { 942 global $ wp_list_table, $post_id;943 if ( empty( $action ) ) 935 global $post_id; 936 if ( empty( $action ) ) { 944 937 $action = 'get-comments'; 945 938 } 946 939 check_ajax_referer( $action ); 947 940 948 941 if ( empty( $post_id ) && ! empty( $_REQUEST['p'] ) ) { 949 942 $id = absint( $_REQUEST['p'] ); 950 if ( ! empty( $id ) ) 943 if ( ! empty( $id ) ) { 951 944 $post_id = $id; 945 } 952 946 } 953 947 954 if ( empty( $post_id ) ) 948 if ( empty( $post_id ) ) { 955 949 wp_die( -1 ); 950 } 956 951 957 952 $wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) ); 958 953 959 if ( ! current_user_can( 'edit_post', $post_id ) ) 954 if ( ! current_user_can( 'edit_post', $post_id ) ) { 960 955 wp_die( -1 ); 956 } 961 957 962 958 $wp_list_table->prepare_items(); 963 959 964 if ( ! $wp_list_table->has_items() )960 if ( ! $wp_list_table->has_items() ) { 965 961 wp_die( 1 ); 962 } 966 963 967 964 $x = new WP_Ajax_Response(); 968 965 ob_start(); … … 986 983 * 987 984 * @since 3.1.0 988 985 * 989 * @global WP_List_Table $wp_list_table990 *991 986 * @param string $action Action to perform. 992 987 */ 993 988 function wp_ajax_replyto_comment( $action ) { 994 global $wp_list_table;995 989 if ( empty( $action ) ) 996 990 $action = 'replyto-comment'; 997 991 … … 1108 1102 * Ajax handler for editing a comment. 1109 1103 * 1110 1104 * @since 3.1.0 1111 *1112 * @global WP_List_Table $wp_list_table1113 1105 */ 1114 1106 function wp_ajax_edit_comment() { 1115 global $wp_list_table;1116 1117 1107 check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' ); 1118 1108 1119 1109 $comment_id = (int) $_POST['comment_ID']; … … 1327 1317 * 1328 1318 * @since 3.1.0 1329 1319 * 1330 * @global WP_List_Table $wp_list_table1331 *1332 1320 * @param string $action Action to perform. 1333 1321 */ 1334 1322 function wp_ajax_add_user( $action ) { 1335 global $wp_list_table; 1336 if ( empty( $action ) ) 1323 if ( empty( $action ) ) { 1337 1324 $action = 'add-user'; 1325 } 1338 1326 1339 1327 check_ajax_referer( $action ); 1340 1328 if ( ! current_user_can('create_users') ) … … 1607 1595 * Ajax handler for Quick Edit saving a post from a list table. 1608 1596 * 1609 1597 * @since 3.1.0 1610 *1611 * @global WP_List_Table $wp_list_table1612 1598 */ 1613 1599 function wp_ajax_inline_save() { 1614 global $ wp_list_table, $mode;1600 global $mode; 1615 1601 1616 1602 check_ajax_referer( 'inlineeditnonce', '_inline_edit' ); 1617 1603 … … 1707 1693 * Ajax handler for quick edit saving for a term. 1708 1694 * 1709 1695 * @since 3.1.0 1710 *1711 * @global WP_List_Table $wp_list_table1712 1696 */ 1713 1697 function wp_ajax_inline_save_tax() { 1714 global $wp_list_table;1715 1716 1698 check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' ); 1717 1699 1718 1700 $taxonomy = sanitize_key( $_POST['taxonomy'] ); -
src/wp-admin/includes/list-table.php
63 63 * @see get_column_headers(), print_column_headers(), get_hidden_columns() 64 64 */ 65 65 function register_column_headers($screen, $columns) { 66 $wp_list_table =new _WP_List_Table_Compat($screen, $columns);66 new _WP_List_Table_Compat($screen, $columns); 67 67 } 68 68 69 69 /**