Make WordPress Core

Changeset 28292


Ignore:
Timestamp:
05/06/2014 03:18:42 PM (10 years ago)
Author:
wonderboymusic
Message:

In ajax-actions.php, remove dead code:

  • In wp_ajax_add_tag(), $post_type is set and never used.
  • In wp_ajax_hidden_columns(), $hidden is set twice, but only checks for the existence of $_POST['hidden'] the first time. The two lines can be combined and work together.
  • In wp_ajax_inline_save(), $mode is set and never used.
  • In wp_ajax_find_posts(), $searchand = $search = ''; is leftover cruft, neither variable is used. $wpdb does not need to be imported, it is never used.
  • In wp_ajax_wp_fullscreen_save_post(), $post_type is set and never used.
  • In wp_ajax_save_attachment_order(), $post is set and never used.
  • In wp_ajax_send_attachment_to_editor(), $title is set and never used.

See #27882.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r28213 r28292  
    639639
    640640    check_ajax_referer( 'add-tag', '_wpnonce_add-tag' );
    641     $post_type = !empty($_POST['post_type']) ? $_POST['post_type'] : 'post';
    642641    $taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag';
    643642    $tax = get_taxonomy($taxonomy);
     
    879878
    880879    $position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1';
    881     $comments_status = isset($_POST['comments_listing']) ? $_POST['comments_listing'] : '';
    882 
    883880    $checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0;
    884881    $wp_list_table = _get_list_table( $checkbox ? 'WP_Comments_List_Table' : 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
     
    11231120function wp_ajax_hidden_columns() {
    11241121    check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' );
    1125     $hidden = isset( $_POST['hidden'] ) ? $_POST['hidden'] : '';
    1126     $hidden = explode( ',', $_POST['hidden'] );
     1122    $hidden = explode( ',', isset( $_POST['hidden'] ) ? $_POST['hidden'] : '' );
    11271123    $page = isset( $_POST['page'] ) ? $_POST['page'] : '';
    11281124
     
    13331329    $wp_list_table = _get_list_table( 'WP_Posts_List_Table', array( 'screen' => $_POST['screen'] ) );
    13341330
    1335     $mode = $_POST['post_view'];
    1336 
    13371331    $level = 0;
    13381332    $request_post = array( get_post( $_POST['post_ID'] ) );
     
    13961390
    13971391function wp_ajax_find_posts() {
    1398     global $wpdb;
    1399 
    14001392    check_ajax_referer( 'find-posts' );
    14011393
     
    14041396
    14051397    $s = wp_unslash( $_POST['ps'] );
    1406     $searchand = $search = '';
    14071398    $args = array(
    14081399        'post_type' => array_keys( $post_types ),
     
    17101701    $post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0;
    17111702
    1712     $post = $post_type = null;
     1703    $post = null;
    17131704
    17141705    if ( $post_id )
    17151706        $post = get_post( $post_id );
    1716 
    1717     if ( $post )
    1718         $post_type = $post->post_type;
    1719     elseif ( isset( $_POST['post_type'] ) && post_type_exists( $_POST['post_type'] ) )
    1720         $post_type = $_POST['post_type'];
    17211707
    17221708    check_ajax_referer('update-post_' . $post_id, '_wpnonce');
     
    19681954        wp_send_json_error();
    19691955
    1970     $post = get_post( $post_id, ARRAY_A );
    1971 
    19721956    foreach ( $attachments as $attachment_id => $menu_order ) {
    19731957        if ( ! current_user_can( 'edit_post', $attachment_id ) )
     
    20121996
    20131997    $rel = $url = '';
    2014     $html = $title = isset( $attachment['post_title'] ) ? $attachment['post_title'] : '';
     1998    $html = isset( $attachment['post_title'] ) ? $attachment['post_title'] : '';
    20151999    if ( ! empty( $attachment['url'] ) ) {
    20162000        $url = $attachment['url'];
Note: See TracChangeset for help on using the changeset viewer.