From 001ffe81fbec4438a9f594f330e18103d21fbcd7 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 29 Jan 2020 00:45:18 +0000 Subject: [PATCH] Docs: Improve inline comments per the documentation standards. Includes minor code layout fixes for better readability. See #48303. Built from https://develop.svn.wordpress.org/trunk@47122 git-svn-id: http://core.svn.wordpress.org/trunk@46922 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-activate.php | 2 +- wp-admin/admin-ajax.php | 6 +- wp-admin/admin-footer.php | 4 +- wp-admin/admin.php | 8 +- wp-admin/async-upload.php | 4 +- wp-admin/comment.php | 4 +- wp-admin/credits.php | 2 +- wp-admin/edit-comments.php | 2 +- wp-admin/edit-form-advanced.php | 6 +- wp-admin/edit-form-blocks.php | 12 +- wp-admin/edit-form-comment.php | 2 +- wp-admin/edit-link-form.php | 2 +- wp-admin/edit-tag-form.php | 8 +- wp-admin/edit-tags.php | 2 +- wp-admin/edit.php | 2 +- wp-admin/import.php | 4 +- wp-admin/includes/admin-filters.php | 2 +- wp-admin/includes/admin.php | 2 +- wp-admin/includes/ajax-actions.php | 62 +- .../class-automatic-upgrader-skin.php | 6 +- wp-admin/includes/class-core-upgrader.php | 35 +- wp-admin/includes/class-custom-background.php | 12 +- .../includes/class-custom-image-header.php | 26 +- .../includes/class-file-upload-upgrader.php | 4 +- .../includes/class-language-pack-upgrader.php | 6 +- wp-admin/includes/class-plugin-upgrader.php | 38 +- wp-admin/includes/class-theme-upgrader.php | 58 +- .../class-walker-category-checklist.php | 2 +- .../class-walker-nav-menu-checklist.php | 4 +- .../includes/class-walker-nav-menu-edit.php | 2 +- .../includes/class-wp-automatic-updater.php | 50 +- .../includes/class-wp-comments-list-table.php | 6 +- .../includes/class-wp-community-events.php | 2 +- wp-admin/includes/class-wp-debug-data.php | 10 +- .../includes/class-wp-filesystem-base.php | 45 +- .../includes/class-wp-filesystem-direct.php | 13 +- .../includes/class-wp-filesystem-ftpext.php | 19 +- .../class-wp-filesystem-ftpsockets.php | 16 +- .../includes/class-wp-filesystem-ssh2.php | 6 +- wp-admin/includes/class-wp-importer.php | 28 +- .../includes/class-wp-internal-pointers.php | 10 +- wp-admin/includes/class-wp-list-table.php | 8 +- .../includes/class-wp-ms-sites-list-table.php | 4 +- .../class-wp-ms-themes-list-table.php | 2 +- .../includes/class-wp-ms-users-list-table.php | 2 +- .../class-wp-plugin-install-list-table.php | 10 +- .../includes/class-wp-plugins-list-table.php | 38 +- .../includes/class-wp-posts-list-table.php | 693 +++++++++--------- .../class-wp-privacy-requests-table.php | 10 +- wp-admin/includes/class-wp-screen.php | 16 +- .../class-wp-site-health-auto-updates.php | 6 +- wp-admin/includes/class-wp-site-health.php | 6 +- wp-admin/includes/class-wp-site-icon.php | 2 +- .../includes/class-wp-terms-list-table.php | 93 ++- .../class-wp-theme-install-list-table.php | 2 +- .../includes/class-wp-themes-list-table.php | 4 +- wp-admin/includes/class-wp-upgrader.php | 67 +- .../includes/class-wp-users-list-table.php | 22 +- wp-admin/includes/comment.php | 21 +- wp-admin/includes/credits.php | 2 +- wp-admin/includes/dashboard.php | 6 +- wp-admin/includes/file.php | 4 +- wp-admin/includes/image.php | 24 +- wp-admin/includes/import.php | 3 +- wp-admin/includes/media.php | 6 +- wp-admin/includes/privacy-tools.php | 2 +- wp-admin/includes/revision.php | 4 +- wp-admin/includes/schema.php | 27 +- wp-admin/includes/screen.php | 4 +- wp-admin/includes/taxonomy.php | 6 +- wp-admin/includes/template.php | 46 +- wp-admin/includes/theme.php | 17 +- wp-admin/includes/translation-install.php | 10 +- wp-admin/includes/update-core.php | 90 +-- wp-admin/includes/update.php | 3 +- wp-admin/includes/upgrade.php | 132 ++-- wp-admin/includes/user.php | 6 +- wp-admin/includes/widgets.php | 10 +- wp-admin/index.php | 4 +- wp-admin/install-helper.php | 4 +- wp-admin/install.php | 18 +- wp-admin/js/accordion.js | 6 +- wp-admin/js/code-editor.js | 6 +- wp-admin/js/color-picker.js | 3 - wp-admin/js/comment.js | 2 +- wp-admin/js/common.js | 48 +- wp-admin/js/customize-controls.js | 178 +++-- wp-admin/js/customize-nav-menus.js | 42 +- wp-admin/js/customize-widgets.js | 179 ++--- wp-admin/js/edit-comments.js | 74 +- wp-admin/js/editor-expand.js | 19 +- wp-admin/js/editor.js | 36 +- wp-admin/js/gallery.js | 8 +- wp-admin/js/image-edit.js | 111 +-- wp-admin/js/inline-edit-post.js | 36 +- wp-admin/js/inline-edit-tax.js | 10 +- wp-admin/js/link.js | 4 +- wp-admin/js/media-upload.js | 8 +- wp-admin/js/nav-menu.js | 148 ++-- wp-admin/js/plugin-install.js | 5 +- wp-admin/js/post.js | 39 +- wp-admin/js/postbox.js | 23 +- wp-admin/js/privacy-tools.js | 10 +- wp-admin/js/site-health.js | 8 +- wp-admin/js/svg-painter.js | 20 +- wp-admin/js/tags-box.js | 7 + wp-admin/js/tags-suggest.js | 16 +- wp-admin/js/tags.js | 14 +- wp-admin/js/theme-plugin-editor.js | 14 +- wp-admin/js/theme.js | 495 +++++++------ wp-admin/js/user-profile.js | 8 +- wp-admin/js/widgets.js | 22 +- wp-admin/js/word-count.js | 14 +- wp-admin/link-manager.php | 2 +- wp-admin/link-parse-opml.php | 6 +- wp-admin/load-scripts.php | 2 +- wp-admin/load-styles.php | 2 +- wp-admin/media-new.php | 2 +- wp-admin/media-upload.php | 4 +- wp-admin/menu-header.php | 6 +- wp-admin/menu.php | 14 +- wp-admin/nav-menus.php | 30 +- wp-admin/network/settings.php | 2 +- wp-admin/network/site-new.php | 4 +- wp-admin/network/site-settings.php | 4 +- wp-admin/network/themes.php | 2 +- wp-admin/network/users.php | 4 +- wp-admin/options-discussion.php | 4 +- wp-admin/options-general.php | 6 +- wp-admin/options-media.php | 2 +- wp-admin/options-permalink.php | 2 +- wp-admin/options.php | 2 +- wp-admin/plugin-editor.php | 230 +++--- wp-admin/plugin-install.php | 2 +- wp-admin/plugins.php | 23 +- wp-admin/post-new.php | 4 +- wp-admin/post.php | 14 +- wp-admin/revision.php | 4 +- wp-admin/setup-config.php | 8 +- wp-admin/theme-editor.php | 236 +++--- wp-admin/theme-install.php | 2 +- wp-admin/themes.php | 16 +- wp-admin/update-core.php | 4 +- wp-admin/update.php | 16 +- wp-admin/upload.php | 4 +- wp-admin/user-edit.php | 33 +- wp-admin/user-new.php | 14 +- wp-admin/users.php | 7 +- wp-admin/widgets.php | 23 +- wp-content/themes/twentyeleven/archive.php | 8 +- wp-content/themes/twentyeleven/author.php | 11 +- wp-content/themes/twentyeleven/category.php | 5 +- wp-content/themes/twentyeleven/comments.php | 8 +- .../themes/twentyeleven/content-aside.php | 2 +- .../themes/twentyeleven/content-gallery.php | 14 +- .../themes/twentyeleven/content-image.php | 6 +- .../themes/twentyeleven/content-link.php | 2 +- .../themes/twentyeleven/content-quote.php | 12 +- .../themes/twentyeleven/content-single.php | 5 +- .../themes/twentyeleven/content-status.php | 2 +- wp-content/themes/twentyeleven/content.php | 20 +- wp-content/themes/twentyeleven/functions.php | 26 +- wp-content/themes/twentyeleven/header.php | 16 +- wp-content/themes/twentyeleven/image.php | 34 +- .../twentyeleven/inc/theme-customizer.js | 2 +- .../themes/twentyeleven/inc/theme-options.php | 52 +- .../themes/twentyeleven/inc/widgets.php | 4 +- wp-content/themes/twentyeleven/index.php | 2 +- wp-content/themes/twentyeleven/page.php | 2 +- wp-content/themes/twentyeleven/search.php | 2 +- wp-content/themes/twentyeleven/showcase.php | 20 +- .../themes/twentyeleven/sidebar-page.php | 2 +- wp-content/themes/twentyeleven/sidebar.php | 2 +- wp-content/themes/twentyeleven/single.php | 2 +- wp-content/themes/twentyeleven/tag.php | 2 +- wp-content/themes/twentyfifteen/archive.php | 8 +- wp-content/themes/twentyfifteen/comments.php | 2 +- .../themes/twentyfifteen/content-link.php | 2 +- wp-content/themes/twentyfifteen/content.php | 2 +- wp-content/themes/twentyfifteen/functions.php | 2 +- wp-content/themes/twentyfifteen/image.php | 4 +- .../twentyfifteen/inc/custom-header.php | 2 +- .../themes/twentyfifteen/inc/customizer.php | 6 +- .../twentyfifteen/inc/template-tags.php | 8 +- wp-content/themes/twentyfifteen/index.php | 6 +- .../themes/twentyfifteen/js/functions.js | 1 + wp-content/themes/twentyfifteen/single.php | 4 +- wp-content/themes/twentyfourteen/archive.php | 6 +- wp-content/themes/twentyfourteen/author.php | 12 +- wp-content/themes/twentyfourteen/category.php | 6 +- .../twentyfourteen/content-featured-post.php | 2 +- .../themes/twentyfourteen/functions.php | 6 +- wp-content/themes/twentyfourteen/image.php | 4 +- .../twentyfourteen/inc/custom-header.php | 6 +- .../twentyfourteen/inc/template-tags.php | 12 +- wp-content/themes/twentyfourteen/index.php | 4 +- .../themes/twentyfourteen/js/functions.js | 3 +- .../page-templates/contributors.php | 2 +- .../page-templates/full-width.php | 2 +- wp-content/themes/twentyfourteen/page.php | 2 +- wp-content/themes/twentyfourteen/search.php | 6 +- wp-content/themes/twentyfourteen/single.php | 6 +- wp-content/themes/twentyfourteen/tag.php | 6 +- .../twentyfourteen/taxonomy-post_format.php | 6 +- wp-content/themes/twentynineteen/archive.php | 3 +- .../class-twentynineteen-svg-icons.php | 2 +- wp-content/themes/twentynineteen/comments.php | 4 +- wp-content/themes/twentynineteen/image.php | 2 +- .../twentynineteen/inc/template-functions.php | 6 +- .../twentynineteen/inc/template-tags.php | 6 +- .../twentynineteen/js/customize-preview.js | 4 +- .../themes/twentynineteen/js/priority-menu.js | 40 +- .../js/touch-keyboard-navigation.js | 76 +- wp-content/themes/twentynineteen/page.php | 4 +- wp-content/themes/twentynineteen/search.php | 3 +- wp-content/themes/twentynineteen/single.php | 4 +- .../template-parts/header/entry-header.php | 2 +- wp-content/themes/twentyseventeen/archive.php | 5 +- .../assets/js/customize-preview.js | 2 +- .../twentyseventeen/inc/custom-header.php | 2 +- .../twentyseventeen/inc/template-tags.php | 17 +- wp-content/themes/twentyseventeen/index.php | 5 +- wp-content/themes/twentyseventeen/page.php | 2 +- wp-content/themes/twentyseventeen/search.php | 4 +- wp-content/themes/twentyseventeen/single.php | 4 +- wp-content/themes/twentysixteen/archive.php | 5 +- wp-content/themes/twentysixteen/functions.php | 2 +- wp-content/themes/twentysixteen/image.php | 2 +- .../themes/twentysixteen/inc/customizer.php | 8 +- .../twentysixteen/inc/template-tags.php | 8 +- wp-content/themes/twentysixteen/index.php | 3 +- wp-content/themes/twentysixteen/page.php | 2 +- wp-content/themes/twentysixteen/single.php | 2 +- wp-content/themes/twentyten/404.php | 2 +- wp-content/themes/twentyten/archive.php | 6 +- wp-content/themes/twentyten/author.php | 6 +- wp-content/themes/twentyten/comments.php | 6 +- wp-content/themes/twentyten/functions.php | 14 +- wp-content/themes/twentyten/header.php | 12 +- .../themes/twentyten/loop-attachment.php | 50 +- wp-content/themes/twentyten/loop-page.php | 2 +- wp-content/themes/twentyten/loop-single.php | 4 +- wp-content/themes/twentyten/loop.php | 8 +- wp-content/themes/twentyten/sidebar.php | 2 +- wp-content/themes/twentyten/tag.php | 16 +- wp-content/themes/twentythirteen/archive.php | 2 +- wp-content/themes/twentythirteen/author.php | 8 +- wp-content/themes/twentythirteen/category.php | 4 +- wp-content/themes/twentythirteen/comments.php | 2 +- wp-content/themes/twentythirteen/content.php | 2 +- .../themes/twentythirteen/functions.php | 8 +- wp-content/themes/twentythirteen/image.php | 4 +- wp-content/themes/twentythirteen/index.php | 2 +- wp-content/themes/twentythirteen/page.php | 2 +- wp-content/themes/twentythirteen/search.php | 2 +- wp-content/themes/twentythirteen/single.php | 2 +- wp-content/themes/twentythirteen/tag.php | 4 +- .../twentythirteen/taxonomy-post_format.php | 2 +- wp-content/themes/twentytwelve/archive.php | 7 +- wp-content/themes/twentytwelve/author.php | 12 +- wp-content/themes/twentytwelve/category.php | 9 +- wp-content/themes/twentytwelve/comments.php | 7 +- wp-content/themes/twentytwelve/content.php | 15 +- wp-content/themes/twentytwelve/functions.php | 6 +- wp-content/themes/twentytwelve/image.php | 48 +- .../themes/twentytwelve/inc/custom-header.php | 2 +- wp-content/themes/twentytwelve/index.php | 6 +- .../twentytwelve/js/theme-customizer.js | 2 +- .../page-templates/front-page.php | 2 +- .../page-templates/full-width.php | 2 +- wp-content/themes/twentytwelve/page.php | 2 +- wp-content/themes/twentytwelve/search.php | 2 +- wp-content/themes/twentytwelve/single.php | 2 +- wp-content/themes/twentytwelve/tag.php | 8 +- .../assets/js/color-calculations.js | 2 + .../assets/js/customize-preview.js | 8 +- .../themes/twentytwenty/assets/js/index.js | 132 ++-- ...class-twentytwenty-non-latin-languages.php | 2 +- .../class-twentytwenty-script-loader.php | 2 +- .../classes/class-twentytwenty-svg-icons.php | 6 +- .../class-twentytwenty-walker-comment.php | 8 +- .../class-twentytwenty-walker-page.php | 2 +- wp-content/themes/twentytwenty/comments.php | 6 +- wp-content/themes/twentytwenty/footer.php | 4 +- wp-content/themes/twentytwenty/functions.php | 2 +- .../themes/twentytwenty/inc/custom-css.php | 2 +- .../themes/twentytwenty/inc/svg-icons.php | 2 +- .../themes/twentytwenty/inc/template-tags.php | 8 +- wp-content/themes/twentytwenty/index.php | 2 +- wp-content/themes/twentytwenty/searchform.php | 4 +- .../template-parts/content-cover.php | 4 +- .../template-parts/entry-author-bio.php | 2 +- .../template-parts/entry-header.php | 2 +- .../template-parts/featured-image.php | 2 +- .../template-parts/footer-menus-widgets.php | 2 +- .../template-parts/pagination.php | 6 +- wp-includes/admin-bar.php | 12 +- wp-includes/author-template.php | 2 +- wp-includes/bookmark-template.php | 8 +- wp-includes/bookmark.php | 4 +- wp-includes/canonical.php | 128 ++-- wp-includes/capabilities.php | 8 +- wp-includes/category-template.php | 11 +- wp-includes/category.php | 2 +- wp-includes/class-http.php | 10 +- wp-includes/class-walker-nav-menu.php | 2 +- wp-includes/class-wp-admin-bar.php | 8 +- wp-includes/class-wp-ajax-response.php | 2 +- wp-includes/class-wp-comment-query.php | 8 +- wp-includes/class-wp-customize-manager.php | 32 +- wp-includes/class-wp-customize-setting.php | 2 +- wp-includes/class-wp-customize-widgets.php | 22 +- wp-includes/class-wp-date-query.php | 20 +- wp-includes/class-wp-editor.php | 84 ++- wp-includes/class-wp-embed.php | 24 +- wp-includes/class-wp-fatal-error-handler.php | 2 +- wp-includes/class-wp-hook.php | 6 +- wp-includes/class-wp-http-ixr-client.php | 14 +- wp-includes/class-wp-http-requests-hooks.php | 2 +- wp-includes/class-wp-http-streams.php | 8 +- wp-includes/class-wp-image-editor-gd.php | 14 +- wp-includes/class-wp-image-editor-imagick.php | 24 +- wp-includes/class-wp-image-editor.php | 8 +- wp-includes/class-wp-locale.php | 10 +- wp-includes/class-wp-matchesmapregex.php | 2 +- wp-includes/class-wp-network-query.php | 2 +- wp-includes/class-wp-network.php | 2 +- wp-includes/class-wp-oembed.php | 14 +- .../class-wp-paused-extensions-storage.php | 2 +- wp-includes/class-wp-post-type.php | 10 +- wp-includes/class-wp-query.php | 118 +-- .../class-wp-recovery-mode-cookie-service.php | 2 +- .../class-wp-recovery-mode-email-service.php | 2 +- .../class-wp-recovery-mode-key-service.php | 2 +- .../class-wp-recovery-mode-link-service.php | 2 +- wp-includes/class-wp-recovery-mode.php | 2 +- wp-includes/class-wp-rewrite.php | 12 +- wp-includes/class-wp-session-tokens.php | 2 +- wp-includes/class-wp-simplepie-file.php | 2 +- wp-includes/class-wp-site-query.php | 2 +- wp-includes/class-wp-tax-query.php | 4 +- wp-includes/class-wp-taxonomy.php | 16 +- .../class-wp-text-diff-renderer-table.php | 42 +- wp-includes/class-wp-theme.php | 22 +- wp-includes/class-wp-user-query.php | 8 +- wp-includes/class-wp-user.php | 2 +- wp-includes/class-wp-walker.php | 20 +- wp-includes/class-wp-widget-factory.php | 2 +- wp-includes/class-wp-widget.php | 8 +- wp-includes/class-wp-xmlrpc-server.php | 357 ++++----- wp-includes/class-wp.php | 27 +- wp-includes/class.wp-dependencies.php | 10 +- wp-includes/comment-template.php | 26 +- wp-includes/comment.php | 108 +-- wp-includes/compat.php | 6 +- wp-includes/cron.php | 36 +- .../class-wp-customize-nav-menu-setting.php | 2 +- .../class-wp-customize-themes-section.php | 4 +- .../class-wp-customize-upload-control.php | 6 +- wp-includes/default-constants.php | 40 +- wp-includes/default-filters.php | 132 ++-- wp-includes/deprecated.php | 44 +- wp-includes/error-protection.php | 2 +- wp-includes/feed-atom-comments.php | 85 ++- wp-includes/feed-atom.php | 21 +- wp-includes/feed-rdf.php | 15 +- wp-includes/feed-rss.php | 1 - wp-includes/feed-rss2-comments.php | 87 ++- wp-includes/feed-rss2.php | 28 +- wp-includes/feed.php | 4 +- wp-includes/formatting.php | 413 ++++++----- wp-includes/functions.php | 164 +++-- wp-includes/functions.wp-scripts.php | 2 +- wp-includes/functions.wp-styles.php | 2 +- wp-includes/general-template.php | 72 +- wp-includes/http.php | 6 +- wp-includes/js/admin-bar.js | 4 +- wp-includes/js/api-request.js | 6 +- wp-includes/js/autosave.js | 42 +- wp-includes/js/comment-reply.js | 2 +- wp-includes/js/customize-base.js | 42 +- wp-includes/js/customize-loader.js | 10 +- wp-includes/js/customize-models.js | 12 +- wp-includes/js/customize-preview-widgets.js | 2 +- wp-includes/js/customize-preview.js | 6 +- wp-includes/js/customize-selective-refresh.js | 2 +- wp-includes/js/heartbeat.js | 109 ++- wp-includes/js/mce-view.js | 10 +- wp-includes/js/media-audiovideo.js | 2 +- wp-includes/js/media-editor.js | 22 +- wp-includes/js/media-grid.js | 20 +- wp-includes/js/media-models.js | 69 +- wp-includes/js/media-views.js | 216 +++--- wp-includes/js/plupload/handlers.js | 77 +- wp-includes/js/plupload/wp-plupload.js | 42 +- wp-includes/js/quicktags.js | 58 +- wp-includes/js/shortcode.js | 221 +++--- .../js/tinymce/plugins/compat3x/plugin.js | 2 +- .../js/tinymce/plugins/wordpress/plugin.js | 56 +- .../js/tinymce/plugins/wpautoresize/plugin.js | 44 +- .../js/tinymce/plugins/wpdialogs/plugin.js | 6 +- .../js/tinymce/plugins/wpeditimage/plugin.js | 84 ++- .../js/tinymce/plugins/wpemoji/plugin.js | 16 +- .../js/tinymce/plugins/wpgallery/plugin.js | 8 +- .../js/tinymce/plugins/wplink/plugin.js | 10 +- .../tinymce/plugins/wptextpattern/plugin.js | 6 +- .../js/tinymce/plugins/wpview/plugin.js | 8 +- wp-includes/js/tinymce/wp-tinymce.php | 4 +- wp-includes/js/utils.js | 12 +- wp-includes/js/wp-ajax-response.js | 4 +- wp-includes/js/wp-api.js | 14 +- wp-includes/js/wp-auth-check.js | 16 +- wp-includes/js/wp-custom-header.js | 2 +- wp-includes/js/wp-emoji.js | 14 +- wp-includes/js/wp-pointer.js | 10 +- wp-includes/js/wp-util.js | 14 +- wp-includes/js/wplink.js | 58 +- wp-includes/kses.php | 100 +-- wp-includes/link-template.php | 30 +- wp-includes/load.php | 42 +- wp-includes/media.php | 137 ++-- wp-includes/meta.php | 18 +- wp-includes/ms-blogs.php | 6 +- wp-includes/ms-default-constants.php | 4 +- wp-includes/ms-default-filters.php | 32 +- wp-includes/ms-deprecated.php | 26 +- wp-includes/ms-files.php | 10 +- wp-includes/ms-functions.php | 56 +- wp-includes/ms-load.php | 20 +- wp-includes/ms-settings.php | 6 +- wp-includes/ms-site.php | 8 +- wp-includes/nav-menu-template.php | 40 +- wp-includes/nav-menu.php | 32 +- wp-includes/option.php | 38 +- wp-includes/pluggable.php | 165 +++-- wp-includes/plugin.php | 33 +- wp-includes/pomo/entry.php | 8 +- wp-includes/pomo/mo.php | 32 +- wp-includes/pomo/plural-forms.php | 14 +- wp-includes/pomo/po.php | 28 +- wp-includes/pomo/translations.php | 2 +- wp-includes/post-formats.php | 2 +- wp-includes/post-template.php | 52 +- wp-includes/post.php | 40 +- wp-includes/query.php | 12 +- wp-includes/rest-api.php | 56 +- .../rest-api/class-wp-rest-request.php | 7 +- .../rest-api/class-wp-rest-response.php | 3 + wp-includes/rest-api/class-wp-rest-server.php | 43 +- .../class-wp-rest-attachments-controller.php | 124 +++- .../class-wp-rest-autosaves-controller.php | 37 +- ...lass-wp-rest-block-renderer-controller.php | 2 + .../class-wp-rest-comments-controller.php | 233 +++++- .../endpoints/class-wp-rest-controller.php | 110 ++- ...class-wp-rest-post-statuses-controller.php | 25 +- .../class-wp-rest-post-types-controller.php | 25 +- .../class-wp-rest-posts-controller.php | 239 ++++-- .../class-wp-rest-revisions-controller.php | 73 +- .../class-wp-rest-search-controller.php | 31 +- .../class-wp-rest-settings-controller.php | 4 + .../class-wp-rest-taxonomies-controller.php | 29 +- .../class-wp-rest-terms-controller.php | 85 ++- .../class-wp-rest-themes-controller.php | 7 +- .../class-wp-rest-users-controller.php | 203 ++++- .../fields/class-wp-rest-meta-fields.php | 16 +- wp-includes/revision.php | 50 +- wp-includes/rewrite.php | 36 +- wp-includes/script-loader.php | 81 +- wp-includes/shortcodes.php | 68 +- wp-includes/taxonomy.php | 39 +- wp-includes/template.php | 3 +- wp-includes/theme-compat/comments.php | 6 +- wp-includes/theme-compat/header.php | 4 +- wp-includes/theme.php | 80 +- wp-includes/update.php | 30 +- wp-includes/user.php | 49 +- wp-includes/vars.php | 12 +- wp-includes/version.php | 2 +- wp-includes/widgets.php | 36 +- .../widgets/class-wp-nav-menu-widget.php | 4 +- .../widgets/class-wp-widget-categories.php | 2 +- .../widgets/class-wp-widget-custom-html.php | 9 +- wp-includes/widgets/class-wp-widget-links.php | 2 +- wp-includes/widgets/class-wp-widget-media.php | 11 +- wp-includes/widgets/class-wp-widget-pages.php | 2 +- .../class-wp-widget-recent-comments.php | 2 +- wp-includes/widgets/class-wp-widget-rss.php | 2 +- .../widgets/class-wp-widget-search.php | 2 +- .../widgets/class-wp-widget-tag-cloud.php | 2 +- wp-includes/widgets/class-wp-widget-text.php | 10 +- wp-includes/wp-db.php | 73 +- wp-load.php | 2 +- wp-login.php | 20 +- wp-mail.php | 15 +- wp-settings.php | 10 +- wp-signup.php | 8 +- xmlrpc.php | 4 +- 497 files changed, 6841 insertions(+), 5486 deletions(-) diff --git a/wp-activate.php b/wp-activate.php index 0349f3fa37..5949372fe7 100644 --- a/wp-activate.php +++ b/wp-activate.php @@ -68,7 +68,7 @@ if ( is_object( $wp_object_cache ) ) { $wp_object_cache->cache_enabled = false; } -// Fix for page title +// Fix for page title. $wp_query->is_404 = false; /** diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index deea44152c..57d33f4f54 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -27,7 +27,7 @@ send_origin_headers(); header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) ); header( 'X-Robots-Tag: noindex' ); -// Require an action parameter +// Require an action parameter. if ( empty( $_REQUEST['action'] ) ) { wp_die( '0', 400 ); } @@ -141,7 +141,7 @@ $core_actions_post = array( 'health-check-get-sizes', ); -// Deprecated +// Deprecated. $core_actions_post_deprecated = array( 'wp-fullscreen-save-post', 'press-this-save-post', 'press-this-add-category' ); $core_actions_post = array_merge( $core_actions_post, $core_actions_post_deprecated ); @@ -189,5 +189,5 @@ if ( is_user_logged_in() ) { */ do_action( "wp_ajax_nopriv_{$action}" ); } -// Default status +// Default status. wp_die( '0' ); diff --git a/wp-admin/admin-footer.php b/wp-admin/admin-footer.php index 4c4c40a081..099b45dfe0 100644 --- a/wp-admin/admin-footer.php +++ b/wp-admin/admin-footer.php @@ -6,7 +6,7 @@ * @subpackage Administration */ -// don't load directly +// Don't load directly. if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } @@ -104,7 +104,7 @@ do_action( 'admin_print_footer_scripts' ); */ do_action( "admin_footer-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores -// get_site_option() won't exist when auto upgrading from <= 2.7 +// get_site_option() won't exist when auto upgrading from <= 2.7. if ( function_exists( 'get_site_option' ) ) { if ( false === get_site_option( 'can_compress_scripts' ) ) { compression_test(); diff --git a/wp-admin/admin.php b/wp-admin/admin.php index 5f8916ed41..14014b04f3 100644 --- a/wp-admin/admin.php +++ b/wp-admin/admin.php @@ -93,12 +93,12 @@ require_once( ABSPATH . 'wp-admin/includes/admin.php' ); auth_redirect(); -// Schedule trash collection +// Schedule trash collection. if ( ! wp_next_scheduled( 'wp_scheduled_delete' ) && ! wp_installing() ) { wp_schedule_event( time(), 'daily', 'wp_scheduled_delete' ); } -// Schedule Transient cleanup. +// Schedule transient cleanup. if ( ! wp_next_scheduled( 'delete_expired_transients' ) && ! wp_installing() ) { wp_schedule_event( time(), 'daily', 'delete_expired_transients' ); } @@ -182,7 +182,7 @@ if ( isset( $plugin_page ) ) { // Back-compat for plugins using add_management_page(). if ( empty( $page_hook ) && 'edit.php' == $pagenow && '' != get_plugin_page_hook( $plugin_page, 'tools.php' ) ) { - // There could be plugin specific params on the URL, so we need the whole query string + // There could be plugin specific params on the URL, so we need the whole query string. if ( ! empty( $_SERVER['QUERY_STRING'] ) ) { $query_string = $_SERVER['QUERY_STRING']; } else { @@ -347,7 +347,7 @@ if ( isset( $plugin_page ) ) { include( ABSPATH . 'wp-admin/admin-footer.php' ); - // Make sure rules are flushed + // Make sure rules are flushed. flush_rewrite_rules( false ); exit(); diff --git a/wp-admin/async-upload.php b/wp-admin/async-upload.php index 4d37f7f644..349335ec0a 100644 --- a/wp-admin/async-upload.php +++ b/wp-admin/async-upload.php @@ -38,7 +38,7 @@ if ( ! current_user_can( 'upload_files' ) ) { wp_die( __( 'Sorry, you are not allowed to upload files.' ) ); } -// just fetch the detail form for that attachment +// Just fetch the detail form for that attachment. if ( isset( $_REQUEST['attachment_id'] ) && intval( $_REQUEST['attachment_id'] ) && $_REQUEST['fetch'] ) { $id = intval( $_REQUEST['attachment_id'] ); $post = get_post( $id ); @@ -112,7 +112,7 @@ if ( $_REQUEST['short'] ) { // Short form response - attachment ID only. echo $id; } else { - // Long form response - big chunk of html. + // Long form response - big chunk of HTML. $type = $_REQUEST['type']; /** diff --git a/wp-admin/comment.php b/wp-admin/comment.php index 145cd7a5ea..7678a83d92 100644 --- a/wp-admin/comment.php +++ b/wp-admin/comment.php @@ -137,7 +137,7 @@ switch ( $action ) { break; } - if ( $comment->comment_approved != '0' ) { // if not unapproved + if ( $comment->comment_approved != '0' ) { // If not unapproved. $message = ''; switch ( $comment->comment_approved ) { case '1': @@ -355,6 +355,6 @@ switch ( $action ) { default: wp_die( __( 'Unknown action.' ) ); -} // end switch +} // End switch. include( ABSPATH . 'wp-admin/admin-footer.php' ); diff --git a/wp-admin/credits.php b/wp-admin/credits.php index af4792d2b4..e6e66564ed 100644 --- a/wp-admin/credits.php +++ b/wp-admin/credits.php @@ -133,7 +133,7 @@ include( ABSPATH . 'wp-admin/admin-footer.php' ); return; -// These are strings returned by the API that we want to be translatable +// These are strings returned by the API that we want to be translatable. __( 'Project Leaders' ); /* translators: %s: The current WordPress version number. */ __( 'Core Contributors to WordPress %s' ); diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index b159c0a179..a03fd00e59 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -52,7 +52,7 @@ if ( $doaction ) { wp_defer_comment_counting( true ); - foreach ( $comment_ids as $comment_id ) { // Check the permissions on each + foreach ( $comment_ids as $comment_id ) { // Check the permissions on each. if ( ! current_user_can( 'edit_comment', $comment_id ) ) { continue; } diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index e7127fbcb2..20b62af216 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -6,7 +6,7 @@ * @subpackage Administration */ -// don't load directly +// Don't load directly. if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } @@ -95,7 +95,7 @@ if ( $thumbnail_support ) { wp_enqueue_media( array( 'post' => $post_ID ) ); } -// Add the local autosave notice HTML +// Add the local autosave notice HTML. add_action( 'admin_footer', '_local_storage_notice' ); /* @@ -242,7 +242,7 @@ $form_action = 'editpost'; $nonce_action = 'update-post_' . $post_ID; $form_extra .= ""; -// Detect if there exists an autosave newer than the post and if that autosave is different than the post +// Detect if there exists an autosave newer than the post and if that autosave is different than the post. if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) { foreach ( _wp_post_revision_fields( $post ) as $autosave_field => $_autosave_field ) { if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) { diff --git a/wp-admin/edit-form-blocks.php b/wp-admin/edit-form-blocks.php index dcec9faaab..274325ae74 100644 --- a/wp-admin/edit-form-blocks.php +++ b/wp-admin/edit-form-blocks.php @@ -8,7 +8,7 @@ * @subpackage Administration */ -// don't load directly +// Don't load directly. if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } @@ -148,10 +148,12 @@ $font_sizes = current( (array) get_theme_support( 'editor-font-sizes' ) ); */ $allowed_block_types = apply_filters( 'allowed_block_types', true, $post ); -// Get all available templates for the post/page attributes meta-box. -// The "Default template" array element should only be added if the array is -// not empty so we do not trigger the template select element without any options -// besides the default value. +/* + * Get all available templates for the post/page attributes meta-box. + * The "Default template" array element should only be added if the array is + * not empty so we do not trigger the template select element without any options + * besides the default value. + */ $available_templates = wp_get_theme()->get_page_templates( get_post( $post->ID ) ); $available_templates = ! empty( $available_templates ) ? array_merge( array( diff --git a/wp-admin/edit-form-comment.php b/wp-admin/edit-form-comment.php index aaed1f9fa4..43b568a0aa 100644 --- a/wp-admin/edit-form-comment.php +++ b/wp-admin/edit-form-comment.php @@ -6,7 +6,7 @@ * @subpackage Administration */ -// don't load directly +// Don't load directly. if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } diff --git a/wp-admin/edit-link-form.php b/wp-admin/edit-link-form.php index 05c3751f72..13cc68ae05 100644 --- a/wp-admin/edit-link-form.php +++ b/wp-admin/edit-link-form.php @@ -6,7 +6,7 @@ * @subpackage Administration */ -// don't load directly +// Don't load directly. if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } diff --git a/wp-admin/edit-tag-form.php b/wp-admin/edit-tag-form.php index a56ee93ff7..42350b709a 100644 --- a/wp-admin/edit-tag-form.php +++ b/wp-admin/edit-tag-form.php @@ -6,12 +6,12 @@ * @subpackage Administration */ -// don't load directly +// Don't load directly. if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } -// Back compat hooks +// Back compat hooks. if ( 'category' == $taxonomy ) { /** * Fires before the Edit Category form. @@ -191,7 +191,7 @@ if ( isset( $tag->name ) ) {

name ) ) { ?> current_action() ) { $tags = (array) $_REQUEST['delete_tags']; /** This action is documented in wp-admin/edit.php */ - $location = apply_filters( "handle_bulk_actions-{$screen}", $location, $wp_list_table->current_action(), $tags ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores + $location = apply_filters( "handle_bulk_actions-{$screen}", $location, $wp_list_table->current_action(), $tags ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores break; } diff --git a/wp-admin/edit.php b/wp-admin/edit.php index 5c818f4e4c..0584e7fe6d 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -47,7 +47,7 @@ if ( ! current_user_can( $post_type_object->cap->edit_posts ) ) { $wp_list_table = _get_list_table( 'WP_Posts_List_Table' ); $pagenum = $wp_list_table->get_pagenum(); -// Back-compat for viewing comments of an entry +// Back-compat for viewing comments of an entry. foreach ( array( 'p', 'attachment_id', 'page_id' ) as $_redirect ) { if ( ! empty( $_REQUEST[ $_redirect ] ) ) { wp_redirect( admin_url( 'edit-comments.php?p=' . absint( $_REQUEST[ $_redirect ] ) ) ); diff --git a/wp-admin/import.php b/wp-admin/import.php index d10f60bde7..cc4246d65c 100644 --- a/wp-admin/import.php +++ b/wp-admin/import.php @@ -39,7 +39,7 @@ if ( current_user_can( 'install_plugins' ) ) { $popular_importers = array(); } -// Detect and redirect invalid importers like 'movabletype', which is registered as 'mt' +// Detect and redirect invalid importers like 'movabletype', which is registered as 'mt'. if ( ! empty( $_GET['invalid'] ) && isset( $popular_importers[ $_GET['invalid'] ] ) ) { $importer_id = $popular_importers[ $_GET['invalid'] ]['importer-id']; if ( $importer_id != $_GET['invalid'] ) { // Prevent redirect loops. @@ -93,7 +93,7 @@ foreach ( $popular_importers as $pop_importer => $pop_data ) { } if ( empty( $importers ) ) { - echo '

' . __( 'No importers are available.' ) . '

'; // TODO: make more helpful + echo '

' . __( 'No importers are available.' ) . '

'; // TODO: Make more helpful. } else { uasort( $importers, '_usort_by_first_member' ); ?> diff --git a/wp-admin/includes/admin-filters.php b/wp-admin/includes/admin-filters.php index c080fd0f24..4e66b28bb8 100644 --- a/wp-admin/includes/admin-filters.php +++ b/wp-admin/includes/admin-filters.php @@ -128,7 +128,7 @@ add_action( 'upgrader_process_complete', 'wp_version_check', 10, 0 ); add_action( 'upgrader_process_complete', 'wp_update_plugins', 10, 0 ); add_action( 'upgrader_process_complete', 'wp_update_themes', 10, 0 ); -// Privacy hooks +// Privacy hooks. add_filter( 'wp_privacy_personal_data_erasure_page', 'wp_privacy_process_personal_data_erasure_page', 10, 5 ); add_filter( 'wp_privacy_personal_data_export_page', 'wp_privacy_process_personal_data_export_page', 10, 7 ); add_action( 'wp_privacy_personal_data_export_file', 'wp_privacy_generate_personal_data_export_file', 10 ); diff --git a/wp-admin/includes/admin.php b/wp-admin/includes/admin.php index 8c3a3eb156..43f0014eb2 100644 --- a/wp-admin/includes/admin.php +++ b/wp-admin/includes/admin.php @@ -74,7 +74,7 @@ require_once( ABSPATH . 'wp-admin/includes/theme.php' ); require_once( ABSPATH . 'wp-admin/includes/privacy-tools.php' ); /** WordPress Privacy List Table classes. */ -// Previously in wp-admin/includes/user.php. Need to be loaded for backwards compatibility. +// Previously in wp-admin/includes/user.php. Need to be loaded for backward compatibility. require_once( ABSPATH . 'wp-admin/includes/class-wp-privacy-requests-table.php' ); require_once( ABSPATH . 'wp-admin/includes/class-wp-privacy-data-export-requests-list-table.php' ); require_once( ABSPATH . 'wp-admin/includes/class-wp-privacy-data-removal-requests-list-table.php' ); diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index 495693c313..f230290bb9 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -22,7 +22,7 @@ function wp_ajax_nopriv_heartbeat() { $response = array(); - // screen_id is the same as $current_screen->id and the JS global 'pagenow'. + // 'screen_id' is the same as $current_screen->id and the JS global 'pagenow'. if ( ! empty( $_POST['screen_id'] ) ) { $screen_id = sanitize_key( $_POST['screen_id'] ); } else { @@ -272,23 +272,23 @@ function wp_ajax_autocomplete_user() { $return = array(); - // Check the type of request - // Current allowed values are `add` and `search` + // Check the type of request. + // Current allowed values are `add` and `search`. if ( isset( $_REQUEST['autocomplete_type'] ) && 'search' === $_REQUEST['autocomplete_type'] ) { $type = $_REQUEST['autocomplete_type']; } else { $type = 'add'; } - // Check the desired field for value - // Current allowed values are `user_email` and `user_login` + // Check the desired field for value. + // Current allowed values are `user_email` and `user_login`. if ( isset( $_REQUEST['autocomplete_field'] ) && 'user_email' === $_REQUEST['autocomplete_field'] ) { $field = $_REQUEST['autocomplete_field']; } else { $field = 'user_login'; } - // Exclude current users of this blog + // Exclude current users of this blog. if ( isset( $_REQUEST['site_id'] ) ) { $id = absint( $_REQUEST['site_id'] ); } else { @@ -433,7 +433,7 @@ function _wp_ajax_delete_comment_response( $comment_id, $delta = -1 ) { $page = isset( $_POST['_page'] ) ? (int) $_POST['_page'] : 0; $url = isset( $_POST['_url'] ) ? esc_url_raw( $_POST['_url'] ) : ''; - // JS didn't send us everything we need to know. Just die with success message + // JS didn't send us everything we need to know. Just die with success message. if ( ! $total || ! $per_page || ! $page || ! $url ) { $time = time(); $comment = get_comment( $comment_id ); @@ -482,7 +482,7 @@ function _wp_ajax_delete_comment_response( $comment_id, $delta = -1 ) { $total = 0; } - // Only do the expensive stuff on a page-break, and about 1 other time per page + // Only do the expensive stuff on a page-break, and about 1 other time per page. if ( 0 == $total % $per_page || 1 == mt_rand( 1, $per_page ) ) { $post_id = 0; // What type of comment count are we looking for? @@ -600,7 +600,7 @@ function _wp_ajax_add_hierarchical_term() { $checked_categories[] = $cat_id; - if ( $parent ) { // Do these all at once in a second + if ( $parent ) { // Do these all at once in a second. continue; } @@ -626,11 +626,11 @@ function _wp_ajax_add_hierarchical_term() { ); } - if ( $parent ) { // Foncy - replace the parent and all its children + if ( $parent ) { // Foncy - replace the parent and all its children. $parent = get_term( $parent, $taxonomy->name ); $term_id = $parent->term_id; - while ( $parent->parent ) { // get the top parent + while ( $parent->parent ) { // Get the top parent. $parent = get_term( $parent->parent, $taxonomy->name ); if ( is_wp_error( $parent ) ) { break; @@ -716,7 +716,8 @@ function wp_ajax_delete_comment() { $r = wp_untrash_comment( $comment ); - if ( ! isset( $_POST['comment_status'] ) || $_POST['comment_status'] != 'trash' ) { // undo trash, not in trash + // Undo trash, not in trash. + if ( ! isset( $_POST['comment_status'] ) || $_POST['comment_status'] != 'trash' ) { $delta = 1; } } elseif ( isset( $_POST['spam'] ) && 1 == $_POST['spam'] ) { @@ -732,7 +733,8 @@ function wp_ajax_delete_comment() { $r = wp_unspam_comment( $comment ); - if ( ! isset( $_POST['comment_status'] ) || $_POST['comment_status'] != 'spam' ) { // undo spam, not in spam + // Undo spam, not in spam. + if ( ! isset( $_POST['comment_status'] ) || $_POST['comment_status'] != 'spam' ) { $delta = 1; } } elseif ( isset( $_POST['delete'] ) && 1 == $_POST['delete'] ) { @@ -741,7 +743,8 @@ function wp_ajax_delete_comment() { wp_die( -1 ); } - if ( $r ) { // Decide if we need to send back '1' or a more complicated response including page links and comment counts + if ( $r ) { + // Decide if we need to send back '1' or a more complicated response including page links and comment counts. _wp_ajax_delete_comment_response( $comment->comment_ID, $delta ); } @@ -989,7 +992,7 @@ function wp_ajax_dim_comment() { $x->send(); } - // Decide if we need to send back '1' or a more complicated response including page links and comment counts + // Decide if we need to send back '1' or a more complicated response including page links and comment counts. _wp_ajax_delete_comment_response( $comment->comment_ID ); wp_die( 0 ); } @@ -1161,7 +1164,7 @@ function wp_ajax_get_tagcloud() { $tags[ $key ]->id = $tag->term_id; } - // We need raw tag names here, so don't filter the output + // We need raw tag names here, so don't filter the output. $return = wp_generate_tag_cloud( $tags, array( @@ -1288,8 +1291,8 @@ function wp_ajax_replyto_comment( $action ) { } if ( wp_create_nonce( 'unfiltered-html-comment' ) != $_POST['_wp_unfiltered_html_comment'] ) { - kses_remove_filters(); // start with a clean slate - kses_init_filters(); // set up the filters + kses_remove_filters(); // Start with a clean slate. + kses_init_filters(); // Set up the filters. remove_filter( 'pre_comment_content', 'wp_filter_post_kses' ); add_filter( 'pre_comment_content', 'wp_filter_kses' ); } @@ -1478,7 +1481,7 @@ function wp_ajax_add_menu_item() { $_menu_items = array_map( 'wp_setup_nav_menu_item', array( $_object ) ); $_menu_item = reset( $_menu_items ); - // Restore the missing menu item properties + // Restore the missing menu item properties. $menu_item_data['menu-item-description'] = $_menu_item->description; } @@ -1498,7 +1501,7 @@ function wp_ajax_add_menu_item() { if ( ! empty( $menu_obj->ID ) ) { $menu_obj = wp_setup_nav_menu_item( $menu_obj ); $menu_obj->title = empty( $menu_obj->title ) ? __( 'Menu Item' ) : $menu_obj->title; - $menu_obj->label = $menu_obj->title; // don't show "(pending)" in ajax-added items + $menu_obj->label = $menu_obj->title; // Don't show "(pending)" in ajax-added items. $menu_items[] = $menu_obj; } } @@ -1548,7 +1551,7 @@ function wp_ajax_add_meta() { // If the post is an autodraft, save the post as a draft and then attempt to save the meta. if ( $post->post_status == 'auto-draft' ) { $post_data = array(); - $post_data['action'] = 'draft'; // Warning fix + $post_data['action'] = 'draft'; // Warning fix. $post_data['post_ID'] = $pid; $post_data['post_type'] = $post->post_type; $post_data['post_status'] = 'draft'; @@ -1608,7 +1611,7 @@ function wp_ajax_add_meta() { $meta = get_metadata_by_mid( 'post', $mid ); if ( ! $meta ) { - wp_die( 0 ); // if meta doesn't exist + wp_die( 0 ); // If meta doesn't exist. } if ( @@ -1731,7 +1734,8 @@ function wp_ajax_closed_postboxes() { } if ( is_array( $hidden ) ) { - $hidden = array_diff( $hidden, array( 'submitdiv', 'linksubmitdiv', 'manage-menu', 'create-menu' ) ); // postboxes that are always shown + // Postboxes that are always shown. + $hidden = array_diff( $hidden, array( 'submitdiv', 'linksubmitdiv', 'manage-menu', 'create-menu' ) ); update_user_option( $user->ID, "metaboxhidden_$page", $hidden, true ); } @@ -2620,7 +2624,7 @@ function wp_ajax_image_editor() { * @since 3.1.0 */ function wp_ajax_set_post_thumbnail() { - $json = ! empty( $_REQUEST['json'] ); // New-style request + $json = ! empty( $_REQUEST['json'] ); // New-style request. $post_ID = intval( $_POST['post_id'] ); if ( ! current_user_can( 'edit_post', $post_ID ) ) { @@ -3226,7 +3230,7 @@ function wp_ajax_send_attachment_to_editor() { $html = stripslashes_deep( $_POST['html'] ); } else { $html = isset( $attachment['post_title'] ) ? $attachment['post_title'] : ''; - $rel = $rel ? ' rel="attachment wp-att-' . $id . '"' : ''; // Hard-coded string, $id is already sanitized + $rel = $rel ? ' rel="attachment wp-att-' . $id . '"' : ''; // Hard-coded string, $id is already sanitized. if ( ! empty( $url ) ) { $html = '' . $html . ''; @@ -3287,7 +3291,7 @@ function wp_ajax_send_link_to_editor() { $fallback = $wp_embed->maybe_make_link( $src ); if ( $check_embed !== $fallback ) { - // TinyMCE view for [embed] will parse this + // TinyMCE view for [embed] will parse this. $html = '[embed]' . $src . '[/embed]'; } elseif ( $link_text ) { $html = '' . $link_text . ''; @@ -3327,7 +3331,7 @@ function wp_ajax_heartbeat() { $data = array(); $nonce_state = wp_verify_nonce( $_POST['_nonce'], 'heartbeat-nonce' ); - // screen_id is the same as $current_screen->id and the JS global 'pagenow'. + // 'screen_id' is the same as $current_screen->id and the JS global 'pagenow'. if ( ! empty( $_POST['screen_id'] ) ) { $screen_id = sanitize_key( $_POST['screen_id'] ); } else { @@ -3392,7 +3396,7 @@ function wp_ajax_heartbeat() { */ do_action( 'heartbeat_tick', $response, $screen_id ); - // Send the current time according to the server + // Send the current time according to the server. $response['server_time'] = time(); wp_send_json( $response ); @@ -3735,7 +3739,7 @@ function wp_ajax_parse_media_shortcode() { $post = get_post( (int) $_POST['post_ID'] ); } - // the embed shortcode requires a post + // The embed shortcode requires a post. if ( ! $post || ! current_user_can( 'edit_post', $post->ID ) ) { if ( 'embed' === $shortcode ) { wp_send_json_error(); diff --git a/wp-admin/includes/class-automatic-upgrader-skin.php b/wp-admin/includes/class-automatic-upgrader-skin.php index e3cc207776..9875c6dee5 100644 --- a/wp-admin/includes/class-automatic-upgrader-skin.php +++ b/wp-admin/includes/class-automatic-upgrader-skin.php @@ -41,8 +41,10 @@ class Automatic_Upgrader_Skin extends WP_Upgrader_Skin { if ( $context ) { $this->options['context'] = $context; } - // TODO: fix up request_filesystem_credentials(), or split it, to allow us to request a no-output version - // This will output a credentials form in event of failure, We don't want that, so just hide with a buffer + /* + * TODO: Fix up request_filesystem_credentials(), or split it, to allow us to request a no-output version. + * This will output a credentials form in event of failure. We don't want that, so just hide with a buffer. + */ ob_start(); $result = parent::request_filesystem_credentials( $error, $context, $allow_relaxed_file_ownership ); ob_end_clean(); diff --git a/wp-admin/includes/class-core-upgrader.php b/wp-admin/includes/class-core-upgrader.php index dd3f540dda..328c91de15 100644 --- a/wp-admin/includes/class-core-upgrader.php +++ b/wp-admin/includes/class-core-upgrader.php @@ -115,7 +115,7 @@ class Core_Upgrader extends WP_Upgrader { $to_download = 'full'; } - // Lock to prevent multiple Core Updates occurring + // Lock to prevent multiple Core Updates occurring. $lock = WP_Upgrader::create_lock( 'core_updater', 15 * MINUTE_IN_SECONDS ); if ( ! $lock ) { return new WP_Error( 'locked', $this->strings['locked'] ); @@ -220,7 +220,7 @@ class Core_Upgrader extends WP_Upgrader { ) ); - // Clear the current updates + // Clear the current updates. delete_site_transient( 'update_core' ); if ( ! $parsed_args['do_rollback'] ) { @@ -272,8 +272,9 @@ class Core_Upgrader extends WP_Upgrader { public static function should_update_to_version( $offered_ver ) { include( ABSPATH . WPINC . '/version.php' ); // $wp_version; // x.y.z - $current_branch = implode( '.', array_slice( preg_split( '/[.-]/', $wp_version ), 0, 2 ) ); // x.y - $new_branch = implode( '.', array_slice( preg_split( '/[.-]/', $offered_ver ), 0, 2 ) ); // x.y + $current_branch = implode( '.', array_slice( preg_split( '/[.-]/', $wp_version ), 0, 2 ) ); // x.y + $new_branch = implode( '.', array_slice( preg_split( '/[.-]/', $offered_ver ), 0, 2 ) ); // x.y + $current_is_development_version = (bool) strpos( $wp_version, '-' ); // Defaults: @@ -284,17 +285,17 @@ class Core_Upgrader extends WP_Upgrader { // WP_AUTO_UPDATE_CORE = true (all), 'minor', false. if ( defined( 'WP_AUTO_UPDATE_CORE' ) ) { if ( false === WP_AUTO_UPDATE_CORE ) { - // Defaults to turned off, unless a filter allows it + // Defaults to turned off, unless a filter allows it. $upgrade_dev = false; $upgrade_minor = false; $upgrade_major = false; } elseif ( true === WP_AUTO_UPDATE_CORE ) { - // ALL updates for core + // ALL updates for core. $upgrade_dev = true; $upgrade_minor = true; $upgrade_major = true; } elseif ( 'minor' === WP_AUTO_UPDATE_CORE ) { - // Only minor updates for core + // Only minor updates for core. $upgrade_dev = false; $upgrade_minor = true; $upgrade_major = false; @@ -306,7 +307,7 @@ class Core_Upgrader extends WP_Upgrader { return false; } - // 2: If we're running a newer version, that's a nope + // 2: If we're running a newer version, that's a nope. if ( version_compare( $wp_version, $offered_ver, '>' ) ) { return false; } @@ -323,15 +324,17 @@ class Core_Upgrader extends WP_Upgrader { return false; } - // Cannot update if we're retrying the same A to B update that caused a non-critical failure. - // Some non-critical failures do allow retries, like download_failed. - // 3.7.1 => 3.7.2 resulted in files_not_writable, if we are still on 3.7.1 and still trying to update to 3.7.2. + /* + * Cannot update if we're retrying the same A to B update that caused a non-critical failure. + * Some non-critical failures do allow retries, like download_failed. + * 3.7.1 => 3.7.2 resulted in files_not_writable, if we are still on 3.7.1 and still trying to update to 3.7.2. + */ if ( empty( $failure_data['retry'] ) && $wp_version == $failure_data['current'] && $offered_ver == $failure_data['attempted'] ) { return false; } } - // 3: 3.7-alpha-25000 -> 3.7-alpha-25678 -> 3.7-beta1 -> 3.7-beta2 + // 3: 3.7-alpha-25000 -> 3.7-alpha-25678 -> 3.7-beta1 -> 3.7-beta2. if ( $current_is_development_version ) { /** @@ -348,7 +351,7 @@ class Core_Upgrader extends WP_Upgrader { // Else fall through to minor + major branches below. } - // 4: Minor In-branch updates (3.7.0 -> 3.7.1 -> 3.7.2 -> 3.7.4) + // 4: Minor in-branch updates (3.7.0 -> 3.7.1 -> 3.7.2 -> 3.7.4). if ( $current_branch == $new_branch ) { /** @@ -361,7 +364,7 @@ class Core_Upgrader extends WP_Upgrader { return apply_filters( 'allow_minor_auto_core_updates', $upgrade_minor ); } - // 5: Major version updates (3.7.0 -> 3.8.0 -> 3.9.1) + // 5: Major version updates (3.7.0 -> 3.8.0 -> 3.9.1). if ( version_compare( $new_branch, $current_branch, '>' ) ) { /** @@ -374,7 +377,7 @@ class Core_Upgrader extends WP_Upgrader { return apply_filters( 'allow_major_auto_core_updates', $upgrade_major ); } - // If we're not sure, we don't want it + // If we're not sure, we don't want it. return false; } @@ -398,7 +401,7 @@ class Core_Upgrader extends WP_Upgrader { } foreach ( $checksums as $file => $checksum ) { - // Skip files which get updated + // Skip files which get updated. if ( 'wp-content' == substr( $file, 0, 10 ) ) { continue; } diff --git a/wp-admin/includes/class-custom-background.php b/wp-admin/includes/class-custom-background.php index ea74ef420c..30a05bf607 100644 --- a/wp-admin/includes/class-custom-background.php +++ b/wp-admin/includes/class-custom-background.php @@ -124,7 +124,7 @@ class Custom_Background { } if ( isset( $_POST['remove-background'] ) ) { - // @TODO: Uploaded files are not removed here. + // @todo Uploaded files are not removed here. check_admin_referer( 'custom-background-remove', '_wpnonce-custom-background-remove' ); set_theme_mod( 'background_image', '' ); set_theme_mod( 'background_image_thumb', '' ); @@ -284,7 +284,7 @@ class Custom_Background { . " background-attachment: $background_attachment;"; } ?> -
+

@@ -503,7 +503,7 @@ class Custom_Background { $file = $file['file']; $filename = wp_basename( $file ); - // Construct the object array + // Construct the object array. $object = array( 'post_title' => $filename, 'post_content' => $url, @@ -512,10 +512,10 @@ class Custom_Background { 'context' => 'custom-background', ); - // Save the data + // Save the data. $id = wp_insert_attachment( $object, $file ); - // Add the meta-data + // Add the metadata. wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); update_post_meta( $id, '_wp_attachment_is_custom_background', get_option( 'stylesheet' ) ); @@ -525,7 +525,7 @@ class Custom_Background { set_theme_mod( 'background_image_thumb', esc_url_raw( $thumbnail[0] ) ); /** This action is documented in wp-admin/includes/class-custom-image-header.php */ - do_action( 'wp_create_file_in_uploads', $file, $id ); // For replication + do_action( 'wp_create_file_in_uploads', $file, $id ); // For replication. $this->updated = true; } diff --git a/wp-admin/includes/class-custom-image-header.php b/wp-admin/includes/class-custom-image-header.php index 12d307d6d4..4f3eb75786 100644 --- a/wp-admin/includes/class-custom-image-header.php +++ b/wp-admin/includes/class-custom-image-header.php @@ -800,7 +800,7 @@ endif; } $max_width = 0; - // For flex, limit size of image displayed to 1500px unless theme says otherwise + // For flex, limit size of image displayed to 1500px unless theme says otherwise. if ( current_theme_supports( 'custom-header', 'flex-width' ) ) { $max_width = 1500; } @@ -810,10 +810,10 @@ endif; } $max_width = max( $max_width, get_theme_support( 'custom-header', 'width' ) ); - // If flexible height isn't supported and the image is the exact right size + // If flexible height isn't supported and the image is the exact right size. if ( ! current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' ) && $width == get_theme_support( 'custom-header', 'width' ) && $height == get_theme_support( 'custom-header', 'height' ) ) { - // Add the meta-data + // Add the metadata. if ( file_exists( $file ) ) { wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) ); } @@ -828,7 +828,7 @@ endif; * @param string $file Path to the file. * @param int $attachment_id Attachment ID. */ - do_action( 'wp_create_file_in_uploads', $file, $attachment_id ); // For replication + do_action( 'wp_create_file_in_uploads', $file, $attachment_id ); // For replication. return $this->finished(); } elseif ( $width > $max_width ) { @@ -839,7 +839,7 @@ endif; } /** This filter is documented in wp-admin/includes/class-custom-image-header.php */ - $image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); // For replication + $image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); // For replication. $url = str_replace( wp_basename( $url ), wp_basename( $image ), $url ); $width = $width / $oitar; @@ -910,7 +910,7 @@ endif; $file = $file['file']; $filename = wp_basename( $file ); - // Construct the object array + // Construct the object array. $object = array( 'post_title' => $filename, 'post_content' => $url, @@ -919,7 +919,7 @@ endif; 'context' => 'custom-header', ); - // Save the data + // Save the data. $attachment_id = wp_insert_attachment( $object, $file ); return compact( 'attachment_id', 'file', 'filename', 'url', 'type' ); } @@ -982,7 +982,7 @@ endif; } /** This filter is documented in wp-admin/includes/class-custom-image-header.php */ - $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication + $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication. $object = $this->create_attachment_object( $cropped, $attachment_id ); @@ -990,7 +990,7 @@ endif; unset( $object['ID'] ); } - // Update the attachment + // Update the attachment. $attachment_id = $this->insert_attachment( $object, $cropped ); $url = wp_get_attachment_url( $attachment_id ); @@ -1180,7 +1180,7 @@ endif; 'dst_width' => null, ); - // For flex, limit size of image displayed to 1500px unless theme says otherwise + // For flex, limit size of image displayed to 1500px unless theme says otherwise. if ( $has_flex_width ) { $max_width = 1500; } @@ -1318,7 +1318,7 @@ endif; } /** This filter is documented in wp-admin/includes/class-custom-image-header.php */ - $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication + $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication. $object = $this->create_attachment_object( $cropped, $attachment_id ); @@ -1434,8 +1434,8 @@ endif; // Get the default image if there is one. $default = get_theme_support( 'custom-header', 'default-image' ); - if ( ! $default ) { // If not, - return $this->default_headers; // easy peasy. + if ( ! $default ) { // If not, easy peasy. + return $this->default_headers; } $default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() ); diff --git a/wp-admin/includes/class-file-upload-upgrader.php b/wp-admin/includes/class-file-upload-upgrader.php index 52e103cc79..3bdae332c8 100644 --- a/wp-admin/includes/class-file-upload-upgrader.php +++ b/wp-admin/includes/class-file-upload-upgrader.php @@ -56,7 +56,7 @@ class File_Upload_Upgrader { wp_die( __( 'Please select a file' ) ); } - //Handle a newly uploaded file, Else assume it's already been uploaded + // Handle a newly uploaded file. Else, assume it's already been uploaded. if ( ! empty( $_FILES ) ) { $overrides = array( 'test_form' => false, @@ -71,7 +71,7 @@ class File_Upload_Upgrader { $this->filename = $_FILES[ $form ]['name']; $this->package = $file['file']; - // Construct the object array + // Construct the object array. $object = array( 'post_title' => $this->filename, 'post_content' => $file['url'], diff --git a/wp-admin/includes/class-language-pack-upgrader.php b/wp-admin/includes/class-language-pack-upgrader.php index 72a86bb32f..0ae18d9e50 100644 --- a/wp-admin/includes/class-language-pack-upgrader.php +++ b/wp-admin/includes/class-language-pack-upgrader.php @@ -192,7 +192,7 @@ class Language_Pack_Upgrader extends WP_Upgrader { $this->skin->feedback( 'starting_upgrade' ); } - // Remove any existing upgrade filters from the plugin/theme upgraders #WP29425 & #WP29230 + // Remove any existing upgrade filters from the plugin/theme upgraders #WP29425 & #WP29230. remove_all_filters( 'upgrader_pre_install' ); remove_all_filters( 'upgrader_clear_destination' ); remove_all_filters( 'upgrader_post_install' ); @@ -202,7 +202,7 @@ class Language_Pack_Upgrader extends WP_Upgrader { $this->skin->header(); - // Connect to the Filesystem first. + // Connect to the filesystem first. $res = $this->fs_connect( array( WP_CONTENT_DIR, WP_LANG_DIR ) ); if ( ! $res ) { $this->skin->footer(); @@ -369,7 +369,7 @@ class Language_Pack_Upgrader extends WP_Upgrader { public function get_name_for_update( $update ) { switch ( $update->type ) { case 'core': - return 'WordPress'; // Not translated + return 'WordPress'; // Not translated. case 'theme': $theme = wp_get_theme( $update->slug ); diff --git a/wp-admin/includes/class-plugin-upgrader.php b/wp-admin/includes/class-plugin-upgrader.php index e4b6f54baa..28523e9db8 100644 --- a/wp-admin/includes/class-plugin-upgrader.php +++ b/wp-admin/includes/class-plugin-upgrader.php @@ -123,7 +123,7 @@ class Plugin_Upgrader extends WP_Upgrader { return $this->result; } - // Force refresh of plugin update information + // Force refresh of plugin update information. wp_clean_plugins_cache( $parsed_args['clear_update_cache'] ); return true; @@ -163,12 +163,13 @@ class Plugin_Upgrader extends WP_Upgrader { return false; } - // Get the URL to the zip file + // Get the URL to the zip file. $r = $current->response[ $plugin ]; add_filter( 'upgrader_pre_install', array( $this, 'deactivate_plugin_before_upgrade' ), 10, 2 ); add_filter( 'upgrader_clear_destination', array( $this, 'delete_old_plugin' ), 10, 4 ); - //'source_selection' => array($this, 'source_selection'), //there's a trac ticket to move up the directory for zip's which are made a bit differently, useful for non-.org plugins. + // There's a Trac ticket to move up the directory for zips which are made a bit differently, useful for non-.org plugins. + // 'source_selection' => array( $this, 'source_selection' ), if ( $parsed_args['clear_update_cache'] ) { // Clear cache so wp_update_plugins() knows about the new plugin. add_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9, 0 ); @@ -197,7 +198,7 @@ class Plugin_Upgrader extends WP_Upgrader { return $this->result; } - // Force refresh of plugin update information + // Force refresh of plugin update information. wp_clean_plugins_cache( $parsed_args['clear_update_cache'] ); return true; @@ -234,7 +235,7 @@ class Plugin_Upgrader extends WP_Upgrader { $this->skin->header(); - // Connect to the Filesystem first. + // Connect to the filesystem first. $res = $this->fs_connect( array( WP_CONTENT_DIR, WP_PLUGIN_DIR ) ); if ( ! $res ) { $this->skin->footer(); @@ -247,7 +248,7 @@ class Plugin_Upgrader extends WP_Upgrader { * Only start maintenance mode if: * - running Multisite and there are one or more plugins specified, OR * - a plugin with an update available is currently active. - * @TODO: For multisite, maintenance mode should only kick in for individual sites if at all possible. + * @todo For multisite, maintenance mode should only kick in for individual sites if at all possible. */ $maintenance = ( is_multisite() && ! empty( $plugins ) ); foreach ( $plugins as $plugin ) { @@ -294,11 +295,11 @@ class Plugin_Upgrader extends WP_Upgrader { $results[ $plugin ] = $this->result; - // Prevent credentials auth screen from displaying multiple times + // Prevent credentials auth screen from displaying multiple times. if ( false === $result ) { break; } - } //end foreach $plugins + } // End foreach $plugins. $this->maintenance_mode( false ); @@ -353,7 +354,7 @@ class Plugin_Upgrader extends WP_Upgrader { return $source; } - // Check the folder contains at least 1 valid plugin. + // Check that the folder contains at least 1 valid plugin. $plugins_found = false; $files = glob( $working_directory . '*.php' ); if ( $files ) { @@ -390,12 +391,14 @@ class Plugin_Upgrader extends WP_Upgrader { return false; } - $plugin = get_plugins( '/' . $this->result['destination_name'] ); //Ensure to pass with leading slash + // Ensure to pass with leading slash. + $plugin = get_plugins( '/' . $this->result['destination_name'] ); if ( empty( $plugin ) ) { return false; } - $pluginfiles = array_keys( $plugin ); //Assume the requested plugin is the first in the list + // Assume the requested plugin is the first in the list. + $pluginfiles = array_keys( $plugin ); return $this->result['destination_name'] . '/' . $pluginfiles[0]; } @@ -414,11 +417,11 @@ class Plugin_Upgrader extends WP_Upgrader { */ public function deactivate_plugin_before_upgrade( $return, $plugin ) { - if ( is_wp_error( $return ) ) { //Bypass. + if ( is_wp_error( $return ) ) { // Bypass. return $return; } - // When in cron (background updates) don't deactivate the plugin, as we require a browser to reactivate it + // When in cron (background updates) don't deactivate the plugin, as we require a browser to reactivate it. if ( wp_doing_cron() ) { return $return; } @@ -429,7 +432,7 @@ class Plugin_Upgrader extends WP_Upgrader { } if ( is_plugin_active( $plugin ) ) { - //Deactivate the plugin silently, Prevent deactivation hooks from running. + // Deactivate the plugin silently, Prevent deactivation hooks from running. deactivate_plugins( $plugin, true ); } @@ -456,7 +459,7 @@ class Plugin_Upgrader extends WP_Upgrader { global $wp_filesystem; if ( is_wp_error( $removed ) ) { - return $removed; //Pass errors through. + return $removed; // Pass errors through. } $plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : ''; @@ -467,12 +470,13 @@ class Plugin_Upgrader extends WP_Upgrader { $plugins_dir = $wp_filesystem->wp_plugins_dir(); $this_plugin_dir = trailingslashit( dirname( $plugins_dir . $plugin ) ); - if ( ! $wp_filesystem->exists( $this_plugin_dir ) ) { //If it's already vanished. + if ( ! $wp_filesystem->exists( $this_plugin_dir ) ) { // If it's already vanished. return $removed; } // If plugin is in its own directory, recursively delete the directory. - if ( strpos( $plugin, '/' ) && $this_plugin_dir != $plugins_dir ) { //base check on if plugin includes directory separator AND that it's not the root plugin folder + // Base check on if plugin includes directory separator AND that it's not the root plugin folder. + if ( strpos( $plugin, '/' ) && $this_plugin_dir != $plugins_dir ) { $deleted = $wp_filesystem->delete( $this_plugin_dir, true ); } else { $deleted = $wp_filesystem->delete( $plugins_dir . $plugin ); diff --git a/wp-admin/includes/class-theme-upgrader.php b/wp-admin/includes/class-theme-upgrader.php index 5abf380324..ec177a249e 100644 --- a/wp-admin/includes/class-theme-upgrader.php +++ b/wp-admin/includes/class-theme-upgrader.php @@ -94,7 +94,7 @@ class Theme_Upgrader extends WP_Upgrader { * @return bool */ public function check_parent_theme_filter( $install_result, $hook_extra, $child_result ) { - // Check to see if we need to install a parent theme + // Check to see if we need to install a parent theme. $theme_info = $this->theme_info(); if ( ! $theme_info->parent() ) { @@ -119,11 +119,11 @@ class Theme_Upgrader extends WP_Upgrader { 'tags' => false, ), ) - ); //Save on a bit of bandwidth. + ); // Save on a bit of bandwidth. if ( ! $api || is_wp_error( $api ) ) { $this->skin->feedback( 'parent_theme_not_found', $theme_info->get( 'Template' ) ); - // Don't show activate or preview actions after installation + // Don't show activate or preview actions after installation. add_filter( 'install_theme_complete_actions', array( $this, 'hide_activate_preview_actions' ) ); return $install_result; } @@ -132,20 +132,21 @@ class Theme_Upgrader extends WP_Upgrader { $child_api = $this->skin->api; $child_success_message = $this->strings['process_success']; - // Override them - $this->skin->api = $api; - $this->strings['process_success_specific'] = $this->strings['parent_theme_install_success'];//, $api->name, $api->version); + // Override them. + $this->skin->api = $api; + + $this->strings['process_success_specific'] = $this->strings['parent_theme_install_success']; //, $api->name, $api->version ); $this->skin->feedback( 'parent_theme_prepare_install', $api->name, $api->version ); add_filter( 'install_theme_complete_actions', '__return_false', 999 ); // Don't show any actions after installing the theme. - // Install the parent theme + // Install the parent theme. $parent_result = $this->run( array( 'package' => $api->download_link, 'destination' => get_theme_root(), - 'clear_destination' => false, //Do not overwrite files. + 'clear_destination' => false, // Do not overwrite files. 'clear_working' => true, ) ); @@ -154,10 +155,10 @@ class Theme_Upgrader extends WP_Upgrader { add_filter( 'install_theme_complete_actions', array( $this, 'hide_activate_preview_actions' ) ); } - // Start cleaning up after the parents installation + // Start cleaning up after the parent's installation. remove_filter( 'install_theme_complete_actions', '__return_false', 999 ); - // Reset child's result and data + // Reset child's result and data. $this->result = $child_result; $this->skin->api = $child_api; $this->strings['process_success'] = $child_success_message; @@ -219,7 +220,7 @@ class Theme_Upgrader extends WP_Upgrader { array( 'package' => $package, 'destination' => get_theme_root(), - 'clear_destination' => false, //Do not overwrite files. + 'clear_destination' => false, // Do not overwrite files. 'clear_working' => true, 'hook_extra' => array( 'type' => 'theme', @@ -236,7 +237,7 @@ class Theme_Upgrader extends WP_Upgrader { return $this->result; } - // Refresh the Theme Update information + // Refresh the Theme Update information. wp_clean_themes_cache( $parsed_args['clear_update_cache'] ); return true; @@ -349,7 +350,7 @@ class Theme_Upgrader extends WP_Upgrader { $this->skin->header(); - // Connect to the Filesystem first. + // Connect to the filesystem first. $res = $this->fs_connect( array( WP_CONTENT_DIR ) ); if ( ! $res ) { $this->skin->footer(); @@ -358,10 +359,12 @@ class Theme_Upgrader extends WP_Upgrader { $this->skin->bulk_header(); - // Only start maintenance mode if: - // - running Multisite and there are one or more themes specified, OR - // - a theme with an update available is currently in use. - // @TODO: For multisite, maintenance mode should only kick in for individual sites if at all possible. + /* + * Only start maintenance mode if: + * - running Multisite and there are one or more themes specified, OR + * - a theme with an update available is currently in use. + * @todo For multisite, maintenance mode should only kick in for individual sites if at all possible. + */ $maintenance = ( is_multisite() && ! empty( $themes ) ); foreach ( $themes as $theme ) { $maintenance = $maintenance || $theme == get_stylesheet() || $theme == get_template(); @@ -388,7 +391,7 @@ class Theme_Upgrader extends WP_Upgrader { continue; } - // Get the URL to the zip file + // Get the URL to the zip file. $r = $current->response[ $theme ]; $result = $this->run( @@ -406,15 +409,15 @@ class Theme_Upgrader extends WP_Upgrader { $results[ $theme ] = $this->result; - // Prevent credentials auth screen from displaying multiple times + // Prevent credentials auth screen from displaying multiple times. if ( false === $result ) { break; } - } //end foreach $plugins + } // End foreach $themes. $this->maintenance_mode( false ); - // Refresh the Theme Update information + // Refresh the Theme Update information. wp_clean_themes_cache( $parsed_args['clear_update_cache'] ); /** This action is documented in wp-admin/includes/class-wp-upgrader.php */ @@ -462,13 +465,13 @@ class Theme_Upgrader extends WP_Upgrader { return $source; } - // Check the folder contains a valid theme + // Check that the folder contains a valid theme. $working_directory = str_replace( $wp_filesystem->wp_content_dir(), trailingslashit( WP_CONTENT_DIR ), $source ); if ( ! is_dir( $working_directory ) ) { // Sanity check, if the above fails, let's not prevent installation. return $source; } - // A proper archive should have a style.css file in the single subdirectory + // A proper archive should have a style.css file in the single subdirectory. if ( ! file_exists( $working_directory . 'style.css' ) ) { return new WP_Error( 'incompatible_archive_theme_no_style', @@ -536,10 +539,11 @@ class Theme_Upgrader extends WP_Upgrader { $theme = isset( $theme['theme'] ) ? $theme['theme'] : ''; - if ( $theme != get_stylesheet() ) { //If not current + if ( $theme != get_stylesheet() ) { // If not current. return $return; } - //Change to maintenance mode now. + + // Change to maintenance mode now. if ( ! $this->bulk ) { $this->maintenance_mode( true ); } @@ -566,7 +570,7 @@ class Theme_Upgrader extends WP_Upgrader { $theme = isset( $theme['theme'] ) ? $theme['theme'] : ''; - if ( $theme != get_stylesheet() ) { // If not current + if ( $theme != get_stylesheet() ) { // If not current. return $return; } @@ -577,7 +581,7 @@ class Theme_Upgrader extends WP_Upgrader { switch_theme( $stylesheet ); } - //Time to remove maintenance mode + // Time to remove maintenance mode. if ( ! $this->bulk ) { $this->maintenance_mode( false ); } diff --git a/wp-admin/includes/class-walker-category-checklist.php b/wp-admin/includes/class-walker-category-checklist.php index 76c4f2bcbd..553494d165 100644 --- a/wp-admin/includes/class-walker-category-checklist.php +++ b/wp-admin/includes/class-walker-category-checklist.php @@ -21,7 +21,7 @@ class Walker_Category_Checklist extends Walker { public $db_fields = array( 'parent' => 'parent', 'id' => 'term_id', - ); //TODO: decouple this + ); // TODO: Decouple this. /** * Starts the list before the elements are added. diff --git a/wp-admin/includes/class-walker-nav-menu-checklist.php b/wp-admin/includes/class-walker-nav-menu-checklist.php index 6cacf1874a..ea4b362bb3 100644 --- a/wp-admin/includes/class-walker-nav-menu-checklist.php +++ b/wp-admin/includes/class-walker-nav-menu-checklist.php @@ -106,7 +106,7 @@ class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu { $output .= ''; - // Menu item hidden fields + // Menu item hidden fields. $output .= ''; $output .= ''; $output .= ''; @@ -119,4 +119,4 @@ class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu { $output .= ''; } -} // Walker_Nav_Menu_Checklist +} diff --git a/wp-admin/includes/class-walker-nav-menu-edit.php b/wp-admin/includes/class-walker-nav-menu-edit.php index fdb247f065..3c984950b0 100644 --- a/wp-admin/includes/class-walker-nav-menu-edit.php +++ b/wp-admin/includes/class-walker-nav-menu-edit.php @@ -295,4 +295,4 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu { $output .= ob_get_clean(); } -} // Walker_Nav_Menu_Edit +} diff --git a/wp-admin/includes/class-wp-automatic-updater.php b/wp-admin/includes/class-wp-automatic-updater.php index fe0142dc7a..cf37ca0e4a 100644 --- a/wp-admin/includes/class-wp-automatic-updater.php +++ b/wp-admin/includes/class-wp-automatic-updater.php @@ -141,7 +141,7 @@ class WP_Automatic_Updater { return false; } - // Only relax the filesystem checks when the update doesn't include new files + // Only relax the filesystem checks when the update doesn't include new files. $allow_relaxed_file_ownership = false; if ( 'core' == $type && isset( $item->new_files ) && ! $item->new_files ) { $allow_relaxed_file_ownership = true; @@ -283,7 +283,7 @@ class WP_Automatic_Updater { break; case 'plugin': $upgrader = new Plugin_Upgrader( $skin ); - $context = WP_PLUGIN_DIR; // We don't support custom Plugin directories, or updates for WPMU_PLUGIN_DIR + $context = WP_PLUGIN_DIR; // We don't support custom Plugin directories, or updates for WPMU_PLUGIN_DIR. break; case 'theme': $upgrader = new Theme_Upgrader( $skin ); @@ -357,7 +357,7 @@ class WP_Automatic_Updater { 'pre_check_md5' => false, // Only available for core updates. 'attempt_rollback' => true, - // Allow relaxed file ownership in some scenarios + // Allow relaxed file ownership in some scenarios. 'allow_relaxed_file_ownership' => $allow_relaxed_file_ownership, ) ); @@ -409,51 +409,51 @@ class WP_Automatic_Updater { return; } - // Don't automatically run these thins, as we'll handle it ourselves + // Don't automatically run these things, as we'll handle it ourselves. remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 ); remove_action( 'upgrader_process_complete', 'wp_version_check' ); remove_action( 'upgrader_process_complete', 'wp_update_plugins' ); remove_action( 'upgrader_process_complete', 'wp_update_themes' ); - // Next, Plugins - wp_update_plugins(); // Check for Plugin updates + // Next, plugins. + wp_update_plugins(); // Check for plugin updates. $plugin_updates = get_site_transient( 'update_plugins' ); if ( $plugin_updates && ! empty( $plugin_updates->response ) ) { foreach ( $plugin_updates->response as $plugin ) { $this->update( 'plugin', $plugin ); } - // Force refresh of plugin update information + // Force refresh of plugin update information. wp_clean_plugins_cache(); } - // Next, those themes we all love - wp_update_themes(); // Check for Theme updates + // Next, those themes we all love. + wp_update_themes(); // Check for theme updates. $theme_updates = get_site_transient( 'update_themes' ); if ( $theme_updates && ! empty( $theme_updates->response ) ) { foreach ( $theme_updates->response as $theme ) { $this->update( 'theme', (object) $theme ); } - // Force refresh of theme update information + // Force refresh of theme update information. wp_clean_themes_cache(); } - // Next, Process any core update - wp_version_check(); // Check for Core updates + // Next, process any core update. + wp_version_check(); // Check for core updates. $core_update = find_core_auto_update(); if ( $core_update ) { $this->update( 'core', $core_update ); } - // Clean up, and check for any pending translations - // (Core_Upgrader checks for core updates) + // Clean up, and check for any pending translations. + // (Core_Upgrader checks for core updates.) $theme_stats = array(); if ( isset( $this->update_results['theme'] ) ) { foreach ( $this->update_results['theme'] as $upgrade ) { $theme_stats[ $upgrade->item->theme ] = ( true === $upgrade->result ); } } - wp_update_themes( $theme_stats ); // Check for Theme updates + wp_update_themes( $theme_stats ); // Check for theme updates. $plugin_stats = array(); if ( isset( $this->update_results['plugin'] ) ) { @@ -461,21 +461,21 @@ class WP_Automatic_Updater { $plugin_stats[ $upgrade->item->plugin ] = ( true === $upgrade->result ); } } - wp_update_plugins( $plugin_stats ); // Check for Plugin updates + wp_update_plugins( $plugin_stats ); // Check for plugin updates. - // Finally, Process any new translations + // Finally, process any new translations. $language_updates = wp_get_translation_updates(); if ( $language_updates ) { foreach ( $language_updates as $update ) { $this->update( 'translation', $update ); } - // Clear existing caches + // Clear existing caches. wp_clean_update_cache(); - wp_version_check(); // check for Core updates - wp_update_themes(); // Check for Theme updates - wp_update_plugins(); // Check for Plugin updates + wp_version_check(); // Check for core updates. + wp_update_themes(); // Check for theme updates. + wp_update_plugins(); // Check for plugin updates. } // Send debugging email to admin for all development installations. @@ -626,7 +626,7 @@ class WP_Automatic_Updater { ); $next_user_core_update = get_preferred_from_update_core(); - // If the update transient is empty, use the update we just performed + // If the update transient is empty, use the update we just performed. if ( ! $next_user_core_update ) { $next_user_core_update = $core_update; } @@ -860,7 +860,7 @@ class WP_Automatic_Updater { /* translators: %s: Network home URL. */ $body[] = sprintf( __( 'WordPress site: %s' ), network_home_url( '/' ) ); - // Core + // Core. if ( isset( $this->update_results['core'] ) ) { $result = $this->update_results['core'][0]; if ( $result->result && ! is_wp_error( $result->result ) ) { @@ -874,7 +874,7 @@ class WP_Automatic_Updater { $body[] = ''; } - // Plugins, Themes, Translations + // Plugins, Themes, Translations. foreach ( array( 'plugin', 'theme', 'translation' ) as $type ) { if ( ! isset( $this->update_results[ $type ] ) ) { continue; @@ -894,7 +894,7 @@ class WP_Automatic_Updater { } } if ( $success_items != $this->update_results[ $type ] ) { - // Failed updates + // Failed updates. $messages = array( 'plugin' => __( 'The following plugins failed to update:' ), 'theme' => __( 'The following themes failed to update:' ), diff --git a/wp-admin/includes/class-wp-comments-list-table.php b/wp-admin/includes/class-wp-comments-list-table.php index a11eefc873..b0ad3494f4 100644 --- a/wp-admin/includes/class-wp-comments-list-table.php +++ b/wp-admin/includes/class-wp-comments-list-table.php @@ -100,7 +100,7 @@ class WP_Comments_List_Table extends WP_List_Table { if ( isset( $_REQUEST['number'] ) ) { $number = (int) $_REQUEST['number']; } else { - $number = $comments_per_page + min( 8, $comments_per_page ); // Grab a few extra + $number = $comments_per_page + min( 8, $comments_per_page ); // Grab a few extra. } $page = $this->get_pagenum(); @@ -222,7 +222,7 @@ class WP_Comments_List_Table extends WP_List_Table { 'All (%s)', 'All (%s)', 'comments' - ), // singular not used + ), // Singular not used. /* translators: %s: Number of comments. */ 'mine' => _nx_noop( @@ -746,7 +746,7 @@ class WP_Comments_List_Table extends WP_List_Table { ++$i; ( ( ( 'approve' === $action || 'unapprove' === $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | '; - // Reply and quickedit need a hide-if-no-js span when not added with ajax + // Reply and quickedit need a hide-if-no-js span when not added with ajax. if ( ( 'reply' === $action || 'quickedit' === $action ) && ! wp_doing_ajax() ) { $action .= ' hide-if-no-js'; } elseif ( ( $action === 'untrash' && $the_comment_status === 'trash' ) || ( $action === 'unspam' && $the_comment_status === 'spam' ) ) { diff --git a/wp-admin/includes/class-wp-community-events.php b/wp-admin/includes/class-wp-community-events.php index 776d72f2f2..8b7acc04ab 100644 --- a/wp-admin/includes/class-wp-community-events.php +++ b/wp-admin/includes/class-wp-community-events.php @@ -92,7 +92,7 @@ class WP_Community_Events { return $cached_events; } - // include an unmodified $wp_version + // Include an unmodified $wp_version. include( ABSPATH . WPINC . '/version.php' ); $api_url = 'http://api.wordpress.org/events/1.0/'; diff --git a/wp-admin/includes/class-wp-debug-data.php b/wp-admin/includes/class-wp-debug-data.php index 0e7cbcbf34..23aa3678e4 100644 --- a/wp-admin/includes/class-wp-debug-data.php +++ b/wp-admin/includes/class-wp-debug-data.php @@ -580,7 +580,7 @@ class WP_Debug_Data { if ( function_exists( 'phpversion' ) ) { $php_version_debug = phpversion(); - // Whether PHP supports 64bit + // Whether PHP supports 64-bit. $php64bit = ( PHP_INT_SIZE * 8 === 64 ); $php_version = sprintf( @@ -677,7 +677,7 @@ class WP_Debug_Data { ); } - // SUHOSIN + // SUHOSIN. $suhosin_loaded = ( extension_loaded( 'suhosin' ) || ( defined( 'SUHOSIN_PATCH' ) && constant( 'SUHOSIN_PATCH' ) ) ); $info['wp-server']['fields']['suhosin'] = array( @@ -686,7 +686,7 @@ class WP_Debug_Data { 'debug' => $suhosin_loaded, ); - // Imagick + // Imagick. $imagick_loaded = extension_loaded( 'imagick' ); $info['wp-server']['fields']['imagick_availability'] = array( @@ -1012,7 +1012,7 @@ class WP_Debug_Data { $theme_version = $theme->version; $theme_author = $theme->author; - // Sanitize + // Sanitize. $theme_author = wp_kses( $theme_author, array() ); $theme_version_string = __( 'No version or author information is available.' ); @@ -1054,7 +1054,7 @@ class WP_Debug_Data { ); } - // Add more filesystem checks + // Add more filesystem checks. if ( defined( 'WPMU_PLUGIN_DIR' ) && is_dir( WPMU_PLUGIN_DIR ) ) { $is_writable_wpmu_plugin_dir = wp_is_writable( WPMU_PLUGIN_DIR ); diff --git a/wp-admin/includes/class-wp-filesystem-base.php b/wp-admin/includes/class-wp-filesystem-base.php index fe8f4b27b6..d9459b31df 100644 --- a/wp-admin/includes/class-wp-filesystem-base.php +++ b/wp-admin/includes/class-wp-filesystem-base.php @@ -55,7 +55,8 @@ class WP_Filesystem_Base { */ public function abspath() { $folder = $this->find_folder( ABSPATH ); - // Perhaps the FTP folder is rooted at the WordPress install, Check for wp-includes folder in root, Could have some false positives, but rare. + // Perhaps the FTP folder is rooted at the WordPress install. + // Check for wp-includes folder in root. Could have some false positives, but rare. if ( ! $folder && $this->is_dir( '/' . WPINC ) ) { $folder = '/'; } @@ -96,7 +97,7 @@ class WP_Filesystem_Base { public function wp_themes_dir( $theme = false ) { $theme_root = get_theme_root( $theme ); - // Account for relative theme roots + // Account for relative theme roots. if ( '/themes' == $theme_root || ! is_dir( $theme_root ) ) { $theme_root = WP_CONTENT_DIR . $theme_root; } @@ -182,7 +183,7 @@ class WP_Filesystem_Base { 'FTP_LANG_DIR' => WP_LANG_DIR, ); - // Direct matches ( folder = CONSTANT/ ) + // Direct matches ( folder = CONSTANT/ ). foreach ( $constant_overrides as $constant => $dir ) { if ( ! defined( $constant ) ) { continue; @@ -192,12 +193,12 @@ class WP_Filesystem_Base { } } - // Prefix Matches ( folder = CONSTANT/subdir ) + // Prefix matches ( folder = CONSTANT/subdir ), foreach ( $constant_overrides as $constant => $dir ) { if ( ! defined( $constant ) ) { continue; } - if ( 0 === stripos( $folder, $dir ) ) { // $folder starts with $dir + if ( 0 === stripos( $folder, $dir ) ) { // $folder starts with $dir. $potential_folder = preg_replace( '#^' . preg_quote( $dir, '#' ) . '/#i', trailingslashit( constant( $constant ) ), $folder ); $potential_folder = trailingslashit( $potential_folder ); @@ -208,12 +209,12 @@ class WP_Filesystem_Base { } } } elseif ( 'direct' == $this->method ) { - $folder = str_replace( '\\', '/', $folder ); // Windows path sanitisation + $folder = str_replace( '\\', '/', $folder ); // Windows path sanitisation. return trailingslashit( $folder ); } - $folder = preg_replace( '|^([a-z]{1}):|i', '', $folder ); // Strip out windows drive letter if it's there. - $folder = str_replace( '\\', '/', $folder ); // Windows path sanitisation + $folder = preg_replace( '|^([a-z]{1}):|i', '', $folder ); // Strip out Windows drive letter if it's there. + $folder = str_replace( '\\', '/', $folder ); // Windows path sanitisation. if ( isset( $this->cache[ $folder ] ) ) { return $this->cache[ $folder ]; @@ -240,7 +241,7 @@ class WP_Filesystem_Base { * * @param string $folder The folder to locate. * @param string $base The folder to start searching from. - * @param bool $loop If the function has recursed, Internal use only. + * @param bool $loop If the function has recursed. Internal use only. * @return string|false The location of the remote path, false to cease looping. */ public function search_for_folder( $folder, $base = '.', $loop = false ) { @@ -303,7 +304,7 @@ class WP_Filesystem_Base { } // Prevent this function from looping again. - // No need to proceed if we've just searched in / + // No need to proceed if we've just searched in `/`. if ( $loop || '/' == $base ) { return false; } @@ -328,39 +329,39 @@ class WP_Filesystem_Base { */ public function gethchmod( $file ) { $perms = intval( $this->getchmod( $file ), 8 ); - if ( ( $perms & 0xC000 ) == 0xC000 ) { // Socket + if ( ( $perms & 0xC000 ) == 0xC000 ) { // Socket. $info = 's'; - } elseif ( ( $perms & 0xA000 ) == 0xA000 ) { // Symbolic Link + } elseif ( ( $perms & 0xA000 ) == 0xA000 ) { // Symbolic Link. $info = 'l'; - } elseif ( ( $perms & 0x8000 ) == 0x8000 ) { // Regular + } elseif ( ( $perms & 0x8000 ) == 0x8000 ) { // Regular. $info = '-'; - } elseif ( ( $perms & 0x6000 ) == 0x6000 ) { // Block special + } elseif ( ( $perms & 0x6000 ) == 0x6000 ) { // Block special. $info = 'b'; - } elseif ( ( $perms & 0x4000 ) == 0x4000 ) { // Directory + } elseif ( ( $perms & 0x4000 ) == 0x4000 ) { // Directory. $info = 'd'; - } elseif ( ( $perms & 0x2000 ) == 0x2000 ) { // Character special + } elseif ( ( $perms & 0x2000 ) == 0x2000 ) { // Character special. $info = 'c'; - } elseif ( ( $perms & 0x1000 ) == 0x1000 ) { // FIFO pipe + } elseif ( ( $perms & 0x1000 ) == 0x1000 ) { // FIFO pipe. $info = 'p'; - } else { // Unknown + } else { // Unknown. $info = 'u'; } - // Owner + // Owner. $info .= ( ( $perms & 0x0100 ) ? 'r' : '-' ); $info .= ( ( $perms & 0x0080 ) ? 'w' : '-' ); $info .= ( ( $perms & 0x0040 ) ? ( ( $perms & 0x0800 ) ? 's' : 'x' ) : ( ( $perms & 0x0800 ) ? 'S' : '-' ) ); - // Group + // Group. $info .= ( ( $perms & 0x0020 ) ? 'r' : '-' ); $info .= ( ( $perms & 0x0010 ) ? 'w' : '-' ); $info .= ( ( $perms & 0x0008 ) ? ( ( $perms & 0x0400 ) ? 's' : 'x' ) : ( ( $perms & 0x0400 ) ? 'S' : '-' ) ); - // World + // World. $info .= ( ( $perms & 0x0004 ) ? 'r' : '-' ); $info .= ( ( $perms & 0x0002 ) ? 'w' : '-' ); $info .= ( ( $perms & 0x0001 ) ? @@ -827,4 +828,4 @@ class WP_Filesystem_Base { return false; } -} // WP_Filesystem_Base +} diff --git a/wp-admin/includes/class-wp-filesystem-direct.php b/wp-admin/includes/class-wp-filesystem-direct.php index d71bcbd777..11999a4e70 100644 --- a/wp-admin/includes/class-wp-filesystem-direct.php +++ b/wp-admin/includes/class-wp-filesystem-direct.php @@ -131,7 +131,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base { if ( ! $this->is_dir( $file ) ) { return chgrp( $file, $group ); } - // Is a directory, and we want recursive + // Is a directory, and we want recursive. $file = trailingslashit( $file ); $filelist = $this->dirlist( $file ); foreach ( $filelist as $filename ) { @@ -167,7 +167,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base { if ( ! $recursive || ! $this->is_dir( $file ) ) { return chmod( $file, $mode ); } - // Is a directory, and we want recursive + // Is a directory, and we want recursive. $file = trailingslashit( $file ); $filelist = $this->dirlist( $file ); foreach ( (array) $filelist as $filename => $filemeta ) { @@ -198,7 +198,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base { if ( ! $this->is_dir( $file ) ) { return chown( $file, $owner ); } - // Is a directory, and we want recursive + // Is a directory, and we want recursive. $filelist = $this->dirlist( $file ); foreach ( $filelist as $filename ) { $this->chown( $file . '/' . $filename, $owner, $recursive ); @@ -327,10 +327,11 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base { * @return bool True on success, false on failure. */ public function delete( $file, $recursive = false, $type = false ) { - if ( empty( $file ) ) { // Some filesystems report this as /, which can cause non-expected recursive deletion of all files in the filesystem. + if ( empty( $file ) ) { + // Some filesystems report this as /, which can cause non-expected recursive deletion of all files in the filesystem. return false; } - $file = str_replace( '\\', '/', $file ); // for win32, occasional problems deleting files otherwise + $file = str_replace( '\\', '/', $file ); // For Win32, occasional problems deleting files otherwise. if ( 'f' == $type || $this->is_file( $file ) ) { return @unlink( $file ); @@ -339,7 +340,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base { return @rmdir( $file ); } - // At this point it's a folder, and we're in recursive mode + // At this point it's a folder, and we're in recursive mode. $file = trailingslashit( $file ); $filelist = $this->dirlist( $file, true ); diff --git a/wp-admin/includes/class-wp-filesystem-ftpext.php b/wp-admin/includes/class-wp-filesystem-ftpext.php index 1209ef4d28..ac897046be 100644 --- a/wp-admin/includes/class-wp-filesystem-ftpext.php +++ b/wp-admin/includes/class-wp-filesystem-ftpext.php @@ -38,8 +38,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base { return; } - // This Class uses the timeout on a per-connection basis, Others use it on a per-action basis. - + // This class uses the timeout on a per-connection basis, others use it on a per-action basis. if ( ! defined( 'FS_TIMEOUT' ) ) { define( 'FS_TIMEOUT', 240 ); } @@ -113,7 +112,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base { return false; } - // Set the Connection to use Passive FTP + // Set the connection to use Passive FTP. ftp_pasv( $this->link, true ); if ( @ftp_get_option( $this->link, FTP_TIMEOUT_SEC ) < FS_TIMEOUT ) { @ftp_set_option( $this->link, FTP_TIMEOUT_SEC, FS_TIMEOUT ); @@ -146,7 +145,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base { return false; } - fseek( $temp, 0 ); // Skip back to the start of the file being written to + fseek( $temp, 0 ); // Skip back to the start of the file being written to. $contents = ''; while ( ! feof( $temp ) ) { @@ -203,7 +202,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base { return false; } - fseek( $temp, 0 ); // Skip back to the start of the file being written to + fseek( $temp, 0 ); // Skip back to the start of the file being written to. $ret = ftp_fput( $this->link, $file, $temp, FTP_BINARY ); @@ -273,7 +272,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base { } } - // chmod the file or directory + // chmod the file or directory. if ( ! function_exists( 'ftp_chmod' ) ) { return (bool) ftp_site( $this->link, sprintf( 'CHMOD %o %s', $mode, $file ) ); } @@ -405,7 +404,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base { return true; // File is an empty directory. } - return ! empty( $list ); //empty list = no file, so invert. + return ! empty( $list ); // Empty list = no file, so invert. } /** @@ -573,7 +572,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base { if ( $lucifer[3] < 70 ) { $lucifer[3] += 2000; } else { - $lucifer[3] += 1900; // 4digit year fix + $lucifer[3] += 1900; // 4-digit year fix. } $b['isdir'] = ( $lucifer[7] == '' ); if ( $b['isdir'] ) { @@ -593,7 +592,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base { } elseif ( ! $is_windows ) { $lucifer = preg_split( '/[ ]/', $line, 9, PREG_SPLIT_NO_EMPTY ); if ( $lucifer ) { - //echo $line."\n"; + // echo $line."\n"; $lcount = count( $lucifer ); if ( $lcount < 8 ) { return ''; @@ -637,7 +636,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base { } } - // Replace symlinks formatted as "source -> target" with just the source name + // Replace symlinks formatted as "source -> target" with just the source name. if ( isset( $b['islink'] ) && $b['islink'] ) { $b['name'] = preg_replace( '/(\s*->\s*.*)$/', '', $b['name'] ); } diff --git a/wp-admin/includes/class-wp-filesystem-ftpsockets.php b/wp-admin/includes/class-wp-filesystem-ftpsockets.php index 49ed4af139..01cbc9ceac 100644 --- a/wp-admin/includes/class-wp-filesystem-ftpsockets.php +++ b/wp-admin/includes/class-wp-filesystem-ftpsockets.php @@ -150,12 +150,12 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base { reset_mbstring_encoding(); - return ''; // Blank document, File does exist, It's just blank. + return ''; // Blank document. File does exist, it's just blank. } reset_mbstring_encoding(); - fseek( $temphandle, 0 ); // Skip back to the start of the file being written to + fseek( $temphandle, 0 ); // Skip back to the start of the file being written to. $contents = ''; while ( ! feof( $temphandle ) ) { @@ -198,7 +198,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base { return false; } - // The FTP class uses string functions internally during file download/upload + // The FTP class uses string functions internally during file download/upload. mbstring_binary_safe_encoding(); $bytes_written = fwrite( $temphandle, $contents ); @@ -211,7 +211,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base { return false; } - fseek( $temphandle, 0 ); // Skip back to the start of the file being written to + fseek( $temphandle, 0 ); // Skip back to the start of the file being written to. $ret = $this->ftp->fput( $file, $temphandle ); @@ -283,7 +283,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base { } } - // chmod the file or directory + // chmod the file or directory. return $this->ftp->chmod( $file, $mode ); } @@ -408,7 +408,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base { return true; // File is an empty directory. } - return ! empty( $list ); //empty list = no file, so invert. + return ! empty( $list ); // Empty list = no file, so invert. // Return $this->ftp->is_exists($file); has issues with ABOR+426 responses on the ncFTPd server. } @@ -635,12 +635,12 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base { } } - // Replace symlinks formatted as "source -> target" with just the source name + // Replace symlinks formatted as "source -> target" with just the source name. if ( $struc['islink'] ) { $struc['name'] = preg_replace( '/(\s*->\s*.*)$/', '', $struc['name'] ); } - // Add the Octal representation of the file permissions + // Add the octal representation of the file permissions. $struc['permsn'] = $this->getnumchmodfromh( $struc['perms'] ); $ret[ $struc['name'] ] = $struc; diff --git a/wp-admin/includes/class-wp-filesystem-ssh2.php b/wp-admin/includes/class-wp-filesystem-ssh2.php index 6468caf72b..51a0dff86c 100644 --- a/wp-admin/includes/class-wp-filesystem-ssh2.php +++ b/wp-admin/includes/class-wp-filesystem-ssh2.php @@ -64,7 +64,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base { $this->method = 'ssh2'; $this->errors = new WP_Error(); - //Check if possible to use ssh2 functions. + // Check if possible to use ssh2 functions. if ( ! extension_loaded( 'ssh2' ) ) { $this->errors->add( 'no_ssh2_ext', __( 'The ssh2 PHP extension is not available' ) ); return; @@ -582,7 +582,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base { * @return bool Whether $file is writable. */ public function is_writable( $file ) { - // PHP will base it's writable checks on system_user === file_owner, not ssh_user === file_owner + // PHP will base its writable checks on system_user === file_owner, not ssh_user === file_owner. return true; } @@ -737,7 +737,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base { $struc['name'] = $entry; if ( '.' == $struc['name'] || '..' == $struc['name'] ) { - continue; //Do not care about these folders. + continue; // Do not care about these folders. } if ( ! $include_hidden && '.' == $struc['name'][0] ) { diff --git a/wp-admin/includes/class-wp-importer.php b/wp-admin/includes/class-wp-importer.php index 43a2038d03..5639f1eb36 100644 --- a/wp-admin/includes/class-wp-importer.php +++ b/wp-admin/includes/class-wp-importer.php @@ -25,18 +25,18 @@ class WP_Importer { $limit = 100; $offset = 0; - // Grab all posts in chunks + // Grab all posts in chunks. do { $meta_key = $importer_name . '_' . $bid . '_permalink'; $sql = $wpdb->prepare( "SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = %s LIMIT %d,%d", $meta_key, $offset, $limit ); $results = $wpdb->get_results( $sql ); - // Increment offset + // Increment offset. $offset = ( $limit + $offset ); if ( ! empty( $results ) ) { foreach ( $results as $r ) { - // Set permalinks into array + // Set permalinks into array. $hashtable[ $r->meta_value ] = intval( $r->post_id ); } } @@ -62,7 +62,7 @@ class WP_Importer { $count = 0; - // Get count of permalinks + // Get count of permalinks. $meta_key = $importer_name . '_' . $bid . '_permalink'; $sql = $wpdb->prepare( "SELECT COUNT( post_id ) AS cnt FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key ); @@ -94,21 +94,21 @@ class WP_Importer { $limit = 100; $offset = 0; - // Grab all comments in chunks + // Grab all comments in chunks. do { $sql = $wpdb->prepare( "SELECT comment_ID, comment_agent FROM $wpdb->comments LIMIT %d,%d", $offset, $limit ); $results = $wpdb->get_results( $sql ); - // Increment offset + // Increment offset. $offset = ( $limit + $offset ); if ( ! empty( $results ) ) { foreach ( $results as $r ) { - // Explode comment_agent key + // Explode comment_agent key. list ( $ca_bid, $source_comment_id ) = explode( '-', $r->comment_agent ); $source_comment_id = intval( $source_comment_id ); - // Check if this comment came from this blog + // Check if this comment came from this blog. if ( $bid == $ca_bid ) { $hashtable[ $source_comment_id ] = intval( $r->comment_ID ); } @@ -203,7 +203,7 @@ class WP_Importer { * @return array */ public function get_page( $url, $username = '', $password = '', $head = false ) { - // Increase the timeout + // Increase the timeout. add_filter( 'http_request_timeout', array( $this, 'bump_request_timeout' ) ); $headers = array(); @@ -267,7 +267,7 @@ class WP_Importer { global $wpdb, $wp_actions; // Or define( 'WP_IMPORTING', true ); $wpdb->queries = array(); - // Reset $wp_actions to keep it from growing out of control + // Reset $wp_actions to keep it from growing out of control. $wp_actions = array(); } } @@ -317,15 +317,15 @@ function get_cli_args( $param, $required = false ) { } } - // Check array for specified param + // Check array for specified param. if ( isset( $out[ $param ] ) ) { - // Set return value + // Set return value. $return = $out[ $param ]; } - // Check for missing required param + // Check for missing required param. if ( ! isset( $out[ $param ] ) && $required ) { - // Display message and exit + // Display message and exit. echo "\"$param\" parameter is required but was not specified\n"; exit(); } diff --git a/wp-admin/includes/class-wp-internal-pointers.php b/wp-admin/includes/class-wp-internal-pointers.php index f025af8425..a17caf5521 100644 --- a/wp-admin/includes/class-wp-internal-pointers.php +++ b/wp-admin/includes/class-wp-internal-pointers.php @@ -48,10 +48,10 @@ final class WP_Internal_Pointers { * ) */ $registered_pointers = array( - //None currently. + // None currently. ); - // Check if screen related pointer is registered + // Check if screen related pointer is registered. if ( empty( $registered_pointers[ $hook_suffix ] ) ) { return; } @@ -75,7 +75,7 @@ final class WP_Internal_Pointers { // None currently. ); - // Get dismissed pointers + // Get dismissed pointers. $dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ); $got_pointers = false; @@ -88,7 +88,7 @@ final class WP_Internal_Pointers { } } - // Bind pointer print function + // Bind pointer print function. add_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_' . $pointer ) ); $got_pointers = true; } @@ -97,7 +97,7 @@ final class WP_Internal_Pointers { return; } - // Add pointers script and style to queue + // Add pointers script and style to queue. wp_enqueue_style( 'wp-pointer' ); wp_enqueue_script( 'wp-pointer' ); } diff --git a/wp-admin/includes/class-wp-list-table.php b/wp-admin/includes/class-wp-list-table.php index 1f078edb42..95ae32c5e6 100644 --- a/wp-admin/includes/class-wp-list-table.php +++ b/wp-admin/includes/class-wp-list-table.php @@ -451,7 +451,7 @@ class WP_List_Table { * * @param string[] $actions An array of the available bulk actions. */ - $this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores + $this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores $two = ''; } else { $two = '2'; @@ -1004,8 +1004,8 @@ class WP_List_Table { $columns = get_column_headers( $this->screen ); $default = $this->get_default_primary_column_name(); - // If the primary column doesn't exist fall back to the - // first non-checkbox column. + // If the primary column doesn't exist, + // fall back to the first non-checkbox column. if ( ! isset( $columns[ $default ] ) ) { $default = WP_List_Table::get_default_primary_column_name(); } @@ -1035,7 +1035,7 @@ class WP_List_Table { * @return array */ protected function get_column_info() { - // $_column_headers is already set / cached + // $_column_headers is already set / cached. if ( isset( $this->_column_headers ) && is_array( $this->_column_headers ) ) { // Back-compat for list tables that have been manually setting $_column_headers for horse reasons. // In 4.3, we added a fourth argument for primary column. diff --git a/wp-admin/includes/class-wp-ms-sites-list-table.php b/wp-admin/includes/class-wp-ms-sites-list-table.php index 35b47245cc..8188844913 100644 --- a/wp-admin/includes/class-wp-ms-sites-list-table.php +++ b/wp-admin/includes/class-wp-ms-sites-list-table.php @@ -114,7 +114,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table { preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s ) || preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s ) || preg_match( '/^[0-9]{1,3}\.$/', $s ) ) { - // IPv4 address + // IPv4 address. $sql = $wpdb->prepare( "SELECT blog_id FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.IP LIKE %s", $wpdb->esc_like( $s ) . ( ! empty( $wild ) ? '%' : '' ) ); $reg_blog_ids = $wpdb->get_col( $sql ); @@ -133,7 +133,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table { $order_by = isset( $_REQUEST['orderby'] ) ? $_REQUEST['orderby'] : ''; if ( 'registered' === $order_by ) { - // registered is a valid field name. + // 'registered' is a valid field name. } elseif ( 'lastupdated' === $order_by ) { $order_by = 'last_updated'; } elseif ( 'blogname' === $order_by ) { diff --git a/wp-admin/includes/class-wp-ms-themes-list-table.php b/wp-admin/includes/class-wp-ms-themes-list-table.php index cb1f34999d..96e17efe58 100644 --- a/wp-admin/includes/class-wp-ms-themes-list-table.php +++ b/wp-admin/includes/class-wp-ms-themes-list-table.php @@ -62,7 +62,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table { * @return array */ protected function get_table_classes() { - // todo: remove and add CSS for .themes + // @todo Remove and add CSS for .themes. return array( 'widefat', 'plugins' ); } diff --git a/wp-admin/includes/class-wp-ms-users-list-table.php b/wp-admin/includes/class-wp-ms-users-list-table.php index b6e21e05f3..de9caf7d9d 100644 --- a/wp-admin/includes/class-wp-ms-users-list-table.php +++ b/wp-admin/includes/class-wp-ms-users-list-table.php @@ -93,7 +93,7 @@ class WP_MS_Users_List_Table extends WP_List_Table { /** This filter is documented in wp-admin/includes/class-wp-users-list-table.php */ $args = apply_filters( 'users_list_table_query_args', $args ); - // Query the user IDs for this page + // Query the user IDs for this page. $wp_user_search = new WP_User_Query( $args ); $this->items = $wp_user_search->get_results(); diff --git a/wp-admin/includes/class-wp-plugin-install-list-table.php b/wp-admin/includes/class-wp-plugin-install-list-table.php index acea5c4b28..2a0e004b6b 100644 --- a/wp-admin/includes/class-wp-plugin-install-list-table.php +++ b/wp-admin/includes/class-wp-plugin-install-list-table.php @@ -95,7 +95,7 @@ class WP_Plugin_Install_List_Table extends WP_List_Table { $per_page = 36; - // These are the tabs which are shown on the page + // These are the tabs which are shown on the page. $tabs = array(); if ( 'search' === $tab ) { @@ -471,7 +471,7 @@ class WP_Plugin_Install_List_Table extends WP_List_Table { $plugin = (array) $plugin; } - // Display the group heading if there is one + // Display the group heading if there is one. if ( isset( $plugin['group'] ) && $plugin['group'] != $group ) { if ( isset( $this->groups[ $plugin['group'] ] ) ) { $group_name = $this->groups[ $plugin['group'] ]; @@ -482,13 +482,13 @@ class WP_Plugin_Install_List_Table extends WP_List_Table { $group_name = $plugin['group']; } - // Starting a new group, close off the divs of the last one + // Starting a new group, close off the divs of the last one. if ( ! empty( $group ) ) { echo '
'; } echo '

' . esc_html( $group_name ) . '

'; - // needs an extra wrapping div for nth-child selectors to work + // Needs an extra wrapping div for nth-child selectors to work. echo '
'; $group = $plugin['group']; @@ -768,7 +768,7 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
'; } diff --git a/wp-admin/includes/class-wp-plugins-list-table.php b/wp-admin/includes/class-wp-plugins-list-table.php index a36ec05221..b92d1c53d9 100644 --- a/wp-admin/includes/class-wp-plugins-list-table.php +++ b/wp-admin/includes/class-wp-plugins-list-table.php @@ -186,40 +186,40 @@ class WP_Plugins_List_Table extends WP_List_Table { if ( isset( $plugin_info->response[ $plugin_file ] ) ) { $plugin_data = array_merge( (array) $plugin_info->response[ $plugin_file ], $plugin_data ); $plugins['all'][ $plugin_file ] = $plugin_data; - // Make sure that $plugins['upgrade'] also receives the extra info since it is used on ?plugin_status=upgrade + // Make sure that $plugins['upgrade'] also receives the extra info since it is used on ?plugin_status=upgrade. if ( isset( $plugins['upgrade'][ $plugin_file ] ) ) { $plugins['upgrade'][ $plugin_file ] = $plugin_data; } } elseif ( isset( $plugin_info->no_update[ $plugin_file ] ) ) { $plugin_data = array_merge( (array) $plugin_info->no_update[ $plugin_file ], $plugin_data ); $plugins['all'][ $plugin_file ] = $plugin_data; - // Make sure that $plugins['upgrade'] also receives the extra info since it is used on ?plugin_status=upgrade + // Make sure that $plugins['upgrade'] also receives the extra info since it is used on ?plugin_status=upgrade. if ( isset( $plugins['upgrade'][ $plugin_file ] ) ) { $plugins['upgrade'][ $plugin_file ] = $plugin_data; } } - // Filter into individual sections + // Filter into individual sections. if ( is_multisite() && ! $screen->in_admin( 'network' ) && is_network_only_plugin( $plugin_file ) && ! is_plugin_active( $plugin_file ) ) { if ( $show_network_active ) { - // On the non-network screen, show inactive network-only plugins if allowed + // On the non-network screen, show inactive network-only plugins if allowed. $plugins['inactive'][ $plugin_file ] = $plugin_data; } else { - // On the non-network screen, filter out network-only plugins as long as they're not individually active + // On the non-network screen, filter out network-only plugins as long as they're not individually active. unset( $plugins['all'][ $plugin_file ] ); } } elseif ( ! $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) { if ( $show_network_active ) { - // On the non-network screen, show network-active plugins if allowed + // On the non-network screen, show network-active plugins if allowed. $plugins['active'][ $plugin_file ] = $plugin_data; } else { - // On the non-network screen, filter out network-active plugins + // On the non-network screen, filter out network-active plugins. unset( $plugins['all'][ $plugin_file ] ); } } elseif ( ( ! $screen->in_admin( 'network' ) && is_plugin_active( $plugin_file ) ) || ( $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) ) { - // On the non-network screen, populate the active list with plugins that are individually activated - // On the network-admin screen, populate the active list with plugins that are network activated + // On the non-network screen, populate the active list with plugins that are individually activated. + // On the network admin screen, populate the active list with plugins that are network-activated. $plugins['active'][ $plugin_file ] = $plugin_data; if ( ! $screen->in_admin( 'network' ) && is_plugin_paused( $plugin_file ) ) { @@ -227,10 +227,10 @@ class WP_Plugins_List_Table extends WP_List_Table { } } else { if ( isset( $recently_activated[ $plugin_file ] ) ) { - // Populate the recently activated list with plugins that have been recently activated + // Populate the recently activated list with plugins that have been recently activated. $plugins['recently_activated'][ $plugin_file ] = $plugin_data; } - // Populate the inactive list with plugins that aren't activated + // Populate the inactive list with plugins that aren't activated. $plugins['inactive'][ $plugin_file ] = $plugin_data; } } @@ -251,7 +251,7 @@ class WP_Plugins_List_Table extends WP_List_Table { $this->items = array(); foreach ( $plugins[ $status ] as $plugin_file => $plugin_data ) { - // Translate, Don't Apply Markup, Sanitize HTML + // Translate, don't apply markup, sanitize HTML. $this->items[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, false, true ); } @@ -631,7 +631,7 @@ class WP_Plugins_List_Table extends WP_List_Table { 'delete' => '', ); - // Do not restrict by default + // Do not restrict by default. $restrict_network_active = false; $restrict_network_only = false; @@ -643,10 +643,10 @@ class WP_Plugins_List_Table extends WP_List_Table { if ( $plugin_file != $plugin_data['Name'] ) { $plugin_name .= '
' . $plugin_data['Name']; } - if ( true === ( $dropins[ $plugin_file ][1] ) ) { // Doesn't require a constant + if ( true === ( $dropins[ $plugin_file ][1] ) ) { // Doesn't require a constant. $is_active = true; $description = '

' . $dropins[ $plugin_file ][0] . '

'; - } elseif ( defined( $dropins[ $plugin_file ][1] ) && constant( $dropins[ $plugin_file ][1] ) ) { // Constant is true + } elseif ( defined( $dropins[ $plugin_file ][1] ) && constant( $dropins[ $plugin_file ][1] ) ) { // Constant is true. $is_active = true; $description = '

' . $dropins[ $plugin_file ][0] . '

'; } else { @@ -750,9 +750,9 @@ class WP_Plugins_List_Table extends WP_List_Table { __( 'Delete' ) ); } - } // end if $is_active - } // end if $screen->in_admin( 'network' ) - } // end if $context + } // End if $is_active. + } // End if $screen->in_admin( 'network' ). + } // End if $context. $actions = array_filter( $actions ); @@ -906,7 +906,7 @@ class WP_Plugins_List_Table extends WP_List_Table { $plugin_meta[] = sprintf( __( 'By %s' ), $author ); } - // Details link using API info, if available + // Details link using API info, if available. if ( isset( $plugin_data['slug'] ) && current_user_can( 'install_plugins' ) ) { $plugin_meta[] = sprintf( '%s', diff --git a/wp-admin/includes/class-wp-posts-list-table.php b/wp-admin/includes/class-wp-posts-list-table.php index 890d133889..a0f6740e3a 100644 --- a/wp-admin/includes/class-wp-posts-list-table.php +++ b/wp-admin/includes/class-wp-posts-list-table.php @@ -143,7 +143,7 @@ class WP_Posts_List_Table extends WP_List_Table { public function prepare_items() { global $avail_post_stati, $wp_query, $per_page, $mode; - // is going to call wp() + // Is going to call wp(). $avail_post_stati = wp_edit_posts_query(); $this->set_hierarchical_display( is_post_type_hierarchical( $this->screen->post_type ) && 'menu_order title' === $wp_query->query['orderby'] ); @@ -877,7 +877,7 @@ class WP_Posts_List_Table extends WP_List_Table { $my_parents = array(); $my_parent = $page->post_parent; while ( $my_parent ) { - // Get the ID from the list or the attribute if my_parent is an object + // Get the ID from the list or the attribute if my_parent is an object. $parent_id = $my_parent; if ( is_object( $my_parent ) ) { $parent_id = $my_parent->ID; @@ -906,7 +906,7 @@ class WP_Posts_List_Table extends WP_List_Table { $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page, $to_display ); } - unset( $children_pages[ $parent ] ); //required in order to keep track of orphans + unset( $children_pages[ $parent ] ); // Required in order to keep track of orphans. } /** @@ -1467,6 +1467,7 @@ class WP_Posts_List_Table extends WP_List_Table { $taxonomy_names = get_object_taxonomies( $screen->post_type ); $hierarchical_taxonomies = array(); $flat_taxonomies = array(); + foreach ( $taxonomy_names as $taxonomy_name ) { $taxonomy = get_taxonomy( $taxonomy_name ); @@ -1507,7 +1508,8 @@ class WP_Posts_List_Table extends WP_List_Table { ?> -
+ +
post_type}"; $bulk = 0; - while ( $bulk < 2 ) { + while ( $bulk < 2 ) : + $classes = $inline_edit_classes . ' '; + $classes .= $bulk ? $bulk_edit_classes : $quick_edit_classes; ?> + + + + + -
+ + get_request_counts(); $total_requests = absint( array_sum( (array) $counts ) ); - // Normalized admin URL + // Normalized admin URL. $admin_url = $this->get_admin_url(); $current_link_attributes = empty( $current_status ) ? ' class="current" aria-current="page"' : ''; diff --git a/wp-admin/includes/class-wp-screen.php b/wp-admin/includes/class-wp-screen.php index dbd796593c..e694e6a06a 100644 --- a/wp-admin/includes/class-wp-screen.php +++ b/wp-admin/includes/class-wp-screen.php @@ -226,7 +226,7 @@ final class WP_Screen { // For those pesky meta boxes. if ( $hook_name && post_type_exists( $hook_name ) ) { $post_type = $id; - $id = 'post'; // changes later. ends up being $base. + $id = 'post'; // Changes later. Ends up being $base. } else { if ( '.php' == substr( $id, -4 ) ) { $id = substr( $id, 0, -4 ); @@ -923,7 +923,7 @@ final class WP_Screen {
columns; // Set the global for back-compat. - // Add screen options + // Add screen options. if ( $this->show_screen_options() ) { $this->render_screen_options(); } @@ -1156,7 +1156,7 @@ final class WP_Screen { $special = array( '_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname' ); foreach ( $columns as $column => $title ) { - // Can't hide these for they are special + // Can't hide these for they are special. if ( in_array( $column, $special ) ) { continue; } @@ -1255,13 +1255,13 @@ final class WP_Screen { $per_page = apply_filters( "{$option}", $per_page ); } - // Back compat + // Back compat. if ( isset( $this->post_type ) ) { /** This filter is documented in wp-admin/includes/post.php */ $per_page = apply_filters( 'edit_posts_per_page', $per_page, $this->post_type ); } - // This needs a submit button + // This needs a submit button. add_filter( 'screen_options_show_submit', '__return_true' ); ?> @@ -1288,7 +1288,7 @@ final class WP_Screen { public function render_view_mode() { $screen = get_current_screen(); - // Currently only enabled for posts lists + // Currently only enabled for posts lists. if ( 'edit' !== $screen->base ) { return; } @@ -1316,7 +1316,7 @@ final class WP_Screen { global $mode; - // This needs a submit button + // This needs a submit button. add_filter( 'screen_options_show_submit', '__return_true' ); ?>
diff --git a/wp-admin/includes/class-wp-site-health-auto-updates.php b/wp-admin/includes/class-wp-site-health-auto-updates.php index 05fbba9085..299744968c 100644 --- a/wp-admin/includes/class-wp-site-health-auto-updates.php +++ b/wp-admin/includes/class-wp-site-health-auto-updates.php @@ -353,12 +353,12 @@ class WP_Site_Health_Auto_Updates { $checksums = get_core_checksums( $wp_version, 'en_US' ); $dev = ( false !== strpos( $wp_version, '-' ) ); - // Get the last stable version's files and test against that + // Get the last stable version's files and test against that. if ( ! $checksums && $dev ) { $checksums = get_core_checksums( (float) $wp_version - 0.1, 'en_US' ); } - // There aren't always checksums for development releases, so just skip the test if we still can't find any + // There aren't always checksums for development releases, so just skip the test if we still can't find any. if ( ! $checksums && $dev ) { return false; } @@ -415,7 +415,7 @@ class WP_Site_Health_Auto_Updates { */ function test_accepts_dev_updates() { include ABSPATH . WPINC . '/version.php'; // $wp_version; // x.y.z - // Only for dev versions + // Only for dev versions. if ( false === strpos( $wp_version, '-' ) ) { return false; } diff --git a/wp-admin/includes/class-wp-site-health.php b/wp-admin/includes/class-wp-site-health.php index 0da1f9e607..afb51e4816 100644 --- a/wp-admin/includes/class-wp-site-health.php +++ b/wp-admin/includes/class-wp-site-health.php @@ -103,7 +103,7 @@ class WP_Site_Health { if ( 'site-health' === $screen->id && ! isset( $_GET['tab'] ) ) { $tests = WP_Site_Health::get_tests(); - // Don't run https test on localhost + // Don't run https test on localhost. if ( 'localhost' === preg_replace( '|https?://|', '', get_site_url() ) ) { unset( $tests['direct']['https_status'] ); } @@ -1217,7 +1217,7 @@ class WP_Site_Health { __( 'Your MySQL version supports utf8mb4.' ) ); } - } else { // MariaDB introduced utf8mb4 support in 5.5.0 + } else { // MariaDB introduced utf8mb4 support in 5.5.0. if ( version_compare( $this->mysql_server_version, '5.5.0', '<' ) ) { $result['status'] = 'recommended'; @@ -2235,7 +2235,7 @@ class WP_Site_Health { 'critical' => 0, ); - // Don't run https test on localhost + // Don't run https test on localhost. if ( 'localhost' === preg_replace( '|https?://|', '', get_site_url() ) ) { unset( $tests['direct']['https_status'] ); } diff --git a/wp-admin/includes/class-wp-site-icon.php b/wp-admin/includes/class-wp-site-icon.php index a16565e70f..8d991e4c75 100644 --- a/wp-admin/includes/class-wp-site-icon.php +++ b/wp-admin/includes/class-wp-site-icon.php @@ -154,7 +154,7 @@ class WP_Site_Icon { natsort( $this->site_icon_sizes ); $this->site_icon_sizes = array_reverse( $this->site_icon_sizes ); - // ensure that we only resize the image into + // Ensure that we only resize the image into sizes that allow cropping. foreach ( $sizes as $name => $size_array ) { if ( isset( $size_array['crop'] ) ) { $only_crop_sizes[ $name ] = $size_array; diff --git a/wp-admin/includes/class-wp-terms-list-table.php b/wp-admin/includes/class-wp-terms-list-table.php index 1acacfc926..9af2f0e502 100644 --- a/wp-admin/includes/class-wp-terms-list-table.php +++ b/wp-admin/includes/class-wp-terms-list-table.php @@ -139,7 +139,7 @@ class WP_Terms_List_Table extends WP_List_Table { * @return bool */ public function has_items() { - // todo: populate $this->items in prepare_items() + // @todo Populate $this->items in prepare_items(). return true; } @@ -254,7 +254,11 @@ class WP_Terms_List_Table extends WP_List_Table { } else { $children = _get_term_hierarchy( $taxonomy ); } - // Some funky recursion to get the job done( Paging & parents mainly ) is contained within, Skip it for non-hierarchical taxonomies for performance sake + + /* + * Some funky recursion to get the job done (paging & parents mainly) is contained within. + * Skip it for non-hierarchical taxonomies for performance sake. + */ $this->_rows( $taxonomy, $terms, $children, $offset, $number, $count ); } else { foreach ( $terms as $term ) { @@ -628,8 +632,11 @@ class WP_Terms_List_Table extends WP_List_Table { } ?> -
- + +
+ theme_installer(); } diff --git a/wp-admin/includes/class-wp-themes-list-table.php b/wp-admin/includes/class-wp-themes-list-table.php index fb8d131f5b..73143f393f 100644 --- a/wp-admin/includes/class-wp-themes-list-table.php +++ b/wp-admin/includes/class-wp-themes-list-table.php @@ -300,14 +300,14 @@ class WP_Themes_List_Table extends WP_List_Table { * @return bool */ public function search_theme( $theme ) { - // Search the features + // Search the features. foreach ( $this->features as $word ) { if ( ! in_array( $word, $theme->get( 'Tags' ) ) ) { return false; } } - // Match all phrases + // Match all phrases. foreach ( $this->search_terms as $word ) { if ( in_array( $word, $theme->get( 'Tags' ) ) ) { continue; diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php index 706337403b..a399bad07f 100644 --- a/wp-admin/includes/class-wp-upgrader.php +++ b/wp-admin/includes/class-wp-upgrader.php @@ -195,7 +195,7 @@ class WP_Upgrader { if ( is_object( $wp_filesystem ) && $wp_filesystem->errors->has_errors() ) { $error = $wp_filesystem->errors; } - // Failed to connect, Error and request again + // Failed to connect. Error and request again. $this->skin->request_filesystem_credentials( $error, $directories[0], $allow_relaxed_file_ownership ); return false; } @@ -238,7 +238,7 @@ class WP_Upgrader { } } return true; - } //end fs_connect(); + } /** * Download a package. @@ -267,8 +267,8 @@ class WP_Upgrader { return $reply; } - if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) { //Local file or remote? - return $package; //must be a local file.. + if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) { // Local file or remote? + return $package; // Must be a local file. } if ( empty( $package ) ) { @@ -305,7 +305,7 @@ class WP_Upgrader { $upgrade_folder = $wp_filesystem->wp_content_dir() . 'upgrade/'; - //Clean up contents of upgrade directory beforehand. + // Clean up contents of upgrade directory beforehand. $upgrade_files = $wp_filesystem->dirlist( $upgrade_folder ); if ( ! empty( $upgrade_files ) ) { foreach ( $upgrade_files as $file ) { @@ -313,15 +313,15 @@ class WP_Upgrader { } } - // We need a working directory - Strip off any .tmp or .zip suffixes + // We need a working directory - strip off any .tmp or .zip suffixes. $working_dir = $upgrade_folder . basename( basename( $package, '.tmp' ), '.zip' ); - // Clean up working directory + // Clean up working directory. if ( $wp_filesystem->is_dir( $working_dir ) ) { $wp_filesystem->delete( $working_dir, true ); } - // Unzip package to working directory + // Unzip package to working directory. $result = unzip_file( $package, $working_dir ); // Once extracted, delete the package if required. @@ -356,11 +356,11 @@ class WP_Upgrader { foreach ( $nested_files as $name => $details ) { $files[ $path . $name ] = $details; - // Append children recursively + // Append children recursively. if ( ! empty( $details['files'] ) ) { $children = $this->flatten_dirlist( $details['files'], $path . $name . '/' ); - // Merge keeping possible numeric keys, which array_merge() will reindex from 0..n + // Merge keeping possible numeric keys, which array_merge() will reindex from 0..n. $files = $files + $children; } } @@ -388,7 +388,7 @@ class WP_Upgrader { return true; } - // Flatten the file list to iterate over + // Flatten the file list to iterate over. $files = $this->flatten_dirlist( $files ); // Check all files are writable before attempting to clear the destination. @@ -450,8 +450,8 @@ class WP_Upgrader { global $wp_filesystem, $wp_theme_directories; $defaults = array( - 'source' => '', // Please always pass this - 'destination' => '', // and this + 'source' => '', // Please always pass this. + 'destination' => '', // ...and this. 'clear_destination' => false, 'clear_working' => false, 'abort_if_destination_exists' => true, @@ -490,19 +490,23 @@ class WP_Upgrader { return $res; } - //Retain the Original source and destinations + // Retain the original source and destinations. $remote_source = $args['source']; $local_destination = $destination; $source_files = array_keys( $wp_filesystem->dirlist( $remote_source ) ); $remote_destination = $wp_filesystem->find_folder( $local_destination ); - //Locate which directory to copy to the new folder, This is based on the actual folder holding the files. - if ( 1 == count( $source_files ) && $wp_filesystem->is_dir( trailingslashit( $args['source'] ) . $source_files[0] . '/' ) ) { //Only one folder? Then we want its contents. + // Locate which directory to copy to the new folder. This is based on the actual folder holding the files. + if ( 1 == count( $source_files ) && $wp_filesystem->is_dir( trailingslashit( $args['source'] ) . $source_files[0] . '/' ) ) { + // Only one folder? Then we want its contents. $source = trailingslashit( $args['source'] ) . trailingslashit( $source_files[0] ); } elseif ( count( $source_files ) == 0 ) { - return new WP_Error( 'incompatible_archive_empty', $this->strings['incompatible_archive'], $this->strings['no_files'] ); // There are no files? - } else { // It's only a single file, the upgrader will use the folder name of this file as the destination folder. Folder name is based on zip filename. + // There are no files? + return new WP_Error( 'incompatible_archive_empty', $this->strings['incompatible_archive'], $this->strings['no_files'] ); + } else { + // It's only a single file, the upgrader will use the folder name of this file as the destination folder. + // Folder name is based on zip filename. $source = trailingslashit( $args['source'] ); } @@ -568,21 +572,22 @@ class WP_Upgrader { return $removed; } } elseif ( $args['abort_if_destination_exists'] && $wp_filesystem->exists( $remote_destination ) ) { - //If we're not clearing the destination folder and something exists there already, Bail. - //But first check to see if there are actually any files in the folder. + // If we're not clearing the destination folder and something exists there already, bail. + // But first check to see if there are actually any files in the folder. $_files = $wp_filesystem->dirlist( $remote_destination ); if ( ! empty( $_files ) ) { - $wp_filesystem->delete( $remote_source, true ); //Clear out the source files. + $wp_filesystem->delete( $remote_source, true ); // Clear out the source files. return new WP_Error( 'folder_exists', $this->strings['folder_exists'], $remote_destination ); } } - //Create destination if needed + // Create destination if needed. if ( ! $wp_filesystem->exists( $remote_destination ) ) { if ( ! $wp_filesystem->mkdir( $remote_destination, FS_CHMOD_DIR ) ) { return new WP_Error( 'mkdir_failed_destination', $this->strings['mkdir_failed'], $remote_destination ); } } + // Copy new version of item into place. $result = copy_dir( $source, $remote_destination ); if ( is_wp_error( $result ) ) { @@ -592,7 +597,7 @@ class WP_Upgrader { return $result; } - //Clear the Working folder? + // Clear the working folder? if ( $args['clear_working'] ) { $wp_filesystem->delete( $remote_source, true ); } @@ -620,7 +625,7 @@ class WP_Upgrader { return $res; } - //Bombard the calling function will all the info which we've just used. + // Bombard the calling function will all the info which we've just used. return $this->result; } @@ -661,9 +666,9 @@ class WP_Upgrader { $defaults = array( 'package' => '', // Please always pass this. - 'destination' => '', // And this + 'destination' => '', // ...and this. 'clear_destination' => false, - 'abort_if_destination_exists' => true, // Abort if the Destination directory exists, Pass clear_destination as false please + 'abort_if_destination_exists' => true, // Abort if the destination directory exists. Pass clear_destination as false please. 'clear_working' => true, 'is_multi' => false, 'hook_extra' => array(), // Pass any extra $hook_extra args here, this will be passed to any hooked filters. @@ -703,11 +708,11 @@ class WP_Upgrader { */ $options = apply_filters( 'upgrader_package_options', $options ); - if ( ! $options['is_multi'] ) { // call $this->header separately if running multiple times + if ( ! $options['is_multi'] ) { // Call $this->header separately if running multiple times. $this->skin->header(); } - // Connect to the Filesystem first. + // Connect to the filesystem first. $res = $this->fs_connect( array( WP_CONTENT_DIR, $options['destination'] ) ); // Mainly for non-connected filesystem. if ( ! $res ) { @@ -740,7 +745,7 @@ class WP_Upgrader { // Don't output the 'no signature could be found' failure message for now. if ( 'signature_verification_no_signature' != $download->get_error_code() || WP_DEBUG ) { - // Outout the failure error as a normal feedback, and not as an error: + // Output the failure error as a normal feedback, and not as an error. $this->skin->feedback( $download->get_error_message() ); // Report this failure back to WordPress.org for debugging purposes. @@ -765,7 +770,7 @@ class WP_Upgrader { return $download; } - $delete_package = ( $download != $options['package'] ); // Do not delete a "local" file + $delete_package = ( $download != $options['package'] ); // Do not delete a "local" file. // Unzips the file into a temporary directory. $working_dir = $this->unpack_package( $download, $delete_package ); @@ -857,7 +862,7 @@ class WP_Upgrader { $file = $wp_filesystem->abspath() . '.maintenance'; if ( $enable ) { $this->skin->feedback( 'maintenance_start' ); - // Create maintenance file to signal that we are upgrading + // Create maintenance file to signal that we are upgrading. $maintenance_string = ''; $wp_filesystem->delete( $file ); $wp_filesystem->put_contents( $file, $maintenance_string, FS_CHMOD_FILE ); diff --git a/wp-admin/includes/class-wp-users-list-table.php b/wp-admin/includes/class-wp-users-list-table.php index a69e889968..505aa9a435 100644 --- a/wp-admin/includes/class-wp-users-list-table.php +++ b/wp-admin/includes/class-wp-users-list-table.php @@ -137,7 +137,7 @@ class WP_Users_List_Table extends WP_List_Table { */ $args = apply_filters( 'users_list_table_query_args', $args ); - // Query the user IDs for this page + // Query the user IDs for this page. $wp_user_search = new WP_User_Query( $args ); $this->items = $wp_user_search->get_results(); @@ -166,7 +166,7 @@ class WP_Users_List_Table extends WP_List_Table { * Provides a list of roles and user count for that role for easy * Filtersing of the user table. * - * @since 3.1.0 + * @since 3.1.0 * * @global string $role * @@ -257,7 +257,7 @@ class WP_Users_List_Table extends WP_List_Table { /** * Retrieve an associative array of bulk actions available on this table. * - * @since 3.1.0 + * @since 3.1.0 * * @return string[] Array of bulk action labels keyed by their action. */ @@ -330,7 +330,7 @@ class WP_Users_List_Table extends WP_List_Table { * Overridden from the base class implementation to capture * the role change drop-down. * - * @since 3.1.0 + * @since 3.1.0 * * @return string The bulk action required. */ @@ -346,7 +346,7 @@ class WP_Users_List_Table extends WP_List_Table { /** * Get a list of columns for the list table. * - * @since 3.1.0 + * @since 3.1.0 * * @return string[] Array of column titles keyed by their column name. */ @@ -389,7 +389,7 @@ class WP_Users_List_Table extends WP_List_Table { * @since 3.1.0 */ public function display_rows() { - // Query the post counts for this page + // Query the post counts for this page. if ( ! $this->is_site_users ) { $post_counts = count_many_users_posts( array_keys( $this->items ) ); } @@ -428,7 +428,7 @@ class WP_Users_List_Table extends WP_List_Table { $user_roles = $this->get_role_list( $user_object ); - // Set up the hover actions for this user + // Set up the hover actions for this user. $actions = array(); $checkbox = ''; $super_admin = ''; @@ -439,9 +439,9 @@ class WP_Users_List_Table extends WP_List_Table { } } - // Check if the user for this row is editable + // Check if the user for this row is editable. if ( current_user_can( 'list_users' ) ) { - // Set up the user editing link + // Set up the user editing link. $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_object->ID ) ) ); if ( current_user_can( 'edit_user', $user_object->ID ) ) { @@ -485,7 +485,7 @@ class WP_Users_List_Table extends WP_List_Table { // Role classes. $role_classes = esc_attr( implode( ' ', array_keys( $user_roles ) ) ); - // Set up the checkbox ( because the user is editable, otherwise it's empty ) + // Set up the checkbox (because the user is editable, otherwise it's empty). $checkbox = sprintf( '' . '', @@ -514,7 +514,7 @@ class WP_Users_List_Table extends WP_List_Table { $classes .= ' has-row-actions column-primary'; } if ( 'posts' === $column_name ) { - $classes .= ' num'; // Special case for that column + $classes .= ' num'; // Special case for that column. } if ( in_array( $column_name, $hidden ) ) { diff --git a/wp-admin/includes/comment.php b/wp-admin/includes/comment.php index e99f8a6a50..afe38fa3cd 100644 --- a/wp-admin/includes/comment.php +++ b/wp-admin/includes/comment.php @@ -79,16 +79,17 @@ function edit_comment() { } if ( ! empty( $_POST['edit_date'] ) ) { - $aa = $_POST['aa']; - $mm = $_POST['mm']; - $jj = $_POST['jj']; - $hh = $_POST['hh']; - $mn = $_POST['mn']; - $ss = $_POST['ss']; - $jj = ( $jj > 31 ) ? 31 : $jj; - $hh = ( $hh > 23 ) ? $hh - 24 : $hh; - $mn = ( $mn > 59 ) ? $mn - 60 : $mn; - $ss = ( $ss > 59 ) ? $ss - 60 : $ss; + $aa = $_POST['aa']; + $mm = $_POST['mm']; + $jj = $_POST['jj']; + $hh = $_POST['hh']; + $mn = $_POST['mn']; + $ss = $_POST['ss']; + $jj = ( $jj > 31 ) ? 31 : $jj; + $hh = ( $hh > 23 ) ? $hh - 24 : $hh; + $mn = ( $mn > 59 ) ? $mn - 60 : $mn; + $ss = ( $ss > 59 ) ? $ss - 60 : $ss; + $_POST['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss"; } diff --git a/wp-admin/includes/credits.php b/wp-admin/includes/credits.php index 3289c18e4a..59ccc28c2e 100644 --- a/wp-admin/includes/credits.php +++ b/wp-admin/includes/credits.php @@ -15,7 +15,7 @@ * @return array|false A list of all of the contributors, or false on error. */ function wp_credits() { - // include an unmodified $wp_version + // Include an unmodified $wp_version. include( ABSPATH . WPINC . '/version.php' ); $locale = get_user_locale(); diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index 6ecc49f8f1..e4cea79c43 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -263,7 +263,7 @@ function wp_dashboard() { } // -// Dashboard Widgets +// Dashboard Widgets. // /** @@ -1116,7 +1116,7 @@ function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = ar } // -// Dashboard Widgets Controls +// Dashboard Widgets Controls. // /** @@ -1627,7 +1627,7 @@ function wp_dashboard_browser_nag() { * @param string $notice The notice content. * @param array $response An array containing web browser information. See `wp_check_browser_version()`. */ - echo apply_filters( 'browse-happy-notice', $notice, $response ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores + echo apply_filters( 'browse-happy-notice', $notice, $response ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores } /** diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php index 0c65f2c6e3..98bcd6484c 100644 --- a/wp-admin/includes/file.php +++ b/wp-admin/includes/file.php @@ -1214,7 +1214,7 @@ function verify_file_signature( $filename, $signatures, $filename_for_errors = f // Check for a edge-case affecting PHP Maths abilities. if ( ! extension_loaded( 'sodium' ) && - in_array( PHP_VERSION_ID, [ 70200, 70201, 70202 ], true ) && + in_array( PHP_VERSION_ID, array( 70200, 70201, 70202 ), true ) && extension_loaded( 'opcache' ) ) { // Sodium_Compat isn't compatible with PHP 7.2.0~7.2.2 due to a bug in the PHP Opcache extension, bail early as it'll fail. @@ -1546,7 +1546,7 @@ function _unzip_file_ziparchive( $file, $to, $needed_dirs = array() ) { return new WP_Error( 'stat_failed_ziparchive', __( 'Could not retrieve file from archive.' ) ); } - if ( '/' == substr( $info['name'], -1 ) ) { // directory + if ( '/' == substr( $info['name'], -1 ) ) { // Directory. continue; } diff --git a/wp-admin/includes/image.php b/wp-admin/includes/image.php index 5ea668c0a2..5d1a8d7bc3 100644 --- a/wp-admin/includes/image.php +++ b/wp-admin/includes/image.php @@ -272,8 +272,8 @@ function wp_create_image_subsizes( $file, $attachment_id ) { */ $threshold = (int) apply_filters( 'big_image_size_threshold', 2560, $imagesize, $file, $attachment_id ); - // If the original image's dimensions are over the threshold, scale the image - // and use it as the "full" size. + // If the original image's dimensions are over the threshold, + // scale the image and use it as the "full" size. if ( $threshold && ( $image_meta['width'] > $threshold || $image_meta['height'] > $threshold ) ) { $editor = wp_get_image_editor( $file ); @@ -282,7 +282,7 @@ function wp_create_image_subsizes( $file, $attachment_id ) { return $image_meta; } - // Resize the image + // Resize the image. $resized = $editor->resize( $threshold, $threshold ); $rotated = null; @@ -305,10 +305,10 @@ function wp_create_image_subsizes( $file, $attachment_id ) { $image_meta['image_meta']['orientation'] = 1; } } else { - // TODO: log errors. + // TODO: Log errors. } } else { - // TODO: log errors. + // TODO: Log errors. } } elseif ( ! empty( $exif_meta['orientation'] ) && (int) $exif_meta['orientation'] !== 1 ) { // Rotate the whole original image if there is EXIF data and "orientation" is not 1. @@ -335,7 +335,7 @@ function wp_create_image_subsizes( $file, $attachment_id ) { $image_meta['image_meta']['orientation'] = 1; } } else { - // TODO: log errors. + // TODO: Log errors. } } } @@ -434,7 +434,7 @@ function _wp_make_subsizes( $new_sizes, $file, $image_meta, $attachment_id ) { $rotated = $editor->maybe_exif_rotate(); if ( is_wp_error( $rotated ) ) { - // TODO: log errors. + // TODO: Log errors. } } @@ -443,7 +443,7 @@ function _wp_make_subsizes( $new_sizes, $file, $image_meta, $attachment_id ) { $new_size_meta = $editor->make_subsize( $new_size_data ); if ( is_wp_error( $new_size_meta ) ) { - // TODO: log errors. + // TODO: Log errors. } else { // Save the size meta value. $image_meta['sizes'][ $new_size_name ] = $new_size_meta; @@ -575,7 +575,7 @@ function wp_generate_attachment_metadata( $attachment_id, $file ) { if ( ! empty( $merged_sizes ) ) { $editor = wp_get_image_editor( $file ); - if ( ! is_wp_error( $editor ) ) { // No support for this type of file + if ( ! is_wp_error( $editor ) ) { // No support for this type of file. /* * PDFs may have the same file filename as JPEGs. * Ensure the PDF preview image does not overwrite any JPEG images that already exist. @@ -715,18 +715,18 @@ function wp_read_image_metadata( $file ) { if ( ! empty( $info['APP13'] ) ) { $iptc = @iptcparse( $info['APP13'] ); - // Headline, "A brief synopsis of the caption." + // Headline, "A brief synopsis of the caption". if ( ! empty( $iptc['2#105'][0] ) ) { $meta['title'] = trim( $iptc['2#105'][0] ); /* * Title, "Many use the Title field to store the filename of the image, - * though the field may be used in many ways." + * though the field may be used in many ways". */ } elseif ( ! empty( $iptc['2#005'][0] ) ) { $meta['title'] = trim( $iptc['2#005'][0] ); } - if ( ! empty( $iptc['2#120'][0] ) ) { // description / legacy caption + if ( ! empty( $iptc['2#120'][0] ) ) { // Description / legacy caption. $caption = trim( $iptc['2#120'][0] ); mbstring_binary_safe_encoding(); diff --git a/wp-admin/includes/import.php b/wp-admin/includes/import.php index 52b623a447..1b36d6a4d9 100644 --- a/wp-admin/includes/import.php +++ b/wp-admin/includes/import.php @@ -136,7 +136,8 @@ function wp_import_handle_upload() { * @return array Importers with metadata for each. */ function wp_get_popular_importers() { - include( ABSPATH . WPINC . '/version.php' ); // Include an unmodified $wp_version. + // Include an unmodified $wp_version. + include( ABSPATH . WPINC . '/version.php' ); $locale = get_user_locale(); $cache_key = 'popular_importers_' . md5( $locale . $wp_version ); diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index f52e9a4704..eaa3a1ca50 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -770,7 +770,7 @@ function media_upload_form_handler() { if ( $image_alt != get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) ) { $image_alt = wp_strip_all_tags( $image_alt, true ); - // Update_meta expects slashed. + // update_post_meta() expects slashed. update_post_meta( $attachment_id, '_wp_attachment_image_alt', wp_slash( $image_alt ) ); } } @@ -2529,7 +2529,7 @@ function media_upload_gallery_form( $errors ) {