From 053a9cd5b8a8db3689381dec3d7980e02a43249c Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 18 Jan 2020 00:54:04 +0000 Subject: [PATCH] Docs: Improve comments in some `wp-admin` files per the documentation standards. Props passoniate. Fixes #49215, #49216. Built from https://develop.svn.wordpress.org/trunk@47084 git-svn-id: http://core.svn.wordpress.org/trunk@46884 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/comment.php | 2 +- wp-admin/includes/dashboard.php | 34 +++++----- wp-admin/includes/deprecated.php | 20 +++--- wp-admin/includes/file.php | 112 +++++++++++++++++-------------- wp-admin/includes/image-edit.php | 8 +-- wp-admin/includes/image.php | 54 ++++++++------- wp-admin/includes/import.php | 8 +-- wp-admin/includes/list-table.php | 6 +- wp-admin/includes/media.php | 43 +++++++----- wp-admin/includes/menu.php | 16 ++--- wp-includes/version.php | 2 +- 11 files changed, 168 insertions(+), 137 deletions(-) diff --git a/wp-admin/includes/comment.php b/wp-admin/includes/comment.php index 7b48f5d3b1..e99f8a6a50 100644 --- a/wp-admin/includes/comment.php +++ b/wp-admin/includes/comment.php @@ -165,7 +165,7 @@ function get_pending_comments_num( $post_id ) { $pending_keyed = array(); - // Default to zero pending for all posts in request + // Default to zero pending for all posts in request. foreach ( $post_id_array as $id ) { $pending_keyed[ $id ] = 0; } diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index 9533c24dec..5aa3fe4dab 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -56,7 +56,7 @@ function wp_dashboard_setup() { wp_add_dashboard_widget( 'dashboard_site_health', __( 'Site Health Status' ), 'wp_dashboard_site_health' ); } - // Right Now + // Right Now. if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) { wp_add_dashboard_widget( 'dashboard_right_now', __( 'At a Glance' ), 'wp_dashboard_right_now' ); } @@ -65,18 +65,18 @@ function wp_dashboard_setup() { wp_add_dashboard_widget( 'network_dashboard_right_now', __( 'Right Now' ), 'wp_network_dashboard_right_now' ); } - // Activity Widget + // Activity Widget. if ( is_blog_admin() ) { wp_add_dashboard_widget( 'dashboard_activity', __( 'Activity' ), 'wp_dashboard_site_activity' ); } - // QuickPress Widget + // QuickPress Widget. if ( is_blog_admin() && current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) { $quick_draft_title = sprintf( '%1$s %2$s', __( 'Quick Draft' ), __( 'Your Recent Drafts' ) ); wp_add_dashboard_widget( 'dashboard_quick_press', $quick_draft_title, 'wp_dashboard_quick_press' ); } - // WordPress Events and News + // WordPress Events and News. wp_add_dashboard_widget( 'dashboard_primary', __( 'WordPress Events and News' ), 'wp_dashboard_events_news' ); if ( is_network_admin() ) { @@ -139,7 +139,7 @@ function wp_dashboard_setup() { if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget_id'] ) ) { check_admin_referer( 'edit-dashboard-widget_' . $_POST['widget_id'], 'dashboard-widget-nonce' ); - ob_start(); // hack - but the same hack wp-admin/widgets.php uses + ob_start(); // Hack - but the same hack wp-admin/widgets.php uses. wp_dashboard_trigger_widget_control( $_POST['widget_id'] ); ob_end_clean(); wp_redirect( remove_query_arg( 'edit' ) ); @@ -278,7 +278,7 @@ function wp_dashboard_right_now() {
' : ''; $gallery = ( ( isset( $_REQUEST['tab'] ) && 'gallery' == $_REQUEST['tab'] ) || ( isset( $redir_tab ) && 'gallery' == $redir_tab ) ); @@ -1710,7 +1714,7 @@ function get_media_item( $attachment_id, $args = null ) { if ( isset( $_GET['post_id'] ) ) { $calling_post_id = absint( $_GET['post_id'] ); - } elseif ( isset( $_POST ) && count( $_POST ) ) {// Like for async-upload where $_GET['post_id'] isn't set + } elseif ( isset( $_POST ) && count( $_POST ) ) {// Like for async-upload where $_GET['post_id'] isn't set. $calling_post_id = $post->post_parent; } @@ -1875,8 +1879,12 @@ function get_compat_media_markup( $attachment_id, $args = null ) { } } - // Merge default fields with their errors, so any key passed with the error (e.g. 'error', 'helps', 'value') will replace the default - // The recursive merge is easily traversed with array casting: foreach ( (array) $things as $thing ) + /* + * Merge default fields with their errors, so any key passed with the error + * (e.g. 'error', 'helps', 'value') will replace the default. + * The recursive merge is easily traversed with array casting: + * foreach ( (array) $things as $thing ) + */ $form_fields = array_merge_recursive( $form_fields, (array) $args['errors'] ); /** This filter is documented in wp-admin/includes/media.php */ @@ -2132,8 +2140,11 @@ function media_upload_form( $errors = null ) { 'multipart_params' => $post_params, ); - // Currently only iOS Safari supports multiple files uploading but iOS 7.x has a bug that prevents uploading of videos - // when enabled. See #29602. + /* + * Currently only iOS Safari supports multiple files uploading, + * but iOS 7.x has a bug that prevents uploading of videos when enabled. + * See #29602. + */ if ( wp_is_mobile() && strpos( $_SERVER['HTTP_USER_AGENT'], 'OS 7_' ) !== false && @@ -2700,7 +2711,7 @@ function media_upload_library_form( $errors ) { } } } - // If available type specified by media button clicked, filter by that type + // If available type specified by media button clicked, filter by that type. if ( empty( $_GET['post_mime_type'] ) && ! empty( $num_posts[ $type ] ) ) { $_GET['post_mime_type'] = $type; list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query(); diff --git a/wp-admin/includes/menu.php b/wp-admin/includes/menu.php index e76bf3d080..4fe351b11e 100644 --- a/wp-admin/includes/menu.php +++ b/wp-admin/includes/menu.php @@ -208,13 +208,13 @@ function add_menu_classes( $menu ) { foreach ( $menu as $order => $top ) { $i++; - if ( 0 == $order ) { // dashboard is always shown/single + if ( 0 == $order ) { // Dashboard is always shown/single. $menu[0][4] = add_cssclass( 'menu-top-first', $top[4] ); $lastorder = 0; continue; } - if ( 0 === strpos( $top[2], 'separator' ) && false !== $lastorder ) { // if separator + if ( 0 === strpos( $top[2], 'separator' ) && false !== $lastorder ) { // If separator. $first = true; $c = $menu[ $lastorder ][4]; $menu[ $lastorder ][4] = add_cssclass( 'menu-top-last', $c ); @@ -227,7 +227,7 @@ function add_menu_classes( $menu ) { $first = false; } - if ( $mc == $i ) { // last item + if ( $mc == $i ) { // Last item. $c = $menu[ $order ][4]; $menu[ $order ][4] = add_cssclass( 'menu-top-last', $c ); } @@ -245,7 +245,7 @@ function add_menu_classes( $menu ) { return apply_filters( 'add_menu_classes', $menu ); } -uksort( $menu, 'strnatcasecmp' ); // make it all pretty +uksort( $menu, 'strnatcasecmp' ); // Make it all pretty. /** * Filters whether to enable custom ordering of the administration menu. @@ -310,21 +310,21 @@ if ( apply_filters( 'custom_menu_order', false ) ) { unset( $menu_order, $default_menu_order ); } -// Prevent adjacent separators +// Prevent adjacent separators. $prev_menu_was_separator = false; foreach ( $menu as $id => $data ) { if ( false === stristr( $data[4], 'wp-menu-separator' ) ) { - // This item is not a separator, so falsey the toggler and do nothing + // This item is not a separator, so falsey the toggler and do nothing. $prev_menu_was_separator = false; } else { - // The previous item was a separator, so unset this one + // The previous item was a separator, so unset this one. if ( true === $prev_menu_was_separator ) { unset( $menu[ $id ] ); } - // This item is a separator, so truthy the toggler and move on + // This item is a separator, so truthy the toggler and move on. $prev_menu_was_separator = true; } } diff --git a/wp-includes/version.php b/wp-includes/version.php index 91e039b665..e8b39518a7 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.4-alpha-47083'; +$wp_version = '5.4-alpha-47084'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.