From aadd546d482fc8a72c1f1c9eb612d07eaddcafee Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 15 Aug 2013 16:25:12 +0000 Subject: [PATCH] Avoid PHP notices in get_sample_permalink() and get_sample_permalink_html(). Remove unused global reference. props ocean90. fixes #25005. Built from https://develop.svn.wordpress.org/trunk@25028 git-svn-id: http://core.svn.wordpress.org/trunk@25015 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/ajax-actions.php | 9 ++++---- .../includes/class-wp-filesystem-base.php | 23 +++++++++++++------ wp-admin/includes/media.php | 5 ++-- wp-admin/includes/post.php | 11 +++++---- wp-admin/js/customize-controls.js | 2 +- wp-admin/js/customize-controls.min.js | 2 +- wp-includes/post-template.php | 2 +- wp-includes/theme.php | 5 +++- 8 files changed, 37 insertions(+), 22 deletions(-) diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index 734409fe1f..82d8abc27f 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -241,10 +241,11 @@ function wp_ajax_logged_in() { * @return die */ function _wp_ajax_delete_comment_response( $comment_id, $delta = -1 ) { - $total = (int) @$_POST['_total']; - $per_page = (int) @$_POST['_per_page']; - $page = (int) @$_POST['_page']; - $url = esc_url_raw( @$_POST['_url'] ); + $total = isset( $_POST['_total'] ) ? (int) $_POST['_total'] : 0; + $per_page = isset( $_POST['_per_page'] ) ? (int) $_POST['_per_page'] : 0; + $page = isset( $_POST['_page'] ) ? (int) $_POST['_page'] : 0; + $url = isset( $_POST['_url'] ) ? esc_url_raw( $_POST['_url'] ) : ''; + // JS didn't send us everything we need to know. Just die with success message if ( !$total || !$per_page || !$page || !$url ) wp_die( time() ); diff --git a/wp-admin/includes/class-wp-filesystem-base.php b/wp-admin/includes/class-wp-filesystem-base.php index d64fe4bba4..9d7d6e8c19 100644 --- a/wp-admin/includes/class-wp-filesystem-base.php +++ b/wp-admin/includes/class-wp-filesystem-base.php @@ -192,8 +192,12 @@ class WP_Filesystem_Base { $folder = untrailingslashit($folder); + if ( $this->verbose ) + printf( "\n" . __('Looking for %1$s in %2$s') . "
\n", $folder, $base ); + $folder_parts = explode('/', $folder); - $last_index = array_pop( array_keys( $folder_parts ) ); + $folder_part_keys = array_keys( $folder_parts ); + $last_index = array_pop( $folder_part_keys ); $last_path = $folder_parts[ $last_index ]; $files = $this->dirlist( $base ); @@ -210,7 +214,7 @@ class WP_Filesystem_Base { //Lets try that folder: $newdir = trailingslashit(path_join($base, $key)); if ( $this->verbose ) - printf( __('Changing to %s') . '
', $newdir ); + printf( "\n" . __('Changing to %s') . "
\n", $newdir ); // 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) ) @@ -221,13 +225,18 @@ class WP_Filesystem_Base { //Only check this as a last resort, to prevent locating the incorrect install. All above procedures will fail quickly if this is the right branch to take. if (isset( $files[ $last_path ] ) ) { if ( $this->verbose ) - printf( __('Found %s') . '
', $base . $last_path ); + printf( "\n" . __('Found %s') . "
\n", $base . $last_path ); return trailingslashit($base . $last_path); } - if ( $loop ) - return false; //Prevent this function from looping again. - //As an extra last resort, Change back to / if the folder wasn't found. This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... mainly dedicated setups. - return $this->search_for_folder($folder, '/', true); + + // Prevent this function from looping again. + // No need to proceed if we've just searched in / + if ( $loop || '/' == $base ) + return false; + + // As an extra last resort, Change back to / if the folder wasn't found. + // This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... + return $this->search_for_folder( $folder, '/', true ); } diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index 4b6417f861..c37dc0b1c4 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -2077,17 +2077,18 @@ $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmon $arc_result = $wpdb->get_results( $arc_query ); $month_count = count($arc_result); +$selected_month = isset( $_GET['m'] ) ? $_GET['m'] : 0; if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?>