Coding Standards: Fix the `Squiz.PHP.DisallowMultipleAssignments` violations in `wp-admin`.
See #47632. Built from https://develop.svn.wordpress.org/trunk@45583 git-svn-id: http://core.svn.wordpress.org/trunk@45394 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b2d5a4216c
commit
cf3fa9f7c8
|
@ -39,7 +39,8 @@ if ( ! current_user_can( 'upload_files' ) ) {
|
|||
}
|
||||
|
||||
// just fetch the detail form for that attachment
|
||||
if ( isset( $_REQUEST['attachment_id'] ) && ( $id = intval( $_REQUEST['attachment_id'] ) ) && $_REQUEST['fetch'] ) {
|
||||
if ( isset( $_REQUEST['attachment_id'] ) && intval( $_REQUEST['attachment_id'] ) && $_REQUEST['fetch'] ) {
|
||||
$id = intval( $_REQUEST['attachment_id'] );
|
||||
$post = get_post( $id );
|
||||
if ( 'attachment' != $post->post_type ) {
|
||||
wp_die( __( 'Invalid post type.' ) );
|
||||
|
@ -50,7 +51,8 @@ if ( isset( $_REQUEST['attachment_id'] ) && ( $id = intval( $_REQUEST['attachmen
|
|||
|
||||
switch ( $_REQUEST['fetch'] ) {
|
||||
case 3:
|
||||
if ( $thumb_url = wp_get_attachment_image_src( $id, 'thumbnail', true ) ) {
|
||||
$thumb_url = wp_get_attachment_image_src( $id, 'thumbnail', true );
|
||||
if ( $thumb_url ) {
|
||||
echo '<img class="pinkynail" src="' . esc_url( $thumb_url[0] ) . '" alt="" />';
|
||||
}
|
||||
echo '<a class="edit-attachment" href="' . esc_url( get_edit_post_link( $id ) ) . '" target="_blank">' . _x( 'Edit', 'media item' ) . '</a>';
|
||||
|
|
|
@ -62,7 +62,8 @@ switch ( $action ) {
|
|||
|
||||
$comment_id = absint( $_GET['c'] );
|
||||
|
||||
if ( ! $comment = get_comment( $comment_id ) ) {
|
||||
$comment = get_comment( $comment_id );
|
||||
if ( ! $comment ) {
|
||||
comment_footer_die( __( 'Invalid comment ID.' ) . sprintf( ' <a href="%s">' . __( 'Go back' ) . '</a>.', 'javascript:history.go(-1)' ) );
|
||||
}
|
||||
|
||||
|
@ -88,7 +89,8 @@ switch ( $action ) {
|
|||
|
||||
$comment_id = absint( $_GET['c'] );
|
||||
|
||||
if ( ! $comment = get_comment( $comment_id ) ) {
|
||||
$comment = get_comment( $comment_id );
|
||||
if ( ! $comment ) {
|
||||
wp_redirect( admin_url( 'edit-comments.php?error=1' ) );
|
||||
die();
|
||||
}
|
||||
|
@ -260,7 +262,8 @@ switch ( $action ) {
|
|||
|
||||
$noredir = isset( $_REQUEST['noredir'] );
|
||||
|
||||
if ( ! $comment = get_comment( $comment_id ) ) {
|
||||
$comment = get_comment( $comment_id );
|
||||
if ( ! $comment ) {
|
||||
comment_footer_die( __( 'Invalid comment ID.' ) . sprintf( ' <a href="%s">' . __( 'Go back' ) . '</a>.', 'edit-comments.php' ) );
|
||||
}
|
||||
if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
|
||||
|
|
|
@ -256,7 +256,8 @@ class Custom_Background {
|
|||
call_user_func( $this->admin_image_div_callback );
|
||||
} else {
|
||||
$background_styles = '';
|
||||
if ( $bgcolor = get_background_color() ) {
|
||||
$bgcolor = get_background_color();
|
||||
if ( $bgcolor ) {
|
||||
$background_styles .= 'background-color: #' . $bgcolor . ';';
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,13 @@ if ( $doaction ) {
|
|||
exit;
|
||||
}
|
||||
|
||||
$approved = $unapproved = $spammed = $unspammed = $trashed = $untrashed = $deleted = 0;
|
||||
$approved = 0;
|
||||
$unapproved = 0;
|
||||
$spammed = 0;
|
||||
$unspammed = 0;
|
||||
$trashed = 0;
|
||||
$untrashed = 0;
|
||||
$deleted = 0;
|
||||
|
||||
$redirect_to = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'spammed', 'unspammed', 'approved', 'unapproved', 'ids' ), wp_get_referer() );
|
||||
$redirect_to = add_query_arg( 'paged', $pagenum, $redirect_to );
|
||||
|
@ -307,17 +313,20 @@ if ( isset( $_REQUEST['approved'] ) || isset( $_REQUEST['deleted'] ) || isset( $
|
|||
$messages[] = sprintf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $deleted ), $deleted );
|
||||
}
|
||||
|
||||
if ( $same > 0 && $comment = get_comment( $same ) ) {
|
||||
switch ( $comment->comment_approved ) {
|
||||
case '1':
|
||||
$messages[] = __( 'This comment is already approved.' ) . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>';
|
||||
break;
|
||||
case 'trash':
|
||||
$messages[] = __( 'This comment is already in the Trash.' ) . ' <a href="' . esc_url( admin_url( 'edit-comments.php?comment_status=trash' ) ) . '"> ' . __( 'View Trash' ) . '</a>';
|
||||
break;
|
||||
case 'spam':
|
||||
$messages[] = __( 'This comment is already marked as spam.' ) . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>';
|
||||
break;
|
||||
if ( $same > 0 ) {
|
||||
$comment = get_comment( $same );
|
||||
if ( $comment ) {
|
||||
switch ( $comment->comment_approved ) {
|
||||
case '1':
|
||||
$messages[] = __( 'This comment is already approved.' ) . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>';
|
||||
break;
|
||||
case 'trash':
|
||||
$messages[] = __( 'This comment is already in the Trash.' ) . ' <a href="' . esc_url( admin_url( 'edit-comments.php?comment_status=trash' ) ) . '"> ' . __( 'View Trash' ) . '</a>';
|
||||
break;
|
||||
case 'spam':
|
||||
$messages[] = __( 'This comment is already marked as spam.' ) . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,9 @@ if ( is_multisite() ) {
|
|||
}
|
||||
|
||||
wp_enqueue_script( 'post' );
|
||||
$_wp_editor_expand = $_content_editor_dfw = false;
|
||||
|
||||
$_wp_editor_expand = false;
|
||||
$_content_editor_dfw = false;
|
||||
|
||||
/**
|
||||
* Filters whether to enable the 'expand' functionality in the post editor.
|
||||
|
@ -106,8 +108,13 @@ if ( ! $permalink ) {
|
|||
|
||||
$messages = array();
|
||||
|
||||
$preview_post_link_html = $scheduled_post_link_html = $view_post_link_html = '';
|
||||
$preview_page_link_html = $scheduled_page_link_html = $view_page_link_html = '';
|
||||
$preview_post_link_html = '';
|
||||
$scheduled_post_link_html = '';
|
||||
$view_post_link_html = '';
|
||||
|
||||
$preview_page_link_html = '';
|
||||
$scheduled_page_link_html = '';
|
||||
$view_page_link_html = '';
|
||||
|
||||
$preview_url = get_preview_post_link( $post );
|
||||
|
||||
|
@ -576,7 +583,8 @@ if ( post_type_supports( $post_type, 'editor' ) ) {
|
|||
<?php
|
||||
if ( 'auto-draft' != $post->post_status ) {
|
||||
echo '<span id="last-edit">';
|
||||
if ( $last_user = get_userdata( get_post_meta( $post_ID, '_edit_last', true ) ) ) {
|
||||
$last_user = get_userdata( get_post_meta( $post_ID, '_edit_last', true ) );
|
||||
if ( $last_user ) {
|
||||
/* translators: 1: Name of most recent post author, 2: Post edited date, 3: Post edited time */
|
||||
printf( __( 'Last edited by %1$s on %2$s at %3$s' ), esc_html( $last_user->display_name ), mysql2date( __( 'F j, Y' ), $post->post_modified ), mysql2date( __( 'g:i a' ), $post->post_modified ) );
|
||||
} else {
|
||||
|
|
|
@ -103,7 +103,8 @@ if ( $doaction ) {
|
|||
|
||||
switch ( $doaction ) {
|
||||
case 'trash':
|
||||
$trashed = $locked = 0;
|
||||
$trashed = 0;
|
||||
$locked = 0;
|
||||
|
||||
foreach ( (array) $post_ids as $post_id ) {
|
||||
if ( ! current_user_can( 'delete_post', $post_id ) ) {
|
||||
|
|
|
@ -101,7 +101,8 @@ if ( empty( $importers ) ) {
|
|||
|
||||
<?php
|
||||
foreach ( $importers as $importer_id => $data ) {
|
||||
$plugin_slug = $action = '';
|
||||
$plugin_slug = '';
|
||||
$action = '';
|
||||
$is_plugin_installed = false;
|
||||
|
||||
if ( isset( $data['install'] ) ) {
|
||||
|
|
|
@ -669,7 +669,8 @@ function _wp_ajax_add_hierarchical_term() {
|
|||
function wp_ajax_delete_comment() {
|
||||
$id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
|
||||
|
||||
if ( ! $comment = get_comment( $id ) ) {
|
||||
$comment = get_comment( $id );
|
||||
if ( ! $comment ) {
|
||||
wp_die( time() );
|
||||
}
|
||||
if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
|
||||
|
@ -778,7 +779,8 @@ function wp_ajax_delete_meta() {
|
|||
$id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
|
||||
|
||||
check_ajax_referer( "delete-meta_$id" );
|
||||
if ( ! $meta = get_metadata_by_mid( 'post', $id ) ) {
|
||||
$meta = get_metadata_by_mid( 'post', $id );
|
||||
if ( ! $meta ) {
|
||||
wp_die( 1 );
|
||||
}
|
||||
|
||||
|
@ -906,7 +908,8 @@ function wp_ajax_delete_page( $action ) {
|
|||
function wp_ajax_dim_comment() {
|
||||
$id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
|
||||
|
||||
if ( ! $comment = get_comment( $id ) ) {
|
||||
$comment = get_comment( $id );
|
||||
if ( ! $comment ) {
|
||||
$x = new WP_Ajax_Response(
|
||||
array(
|
||||
'what' => 'comment',
|
||||
|
@ -1010,7 +1013,11 @@ function wp_ajax_add_tag() {
|
|||
|
||||
$tag = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST );
|
||||
|
||||
if ( ! $tag || is_wp_error( $tag ) || ( ! $tag = get_term( $tag['term_id'], $taxonomy ) ) ) {
|
||||
if ( $tag && ! is_wp_error( $tag ) ) {
|
||||
$tag = get_term( $tag['term_id'], $taxonomy );
|
||||
}
|
||||
|
||||
if ( ! $tag || is_wp_error( $tag ) ) {
|
||||
$message = __( 'An error has occurred. Please reload the page and try again.' );
|
||||
if ( is_wp_error( $tag ) && $tag->get_error_message() ) {
|
||||
$message = $tag->get_error_message();
|
||||
|
@ -1490,14 +1497,18 @@ function wp_ajax_add_meta() {
|
|||
$x->send();
|
||||
}
|
||||
|
||||
if ( ! $mid = add_meta( $pid ) ) {
|
||||
$mid = add_meta( $pid );
|
||||
if ( ! $mid ) {
|
||||
wp_die( __( 'Please provide a custom field value.' ) );
|
||||
}
|
||||
} else {
|
||||
wp_die( 0 );
|
||||
}
|
||||
} elseif ( ! $mid = add_meta( $pid ) ) {
|
||||
wp_die( __( 'Please provide a custom field value.' ) );
|
||||
} else {
|
||||
$mid = add_meta( $pid );
|
||||
if ( ! $mid ) {
|
||||
wp_die( __( 'Please provide a custom field value.' ) );
|
||||
}
|
||||
}
|
||||
|
||||
$meta = get_metadata_by_mid( 'post', $mid );
|
||||
|
@ -1519,7 +1530,8 @@ function wp_ajax_add_meta() {
|
|||
if ( '' == trim( $key ) ) {
|
||||
wp_die( __( 'Please provide a custom field name.' ) );
|
||||
}
|
||||
if ( ! $meta = get_metadata_by_mid( 'post', $mid ) ) {
|
||||
$meta = get_metadata_by_mid( 'post', $mid );
|
||||
if ( ! $meta ) {
|
||||
wp_die( 0 ); // if meta doesn't exist
|
||||
}
|
||||
if ( is_protected_meta( $meta->meta_key, 'post' ) || is_protected_meta( $key, 'post' ) ||
|
||||
|
@ -1528,7 +1540,8 @@ function wp_ajax_add_meta() {
|
|||
wp_die( -1 );
|
||||
}
|
||||
if ( $meta->meta_value != $value || $meta->meta_key != $key ) {
|
||||
if ( ! $u = update_metadata_by_mid( 'post', $mid, $value, $key ) ) {
|
||||
$u = update_metadata_by_mid( 'post', $mid, $value, $key );
|
||||
if ( ! $u ) {
|
||||
wp_die( 0 ); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems).
|
||||
}
|
||||
}
|
||||
|
@ -1570,7 +1583,8 @@ function wp_ajax_add_user( $action ) {
|
|||
if ( ! current_user_can( 'create_users' ) ) {
|
||||
wp_die( -1 );
|
||||
}
|
||||
if ( ! $user_id = edit_user() ) {
|
||||
$user_id = edit_user();
|
||||
if ( ! $user_id ) {
|
||||
wp_die( 0 );
|
||||
} elseif ( is_wp_error( $user_id ) ) {
|
||||
$x = new WP_Ajax_Response(
|
||||
|
@ -1624,7 +1638,8 @@ function wp_ajax_closed_postboxes() {
|
|||
wp_die( 0 );
|
||||
}
|
||||
|
||||
if ( ! $user = wp_get_current_user() ) {
|
||||
$user = wp_get_current_user();
|
||||
if ( ! $user ) {
|
||||
wp_die( -1 );
|
||||
}
|
||||
|
||||
|
@ -1653,7 +1668,8 @@ function wp_ajax_hidden_columns() {
|
|||
wp_die( 0 );
|
||||
}
|
||||
|
||||
if ( ! $user = wp_get_current_user() ) {
|
||||
$user = wp_get_current_user();
|
||||
if ( ! $user ) {
|
||||
wp_die( -1 );
|
||||
}
|
||||
|
||||
|
@ -1807,7 +1823,8 @@ function wp_ajax_meta_box_order() {
|
|||
wp_die( 0 );
|
||||
}
|
||||
|
||||
if ( ! $user = wp_get_current_user() ) {
|
||||
$user = wp_get_current_user();
|
||||
if ( ! $user ) {
|
||||
wp_die( -1 );
|
||||
}
|
||||
|
||||
|
@ -1875,10 +1892,12 @@ function wp_ajax_inline_save() {
|
|||
|
||||
check_ajax_referer( 'inlineeditnonce', '_inline_edit' );
|
||||
|
||||
if ( ! isset( $_POST['post_ID'] ) || ! ( $post_ID = (int) $_POST['post_ID'] ) ) {
|
||||
if ( ! isset( $_POST['post_ID'] ) || ! (int) $_POST['post_ID'] ) {
|
||||
wp_die();
|
||||
}
|
||||
|
||||
$post_ID = (int) $_POST['post_ID'];
|
||||
|
||||
if ( 'page' == $_POST['post_type'] ) {
|
||||
if ( ! current_user_can( 'edit_page', $post_ID ) ) {
|
||||
wp_die( __( 'Sorry, you are not allowed to edit this page.' ) );
|
||||
|
@ -1889,7 +1908,8 @@ function wp_ajax_inline_save() {
|
|||
}
|
||||
}
|
||||
|
||||
if ( $last = wp_check_post_lock( $post_ID ) ) {
|
||||
$last = wp_check_post_lock( $post_ID );
|
||||
if ( $last ) {
|
||||
$last_user = get_userdata( $last );
|
||||
$last_user_name = $last_user ? $last_user->display_name : __( 'Someone' );
|
||||
|
||||
|
@ -1991,10 +2011,12 @@ function wp_ajax_inline_save_tax() {
|
|||
wp_die( 0 );
|
||||
}
|
||||
|
||||
if ( ! isset( $_POST['tax_ID'] ) || ! ( $id = (int) $_POST['tax_ID'] ) ) {
|
||||
if ( ! isset( $_POST['tax_ID'] ) || ! (int) $_POST['tax_ID'] ) {
|
||||
wp_die( -1 );
|
||||
}
|
||||
|
||||
$id = (int) $_POST['tax_ID'];
|
||||
|
||||
if ( ! current_user_can( 'edit_term', $id ) ) {
|
||||
wp_die( -1 );
|
||||
}
|
||||
|
@ -2236,7 +2258,8 @@ function wp_ajax_save_widget() {
|
|||
wp_die();
|
||||
}
|
||||
|
||||
if ( $form = $wp_registered_widget_controls[ $widget_id ] ) {
|
||||
$form = $wp_registered_widget_controls[ $widget_id ];
|
||||
if ( $form ) {
|
||||
call_user_func_array( $form['callback'], $form['params'] );
|
||||
}
|
||||
|
||||
|
@ -2388,7 +2411,8 @@ function wp_ajax_upload_attachment() {
|
|||
}
|
||||
}
|
||||
|
||||
if ( ! $attachment = wp_prepare_attachment_for_js( $attachment_id ) ) {
|
||||
$attachment = wp_prepare_attachment_for_js( $attachment_id );
|
||||
if ( ! $attachment ) {
|
||||
wp_die();
|
||||
}
|
||||
|
||||
|
@ -2598,7 +2622,8 @@ function wp_ajax_wp_fullscreen_save_post() {
|
|||
$last_time = date_i18n( __( 'g:i a' ) );
|
||||
}
|
||||
|
||||
if ( $last_id = get_post_meta( $post_id, '_edit_last', true ) ) {
|
||||
$last_id = get_post_meta( $post_id, '_edit_last', true );
|
||||
if ( $last_id ) {
|
||||
$last_user = get_userdata( $last_id );
|
||||
/* translators: 1: display_name of last user, 2: date of last edit, 3: time of last edit. */
|
||||
$last_edited = sprintf( __( 'Last edited by %1$s on %2$s at %3$s' ), esc_html( $last_user->display_name ), $last_date, $last_time );
|
||||
|
@ -2620,7 +2645,8 @@ function wp_ajax_wp_remove_post_lock() {
|
|||
wp_die( 0 );
|
||||
}
|
||||
$post_id = (int) $_POST['post_ID'];
|
||||
if ( ! $post = get_post( $post_id ) ) {
|
||||
$post = get_post( $post_id );
|
||||
if ( ! $post ) {
|
||||
wp_die( 0 );
|
||||
}
|
||||
|
||||
|
@ -2684,11 +2710,13 @@ function wp_ajax_get_attachment() {
|
|||
wp_send_json_error();
|
||||
}
|
||||
|
||||
if ( ! $id = absint( $_REQUEST['id'] ) ) {
|
||||
$id = absint( $_REQUEST['id'] );
|
||||
if ( ! $id ) {
|
||||
wp_send_json_error();
|
||||
}
|
||||
|
||||
if ( ! $post = get_post( $id ) ) {
|
||||
$post = get_post( $id );
|
||||
if ( ! $post ) {
|
||||
wp_send_json_error();
|
||||
}
|
||||
|
||||
|
@ -2700,7 +2728,8 @@ function wp_ajax_get_attachment() {
|
|||
wp_send_json_error();
|
||||
}
|
||||
|
||||
if ( ! $attachment = wp_prepare_attachment_for_js( $id ) ) {
|
||||
$attachment = wp_prepare_attachment_for_js( $id );
|
||||
if ( ! $attachment ) {
|
||||
wp_send_json_error();
|
||||
}
|
||||
|
||||
|
@ -2786,7 +2815,8 @@ function wp_ajax_save_attachment() {
|
|||
wp_send_json_error();
|
||||
}
|
||||
|
||||
if ( ! $id = absint( $_REQUEST['id'] ) ) {
|
||||
$id = absint( $_REQUEST['id'] );
|
||||
if ( ! $id ) {
|
||||
wp_send_json_error();
|
||||
}
|
||||
|
||||
|
@ -2869,7 +2899,8 @@ function wp_ajax_save_attachment_compat() {
|
|||
wp_send_json_error();
|
||||
}
|
||||
|
||||
if ( ! $id = absint( $_REQUEST['id'] ) ) {
|
||||
$id = absint( $_REQUEST['id'] );
|
||||
if ( ! $id ) {
|
||||
wp_send_json_error();
|
||||
}
|
||||
|
||||
|
@ -2906,7 +2937,8 @@ function wp_ajax_save_attachment_compat() {
|
|||
}
|
||||
}
|
||||
|
||||
if ( ! $attachment = wp_prepare_attachment_for_js( $id ) ) {
|
||||
$attachment = wp_prepare_attachment_for_js( $id );
|
||||
if ( ! $attachment ) {
|
||||
wp_send_json_error();
|
||||
}
|
||||
|
||||
|
@ -2923,7 +2955,8 @@ function wp_ajax_save_attachment_order() {
|
|||
wp_send_json_error();
|
||||
}
|
||||
|
||||
if ( ! $post_id = absint( $_REQUEST['post_id'] ) ) {
|
||||
$post_id = absint( $_REQUEST['post_id'] );
|
||||
if ( ! $post_id ) {
|
||||
wp_send_json_error();
|
||||
}
|
||||
|
||||
|
@ -2943,7 +2976,8 @@ function wp_ajax_save_attachment_order() {
|
|||
if ( ! current_user_can( 'edit_post', $attachment_id ) ) {
|
||||
continue;
|
||||
}
|
||||
if ( ! $attachment = get_post( $attachment_id ) ) {
|
||||
$attachment = get_post( $attachment_id );
|
||||
if ( ! $attachment ) {
|
||||
continue;
|
||||
}
|
||||
if ( 'attachment' != $attachment->post_type ) {
|
||||
|
@ -2977,7 +3011,8 @@ function wp_ajax_send_attachment_to_editor() {
|
|||
|
||||
$id = intval( $attachment['id'] );
|
||||
|
||||
if ( ! $post = get_post( $id ) ) {
|
||||
$post = get_post( $id );
|
||||
if ( ! $post ) {
|
||||
wp_send_json_error();
|
||||
}
|
||||
|
||||
|
@ -2987,7 +3022,8 @@ function wp_ajax_send_attachment_to_editor() {
|
|||
|
||||
if ( current_user_can( 'edit_post', $id ) ) {
|
||||
// If this attachment is unattached, attach it. Primarily a back compat thing.
|
||||
if ( 0 == $post->post_parent && $insert_into_post_id = intval( $_POST['post_id'] ) ) {
|
||||
$insert_into_post_id = intval( $_POST['post_id'] );
|
||||
if ( 0 == $post->post_parent && $insert_into_post_id ) {
|
||||
wp_update_post(
|
||||
array(
|
||||
'ID' => $id,
|
||||
|
@ -3052,7 +3088,8 @@ function wp_ajax_send_link_to_editor() {
|
|||
|
||||
check_ajax_referer( 'media-send-to-editor', 'nonce' );
|
||||
|
||||
if ( ! $src = wp_unslash( $_POST['src'] ) ) {
|
||||
$src = wp_unslash( $_POST['src'] );
|
||||
if ( ! $src ) {
|
||||
wp_send_json_error();
|
||||
}
|
||||
|
||||
|
@ -3060,11 +3097,13 @@ function wp_ajax_send_link_to_editor() {
|
|||
$src = 'http://' . $src;
|
||||
}
|
||||
|
||||
if ( ! $src = esc_url_raw( $src ) ) {
|
||||
$src = esc_url_raw( $src );
|
||||
if ( ! $src ) {
|
||||
wp_send_json_error();
|
||||
}
|
||||
|
||||
if ( ! $link_text = trim( wp_unslash( $_POST['link_text'] ) ) ) {
|
||||
$link_text = trim( wp_unslash( $_POST['link_text'] ) );
|
||||
if ( ! $link_text ) {
|
||||
$link_text = wp_basename( $src );
|
||||
}
|
||||
|
||||
|
@ -3087,9 +3126,12 @@ function wp_ajax_send_link_to_editor() {
|
|||
|
||||
// Figure out what filter to run:
|
||||
$type = 'file';
|
||||
if ( ( $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src ) ) && ( $ext_type = wp_ext2type( $ext ) )
|
||||
&& ( 'audio' == $ext_type || 'video' == $ext_type ) ) {
|
||||
$ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src );
|
||||
if ( $ext ) {
|
||||
$ext_type = wp_ext2type( $ext );
|
||||
if ( 'audio' == $ext_type || 'video' == $ext_type ) {
|
||||
$type = $ext_type;
|
||||
}
|
||||
}
|
||||
|
||||
/** This filter is documented in wp-admin/includes/media.php */
|
||||
|
@ -3110,7 +3152,8 @@ function wp_ajax_heartbeat() {
|
|||
wp_send_json_error();
|
||||
}
|
||||
|
||||
$response = $data = array();
|
||||
$response = array();
|
||||
$data = array();
|
||||
$nonce_state = wp_verify_nonce( $_POST['_nonce'], 'heartbeat-nonce' );
|
||||
|
||||
// screen_id is the same as $current_screen->id and the JS global 'pagenow'.
|
||||
|
@ -3192,7 +3235,8 @@ function wp_ajax_heartbeat() {
|
|||
function wp_ajax_get_revision_diffs() {
|
||||
require ABSPATH . 'wp-admin/includes/revision.php';
|
||||
|
||||
if ( ! $post = get_post( (int) $_REQUEST['post_id'] ) ) {
|
||||
$post = get_post( (int) $_REQUEST['post_id'] );
|
||||
if ( ! $post ) {
|
||||
wp_send_json_error();
|
||||
}
|
||||
|
||||
|
@ -3201,7 +3245,8 @@ function wp_ajax_get_revision_diffs() {
|
|||
}
|
||||
|
||||
// Really just pre-loading the cache here.
|
||||
if ( ! $revisions = wp_get_post_revisions( $post->ID, array( 'check_enabled' => false ) ) ) {
|
||||
$revisions = wp_get_post_revisions( $post->ID, array( 'check_enabled' => false ) );
|
||||
if ( ! $revisions ) {
|
||||
wp_send_json_error();
|
||||
}
|
||||
|
||||
|
|
|
@ -284,14 +284,19 @@ class Core_Upgrader extends WP_Upgrader {
|
|||
if ( defined( 'WP_AUTO_UPDATE_CORE' ) ) {
|
||||
if ( false === WP_AUTO_UPDATE_CORE ) {
|
||||
// Defaults to turned off, unless a filter allows it
|
||||
$upgrade_dev = $upgrade_minor = $upgrade_major = false;
|
||||
$upgrade_dev = false;
|
||||
$upgrade_minor = false;
|
||||
$upgrade_major = false;
|
||||
} elseif ( true === WP_AUTO_UPDATE_CORE ) {
|
||||
// ALL updates for core
|
||||
$upgrade_dev = $upgrade_minor = $upgrade_major = true;
|
||||
$upgrade_dev = true;
|
||||
$upgrade_minor = true;
|
||||
$upgrade_major = true;
|
||||
} elseif ( 'minor' === WP_AUTO_UPDATE_CORE ) {
|
||||
// Only minor updates for core
|
||||
$upgrade_dev = $upgrade_major = false;
|
||||
$upgrade_dev = false;
|
||||
$upgrade_minor = true;
|
||||
$upgrade_major = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,8 @@ class File_Upload_Upgrader {
|
|||
$this->package = get_attached_file( $attachment->ID );
|
||||
} else {
|
||||
// Else, It's set to something, Back compat for plugins using the old (pre-3.3) File_Uploader handler.
|
||||
if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) ) {
|
||||
$uploads = wp_upload_dir();
|
||||
if ( ! ( $uploads && false === $uploads['error'] ) ) {
|
||||
wp_die( $uploads['error'] );
|
||||
}
|
||||
|
||||
|
|
|
@ -332,7 +332,8 @@ class Language_Pack_Upgrader extends WP_Upgrader {
|
|||
$files = $wp_filesystem->dirlist( $remote_source );
|
||||
|
||||
// Check to see if a .po and .mo exist in the folder.
|
||||
$po = $mo = false;
|
||||
$po = false;
|
||||
$mo = false;
|
||||
foreach ( (array) $files as $file => $filedata ) {
|
||||
if ( '.po' == substr( $file, -3 ) ) {
|
||||
$po = true;
|
||||
|
|
|
@ -41,7 +41,8 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
|
|||
$this->decrement_update_count( 'theme' );
|
||||
|
||||
$update_actions = array();
|
||||
if ( ! empty( $this->upgrader->result['destination_name'] ) && $theme_info = $this->upgrader->theme_info() ) {
|
||||
$theme_info = $this->upgrader->theme_info();
|
||||
if ( $theme_info ) {
|
||||
$name = $theme_info->display( 'Name' );
|
||||
$stylesheet = $this->upgrader->result['destination_name'];
|
||||
$template = $theme_info->get_template();
|
||||
|
|
|
@ -99,7 +99,8 @@ class WP_Automatic_Updater {
|
|||
// Search all directories we've found for evidence of version control.
|
||||
foreach ( $vcs_dirs as $vcs_dir ) {
|
||||
foreach ( $check_dirs as $check_dir ) {
|
||||
if ( $checkout = @is_dir( rtrim( $check_dir, '\\/' ) . "/$vcs_dir" ) ) {
|
||||
$checkout = @is_dir( rtrim( $check_dir, '\\/' ) . "/$vcs_dir" );
|
||||
if ( $checkout ) {
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -819,8 +819,9 @@ class WP_Comments_List_Table extends WP_List_Table {
|
|||
if ( isset( $this->pending_count[ $post->ID ] ) ) {
|
||||
$pending_comments = $this->pending_count[ $post->ID ];
|
||||
} else {
|
||||
$_pending_count_temp = get_pending_comments_num( array( $post->ID ) );
|
||||
$pending_comments = $this->pending_count[ $post->ID ] = $_pending_count_temp[ $post->ID ];
|
||||
$_pending_count_temp = get_pending_comments_num( array( $post->ID ) );
|
||||
$pending_comments = $_pending_count_temp[ $post->ID ];
|
||||
$this->pending_count[ $post->ID ] = $pending_comments;
|
||||
}
|
||||
|
||||
if ( current_user_can( 'edit_post', $post->ID ) ) {
|
||||
|
@ -831,8 +832,11 @@ class WP_Comments_List_Table extends WP_List_Table {
|
|||
}
|
||||
|
||||
echo '<div class="response-links">';
|
||||
if ( 'attachment' === $post->post_type && ( $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ) ) ) {
|
||||
echo $thumb;
|
||||
if ( 'attachment' === $post->post_type ) {
|
||||
$thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true );
|
||||
if ( $thumb ) {
|
||||
echo $thumb;
|
||||
}
|
||||
}
|
||||
echo $post_link;
|
||||
$post_type_object = get_post_type_object( $post->post_type );
|
||||
|
|
|
@ -224,7 +224,8 @@ class WP_Filesystem_Base {
|
|||
$this->cache[ $folder ] = $folder;
|
||||
return $folder;
|
||||
}
|
||||
if ( $return = $this->search_for_folder( $folder ) ) {
|
||||
$return = $this->search_for_folder( $folder );
|
||||
if ( $return ) {
|
||||
$this->cache[ $folder ] = $return;
|
||||
}
|
||||
return $return;
|
||||
|
@ -284,7 +285,8 @@ class WP_Filesystem_Base {
|
|||
|
||||
// Only search for the remaining path tokens in the directory, not the full path again.
|
||||
$newfolder = implode( '/', array_slice( $folder_parts, $index + 1 ) );
|
||||
if ( $ret = $this->search_for_folder( $newfolder, $newdir, $loop ) ) {
|
||||
$ret = $this->search_for_folder( $newfolder, $newdir, $loop );
|
||||
if ( $ret ) {
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
@ -398,7 +400,8 @@ class WP_Filesystem_Base {
|
|||
$attarray = preg_split( '//', $mode );
|
||||
|
||||
for ( $i = 0, $c = count( $attarray ); $i < $c; $i++ ) {
|
||||
if ( $key = array_search( $attarray[ $i ], $legal ) ) {
|
||||
$key = array_search( $attarray[ $i ], $legal );
|
||||
if ( $key ) {
|
||||
$realmode .= $legal[ $key ];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -590,47 +590,50 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
|||
$b['time'] = @mktime( $lucifer[4] + ( strcasecmp( $lucifer[6], 'PM' ) == 0 ? 12 : 0 ), $lucifer[5], 0, $lucifer[1], $lucifer[2], $lucifer[3] );
|
||||
$b['am/pm'] = $lucifer[6];
|
||||
$b['name'] = $lucifer[8];
|
||||
} elseif ( ! $is_windows && $lucifer = preg_split( '/[ ]/', $line, 9, PREG_SPLIT_NO_EMPTY ) ) {
|
||||
//echo $line."\n";
|
||||
$lcount = count( $lucifer );
|
||||
if ( $lcount < 8 ) {
|
||||
return '';
|
||||
}
|
||||
$b = array();
|
||||
$b['isdir'] = $lucifer[0]{0} === 'd';
|
||||
$b['islink'] = $lucifer[0]{0} === 'l';
|
||||
if ( $b['isdir'] ) {
|
||||
$b['type'] = 'd';
|
||||
} elseif ( $b['islink'] ) {
|
||||
$b['type'] = 'l';
|
||||
} else {
|
||||
$b['type'] = 'f';
|
||||
}
|
||||
$b['perms'] = $lucifer[0];
|
||||
$b['permsn'] = $this->getnumchmodfromh( $b['perms'] );
|
||||
$b['number'] = $lucifer[1];
|
||||
$b['owner'] = $lucifer[2];
|
||||
$b['group'] = $lucifer[3];
|
||||
$b['size'] = $lucifer[4];
|
||||
if ( $lcount == 8 ) {
|
||||
sscanf( $lucifer[5], '%d-%d-%d', $b['year'], $b['month'], $b['day'] );
|
||||
sscanf( $lucifer[6], '%d:%d', $b['hour'], $b['minute'] );
|
||||
$b['time'] = @mktime( $b['hour'], $b['minute'], 0, $b['month'], $b['day'], $b['year'] );
|
||||
$b['name'] = $lucifer[7];
|
||||
} else {
|
||||
$b['month'] = $lucifer[5];
|
||||
$b['day'] = $lucifer[6];
|
||||
if ( preg_match( '/([0-9]{2}):([0-9]{2})/', $lucifer[7], $l2 ) ) {
|
||||
$b['year'] = gmdate( 'Y' );
|
||||
$b['hour'] = $l2[1];
|
||||
$b['minute'] = $l2[2];
|
||||
} else {
|
||||
$b['year'] = $lucifer[7];
|
||||
$b['hour'] = 0;
|
||||
$b['minute'] = 0;
|
||||
} elseif ( ! $is_windows ) {
|
||||
$lucifer = preg_split( '/[ ]/', $line, 9, PREG_SPLIT_NO_EMPTY );
|
||||
if ( $lucifer ) {
|
||||
//echo $line."\n";
|
||||
$lcount = count( $lucifer );
|
||||
if ( $lcount < 8 ) {
|
||||
return '';
|
||||
}
|
||||
$b = array();
|
||||
$b['isdir'] = $lucifer[0]{0} === 'd';
|
||||
$b['islink'] = $lucifer[0]{0} === 'l';
|
||||
if ( $b['isdir'] ) {
|
||||
$b['type'] = 'd';
|
||||
} elseif ( $b['islink'] ) {
|
||||
$b['type'] = 'l';
|
||||
} else {
|
||||
$b['type'] = 'f';
|
||||
}
|
||||
$b['perms'] = $lucifer[0];
|
||||
$b['permsn'] = $this->getnumchmodfromh( $b['perms'] );
|
||||
$b['number'] = $lucifer[1];
|
||||
$b['owner'] = $lucifer[2];
|
||||
$b['group'] = $lucifer[3];
|
||||
$b['size'] = $lucifer[4];
|
||||
if ( $lcount == 8 ) {
|
||||
sscanf( $lucifer[5], '%d-%d-%d', $b['year'], $b['month'], $b['day'] );
|
||||
sscanf( $lucifer[6], '%d:%d', $b['hour'], $b['minute'] );
|
||||
$b['time'] = @mktime( $b['hour'], $b['minute'], 0, $b['month'], $b['day'], $b['year'] );
|
||||
$b['name'] = $lucifer[7];
|
||||
} else {
|
||||
$b['month'] = $lucifer[5];
|
||||
$b['day'] = $lucifer[6];
|
||||
if ( preg_match( '/([0-9]{2}):([0-9]{2})/', $lucifer[7], $l2 ) ) {
|
||||
$b['year'] = gmdate( 'Y' );
|
||||
$b['hour'] = $l2[1];
|
||||
$b['minute'] = $l2[2];
|
||||
} else {
|
||||
$b['year'] = $lucifer[7];
|
||||
$b['hour'] = 0;
|
||||
$b['minute'] = 0;
|
||||
}
|
||||
$b['time'] = strtotime( sprintf( '%d %s %d %02d:%02d', $b['day'], $b['month'], $b['year'], $b['hour'], $b['minute'] ) );
|
||||
$b['name'] = $lucifer[8];
|
||||
}
|
||||
$b['time'] = strtotime( sprintf( '%d %s %d %02d:%02d', $b['day'], $b['month'], $b['year'], $b['hour'], $b['minute'] ) );
|
||||
$b['name'] = $lucifer[8];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -136,7 +136,8 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
|
|||
|
||||
$temp = wp_tempnam( $file );
|
||||
|
||||
if ( ! $temphandle = fopen( $temp, 'w+' ) ) {
|
||||
$temphandle = fopen( $temp, 'w+' );
|
||||
if ( ! $temphandle ) {
|
||||
unlink( $temp );
|
||||
return false;
|
||||
}
|
||||
|
@ -190,8 +191,9 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
|
|||
* @return bool True on success, false on failure.
|
||||
*/
|
||||
public function put_contents( $file, $contents, $mode = false ) {
|
||||
$temp = wp_tempnam( $file );
|
||||
if ( ! $temphandle = @fopen( $temp, 'w+' ) ) {
|
||||
$temp = wp_tempnam( $file );
|
||||
$temphandle = @fopen( $temp, 'w+' );
|
||||
if ( ! $temphandle ) {
|
||||
unlink( $temp );
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -221,7 +221,8 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
|
|||
return false;
|
||||
}
|
||||
|
||||
if ( ! ( $stream = ssh2_exec( $this->link, $command ) ) ) {
|
||||
$stream = ssh2_exec( $this->link, $command );
|
||||
if ( ! $stream ) {
|
||||
$this->errors->add(
|
||||
'command',
|
||||
/* translators: %s: command */
|
||||
|
|
|
@ -130,8 +130,9 @@ class WP_Importer {
|
|||
if ( is_numeric( $blog_id ) ) {
|
||||
$blog_id = (int) $blog_id;
|
||||
} else {
|
||||
$blog = 'http://' . preg_replace( '#^https?://#', '', $blog_id );
|
||||
if ( ( ! $parsed = parse_url( $blog ) ) || empty( $parsed['host'] ) ) {
|
||||
$blog = 'http://' . preg_replace( '#^https?://#', '', $blog_id );
|
||||
$parsed = parse_url( $blog );
|
||||
if ( ! $parsed || empty( $parsed['host'] ) ) {
|
||||
fwrite( STDERR, "Error: can not determine blog_id from $blog_id\n" );
|
||||
exit();
|
||||
}
|
||||
|
|
|
@ -804,7 +804,10 @@ class WP_List_Table {
|
|||
$total_pages_before = '<span class="paging-input">';
|
||||
$total_pages_after = '</span></span>';
|
||||
|
||||
$disable_first = $disable_last = $disable_prev = $disable_next = false;
|
||||
$disable_first = false;
|
||||
$disable_last = false;
|
||||
$disable_prev = false;
|
||||
$disable_next = false;
|
||||
|
||||
if ( $current == 1 ) {
|
||||
$disable_first = true;
|
||||
|
|
|
@ -377,7 +377,8 @@ class WP_Media_List_Table extends WP_List_Table {
|
|||
|
||||
$title = _draft_or_post_title();
|
||||
$thumb = wp_get_attachment_image( $post->ID, array( 60, 60 ), true, array( 'alt' => '' ) );
|
||||
$link_start = $link_end = '';
|
||||
$link_start = '';
|
||||
$link_end = '';
|
||||
|
||||
if ( current_user_can( 'edit_post', $post->ID ) && ! $this->is_trash ) {
|
||||
$link_start = sprintf(
|
||||
|
@ -452,7 +453,8 @@ class WP_Media_List_Table extends WP_List_Table {
|
|||
} else {
|
||||
$m_time = $post->post_date;
|
||||
$time = get_post_time( 'G', true, $post, false );
|
||||
if ( ( abs( $t_diff = time() - $time ) ) < DAY_IN_SECONDS ) {
|
||||
$t_diff = time() - $time;
|
||||
if ( ( abs( $t_diff ) ) < DAY_IN_SECONDS ) {
|
||||
if ( $t_diff < 0 ) {
|
||||
$h_time = sprintf( __( '%s from now' ), human_time_diff( $time ) );
|
||||
} else {
|
||||
|
|
|
@ -93,10 +93,12 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
|||
*/
|
||||
if ( ! $s && wp_is_large_network() ) {
|
||||
if ( ! isset( $_REQUEST['orderby'] ) ) {
|
||||
$_GET['orderby'] = $_REQUEST['orderby'] = '';
|
||||
$_GET['orderby'] = '';
|
||||
$_REQUEST['orderby'] = '';
|
||||
}
|
||||
if ( ! isset( $_REQUEST['order'] ) ) {
|
||||
$_GET['order'] = $_REQUEST['order'] = 'DESC';
|
||||
$_GET['order'] = 'DESC';
|
||||
$_REQUEST['order'] = 'DESC';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,8 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
|
|||
$allowed_where = 'network';
|
||||
}
|
||||
|
||||
$maybe_update = current_user_can( 'update_themes' ) && ! $this->is_site_themes && $current = get_site_transient( 'update_themes' );
|
||||
$current = get_site_transient( 'update_themes' );
|
||||
$maybe_update = current_user_can( 'update_themes' ) && ! $this->is_site_themes && $current;
|
||||
|
||||
foreach ( (array) $themes['all'] as $key => $theme ) {
|
||||
if ( $this->is_site_themes && $theme->is_allowed( 'network' ) ) {
|
||||
|
|
|
@ -65,10 +65,12 @@ class WP_MS_Users_List_Table extends WP_List_Table {
|
|||
*/
|
||||
if ( ! $usersearch && wp_is_large_network( 'users' ) ) {
|
||||
if ( ! isset( $_REQUEST['orderby'] ) ) {
|
||||
$_GET['orderby'] = $_REQUEST['orderby'] = 'id';
|
||||
$_GET['orderby'] = 'id';
|
||||
$_REQUEST['orderby'] = 'id';
|
||||
}
|
||||
if ( ! isset( $_REQUEST['order'] ) ) {
|
||||
$_GET['order'] = $_REQUEST['order'] = 'DESC';
|
||||
$_GET['order'] = 'DESC';
|
||||
$_REQUEST['order'] = 'DESC';
|
||||
}
|
||||
$args['count_total'] = false;
|
||||
}
|
||||
|
@ -471,7 +473,7 @@ class WP_MS_Users_List_Table extends WP_List_Table {
|
|||
}
|
||||
|
||||
if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) {
|
||||
$actions['delete'] = '<a href="' . $delete = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'users.php', 'deleteuser' ) . '&action=deleteuser&id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>';
|
||||
$actions['delete'] = '<a href="' . esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'users.php', 'deleteuser' ) . '&action=deleteuser&id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -109,7 +109,8 @@ class WP_Posts_List_Table extends WP_List_Table {
|
|||
$_GET['author'] = get_current_user_id();
|
||||
}
|
||||
|
||||
if ( 'post' === $post_type && $sticky_posts = get_option( 'sticky_posts' ) ) {
|
||||
$sticky_posts = get_option( 'sticky_posts' );
|
||||
if ( 'post' === $post_type && $sticky_posts ) {
|
||||
$sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) );
|
||||
$this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status NOT IN ('trash', 'auto-draft') AND ID IN ($sticky_posts)", $post_type ) );
|
||||
}
|
||||
|
@ -243,7 +244,8 @@ class WP_Posts_List_Table extends WP_List_Table {
|
|||
protected function get_edit_link( $args, $label, $class = '' ) {
|
||||
$url = add_query_arg( $args, 'edit.php' );
|
||||
|
||||
$class_html = $aria_current = '';
|
||||
$class_html = '';
|
||||
$aria_current = '';
|
||||
if ( ! empty( $class ) ) {
|
||||
$class_html = sprintf(
|
||||
' class="%s"',
|
||||
|
@ -995,7 +997,8 @@ class WP_Posts_List_Table extends WP_List_Table {
|
|||
$locked_avatar = get_avatar( $lock_holder->ID, 18 );
|
||||
$locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) );
|
||||
} else {
|
||||
$locked_avatar = $locked_text = '';
|
||||
$locked_avatar = '';
|
||||
$locked_text = '';
|
||||
}
|
||||
|
||||
echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n";
|
||||
|
@ -1054,7 +1057,8 @@ class WP_Posts_List_Table extends WP_List_Table {
|
|||
global $mode;
|
||||
|
||||
if ( '0000-00-00 00:00:00' === $post->post_date ) {
|
||||
$t_time = $h_time = __( 'Unpublished' );
|
||||
$t_time = __( 'Unpublished' );
|
||||
$h_time = $t_time;
|
||||
$time_diff = 0;
|
||||
} else {
|
||||
$t_time = get_the_time( __( 'Y/m/d g:i:s a' ) );
|
||||
|
@ -1574,7 +1578,8 @@ class WP_Posts_List_Table extends WP_List_Table {
|
|||
$users_opt['show_option_none'] = __( '— No Change —' );
|
||||
}
|
||||
|
||||
if ( $authors = wp_dropdown_users( $users_opt ) ) :
|
||||
$authors = wp_dropdown_users( $users_opt );
|
||||
if ( $authors ) :
|
||||
$authors_dropdown = '<label class="inline-edit-author">';
|
||||
$authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>';
|
||||
$authors_dropdown .= $authors;
|
||||
|
|
|
@ -241,12 +241,13 @@ final class WP_Privacy_Policy_Content {
|
|||
$found = true;
|
||||
} elseif ( $new_data['plugin_name'] === $old_data['plugin_name'] ) {
|
||||
// The info for the policy was updated.
|
||||
$checked[] = array(
|
||||
$checked[] = array(
|
||||
'plugin_name' => $new_data['plugin_name'],
|
||||
'policy_text' => $new_data['policy_text'],
|
||||
'updated' => $time,
|
||||
);
|
||||
$found = $update_cache = true;
|
||||
$found = true;
|
||||
$update_cache = true;
|
||||
}
|
||||
|
||||
if ( $found ) {
|
||||
|
@ -378,7 +379,9 @@ final class WP_Privacy_Policy_Content {
|
|||
$return_to_top = '<a href="#" class="return-to-top">' . __( '↑ Return to Top' ) . '</a>';
|
||||
|
||||
foreach ( $content_array as $section ) {
|
||||
$class = $meta = $removed = '';
|
||||
$class = '';
|
||||
$meta = '';
|
||||
$removed = '';
|
||||
|
||||
if ( ! empty( $section['removed'] ) ) {
|
||||
$class = ' text-removed';
|
||||
|
|
|
@ -202,7 +202,8 @@ final class WP_Screen {
|
|||
return $hook_name;
|
||||
}
|
||||
|
||||
$post_type = $taxonomy = null;
|
||||
$post_type = null;
|
||||
$taxonomy = null;
|
||||
$in_admin = false;
|
||||
$action = '';
|
||||
$is_block_editor = false;
|
||||
|
@ -1015,7 +1016,10 @@ final class WP_Screen {
|
|||
)
|
||||
);
|
||||
|
||||
$wrapper_start = $wrapper_end = $form_start = $form_end = '';
|
||||
$wrapper_start = '';
|
||||
$wrapper_end = '';
|
||||
$form_start = '';
|
||||
$form_end = '';
|
||||
|
||||
// Output optional wrapper.
|
||||
if ( $options['wrap'] ) {
|
||||
|
|
|
@ -226,14 +226,16 @@ class WP_Terms_List_Table extends WP_List_Table {
|
|||
// Set variable because $args['number'] can be subsequently overridden.
|
||||
$number = $args['number'];
|
||||
|
||||
$args['offset'] = $offset = ( $page - 1 ) * $number;
|
||||
$offset = ( $page - 1 ) * $number;
|
||||
$args['offset'] = $offset;
|
||||
|
||||
// Convert it to table rows.
|
||||
$count = 0;
|
||||
|
||||
if ( is_taxonomy_hierarchical( $taxonomy ) && ! isset( $args['orderby'] ) ) {
|
||||
// We'll need the full set of terms then.
|
||||
$args['number'] = $args['offset'] = 0;
|
||||
$args['number'] = 0;
|
||||
$args['offset'] = $args['number'];
|
||||
}
|
||||
$terms = get_terms( $taxonomy, $args );
|
||||
|
||||
|
@ -285,7 +287,8 @@ class WP_Terms_List_Table extends WP_List_Table {
|
|||
|
||||
// If the page starts in a subtree, print the parents.
|
||||
if ( $count == $start && $term->parent > 0 && empty( $_REQUEST['s'] ) ) {
|
||||
$my_parents = $parent_ids = array();
|
||||
$my_parents = array();
|
||||
$parent_ids = array();
|
||||
$p = $term->parent;
|
||||
while ( $p ) {
|
||||
$my_parent = get_term( $p, $taxonomy );
|
||||
|
|
|
@ -208,15 +208,16 @@ class WP_Themes_List_Table extends WP_List_Table {
|
|||
$delete_action = isset( $actions['delete'] ) ? '<div class="delete-theme">' . $actions['delete'] . '</div>' : '';
|
||||
unset( $actions['delete'] );
|
||||
|
||||
$screenshot = $theme->get_screenshot();
|
||||
?>
|
||||
|
||||
<span class="screenshot hide-if-customize">
|
||||
<?php if ( $screenshot = $theme->get_screenshot() ) : ?>
|
||||
<?php if ( $screenshot ) : ?>
|
||||
<img src="<?php echo esc_url( $screenshot ); ?>" alt="" />
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
<a href="<?php echo wp_customize_url( $stylesheet ); ?>" class="screenshot load-customize hide-if-no-customize">
|
||||
<?php if ( $screenshot = $theme->get_screenshot() ) : ?>
|
||||
<?php if ( $screenshot ) : ?>
|
||||
<img src="<?php echo esc_url( $screenshot ); ?>" alt="" />
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
|
|
|
@ -185,7 +185,8 @@ class WP_Upgrader {
|
|||
public function fs_connect( $directories = array(), $allow_relaxed_file_ownership = false ) {
|
||||
global $wp_filesystem;
|
||||
|
||||
if ( false === ( $credentials = $this->skin->request_filesystem_credentials( false, $directories[0], $allow_relaxed_file_ownership ) ) ) {
|
||||
$credentials = $this->skin->request_filesystem_credentials( false, $directories[0], $allow_relaxed_file_ownership );
|
||||
if ( false === $credentials ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,8 @@ function edit_comment() {
|
|||
* @return WP_Comment|false Comment if found. False on failure.
|
||||
*/
|
||||
function get_comment_to_edit( $id ) {
|
||||
if ( ! $comment = get_comment( $id ) ) {
|
||||
$comment = get_comment( $id );
|
||||
if ( ! $comment ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -595,7 +595,8 @@ function wp_dashboard_recent_drafts( $drafts = false ) {
|
|||
/* translators: %s: post title */
|
||||
echo '<div class="draft-title"><a href="' . esc_url( $url ) . '" aria-label="' . esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ) . '">' . esc_html( $title ) . '</a>';
|
||||
echo '<time datetime="' . get_the_time( 'c', $draft ) . '">' . get_the_time( __( 'F j, Y' ), $draft ) . '</time></div>';
|
||||
if ( $the_content = wp_trim_words( $draft->post_content, $draft_length ) ) {
|
||||
$the_content = wp_trim_words( $draft->post_content, $draft_length );
|
||||
if ( $the_content ) {
|
||||
echo '<p>' . $the_content . '</p>';
|
||||
}
|
||||
echo "</li>\n";
|
||||
|
@ -1012,7 +1013,8 @@ function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = ar
|
|||
|
||||
$locale = get_user_locale();
|
||||
$cache_key = 'dash_v2_' . md5( $widget_id . '_' . $locale );
|
||||
if ( false !== ( $output = get_transient( $cache_key ) ) ) {
|
||||
$output = get_transient( $cache_key );
|
||||
if ( false !== $output ) {
|
||||
echo $output;
|
||||
return true;
|
||||
}
|
||||
|
@ -1073,7 +1075,8 @@ function wp_dashboard_trigger_widget_control( $widget_control_id = false ) {
|
|||
* @param array $form_inputs
|
||||
*/
|
||||
function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) {
|
||||
if ( ! $widget_options = get_option( 'dashboard_widget_options' ) ) {
|
||||
$widget_options = get_option( 'dashboard_widget_options' );
|
||||
if ( ! $widget_options ) {
|
||||
$widget_options = array();
|
||||
}
|
||||
|
||||
|
@ -1566,7 +1569,8 @@ function wp_check_browser_version() {
|
|||
|
||||
$key = md5( $_SERVER['HTTP_USER_AGENT'] );
|
||||
|
||||
if ( false === ( $response = get_site_transient( 'browser_' . $key ) ) ) {
|
||||
$response = get_site_transient( 'browser_' . $key );
|
||||
if ( false === $response ) {
|
||||
// include an unmodified $wp_version
|
||||
include( ABSPATH . WPINC . '/version.php' );
|
||||
|
||||
|
|
|
@ -49,7 +49,8 @@ $messages['post_tag'] = array(
|
|||
$messages = apply_filters( 'term_updated_messages', $messages );
|
||||
|
||||
$message = false;
|
||||
if ( isset( $_REQUEST['message'] ) && ( $msg = (int) $_REQUEST['message'] ) ) {
|
||||
if ( isset( $_REQUEST['message'] ) && (int) $_REQUEST['message'] ) {
|
||||
$msg = (int) $_REQUEST['message'];
|
||||
if ( isset( $messages[ $taxonomy ][ $msg ] ) ) {
|
||||
$message = $messages[ $taxonomy ][ $msg ];
|
||||
} elseif ( ! isset( $messages[ $taxonomy ] ) && isset( $messages['_item'][ $msg ] ) ) {
|
||||
|
|
|
@ -117,7 +117,8 @@ function export_wp( $args = array() ) {
|
|||
|
||||
$join = '';
|
||||
if ( $args['category'] && 'post' == $args['content'] ) {
|
||||
if ( $term = term_exists( $args['category'], 'category' ) ) {
|
||||
$term = term_exists( $args['category'], 'category' );
|
||||
if ( $term ) {
|
||||
$join = "INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id)";
|
||||
$where .= $wpdb->prepare( " AND {$wpdb->term_relationships}.term_taxonomy_id = %d", $term['term_taxonomy_id'] );
|
||||
}
|
||||
|
@ -144,7 +145,9 @@ function export_wp( $args = array() ) {
|
|||
* Get the requested terms ready, empty unless posts filtered by category
|
||||
* or all content.
|
||||
*/
|
||||
$cats = $tags = $terms = array();
|
||||
$cats = array();
|
||||
$tags = array();
|
||||
$terms = array();
|
||||
if ( isset( $term ) && $term ) {
|
||||
$cat = get_term( $term['term_id'], 'category' );
|
||||
$cats = array( $cat->term_id => $cat );
|
||||
|
|
|
@ -821,7 +821,8 @@ function _wp_handle_upload( &$file, $overrides, $time, $action ) {
|
|||
* A writable uploads dir will pass this test. Again, there's no point
|
||||
* overriding this one.
|
||||
*/
|
||||
if ( ! ( ( $uploads = wp_upload_dir( $time ) ) && false === $uploads['error'] ) ) {
|
||||
$uploads = wp_upload_dir( $time );
|
||||
if ( ! ( $uploads && false === $uploads['error'] ) ) {
|
||||
return call_user_func_array( $upload_error_handler, array( &$file, $uploads['error'] ) );
|
||||
}
|
||||
|
||||
|
@ -1251,7 +1252,8 @@ function verify_file_signature( $filename, $signatures, $filename_for_errors = f
|
|||
|
||||
mbstring_binary_safe_encoding();
|
||||
|
||||
$skipped_key = $skipped_signature = 0;
|
||||
$skipped_key = 0;
|
||||
$skipped_signature = 0;
|
||||
|
||||
foreach ( (array) $signatures as $signature ) {
|
||||
$signature_raw = base64_decode( $signature );
|
||||
|
@ -1432,7 +1434,8 @@ function _unzip_file_ziparchive( $file, $to, $needed_dirs = array() ) {
|
|||
$uncompressed_size = 0;
|
||||
|
||||
for ( $i = 0; $i < $z->numFiles; $i++ ) {
|
||||
if ( ! $info = $z->statIndex( $i ) ) {
|
||||
$info = $z->statIndex( $i );
|
||||
if ( ! $info ) {
|
||||
return new WP_Error( 'stat_failed_ziparchive', __( 'Could not retrieve file from archive.' ) );
|
||||
}
|
||||
|
||||
|
@ -1447,10 +1450,12 @@ function _unzip_file_ziparchive( $file, $to, $needed_dirs = array() ) {
|
|||
|
||||
$uncompressed_size += $info['size'];
|
||||
|
||||
$dirname = dirname( $info['name'] );
|
||||
|
||||
if ( '/' === substr( $info['name'], -1 ) ) {
|
||||
// Directory.
|
||||
$needed_dirs[] = $to . untrailingslashit( $info['name'] );
|
||||
} elseif ( '.' !== $dirname = dirname( $info['name'] ) ) {
|
||||
} elseif ( '.' !== $dirname ) {
|
||||
// Path to a file.
|
||||
$needed_dirs[] = $to . untrailingslashit( $dirname );
|
||||
}
|
||||
|
@ -1496,7 +1501,8 @@ function _unzip_file_ziparchive( $file, $to, $needed_dirs = array() ) {
|
|||
unset( $needed_dirs );
|
||||
|
||||
for ( $i = 0; $i < $z->numFiles; $i++ ) {
|
||||
if ( ! $info = $z->statIndex( $i ) ) {
|
||||
$info = $z->statIndex( $i );
|
||||
if ( ! $info ) {
|
||||
return new WP_Error( 'stat_failed_ziparchive', __( 'Could not retrieve file from archive.' ) );
|
||||
}
|
||||
|
||||
|
@ -1829,7 +1835,8 @@ function get_filesystem_method( $args = array(), $context = '', $allow_relaxed_f
|
|||
if ( $temp_handle ) {
|
||||
|
||||
// Attempt to determine the file owner of the WordPress files, and that of newly created files
|
||||
$wp_file_owner = $temp_file_owner = false;
|
||||
$wp_file_owner = false;
|
||||
$temp_file_owner = false;
|
||||
if ( function_exists( 'fileowner' ) ) {
|
||||
$wp_file_owner = @fileowner( __FILE__ );
|
||||
$temp_file_owner = @fileowner( $temp_file_name );
|
||||
|
|
|
@ -654,11 +654,12 @@ function stream_preview_image( $post_id ) {
|
|||
* @return stdClass Image restoration message object.
|
||||
*/
|
||||
function wp_restore_image( $post_id ) {
|
||||
$meta = wp_get_attachment_metadata( $post_id );
|
||||
$file = get_attached_file( $post_id );
|
||||
$backup_sizes = $old_backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
|
||||
$restored = false;
|
||||
$msg = new stdClass;
|
||||
$meta = wp_get_attachment_metadata( $post_id );
|
||||
$file = get_attached_file( $post_id );
|
||||
$backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
|
||||
$old_backup_sizes = $backup_sizes;
|
||||
$restored = false;
|
||||
$msg = new stdClass;
|
||||
|
||||
if ( ! is_array( $backup_sizes ) ) {
|
||||
$msg->error = __( 'Cannot load image metadata.' );
|
||||
|
@ -747,7 +748,10 @@ function wp_save_image( $post_id ) {
|
|||
$_wp_additional_image_sizes = wp_get_additional_image_sizes();
|
||||
|
||||
$return = new stdClass;
|
||||
$success = $delete = $scaled = $nocrop = false;
|
||||
$success = false;
|
||||
$delete = false;
|
||||
$scaled = false;
|
||||
$nocrop = false;
|
||||
$post = get_post( $post_id );
|
||||
|
||||
$img = wp_get_image_editor( _load_image_to_edit_path( $post_id, 'full' ) );
|
||||
|
@ -874,7 +878,9 @@ function wp_save_image( $post_id ) {
|
|||
$return->fh = $meta['height'];
|
||||
} elseif ( 'thumbnail' == $target ) {
|
||||
$sizes = array( 'thumbnail' );
|
||||
$success = $delete = $nocrop = true;
|
||||
$success = true;
|
||||
$delete = true;
|
||||
$nocrop = true;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -944,7 +950,8 @@ function wp_save_image( $post_id ) {
|
|||
$return->thumbnail = $thumb_url[0];
|
||||
} else {
|
||||
$file_url = wp_get_attachment_url( $post_id );
|
||||
if ( ! empty( $meta['sizes']['thumbnail'] ) && $thumb = $meta['sizes']['thumbnail'] ) {
|
||||
if ( ! empty( $meta['sizes']['thumbnail'] ) ) {
|
||||
$thumb = $meta['sizes']['thumbnail'];
|
||||
$return->thumbnail = path_join( dirname( $file_url ), $thumb['file'] );
|
||||
} else {
|
||||
$return->thumbnail = "$file_url?w=128&h=128";
|
||||
|
|
|
@ -287,7 +287,8 @@ win.send_to_editor( <?php echo wp_json_encode( $html ); ?> );
|
|||
function media_handle_upload( $file_id, $post_id, $post_data = array(), $overrides = array( 'test_form' => false ) ) {
|
||||
|
||||
$time = current_time( 'mysql' );
|
||||
if ( $post = get_post( $post_id ) ) {
|
||||
$post = get_post( $post_id );
|
||||
if ( $post ) {
|
||||
// The post date doesn't usually matter for pages, so don't backdate this upload.
|
||||
if ( 'page' !== $post->post_type && substr( $post->post_date, 0, 4 ) > 0 ) {
|
||||
$time = $post->post_date;
|
||||
|
@ -369,13 +370,16 @@ function media_handle_upload( $file_id, $post_id, $post_data = array(), $overrid
|
|||
}
|
||||
|
||||
// Use image exif/iptc data for title and caption defaults if possible.
|
||||
} elseif ( 0 === strpos( $type, 'image/' ) && $image_meta = wp_read_image_metadata( $file ) ) {
|
||||
if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) {
|
||||
$title = $image_meta['title'];
|
||||
}
|
||||
} elseif ( 0 === strpos( $type, 'image/' ) ) {
|
||||
$image_meta = wp_read_image_metadata( $file );
|
||||
if ( $image_meta ) {
|
||||
if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) {
|
||||
$title = $image_meta['title'];
|
||||
}
|
||||
|
||||
if ( trim( $image_meta['caption'] ) ) {
|
||||
$excerpt = $image_meta['caption'];
|
||||
if ( trim( $image_meta['caption'] ) ) {
|
||||
$excerpt = $image_meta['caption'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -420,7 +424,8 @@ function media_handle_sideload( $file_array, $post_id, $desc = null, $post_data
|
|||
$overrides = array( 'test_form' => false );
|
||||
|
||||
$time = current_time( 'mysql' );
|
||||
if ( $post = get_post( $post_id ) ) {
|
||||
$post = get_post( $post_id );
|
||||
if ( $post ) {
|
||||
if ( substr( $post->post_date, 0, 4 ) > 0 ) {
|
||||
$time = $post->post_date;
|
||||
}
|
||||
|
@ -438,7 +443,8 @@ function media_handle_sideload( $file_array, $post_id, $desc = null, $post_data
|
|||
$content = '';
|
||||
|
||||
// Use image exif/iptc data for title and caption defaults if possible.
|
||||
if ( $image_meta = wp_read_image_metadata( $file ) ) {
|
||||
$image_meta = wp_read_image_metadata( $file );
|
||||
if ( $image_meta ) {
|
||||
if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) {
|
||||
$title = $image_meta['title'];
|
||||
}
|
||||
|
@ -692,7 +698,8 @@ function media_upload_form_handler() {
|
|||
|
||||
if ( ! empty( $_POST['attachments'] ) ) {
|
||||
foreach ( $_POST['attachments'] as $attachment_id => $attachment ) {
|
||||
$post = $_post = get_post( $attachment_id, ARRAY_A );
|
||||
$post = get_post( $attachment_id, ARRAY_A );
|
||||
$_post = $post;
|
||||
|
||||
if ( ! current_user_can( 'edit_post', $attachment_id ) ) {
|
||||
continue;
|
||||
|
@ -835,9 +842,12 @@ function wp_media_upload_handler() {
|
|||
}
|
||||
|
||||
$type = 'file';
|
||||
if ( ( $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src ) ) && ( $ext_type = wp_ext2type( $ext ) )
|
||||
&& ( 'audio' == $ext_type || 'video' == $ext_type ) ) {
|
||||
$ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src );
|
||||
if ( $ext ) {
|
||||
$ext_type = wp_ext2type( $ext );
|
||||
if ( 'audio' == $ext_type || 'video' == $ext_type ) {
|
||||
$type = $ext_type;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1440,7 +1450,8 @@ function get_media_items( $post_id, $errors ) {
|
|||
if ( $attachment->post_status == 'trash' ) {
|
||||
continue;
|
||||
}
|
||||
if ( $item = get_media_item( $id, array( 'errors' => isset( $errors[ $id ] ) ? $errors[ $id ] : null ) ) ) {
|
||||
$item = get_media_item( $id, array( 'errors' => isset( $errors[ $id ] ) ? $errors[ $id ] : null ) );
|
||||
if ( $item ) {
|
||||
$output .= "\n<div id='media-item-$id' class='media-item child-of-$attachment->post_parent preloaded'><div class='progress hidden'><div class='bar'></div></div><div id='media-upload-error-$id' class='hidden'></div><div class='filename hidden'></div>$item\n</div>";
|
||||
}
|
||||
}
|
||||
|
@ -1462,10 +1473,14 @@ function get_media_items( $post_id, $errors ) {
|
|||
function get_media_item( $attachment_id, $args = null ) {
|
||||
global $redir_tab;
|
||||
|
||||
if ( ( $attachment_id = intval( $attachment_id ) ) && $thumb_url = wp_get_attachment_image_src( $attachment_id, 'thumbnail', true ) ) {
|
||||
$thumb_url = $thumb_url[0];
|
||||
} else {
|
||||
$thumb_url = false;
|
||||
$thumb_url = false;
|
||||
$attachment_id = intval( $attachment_id );
|
||||
|
||||
if ( $attachment_id ) {
|
||||
$thumb_url = wp_get_attachment_image_src( $attachment_id, 'thumbnail', true );
|
||||
if ( $thumb_url ) {
|
||||
$thumb_url = $thumb_url[0];
|
||||
}
|
||||
}
|
||||
|
||||
$post = get_post( $attachment_id );
|
||||
|
@ -2753,7 +2768,8 @@ function wp_media_insert_url_form( $default_view = 'image' ) {
|
|||
$view = 'image-only';
|
||||
$table_class = '';
|
||||
} else {
|
||||
$view = $table_class = 'not-image';
|
||||
$view = 'not-image';
|
||||
$table_class = $view;
|
||||
}
|
||||
|
||||
return '
|
||||
|
@ -2836,7 +2852,8 @@ function wp_media_insert_url_form( $default_view = 'image' ) {
|
|||
function media_upload_flash_bypass() {
|
||||
$browser_uploader = admin_url( 'media-new.php?browser-uploader' );
|
||||
|
||||
if ( $post = get_post() ) {
|
||||
$post = get_post();
|
||||
if ( $post ) {
|
||||
$browser_uploader .= '&post_id=' . intval( $post->ID );
|
||||
} elseif ( ! empty( $GLOBALS['post_ID'] ) ) {
|
||||
$browser_uploader .= '&post_id=' . intval( $GLOBALS['post_ID'] );
|
||||
|
@ -2876,7 +2893,8 @@ function media_upload_text_after() {}
|
|||
*/
|
||||
function media_upload_max_image_resize() {
|
||||
$checked = get_user_setting( 'upload_resize' ) ? ' checked="true"' : '';
|
||||
$a = $end = '';
|
||||
$a = '';
|
||||
$end = '';
|
||||
|
||||
if ( current_user_can( 'manage_options' ) ) {
|
||||
$a = '<a href="' . esc_url( admin_url( 'options-media.php' ) ) . '" target="_blank">';
|
||||
|
@ -2919,8 +2937,9 @@ function edit_form_image_editor( $post ) {
|
|||
require_once ABSPATH . 'wp-admin/includes/image-edit.php';
|
||||
}
|
||||
|
||||
$thumb_url = false;
|
||||
if ( $attachment_id = intval( $post->ID ) ) {
|
||||
$thumb_url = false;
|
||||
$attachment_id = intval( $post->ID );
|
||||
if ( $attachment_id ) {
|
||||
$thumb_url = wp_get_attachment_image_src( $attachment_id, array( 900, 450 ), true );
|
||||
}
|
||||
|
||||
|
@ -2937,7 +2956,8 @@ function edit_form_image_editor( $post ) {
|
|||
$image_edit_button = "<input type='button' id='imgedit-open-btn-$post->ID' onclick='imageEdit.open( $post->ID, \"$nonce\" )' class='button' value='" . esc_attr__( 'Edit Image' ) . "' /> <span class='spinner'></span>";
|
||||
}
|
||||
|
||||
$open_style = $not_open_style = '';
|
||||
$open_style = '';
|
||||
$not_open_style = '';
|
||||
if ( $open ) {
|
||||
$open_style = ' style="display:none"';
|
||||
} else {
|
||||
|
@ -3511,7 +3531,8 @@ function wp_media_attach_action( $parent_id, $action = 'attach' ) {
|
|||
|
||||
if ( isset( $result ) ) {
|
||||
$location = 'upload.php';
|
||||
if ( $referer = wp_get_referer() ) {
|
||||
$referer = wp_get_referer();
|
||||
if ( $referer ) {
|
||||
if ( false !== strpos( $referer, 'upload.php' ) ) {
|
||||
$location = remove_query_arg( array( 'attached', 'detach' ), $referer );
|
||||
}
|
||||
|
|
|
@ -43,7 +43,8 @@ if ( is_network_admin() ) {
|
|||
|
||||
// Create list of page plugin hook names.
|
||||
foreach ( $menu as $menu_page ) {
|
||||
if ( false !== $pos = strpos( $menu_page[2], '?' ) ) {
|
||||
$pos = strpos( $menu_page[2], '?' );
|
||||
if ( false !== $pos ) {
|
||||
// Handle post_type=post|page|foo pages.
|
||||
$hook_name = substr( $menu_page[2], 0, $pos );
|
||||
$hook_args = substr( $menu_page[2], $pos + 1 );
|
||||
|
@ -200,9 +201,10 @@ function add_cssclass( $add, $class ) {
|
|||
* @return array
|
||||
*/
|
||||
function add_menu_classes( $menu ) {
|
||||
$first = $lastorder = false;
|
||||
$i = 0;
|
||||
$mc = count( $menu );
|
||||
$first = false;
|
||||
$lastorder = false;
|
||||
$i = 0;
|
||||
$mc = count( $menu );
|
||||
foreach ( $menu as $order => $top ) {
|
||||
$i++;
|
||||
|
||||
|
|
|
@ -136,8 +136,11 @@ function insert_with_markers( $filename, $marker, $insertion ) {
|
|||
}
|
||||
|
||||
// Split out the existing file into the preceding lines, and those that appear after the marker
|
||||
$pre_lines = $post_lines = $existing_lines = array();
|
||||
$found_marker = $found_end_marker = false;
|
||||
$pre_lines = array();
|
||||
$post_lines = array();
|
||||
$existing_lines = array();
|
||||
$found_marker = false;
|
||||
$found_end_marker = false;
|
||||
foreach ( $lines as $line ) {
|
||||
if ( ! $found_marker && false !== strpos( $line, $start_marker ) ) {
|
||||
$found_marker = true;
|
||||
|
@ -596,7 +599,8 @@ function set_screen_options() {
|
|||
if ( isset( $_POST['wp_screen_options'] ) && is_array( $_POST['wp_screen_options'] ) ) {
|
||||
check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
|
||||
|
||||
if ( ! $user = wp_get_current_user() ) {
|
||||
$user = wp_get_current_user();
|
||||
if ( ! $user ) {
|
||||
return;
|
||||
}
|
||||
$option = $_POST['wp_screen_options']['option'];
|
||||
|
@ -964,18 +968,24 @@ function wp_check_locked_posts( $response, $data, $screen_id ) {
|
|||
|
||||
if ( array_key_exists( 'wp-check-locked-posts', $data ) && is_array( $data['wp-check-locked-posts'] ) ) {
|
||||
foreach ( $data['wp-check-locked-posts'] as $key ) {
|
||||
if ( ! $post_id = absint( substr( $key, 5 ) ) ) {
|
||||
$post_id = absint( substr( $key, 5 ) );
|
||||
if ( ! $post_id ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ( $user_id = wp_check_post_lock( $post_id ) ) && ( $user = get_userdata( $user_id ) ) && current_user_can( 'edit_post', $post_id ) ) {
|
||||
$send = array( 'text' => sprintf( __( '%s is currently editing' ), $user->display_name ) );
|
||||
$user_id = wp_check_post_lock( $post_id );
|
||||
if ( $user_id ) {
|
||||
$user = get_userdata( $user_id );
|
||||
if ( $user && current_user_can( 'edit_post', $post_id ) ) {
|
||||
$send = array( 'text' => sprintf( __( '%s is currently editing' ), $user->display_name ) );
|
||||
|
||||
if ( ( $avatar = get_avatar( $user->ID, 18 ) ) && preg_match( "|src='([^']+)'|", $avatar, $matches ) ) {
|
||||
$send['avatar_src'] = $matches[1];
|
||||
$avatar = get_avatar( $user->ID, 18 );
|
||||
if ( $avatar && preg_match( "|src='([^']+)'|", $avatar, $matches ) ) {
|
||||
$send['avatar_src'] = $matches[1];
|
||||
}
|
||||
|
||||
$checked[ $key ] = $send;
|
||||
}
|
||||
|
||||
$checked[ $key ] = $send;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1002,7 +1012,8 @@ function wp_refresh_post_lock( $response, $data, $screen_id ) {
|
|||
$received = $data['wp-refresh-post-lock'];
|
||||
$send = array();
|
||||
|
||||
if ( ! $post_id = absint( $received['post_id'] ) ) {
|
||||
$post_id = absint( $received['post_id'] );
|
||||
if ( ! $post_id ) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
@ -1010,12 +1021,15 @@ function wp_refresh_post_lock( $response, $data, $screen_id ) {
|
|||
return $response;
|
||||
}
|
||||
|
||||
if ( ( $user_id = wp_check_post_lock( $post_id ) ) && ( $user = get_userdata( $user_id ) ) ) {
|
||||
$user_id = wp_check_post_lock( $post_id );
|
||||
$user = get_userdata( $user_id );
|
||||
if ( $user ) {
|
||||
$error = array(
|
||||
'text' => sprintf( __( '%s has taken over and is currently editing.' ), $user->display_name ),
|
||||
);
|
||||
|
||||
if ( $avatar = get_avatar( $user->ID, 64 ) ) {
|
||||
$avatar = get_avatar( $user->ID, 64 );
|
||||
if ( $avatar ) {
|
||||
if ( preg_match( "|src='([^']+)'|", $avatar, $matches ) ) {
|
||||
$error['avatar_src'] = $matches[1];
|
||||
}
|
||||
|
@ -1023,7 +1037,8 @@ function wp_refresh_post_lock( $response, $data, $screen_id ) {
|
|||
|
||||
$send['lock_error'] = $error;
|
||||
} else {
|
||||
if ( $new_lock = wp_set_post_lock( $post_id ) ) {
|
||||
$new_lock = wp_set_post_lock( $post_id );
|
||||
if ( $new_lock ) {
|
||||
$send['new_lock'] = implode( ':', $new_lock );
|
||||
}
|
||||
}
|
||||
|
@ -1049,7 +1064,8 @@ function wp_refresh_post_nonces( $response, $data, $screen_id ) {
|
|||
$received = $data['wp-refresh-post-nonces'];
|
||||
$response['wp-refresh-post-nonces'] = array( 'check' => 1 );
|
||||
|
||||
if ( ! $post_id = absint( $received['post_id'] ) ) {
|
||||
$post_id = absint( $received['post_id'] );
|
||||
if ( ! $post_id ) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
|
|
@ -367,7 +367,8 @@ function update_user_status( $id, $pref, $value, $deprecated = null ) {
|
|||
function refresh_user_details( $id ) {
|
||||
$id = (int) $id;
|
||||
|
||||
if ( ! $user = get_userdata( $id ) ) {
|
||||
$user = get_userdata( $id );
|
||||
if ( ! $user ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -908,7 +909,8 @@ function confirm_delete_users( $users ) {
|
|||
?>
|
||||
<table class="form-table" role="presentation">
|
||||
<?php
|
||||
foreach ( ( $allusers = (array) $_POST['allusers'] ) as $user_id ) {
|
||||
$allusers = (array) $_POST['allusers'];
|
||||
foreach ( $allusers as $user_id ) {
|
||||
if ( $user_id != '' && $user_id != '0' ) {
|
||||
$delete_user = get_userdata( $user_id );
|
||||
|
||||
|
|
|
@ -411,7 +411,9 @@ function wp_nav_menu_item_post_type_meta_box( $object, $box ) {
|
|||
'_wpnonce',
|
||||
);
|
||||
|
||||
$most_recent_url = $view_all_url = $search_url = '';
|
||||
$most_recent_url = '';
|
||||
$view_all_url = '';
|
||||
$search_url = '';
|
||||
if ( $nav_menu_selected_id ) {
|
||||
$most_recent_url = esc_url( add_query_arg( $post_type_name . '-tab', 'most-recent', remove_query_arg( $removed_args ) ) );
|
||||
$view_all_url = esc_url( add_query_arg( $post_type_name . '-tab', 'all', remove_query_arg( $removed_args ) ) );
|
||||
|
@ -740,7 +742,9 @@ function wp_nav_menu_item_taxonomy_meta_box( $object, $box ) {
|
|||
'_wpnonce',
|
||||
);
|
||||
|
||||
$most_used_url = $view_all_url = $search_url = '';
|
||||
$most_used_url = '';
|
||||
$view_all_url = '';
|
||||
$search_url = '';
|
||||
if ( $nav_menu_selected_id ) {
|
||||
$most_used_url = esc_url( add_query_arg( $taxonomy_name . '-tab', 'most-used', remove_query_arg( $removed_args ) ) );
|
||||
$view_all_url = esc_url( add_query_arg( $taxonomy_name . '-tab', 'all', remove_query_arg( $removed_args ) ) );
|
||||
|
@ -1027,7 +1031,8 @@ function wp_get_nav_menu_to_edit( $menu_id = 0 ) {
|
|||
);
|
||||
}
|
||||
|
||||
$some_pending_menu_items = $some_invalid_menu_items = false;
|
||||
$some_pending_menu_items = false;
|
||||
$some_invalid_menu_items = false;
|
||||
foreach ( (array) $menu_items as $menu_item ) {
|
||||
if ( isset( $menu_item->post_status ) && 'draft' == $menu_item->post_status ) {
|
||||
$some_pending_menu_items = true;
|
||||
|
@ -1181,7 +1186,8 @@ function wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selecte
|
|||
$nav_menu_option['auto_add'][] = $nav_menu_selected_id;
|
||||
}
|
||||
} else {
|
||||
if ( false !== ( $key = array_search( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) ) ) {
|
||||
$key = array_search( $nav_menu_selected_id, $nav_menu_option['auto_add'] );
|
||||
if ( false !== $key ) {
|
||||
unset( $nav_menu_option['auto_add'][ $key ] );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,11 +82,13 @@ function allow_subdirectory_install() {
|
|||
* @return string Base domain.
|
||||
*/
|
||||
function get_clean_basedomain() {
|
||||
if ( $existing_domain = network_domain_check() ) {
|
||||
$existing_domain = network_domain_check();
|
||||
if ( $existing_domain ) {
|
||||
return $existing_domain;
|
||||
}
|
||||
$domain = preg_replace( '|https?://|', '', get_option( 'siteurl' ) );
|
||||
if ( $slash = strpos( $domain, '/' ) ) {
|
||||
$slash = strpos( $domain, '/' );
|
||||
if ( $slash ) {
|
||||
$domain = substr( $domain, 0, $slash );
|
||||
}
|
||||
return $domain;
|
||||
|
@ -185,7 +187,8 @@ function network_step1( $errors = false ) {
|
|||
$subdomain_install = true;
|
||||
} else {
|
||||
$subdomain_install = false;
|
||||
if ( $got_mod_rewrite = got_mod_rewrite() ) { // dangerous assumptions
|
||||
$got_mod_rewrite = got_mod_rewrite();
|
||||
if ( $got_mod_rewrite ) { // dangerous assumptions
|
||||
echo '<div class="updated inline"><p><strong>' . __( 'Note:' ) . '</strong> ';
|
||||
/* translators: %s: mod_rewrite */
|
||||
printf(
|
||||
|
|
|
@ -160,7 +160,8 @@ function plugins_api( $action, $args = array() ) {
|
|||
);
|
||||
|
||||
$http_url = $url;
|
||||
if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) {
|
||||
$ssl = wp_http_supports( array( 'ssl' ) );
|
||||
if ( $ssl ) {
|
||||
$url = set_url_scheme( $url, 'https' );
|
||||
}
|
||||
|
||||
|
@ -238,8 +239,9 @@ function plugins_api( $action, $args = array() ) {
|
|||
* @return array
|
||||
*/
|
||||
function install_popular_tags( $args = array() ) {
|
||||
$key = md5( serialize( $args ) );
|
||||
if ( false !== ( $tags = get_site_transient( 'poptags_' . $key ) ) ) {
|
||||
$key = md5( serialize( $args ) );
|
||||
$tags = get_site_transient( 'poptags_' . $key );
|
||||
if ( false !== $tags ) {
|
||||
return $tags;
|
||||
}
|
||||
|
||||
|
|
|
@ -152,7 +152,8 @@ function _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup
|
|||
|
||||
// Translate fields
|
||||
if ( $translate ) {
|
||||
if ( $textdomain = $plugin_data['TextDomain'] ) {
|
||||
$textdomain = $plugin_data['TextDomain'];
|
||||
if ( $textdomain ) {
|
||||
if ( ! is_textdomain_loaded( $textdomain ) ) {
|
||||
if ( $plugin_data['DomainPath'] ) {
|
||||
load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) . $plugin_data['DomainPath'] );
|
||||
|
@ -364,7 +365,8 @@ function get_mu_plugins() {
|
|||
if ( ! is_dir( WPMU_PLUGIN_DIR ) ) {
|
||||
return $wp_plugins;
|
||||
}
|
||||
if ( $plugins_dir = @ opendir( WPMU_PLUGIN_DIR ) ) {
|
||||
$plugins_dir = @opendir( WPMU_PLUGIN_DIR );
|
||||
if ( $plugins_dir ) {
|
||||
while ( ( $file = readdir( $plugins_dir ) ) !== false ) {
|
||||
if ( substr( $file, -4 ) == '.php' ) {
|
||||
$plugin_files[] = $file;
|
||||
|
@ -431,7 +433,8 @@ function get_dropins() {
|
|||
$_dropins = _get_dropins();
|
||||
|
||||
// These exist in the wp-content directory
|
||||
if ( $plugins_dir = @ opendir( WP_CONTENT_DIR ) ) {
|
||||
$plugins_dir = @opendir( WP_CONTENT_DIR );
|
||||
if ( $plugins_dir ) {
|
||||
while ( ( $file = readdir( $plugins_dir ) ) !== false ) {
|
||||
if ( isset( $_dropins[ $file ] ) ) {
|
||||
$plugin_files[] = $file;
|
||||
|
@ -733,8 +736,9 @@ function deactivate_plugins( $plugins, $silent = false, $network_wide = null ) {
|
|||
if ( is_multisite() ) {
|
||||
$network_current = get_site_option( 'active_sitewide_plugins', array() );
|
||||
}
|
||||
$current = get_option( 'active_plugins', array() );
|
||||
$do_blog = $do_network = false;
|
||||
$current = get_option( 'active_plugins', array() );
|
||||
$do_blog = false;
|
||||
$do_network = false;
|
||||
|
||||
foreach ( (array) $plugins as $plugin ) {
|
||||
$plugin = plugin_basename( trim( $plugin ) );
|
||||
|
@ -992,7 +996,8 @@ function delete_plugins( $plugins, $deprecated = '' ) {
|
|||
}
|
||||
|
||||
// Remove deleted plugins from the plugin updates list.
|
||||
if ( $current = get_site_transient( 'update_plugins' ) ) {
|
||||
$current = get_site_transient( 'update_plugins' );
|
||||
if ( $current ) {
|
||||
// Don't remove the plugins that weren't deleted.
|
||||
$deleted = array_diff( $plugins, $errors );
|
||||
|
||||
|
@ -1819,7 +1824,8 @@ function get_admin_page_title() {
|
|||
|
||||
$hook = get_plugin_page_hook( $plugin_page, $pagenow );
|
||||
|
||||
$parent = $parent1 = get_admin_page_parent();
|
||||
$parent = get_admin_page_parent();
|
||||
$parent1 = $parent;
|
||||
|
||||
if ( empty( $parent ) ) {
|
||||
foreach ( (array) $menu as $menu_array ) {
|
||||
|
|
|
@ -339,7 +339,8 @@ function edit_post( $post_data = null ) {
|
|||
// Meta Stuff
|
||||
if ( isset( $post_data['meta'] ) && $post_data['meta'] ) {
|
||||
foreach ( $post_data['meta'] as $key => $value ) {
|
||||
if ( ! $meta = get_post_meta_by_id( $key ) ) {
|
||||
$meta = get_post_meta_by_id( $key );
|
||||
if ( ! $meta ) {
|
||||
continue;
|
||||
}
|
||||
if ( $meta->post_id != $post_ID ) {
|
||||
|
@ -357,7 +358,8 @@ function edit_post( $post_data = null ) {
|
|||
|
||||
if ( isset( $post_data['deletemeta'] ) && $post_data['deletemeta'] ) {
|
||||
foreach ( $post_data['deletemeta'] as $key => $value ) {
|
||||
if ( ! $meta = get_post_meta_by_id( $key ) ) {
|
||||
$meta = get_post_meta_by_id( $key );
|
||||
if ( ! $meta ) {
|
||||
continue;
|
||||
}
|
||||
if ( $meta->post_id != $post_ID ) {
|
||||
|
@ -531,7 +533,8 @@ function bulk_edit_posts( $post_data = null ) {
|
|||
}
|
||||
}
|
||||
|
||||
if ( isset( $post_data['post_parent'] ) && ( $parent = (int) $post_data['post_parent'] ) ) {
|
||||
if ( isset( $post_data['post_parent'] ) && (int) $post_data['post_parent'] ) {
|
||||
$parent = (int) $post_data['post_parent'];
|
||||
$pages = $wpdb->get_results( "SELECT ID, post_parent FROM $wpdb->posts WHERE post_type = 'page'" );
|
||||
$children = array();
|
||||
|
||||
|
@ -547,7 +550,9 @@ function bulk_edit_posts( $post_data = null ) {
|
|||
}
|
||||
}
|
||||
|
||||
$updated = $skipped = $locked = array();
|
||||
$updated = array();
|
||||
$skipped = array();
|
||||
$locked = array();
|
||||
$shared_post_data = $post_data;
|
||||
|
||||
foreach ( $post_IDs as $post_ID ) {
|
||||
|
@ -1281,7 +1286,8 @@ function wp_edit_attachments_query( $q = false ) {
|
|||
function postbox_classes( $box_id, $screen_id ) {
|
||||
if ( isset( $_GET['edit'] ) && $_GET['edit'] == $box_id ) {
|
||||
$classes = array( '' );
|
||||
} elseif ( $closed = get_user_option( 'closedpostboxes_' . $screen_id ) ) {
|
||||
} elseif ( get_user_option( 'closedpostboxes_' . $screen_id ) ) {
|
||||
$closed = get_user_option( 'closedpostboxes_' . $screen_id );
|
||||
if ( ! is_array( $closed ) ) {
|
||||
$classes = array( '' );
|
||||
} else {
|
||||
|
@ -1556,11 +1562,13 @@ function _wp_post_thumbnail_html( $thumbnail_id = null, $post = null ) {
|
|||
* the user with lock does not exist, or the post is locked by current user.
|
||||
*/
|
||||
function wp_check_post_lock( $post_id ) {
|
||||
if ( ! $post = get_post( $post_id ) ) {
|
||||
$post = get_post( $post_id );
|
||||
if ( ! $post ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ! $lock = get_post_meta( $post->ID, '_edit_lock', true ) ) {
|
||||
$lock = get_post_meta( $post->ID, '_edit_lock', true );
|
||||
if ( ! $lock ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1592,11 +1600,13 @@ function wp_check_post_lock( $post_id ) {
|
|||
* there is no current user.
|
||||
*/
|
||||
function wp_set_post_lock( $post_id ) {
|
||||
if ( ! $post = get_post( $post_id ) ) {
|
||||
$post = get_post( $post_id );
|
||||
if ( ! $post ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( 0 == ( $user_id = get_current_user_id() ) ) {
|
||||
$user_id = get_current_user_id();
|
||||
if ( 0 == $user_id ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1615,12 +1625,14 @@ function wp_set_post_lock( $post_id ) {
|
|||
* @return none
|
||||
*/
|
||||
function _admin_notice_post_locked() {
|
||||
if ( ! $post = get_post() ) {
|
||||
$post = get_post();
|
||||
if ( ! $post ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$user = null;
|
||||
if ( $user_id = wp_check_post_lock( $post->ID ) ) {
|
||||
$user = null;
|
||||
$user_id = wp_check_post_lock( $post->ID );
|
||||
if ( $user_id ) {
|
||||
$user = get_userdata( $user_id );
|
||||
}
|
||||
|
||||
|
@ -1646,8 +1658,8 @@ function _admin_notice_post_locked() {
|
|||
$locked = false;
|
||||
}
|
||||
|
||||
if ( $locked && ( $sendback = wp_get_referer() ) &&
|
||||
false === strpos( $sendback, 'post.php' ) && false === strpos( $sendback, 'post-new.php' ) ) {
|
||||
$sendback = wp_get_referer();
|
||||
if ( $locked && $sendback && false === strpos( $sendback, 'post.php' ) && false === strpos( $sendback, 'post-new.php' ) ) {
|
||||
|
||||
$sendback_text = __( 'Go back' );
|
||||
} else {
|
||||
|
@ -1793,7 +1805,8 @@ function wp_create_post_autosave( $post_data ) {
|
|||
$post_author = get_current_user_id();
|
||||
|
||||
// Store one autosave per author. If there is already an autosave, overwrite it.
|
||||
if ( $old_autosave = wp_get_post_autosave( $post_id, $post_author ) ) {
|
||||
$old_autosave = wp_get_post_autosave( $post_id, $post_author );
|
||||
if ( $old_autosave ) {
|
||||
$new_autosave = _wp_post_revision_data( $post_data, true );
|
||||
$new_autosave['ID'] = $old_autosave->ID;
|
||||
$new_autosave['post_author'] = $post_author;
|
||||
|
@ -1844,7 +1857,8 @@ function post_preview() {
|
|||
$post_ID = (int) $_POST['post_ID'];
|
||||
$_POST['ID'] = $post_ID;
|
||||
|
||||
if ( ! $post = get_post( $post_ID ) ) {
|
||||
$post = get_post( $post_ID );
|
||||
if ( ! $post ) {
|
||||
wp_die( __( 'Sorry, you are not allowed to edit this post.' ) );
|
||||
}
|
||||
|
||||
|
@ -1905,8 +1919,9 @@ function wp_autosave( $post_data ) {
|
|||
define( 'DOING_AUTOSAVE', true );
|
||||
}
|
||||
|
||||
$post_id = (int) $post_data['post_id'];
|
||||
$post_data['ID'] = $post_data['post_ID'] = $post_id;
|
||||
$post_id = (int) $post_data['post_id'];
|
||||
$post_data['ID'] = $post_id;
|
||||
$post_data['post_ID'] = $post_id;
|
||||
|
||||
if ( false === wp_verify_nonce( $post_data['_wpnonce'], 'update-post_' . $post_id ) ) {
|
||||
return new WP_Error( 'invalid_nonce', __( 'Error while saving.' ) );
|
||||
|
|
|
@ -20,12 +20,14 @@
|
|||
* Or, false on failure.
|
||||
*/
|
||||
function wp_get_revision_ui_diff( $post, $compare_from, $compare_to ) {
|
||||
if ( ! $post = get_post( $post ) ) {
|
||||
$post = get_post( $post );
|
||||
if ( ! $post ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( $compare_from ) {
|
||||
if ( ! $compare_from = get_post( $compare_from ) ) {
|
||||
$compare_from = get_post( $compare_from );
|
||||
if ( ! $compare_from ) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
|
@ -33,7 +35,8 @@ function wp_get_revision_ui_diff( $post, $compare_from, $compare_to ) {
|
|||
$compare_from = false;
|
||||
}
|
||||
|
||||
if ( ! $compare_to = get_post( $compare_to ) ) {
|
||||
$compare_to = get_post( $compare_to );
|
||||
if ( ! $compare_to ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,8 @@ function get_category_to_edit( $id ) {
|
|||
* @return int|WP_Error
|
||||
*/
|
||||
function wp_create_category( $cat_name, $parent = 0 ) {
|
||||
if ( $id = category_exists( $cat_name, $parent ) ) {
|
||||
$id = category_exists( $cat_name, $parent );
|
||||
if ( $id ) {
|
||||
return $id;
|
||||
}
|
||||
|
||||
|
@ -77,10 +78,14 @@ function wp_create_category( $cat_name, $parent = 0 ) {
|
|||
function wp_create_categories( $categories, $post_id = '' ) {
|
||||
$cat_ids = array();
|
||||
foreach ( $categories as $category ) {
|
||||
if ( $id = category_exists( $category ) ) {
|
||||
$cat_ids[] = $id;
|
||||
} elseif ( $id = wp_create_category( $category ) ) {
|
||||
$id = category_exists( $category );
|
||||
if ( $id ) {
|
||||
$cat_ids[] = $id;
|
||||
} else {
|
||||
$id = wp_create_category( $category );
|
||||
if ( $id ) {
|
||||
$cat_ids[] = $id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -300,7 +305,8 @@ function get_terms_to_edit( $post_id, $taxonomy = 'post_tag' ) {
|
|||
* @return array|WP_Error
|
||||
*/
|
||||
function wp_create_term( $tag_name, $taxonomy = 'post_tag' ) {
|
||||
if ( $id = term_exists( $tag_name, $taxonomy ) ) {
|
||||
$id = term_exists( $tag_name, $taxonomy );
|
||||
if ( $id ) {
|
||||
return $id;
|
||||
}
|
||||
|
||||
|
|
|
@ -1212,7 +1212,8 @@ function do_meta_boxes( $screen, $context, $object ) {
|
|||
printf( '<div id="%s-sortables" class="meta-box-sortables">', esc_attr( $context ) );
|
||||
|
||||
// Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
|
||||
if ( ! $already_sorted && $sorted = get_user_option( "meta-box-order_$page" ) ) {
|
||||
$sorted = get_user_option( "meta-box-order_$page" );
|
||||
if ( ! $already_sorted && $sorted ) {
|
||||
foreach ( $sorted as $box_context => $ids ) {
|
||||
foreach ( explode( ',', $ids ) as $id ) {
|
||||
if ( $id && 'dashboard_browser_nag' !== $id ) {
|
||||
|
|
|
@ -62,7 +62,8 @@ $theme_field_defaults = array(
|
|||
function install_themes_feature_list() {
|
||||
_deprecated_function( __FUNCTION__, '3.1.0', 'get_theme_feature_list()' );
|
||||
|
||||
if ( ! $cache = get_transient( 'wporg_theme_feature_list' ) ) {
|
||||
$cache = get_transient( 'wporg_theme_feature_list' );
|
||||
if ( ! $cache ) {
|
||||
set_transient( 'wporg_theme_feature_list', array(), 3 * HOUR_IN_SECONDS );
|
||||
}
|
||||
|
||||
|
|
|
@ -303,7 +303,8 @@ function get_theme_feature_list( $api = true ) {
|
|||
return $features;
|
||||
}
|
||||
|
||||
if ( ! $feature_list = get_site_transient( 'wporg_theme_feature_list' ) ) {
|
||||
$feature_list = get_site_transient( 'wporg_theme_feature_list' );
|
||||
if ( ! $feature_list ) {
|
||||
set_site_transient( 'wporg_theme_feature_list', array(), 3 * HOUR_IN_SECONDS );
|
||||
}
|
||||
|
||||
|
@ -490,7 +491,8 @@ function themes_api( $action, $args = array() ) {
|
|||
);
|
||||
|
||||
$http_url = $url;
|
||||
if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) {
|
||||
$ssl = wp_http_supports( array( 'ssl' ) );
|
||||
if ( $ssl ) {
|
||||
$url = set_url_scheme( $url, 'https' );
|
||||
}
|
||||
|
||||
|
|
|
@ -35,8 +35,10 @@ function translations_api( $type, $args = null ) {
|
|||
$res = apply_filters( 'translations_api', false, $type, $args );
|
||||
|
||||
if ( false === $res ) {
|
||||
$url = $http_url = 'http://api.wordpress.org/translations/' . $type . '/1.0/';
|
||||
if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) {
|
||||
$url = 'http://api.wordpress.org/translations/' . $type . '/1.0/';
|
||||
$http_url = $url;
|
||||
$ssl = wp_http_supports( array( 'ssl' ) );
|
||||
if ( $ssl ) {
|
||||
$url = set_url_scheme( $url, 'https' );
|
||||
}
|
||||
|
||||
|
@ -117,8 +119,11 @@ function translations_api( $type, $args = null ) {
|
|||
* in an error, an empty array will be returned.
|
||||
*/
|
||||
function wp_get_available_translations() {
|
||||
if ( ! wp_installing() && false !== ( $translations = get_site_transient( 'available_translations' ) ) ) {
|
||||
return $translations;
|
||||
if ( ! wp_installing() ) {
|
||||
$translations = get_site_transient( 'available_translations' );
|
||||
if ( false !== $translations ) {
|
||||
return $translations;
|
||||
}
|
||||
}
|
||||
|
||||
include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
|
||||
|
|
|
@ -116,9 +116,11 @@ function find_core_auto_update() {
|
|||
* @return bool|array False on failure. An array of checksums on success.
|
||||
*/
|
||||
function get_core_checksums( $version, $locale ) {
|
||||
$url = $http_url = 'http://api.wordpress.org/core/checksums/1.0/?' . http_build_query( compact( 'version', 'locale' ), null, '&' );
|
||||
$http_url = 'http://api.wordpress.org/core/checksums/1.0/?' . http_build_query( compact( 'version', 'locale' ), null, '&' );
|
||||
$url = $http_url;
|
||||
|
||||
if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) {
|
||||
$ssl = wp_http_supports( array( 'ssl' ) );
|
||||
if ( $ssl ) {
|
||||
$url = set_url_scheme( $url, 'https' );
|
||||
}
|
||||
|
||||
|
|
|
@ -1260,7 +1260,8 @@ function upgrade_230() {
|
|||
$term_group = 0;
|
||||
|
||||
// Associate terms with the same slug in a term group and make slugs unique.
|
||||
if ( $exists = $wpdb->get_results( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug ) ) ) {
|
||||
$exists = $wpdb->get_results( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug ) );
|
||||
if ( $exists ) {
|
||||
$term_group = $exists[0]->term_group;
|
||||
$id = $exists[0]->term_id;
|
||||
$num = 2;
|
||||
|
@ -1365,7 +1366,8 @@ function upgrade_230() {
|
|||
$term_group = 0;
|
||||
|
||||
// Associate terms with the same slug in a term group and make slugs unique.
|
||||
if ( $exists = $wpdb->get_results( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug ) ) ) {
|
||||
$exists = $wpdb->get_results( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug ) );
|
||||
if ( $exists ) {
|
||||
$term_group = $exists[0]->term_group;
|
||||
$term_id = $exists[0]->term_id;
|
||||
}
|
||||
|
@ -1823,8 +1825,11 @@ function upgrade_350() {
|
|||
}
|
||||
}
|
||||
|
||||
if ( $wp_current_db_version < 22422 && $term = get_term_by( 'slug', 'post-format-standard', 'post_format' ) ) {
|
||||
wp_delete_term( $term->term_id, 'post_format' );
|
||||
if ( $wp_current_db_version < 22422 ) {
|
||||
$term = get_term_by( 'slug', 'post-format-standard', 'post_format' );
|
||||
if ( $term ) {
|
||||
wp_delete_term( $term->term_id, 'post_format' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2430,7 +2435,8 @@ function maybe_convert_table_to_utf8mb4( $table ) {
|
|||
function get_alloptions_110() {
|
||||
global $wpdb;
|
||||
$all_options = new stdClass;
|
||||
if ( $options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" ) ) {
|
||||
$options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" );
|
||||
if ( $options ) {
|
||||
foreach ( $options as $option ) {
|
||||
if ( 'siteurl' == $option->option_name || 'home' == $option->option_name || 'category_base' == $option->option_name ) {
|
||||
$option->option_value = untrailingslashit( $option->option_value );
|
||||
|
@ -2607,7 +2613,9 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
|
|||
}
|
||||
|
||||
// Clear the field and index arrays.
|
||||
$cfields = $indices = $indices_without_subparts = array();
|
||||
$cfields = array();
|
||||
$indices = array();
|
||||
$indices_without_subparts = array();
|
||||
|
||||
// Get all of the field names in the query from between the parentheses.
|
||||
preg_match( '|\((.*)\)|ms', $qry, $match2 );
|
||||
|
@ -2682,7 +2690,8 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
|
|||
$index_name = ( 'PRIMARY KEY' === $index_type ) ? '' : '`' . strtolower( $index_matches['index_name'] ) . '`';
|
||||
|
||||
// Parse the columns. Multiple columns are separated by a comma.
|
||||
$index_columns = $index_columns_without_subparts = array_map( 'trim', explode( ',', $index_matches['index_columns'] ) );
|
||||
$index_columns = array_map( 'trim', explode( ',', $index_matches['index_columns'] ) );
|
||||
$index_columns_without_subparts = $index_columns;
|
||||
|
||||
// Normalize columns.
|
||||
foreach ( $index_columns as $id => &$index_column ) {
|
||||
|
@ -2852,7 +2861,8 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
|
|||
$index_string .= " ($index_columns)";
|
||||
|
||||
// Check if the index definition exists, ignoring subparts.
|
||||
if ( ! ( ( $aindex = array_search( $index_string, $indices_without_subparts ) ) === false ) ) {
|
||||
$aindex = array_search( $index_string, $indices_without_subparts );
|
||||
if ( false !== $aindex ) {
|
||||
// If the index already exists (even with different subparts), we don't need to create it.
|
||||
unset( $indices_without_subparts[ $aindex ] );
|
||||
unset( $indices[ $aindex ] );
|
||||
|
|
|
@ -44,7 +44,8 @@ function edit_user( $user_id = 0 ) {
|
|||
$user->user_login = sanitize_user( $_POST['user_login'], true );
|
||||
}
|
||||
|
||||
$pass1 = $pass2 = '';
|
||||
$pass1 = '';
|
||||
$pass2 = '';
|
||||
if ( isset( $_POST['pass1'] ) ) {
|
||||
$pass1 = $_POST['pass1'];
|
||||
}
|
||||
|
@ -201,8 +202,11 @@ function edit_user( $user_id = 0 ) {
|
|||
$errors->add( 'empty_email', __( '<strong>ERROR</strong>: Please enter an email address.' ), array( 'form-field' => 'email' ) );
|
||||
} elseif ( ! is_email( $user->user_email ) ) {
|
||||
$errors->add( 'invalid_email', __( '<strong>ERROR</strong>: The email address isn’t correct.' ), array( 'form-field' => 'email' ) );
|
||||
} elseif ( ( $owner_id = email_exists( $user->user_email ) ) && ( ! $update || ( $owner_id != $user->ID ) ) ) {
|
||||
$errors->add( 'email_exists', __( '<strong>ERROR</strong>: This email is already registered, please choose another one.' ), array( 'form-field' => 'email' ) );
|
||||
} else {
|
||||
$owner_id = email_exists( $user->user_email );
|
||||
if ( $owner_id && ( ! $update || ( $owner_id != $user->ID ) ) ) {
|
||||
$errors->add( 'email_exists', __( '<strong>ERROR</strong>: This email is already registered, please choose another one.' ), array( 'form-field' => 'email' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -299,7 +299,10 @@ function wp_widget_control( $sidebar_args ) {
|
|||
</div>
|
||||
|
||||
<div class="widget-description">
|
||||
<?php echo ( $widget_description = wp_widget_description( $widget_id ) ) ? "$widget_description\n" : "$widget_title\n"; ?>
|
||||
<?php
|
||||
$widget_description = wp_widget_description( $widget_id );
|
||||
echo ( $widget_description ) ? "$widget_description\n" : "$widget_title\n";
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
echo $sidebar_args['after_widget'];
|
||||
|
|
|
@ -307,13 +307,16 @@ $scripts_to_print = array( 'jquery' );
|
|||
|
||||
switch ( $step ) {
|
||||
case 0: // Step 0
|
||||
if ( wp_can_install_language_pack() && empty( $language ) && ( $languages = wp_get_available_translations() ) ) {
|
||||
$scripts_to_print[] = 'language-chooser';
|
||||
display_header( 'language-chooser' );
|
||||
echo '<form id="setup" method="post" action="?step=1">';
|
||||
wp_install_language_form( $languages );
|
||||
echo '</form>';
|
||||
break;
|
||||
if ( wp_can_install_language_pack() && empty( $language ) ) {
|
||||
$languages = wp_get_available_translations();
|
||||
if ( $languages ) {
|
||||
$scripts_to_print[] = 'language-chooser';
|
||||
display_header( 'language-chooser' );
|
||||
echo '<form id="setup" method="post" action="?step=1">';
|
||||
wp_install_language_form( $languages );
|
||||
echo '</form>';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Deliberately fall through if we can't reach the translations API.
|
||||
|
|
|
@ -44,8 +44,9 @@ if ( $doaction && isset( $_REQUEST['linkcheck'] ) ) {
|
|||
|
||||
$wp_list_table->prepare_items();
|
||||
|
||||
$title = __( 'Links' );
|
||||
$this_file = $parent_file = 'link-manager.php';
|
||||
$title = __( 'Links' );
|
||||
$this_file = 'link-manager.php';
|
||||
$parent_file = $this_file;
|
||||
|
||||
get_current_screen()->add_help_tab(
|
||||
array(
|
||||
|
|
|
@ -112,7 +112,8 @@ switch ( $action ) {
|
|||
|
||||
$link_id = (int) $_GET['link_id'];
|
||||
|
||||
if ( ! $link = get_link_to_edit( $link_id ) ) {
|
||||
$link = get_link_to_edit( $link_id );
|
||||
if ( ! $link ) {
|
||||
wp_die( __( 'Link not found.' ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,8 @@ switch ( $action ) {
|
|||
|
||||
if ( empty( $errors ) ) {
|
||||
$location = 'media.php';
|
||||
if ( $referer = wp_get_original_referer() ) {
|
||||
$referer = wp_get_original_referer();
|
||||
if ( $referer ) {
|
||||
if ( false !== strpos( $referer, 'upload.php' ) || ( url_to_postid( $referer ) == $attachment_id ) ) {
|
||||
$location = $referer;
|
||||
}
|
||||
|
|
|
@ -108,7 +108,8 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
|
|||
|
||||
$class = $class ? ' class="' . join( ' ', $class ) . '"' : '';
|
||||
$id = ! empty( $item[5] ) ? ' id="' . preg_replace( '|[^a-zA-Z0-9_:.]|', '-', $item[5] ) . '"' : '';
|
||||
$img = $img_style = '';
|
||||
$img = '';
|
||||
$img_style = '';
|
||||
$img_class = ' dashicons-before';
|
||||
|
||||
if ( false !== strpos( $class, 'wp-menu-separator' ) ) {
|
||||
|
@ -152,7 +153,8 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
|
|||
$submenu_items = array_values( $submenu_items ); // Re-index.
|
||||
$menu_hook = get_plugin_page_hook( $submenu_items[0][2], $item[2] );
|
||||
$menu_file = $submenu_items[0][2];
|
||||
if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) {
|
||||
$pos = strpos( $menu_file, '?' );
|
||||
if ( false !== $pos ) {
|
||||
$menu_file = substr( $menu_file, 0, $pos );
|
||||
}
|
||||
if ( ! empty( $menu_hook ) || ( ( 'index.php' != $submenu_items[0][2] ) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) ) ) {
|
||||
|
@ -164,7 +166,8 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
|
|||
} elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) {
|
||||
$menu_hook = get_plugin_page_hook( $item[2], 'admin.php' );
|
||||
$menu_file = $item[2];
|
||||
if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) {
|
||||
$pos = strpos( $menu_file, '?' );
|
||||
if ( false !== $pos ) {
|
||||
$menu_file = substr( $menu_file, 0, $pos );
|
||||
}
|
||||
if ( ! empty( $menu_hook ) || ( ( 'index.php' != $item[2] ) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) ) ) {
|
||||
|
@ -196,7 +199,8 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
|
|||
|
||||
$menu_file = $item[2];
|
||||
|
||||
if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) {
|
||||
$pos = strpos( $menu_file, '?' );
|
||||
if ( false !== $pos ) {
|
||||
$menu_file = substr( $menu_file, 0, $pos );
|
||||
}
|
||||
|
||||
|
@ -226,7 +230,8 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
|
|||
|
||||
$menu_hook = get_plugin_page_hook( $sub_item[2], $item[2] );
|
||||
$sub_file = $sub_item[2];
|
||||
if ( false !== ( $pos = strpos( $sub_file, '?' ) ) ) {
|
||||
$pos = strpos( $sub_file, '?' );
|
||||
if ( false !== $pos ) {
|
||||
$sub_file = substr( $sub_file, 0, $pos );
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,8 @@ include( ABSPATH . 'wp-admin/admin-header.php' );
|
|||
|
||||
<?php
|
||||
if ( ! is_multisite() ) {
|
||||
$wp_site_url_class = $wp_home_class = '';
|
||||
$wp_site_url_class = '';
|
||||
$wp_home_class = '';
|
||||
if ( defined( 'WP_SITEURL' ) ) {
|
||||
$wp_site_url_class = ' disabled';
|
||||
}
|
||||
|
|
|
@ -57,7 +57,8 @@ $home_path = get_home_path();
|
|||
$iis7_permalinks = iis7_supports_permalinks();
|
||||
$permalink_structure = get_option( 'permalink_structure' );
|
||||
|
||||
$prefix = $blog_prefix = '';
|
||||
$prefix = '';
|
||||
$blog_prefix = '';
|
||||
if ( ! got_url_rewrite() ) {
|
||||
$prefix = '/index.php';
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ if ( is_multisite() && ! current_user_can( 'manage_network_options' ) && 'update
|
|||
);
|
||||
}
|
||||
|
||||
$whitelist_options = array(
|
||||
$whitelist_options = array(
|
||||
'general' => array(
|
||||
'blogname',
|
||||
'blogdescription',
|
||||
|
@ -146,7 +146,9 @@ $whitelist_options = array(
|
|||
'default_post_format',
|
||||
),
|
||||
);
|
||||
$whitelist_options['misc'] = $whitelist_options['options'] = $whitelist_options['privacy'] = array();
|
||||
$whitelist_options['misc'] = array();
|
||||
$whitelist_options['options'] = array();
|
||||
$whitelist_options['privacy'] = array();
|
||||
|
||||
$mail_options = array( 'mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass' );
|
||||
|
||||
|
|
|
@ -291,7 +291,8 @@ if ( $action ) {
|
|||
$plugin_slug = dirname( $plugin );
|
||||
|
||||
if ( '.' == $plugin_slug ) {
|
||||
if ( $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ) ) {
|
||||
$data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
|
||||
if ( $data ) {
|
||||
$plugin_info[ $plugin ] = $data;
|
||||
$plugin_info[ $plugin ]['is_uninstallable'] = is_uninstallable_plugin( $plugin );
|
||||
if ( ! $plugin_info[ $plugin ]['Network'] ) {
|
||||
|
@ -300,7 +301,8 @@ if ( $action ) {
|
|||
}
|
||||
} else {
|
||||
// Get plugins list from that folder.
|
||||
if ( $folder_plugins = get_plugins( '/' . $plugin_slug ) ) {
|
||||
$folder_plugins = get_plugins( '/' . $plugin_slug );
|
||||
if ( $folder_plugins ) {
|
||||
foreach ( $folder_plugins as $plugin_file => $data ) {
|
||||
$plugin_info[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $data );
|
||||
$plugin_info[ $plugin_file ]['is_uninstallable'] = is_uninstallable_plugin( $plugin );
|
||||
|
|
|
@ -19,12 +19,13 @@ wp_reset_vars( array( 'action' ) );
|
|||
if ( isset( $_GET['post'] ) && isset( $_POST['post_ID'] ) && (int) $_GET['post'] !== (int) $_POST['post_ID'] ) {
|
||||
wp_die( __( 'A post ID mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 );
|
||||
} elseif ( isset( $_GET['post'] ) ) {
|
||||
$post_id = $post_ID = (int) $_GET['post'];
|
||||
$post_id = (int) $_GET['post'];
|
||||
} elseif ( isset( $_POST['post_ID'] ) ) {
|
||||
$post_id = $post_ID = (int) $_POST['post_ID'];
|
||||
$post_id = (int) $_POST['post_ID'];
|
||||
} else {
|
||||
$post_id = $post_ID = 0;
|
||||
$post_id = 0;
|
||||
}
|
||||
$post_ID = $post_id;
|
||||
|
||||
/**
|
||||
* @global string $post_type
|
||||
|
@ -241,7 +242,8 @@ switch ( $action ) {
|
|||
wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) );
|
||||
}
|
||||
|
||||
if ( $user_id = wp_check_post_lock( $post_id ) ) {
|
||||
$user_id = wp_check_post_lock( $post_id );
|
||||
if ( $user_id ) {
|
||||
$user = get_userdata( $user_id );
|
||||
wp_die( sprintf( __( 'You cannot move this item to the Trash. %s is currently editing.' ), $user->display_name ) );
|
||||
}
|
||||
|
|
|
@ -33,7 +33,8 @@ $redirect = 'edit.php';
|
|||
|
||||
switch ( $action ) {
|
||||
case 'restore':
|
||||
if ( ! $revision = wp_get_post_revision( $revision_id ) ) {
|
||||
$revision = wp_get_post_revision( $revision_id );
|
||||
if ( ! $revision ) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -41,7 +42,8 @@ switch ( $action ) {
|
|||
break;
|
||||
}
|
||||
|
||||
if ( ! $post = get_post( $revision->post_parent ) ) {
|
||||
$post = get_post( $revision->post_parent );
|
||||
if ( ! $post ) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -70,10 +72,13 @@ switch ( $action ) {
|
|||
case 'view':
|
||||
case 'edit':
|
||||
default:
|
||||
if ( ! $revision = wp_get_post_revision( $revision_id ) ) {
|
||||
$revision = wp_get_post_revision( $revision_id );
|
||||
if ( ! $revision ) {
|
||||
break;
|
||||
}
|
||||
if ( ! $post = get_post( $revision->post_parent ) ) {
|
||||
|
||||
$post = get_post( $revision->post_parent );
|
||||
if ( ! $post ) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -110,10 +115,11 @@ if ( ! empty( $redirect ) ) {
|
|||
|
||||
// This is so that the correct "Edit" menu item is selected.
|
||||
if ( ! empty( $post->post_type ) && 'post' != $post->post_type ) {
|
||||
$parent_file = $submenu_file = 'edit.php?post_type=' . $post->post_type;
|
||||
$parent_file = 'edit.php?post_type=' . $post->post_type;
|
||||
} else {
|
||||
$parent_file = $submenu_file = 'edit.php';
|
||||
$parent_file = 'edit.php';
|
||||
}
|
||||
$submenu_file = $parent_file;
|
||||
|
||||
wp_enqueue_script( 'revisions' );
|
||||
wp_localize_script( 'revisions', '_wpRevisionsSettings', wp_prepare_revisions_for_js( $post, $revision_id, $from ) );
|
||||
|
|
|
@ -126,13 +126,16 @@ if ( ! empty( $_REQUEST['language'] ) ) {
|
|||
|
||||
switch ( $step ) {
|
||||
case -1:
|
||||
if ( wp_can_install_language_pack() && empty( $language ) && ( $languages = wp_get_available_translations() ) ) {
|
||||
setup_config_display_header( 'language-chooser' );
|
||||
echo '<h1 class="screen-reader-text">Select a default language</h1>';
|
||||
echo '<form id="setup" method="post" action="?step=0">';
|
||||
wp_install_language_form( $languages );
|
||||
echo '</form>';
|
||||
break;
|
||||
if ( wp_can_install_language_pack() && empty( $language ) ) {
|
||||
$languages = wp_get_available_translations();
|
||||
if ( $languages ) {
|
||||
setup_config_display_header( 'language-chooser' );
|
||||
echo '<h1 class="screen-reader-text">Select a default language</h1>';
|
||||
echo '<form id="setup" method="post" action="?step=0">';
|
||||
wp_install_language_form( $languages );
|
||||
echo '</form>';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Deliberately fall through if we can't reach the translations API.
|
||||
|
|
|
@ -73,7 +73,8 @@ if ( $theme->errors() && 'theme_no_stylesheet' == $theme->errors()->get_error_co
|
|||
wp_die( __( 'The requested theme does not exist.' ) . ' ' . $theme->errors()->get_error_message() );
|
||||
}
|
||||
|
||||
$allowed_files = $style_files = array();
|
||||
$allowed_files = array();
|
||||
$style_files = array();
|
||||
$has_templates = false;
|
||||
|
||||
$file_types = wp_get_theme_file_editable_extensions( $theme );
|
||||
|
|
|
@ -268,7 +268,8 @@ if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) {
|
|||
}
|
||||
}
|
||||
|
||||
if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) {
|
||||
$pos = strpos( $menu_file, '?' );
|
||||
if ( false !== $pos ) {
|
||||
$menu_file = substr( $menu_file, 0, $pos );
|
||||
}
|
||||
|
||||
|
@ -368,7 +369,8 @@ foreach ( $themes as $theme ) :
|
|||
|
||||
<?php
|
||||
// List broken themes, if any.
|
||||
if ( ! is_multisite() && current_user_can( 'edit_themes' ) && $broken_themes = wp_get_themes( array( 'errors' => true ) ) ) {
|
||||
$broken_themes = wp_get_themes( array( 'errors' => true ) );
|
||||
if ( ! is_multisite() && current_user_can( 'edit_themes' ) && $broken_themes ) {
|
||||
?>
|
||||
|
||||
<div class="broken-themes">
|
||||
|
|
|
@ -35,15 +35,17 @@ function list_core_update( $update ) {
|
|||
global $wp_local_package, $wpdb;
|
||||
static $first_pass = true;
|
||||
|
||||
$wp_version = get_bloginfo( 'version' );
|
||||
$wp_version = get_bloginfo( 'version' );
|
||||
$version_string = sprintf( '%s–<strong>%s</strong>', $update->current, $update->locale );
|
||||
|
||||
if ( 'en_US' == $update->locale && 'en_US' == get_locale() ) {
|
||||
$version_string = $update->current;
|
||||
} elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ( $updates = get_core_updates() ) && 1 == count( $updates ) ) {
|
||||
// If the only available update is a partial builds, it doesn't need a language-specific version string.
|
||||
$version_string = $update->current;
|
||||
} else {
|
||||
$version_string = sprintf( '%s–<strong>%s</strong>', $update->current, $update->locale );
|
||||
} elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version ) {
|
||||
$updates = get_core_updates();
|
||||
if ( $updates && 1 == count( $updates ) ) {
|
||||
// If the only available update is a partial builds, it doesn't need a language-specific version string.
|
||||
$version_string = $update->current;
|
||||
}
|
||||
}
|
||||
|
||||
$current = false;
|
||||
|
@ -537,7 +539,8 @@ function do_core_upgrade( $reinstall = false ) {
|
|||
<h1><?php _e( 'Update WordPress' ); ?></h1>
|
||||
<?php
|
||||
|
||||
if ( false === ( $credentials = request_filesystem_credentials( $url, '', false, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership ) ) ) {
|
||||
$credentials = request_filesystem_credentials( $url, '', false, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership );
|
||||
if ( false === $credentials ) {
|
||||
echo '</div>';
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -130,7 +130,8 @@ if ( $doaction ) {
|
|||
}
|
||||
|
||||
$location = 'upload.php';
|
||||
if ( $referer = wp_get_referer() ) {
|
||||
$referer = wp_get_referer();
|
||||
if ( $referer ) {
|
||||
if ( false !== strpos( $referer, 'upload.php' ) ) {
|
||||
$location = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted' ), $referer );
|
||||
}
|
||||
|
@ -286,7 +287,8 @@ if ( ! empty( $_GET['posted'] ) ) {
|
|||
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'posted' ), $_SERVER['REQUEST_URI'] );
|
||||
}
|
||||
|
||||
if ( ! empty( $_GET['attached'] ) && $attached = absint( $_GET['attached'] ) ) {
|
||||
if ( ! empty( $_GET['attached'] ) && absint( $_GET['attached'] ) ) {
|
||||
$attached = absint( $_GET['attached'] );
|
||||
if ( 1 == $attached ) {
|
||||
$message = __( 'Media file attached.' );
|
||||
} else {
|
||||
|
@ -297,7 +299,8 @@ if ( ! empty( $_GET['attached'] ) && $attached = absint( $_GET['attached'] ) ) {
|
|||
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] );
|
||||
}
|
||||
|
||||
if ( ! empty( $_GET['detach'] ) && $detached = absint( $_GET['detach'] ) ) {
|
||||
if ( ! empty( $_GET['detach'] ) && absint( $_GET['detach'] ) ) {
|
||||
$detached = absint( $_GET['detach'] );
|
||||
if ( 1 == $detached ) {
|
||||
$message = __( 'Media file detached.' );
|
||||
} else {
|
||||
|
@ -308,7 +311,8 @@ if ( ! empty( $_GET['detach'] ) && $detached = absint( $_GET['detach'] ) ) {
|
|||
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] );
|
||||
}
|
||||
|
||||
if ( ! empty( $_GET['deleted'] ) && $deleted = absint( $_GET['deleted'] ) ) {
|
||||
if ( ! empty( $_GET['deleted'] ) && absint( $_GET['deleted'] ) ) {
|
||||
$deleted = absint( $_GET['deleted'] );
|
||||
if ( 1 == $deleted ) {
|
||||
$message = __( 'Media file permanently deleted.' );
|
||||
} else {
|
||||
|
@ -319,7 +323,8 @@ if ( ! empty( $_GET['deleted'] ) && $deleted = absint( $_GET['deleted'] ) ) {
|
|||
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'deleted' ), $_SERVER['REQUEST_URI'] );
|
||||
}
|
||||
|
||||
if ( ! empty( $_GET['trashed'] ) && $trashed = absint( $_GET['trashed'] ) ) {
|
||||
if ( ! empty( $_GET['trashed'] ) && absint( $_GET['trashed'] ) ) {
|
||||
$trashed = absint( $_GET['trashed'] );
|
||||
if ( 1 == $trashed ) {
|
||||
$message = __( 'Media file moved to the trash.' );
|
||||
} else {
|
||||
|
@ -331,7 +336,8 @@ if ( ! empty( $_GET['trashed'] ) && $trashed = absint( $_GET['trashed'] ) ) {
|
|||
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'trashed' ), $_SERVER['REQUEST_URI'] );
|
||||
}
|
||||
|
||||
if ( ! empty( $_GET['untrashed'] ) && $untrashed = absint( $_GET['untrashed'] ) ) {
|
||||
if ( ! empty( $_GET['untrashed'] ) && absint( $_GET['untrashed'] ) ) {
|
||||
$untrashed = absint( $_GET['untrashed'] );
|
||||
if ( 1 == $untrashed ) {
|
||||
$message = __( 'Media file restored from the trash.' );
|
||||
} else {
|
||||
|
|
|
@ -602,7 +602,8 @@ endif; //!IS_PROFILE_PAGE
|
|||
* @param bool $show Whether to show the password fields. Default true.
|
||||
* @param WP_User $profileuser User object for the current user to edit.
|
||||
*/
|
||||
if ( $show_password_fields = apply_filters( 'show_password_fields', true, $profileuser ) ) :
|
||||
$show_password_fields = apply_filters( 'show_password_fields', true, $profileuser );
|
||||
if ( $show_password_fields ) :
|
||||
?>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -485,7 +485,8 @@ switch ( $wp_list_table->current_action() ) {
|
|||
case 'add':
|
||||
$message = __( 'New user created.' );
|
||||
|
||||
if ( isset( $_GET['id'] ) && ( $user_id = $_GET['id'] ) && current_user_can( 'edit_user', $user_id ) ) {
|
||||
$user_id = isset( $_GET['id'] ) ? $_GET['id'] : false;
|
||||
if ( $user_id && current_user_can( 'edit_user', $user_id ) ) {
|
||||
$message .= sprintf(
|
||||
' <a href="%s">%s</a>',
|
||||
esc_url(
|
||||
|
|
|
@ -254,7 +254,8 @@ if ( isset( $_GET['editwidget'] ) && $_GET['editwidget'] ) {
|
|||
$control_callback = $control['callback'];
|
||||
$multi_number = (int) $_GET['num'];
|
||||
$control['params'][0]['number'] = -1;
|
||||
$widget_id = $control['id'] = $control['id_base'] . '-' . $multi_number;
|
||||
$control['id'] = $control['id_base'] . '-' . $multi_number;
|
||||
$widget_id = $control['id'];
|
||||
$wp_registered_widget_controls[ $control['id'] ] = $control;
|
||||
break;
|
||||
}
|
||||
|
@ -498,7 +499,8 @@ foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) {
|
|||
</div>
|
||||
<?php
|
||||
|
||||
$i = $split = 0;
|
||||
$i = 0;
|
||||
$split = 0;
|
||||
$single_sidebar_class = '';
|
||||
$sidebars_count = count( $theme_sidebars );
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.3-alpha-45582';
|
||||
$wp_version = '5.3-alpha-45583';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue