WordPress.org

Make WordPress Core

Ticket #28931: wp-admin-28931.diff

File wp-admin-28931.diff, 114.6 KB (added by DrewAPicture, 7 years ago)
  • src/wp-admin/admin.php

     
    151151                $the_parent = $pagenow;
    152152        if ( ! $page_hook = get_plugin_page_hook($plugin_page, $the_parent) ) {
    153153                $page_hook = get_plugin_page_hook($plugin_page, $plugin_page);
    154                 // backwards compatibility for plugins using add_management_page
     154
     155                // Backwards compatibility for plugins using add_management_page().
    155156                if ( empty( $page_hook ) && 'edit.php' == $pagenow && '' != get_plugin_page_hook($plugin_page, 'tools.php') ) {
    156157                        // There could be plugin specific params on the URL, so we need the whole query string
    157158                        if ( !empty($_SERVER[ 'QUERY_STRING' ]) )
  • src/wp-admin/async-upload.php

     
    9494}
    9595
    9696if ( $_REQUEST['short'] ) {
    97         // short form response - attachment ID only
     97        // Short form response - attachment ID only.
    9898        echo $id;
    9999} else {
    100         // long form response - big chunk o html
     100        // Long form response - big chunk o html.
    101101        $type = $_REQUEST['type'];
    102102
    103103        /**
  • src/wp-admin/custom-background.php

     
    256256
    257257                if ( get_background_image() ) {
    258258                        $background_image_thumb = esc_url( set_url_scheme( get_theme_mod( 'background_image_thumb', str_replace( '%', '%%', get_background_image() ) ) ) );
    259                         // background-image URL must be single quote, see below
     259
     260                        // Background-image URL must be single quote, see below.
    260261                        $background_styles .= ' background-image: url(\'' . $background_image_thumb . '\');'
    261262                                . ' background-repeat: ' . get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) . ';'
    262263                                . ' background-position: top ' . get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );
  • src/wp-admin/custom-header.php

     
    934934                $url = $object['guid'];
    935935                $this->set_header_image( compact( 'url', 'attachment_id', 'width', 'height' ) );
    936936
    937                 // cleanup
     937                // Cleanup.
    938938                $medium = str_replace( basename( $original ), 'midsize-' . basename( $original ), $original );
    939939                if ( file_exists( $medium ) ) {
    940940                        /**
  • src/wp-admin/customize.php

     
    189189         */
    190190        do_action( 'customize_controls_print_footer_scripts' );
    191191
    192         // If the frontend and the admin are served from the same domain, load the
    193         // preview over ssl if the customizer is being loaded over ssl. This avoids
    194         // insecure content warnings. This is not attempted if the admin and frontend
    195         // are on different domains to avoid the case where the frontend doesn't have
    196         // ssl certs. Domain mapping plugins can allow other urls in these conditions
    197         // using the customize_allowed_urls filter.
     192        /*
     193         * If the frontend and the admin are served from the same domain, load the
     194         * preview over ssl if the customizer is being loaded over ssl. This avoids
     195         * insecure content warnings. This is not attempted if the admin and frontend
     196         * are on different domains to avoid the case where the frontend doesn't have
     197         * ssl certs. Domain mapping plugins can allow other urls in these conditions
     198         * using the customize_allowed_urls filter.
     199         */
    198200
    199201        $allowed_urls = array( home_url('/') );
    200202        $admin_origin = parse_url( admin_url() );
  • src/wp-admin/includes/admin.php

     
    77 */
    88
    99if ( ! defined('WP_ADMIN') ) {
    10         // This file is being included from a file other than wp-admin/admin.php, so
    11         // some setup was skipped. Make sure the admin message catalog is loaded since
    12         // load_default_textdomain() will not have done so in this context.
     10        /*
     11         * This file is being included from a file other than wp-admin/admin.php, so
     12         * some setup was skipped. Make sure the admin message catalog is loaded since
     13         * load_default_textdomain() will not have done so in this context.
     14         */
    1315        load_textdomain( 'default', WP_LANG_DIR . '/admin-' . get_locale() . '.mo' );
    1416}
    1517
  • src/wp-admin/includes/ajax-actions.php

     
    2121function wp_ajax_nopriv_heartbeat() {
    2222        $response = array();
    2323
    24         // screen_id is the same as $current_screen->id and the JS global 'pagenow'
     24        // screen_id is the same as $current_screen->id and the JS global 'pagenow'.
    2525        if ( ! empty($_POST['screen_id']) )
    2626                $screen_id = sanitize_key($_POST['screen_id']);
    2727        else
     
    6464         */
    6565        do_action( 'heartbeat_nopriv_tick', $response, $screen_id );
    6666
    67         // send the current time according to the server
     67        // Send the current time according to the server.
    6868        $response['server_time'] = time();
    6969
    7070        wp_send_json($response);
     
    362362
    363363                $comment_count = wp_count_comments($post_id);
    364364
    365                 if ( isset( $comment_count->$status ) ) // We're looking for a known type of comment count
     365                // We're looking for a known type of comment count.
     366                if ( isset( $comment_count->$status ) )
    366367                        $total = $comment_count->$status;
    367                         // else use the decremented value from above
     368                        // Else use the decremented value from above.
    368369        }
    369370
    370         $time = time(); // The time since the last comment count
     371        // The time since the last comment count.
     372        $time = time();
    371373
    372374        $x = new WP_Ajax_Response( array(
    373375                'what' => 'comment',
    374                 'id' => $comment_id, // here for completeness - not used
     376                // Here for completeness - not used.
     377                'id' => $comment_id,
    375378                'supplemental' => array(
    376379                        'total_items_i18n' => sprintf( _n( '1 item', '%s items', $total ), number_format_i18n( $total ) ),
    377380                        'total_pages' => ceil( $total / $per_page ),
     
    955958        $comment_auto_approved = false;
    956959        $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID');
    957960
    958         // automatically approve parent comment
     961        // Automatically approve parent comment.
    959962        if ( !empty($_POST['approve_parent']) ) {
    960963                $parent = get_comment( $comment_parent );
    961964
     
    15121515        $data = &$_POST;
    15131516
    15141517        $post = get_post( $post_ID, ARRAY_A );
    1515         $post = wp_slash($post); //since it is from db
    15161518
     1519        // Since it's coming from the database.
     1520        $post = wp_slash($post);
     1521
    15171522        $data['content'] = $post['post_content'];
    15181523        $data['excerpt'] = $post['post_excerpt'];
    15191524
    1520         // rename
     1525        // Rename.
    15211526        $data['user_ID'] = get_current_user_id();
    15221527
    15231528        if ( isset($data['post_parent']) )
    15241529                $data['parent_id'] = $data['post_parent'];
    15251530
    1526         // status
     1531        // Status.
    15271532        if ( isset($data['keep_private']) && 'private' == $data['keep_private'] )
    15281533                $data['post_status'] = 'private';
    15291534        else
     
    15401545                $data['post_name'] = wp_unique_post_slug( $data['post_name'], $post['ID'], $post['post_status'], $post['post_type'], $post['post_parent'] );
    15411546        }
    15421547
    1543         // update the post
     1548        // Update the post.
    15441549        edit_post();
    15451550
    15461551        $wp_list_table = _get_list_table( 'WP_Posts_List_Table', array( 'screen' => $_POST['screen'] ) );
     
    16861691
    16871692        unset( $_POST['savewidgets'], $_POST['action'] );
    16881693
    1689         // save widgets order for all sidebars
     1694        // Save widgets order for all sidebars.
    16901695        if ( is_array($_POST['sidebars']) ) {
    16911696                $sidebars = array();
    16921697                foreach ( $_POST['sidebars'] as $key => $val ) {
     
    17511756        $sidebars = wp_get_sidebars_widgets();
    17521757        $sidebar = isset($sidebars[$sidebar_id]) ? $sidebars[$sidebar_id] : array();
    17531758
    1754         // delete
     1759        // Delete.
    17551760        if ( isset($_POST['delete_widget']) && $_POST['delete_widget'] ) {
    17561761
    17571762                if ( !isset($wp_registered_widgets[$widget_id]) )
     
    24112416                $title = wp_basename( $src );
    24122417
    24132418        $post = get_post( isset( $_POST['post_id'] ) ? $_POST['post_id'] : 0 );
    2414         // ping WordPress for an embed
     2419
     2420        // Ping WordPress for an embed.
    24152421        $check_embed = $wp_embed->run_shortcode( '[embed]'. $src .'[/embed]' );
    2416         // fallback that WordPress creates when no oEmbed was found
     2422
     2423        // Fallback that WordPress creates when no oEmbed was found.
    24172424        $fallback = $wp_embed->maybe_make_link( $src );
    24182425
    24192426        if ( $check_embed !== $fallback ) {
     
    24562463                wp_send_json($response);
    24572464        }
    24582465
    2459         // screen_id is the same as $current_screen->id and the JS global 'pagenow'
     2466        // screen_id is the same as $current_screen->id and the JS global 'pagenow'.
    24602467        if ( ! empty($_POST['screen_id']) )
    24612468                $screen_id = sanitize_key($_POST['screen_id']);
    24622469        else
  • src/wp-admin/includes/class-wp-comments-list-table.php

     
    424424                }
    425425
    426426                if ( $user_can ) {
    427                         // preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash
     427                        // Preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash.
    428428                        $actions = array(
    429429                                'approve' => '', 'unapprove' => '',
    430430                                'reply' => '',
     
    434434                                'trash' => '', 'untrash' => '', 'delete' => ''
    435435                        );
    436436
    437                         if ( $comment_status && 'all' != $comment_status ) { // not looking at all comments
     437                        // Not looking at all comments.
     438                        if ( $comment_status && 'all' != $comment_status ) {
    438439                                if ( 'approved' == $the_comment_status )
    439440                                        $actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=unapproved' class='vim-u vim-destructive' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
    440441                                else if ( 'unapproved' == $the_comment_status )
  • src/wp-admin/includes/class-wp-filesystem-base.php

     
    308308                        if ( $index == $last_index )
    309309                                continue; // We want this to be caught by the next code block.
    310310
    311                         // Working from /home/ to /user/ to /wordpress/ see if that file exists within the current folder,
    312                         // If it's found, change into it and follow through looking for it.
    313                         // If it cant find WordPress down that route, it'll continue onto the next folder level, and see if that matches, and so on.
    314                         // If it reaches the end, and still cant find it, it'll return false for the entire function.
     311                        /*
     312                         * Working from /home/ to /user/ to /wordpress/ see if that file exists within
     313                         * the current folder, If it's found, change into it and follow through looking
     314                         * for it. If it cant find WordPress down that route, it'll continue onto the next
     315                         * folder level, and see if that matches, and so on. If it reaches the end, and still
     316                         * cant find it, it'll return false for the entire function.
     317                         */
    315318                        if ( isset($files[ $key ]) ){
     319
    316320                                // Lets try that folder:
    317321                                $newdir = trailingslashit(path_join($base, $key));
    318322                                if ( $this->verbose )
    319323                                        printf( "\n" . __('Changing to %s') . "<br/>\n", $newdir );
    320                                 // only search for the remaining path tokens in the directory, not the full path again
     324
     325                                // Only search for the remaining path tokens in the directory, not the full path again.
    321326                                $newfolder = implode( '/', array_slice( $folder_parts, $index + 1 ) );
    322327                                if ( $ret = $this->search_for_folder( $newfolder, $newdir, $loop) )
    323328                                        return $ret;
  • src/wp-admin/includes/class-wp-filesystem-direct.php

     
    224224                if ( ! $overwrite && $this->exists($destination) )
    225225                        return false;
    226226
    227                 // try using rename first. if that fails (for example, source is read only) try copy
     227                // Try using rename first. if that fails (for example, source is read only) try copy.
    228228                if ( @rename($source, $destination) )
    229229                        return true;
    230230
     
    305305        }
    306306
    307307        public function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
    308                 // safe mode fails with a trailing slash under certain PHP versions.
     308                // Safe mode fails with a trailing slash under certain PHP versions.
    309309                $path = untrailingslashit($path);
    310310                if ( empty($path) )
    311311                        return false;
  • src/wp-admin/includes/class-wp-filesystem-ftpsockets.php

     
    232232        public function exists( $file ) {
    233233                $list = $this->ftp->nlist( $file );
    234234                return !empty( $list ); //empty list = no file, so invert.
    235                 // return $this->ftp->is_exists($file); has issues with ABOR+426 responses on the ncFTPd server
     235                // Return $this->ftp->is_exists($file); has issues with ABOR+426 responses on the ncFTPd server.
    236236        }
    237237
    238238        public function is_file($file) {
  • src/wp-admin/includes/class-wp-filesystem-ssh2.php

     
    8585                        $this->options['username'] = $opt['username'];
    8686
    8787                if ( empty ($opt['password']) ) {
    88                         if ( !$this->keys )     //password can be blank if we are using keys
     88                        // Password can be blank if we are using keys.
     89                        if ( !$this->keys )
    8990                                $this->errors->add('empty_password', __('SSH2 password is required'));
    9091                } else {
    9192                        $this->options['password'] = $opt['password'];
  • src/wp-admin/includes/class-wp-importer.php

     
    4141                        }
    4242                } while ( count( $results ) == $limit );
    4343
    44                 // unset to save memory
     44                // Unset to save memory.
    4545                unset( $results, $r );
    4646
    4747                return $hashtable;
     
    6767                if ( !empty( $result ) )
    6868                        $count = intval( $result[0]->cnt );
    6969
    70                 // unset to save memory
     70                // Unset to save memory.
    7171                unset( $results );
    7272
    7373                return $count;
     
    109109                        }
    110110                } while ( count( $results ) == $limit );
    111111
    112                 // unset to save memory
     112                // Unset to save memory.
    113113                unset( $results, $r );
    114114
    115115                return $hashtable;
  • src/wp-admin/includes/class-wp-list-table.php

     
    201201                if ( !$args['total_pages'] && $args['per_page'] > 0 )
    202202                        $args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] );
    203203
    204                 // redirect if page number is invalid and headers are not already sent
     204                // Redirect if page number is invalid and headers are not already sent.
    205205                if ( ! headers_sent() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages'] ) {
    206206                        wp_redirect( add_query_arg( 'paged', $args['total_pages'] ) );
    207207                        exit;
  • src/wp-admin/includes/class-wp-ms-sites-list-table.php

     
    3838                        $s = trim($s, '*');
    3939                }
    4040
    41                 // If the network is large and a search is not being performed, show only the latest blogs with no paging in order
    42                 // to avoid expensive count queries.
     41                /*
     42                 * If the network is large and a search is not being performed, show only
     43                 * the latest blogs with no paging in order to avoid expensive count queries.
     44                 */
    4345                if ( !$s && wp_is_large_network() ) {
    4446                        if ( !isset($_REQUEST['orderby']) )
    4547                                $_GET['orderby'] = $_REQUEST['orderby'] = '';
  • src/wp-admin/includes/class-wp-ms-themes-list-table.php

     
    3333        }
    3434
    3535        protected function get_table_classes() {
    36                 return array( 'widefat', 'plugins' );   // todo: remove and add CSS for .themes
     36                // todo: remove and add CSS for .themes
     37                return array( 'widefat', 'plugins' );
    3738        }
    3839
    3940        public function ajax_user_can() {
     
    268269                        $allowed = $theme->is_allowed( 'network' );
    269270                }
    270271
    271                 // preorder
     272                // Pre-order.
    272273                $actions = array(
    273274                        'enable' => '',
    274275                        'disable' => '',
  • src/wp-admin/includes/class-wp-ms-users-list-table.php

     
    4040                        $args['include'] = $wpdb->get_col( "SELECT ID FROM $wpdb->users WHERE user_login IN ('$logins')" );
    4141                }
    4242
    43                 // If the network is large and a search is not being performed, show only the latest users with no paging in order
    44                 // to avoid expensive count queries.
     43                /*
     44                 * If the network is large and a search is not being performed,
     45                 * show only the latest users with no paging in order to avoid
     46                 * expensive count queries.
     47                 */
    4548                if ( !$usersearch && wp_is_large_network( 'users' ) ) {
    4649                        if ( !isset($_REQUEST['orderby']) )
    4750                                $_GET['orderby'] = $_REQUEST['orderby'] = 'id';
  • src/wp-admin/includes/class-wp-plugins-list-table.php

     
    340340                $context = $status;
    341341                $screen = $this->screen;
    342342
    343                 // preorder
     343                // Pre-order.
    344344                $actions = array(
    345345                        'deactivate' => '',
    346346                        'activate' => '',
  • src/wp-admin/includes/class-wp-posts-list-table.php

     
    414414
    415415                        foreach ( $pages as $page ) {
    416416
    417                                 // catch and repair bad pages
     417                                // Catch and repair bad pages.
    418418                                if ( $page->post_parent == $page->ID ) {
    419419                                        $page->post_parent = 0;
    420420                                        $wpdb->update( $wpdb->posts, array( 'post_parent' => 0 ), array( 'ID' => $page->ID ) );
     
    449449                                $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
    450450                }
    451451
    452                 // if it is the last pagenum and there are orphaned pages, display them with paging as well
     452                // If it is the last pagenum and there are orphaned pages, display them with paging as well.
    453453                if ( isset( $children_pages ) && $count < $end ){
    454454                        foreach ( $children_pages as $orphans ){
    455455                                foreach ( $orphans as $op ) {
     
    591591                                $attributes = 'class="post-title page-title column-title"' . $style;
    592592                                if ( $this->hierarchical_display ) {
    593593                                        if ( 0 == $level && (int) $post->post_parent > 0 ) {
    594                                                 //sent level 0 by accident, by default, or because we don't know the actual level
     594                                                // Sent level 0 by accident, by default, or because we don't know the actual level.
    595595                                                $find_main_page = (int) $post->post_parent;
    596596                                                while ( $find_main_page > 0 ) {
    597597                                                        $parent = get_post( $find_main_page );
  • src/wp-admin/includes/class-wp-terms-list-table.php

     
    155155                ) );
    156156
    157157                $page = $args['page'];
    158                 // set variable because $args['number'] can be subsequently overridden
     158
     159                // Set variable because $args['number'] can be subsequently overridden.
    159160                $number = $args['number'];
    160161
    161162                $args['offset'] = $offset = ( $page - 1 ) * $number;
    162163
    163                 // convert it to table rows
     164                // Convert it to table rows.
    164165                $count = 0;
    165166
    166167                if ( is_taxonomy_hierarchical( $taxonomy ) && ! isset( $args['orderby'] ) ) {
  • src/wp-admin/includes/class-wp-theme-install-list-table.php

     
    9292                                break;
    9393
    9494                        case 'featured':
    95                         //case 'popular':
     95                        // case 'popular':
    9696                        case 'new':
    9797                        case 'updated':
    9898                                $args['browse'] = $tab;
  • src/wp-admin/includes/class-wp-themes-list-table.php

     
    7373
    7474                                return;
    7575                        }
    76                         // else, fallthrough. install_themes doesn't help if you can't enable it.
     76                        // Else, fallthrough. install_themes doesn't help if you can't enable it.
    7777                } else {
    7878                        if ( current_user_can( 'install_themes' ) ) {
    7979                                printf( __( 'You only have one theme installed right now. Live a little! You can choose from over 1,000 free themes in the WordPress.org Theme Directory at any time: just click on the <a href="%s">Install Themes</a> tab above.' ), admin_url( 'theme-install.php' ) );
  • src/wp-admin/includes/class-wp-upgrader.php

     
    190190                );
    191191
    192192                $args = wp_parse_args($args, $defaults);
    193                 // these were previously extract()'d
     193
     194                // These were previously extract()'d.
    194195                $source = $args['source'];
    195196                $destination = $args['destination'];
    196197                $clear_destination = $args['clear_destination'];
     
    249250                        return $source;
    250251                }
    251252
    252                 //Has the source location changed? If so, we need a new source_files list.
     253                // Has the source location changed? If so, we need a new source_files list.
    253254                if ( $source !== $remote_source ) {
    254255                        $source_files = array_keys( $wp_filesystem->dirlist( $source ) );
    255256                }
    256                 // Protection against deleting files in any important base directories.
    257                 // Theme_Upgrader & Plugin_Upgrader also trigger this, as they pass the destination directory (WP_PLUGIN_DIR / wp-content/themes)
    258                 // intending to copy the directory into the directory, whilst they pass the source as the actual files to copy.
     257                /*
     258                 * Protection against deleting files in any important base directories.
     259                 * Theme_Upgrader & Plugin_Upgrader also trigger this, as they pass the
     260                 * destination directory (WP_PLUGIN_DIR / wp-content/themes) intending
     261                 * to copy the directory into the directory, whilst they pass the source
     262                 * as the actual files to copy.
     263                 */
    259264                $protected_directories = array( ABSPATH, WP_CONTENT_DIR, WP_PLUGIN_DIR, WP_CONTENT_DIR . '/themes' );
     265
    260266                if ( is_array( $wp_theme_directories ) ) {
    261267                        $protected_directories = array_merge( $protected_directories, $wp_theme_directories );
    262268                }
     
    716722                return $source;
    717723        }
    718724
    719         //return plugin info.
     725        // Return plugin info.
    720726        public function plugin_info() {
    721727                if ( ! is_array($this->result) )
    722728                        return false;
     
    12661272                $this->update_count = count( $language_updates );
    12671273                $this->update_current = 0;
    12681274
    1269                 // The filesystem's mkdir() is not recursive. Make sure WP_LANG_DIR exists,
    1270                 // as we then may need to create a /plugins or /themes directory inside of it.
     1275                /*
     1276                 * The filesystem's mkdir() is not recursive. Make sure WP_LANG_DIR exists,
     1277                 * as we then may need to create a /plugins or /themes directory inside of it.
     1278                 */
    12711279                $remote_destination = $wp_filesystem->find_folder( WP_LANG_DIR );
    12721280                if ( ! $wp_filesystem->exists( $remote_destination ) )
    12731281                        if ( ! $wp_filesystem->mkdir( $remote_destination, FS_CHMOD_DIR ) )
     
    14691477                        $try_rollback = false;
    14701478                        if ( is_wp_error( $result ) ) {
    14711479                                $error_code = $result->get_error_code();
    1472                                 // Not all errors are equal. These codes are critical: copy_failed__copy_dir,
    1473                                 // mkdir_failed__copy_dir, copy_failed__copy_dir_retry, and disk_full.
    1474                                 // do_rollback allows for update_core() to trigger a rollback if needed.
     1480                                /*
     1481                                 * Not all errors are equal. These codes are critical: copy_failed__copy_dir,
     1482                                 * mkdir_failed__copy_dir, copy_failed__copy_dir_retry, and disk_full.
     1483                                 * do_rollback allows for update_core() to trigger a rollback if needed.
     1484                                 */
    14751485                                if ( false !== strpos( $error_code, 'do_rollback' ) )
    14761486                                        $try_rollback = true;
    14771487                                elseif ( false !== strpos( $error_code, '__copy_dir' ) )
     
    16011611                         */
    16021612                        if ( ! apply_filters( 'allow_dev_auto_core_updates', $upgrade_dev ) )
    16031613                                return false;
    1604                         // else fall through to minor + major branches below
     1614                        // Else fall through to minor + major branches below.
    16051615                }
    16061616
    16071617                // 4: Minor In-branch updates (3.7.0 -> 3.7.1 -> 3.7.2 -> 3.7.4)
     
    16921702                                'post_status' => 'private'
    16931703                        );
    16941704
    1695                         // Save the data
     1705                        // Save the data.
    16961706                        $this->id = wp_insert_attachment( $object, $file['file'] );
    16971707
    1698                         // schedule a cleanup for 2 hours from now in case of failed install
     1708                        // Schedule a cleanup for 2 hours from now in case of failed install.
    16991709                        wp_schedule_single_event( time() + 2 * HOUR_IN_SECONDS, 'upgrader_scheduled_cleanup', array( $this->id ) );
    17001710
    17011711                } elseif ( is_numeric( $_GET[$urlholder] ) ) {
     
    20182028                // Boom, This sites about to get a whole new splash of paint!
    20192029                $upgrade_result = $upgrader->upgrade( $upgrader_item, array(
    20202030                        'clear_update_cache' => false,
    2021                         'pre_check_md5'      => false, /* always use partial builds if possible for core updates */
    2022                         'attempt_rollback'   => true, /* only available for core updates */
     2031                        // Always use partial builds if possible for core updates.
     2032                        'pre_check_md5'      => false,
     2033                        // Only available for core updates.
     2034                        'attempt_rollback'   => true,
    20232035                ) );
    20242036
    2025                 // if the filesystem is unavailable, false is returned.
     2037                // If the filesystem is unavailable, false is returned.
    20262038                if ( false === $upgrade_result ) {
    20272039                        $upgrade_result = new WP_Error( 'fs_unavailable', __( 'Could not access filesystem.' ) );
    20282040                }
    20292041
    2030                 // Core doesn't output this, so lets append it so we don't get confused
     2042                // Core doesn't output this, so lets append it so we don't get confused.
    20312043                if ( 'core' == $type ) {
    20322044                        if ( is_wp_error( $upgrade_result ) ) {
    20332045                                $skin->error( __( 'Installation Failed' ), $upgrade_result );
  • src/wp-admin/includes/dashboard.php

     
    531531
    532532        $actions_string = '';
    533533        if ( current_user_can( 'edit_comment', $comment->comment_ID ) ) {
    534                 // preorder it: Approve | Reply | Edit | Spam | Trash
     534                // Pre-order it: Approve | Reply | Edit | Spam | Trash.
    535535                $actions = array(
    536536                        'approve' => '', 'unapprove' => '',
    537537                        'reply' => '',
     
    898898                $_POST['widget-rss'][$number] = wp_unslash( $_POST['widget-rss'][$number] );
    899899                $widget_options[$widget_id] = wp_widget_rss_process( $_POST['widget-rss'][$number] );
    900900                $widget_options[$widget_id]['number'] = $number;
    901                 // title is optional. If black, fill it if possible
     901
     902                // Title is optional. If black, fill it if possible.
    902903                if ( !$widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title']) ) {
    903904                        $rss = fetch_feed($widget_options[$widget_id]['url']);
    904905                        if ( is_wp_error($rss) ) {
  • src/wp-admin/includes/export.php

     
    8383                        $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date < %s", date( 'Y-m-d', strtotime('+1 month', strtotime($args['end_date'])) ) );
    8484        }
    8585
    86         // grab a snapshot of post IDs, just in case it changes during the export
     86        // Grab a snapshot of post IDs, just in case it changes during the export.
    8787        $post_ids = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} $join WHERE $where" );
    8888
    89         // get the requested terms ready, empty unless posts filtered by category or all content
     89        /*
     90         * Get the requested terms ready, empty unless posts filtered by category
     91         * or all content.
     92         */
    9093        $cats = $tags = $terms = array();
    9194        if ( isset( $term ) && $term ) {
    9295                $cat = get_term( $term['term_id'], 'category' );
     
    99102                $custom_taxonomies = get_taxonomies( array( '_builtin' => false ) );
    100103                $custom_terms = (array) get_terms( $custom_taxonomies, array( 'get' => 'all' ) );
    101104
    102                 // put categories in order with no child going before its parent
     105                // Put categories in order with no child going before its parent.
    103106                while ( $cat = array_shift( $categories ) ) {
    104107                        if ( $cat->parent == 0 || isset( $cats[$cat->parent] ) )
    105108                                $cats[$cat->term_id] = $cat;
     
    107110                                $categories[] = $cat;
    108111                }
    109112
    110                 // put terms in order with no child going before its parent
     113                // Put terms in order with no child going before its parent.
    111114                while ( $t = array_shift( $custom_terms ) ) {
    112115                        if ( $t->parent == 0 || isset( $terms[$t->parent] ) )
    113116                                $terms[$t->term_id] = $t;
     
    144147         * @return string Site URL.
    145148         */
    146149        function wxr_site_url() {
    147                 // ms: the base url
     150                // Multisite: the base URL.
    148151                if ( is_multisite() )
    149152                        return network_home_url();
    150                 // wp: the blog url
     153                // WordPress (single site): the blog URL.
    151154                else
    152155                        return get_bloginfo_rss( 'url' );
    153156        }
     
    373376
    374377<?php if ( $post_ids ) {
    375378        global $wp_query;
    376         $wp_query->in_the_loop = true; // Fake being in the loop.
    377379
    378         // fetch 20 posts at a time rather than loading the entire table into memory
     380        // Fake being in the loop.
     381        $wp_query->in_the_loop = true;
     382
     383        // Fetch 20 posts at a time rather than loading the entire table into memory.
    379384        while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) {
    380385        $where = 'WHERE ID IN (' . join( ',', $next_posts ) . ')';
    381386        $posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where" );
    382387
    383         // Begin Loop
     388        // Begin Loop.
    384389        foreach ( $posts as $post ) {
    385390                setup_postdata( $post );
    386391                $is_sticky = is_sticky( $post->ID ) ? 1 : 0;
  • src/wp-admin/includes/file.php

     
    179179                case 1 :
    180180                        wp_die( __( 'Sorry, that file cannot be edited.' ) );
    181181
    182                 //case 2 :
    183                 //      wp_die( __('Sorry, can&#8217;t call files with their real path.' ));
     182                // case 2 :
     183                // wp_die( __('Sorry, can&#8217;t call files with their real path.' ));
    184184
    185185                case 3 :
    186186                        wp_die( __( 'Sorry, that file cannot be edited.' ) );
     
    257257                __( "Failed to write file to disk." ),
    258258                __( "File upload stopped by extension." ));
    259259
    260         // this may not have orignially been intended to be overrideable, but historically has been
     260        /*
     261         * This may not have orignially been intended to be overrideable,
     262         * but historically has been.
     263         */
    261264        if ( isset( $overrides['upload_error_strings'] ) ) {
    262265                $upload_error_strings = $overrides['upload_error_strings'];
    263266        }
     
    267270        $test_size = isset( $overrides['test_size'] ) ? $overrides['test_size'] : true;
    268271        $test_upload = isset( $overrides['test_upload'] ) ? $overrides['test_upload'] : true;
    269272
    270         // If you override this, you must provide $ext and $type!!!!
     273        // If you override this, you must provide $ext and $type!!
    271274        $test_type = isset( $overrides['test_type'] ) ? $overrides['test_type'] : true;
    272275        $mimes = isset( $overrides['mimes'] ) ? $overrides['mimes'] : false;
    273276
     
    314317                $type = '';
    315318        }
    316319
    317         // A writable uploads dir will pass this test. Again, there's no point overriding this one.
     320        /*
     321         * A writable uploads dir will pass this test. Again, there's no point
     322         * overriding this one.
     323         */
    318324        if ( ! ( ( $uploads = wp_upload_dir($time) ) && false === $uploads['error'] ) )
    319325                return call_user_func($upload_error_handler, $file, $uploads['error'] );
    320326
    321327        $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback );
    322328
    323         // Move the file to the uploads dir
     329        // Move the file to the uploads dir.
    324330        $new_file = $uploads['path'] . "/$filename";
    325331        if ( false === @ move_uploaded_file( $file['tmp_name'], $new_file ) ) {
    326332                if ( 0 === strpos( $uploads['basedir'], ABSPATH ) )
     
    331337                return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $error_path ) );
    332338        }
    333339
    334         // Set correct file permissions
     340        // Set correct file permissions.
    335341        $stat = stat( dirname( $new_file ));
    336342        $perms = $stat['mode'] & 0000666;
    337343        @ chmod( $new_file, $perms );
    338344
    339         // Compute the URL
     345        // Compute the URL.
    340346        $url = $uploads['url'] . "/$filename";
    341347
    342348        if ( is_multisite() )
     
    10511057        $credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : (!empty($_POST['public_key']) ? wp_unslash( $_POST['public_key'] ) : '');
    10521058        $credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : (!empty($_POST['private_key']) ? wp_unslash( $_POST['private_key'] ) : '');
    10531059
    1054         //sanitize the hostname, Some people might pass in odd-data:
     1060        // Sanitize the hostname, Some people might pass in odd-data:
    10551061        $credentials['hostname'] = preg_replace('|\w+://|', '', $credentials['hostname']); //Strip any schemes off
    10561062
    10571063        if ( strpos($credentials['hostname'], ':') ) {
  • src/wp-admin/includes/image-edit.php

     
    411411        if ( !is_array($changes) )
    412412                return $image;
    413413
    414         // expand change operations
     414        // Expand change operations.
    415415        foreach ( $changes as $key => $obj ) {
    416416                if ( isset($obj->r) ) {
    417417                        $obj->type = 'rotate';
     
    429429                $changes[$key] = $obj;
    430430        }
    431431
    432         // combine operations
     432        // Combine operations.
    433433        if ( count($changes) > 1 ) {
    434434                $filtered = array($changes[0]);
    435435                for ( $i = 0, $j = 1; $j < count($changes); $j++ ) {
     
    453453                unset($filtered);
    454454        }
    455455
    456         // image resource before applying the changes
     456        // Image resource before applying the changes.
    457457        if ( $image instanceof WP_Image_Editor ) {
    458458
    459459                /**
     
    540540        if ( $changes )
    541541                $img = image_edit_apply_changes( $img, $changes );
    542542
    543         // scale the image
     543        // Scale the image.
    544544        $size = $img->get_size();
    545545        $w = $size['width'];
    546546        $h = $size['height'];
     
    576576
    577577                if ( $parts['basename'] != $data['file'] ) {
    578578                        if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE ) {
    579                                 // delete only if it's edited image
     579
     580                                // Delete only if it's edited image.
    580581                                if ( preg_match('/-e[0-9]{13}\./', $parts['basename']) ) {
    581582
    582583                                        /** This filter is documented in wp-admin/custom-header.php */
     
    601602                        $data = $backup_sizes["$default_size-orig"];
    602603                        if ( isset($meta['sizes'][$default_size]) && $meta['sizes'][$default_size]['file'] != $data['file'] ) {
    603604                                if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE ) {
    604                                         // delete only if it's edited image
     605
     606                                        // Delete only if it's edited image
    605607                                        if ( preg_match('/-e[0-9]{13}-/', $meta['sizes'][$default_size]['file']) ) {
    606608                                                /** This filter is documented in wp-admin/custom-header.php */
    607609                                                $delpath = apply_filters( 'wp_delete_file', path_join($parts['dirname'], $meta['sizes'][$default_size]['file']) );
     
    661663                $sX = $size['width'];
    662664                $sY = $size['height'];
    663665
    664                 // check if it has roughly the same w / h ratio
     666                // Check if it has roughly the same w / h ratio.
    665667                $diff = round($sX / $sY, 2) - round($fwidth / $fheight, 2);
    666668                if ( -0.1 < $diff && $diff < 0.1 ) {
    667                         // scale the full size image
     669                        // Scale the full size image.
    668670                        if ( $img->resize( $fwidth, $fheight ) )
    669671                                $scaled = true;
    670672                }
     
    693695        if ( !is_array($backup_sizes) )
    694696                $backup_sizes = array();
    695697
    696         // generate new filename
     698        // Generate new filename.
    697699        $path = get_attached_file($post_id);
    698700        $path_parts = pathinfo( $path );
    699701        $filename = $path_parts['filename'];
     
    719721                }
    720722        }
    721723
    722         // save the full-size file, also needed to create sub-sizes
     724        // Save the full-size file, also needed to create sub-sizes.
    723725        if ( !wp_save_image_file($new_path, $img, $post->post_mime_type, $post_id) ) {
    724726                $return->error = esc_js( __('Unable to save the image.') );
    725727                return $return;
  • src/wp-admin/includes/image.php

     
    4747        if ( ! $dst_file )
    4848                $dst_file = str_replace( basename( $src_file ), 'cropped-' . basename( $src_file ), $src_file );
    4949
    50         // The directory containing the original file may no longer exist when
    51         // using a replication plugin.
     50        /*
     51         * The directory containing the original file may no longer exist when
     52         * using a replication plugin.
     53         */
    5254        wp_mkdir_p( dirname( $dst_file ) );
    5355
    5456        $dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), basename( $dst_file ) );
     
    7981                $metadata['width'] = $imagesize[0];
    8082                $metadata['height'] = $imagesize[1];
    8183
    82                 // Make the file path relative to the upload dir
     84                // Make the file path relative to the upload dir.
    8385                $metadata['file'] = _wp_relative_upload_path($file);
    8486
    85                 // make thumbnails and other intermediate sizes
     87                // Make thumbnails and other intermediate sizes.
    8688                global $_wp_additional_image_sizes;
    8789
    8890                $sizes = array();
     
    120122                        $metadata['sizes'] = array();
    121123                }
    122124
    123                 // fetch additional metadata from exif/iptc
     125                // Fetch additional metadata from EXIF/IPTC.
    124126                $image_meta = wp_read_image_metadata( $file );
    125127                if ( $image_meta )
    126128                        $metadata['image_meta'] = $image_meta;
     
    134136        }
    135137
    136138        if ( $support && ! empty( $metadata['image']['data'] ) ) {
    137                 // check for existing cover
     139                // Check for existing cover.
    138140                $hash = md5( $metadata['image']['data'] );
    139141                $posts = get_posts( array(
    140142                        'fields' => 'ids',
     
    187189                }
    188190        }
    189191
    190         // remove the blob of binary data from the array
     192        // Remove the blob of binary data from the array.
    191193        if ( isset( $metadata['image']['data'] ) )
    192194                unset( $metadata['image']['data'] );
    193195
     
    254256
    255257        list( , , $sourceImageType ) = getimagesize( $file );
    256258
    257         // exif contains a bunch of data we'll probably never need formatted in ways
    258         // that are difficult to use. We'll normalize it and just extract the fields
    259         // that are likely to be useful. Fractions and numbers are converted to
    260         // floats, dates to unix timestamps, and everything else to strings.
     259        /*
     260         * EXIF contains a bunch of data we'll probably never need formatted in ways
     261         * that are difficult to use. We'll normalize it and just extract the fields
     262         * that are likely to be useful. Fractions and numbers are converted to
     263         * floats, dates to unix timestamps, and everything else to strings.
     264         */
    261265        $meta = array(
    262266                'aperture' => 0,
    263267                'credit' => '',
     
    271275                'title' => '',
    272276        );
    273277
    274         // read iptc first, since it might contain data not available in exif such
    275         // as caption, description etc
     278        /*
     279         * Read IPTC first, since it might contain data not available in exif such
     280         * as caption, description etc.
     281         */
    276282        if ( is_callable( 'iptcparse' ) ) {
    277283                getimagesize( $file, $info );
    278284
    279285                if ( ! empty( $info['APP13'] ) ) {
    280286                        $iptc = iptcparse( $info['APP13'] );
    281287
    282                         // headline, "A brief synopsis of the caption."
    283                         if ( ! empty( $iptc['2#105'][0] ) )
     288                        // Headline, "A brief synopsis of the caption."
     289                        if ( ! empty( $iptc['2#105'][0] ) ) {
    284290                                $meta['title'] = trim( $iptc['2#105'][0] );
    285                         // title, "Many use the Title field to store the filename of the image, though the field may be used in many ways."
    286                         elseif ( ! empty( $iptc['2#005'][0] ) )
     291                        /*
     292                         * Title, "Many use the Title field to store the filename of the image,
     293                         * though the field may be used in many ways."
     294                         */
     295                        } elseif ( ! empty( $iptc['2#005'][0] ) ) {
    287296                                $meta['title'] = trim( $iptc['2#005'][0] );
     297                        }
    288298
    289299                        if ( ! empty( $iptc['2#120'][0] ) ) { // description / legacy caption
    290300                                $caption = trim( $iptc['2#120'][0] );
     
    568578                $dst_file = str_replace( basename( $dst_file ), 'copy-' . basename( $dst_file ), $dst_file );
    569579                $dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), basename( $dst_file ) );
    570580
    571                 // The directory containing the original file may no longer exist when
    572                 // using a replication plugin.
     581                /*
     582                 * The directory containing the original file may no longer
     583                 * exist when using a replication plugin.
     584                 */
    573585                wp_mkdir_p( dirname( $dst_file ) );
    574586
    575587                if ( ! @copy( $src_file, $dst_file ) )
  • src/wp-admin/includes/import.php

     
    105105        // Save the data
    106106        $id = wp_insert_attachment( $object, $file );
    107107
    108         // schedule a cleanup for one day from now in case of failed import or missing wp_import_cleanup() call
     108        /*
     109         * Schedule a cleanup for one day from now in case of failed
     110         * import or missing wp_import_cleanup() call.
     111         */
    109112        wp_schedule_single_event( time() + DAY_IN_SECONDS, 'importer_scheduled_cleanup', array( $id ) );
    110113
    111114        return array( 'file' => $file, 'id' => $id );
  • src/wp-admin/includes/media.php

     
    180180
    181181        $caption = str_replace( array("\r\n", "\r"), "\n", $caption);
    182182        $caption = preg_replace_callback( '/<[a-zA-Z0-9]+(?: [^<>]+>)*/', '_cleanup_image_add_caption', $caption );
    183         // convert any remaining line breaks to <br>
     183
     184        // Convert any remaining line breaks to <br>.
    184185        $caption = preg_replace( '/[ \n\t]*\n[ \t]*/', '<br />', $caption );
    185186
    186187        $html = preg_replace( '/(class=["\'][^\'"]*)align(none|left|right|center)\s?/', '$1', $html );
     
    208209 * @since 3.4.0
    209210 */
    210211function _cleanup_image_add_caption( $matches ) {
    211         // remove any line breaks from inside the tags
     212        // Remove any line breaks from inside the tags.
    212213        return preg_replace( '/[\r\n\t]+/', ' ', $matches[0] );
    213214}
    214215
     
    317318                if ( ! empty( $meta['genre'] ) )
    318319                        $content .= ' ' . sprintf( __( 'Genre: %s.' ), $meta['genre'] );
    319320
    320         // use image exif/iptc data for title and caption defaults if possible
     321        // Use image exif/iptc data for title and caption defaults if possible.
    321322        } elseif ( $image_meta = @wp_read_image_metadata( $file ) ) {
    322323                if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) )
    323324                        $title = $image_meta['title'];
     
    378379        $title = preg_replace('/\.[^.]+$/', '', basename($file));
    379380        $content = '';
    380381
    381         // use image exif/iptc data for title and caption defaults if possible
     382        // Use image exif/iptc data for title and caption defaults if possible.
    382383        if ( $image_meta = @wp_read_image_metadata($file) ) {
    383384                if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) )
    384385                        $title = $image_meta['title'];
     
    389390        if ( isset( $desc ) )
    390391                $title = $desc;
    391392
    392         // Construct the attachment array
     393        // Construct the attachment array.
    393394        $attachment = array_merge( array(
    394395                'post_mime_type' => $type,
    395396                'guid' => $url,
     
    634635                        $image_alt = wp_unslash( $attachment['image_alt'] );
    635636                        if ( $image_alt != get_post_meta($attachment_id, '_wp_attachment_image_alt', true) ) {
    636637                                $image_alt = wp_strip_all_tags( $image_alt, true );
    637                                 // update_meta expects slashed
     638
     639                                // Update_meta expects slashed.
    638640                                update_post_meta( $attachment_id, '_wp_attachment_image_alt', wp_slash( $image_alt ) );
    639641                        }
    640642                }
     
    807809 */
    808810function media_sideload_image( $file, $post_id, $desc = null ) {
    809811        if ( ! empty( $file ) ) {
    810                 // Set variables for storage
    811                 // fix file filename for query strings
     812                // Set variables for storage, fix file filename for query strings.
    812813                preg_match( '/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $file, $matches );
    813814                $file_array['name'] = basename( $matches[0] );
    814                 // Download file to temp location
     815
     816                // Download file to temp location.
    815817                $file_array['tmp_name'] = download_url( $file );
    816818
    817819                // If error storing temporarily, return the error.
     
    819821                        return $file_array['tmp_name'];
    820822                }
    821823
    822                 // do the validation and storage stuff
     824                // Do the validation and storage stuff.
    823825                $id = media_handle_sideload( $file_array, $post_id, $desc );
    824                 // If error storing permanently, unlink
     826
     827                // If error storing permanently, unlink.
    825828                if ( is_wp_error( $id ) ) {
    826829                        @unlink( $file_array['tmp_name'] );
    827830                        return $id;
     
    830833                $src = wp_get_attachment_url( $id );
    831834        }
    832835
    833         // Finally check to make sure the file has been saved, then return the html
     836        // Finally check to make sure the file has been saved, then return the HTML.
    834837        if ( ! empty( $src ) ) {
    835838                $alt = isset( $desc ) ? esc_attr( $desc ) : '';
    836839                $html = "<img src='$src' alt='$alt' />";
     
    943946                        $downsize = image_downsize($post->ID, $size);
    944947                        $checked = '';
    945948
    946                         // is this size selectable?
     949                        // Is this size selectable?
    947950                        $enabled = ( $downsize[3] || 'full' == $size );
    948951                        $css_id = "image-size-{$size}-{$post->ID}";
    949                         // if this size is the default but that's not available, don't select it
     952
     953                        // If this size is the default but that's not available, don't select it.
    950954                        if ( $size == $check ) {
    951955                                if ( $enabled )
    952956                                        $checked = " checked='checked'";
    953957                                else
    954958                                        $check = '';
    955959                        } elseif ( !$check && $enabled && 'thumbnail' != $size ) {
    956                                 // if $check is not enabled, default to the first available size that's bigger than a thumbnail
     960                                /*
     961                                 * If $check is not enabled, default to the first available size
     962                                 * that's bigger than a thumbnail.
     963                                 */
    957964                                $check = $size;
    958965                                $checked = " checked='checked'";
    959966                        }
     
    961968                        $html = "<div class='image-size-item'><input type='radio' " . disabled( $enabled, false, false ) . "name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}'$checked />";
    962969
    963970                        $html .= "<label for='{$css_id}'>$label</label>";
    964                         // only show the dimensions if that choice is available
     971
     972                        // Only show the dimensions if that choice is available.
    965973                        if ( $enabled )
    966974                                $html .= " <label for='{$css_id}' class='help'>" . sprintf( "(%d&nbsp;&times;&nbsp;%d)", $downsize[1], $downsize[2] ). "</label>";
    967975
     
    10091017}
    10101018
    10111019function wp_caption_input_textarea($edit_post) {
    1012         // post data is already escaped
     1020        // Post data is already escaped.
    10131021        $name = "attachments[{$edit_post->ID}][post_excerpt]";
    10141022
    10151023        return '<textarea name="' . $name . '" id="' . $name . '">' . $edit_post->post_excerpt . '</textarea>';
     
    14721480                        $item .= $field[ $field['input'] ];
    14731481                elseif ( $field['input'] == 'textarea' ) {
    14741482                        if ( 'post_content' == $id && user_can_richedit() ) {
    1475                                 // sanitize_post() skips the post_content when user_can_richedit
     1483                                // Sanitize_post() skips the post_content when user_can_richedit.
    14761484                                $field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES );
    14771485                        }
    1478                         // post_excerpt is already escaped by sanitize_post() in get_attachment_fields_to_edit()
     1486                        // Post_excerpt is already escaped by sanitize_post() in get_attachment_fields_to_edit().
    14791487                        $item .= "<textarea id='$name' name='$name' $aria_required>" . $field['value'] . '</textarea>';
    14801488                } else {
    14811489                        $item .= "<input type='text' class='text' id='$name' name='$name' value='" . esc_attr( $field['value'] ) . "' $aria_required />";
     
    16211629                        $item .= $field[ $field['input'] ];
    16221630                elseif ( $field['input'] == 'textarea' ) {
    16231631                        if ( 'post_content' == $id && user_can_richedit() ) {
    1624                                 // sanitize_post() skips the post_content when user_can_richedit
     1632                                // sanitize_post() skips the post_content when user_can_richedit.
    16251633                                $field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES );
    16261634                        }
    16271635                        $item .= "<textarea id='$id_attr' name='$name' $aria_required>" . $field['value'] . '</textarea>';
     
    28522860                        foreach ( $data[$version]['comments'] as $key => $list ) {
    28532861                                if ( ! empty( $list ) ) {
    28542862                                        $metadata[$key] = reset( $list );
    2855                                         // fix bug in byte stream analysis
     2863                                        // Fix bug in byte stream analysis.
    28562864                                        if ( 'terms_of_use' === $key && 0 === strpos( $metadata[$key], 'yright notice.' ) )
    28572865                                                $metadata[$key] = 'Cop' . $metadata[$key];
    28582866                                }
  • src/wp-admin/includes/menu.php

     
    9797        $first_sub = array_shift($subs);
    9898        $old_parent = $data[2];
    9999        $new_parent = $first_sub[2];
    100         // If the first submenu is not the same as the assigned parent,
    101         // make the first submenu the new parent.
     100        /*
     101         * If the first submenu is not the same as the assigned parent,
     102         * make the first submenu the new parent.
     103         */
    102104        if ( $new_parent != $old_parent ) {
    103105                $_wp_real_parent_file[$old_parent] = $new_parent;
    104106                $menu[$id][2] = $new_parent;
  • src/wp-admin/includes/misc.php

     
    163163        $home_path = get_home_path();
    164164        $htaccess_file = $home_path.'.htaccess';
    165165
    166         // If the file doesn't already exist check for write access to the directory and whether we have some rules.
    167         // else check for write access to the file.
     166        /*
     167         * If the file doesn't already exist check for write access to the directory
     168         * and whether we have some rules. Else check for write access to the file.
     169         */
    168170        if ((!file_exists($htaccess_file) && is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks()) || is_writable($htaccess_file)) {
    169171                if ( got_mod_rewrite() ) {
    170172                        $rules = explode( "\n", $wp_rewrite->mod_rewrite_rules() );
  • src/wp-admin/includes/ms-deprecated.php

     
    1414 */
    1515function wpmu_menu() {
    1616        _deprecated_function(__FUNCTION__, '3.0' );
    17         // deprecated. See #11763
     17        // Deprecated. See #11763.
    1818}
    1919
    2020/**
  • src/wp-admin/includes/nav-menu.php

     
    516516                $post_type = apply_filters( 'nav_menu_meta_box_object', $post_type );
    517517                if ( $post_type ) {
    518518                        $id = $post_type->name;
    519                         // give pages a higher priority
     519                        // Give pages a higher priority.
    520520                        $priority = ( 'page' == $post_type->name ? 'core' : 'default' );
    521521                        add_meta_box( "add-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', $priority, $post_type );
    522522                }
     
    615615
    616616        $post_type_name = $post_type['args']->name;
    617617
    618         // paginate browsing for large numbers of post objects
     618        // Paginate browsing for large numbers of post objects.
    619619        $per_page = 50;
    620620        $pagenum = isset( $_REQUEST[$post_type_name . '-tab'] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1;
    621621        $offset = 0 < $pagenum ? $per_page * ( $pagenum - 1 ) : 0;
     
    762762                                <?php
    763763                                $args['walker'] = $walker;
    764764
    765                                 // if we're dealing with pages, let's put a checkbox for the front page at the top of the list
     765                                /*
     766                                 * If we're dealing with pages, let's put a checkbox for the front
     767                                 * page at the top of the list.
     768                                 */
    766769                                if ( 'page' == $post_type_name ) {
    767770                                        $front_page = 'page' == get_option('show_on_front') ? (int) get_option( 'page_on_front' ) : 0;
    768771                                        if ( ! empty( $front_page ) ) {
     
    854857        global $nav_menu_selected_id;
    855858        $taxonomy_name = $taxonomy['args']->name;
    856859
    857         // paginate browsing for large numbers of objects
     860        // Paginate browsing for large numbers of objects.
    858861        $per_page = 50;
    859862        $pagenum = isset( $_REQUEST[$taxonomy_name . '-tab'] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1;
    860863        $offset = 0 < $pagenum ? $per_page * ( $pagenum - 1 ) : 0;
     
    10451048
    10461049        if ( 0 == $menu_id || is_nav_menu( $menu_id ) ) {
    10471050
    1048                 // Loop through all the menu items' POST values
     1051                // Loop through all the menu items' POST values.
    10491052                foreach( (array) $menu_data as $_possible_db_id => $_item_object_data ) {
    10501053                        if (
    1051                                 empty( $_item_object_data['menu-item-object-id'] ) && // checkbox is not checked
     1054                                // Checkbox is not checked.
     1055                                empty( $_item_object_data['menu-item-object-id'] ) &&
    10521056                                (
    1053                                         ! isset( $_item_object_data['menu-item-type'] ) || // and item type either isn't set
    1054                                         in_array( $_item_object_data['menu-item-url'], array( 'http://', '' ) ) || // or URL is the default
     1057                                        // And item type either isn't set.
     1058                                        ! isset( $_item_object_data['menu-item-type'] ) ||
     1059                                        // Or URL is the default.
     1060                                        in_array( $_item_object_data['menu-item-url'], array( 'http://', '' ) ) ||
    10551061                                        ! ( 'custom' == $_item_object_data['menu-item-type'] && ! isset( $_item_object_data['menu-item-db-id'] ) ) || // or it's not a custom menu item (but not the custom home page)
    1056                                         ! empty( $_item_object_data['menu-item-db-id'] ) // or it *is* a custom menu item that already exists
     1062                                        // Or it *is* a custom menu item that already exists.
     1063                                        ! empty( $_item_object_data['menu-item-db-id'] )
    10571064                                )
    10581065                        ) {
    1059                                 continue; // then this potential menu item is not getting added to this menu
     1066                                // Then this potential menu item is not getting added to this menu.
     1067                                continue;
    10601068                        }
    10611069
    1062                         // if this possible menu item doesn't actually have a menu database ID yet
     1070                        // If this possible menu item doesn't actually have a menu database ID yet.
    10631071                        if (
    10641072                                empty( $_item_object_data['menu-item-db-id'] ) ||
    10651073                                ( 0 > $_possible_db_id ) ||
     
    11121120                                'post_status' => 'publish',
    11131121                        );
    11141122
    1115                 // posts should show only published items
     1123                // Posts should show only published items.
    11161124                } elseif ( 'post' == $object->name ) {
    11171125                        $object->_default_query = array(
    11181126                                'post_status' => 'publish',
    11191127                        );
    11201128
    1121                 // cats should be in reverse chronological order
     1129                // Categories should be in reverse chronological order.
    11221130                } elseif ( 'category' == $object->name ) {
    11231131                        $object->_default_query = array(
    11241132                                'orderby' => 'id',
    11251133                                'order' => 'DESC',
    11261134                        );
    11271135
    1128                 // custom post types should show only published items
     1136                // Custom post types should show only published items.
    11291137                } else {
    11301138                        $object->_default_query = array(
    11311139                                'post_status' => 'publish',
     
    12261234        global $wpdb;
    12271235        $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
    12281236
    1229         // delete orphaned draft menu items
     1237        // Delete orphaned draft menu items.
    12301238        $menu_items_to_delete = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts AS p LEFT JOIN $wpdb->postmeta AS m ON p.ID = m.post_id WHERE post_type = 'nav_menu_item' AND post_status = 'draft' AND meta_key = '_menu_item_orphaned' AND meta_value < '%d'", $delete_timestamp ) );
    12311239
    12321240        foreach( (array) $menu_items_to_delete as $menu_item_id )
  • src/wp-admin/includes/plugin-install.php

     
    245245 * @since 3.0.0
    246246 */
    247247function install_plugin_install_status($api, $loop = false) {
    248         // this function is called recursively, $loop prevents further loops.
     248        // This function is called recursively, $loop prevents further loops.
    249249        if ( is_array($api) )
    250250                $api = (object) $api;
    251251
    252         //Default to a "new" plugin
     252        // Default to a "new" plugin
    253253        $status = 'install';
    254254        $url = false;
    255255
    256         //Check to see if this plugin is known to be installed, and has an update awaiting it.
     256        /*
     257         * Check to see if this plugin is known to be installed,
     258         * and has an update awaiting it.
     259         */
    257260        $update_plugins = get_site_transient('update_plugins');
    258261        if ( isset( $update_plugins->response ) ) {
    259262                foreach ( (array)$update_plugins->response as $file => $plugin ) {
     
    438441
    439442                if ( ! empty( $api->ratings ) && array_sum( (array) $api->ratings ) > 0 ) {
    440443                        foreach( $api->ratings as $key => $ratecount ) {
    441                                 // avoid div-by-zero
     444                                // Avoid div-by-zero.
    442445                                $_rating = $api->num_ratings ? ( $ratecount / $api->num_ratings ) : 0;
    443446                                ?>
    444447                                <div class="counter-container">
  • src/wp-admin/includes/plugin.php

     
    851851 */
    852852function validate_active_plugins() {
    853853        $plugins = get_option( 'active_plugins', array() );
    854         // validate vartype: array
     854        // Validate vartype: array.
    855855        if ( ! is_array( $plugins ) ) {
    856856                update_option( 'active_plugins', array() );
    857857                $plugins = array();
     
    867867
    868868        $invalid = array();
    869869
    870         // invalid plugins get deactivated
     870        // Invalid plugins get deactivated.
    871871        foreach ( $plugins as $plugin ) {
    872872                $result = validate_plugin( $plugin );
    873873                if ( is_wp_error( $result ) ) {
     
    11191119                return false;
    11201120        }
    11211121
    1122         // If the parent doesn't already have a submenu, add a link to the parent
    1123         // as the first item in the submenu. If the submenu file is the same as the
    1124         // parent file someone is trying to link back to the parent manually. In
    1125         // this case, don't automatically add a link back to avoid duplication.
     1122        /*
     1123         * If the parent doesn't already have a submenu, add a link to the parent
     1124         * as the first item in the submenu. If the submenu file is the same as the
     1125         * parent file someone is trying to link back to the parent manually. In
     1126         * this case, don't automatically add a link back to avoid duplication.
     1127         */
    11261128        if (!isset( $submenu[$parent_slug] ) && $menu_slug != $parent_slug ) {
    11271129                foreach ( (array)$menu as $parent_menu ) {
    11281130                        if ( $parent_menu[2] == $parent_slug && current_user_can( $parent_menu[1] ) )
     
    11371139                add_action( $hookname, $function );
    11381140
    11391141        $_registered_pages[$hookname] = true;
    1140         // backwards-compatibility for plugins using add_management page. See wp-admin/admin.php for redirect from edit.php to tools.php
     1142
     1143        /*
     1144         * Backward-compatibility for plugins using add_management page.
     1145         * See wp-admin/admin.php for redirect from edit.php to tools.php
     1146         */
    11411147        if ( 'tools.php' == $parent_slug )
    11421148                $_registered_pages[get_plugin_page_hookname( $menu_slug, 'edit.php')] = true;
    11431149
    1144         // No parent as top level
     1150        // No parent as top level.
    11451151        $_parent_pages[$menu_slug] = $parent_slug;
    11461152
    11471153        return $hookname;
  • src/wp-admin/includes/post.php

     
    302302                        $image_alt = wp_unslash( $post_data['_wp_attachment_image_alt'] );
    303303                        if ( $image_alt != get_post_meta( $post_ID, '_wp_attachment_image_alt', true ) ) {
    304304                                $image_alt = wp_strip_all_tags( $image_alt, true );
    305                                 // update_meta expects slashed
     305                                // update_meta expects slashed.
    306306                                update_post_meta( $post_ID, '_wp_attachment_image_alt', wp_slash( $image_alt ) );
    307307                        }
    308308                }
     
    740740                $metavalue = trim( $metavalue );
    741741
    742742        if ( ('0' === $metavalue || ! empty ( $metavalue ) ) && ( ( ( '#NONE#' != $metakeyselect ) && !empty ( $metakeyselect) ) || !empty ( $metakeyinput ) ) ) {
    743                 // We have a key/value pair. If both the select and the
    744                 // input for the key have data, the input takes precedence:
    745 
     743                /*
     744                 * We have a key/value pair. If both the select and the input
     745                 * for the key have data, the input takes precedence.
     746                 */
    746747                if ( '#NONE#' != $metakeyselect )
    747748                        $metakey = $metakeyselect;
    748749
  • src/wp-admin/includes/revision.php

     
    177177                );
    178178        }
    179179
    180         // If a post has been saved since the last revision (no revisioned fields were changed)
    181         // we may not have a "current" revision. Mark the latest revision as "current".
     180        /*
     181         * If a post has been saved since the last revision (no revisioned fields
     182         * were changed), we may not have a "current" revision. Mark the latest
     183         * revision as "current".
     184         */
    182185        if ( empty( $current_id ) ) {
    183186                if ( $revisions[ $revision->ID ]['autosave'] ) {
    184187                        $revision = end( $revisions );
     
    192195                $revisions[ $current_id ]['current'] = true;
    193196        }
    194197
    195         // Now, grab the initial diff
     198        // Now, grab the initial diff.
    196199        $compare_two_mode = is_numeric( $from );
    197200        if ( ! $compare_two_mode ) {
    198201                $found = array_search( $selected_revision_id, array_keys( $revisions ) );
  • src/wp-admin/includes/schema.php

     
    205205  KEY user_nicename (user_nicename)
    206206) $charset_collate;\n";
    207207
    208         // usermeta
     208        // Usermeta.
    209209        $usermeta_table = "CREATE TABLE $wpdb->usermeta (
    210210  umeta_id bigint(20) unsigned NOT NULL auto_increment,
    211211  user_id bigint(20) unsigned NOT NULL default '0',
     
    522522        if ( !empty($insert) )
    523523                $wpdb->query("INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES " . $insert);
    524524
    525         // in case it is set, but blank, update "home"
     525        // In case it is set, but blank, update "home".
    526526        if ( !__get_option('home') ) update_option('home', $guessurl);
    527527
    528         // Delete unused options
     528        // Delete unused options.
    529529        $unusedoptions = array(
    530530                'blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory',
    531531                'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping',
     
    547547        foreach ( $unusedoptions as $option )
    548548                delete_option($option);
    549549
    550         // delete obsolete magpie stuff
     550        // Delete obsolete magpie stuff.
    551551        $wpdb->query("DELETE FROM $wpdb->options WHERE option_name REGEXP '^rss_[0-9a-f]{32}(_ts)?$'");
    552552
    553         // Deletes all expired transients.
    554         // The multi-table delete syntax is used to delete the transient record from table a,
    555         // and the corresponding transient_timeout record from table b.
     553        /*
     554         * Deletes all expired transients. The multi-table delete syntax is used
     555         * to delete the transient record from table a, and the corresponding
     556         * transient_timeout record from table b.
     557         */
    556558        $time = time();
    557559        $sql = "DELETE a, b FROM $wpdb->options a, $wpdb->options b
    558560                WHERE a.option_name LIKE %s
     
    819821                $role->add_cap( 'list_users' );
    820822                $role->add_cap( 'remove_users' );
    821823
    822                 // Never used, will be removed. create_users or
    823                 // promote_users is the capability you're looking for.
     824                /*
     825                 * Never used, will be removed. create_users or promote_users
     826                 * is the capability you're looking for.
     827                 */
    824828                $role->add_cap( 'add_users' );
    825829
    826830                $role->add_cap( 'promote_users' );
     
    863867        if ( '' == $site_name )
    864868                $errors->add( 'empty_sitename', __( 'You must provide a name for your network of sites.' ) );
    865869
    866         // check for network collision
     870        // Check for network collision.
    867871        if ( $network_id == $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE id = %d", $network_id ) ) )
    868872                $errors->add( 'siteid_exists', __( 'The network already exists.' ) );
    869873
     
    874878        if ( $errors->get_error_code() )
    875879                return $errors;
    876880
    877         // set up site tables
     881        // Set up site tables.
    878882        $template = get_option( 'template' );
    879883        $stylesheet = get_option( 'stylesheet' );
    880884        $allowed_themes = array( $stylesheet => true );
     
    920924--The Team @ SITE_NAME' );
    921925
    922926        $misc_exts = array(
    923                 // images
     927                // Images.
    924928                'jpg', 'jpeg', 'png', 'gif',
    925                 // video
     929                // Video.
    926930                'mov', 'avi', 'mpg', '3gp', '3g2',
    927                 // "audio"
     931                // "audio".
    928932                'midi', 'mid',
    929                 // misc
     933                // Miscellaneous.
    930934                'pdf', 'doc', 'ppt', 'odt', 'pptx', 'docx', 'pps', 'ppsx', 'xls', 'xlsx', 'key',
    931935        );
    932936        $audio_exts = wp_get_audio_extensions();
     
    981985        }
    982986        $wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert );
    983987
    984         // When upgrading from single to multisite, assume the current site will become the main site of the network.
    985         // When using populate_network() to create another network in an existing multisite environment,
    986         // skip these steps since the main site of the new network has not yet been created.
     988        /*
     989         * When upgrading from single to multisite, assume the current site will
     990         * become the main site of the network. When using populate_network()
     991         * to create another network in an existing multisite environment, skip
     992         * these steps since the main site of the new network has not yet been
     993         * created.
     994         */
    987995        if ( ! is_multisite() ) {
    988996                $current_site = new stdClass;
    989997                $current_site->domain = $domain;
  • src/wp-admin/includes/template.php

     
    583583
    584584        if ( is_serialized( $entry['meta_value'] ) ) {
    585585                if ( is_serialized_string( $entry['meta_value'] ) ) {
    586                         // this is a serialized string, so we should display it
     586                        // This is a serialized string, so we should display it.
    587587                        $entry['meta_value'] = maybe_unserialize( $entry['meta_value'] );
    588588                } else {
    589                         // this is a serialized array/object so we should NOT display it
     589                        // This is a serialized array/object so we should NOT display it.
    590590                        --$count;
    591591                        return;
    592592                }
     
    716716        if ( (int) $tab_index > 0 )
    717717                $tab_index_attribute = " tabindex=\"$tab_index\"";
    718718
     719        // todo: Remove this?
    719720        // echo '<label for="timestamp" style="display: block;"><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp"'.$tab_index_attribute.' /> '.__( 'Edit timestamp' ).'</label><br />';
    720721
    721722        $time_adj = current_time('timestamp');
     
    940941                                // If core box previously deleted, don't add
    941942                                if ( false === $wp_meta_boxes[$page][$a_context][$a_priority][$id] )
    942943                                        return;
    943                                 // If box was added with default priority, give it core priority to maintain sort order
     944
     945                                /*
     946                                 * If box was added with default priority, give it core priority to
     947                                 * maintain sort order.
     948                                 */
    944949                                if ( 'default' == $a_priority ) {
    945950                                        $wp_meta_boxes[$page][$a_context]['core'][$id] = $wp_meta_boxes[$page][$a_context]['default'][$id];
    946951                                        unset($wp_meta_boxes[$page][$a_context]['default'][$id]);
    947952                                }
    948953                                return;
    949954                        }
    950                         // If no priority given and id already present, use existing priority
     955                        // If no priority given and id already present, use existing priority.
    951956                        if ( empty($priority) ) {
    952957                                $priority = $a_priority;
    953                         // else if we're adding to the sorted priority, we don't know the title or callback. Grab them from the previously added context/priority.
     958                        /*
     959                         * Else, if we're adding to the sorted priority, we don't know the title
     960                         * or callback. Grab them from the previously added context/priority.
     961                         */
    954962                        } elseif ( 'sorted' == $priority ) {
    955963                                $title = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['title'];
    956964                                $callback = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['callback'];
    957965                                $callback_args = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['args'];
    958966                        }
    959                         // An id can be in only one priority and one context
     967                        // An id can be in only one priority and one context.
    960968                        if ( $priority != $a_priority || $context != $a_context )
    961969                                unset($wp_meta_boxes[$page][$a_context][$a_priority][$id]);
    962970                }
     
    13401348function get_settings_errors( $setting = '', $sanitize = false ) {
    13411349        global $wp_settings_errors;
    13421350
    1343         // If $sanitize is true, manually re-run the sanitization for this option
    1344         // This allows the $sanitize_callback from register_setting() to run, adding
    1345         // any settings errors you want to show by default.
     1351        /*
     1352         * If $sanitize is true, manually re-run the sanitization for this option
     1353         * This allows the $sanitize_callback from register_setting() to run, adding
     1354         * any settings errors you want to show by default.
     1355         */
    13461356        if ( $sanitize )
    13471357                sanitize_option( $setting, get_option( $setting ) );
    13481358
    1349         // If settings were passed back from options.php then use them
     1359        // If settings were passed back from options.php then use them.
    13501360        if ( isset( $_GET['settings-updated'] ) && $_GET['settings-updated'] && get_transient( 'settings_errors' ) ) {
    13511361                $wp_settings_errors = array_merge( (array) $wp_settings_errors, get_transient( 'settings_errors' ) );
    13521362                delete_transient( 'settings_errors' );
    13531363        }
    13541364
    1355         // Check global in case errors have been added on this pageload
     1365        // Check global in case errors have been added on this pageload.
    13561366        if ( ! count( $wp_settings_errors ) )
    13571367                return array();
    13581368
    1359         // Filter the results to those of a specific setting if one was set
     1369        // Filter the results to those of a specific setting if one was set.
    13601370        if ( $setting ) {
    13611371                $setting_errors = array();
    13621372                foreach ( (array) $wp_settings_errors as $key => $details ) {
  • src/wp-admin/includes/update-core.php

     
    10891089                                        return new WP_Error( 'mkdir_failed__copy_dir', __( 'Could not create directory.' ), $to . $filename );
    10901090                        }
    10911091
    1092                         // generate the $sub_skip_list for the subdirectory as a sub-set of the existing $skip_list
     1092                        /*
     1093                         * Generate the $sub_skip_list for the subdirectory as a sub-set
     1094                         * of the existing $skip_list.
     1095                         */
    10931096                        $sub_skip_list = array();
    10941097                        foreach ( $skip_list as $skip_item ) {
    10951098                                if ( 0 === strpos( $skip_item, $filename . '/' ) )
     
    11251128        if ( 'do-core-upgrade' != $action && 'do-core-reinstall' != $action )
    11261129                return;
    11271130
    1128         // Load the updated default text localization domain for new strings
     1131        // Load the updated default text localization domain for new strings.
    11291132        load_default_textdomain();
    11301133
    11311134        // See do_core_upgrade()
     
    11411144</script>
    11421145        <?php
    11431146
    1144         // Include admin-footer.php and exit
     1147        // Include admin-footer.php and exit.
    11451148        include(ABSPATH . 'wp-admin/admin-footer.php');
    11461149        exit();
    11471150}
  • src/wp-admin/includes/upgrade.php

     
    6161        if ( ! $public )
    6262                update_option('default_pingback_flag', 0);
    6363
    64         // Create default user. If the user already exists, the user tables are
    65         // being shared among blogs. Just set the role in that case.
     64        /*
     65         * Create default user. If the user already exists, the user tables are
     66         * being shared among blogs. Just set the role in that case.
     67         */
    6668        $user_id = username_exists($user_name);
    6769        $user_password = trim($user_password);
    6870        $email_password = false;
     
    625627
    626628        $active_plugins = __get_option('active_plugins');
    627629
    628         // If plugins are not stored in an array, they're stored in the old
    629         // newline separated format. Convert to new format.
     630        /*
     631         * If plugins are not stored in an array, they're stored in the old
     632         * newline separated format. Convert to new format.
     633         */
    630634        if ( !is_array( $active_plugins ) ) {
    631635                $active_plugins = explode("\n", trim($active_plugins));
    632636                update_option('active_plugins', $active_plugins);
     
    716720                $wpdb->query("ALTER TABLE $wpdb->users DROP $old");
    717721        $wpdb->show_errors();
    718722
    719         // populate comment_count field of posts table
     723        // Populate comment_count field of posts table.
    720724        $comments = $wpdb->get_results( "SELECT comment_post_ID, COUNT(*) as c FROM $wpdb->comments WHERE comment_approved = '1' GROUP BY comment_post_ID" );
    721725        if ( is_array( $comments ) )
    722726                foreach ($comments as $comment)
    723727                        $wpdb->update( $wpdb->posts, array('comment_count' => $comment->c), array('ID' => $comment->comment_post_ID) );
    724728
    725         // Some alpha versions used a post status of object instead of attachment and put
    726         // the mime type in post_type instead of post_mime_type.
     729        /*
     730         * Some alpha versions used a post status of object instead of attachment
     731         * and put the mime type in post_type instead of post_mime_type.
     732         */
    727733        if ( $wp_current_db_version > 2541 && $wp_current_db_version <= 3091 ) {
    728734                $objects = $wpdb->get_results("SELECT ID, post_type FROM $wpdb->posts WHERE post_status = 'object'");
    729735                foreach ($objects as $object) {
     
    880886
    881887        // < 3570 we used linkcategories. >= 3570 we used categories and link2cat.
    882888        if ( $wp_current_db_version < 3570 ) {
    883                 // Create link_category terms for link categories. Create a map of link cat IDs
    884                 // to link_category terms.
     889                /*
     890                 * Create link_category terms for link categories. Create a map of link
     891                 * cat IDs to link_category terms.
     892                 */
    885893                $link_cat_id_map = array();
    886894                $default_link_cat = 0;
    887895                $tt_ids = array();
     
    989997 * @since 2.2.0
    990998 */
    991999function upgrade_old_slugs() {
    992         // upgrade people who were using the Redirect Old Slugs plugin
     1000        // Upgrade people who were using the Redirect Old Slugs plugin.
    9931001        global $wpdb;
    9941002        $wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '_wp_old_slug' WHERE meta_key = 'old_slug'");
    9951003}
     
    13041312function upgrade_network() {
    13051313        global $wp_current_db_version, $wpdb;
    13061314
    1307         // Always
     1315        // Always.
    13081316        if ( is_main_network() ) {
    1309                 // Deletes all expired transients.
    1310                 // The multi-table delete syntax is used to delete the transient record from table a,
    1311                 // and the corresponding transient_timeout record from table b.
     1317                /*
     1318                 * Deletes all expired transients. The multi-table delete syntax is used
     1319                 * to delete the transient record from table a, and the corresponding
     1320                 * transient_timeout record from table b.
     1321                 */
    13121322                $time = time();
    13131323                $sql = "DELETE a, b FROM $wpdb->sitemeta a, $wpdb->sitemeta b
    13141324                        WHERE a.meta_key LIKE %s
     
    13181328                $wpdb->query( $wpdb->prepare( $sql, $wpdb->esc_like( '_site_transient_' ) . '%', $wpdb->esc_like ( '_site_transient_timeout_' ) . '%', $time ) );
    13191329        }
    13201330
    1321         // 2.8
     1331        // 2.8.
    13221332        if ( $wp_current_db_version < 11549 ) {
    13231333                $wpmu_sitewide_plugins = get_site_option( 'wpmu_sitewide_plugins' );
    13241334                $active_sitewide_plugins = get_site_option( 'active_sitewide_plugins' );
     
    14151425        if ( $wpdb->get_var( $query ) == $table_name ) {
    14161426                return true;
    14171427        }
    1418         //didn't find it try to create it.
     1428
     1429        // Didn't find it try to create it..
    14191430        $wpdb->query($create_ddl);
    1420         // we cannot directly tell that whether this succeeded!
     1431
     1432        // We cannot directly tell that whether this succeeded!
    14211433        if ( $wpdb->get_var( $query ) == $table_name ) {
    14221434                return true;
    14231435        }
     
    14781490                        return true;
    14791491                }
    14801492        }
    1481         //didn't find it try to create it.
     1493
     1494        // Didn't find it try to create it.
    14821495        $wpdb->query($create_ddl);
    1483         // we cannot directly tell that whether this succeeded!
     1496
     1497        // We cannot directly tell that whether this succeeded!
    14841498        foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
    14851499                if ($column == $column_name) {
    14861500                        return true;
     
    15511565function deslash($content) {
    15521566        // Note: \\\ inside a regex denotes a single backslash.
    15531567
    1554         // Replace one or more backslashes followed by a single quote with
    1555         // a single quote.
     1568        /*
     1569         * Replace one or more backslashes followed by a single quote with
     1570         * a single quote.
     1571         */
    15561572        $content = preg_replace("/\\\+'/", "'", $content);
    15571573
    1558         // Replace one or more backslashes followed by a double quote with
    1559         // a double quote.
     1574        /*
     1575         * Replace one or more backslashes followed by a double quote with
     1576         * a double quote.
     1577         */
    15601578        $content = preg_replace('/\\\+"/', '"', $content);
    15611579
    15621580        // Replace one or more backslashes with one backslash.
     
    16551673                if ( ! $tablefields )
    16561674                        continue;
    16571675
    1658                 // Clear the field and index arrays
     1676                // Clear the field and index arrays.
    16591677                $cfields = $indices = array();
    1660                 // Get all of the field names in the query from between the parens
     1678
     1679                // Get all of the field names in the query from between the parentheses.
    16611680                preg_match("|\((.*)\)|ms", $qry, $match2);
    16621681                $qryline = trim($match2[1]);
    16631682
    1664                 // Separate field lines into an array
     1683                // Separate field lines into an array.
    16651684                $flds = explode("\n", $qryline);
    16661685
     1686                // todo: Remove this?
    16671687                //echo "<hr/><pre>\n".print_r(strtolower($table), true).":\n".print_r($cqueries, true)."</pre><hr/>";
    16681688
    1669                 // For every field line specified in the query
     1689                // For every field line specified in the query.
    16701690                foreach ($flds as $fld) {
    1671                         // Extract the field name
     1691
     1692                        // Extract the field name.
    16721693                        preg_match("|^([^ ]*)|", trim($fld), $fvals);
    16731694                        $fieldname = trim( $fvals[1], '`' );
    16741695
    1675                         // Verify the found field name
     1696                        // Verify the found field name.
    16761697                        $validfield = true;
    16771698                        switch (strtolower($fieldname)) {
    16781699                        case '':
     
    16871708                        }
    16881709                        $fld = trim($fld);
    16891710
    1690                         // If it's a valid field, add it to the field array
     1711                        // If it's a valid field, add it to the field array.
    16911712                        if ($validfield) {
    16921713                                $cfields[strtolower($fieldname)] = trim($fld, ", \n");
    16931714                        }
    16941715                }
    16951716
    1696                 // For every field in the table
     1717                // For every field in the table.
    16971718                foreach ($tablefields as $tablefield) {
    1698                         // If the table field exists in the field array...
     1719
     1720                        // If the table field exists in the field array ...
    16991721                        if (array_key_exists(strtolower($tablefield->Field), $cfields)) {
    1700                                 // Get the field type from the query
     1722
     1723                                // Get the field type from the query.
    17011724                                preg_match("|".$tablefield->Field." ([^ ]*( unsigned)?)|i", $cfields[strtolower($tablefield->Field)], $matches);
    17021725                                $fieldtype = $matches[1];
    17031726
     
    17091732                                }
    17101733
    17111734                                // Get the default value from the array
     1735                                        // todo: Remove this?
    17121736                                        //echo "{$cfields[strtolower($tablefield->Field)]}<br>";
    17131737                                if (preg_match("| DEFAULT '(.*?)'|i", $cfields[strtolower($tablefield->Field)], $matches)) {
    17141738                                        $default_value = $matches[1];
     
    17191743                                        }
    17201744                                }
    17211745
    1722                                 // Remove the field from the array (so it's not added)
     1746                                // Remove the field from the array (so it's not added).
    17231747                                unset($cfields[strtolower($tablefield->Field)]);
    17241748                        } else {
    17251749                                // This field exists in the table, but not in the creation queries?
    17261750                        }
    17271751                }
    17281752
    1729                 // For every remaining field specified for the table
     1753                // For every remaining field specified for the table.
    17301754                foreach ($cfields as $fieldname => $fielddef) {
    1731                         // Push a query line into $cqueries that adds the field to that table
     1755                        // Push a query line into $cqueries that adds the field to that table.
    17321756                        $cqueries[] = "ALTER TABLE {$table} ADD COLUMN $fielddef";
    17331757                        $for_update[$table.'.'.$fieldname] = 'Added column '.$table.'.'.$fieldname;
    17341758                }
    17351759
    1736                 // Index stuff goes here
    1737                 // Fetch the table index structure from the database
     1760                // Index stuff goes here. Fetch the table index structure from the database.
    17381761                $tableindices = $wpdb->get_results("SHOW INDEX FROM {$table};");
    17391762
    17401763                if ($tableindices) {
    1741                         // Clear the index array
     1764                        // Clear the index array.
    17421765                        unset($index_ary);
    17431766
    1744                         // For every index in the table
     1767                        // For every index in the table.
    17451768                        foreach ($tableindices as $tableindex) {
    1746                                 // Add the index to the index data array
     1769
     1770                                // Add the index to the index data array.
    17471771                                $keyname = $tableindex->Key_name;
    17481772                                $index_ary[$keyname]['columns'][] = array('fieldname' => $tableindex->Column_name, 'subpart' => $tableindex->Sub_part);
    17491773                                $index_ary[$keyname]['unique'] = ($tableindex->Non_unique == 0)?true:false;
    17501774                        }
    17511775
    1752                         // For each actual index in the index array
     1776                        // For each actual index in the index array.
    17531777                        foreach ($index_ary as $index_name => $index_data) {
    1754                                 // Build a create string to compare to the query
     1778
     1779                                // Build a create string to compare to the query.
    17551780                                $index_string = '';
    17561781                                if ($index_name == 'PRIMARY') {
    17571782                                        $index_string .= 'PRIMARY ';
     
    17631788                                        $index_string .= $index_name;
    17641789                                }
    17651790                                $index_columns = '';
    1766                                 // For each column in the index
     1791
     1792                                // For each column in the index.
    17671793                                foreach ($index_data['columns'] as $column_data) {
    17681794                                        if ($index_columns != '') $index_columns .= ',';
    1769                                         // Add the field to the column list string
     1795
     1796                                        // Add the field to the column list string.
    17701797                                        $index_columns .= $column_data['fieldname'];
    17711798                                        if ($column_data['subpart'] != '') {
    17721799                                                $index_columns .= '('.$column_data['subpart'].')';
    17731800                                        }
    17741801                                }
    1775                                 // Add the column list to the index create string
     1802                                // Add the column list to the index create string.
    17761803                                $index_string .= ' ('.$index_columns.')';
    17771804                                if (!(($aindex = array_search($index_string, $indices)) === false)) {
    17781805                                        unset($indices[$aindex]);
     1806                                        // todo: Remove this?
    17791807                                        //echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">{$table}:<br />Found index:".$index_string."</pre>\n";
    17801808                                }
     1809                                // todo: Remove this?
    17811810                                //else echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">{$table}:<br /><b>Did not find index:</b>".$index_string."<br />".print_r($indices, true)."</pre>\n";
    17821811                        }
    17831812                }
    17841813
    1785                 // For every remaining index specified for the table
     1814                // For every remaining index specified for the table.
    17861815                foreach ( (array) $indices as $index ) {
    1787                         // Push a query line into $cqueries that adds the index to that table
     1816                        // Push a query line into $cqueries that adds the index to that table.
    17881817                        $cqueries[] = "ALTER TABLE {$table} ADD $index";
    17891818                        $for_update[] = 'Added index ' . $table . ' ' . $index;
    17901819                }
    17911820
    1792                 // Remove the original table creation query from processing
     1821                // Remove the original table creation query from processing.
    17931822                unset( $cqueries[ $table ], $for_update[ $table ] );
    17941823        }
    17951824
    17961825        $allqueries = array_merge($cqueries, $iqueries);
    17971826        if ($execute) {
    17981827                foreach ($allqueries as $query) {
     1828                        // todo: Remove this?
    17991829                        //echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">".print_r($query, true)."</pre>\n";
    18001830                        $wpdb->query($query);
    18011831                }
     
    18471877        if (! file_exists("$home_path/index.php"))
    18481878                return false;
    18491879
    1850         // Copy files from the old locations to the site theme.
    1851         // TODO: This does not copy arbitrary include dependencies. Only the
    1852         // standard WP files are copied.
     1880        /*
     1881         * Copy files from the old locations to the site theme.
     1882         * TODO: This does not copy arbitrary include dependencies. Only the standard WP files are copied.
     1883         */
    18531884        $files = array('index.php' => 'index.php', 'wp-layout.css' => 'style.css', 'wp-comments.php' => 'comments.php', 'wp-comments-popup.php' => 'comments-popup.php');
    18541885
    18551886        foreach ($files as $oldfile => $newfile) {
     
    18581889                else
    18591890                        $oldpath = ABSPATH;
    18601891
    1861                 if ($oldfile == 'index.php') { // Check to make sure it's not a new index
     1892                // Check to make sure it's not a new index.
     1893                if ($oldfile == 'index.php') {
    18621894                        $index = implode('', file("$oldpath/$oldfile"));
    18631895                        if (strpos($index, 'WP_USE_THEMES') !== false) {
    18641896                                if (! @copy(WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME . '/index.php', "$site_dir/$newfile"))
    18651897                                        return false;
    1866                                 continue; // Don't copy anything
     1898
     1899                                // Don't copy anything.
     1900                                continue;
    18671901                                }
    18681902                }
    18691903
  • src/wp-admin/includes/user.php

     
    390390 */
    391391function default_password_nag_handler($errors = false) {
    392392        global $user_ID;
    393         if ( ! get_user_option('default_password_nag') ) //Short circuit it.
     393        // Short-circuit it.
     394        if ( ! get_user_option('default_password_nag') )
    394395                return;
    395396
    396         //get_user_setting = JS saved UI setting. else no-js-fallback code.
     397        // get_user_setting = JS saved UI setting. else no-js-fallback code.
    397398        if ( 'hide' == get_user_setting('default_password_nag') || isset($_GET['default_password_nag']) && '0' == $_GET['default_password_nag'] ) {
    398399                delete_user_setting('default_password_nag');
    399400                update_user_option($user_ID, 'default_password_nag', false, true);
     
    401402}
    402403
    403404add_action('profile_update', 'default_password_nag_edit_user', 10, 2);
     405
    404406/**
    405407 * @since 2.8.0
    406408 */
    407409function default_password_nag_edit_user($user_ID, $old_data) {
    408         if ( ! get_user_option('default_password_nag', $user_ID) ) //Short circuit it.
     410        // Short-circuit it.
     411        if ( ! get_user_option('default_password_nag', $user_ID) )
    409412                return;
    410413
    411414        $new_data = get_userdata($user_ID);
    412415
    413         if ( $new_data->user_pass != $old_data->user_pass ) { //Remove the nag if the password has been changed.
     416        // Remove the nag if the password has been changed.
     417        if ( $new_data->user_pass != $old_data->user_pass ) {
    414418                delete_user_setting('default_password_nag');
    415419                update_user_option($user_ID, 'default_password_nag', false, true);
    416420        }
    417421}
    418422
    419423add_action('admin_notices', 'default_password_nag');
     424
    420425/**
    421426 * @since 2.8.0
    422427 */
    423428function default_password_nag() {
    424429        global $pagenow;
    425         if ( 'profile.php' == $pagenow || ! get_user_option('default_password_nag') ) //Short circuit it.
     430        // Short-circuit it.
     431        if ( 'profile.php' == $pagenow || ! get_user_option('default_password_nag') )
    426432                return;
    427433
    428434        echo '<div class="error default-password-nag">';
  • src/wp-admin/includes/widgets.php

     
    173173                $query_arg['key'] = $key;
    174174        }
    175175
    176         // We aren't showing a widget control, we're outputting a template for a multi-widget control
     176        /*
     177         * We aren't showing a widget control, we're outputting a template
     178         * for a multi-widget control.
     179         */
    177180        if ( isset($sidebar_args['_display']) && 'template' == $sidebar_args['_display'] && $widget_number ) {
    178181                // number == -1 implies a template where id numbers are replaced by a generic '__i__'
    179182                $control['params'][0]['number'] = -1;
    180                 // with id_base widget id's are constructed like {$id_base}-{$id_number}
     183                // With id_base widget id's are constructed like {$id_base}-{$id_number}.
    181184                if ( isset($control['id_base']) )
    182185                        $id_format = $control['id_base'] . '-__i__';
    183186        }
  • src/wp-admin/install-helper.php

     
    5757                        return true;
    5858                }
    5959        }
    60         //didn't find it try to create it.
     60        // Didn't find it, so try to create it.
    6161        $wpdb->query($create_ddl);
    62         // we cannot directly tell that whether this succeeded!
     62
     63        // We cannot directly tell that whether this succeeded!
    6364        foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
    6465                if ($table == $table_name) {
    6566                        return true;
     
    9091                        return true;
    9192                }
    9293        }
    93         //didn't find it try to create it.
     94
     95        // Didn't find it, so try to create it.
    9496        $wpdb->query($create_ddl);
    95         // we cannot directly tell that whether this succeeded!
     97
     98        // We cannot directly tell that whether this succeeded!
    9699        foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
    97100                if ($column == $column_name) {
    98101                        return true;
     
    118121        global $wpdb;
    119122        foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
    120123                if ($column == $column_name) {
    121                         //found it try to drop it.
     124
     125                        // Found it, so try to drop it.
    122126                        $wpdb->query($drop_ddl);
    123                         // we cannot directly tell that whether this succeeded!
     127
     128                        // We cannot directly tell that whether this succeeded!
    124129                        foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
    125130                                if ($column == $column_name) {
    126131                                        return false;
     
    128133                        }
    129134                }
    130135        }
    131         // else didn't find it
     136        // Else didn't find it.
    132137        return true;
    133138}
    134139
     
    167172        foreach ($results as $row ) {
    168173
    169174                if ($row->Field == $col_name) {
    170                         // got our column, check the params
     175
     176                        // Got our column, check the params.
    171177                        if (($col_type != null) && ($row->Type != $col_type)) {
    172178                                ++$diffs;
    173179                        }
  • src/wp-admin/install.php

     
    222222                $admin_password_check = isset($_POST['admin_password2']) ? wp_unslash( $_POST['admin_password2'] ) : '';
    223223                $admin_email  = isset( $_POST['admin_email']  ) ?trim( wp_unslash( $_POST['admin_email'] ) ) : '';
    224224                $public       = isset( $_POST['blog_public']  ) ? (int) $_POST['blog_public'] : 0;
    225                 // check e-mail address
     225
     226                // Check e-mail address.
    226227                $error = false;
    227228                if ( empty( $user_name ) ) {
    228229                        // TODO: poka-yoke
  • src/wp-admin/link-parse-opml.php

     
    4545                if ( isset( $attrs['HTMLURL'] ) ) {
    4646                        $url = $attrs['HTMLURL'];
    4747                }
    48                 // save the data away.
     48
     49                // Save the data away.
    4950                $names[] = $name;
    5051                $urls[] = $url;
    5152                $targets[] = isset( $attrs['TARGET'] ) ? $attrs['TARGET'] :  '';
    5253                $feeds[] = isset( $attrs['XMLURL'] ) ? $attrs['XMLURL'] :  '';
    5354                $descriptions[] = isset( $attrs['DESCRIPTION'] ) ? $attrs['DESCRIPTION'] :  '';
    54         } // end if outline
     55        } // End if outline.
    5556}
    5657
    5758/**
     
    6465 * @param string $tagName XML tag name.
    6566 */
    6667function endElement($parser, $tagName) {
    67         // nothing to do.
     68        // Nothing to do.
    6869}
    6970
    7071// Create an XML parser
  • src/wp-admin/link.php

     
    3030        case 'deletebookmarks' :
    3131                check_admin_referer('bulk-bookmarks');
    3232
    33                 //for each link id (in $linkcheck[]) change category to selected value
     33                // For each link id (in $linkcheck[]) change category to selected value.
    3434                if (count($linkcheck) == 0) {
    3535                        wp_redirect($this_file);
    3636                        exit;
     
    5050        case 'move' :
    5151                check_admin_referer('bulk-bookmarks');
    5252
    53                 //for each link id (in $linkcheck[]) change category to selected value
     53                // For each link id (in $linkcheck[]) change category to selected value.
    5454                if (count($linkcheck) == 0) {
    5555                        wp_redirect($this_file);
    5656                        exit;
    5757                }
    5858                $all_links = join(',', $linkcheck);
    59                 // should now have an array of links we can change
    60                 //$q = $wpdb->query("update $wpdb->links SET link_category='$category' WHERE link_id IN ($all_links)");
     59                /*
     60                 * Should now have an array of links we can change:
     61                 *     $q = $wpdb->query("update $wpdb->links SET link_category='$category' WHERE link_id IN ($all_links)");
     62                 */
    6163
    6264                wp_redirect($this_file);
    6365                exit;
  • src/wp-admin/media-upload.php

     
    3030$ID = isset($ID) ? (int) $ID : 0;
    3131$post_id = isset($post_id)? (int) $post_id : 0;
    3232
    33 // Require an ID for the edit screen
     33// Require an ID for the edit screen.
    3434if ( isset($action) && $action == 'edit' && !$ID )
    3535        wp_die( __( 'Cheatin&#8217; uh?' ) );
    3636
    3737        if ( ! empty( $_REQUEST['post_id'] ) && ! current_user_can( 'edit_post' , $_REQUEST['post_id'] ) )
    3838                wp_die( __( 'Cheatin&#8217; uh?' ) );
    3939
    40         // upload type: image, video, file, ..?
     40        // Upload type: image, video, file, ..?
    4141        if ( isset($_GET['type']) ) {
    4242                $type = strval($_GET['type']);
    4343        } else {
     
    5252                $type = apply_filters( 'media_upload_default_type', 'file' );
    5353        }
    5454
    55         // tab: gallery, library, or type-specific
     55        // Tab: gallery, library, or type-specific.
    5656        if ( isset($_GET['tab']) ) {
    5757                $tab = strval($_GET['tab']);
    5858        } else {
     
    6868
    6969        $body_id = 'media-upload';
    7070
    71         // let the action code decide how to handle the request
     71        // Let the action code decide how to handle the request.
    7272        if ( $tab == 'type' || $tab == 'type_url' || ! array_key_exists( $tab , media_upload_tabs() ) ) {
    7373                /**
    7474                 * Fires inside specific upload-type views in the legacy (pre-3.5.0)
  • src/wp-admin/media.php

     
    4040                exit;
    4141        }
    4242
    43         // no break
     43        // No break.
    4444case 'edit' :
    4545        $title = __('Edit Media');
    4646
  • src/wp-admin/menu-header.php

     
    8080                $img = $img_style = '';
    8181                $img_class = ' dashicons-before';
    8282
    83                 // if the string 'none' (previously 'div') is passed instead of an URL, don't output the default menu image
    84                 // so an icon can be added to div.wp-menu-image as background with CSS.
    85                 // Dashicons and base64-encoded data:image/svg_xml URIs are also handled as special cases.
     83                /*
     84                 * If the string 'none' (previously 'div') is passed instead of an URL, don't output
     85                 * the default menu image so an icon can be added to div.wp-menu-image as background
     86                 * with CSS. Dashicons and base64-encoded data:image/svg_xml URIs are also handled
     87                 * as special cases.
     88                 */
    8689                if ( ! empty( $item[6] ) ) {
    8790                        $img = '<img src="' . $item[6] . '" alt="" />';
    8891
  • src/wp-admin/menu.php

     
    121121                $ptype_class = 'post';
    122122        }
    123123
    124         // if $ptype_menu_position is already populated or will be populated by a hard-coded value below, increment the position.
     124        /*
     125         * If $ptype_menu_position is already populated or will be populated
     126         * by a hard-coded value below, increment the position.
     127         */
    125128        $core_menu_positions = array(59, 60, 65, 70, 75, 80, 85, 99);
    126129        while ( isset($menu[$ptype_menu_position]) || in_array($ptype_menu_position, $core_menu_positions) )
    127130                $ptype_menu_position++;
  • src/wp-admin/nav-menus.php

     
    5353                        wp_save_nav_menu_items( $nav_menu_selected_id, $_REQUEST['menu-item'] );
    5454                break;
    5555        case 'move-down-menu-item' :
    56                 // moving down a menu item is the same as moving up the next in order
     56
     57                // Moving down a menu item is the same as moving up the next in order.
    5758                check_admin_referer( 'move-menu_item' );
    5859                $menu_item_id = isset( $_REQUEST['menu-item'] ) ? (int) $_REQUEST['menu-item'] : 0;
    5960                if ( is_nav_menu_item( $menu_item_id ) ) {
     
    6364                                $ordered_menu_items = wp_get_nav_menu_items( $menu_id );
    6465                                $menu_item_data = (array) wp_setup_nav_menu_item( get_post( $menu_item_id ) );
    6566
    66                                 // set up the data we need in one pass through the array of menu items
     67                                // Set up the data we need in one pass through the array of menu items.
    6768                                $dbids_to_orders = array();
    6869                                $orders_to_dbids = array();
    6970                                foreach( (array) $ordered_menu_items as $ordered_menu_item_object ) {
     
    7576                                        }
    7677                                }
    7778
    78                                 // get next in order
     79                                // Get next in order.
    7980                                if (
    8081                                        isset( $orders_to_dbids[$dbids_to_orders[$menu_item_id] + 1] )
    8182                                ) {
    8283                                        $next_item_id = $orders_to_dbids[$dbids_to_orders[$menu_item_id] + 1];
    8384                                        $next_item_data = (array) wp_setup_nav_menu_item( get_post( $next_item_id ) );
    8485
    85                                         // if not siblings of same parent, bubble menu item up but keep order
     86                                        // If not siblings of same parent, bubble menu item up but keep order.
    8687                                        if (
    8788                                                ! empty( $menu_item_data['menu_item_parent'] ) &&
    8889                                                (
     
    102103
    103104                                                }
    104105
    105                                         // make menu item a child of its next sibling
     106                                        // Make menu item a child of its next sibling.
    106107                                        } else {
    107108                                                $next_item_data['menu_order'] = $next_item_data['menu_order'] - 1;
    108109                                                $menu_item_data['menu_order'] = $menu_item_data['menu_order'] + 1;
     
    114115                                                wp_update_post($next_item_data);
    115116                                        }
    116117
    117                                 // the item is last but still has a parent, so bubble up
     118                                // The item is last but still has a parent, so bubble up.
    118119                                } elseif (
    119120                                        ! empty( $menu_item_data['menu_item_parent'] ) &&
    120121                                        in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids )
     
    136137                                $ordered_menu_items = wp_get_nav_menu_items( $menu_id );
    137138                                $menu_item_data = (array) wp_setup_nav_menu_item( get_post( $menu_item_id ) );
    138139
    139                                 // set up the data we need in one pass through the array of menu items
     140                                // Set up the data we need in one pass through the array of menu items.
    140141                                $dbids_to_orders = array();
    141142                                $orders_to_dbids = array();
    142143                                foreach( (array) $ordered_menu_items as $ordered_menu_item_object ) {
     
    148149                                        }
    149150                                }
    150151
    151                                 // if this menu item is not first
     152                                // If this menu item is not first.
    152153                                if ( ! empty( $dbids_to_orders[$menu_item_id] ) && ! empty( $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] ) ) {
    153154
    154                                         // if this menu item is a child of the previous
     155                                        // If this menu item is a child of the previous.
    155156                                        if (
    156157                                                ! empty( $menu_item_data['menu_item_parent'] ) &&
    157158                                                in_array( $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders ) ) &&
     
    164165                                                if ( ! is_wp_error( $parent_object ) ) {
    165166                                                        $parent_data = (array) $parent_object;
    166167
    167                                                         // if there is something before the parent and parent a child of it, make menu item a child also of it
     168                                                        /*
     169                                                         * If there is something before the parent and parent a child of it,
     170                                                         * make menu item a child also of it.
     171                                                         */
    168172                                                        if (
    169173                                                                ! empty( $dbids_to_orders[$parent_db_id] ) &&
    170174                                                                ! empty( $orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1] ) &&
     
    172176                                                        ) {
    173177                                                                $menu_item_data['menu_item_parent'] = $parent_data['menu_item_parent'];
    174178
    175                                                         // else if there is something before parent and parent not a child of it, make menu item a child of that something's parent
     179                                                        /*
     180                                                         * Else if there is something before parent and parent not a child of it,
     181                                                         * make menu item a child of that something's parent
     182                                                         */
    176183                                                        } elseif (
    177184                                                                ! empty( $dbids_to_orders[$parent_db_id] ) &&
    178185                                                                ! empty( $orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1] )
     
    183190                                                                else
    184191                                                                        $menu_item_data['menu_item_parent'] = 0;
    185192
    186                                                         // else there isn't something before the parent
     193                                                        // Else there isn't something before the parent.
    187194                                                        } else {
    188195                                                                $menu_item_data['menu_item_parent'] = 0;
    189196                                                        }
    190197
    191                                                         // set former parent's [menu_order] to that of menu-item's
     198                                                        // Set former parent's [menu_order] to that of menu-item's.
    192199                                                        $parent_data['menu_order'] = $parent_data['menu_order'] + 1;
    193200
    194                                                         // set menu-item's [menu_order] to that of former parent
     201                                                        // Set menu-item's [menu_order] to that of former parent.
    195202                                                        $menu_item_data['menu_order'] = $menu_item_data['menu_order'] - 1;
    196203
    197                                                         // save changes
     204                                                        // Save changes.
    198205                                                        update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
    199206                                                        wp_update_post($menu_item_data);
    200207                                                        wp_update_post($parent_data);
    201208                                                }
    202209
    203                                         // else this menu item is not a child of the previous
     210                                        // Else this menu item is not a child of the previous.
    204211                                        } elseif (
    205212                                                empty( $menu_item_data['menu_order'] ) ||
    206213                                                empty( $menu_item_data['menu_item_parent'] ) ||
     
    208215                                                empty( $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] ) ||
    209216                                                $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] != $menu_item_data['menu_item_parent']
    210217                                        ) {
    211                                                 // just make it a child of the previous; keep the order
     218                                                // Just make it a child of the previous; keep the order.
    212219                                                $menu_item_data['menu_item_parent'] = (int) $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1];
    213220                                                update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
    214221                                                wp_update_post($menu_item_data);
     
    232239                if ( is_nav_menu( $nav_menu_selected_id ) ) {
    233240                        $deletion = wp_delete_nav_menu( $nav_menu_selected_id );
    234241                } else {
    235                         // Reset the selected menu
     242                        // Reset the selected menu.
    236243                        $nav_menu_selected_id = 0;
    237244                        unset( $_REQUEST['menu'] );
    238245                }
     
    266273        case 'update':
    267274                check_admin_referer( 'update-nav_menu', 'update-nav-menu-nonce' );
    268275
    269                 // Remove menu locations that have been unchecked
     276                // Remove menu locations that have been unchecked.
    270277                foreach ( $locations as $location => $description ) {
    271278                        if ( ( empty( $_POST['menu-locations'] ) || empty( $_POST['menu-locations'][ $location ] ) ) && isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $nav_menu_selected_id )
    272279                                unset( $menu_locations[ $location ] );
    273280                }
    274281
    275                 // Merge new and existing menu locations if any new ones are set
     282                // Merge new and existing menu locations if any new ones are set.
    276283                if ( isset( $_POST['menu-locations'] ) ) {
    277284                        $new_menu_locations = array_map( 'absint', $_POST['menu-locations'] );
    278285                        $menu_locations = array_merge( $menu_locations, $new_menu_locations );
    279286                }
    280287
    281                 // Set menu locations
     288                // Set menu locations.
    282289                set_theme_mod( 'nav_menu_locations', $menu_locations );
    283290
    284                 // Add Menu
     291                // Add Menu.
    285292                if ( 0 == $nav_menu_selected_id ) {
    286293                        $new_menu_title = trim( esc_html( $_POST['menu-name'] ) );
    287294
     
    314321                                                        $menu_locations[ $_REQUEST['use-location'] ] = $nav_menu_selected_id;
    315322                                                set_theme_mod( 'nav_menu_locations', $menu_locations );
    316323                                        }
     324
    317325                                        // $messages[] = '<div id="message" class="updated"><p>' . sprintf( __( '<strong>%s</strong> has been created.' ), $nav_menu_selected_title ) . '</p></div>';
    318326                                        wp_redirect( admin_url( 'nav-menus.php?menu=' . $_nav_menu_selected_id ) );
    319327                                        exit();
     
    322330                                $messages[] = '<div id="message" class="error"><p>' . __( 'Please enter a valid menu name.' ) . '</p></div>';
    323331                        }
    324332
    325                 // Update existing menu
     333                // Update existing menu.
    326334                } else {
    327335
    328336                        $_menu_object = wp_get_nav_menu_object( $nav_menu_selected_id );
     
    344352                                }
    345353                        }
    346354
    347                         // Update menu items
     355                        // Update menu items.
    348356                        if ( ! is_wp_error( $_menu_object ) ) {
    349357                                $messages = array_merge( $messages, wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selected_title ) );
    350358                        }
     
    371379                break;
    372380}
    373381
    374 // Get all nav menus
     382// Get all nav menus.
    375383$nav_menus = wp_get_nav_menus( array('orderby' => 'name') );
    376384$menu_count = count( $nav_menus );
    377385
     
    380388
    381389$locations_screen = ( isset( $_GET['action'] ) && 'locations' == $_GET['action'] ) ? true : false;
    382390
    383 // If we have one theme location, and zero menus, we take them right into editing their first menu
     391/*
     392 * If we have one theme location, and zero menus, we take them right
     393 * into editing their first menu.
     394 */
    384395$page_count = wp_count_posts( 'page' );
    385396$one_theme_location_no_menus = ( 1 == count( get_registered_nav_menus() ) && ! $add_new_screen && empty( $nav_menus ) && ! empty( $page_count->publish ) ) ? true : false;
    386397
     
    404415);
    405416wp_localize_script( 'nav-menu', 'menus', $nav_menus_l10n );
    406417
    407 // Redirect to add screen if there are no menus and this users has either zero, or more than 1 theme locations
     418/*
     419 * Redirect to add screen if there are no menus and this users has either zero,
     420 * or more than 1 theme locations.
     421 */
    408422if ( 0 == $menu_count && ! $add_new_screen && ! $one_theme_location_no_menus )
    409423        wp_redirect( admin_url( 'nav-menus.php?action=edit&menu=0' ) );
    410424
    411 // Get recently edited nav menu
     425// Get recently edited nav menu.
    412426$recently_edited = absint( get_user_option( 'nav_menu_recently_edited' ) );
    413427if ( empty( $recently_edited ) && is_nav_menu( $nav_menu_selected_id ) )
    414428        $recently_edited = $nav_menu_selected_id;
    415429
    416 // Use $recently_edited if none are selected
     430// Use $recently_edited if none are selected.
    417431if ( empty( $nav_menu_selected_id ) && ! isset( $_GET['menu'] ) && is_nav_menu( $recently_edited ) )
    418432        $nav_menu_selected_id = $recently_edited;
    419433
    420 // On deletion of menu, if another menu exists, show it
     434// On deletion of menu, if another menu exists, show it.
    421435if ( ! $add_new_screen && 0 < $menu_count && isset( $_GET['action'] ) && 'delete' == $_GET['action'] )
    422436        $nav_menu_selected_id = $nav_menus[0]->term_id;
    423437
    424 // Set $nav_menu_selected_id to 0 if no menus
     438// Set $nav_menu_selected_id to 0 if no menus.
    425439if ( $one_theme_location_no_menus ) {
    426440        $nav_menu_selected_id = 0;
    427441} elseif ( empty( $nav_menu_selected_id ) && ! empty( $nav_menus ) && ! $add_new_screen ) {
    428         // if we have no selection yet, and we have menus, set to the first one in the list
     442        // if we have no selection yet, and we have menus, set to the first one in the list.
    429443        $nav_menu_selected_id = $nav_menus[0]->term_id;
    430444}
    431445
    432 // Update the user's setting
     446// Update the user's setting.
    433447if ( $nav_menu_selected_id != $recently_edited && is_nav_menu( $nav_menu_selected_id ) )
    434448        update_user_meta( $current_user->ID, 'nav_menu_recently_edited', $nav_menu_selected_id );
    435449
     
    439453        $nav_menu_selected_title = ! is_wp_error( $_menu_object ) ? $_menu_object->name : '';
    440454}
    441455
    442 // Generate truncated menu names
     456// Generate truncated menu names.
    443457foreach( (array) $nav_menus as $key => $_nav_menu ) {
    444458        $nav_menus[$key]->truncated_name = wp_html_excerpt( $_nav_menu->name, 40, '&hellip;' );
    445459}
    446460
    447 // Retrieve menu locations
     461// Retrieve menu locations.
    448462if ( current_theme_supports( 'menus' ) ) {
    449463        $locations = get_registered_nav_menus();
    450464        $menu_locations = get_nav_menu_locations();
    451465}
    452466
    453 // Ensure the user will be able to scroll horizontally
    454 // by adding a class for the max menu depth.
     467/*
     468 * Ensure the user will be able to scroll horizontally
     469 * by adding a class for the max menu depth.
     470 */
    455471global $_wp_nav_menu_max_depth;
    456472$_wp_nav_menu_max_depth = 0;
    457473
    458 // Calling wp_get_nav_menu_to_edit generates $_wp_nav_menu_max_depth
     474// Calling wp_get_nav_menu_to_edit generates $_wp_nav_menu_max_depth.
    459475if ( is_nav_menu( $nav_menu_selected_id ) ) {
    460476        $menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array( 'post_status' => 'any' ) );
    461477        $edit_markup = wp_get_nav_menu_to_edit( $nav_menu_selected_id );
     
    510526                'title'   => __( 'Editing Menus' ),
    511527                'content' => $editing_menus
    512528        ) );
    513 else : // Locations Tab
     529else : // Locations Tab.
    514530        $locations_overview  = '<p>' . __( 'This screen is used for globally assigning menus to locations defined by your theme.' ) . '</p>';
    515531        $locations_overview .= '<ul><li>' . __( 'To assign menus to one or more theme locations, <strong>select a menu from each location&#8217;s drop down.</strong> When you&#8217;re finished, <strong>click Save Changes</strong>' ) . '</li>';
    516532        $locations_overview .= '<li>' . __( 'To edit a menu currently assigned to a theme location, <strong>click the adjacent &#8217;Edit&#8217; link</strong>' ) . '</li>';
     
    529545        '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
    530546);
    531547
    532 // Get the admin header
     548// Get the admin header.
    533549require_once( ABSPATH . 'wp-admin/admin-header.php' );
    534550?>
    535551<div class="wrap">
     
    644660                                                         */
    645661                                                        $assigned_locations = array_slice( $locations_assigned_to_this_menu, 0, absint( apply_filters( 'wp_nav_locations_listed_per_menu', 3 ) ) );
    646662
    647                                                         // Adds ellipses following the number of locations defined in $assigned_locations
     663                                                        // Adds ellipses following the number of locations defined in $assigned_locations.
    648664                                                        if ( ! empty( $assigned_locations ) ) {
    649665                                                                printf( ' (%1$s%2$s)',
    650666                                                                        implode( ', ', $assigned_locations ),
  • src/wp-admin/network/site-info.php

     
    5959                        update_option( 'home', $blog_address );
    6060        }
    6161
    62         // rewrite rules can't be flushed during switch to blog
     62        // Rewrite rules can't be flushed during switch to blog.
    6363        delete_option( 'rewrite_rules' );
    6464
    65         // update blogs table
     65        // Update blogs table.
    6666        $blog_data = wp_unslash( $_POST['blog'] );
    6767        $existing_details = get_blog_details( $id, false );
    6868        $blog_data_checkboxes = array( 'public', 'archived', 'spam', 'mature', 'deleted' );
  • src/wp-admin/network.php

     
    533533        check_admin_referer( 'install-network-1' );
    534534
    535535        require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
    536         // create network tables
     536        // Create network tables.
    537537        install_network();
    538538        $base              = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH );
    539539        $subdomain_install = allow_subdomain_install() ? !empty( $_POST['subdomain_install'] ) : false;
  • src/wp-admin/options.php

     
    216216                continue;
    217217        if ( is_serialized( $option->option_value ) ) {
    218218                if ( is_serialized_string( $option->option_value ) ) {
    219                         // this is a serialized string, so we should display it
     219                        // This is a serialized string, so we should display it.
    220220                        $value = maybe_unserialize( $option->option_value );
    221221                        $options_to_update[] = $option->option_name;
    222222                        $class = 'all-options';
  • src/wp-admin/press-this.php

     
    4040        $upload = false;
    4141        if ( !empty($_POST['photo_src']) && current_user_can('upload_files') ) {
    4242                foreach( (array) $_POST['photo_src'] as $key => $image) {
    43                         // see if files exist in content - we don't want to upload non-used selected files.
     43                        // See if files exist in content - we don't want to upload non-used selected files.
    4444                        if ( strpos($_POST['content'], htmlspecialchars($image)) !== false ) {
    4545                                $desc = isset($_POST['photo_description'][$key]) ? $_POST['photo_description'][$key] : '';
    4646                                $upload = media_sideload_image($image, $post_ID, $desc);
     
    5151                        }
    5252                }
    5353        }
    54         // set the post_content and status
     54        // Set the post_content and status.
    5555        $post['post_content'] = $content;
    5656        if ( isset( $_POST['publish'] ) && current_user_can( 'publish_posts' ) )
    5757                $post['post_status'] = 'publish';
     
    6060        else
    6161                $post['post_status'] = 'draft';
    6262
    63         // error handling for media_sideload
     63        // Error handling for media_sideload.
    6464        if ( is_wp_error($upload) ) {
    6565                wp_delete_post($post_ID);
    6666                wp_die($upload);
    6767        } else {
    68                 // Post formats
     68                // Post formats.
    6969                if ( isset( $_POST['post_format'] ) ) {
    7070                        if ( current_theme_supports( 'post-formats', $_POST['post_format'] ) )
    7171                                set_post_format( $post_ID, $_POST['post_format'] );
     
    181181                                return '';
    182182                        $sources = array();
    183183                        foreach ($matches[3] as $src) {
    184                                 // if no http in url
     184
     185                                // If no http in URL.
    185186                                if (strpos($src, 'http') === false)
    186                                         // if it doesn't have a relative uri
     187                                        // If it doesn't have a relative URI.
    187188                                        if ( strpos($src, '../') === false && strpos($src, './') === false && strpos($src, '/') === 0)
    188189                                                $src = 'http://'.str_replace('//','/', $host['host'].'/'.$src);
    189190                                        else
     
    197198                break;
    198199
    199200        case 'photo_js': ?>
    200                 // gather images and load some default JS
     201                // Gather images and load some default JS.
    201202                var last = null
    202203                var img, img_tag, aspect, w, h, skip, i, strtoappend = "";
    203204                if(photostorage == false) {
     
    438439                }
    439440        }
    440441        jQuery(document).ready(function($) {
    441                 //resize screen
     442                // Resize screen.
    442443                window.resizeTo(760,580);
    443                 // set button actions
     444
     445                // Set button actions.
    444446                jQuery('#photo_button').click(function() { show('photo'); return false; });
    445447                jQuery('#video_button').click(function() { show('video'); return false; });
    446                 // auto select
     448
     449                // Auto select.
    447450                <?php if ( preg_match("/youtube\.com\/watch/i", $url) ) { ?>
    448451                        show('video');
    449452                <?php } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) { ?>
  • src/wp-admin/setup-config.php

     
    300300</script>
    301301<?php
    302302        else :
    303                 // If this file doesn't exist, then we are using the wp-config-sample.php
    304                 // file one level up, which is for the develop repo.
     303                /*
     304                 * If this file doesn't exist, then we are using the wp-config-sample.php
     305                 * file one level up, which is for the develop repo.
     306                 */
    305307                if ( file_exists( ABSPATH . 'wp-config-sample.php' ) )
    306308                        $path_to_wp_config = ABSPATH . 'wp-config.php';
    307309                else
  • src/wp-admin/theme-editor.php

     
    8181        $newcontent = wp_unslash( $_POST['newcontent'] );
    8282        $location = 'theme-editor.php?file=' . urlencode( $relative_file ) . '&theme=' . urlencode( $stylesheet ) . '&scrollto=' . $scrollto;
    8383        if ( is_writeable( $file ) ) {
    84                 //is_writable() not always reliable, check return value. see comments @ http://uk.php.net/is_writable
     84                // is_writable() not always reliable, check return value. see comments @ http://uk.php.net/is_writable
    8585                $f = fopen( $file, 'w+' );
    8686                if ( $f !== false ) {
    8787                        fwrite( $f, $newcontent );
  • src/wp-admin/update-core.php

     
    540540
    541541        check_admin_referer('upgrade-core');
    542542
    543         // do the (un)dismiss actions before headers,
    544         // so that they can redirect
     543        // Do the (un)dismiss actions before headers, so that they can redirect.
    545544        if ( isset( $_POST['dismiss'] ) )
    546545                do_dismiss_core_update();
    547546        elseif ( isset( $_POST['undismiss'] ) )
  • src/wp-admin/widgets.php

     
    141141        $id_base = $_POST['id_base'];
    142142        $sidebar = isset($sidebars_widgets[$sidebar_id]) ? $sidebars_widgets[$sidebar_id] : array();
    143143
    144         // delete
     144        // Delete.
    145145        if ( isset($_POST['removewidget']) && $_POST['removewidget'] ) {
    146146
    147147                if ( !in_array($widget_id, $sidebar, true) ) {
     
    168168
    169169        $sidebars_widgets[$sidebar_id] = $sidebar;
    170170
    171         // remove old position
     171        // Remove old position.
    172172        if ( !isset($_POST['delete_widget']) ) {
    173173                foreach ( $sidebars_widgets as $key => $sb ) {
    174174                        if ( is_array($sb) )
     
    224224
    225225        $id_base = isset($control['id_base']) ? $control['id_base'] : $control['id'];
    226226
    227         // show the widget form
     227        // Show the widget form.
    228228        $width = ' style="width:' . max($control['width'], 350) . 'px"';
    229229        $key = isset($_GET['key']) ? (int) $_GET['key'] : 0;
    230230