mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-12 13:44:21 +01:00
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. Built from https://develop.svn.wordpress.org/trunk@28292 git-svn-id: http://core.svn.wordpress.org/trunk@28120 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d433f8f1ed
commit
28d98a89f3
@ -638,7 +638,6 @@ function wp_ajax_add_tag() {
|
||||
global $wp_list_table;
|
||||
|
||||
check_ajax_referer( 'add-tag', '_wpnonce_add-tag' );
|
||||
$post_type = !empty($_POST['post_type']) ? $_POST['post_type'] : 'post';
|
||||
$taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag';
|
||||
$tax = get_taxonomy($taxonomy);
|
||||
|
||||
@ -878,8 +877,6 @@ function wp_ajax_edit_comment() {
|
||||
edit_comment();
|
||||
|
||||
$position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1';
|
||||
$comments_status = isset($_POST['comments_listing']) ? $_POST['comments_listing'] : '';
|
||||
|
||||
$checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0;
|
||||
$wp_list_table = _get_list_table( $checkbox ? 'WP_Comments_List_Table' : 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
|
||||
|
||||
@ -1122,8 +1119,7 @@ function wp_ajax_closed_postboxes() {
|
||||
|
||||
function wp_ajax_hidden_columns() {
|
||||
check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' );
|
||||
$hidden = isset( $_POST['hidden'] ) ? $_POST['hidden'] : '';
|
||||
$hidden = explode( ',', $_POST['hidden'] );
|
||||
$hidden = explode( ',', isset( $_POST['hidden'] ) ? $_POST['hidden'] : '' );
|
||||
$page = isset( $_POST['page'] ) ? $_POST['page'] : '';
|
||||
|
||||
if ( $page != sanitize_key( $page ) )
|
||||
@ -1332,8 +1328,6 @@ function wp_ajax_inline_save() {
|
||||
|
||||
$wp_list_table = _get_list_table( 'WP_Posts_List_Table', array( 'screen' => $_POST['screen'] ) );
|
||||
|
||||
$mode = $_POST['post_view'];
|
||||
|
||||
$level = 0;
|
||||
$request_post = array( get_post( $_POST['post_ID'] ) );
|
||||
$parent = $request_post[0]->post_parent;
|
||||
@ -1395,15 +1389,12 @@ function wp_ajax_inline_save_tax() {
|
||||
}
|
||||
|
||||
function wp_ajax_find_posts() {
|
||||
global $wpdb;
|
||||
|
||||
check_ajax_referer( 'find-posts' );
|
||||
|
||||
$post_types = get_post_types( array( 'public' => true ), 'objects' );
|
||||
unset( $post_types['attachment'] );
|
||||
|
||||
$s = wp_unslash( $_POST['ps'] );
|
||||
$searchand = $search = '';
|
||||
$args = array(
|
||||
'post_type' => array_keys( $post_types ),
|
||||
'post_status' => 'any',
|
||||
@ -1709,16 +1700,11 @@ function wp_ajax_time_format() {
|
||||
function wp_ajax_wp_fullscreen_save_post() {
|
||||
$post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0;
|
||||
|
||||
$post = $post_type = null;
|
||||
$post = null;
|
||||
|
||||
if ( $post_id )
|
||||
$post = get_post( $post_id );
|
||||
|
||||
if ( $post )
|
||||
$post_type = $post->post_type;
|
||||
elseif ( isset( $_POST['post_type'] ) && post_type_exists( $_POST['post_type'] ) )
|
||||
$post_type = $_POST['post_type'];
|
||||
|
||||
check_ajax_referer('update-post_' . $post_id, '_wpnonce');
|
||||
|
||||
$post_id = edit_post();
|
||||
@ -1967,8 +1953,6 @@ function wp_ajax_save_attachment_order() {
|
||||
if ( ! current_user_can( 'edit_post', $post_id ) )
|
||||
wp_send_json_error();
|
||||
|
||||
$post = get_post( $post_id, ARRAY_A );
|
||||
|
||||
foreach ( $attachments as $attachment_id => $menu_order ) {
|
||||
if ( ! current_user_can( 'edit_post', $attachment_id ) )
|
||||
continue;
|
||||
@ -2011,7 +1995,7 @@ function wp_ajax_send_attachment_to_editor() {
|
||||
}
|
||||
|
||||
$rel = $url = '';
|
||||
$html = $title = isset( $attachment['post_title'] ) ? $attachment['post_title'] : '';
|
||||
$html = isset( $attachment['post_title'] ) ? $attachment['post_title'] : '';
|
||||
if ( ! empty( $attachment['url'] ) ) {
|
||||
$url = $attachment['url'];
|
||||
if ( strpos( $url, 'attachment_id') || get_attachment_link( $id ) == $url )
|
||||
|
Loading…
Reference in New Issue
Block a user