summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--.git-blame-ignore-revs3
-rw-r--r--.github/dependabot.yml62
-rw-r--r--.github/workflows/check-built-files.yml2
-rw-r--r--.github/workflows/commit-built-file-changes.yml4
-rw-r--r--.github/workflows/install-testing.yml6
-rw-r--r--.github/workflows/local-docker-environment.yml6
-rw-r--r--.github/workflows/phpunit-tests.yml36
-rw-r--r--.github/workflows/pull-request-comments.yml2
-rw-r--r--.github/workflows/reusable-cleanup-pull-requests.yml28
-rw-r--r--.github/workflows/reusable-phpunit-tests-v1.yml2
-rw-r--r--.github/workflows/reusable-test-local-docker-environment-v1.yml2
-rw-r--r--.github/workflows/test-and-zip-default-themes.yml26
-rw-r--r--.github/workflows/test-old-branches.yml4
-rw-r--r--.github/workflows/upgrade-develop-testing.yml2
-rw-r--r--.github/workflows/upgrade-testing.yml95
-rw-r--r--.version-support-mysql.json44
-rw-r--r--.version-support-php.json45
-rw-r--r--Gruntfile.js1
-rw-r--r--SECURITY.md8
-rw-r--r--composer.json2
-rw-r--r--docker-compose.yml4
-rw-r--r--package.json2
-rw-r--r--src/js/_enqueues/admin/user-profile.js14
-rw-r--r--src/js/_enqueues/vendor/README.md2
-rw-r--r--src/js/_enqueues/vendor/swfobject.js4
-rw-r--r--src/js/_enqueues/vendor/swfupload/handlers.js54
-rw-r--r--src/js/_enqueues/vendor/swfupload/handlers.min.js1
-rw-r--r--src/js/_enqueues/vendor/swfupload/license.txt32
-rw-r--r--src/js/_enqueues/vendor/swfupload/swfupload.js140
-rw-r--r--src/js/media/views/uploader/status.js6
-rw-r--r--src/readme.html2
-rw-r--r--src/wp-admin/async-upload.php19
-rw-r--r--src/wp-admin/css/common.css4
-rw-r--r--src/wp-admin/css/list-tables.css8
-rw-r--r--src/wp-admin/css/revisions.css30
-rw-r--r--src/wp-admin/includes/ajax-actions.php8
-rw-r--r--src/wp-admin/includes/class-custom-image-header.php2
-rw-r--r--src/wp-admin/includes/class-language-pack-upgrader.php2
-rw-r--r--src/wp-admin/includes/class-wp-automatic-updater.php2
-rw-r--r--src/wp-admin/includes/class-wp-community-events.php8
-rw-r--r--src/wp-admin/includes/class-wp-debug-data.php23
-rw-r--r--src/wp-admin/includes/class-wp-filesystem-ftpext.php9
-rw-r--r--src/wp-admin/includes/class-wp-filesystem-ftpsockets.php4
-rw-r--r--src/wp-admin/includes/class-wp-list-table.php4
-rw-r--r--src/wp-admin/includes/class-wp-ms-sites-list-table.php18
-rw-r--r--src/wp-admin/includes/class-wp-site-health.php2
-rw-r--r--src/wp-admin/includes/file.php2
-rw-r--r--src/wp-admin/includes/media.php2
-rw-r--r--src/wp-admin/includes/misc.php8
-rw-r--r--src/wp-admin/includes/post.php2
-rw-r--r--src/wp-admin/includes/revision.php72
-rw-r--r--src/wp-admin/includes/taxonomy.php2
-rw-r--r--src/wp-admin/includes/template.php3
-rw-r--r--src/wp-admin/includes/update-core.php1
-rw-r--r--src/wp-admin/install.php4
-rw-r--r--src/wp-admin/menu.php2
-rw-r--r--src/wp-admin/nav-menus.php2
-rw-r--r--src/wp-admin/network/site-info.php2
-rw-r--r--src/wp-admin/network/site-new.php2
-rw-r--r--src/wp-admin/network/sites.php44
-rw-r--r--src/wp-admin/options-discussion.php2
-rw-r--r--src/wp-admin/post.php2
-rw-r--r--src/wp-admin/upgrade.php4
-rw-r--r--src/wp-admin/user-edit.php30
-rw-r--r--src/wp-content/themes/twentyeleven/inc/block-patterns.php4
-rw-r--r--src/wp-content/themes/twentyfourteen/css/blocks.css2
-rw-r--r--src/wp-content/themes/twentyfourteen/inc/block-patterns.php2
-rw-r--r--src/wp-content/themes/twentynineteen/sass/navigation/_menu-main-navigation.scss6
-rw-r--r--src/wp-content/themes/twentynineteen/style-rtl.css6
-rw-r--r--src/wp-content/themes/twentynineteen/style.css6
-rw-r--r--src/wp-content/themes/twentyseventeen/inc/block-patterns.php60
-rw-r--r--src/wp-content/themes/twentysixteen/css/editor-blocks.css4
-rw-r--r--src/wp-content/themes/twentytwelve/css/editor-blocks.css8
-rw-r--r--src/wp-content/themes/twentytwenty/assets/js/index.js5
-rw-r--r--src/wp-content/themes/twentytwenty/functions.php6
-rw-r--r--src/wp-content/themes/twentytwentyone/assets/js/primary-navigation.js2
-rw-r--r--src/wp-includes/author-template.php2
-rw-r--r--src/wp-includes/block-template-utils.php9
-rw-r--r--src/wp-includes/block-template.php2
-rw-r--r--src/wp-includes/blocks.php34
-rw-r--r--src/wp-includes/capabilities.php89
-rw-r--r--src/wp-includes/category-template.php26
-rw-r--r--src/wp-includes/certificates/ca-bundle.crt168
-rw-r--r--src/wp-includes/certificates/cacert.pem168
-rw-r--r--src/wp-includes/class-wp-block-list.php3
-rw-r--r--src/wp-includes/class-wp-block-pattern-categories-registry.php2
-rw-r--r--src/wp-includes/class-wp-block-patterns-registry.php2
-rw-r--r--src/wp-includes/class-wp-block-styles-registry.php2
-rw-r--r--src/wp-includes/class-wp-block.php2
-rw-r--r--src/wp-includes/class-wp-classic-to-block-menu-converter.php1
-rw-r--r--src/wp-includes/class-wp-comment-query.php4
-rw-r--r--src/wp-includes/class-wp-customize-widgets.php8
-rw-r--r--src/wp-includes/class-wp-image-editor-imagick.php53
-rw-r--r--src/wp-includes/class-wp-navigation-fallback.php1
-rw-r--r--src/wp-includes/class-wp-oembed.php16
-rw-r--r--src/wp-includes/class-wp-phpmailer.php2
-rw-r--r--src/wp-includes/class-wp-roles.php36
-rw-r--r--src/wp-includes/class-wp-site.php2
-rw-r--r--src/wp-includes/class-wp-tax-query.php2
-rw-r--r--src/wp-includes/class-wpdb.php42
-rw-r--r--src/wp-includes/comment-template.php29
-rw-r--r--src/wp-includes/comment.php47
-rw-r--r--src/wp-includes/compat.php10
-rw-r--r--src/wp-includes/css/wp-embed-template.css17
-rw-r--r--src/wp-includes/embed.php18
-rw-r--r--src/wp-includes/formatting.php21
-rw-r--r--src/wp-includes/general-template.php2
-rw-r--r--src/wp-includes/kses.php28
-rw-r--r--src/wp-includes/link-template.php31
-rw-r--r--src/wp-includes/load.php9
-rw-r--r--src/wp-includes/media-template.php4
-rw-r--r--src/wp-includes/media.php21
-rw-r--r--src/wp-includes/meta.php188
-rw-r--r--src/wp-includes/ms-load.php8
-rw-r--r--src/wp-includes/ms-site.php12
-rw-r--r--src/wp-includes/option.php2
-rw-r--r--src/wp-includes/pluggable.php20
-rw-r--r--src/wp-includes/plugin.php4
-rw-r--r--src/wp-includes/post.php25
-rw-r--r--src/wp-includes/rest-api/class-wp-rest-response.php4
-rw-r--r--src/wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php11
-rw-r--r--src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php8
-rw-r--r--src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php21
-rw-r--r--src/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php14
-rw-r--r--src/wp-includes/script-loader.php10
-rw-r--r--src/wp-includes/taxonomy.php22
-rw-r--r--src/wp-includes/theme.php2
-rw-r--r--src/wp-includes/user.php17
-rw-r--r--src/wp-includes/version.php4
-rw-r--r--src/wp-includes/widgets/class-wp-widget-media-gallery.php1
-rw-r--r--src/wp-settings.php6
-rw-r--r--tests/e2e/specs/install.test.js2
-rw-r--r--tests/phpunit/data/images/png-tests/grayscale-test-image.pngbin0 -> 8843 bytes
-rw-r--r--tests/phpunit/data/images/png-tests/vivid-green-bird.pngbin0 -> 2625142 bytes
-rw-r--r--tests/phpunit/includes/abstract-testcase.php55
-rw-r--r--tests/phpunit/includes/build-visual-html-tree.php304
-rw-r--r--tests/phpunit/includes/factory/class-wp-unittest-factory-for-attachment.php5
-rw-r--r--tests/phpunit/includes/object-cache.php8
-rw-r--r--tests/phpunit/tests/admin/includesPlugin.php21
-rw-r--r--tests/phpunit/tests/admin/includesTemplate.php14
-rw-r--r--tests/phpunit/tests/admin/wpPluginsListTable.php2
-rw-r--r--tests/phpunit/tests/ajax/wpAjaxSendAttachmentToEditor.php38
-rw-r--r--tests/phpunit/tests/ajax/wpCustomizeNavMenus.php37
-rw-r--r--tests/phpunit/tests/auth.php16
-rw-r--r--tests/phpunit/tests/build-visual-html-tree.php144
-rw-r--r--tests/phpunit/tests/comment.php20
-rw-r--r--tests/phpunit/tests/comment/commentForm.php34
-rw-r--r--tests/phpunit/tests/comment/commentsTemplate.php15
-rw-r--r--tests/phpunit/tests/comment/metaCache.php34
-rw-r--r--tests/phpunit/tests/comment/wpHandleCommentSubmission.php39
-rw-r--r--tests/phpunit/tests/customize/control.php18
-rw-r--r--tests/phpunit/tests/customize/custom-css-setting.php32
-rw-r--r--tests/phpunit/tests/customize/manager.php24
-rw-r--r--tests/phpunit/tests/customize/nav-menu-item-setting.php18
-rw-r--r--tests/phpunit/tests/customize/nav-menu-setting.php18
-rw-r--r--tests/phpunit/tests/customize/nav-menus.php54
-rw-r--r--tests/phpunit/tests/customize/panel.php25
-rw-r--r--tests/phpunit/tests/customize/selective-refresh-ajax.php26
-rw-r--r--tests/phpunit/tests/customize/setting.php32
-rw-r--r--tests/phpunit/tests/customize/widgets.php57
-rw-r--r--tests/phpunit/tests/db/charset.php8
-rw-r--r--tests/phpunit/tests/dependencies/scripts.php435
-rw-r--r--tests/phpunit/tests/feed/atom.php2
-rw-r--r--tests/phpunit/tests/feed/rss2.php2
-rw-r--r--tests/phpunit/tests/file.php6
-rw-r--r--tests/phpunit/tests/formatting/escUrl.php6
-rw-r--r--tests/phpunit/tests/formatting/sanitizeFileName.php12
-rw-r--r--tests/phpunit/tests/formatting/sanitizePost.php3
-rw-r--r--tests/phpunit/tests/formatting/wpSpecialchars.php2
-rw-r--r--tests/phpunit/tests/formatting/wpTrimExcerpt.php22
-rw-r--r--tests/phpunit/tests/functions.php2
-rw-r--r--tests/phpunit/tests/general/template.php38
-rw-r--r--tests/phpunit/tests/image/editorImagick.php61
-rw-r--r--tests/phpunit/tests/kses.php2
-rw-r--r--tests/phpunit/tests/l10n.php17
-rw-r--r--tests/phpunit/tests/l10n/getUserLocale.php53
-rw-r--r--tests/phpunit/tests/media.php7
-rw-r--r--tests/phpunit/tests/meta.php117
-rw-r--r--tests/phpunit/tests/oembed/controller.php24
-rw-r--r--tests/phpunit/tests/oembed/wpOembed.php26
-rw-r--r--tests/phpunit/tests/post.php3
-rw-r--r--tests/phpunit/tests/post/getPages.php71
-rw-r--r--tests/phpunit/tests/post/getPostsByAuthorSql.php36
-rw-r--r--tests/phpunit/tests/post/revisions.php2
-rw-r--r--tests/phpunit/tests/post/updateTermCountOnTransitionPostStatus.php180
-rw-r--r--tests/phpunit/tests/post/wpPostType.php2
-rw-r--r--tests/phpunit/tests/query.php3
-rw-r--r--tests/phpunit/tests/query/conditionals.php40
-rw-r--r--tests/phpunit/tests/query/postStatus.php6
-rw-r--r--tests/phpunit/tests/query/setupPostdata.php12
-rw-r--r--tests/phpunit/tests/readme.php18
-rw-r--r--tests/phpunit/tests/rest-api/rest-application-passwords-controller.php43
-rw-r--r--tests/phpunit/tests/rest-api/rest-comments-controller.php4
-rw-r--r--tests/phpunit/tests/rest-api/rest-global-styles-controller.php56
-rw-r--r--tests/phpunit/tests/rest-api/rest-posts-controller.php3
-rw-r--r--tests/phpunit/tests/rest-api/rest-schema-setup.php2
-rw-r--r--tests/phpunit/tests/rest-api/rest-server.php2
-rw-r--r--tests/phpunit/tests/rest-api/rest-settings-controller.php71
-rw-r--r--tests/phpunit/tests/rest-api/rest-users-controller.php6
-rw-r--r--tests/phpunit/tests/shortcode.php3
-rw-r--r--tests/phpunit/tests/taxonomy.php28
-rw-r--r--tests/phpunit/tests/term/cache.php2
-rw-r--r--tests/phpunit/tests/term/meta.php64
-rw-r--r--tests/phpunit/tests/term/wpGenerateTagCloud.php4
-rw-r--r--tests/phpunit/tests/term/wpGetObjectTerms.php5
-rw-r--r--tests/phpunit/tests/term/wpTaxonomy.php2
-rw-r--r--tests/phpunit/tests/theme.php11
-rw-r--r--tests/phpunit/tests/url.php17
-rw-r--r--tests/phpunit/tests/user.php28
-rw-r--r--tests/phpunit/tests/user/capabilities.php23
-rw-r--r--tests/phpunit/tests/user/getTheAuthorPosts.php4
-rw-r--r--tests/phpunit/tests/xmlrpc/wp/getComments.php2
-rw-r--r--tests/phpunit/tests/xmlrpc/wp/getPageList.php1
-rw-r--r--tests/phpunit/tests/xmlrpc/wp/getPages.php1
-rw-r--r--tests/phpunit/tests/xmlrpc/wp/getPosts.php2
-rw-r--r--tests/phpunit/tests/xmlrpc/wp/getTerms.php1
-rw-r--r--tests/phpunit/tests/xmlrpc/wp/getUsers.php1
-rw-r--r--tests/qunit/fixtures/wp-api-generated.js32
-rw-r--r--tools/local-env/scripts/docker.js33
-rw-r--r--tools/local-env/scripts/install.js37
-rw-r--r--tools/local-env/scripts/start.js61
-rw-r--r--tools/local-env/scripts/utils.js10
222 files changed, 3277 insertions, 1965 deletions
diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
index 77c4e990b0..054a175385 100644
--- a/.git-blame-ignore-revs
+++ b/.git-blame-ignore-revs
@@ -59,3 +59,6 @@ a96fa164b00ed51c7c0481574834cff92ab9b1f0 # [60043]
1aa6da693ad739b78752a55d154cd48cb757b90b # [60047]
d44e1c2ce2dc638e89ed6a1d02b1cfadb8a15fe7 # [60048]
a18719e7ea49ab7ac0091e076840cb7efdf51cc5 # [60049]
+
+# 6.9 Coding Standards
+cbb6519119276ceba4279eaee73ab66294ebd820 # [60402]
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index bb655cb528..53d399e665 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -127,3 +127,65 @@ updates:
- "lodash"
- "moment"
- "underscore"
+
+ # Monitor npm dependencies within default themes.
+ - package-ecosystem: "npm"
+ directory: "/src/wp-content/themes/twentytwentyone"
+ schedule:
+ interval: "weekly"
+ open-pull-requests-limit: 20
+ groups:
+ twentytwentyone-sass-css:
+ patterns:
+ - "**browserslist*"
+ - "autoprefixer"
+ - "*css*"
+ - "*sass*"
+ - "!*stylelint*"
+ twentytwentyone-eslint:
+ patterns:
+ - "**eslint*"
+ twentytwentyone-stylelint:
+ patterns:
+ - "**stylelint*"
+ twentytwentyone-miscellaneous:
+ patterns:
+ - "chokidar-cli"
+ - "minimist"
+ - "npm-run-all"
+
+ - package-ecosystem: "npm"
+ directory: "/src/wp-content/themes/twentytwenty"
+ schedule:
+ interval: "weekly"
+ open-pull-requests-limit: 20
+ groups:
+ twentytwenty-css:
+ patterns:
+ - "**browserslist*"
+ - "autoprefixer"
+ - "*css*"
+ twentytwenty-stylelint:
+ patterns:
+ - "*stylelint*"
+ twentytwenty-miscellaneous:
+ patterns:
+ - "concurrently"
+ - "@wordpress/scripts"
+
+ - package-ecosystem: "npm"
+ directory: "/src/wp-content/themes/twentynineteen"
+ schedule:
+ interval: "weekly"
+ open-pull-requests-limit: 20
+ groups:
+ twentynineteen-css-sass:
+ patterns:
+ - "**browserslist*"
+ - "autoprefixer"
+ - "*css*"
+ - "*sass*"
+ twentynineteen-miscellaneous:
+ patterns:
+ - "chokidar-cli"
+ - "npm-run-all"
diff --git a/.github/workflows/check-built-files.yml b/.github/workflows/check-built-files.yml
index e1338f8518..8fb020313b 100644
--- a/.github/workflows/check-built-files.yml
+++ b/.github/workflows/check-built-files.yml
@@ -26,6 +26,8 @@ on:
- 'composer.*'
# Confirm any changes to relevant workflow files.
- '.github/workflows/check-built-files.yml'
+ # Changes to the default themes should be handled by the themes workflows.
+ - '!src/wp-content/themes/twenty**'
# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
diff --git a/.github/workflows/commit-built-file-changes.yml b/.github/workflows/commit-built-file-changes.yml
index 52ce676c89..5ffebd8c10 100644
--- a/.github/workflows/commit-built-file-changes.yml
+++ b/.github/workflows/commit-built-file-changes.yml
@@ -3,7 +3,9 @@ name: Commit Built File Changes (PRs)
on:
workflow_run:
- workflows: [ 'Check Built Files (PRs)' ]
+ workflows:
+ - 'Check Built Files (PRs)'
+ - 'Test Default Themes & Create ZIPs'
types:
- completed
diff --git a/.github/workflows/install-testing.yml b/.github/workflows/install-testing.yml
index 775ea83c75..6d6caf246a 100644
--- a/.github/workflows/install-testing.yml
+++ b/.github/workflows/install-testing.yml
@@ -92,11 +92,13 @@ jobs:
db-version: '8.4'
# Only test the latest innovation release.
- db-version: '9.0'
+ - db-version: '9.1'
+ - db-version: '9.2'
# MySQL 9.0+ will not work on PHP 7.2 & 7.3. See https://core.trac.wordpress.org/ticket/61218.
- php: '7.2'
- db-version: '9.1'
+ db-version: '9.3'
- php: '7.3'
- db-version: '9.1'
+ db-version: '9.3'
services:
database:
diff --git a/.github/workflows/local-docker-environment.yml b/.github/workflows/local-docker-environment.yml
index 7e4be73c33..d8312015f6 100644
--- a/.github/workflows/local-docker-environment.yml
+++ b/.github/workflows/local-docker-environment.yml
@@ -97,11 +97,13 @@ jobs:
- db-version: '5.5'
# Only test the latest innovation release.
- db-version: '9.0'
+ - db-version: '9.1'
+ - db-version: '9.2'
# MySQL 9.0+ will not work on PHP 7.2 & 7.3. See https://core.trac.wordpress.org/ticket/61218.
- php: '7.2'
- db-version: '9.1'
+ db-version: '9.3'
- php: '7.3'
- db-version: '9.1'
+ db-version: '9.3'
with:
os: ${{ matrix.os }}
diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml
index 2feb89a063..d266b40fb2 100644
--- a/.github/workflows/phpunit-tests.yml
+++ b/.github/workflows/phpunit-tests.yml
@@ -53,6 +53,10 @@ jobs:
#
# Creates a PHPUnit test job for each PHP/MySQL combination.
#
+ # Though MySQL 5.5 and 5.6 are still supported by WordPress, they are not currently tested here because the Docker
+ # images do not work. Testing against MariaDB 5.5 provides a reasonable level of MySQL 5.5 testing (see MariaDB matrix
+ # below for more details).
+ #
test-with-mysql:
name: PHP ${{ matrix.php }}
uses: ./.github/workflows/reusable-phpunit-tests-v3.yml
@@ -124,6 +128,12 @@ jobs:
#
# Creates a PHPUnit test job for each PHP/MariaDB combination.
#
+ # All LTS versions of MariaDB supported by WordPress with greater than 1% usage according to w.org/stats should be
+ # tested. The exceptions to this rule are the most recent LTS and version 5.5.
+ #
+ # The 5.5 release was intended as a drop-in replacement for MySQL. Because the MySQL 5.5 Docker containers do not
+ # work, this ensures some level of MySQL 5.5 testing.
+ #
test-with-mariadb:
name: PHP ${{ matrix.php }}
uses: ./.github/workflows/reusable-phpunit-tests-v3.yml
@@ -137,7 +147,7 @@ jobs:
os: [ ubuntu-24.04 ]
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
db-type: [ 'mariadb' ]
- db-version: [ '5.5', '10.3', '10.4', '10.5', '10.6', '10.11', '11.4' ]
+ db-version: [ '5.5', '10.3', '10.4', '10.5', '10.6', '10.11', '11.4', '11.8' ]
multisite: [ false, true ]
memcached: [ false ]
@@ -146,13 +156,13 @@ jobs:
- os: ubuntu-24.04
php: '8.3'
db-type: 'mariadb'
- db-version: '11.4'
+ db-version: '11.8'
multisite: false
memcached: true
- os: ubuntu-24.04
php: '8.3'
db-type: 'mariadb'
- db-version: '11.4'
+ db-version: '11.8'
multisite: true
memcached: true
with:
@@ -168,11 +178,11 @@ jobs:
#
# Creates PHPUnit test jobs to test MariaDB and MySQL innovation releases.
#
- # Though innovation releases are deemed "production grade" and never receive LTS status, they include new features
- # and updates that will be included in the next LTS version.
+ # Though innovation releases are deemed "production grade", they never receive LTS status. However, they include new
+ # features and updates that will be included in the next LTS version.
#
- # Because upstream support for innovation releases gets dropped when a new one is released, only the most recent
- # innovation version is tested.
+ # Because upstream support for innovation releases is dropped when a new one is released (including security updates),
+ # only the most recent innovation version is tested.
#
test-innovation-releases:
name: PHP ${{ matrix.php }}
@@ -187,7 +197,7 @@ jobs:
os: [ ubuntu-24.04 ]
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
db-type: [ 'mysql', 'mariadb' ]
- db-version: [ '9.1', '11.6' ]
+ db-version: [ '9.3', '11.7' ]
multisite: [ false, true ]
memcached: [ false ]
db-innovation: [ true ]
@@ -195,14 +205,14 @@ jobs:
exclude:
# MySQL 9.0+ will not work on PHP <= 7.3 because mysql_native_password was removed. See https://core.trac.wordpress.org/ticket/61218.
- php: '7.2'
- db-version: '9.1'
+ db-version: '9.3'
- php: '7.3'
- db-version: '9.1'
+ db-version: '9.3'
# Exclude version combinations that don't exist.
- db-type: 'mariadb'
- db-version: '9.1'
+ db-version: '9.3'
- db-type: 'mysql'
- db-version: '11.6'
+ db-version: '11.7'
with:
os: ${{ matrix.os }}
php: ${{ matrix.php }}
@@ -217,6 +227,8 @@ jobs:
#
# Runs specific individual test groups.
#
+ # These tests are run against the most recent LTS version of MySQL.
+ #
specific-test-groups:
name: ${{ matrix.phpunit-test-groups }}
uses: ./.github/workflows/reusable-phpunit-tests-v3.yml
diff --git a/.github/workflows/pull-request-comments.yml b/.github/workflows/pull-request-comments.yml
index ea18e6be91..1bdbe6a517 100644
--- a/.github/workflows/pull-request-comments.yml
+++ b/.github/workflows/pull-request-comments.yml
@@ -158,7 +158,7 @@ jobs:
- All changes will be lost when refreshing the page.
- A fresh instance is created each time the link below is clicked.
- Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
- it's possible that the most recent build failed, or has not completed. Check the [list of workflow runs to be sure](https://github.com/WordPress/wordpress-develop/actions/workflows/wordpress-playground.yml).
+ it's possible that the most recent build failed, or has not completed. Check the [list of workflow runs to be sure](https://github.com/WordPress/wordpress-develop/actions/workflows/test-build-processes.yml).
For more details about these limitations and more, check out the [Limitations page](https://wordpress.github.io/wordpress-playground/limitations/) in the WordPress Playground documentation.
diff --git a/.github/workflows/reusable-cleanup-pull-requests.yml b/.github/workflows/reusable-cleanup-pull-requests.yml
index 796d67b63e..e65c1e211f 100644
--- a/.github/workflows/reusable-cleanup-pull-requests.yml
+++ b/.github/workflows/reusable-cleanup-pull-requests.yml
@@ -50,16 +50,32 @@ jobs:
with:
script: |
const fixedList = "${{ steps.trac-tickets.outputs.fixed_list }}".split(' ').filter(Boolean);
-
let prNumbers = [];
for (const ticket of fixedList) {
- const tracTicketUrl = `https://core.trac.wordpress.org/ticket/${ ticket }`;
- const corePrefix = `Core-${ ticket }`;
- const query = `is:pr is:open repo:${ context.repo.owner }/${ context.repo.repo } in:body ${ tracTicketUrl } OR ${ corePrefix }`;
- const result = await github.rest.search.issuesAndPullRequests({ q: query });
+ const tracTicketUrl = `https://core.trac.wordpress.org/ticket/${ticket}`;
+ const corePrefix = `Core-${ticket}`;
+
+ const query = `
+ query($searchQuery: String!) {
+ search(query: $searchQuery, type: ISSUE_ADVANCED, first: 20) {
+ nodes {
+ ... on PullRequest {
+ number
+ state
+ }
+ }
+ }
+ }
+ `;
+
+ const searchQuery = `repo:${context.repo.owner}/${context.repo.repo} is:pr is:open in:body ( "${tracTicketUrl}" OR "${corePrefix}" )`;
+
+ const result = await github.graphql(query, {
+ searchQuery,
+ });
- prNumbers = prNumbers.concat(result.data.items.map(pr => pr.number));
+ prNumbers.push(...result.search.nodes.map(pr => pr.number));
}
return prNumbers;
diff --git a/.github/workflows/reusable-phpunit-tests-v1.yml b/.github/workflows/reusable-phpunit-tests-v1.yml
index 5fd7d54d84..abfb1ee5b4 100644
--- a/.github/workflows/reusable-phpunit-tests-v1.yml
+++ b/.github/workflows/reusable-phpunit-tests-v1.yml
@@ -3,7 +3,7 @@
#
# A reusable workflow that runs the PHPUnit test suite with the specified configuration.
#
-# This workflow is used by branches 4.1 through 5.1.
+# This workflow is used by branches 4.7 through 5.1.
##
name: Run PHPUnit tests
diff --git a/.github/workflows/reusable-test-local-docker-environment-v1.yml b/.github/workflows/reusable-test-local-docker-environment-v1.yml
index 83ed4d1ac7..c4bbfae729 100644
--- a/.github/workflows/reusable-test-local-docker-environment-v1.yml
+++ b/.github/workflows/reusable-test-local-docker-environment-v1.yml
@@ -155,7 +155,7 @@ jobs:
run: npm run env:restart
- name: Test a CLI command
- run: npm run env:cli wp option get siteurl
+ run: npm run env:cli option get siteurl
- name: Test logs command
run: npm run env:logs
diff --git a/.github/workflows/test-and-zip-default-themes.yml b/.github/workflows/test-and-zip-default-themes.yml
index ca1473cf0b..49b7522cfe 100644
--- a/.github/workflows/test-and-zip-default-themes.yml
+++ b/.github/workflows/test-and-zip-default-themes.yml
@@ -148,6 +148,32 @@ jobs:
- name: Build theme
run: npm run build
+ - name: Check for changes to versioned files
+ id: built-file-check
+ if: ${{ github.event_name == 'pull_request' }}
+ run: |
+ if git diff --quiet; then
+ echo "uncommitted_changes=false" >> "$GITHUB_OUTPUT"
+ else
+ echo "uncommitted_changes=true" >> "$GITHUB_OUTPUT"
+ fi
+
+ - name: Display changes to versioned files
+ if: ${{ steps.built-file-check.outputs.uncommitted_changes == 'true' }}
+ run: git diff
+
+ - name: Save diff to a file
+ if: ${{ steps.built-file-check.outputs.uncommitted_changes == 'true' }}
+ run: git diff > ./changes.diff
+
+ # Uploads the diff file as an artifact.
+ - name: Upload diff file as artifact
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
+ if: ${{ steps.built-file-check.outputs.uncommitted_changes == 'true' }}
+ with:
+ name: pr-built-file-changes
+ path: src/wp-content/themes/${{ matrix.theme }}/changes.diff
+
- name: Ensure version-controlled files are not modified or deleted
run: git diff --exit-code
diff --git a/.github/workflows/test-old-branches.yml b/.github/workflows/test-old-branches.yml
index fb058697da..a28eb2e913 100644
--- a/.github/workflows/test-old-branches.yml
+++ b/.github/workflows/test-old-branches.yml
@@ -25,7 +25,7 @@ on:
permissions: {}
env:
- CURRENTLY_SUPPORTED_BRANCH: '6.7'
+ CURRENTLY_SUPPORTED_BRANCH: '6.8'
jobs:
dispatch-workflows-for-old-branches:
@@ -47,7 +47,7 @@ jobs:
branch: [
'6.8', '6.7', '6.6', '6.5', '6.4', '6.3', '6.2', '6.1','6.0',
'5.9', '5.8', '5.7', '5.6', '5.5', '5.4', '5.3', '5.2', '5.1', '5.0',
- '4.9', '4.8', '4.7', '4.6', '4.5', '4.4', '4.3', '4.2', '4.1'
+ '4.9', '4.8', '4.7'
]
include:
# PHP Compatibility testing was introduced in 5.5.
diff --git a/.github/workflows/upgrade-develop-testing.yml b/.github/workflows/upgrade-develop-testing.yml
index 60f5cb582b..b24fd5fea2 100644
--- a/.github/workflows/upgrade-develop-testing.yml
+++ b/.github/workflows/upgrade-develop-testing.yml
@@ -64,7 +64,7 @@ jobs:
db-type: [ 'mysql' ]
db-version: [ '5.7', '8.4' ]
# WordPress 4.9 is the oldest version that supports PHP 7.2.
- wp: [ '4.9', '6.5', '6.7', '6.8-RC1' ]
+ wp: [ '4.9', '6.6', '6.7', '6.8' ]
multisite: [ false, true ]
exclude:
diff --git a/.github/workflows/upgrade-testing.yml b/.github/workflows/upgrade-testing.yml
index 8f3320f216..9694433b57 100644
--- a/.github/workflows/upgrade-testing.yml
+++ b/.github/workflows/upgrade-testing.yml
@@ -37,15 +37,15 @@ permissions: {}
# Because the number of jobs spawned can quickly balloon out of control, the following methodology is applied when
# building out the matrix below:
#
-# - The last two releases of WordPress are tested against all PHP/MySQL LTS version combinations and the most recent
-# innovation release.
+# - The two most recent releases of WordPress are tested against all PHP/MySQL LTS version combinations and the
+# most recent innovation release.
# - The next 6 oldest versions of WordPress are tested against both the oldest and newest releases of PHP currently
# supported for both PHP 7 & 8 along with the oldest and newest MySQL LTS versions currently supported (no innovation
# releases). At the current 3 releases per year pace, this accounts for 2 additional years worth of releases.
# - Of the remaining versions of WordPress still receiving security updates, only test the ones where the database
# version was updated since the previous major release.
# - The oldest version of WordPress receiving security updates should always be tested against the same combinations as
-# detailed for the last two releases.
+# detailed for the two most recent releases.
# Notes about chosen MySQL versions:
# - Only the most recent innovation release should be included in testing.
@@ -54,8 +54,8 @@ permissions: {}
# - 5.6.x Docker containers are available and work, but 5.6 only accounts for ~2.3% of installs as of 12/6/2024.defaults:
# - 5.7.x accounts for ~20% of installs, so this is used below instead.
jobs:
- # Tests the full list of PHP/MySQL combinations for the last two versions of WordPress.
- upgrade-tests-last-two-releases:
+ # Tests the full list of PHP/MySQL combinations for the two most recent versions of WordPress.
+ upgrade-tests-recent-releases:
name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }}
uses: ./.github/workflows/reusable-upgrade-testing.yml
if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }}
@@ -65,8 +65,8 @@ jobs:
os: [ 'ubuntu-24.04' ]
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
db-type: [ 'mysql' ]
- db-version: [ '5.7', '8.0', '8.4', '9.1' ]
- wp: [ '6.6', '6.7' ]
+ db-version: [ '5.7', '8.0', '8.4', '9.3' ]
+ wp: [ '6.7', '6.8' ]
multisite: [ false, true ]
exclude:
@@ -77,9 +77,9 @@ jobs:
db-version: '8.4'
# MySQL 9.0+ will not work on PHP 7.2 & 7.3. See https://core.trac.wordpress.org/ticket/61218.
- php: '7.2'
- db-version: '9.1'
+ db-version: '9.3'
- php: '7.3'
- db-version: '9.1'
+ db-version: '9.3'
with:
os: ${{ matrix.os }}
php: ${{ matrix.php }}
@@ -89,7 +89,7 @@ jobs:
new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }}
multisite: ${{ matrix.multisite }}
- # Tests the remaining 6.x releases on the oldest and newest supported versions of PHP 7 & 8.
+ # Tests 6.x releases where the WordPress database version changed on the oldest and newest supported versions of PHP 7 & 8.
upgrade-tests-wp-6x-mysql:
name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }}
uses: ./.github/workflows/reusable-upgrade-testing.yml
@@ -101,7 +101,7 @@ jobs:
php: [ '7.2', '7.4', '8.0', '8.4' ]
db-type: [ 'mysql' ]
db-version: [ '5.7', '8.4' ]
- wp: [ '6.0', '6.1', '6.2', '6.3', '6.4', '6.5' ]
+ wp: [ '6.0', '6.3', '6.4', '6.5' ]
multisite: [ false, true ]
exclude:
@@ -172,67 +172,12 @@ jobs:
new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }}
multisite: ${{ matrix.multisite }}
- # Tests 4.x releases where the WordPress database version changed on the oldest and newest supported versions of PHP 7.
- #
- # The oldest version of WordPress receiving security updates should always be tested.
- upgrade-tests-wp-4x-php-7x-mysql:
- name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }}
- uses: ./.github/workflows/reusable-upgrade-testing.yml
- if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }}
- strategy:
- fail-fast: false
- matrix:
- os: [ 'ubuntu-24.04' ]
- php: [ '7.2', '7.4' ]
- db-type: [ 'mysql' ]
- db-version: [ '5.7', '8.4' ]
- wp: [ '4.1', '4.2', '4.3', '4.4', '4.5', '4.6', '4.7' ]
- multisite: [ false, true ]
-
- exclude:
- # The PHP <= 7.3/MySQL 8.4 jobs currently fail due to mysql_native_password being disabled by default. See https://core.trac.wordpress.org/ticket/61218.
- - php: '7.2'
- db-version: '8.4'
- with:
- os: ${{ matrix.os }}
- php: ${{ matrix.php }}
- db-type: ${{ matrix.db-type }}
- db-version: ${{ matrix.db-version }}
- wp: ${{ matrix.wp }}
- new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }}
- multisite: ${{ matrix.multisite }}
-
- # Tests 4.x releases where the WordPress database version changed on the oldest and newest supported versions of PHP 8.
- #
- # The oldest version of WordPress receiving security updates should always be tested.
+ # The oldest version of WordPress receiving security updates should always be tested against
+ # the widest possible list of PHP/MySQL combinations.
#
- # WordPress 4.6-4.9 are excluded from PHP 8+ testing because of the following fatal errors:
+ # WordPress 4.7 is excluded from PHP 8+ testing because of the following fatal errors:
# - Use of __autoload().
# - array/string offset with curly braces.
- upgrade-tests-wp-4x-php-8x-mysql:
- name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }}
- uses: ./.github/workflows/reusable-upgrade-testing.yml
- if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }}
- strategy:
- fail-fast: false
- matrix:
- os: [ 'ubuntu-24.04' ]
- php: [ '8.0', '8.4' ]
- db-type: [ 'mysql' ]
- db-version: [ '5.7', '8.4' ]
- wp: [ '4.1', '4.2', '4.3', '4.4', '4.5' ]
- multisite: [ false, true ]
- with:
- os: ${{ matrix.os }}
- php: ${{ matrix.php }}
- db-type: ${{ matrix.db-type }}
- db-version: ${{ matrix.db-version }}
- wp: ${{ matrix.wp }}
- new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }}
- multisite: ${{ matrix.multisite }}
-
- # The oldest version of WordPress receiving security updates should always be tested against
- # the full list of PHP/MySQL combinations.
upgrade-tests-oldest-wp-mysql:
name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }}
uses: ./.github/workflows/reusable-upgrade-testing.yml
@@ -241,10 +186,10 @@ jobs:
fail-fast: false
matrix:
os: [ 'ubuntu-24.04' ]
- php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
+ php: [ '7.2', '7.3', '7.4' ]
db-type: [ 'mysql' ]
- db-version: [ '5.7', '8.0', '8.4', '9.1' ]
- wp: [ '4.1' ]
+ db-version: [ '5.7', '8.0', '8.4', '9.3' ]
+ wp: [ '4.7' ]
multisite: [ false, true ]
exclude:
@@ -255,9 +200,9 @@ jobs:
db-version: '8.4'
# MySQL 9.0+ will not work on PHP 7.2 & 7.3. See https://core.trac.wordpress.org/ticket/61218.
- php: '7.2'
- db-version: '9.1'
+ db-version: '9.3'
- php: '7.3'
- db-version: '9.1'
+ db-version: '9.3'
with:
os: ${{ matrix.os }}
php: ${{ matrix.php }}
@@ -273,7 +218,7 @@ jobs:
permissions:
actions: read
contents: read
- needs: [ upgrade-tests-last-two-releases, upgrade-tests-wp-6x-mysql, upgrade-tests-wp-5x-php-7x-mysql, upgrade-tests-wp-5x-php-8x-mysql, upgrade-tests-wp-4x-php-7x-mysql, upgrade-tests-wp-4x-php-8x-mysql, upgrade-tests-oldest-wp-mysql ]
+ needs: [ upgrade-tests-recent-releases, upgrade-tests-wp-6x-mysql, upgrade-tests-wp-5x-php-7x-mysql, upgrade-tests-wp-5x-php-8x-mysql, upgrade-tests-oldest-wp-mysql ]
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
with:
calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
diff --git a/.version-support-mysql.json b/.version-support-mysql.json
index bc3d17dce6..09731cfef2 100644
--- a/.version-support-mysql.json
+++ b/.version-support-mysql.json
@@ -1,5 +1,7 @@
{
"6-9": [
+ "9.3",
+ "9.2",
"9.1",
"9.0",
"8.4",
@@ -180,47 +182,5 @@
"5.5",
"5.1",
"5.0"
- ],
- "4-6": [
- "5.7",
- "5.6",
- "5.5",
- "5.1",
- "5.0"
- ],
- "4-5": [
- "5.7",
- "5.6",
- "5.5",
- "5.1",
- "5.0"
- ],
- "4-4": [
- "5.7",
- "5.6",
- "5.5",
- "5.1",
- "5.0"
- ],
- "4-3": [
- "5.7",
- "5.6",
- "5.5",
- "5.1",
- "5.0"
- ],
- "4-2": [
- "5.7",
- "5.6",
- "5.5",
- "5.1",
- "5.0"
- ],
- "4-1": [
- "5.7",
- "5.6",
- "5.5",
- "5.1",
- "5.0"
]
}
diff --git a/.version-support-php.json b/.version-support-php.json
index 8d74dfd8de..b2298e7177 100644
--- a/.version-support-php.json
+++ b/.version-support-php.json
@@ -219,50 +219,5 @@
"5.6",
"7.0",
"7.1"
- ],
- "4-6": [
- "5.2",
- "5.3",
- "5.4",
- "5.5",
- "5.6",
- "7.0"
- ],
- "4-5": [
- "5.2",
- "5.3",
- "5.4",
- "5.5",
- "5.6",
- "7.0"
- ],
- "4-4": [
- "5.2",
- "5.3",
- "5.4",
- "5.5",
- "5.6",
- "7.0"
- ],
- "4-3": [
- "5.2",
- "5.3",
- "5.4",
- "5.5",
- "5.6"
- ],
- "4-2": [
- "5.2",
- "5.3",
- "5.4",
- "5.5",
- "5.6"
- ],
- "4-1": [
- "5.2",
- "5.3",
- "5.4",
- "5.5",
- "5.6"
]
}
diff --git a/Gruntfile.js b/Gruntfile.js
index 83a31a9cd3..a577b0711d 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -838,7 +838,6 @@ module.exports = function(grunt) {
'!**/*.min.js',
'!wp-admin/js/custom-header.js', // Why? We should minify this.
'!wp-admin/js/farbtastic.js',
- '!wp-includes/js/swfobject.js',
]
},
'jquery-ui': {
diff --git a/SECURITY.md b/SECURITY.md
index 3bf3bfe3ed..da1c8b444c 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -32,13 +32,7 @@ Full details of the WordPress Security Policy and the list of covered projects a
| 4.9.x | Yes |
| 4.8.x | Yes |
| 4.7.x | Yes |
-| 4.6.x | Yes |
-| 4.5.x | Yes |
-| 4.4.x | Yes |
-| 4.3.x | Yes |
-| 4.2.x | Yes |
-| 4.1.x | Yes |
-| < 4.1.0 | No |
+| < 4.7.0 | No |
## Reporting a Vulnerability
diff --git a/composer.json b/composer.json
index dbe4e2ba7a..c07f9361d8 100644
--- a/composer.json
+++ b/composer.json
@@ -19,7 +19,7 @@
"ext-dom": "*"
},
"require-dev": {
- "composer/ca-bundle": "1.5.6",
+ "composer/ca-bundle": "1.5.7",
"squizlabs/php_codesniffer": "3.10.3",
"wp-coding-standards/wpcs": "~3.1.0",
"phpcompatibility/phpcompatibility-wp": "~2.1.3",
diff --git a/docker-compose.yml b/docker-compose.yml
index 48f3abc607..863cbd2ea9 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -106,10 +106,14 @@ services:
PHP_FPM_UID: ${PHP_FPM_UID-1000}
PHP_FPM_GID: ${PHP_FPM_GID-1000}
HOST_PATH: ${PWD-}/${LOCAL_DIR-src}
+ WP_CONFIG_PATH: /var/www/wp-config.php
volumes:
- ./:/var/www
+ # Keeps the service alive.
+ command: 'sleep infinity'
+
# The init directive ensures the command runs with a PID > 1, so Ctrl+C works correctly.
init: true
diff --git a/package.json b/package.json
index aeef7640f4..77c2b2d68c 100644
--- a/package.json
+++ b/package.json
@@ -184,7 +184,7 @@
"env:clean": "node ./tools/local-env/scripts/docker.js down -v --remove-orphans",
"env:reset": "node ./tools/local-env/scripts/docker.js down --rmi all -v --remove-orphans",
"env:install": "node ./tools/local-env/scripts/install.js",
- "env:cli": "node ./tools/local-env/scripts/docker.js run --rm cli",
+ "env:cli": "node ./tools/local-env/scripts/docker.js exec cli wp --allow-root",
"env:logs": "node ./tools/local-env/scripts/docker.js logs",
"env:pull": "node ./tools/local-env/scripts/docker.js pull",
"test:performance": "wp-scripts test-playwright --config tests/performance/playwright.config.js",
diff --git a/src/js/_enqueues/admin/user-profile.js b/src/js/_enqueues/admin/user-profile.js
index 2aebe62a91..ce680ef4c4 100644
--- a/src/js/_enqueues/admin/user-profile.js
+++ b/src/js/_enqueues/admin/user-profile.js
@@ -56,8 +56,8 @@
// Once zxcvbn loads, passwords strength is known.
$( '#pw-weak-text-label' ).text( __( 'Confirm use of weak password' ) );
- // Focus the password field.
- if ( 'mailserver_pass' !== $pass1.prop('id' ) ) {
+ // Focus the password field if not the install screen.
+ if ( 'mailserver_pass' !== $pass1.prop('id' ) && ! $('#weblog_title').length ) {
$( $pass1 ).trigger( 'focus' );
}
}
@@ -101,6 +101,8 @@
return;
}
$toggleButton = $pass1Row.find('.wp-hide-pw');
+
+ // Toggle between showing and hiding the password.
$toggleButton.show().on( 'click', function () {
if ( 'password' === $pass1.attr( 'type' ) ) {
$pass1.attr( 'type', 'text' );
@@ -110,6 +112,14 @@
resetToggle( true );
}
});
+
+ // Ensure the password input type is set to password when the form is submitted.
+ $pass1Row.closest( 'form' ).on( 'submit', function() {
+ if ( $pass1.attr( 'type' ) === 'text' ) {
+ $pass1.attr( 'type', 'password' );
+ resetToggle( true );
+ }
+ } );
}
/**
diff --git a/src/js/_enqueues/vendor/README.md b/src/js/_enqueues/vendor/README.md
index 4764f0b808..fef43e3ec2 100644
--- a/src/js/_enqueues/vendor/README.md
+++ b/src/js/_enqueues/vendor/README.md
@@ -10,7 +10,6 @@ In this directory you'll find vendor JavaScript packages that cannot be installe
- jcrop: https://github.com/tapmodo/Jcrop
- mediaelement: https://github.com/mediaelement/mediaelement
- plupload: https://github.com/moxiecode/plupload
-- swfupload: https://github.com/WordPress/secure-swfupload
- thickbox: https://codylindley.com/thickbox/
- tinymce: https://www.tiny.cloud/get-tiny/self-hosted/
- Download "TinyMCE Dev Package". This package is needed because it includes
@@ -70,6 +69,5 @@ In this directory you'll find vendor JavaScript packages that cannot be installe
- jquery/jquery.serializeobject: https://github.com/cowboy/jquery-misc/blob/master/jquery.ba-serializeobject.js
- jquery/jquery.table-hotkeys: WP version can be downloaded at https://code.google.com/archive/p/js-hotkeys/downloads?page=2. A newer version is available at https://github.com/jeresig/jquery.hotkeys.
- jquery/jquery.ui.touch-punch.js https://github.com/furf/jquery-ui-touch-punch/blob/master/jquery.ui.touch-punch.js
-- swfobject: https://github.com/swfobject/swfobject
- tw-sack: https://github.com/abritinthebay/simpleajaxcodekit
- zxcvbn: https://github.com/dropbox/zxcvbn cannot automatically be installed as the frequency lists need to be manually ROT13 transformed.
diff --git a/src/js/_enqueues/vendor/swfobject.js b/src/js/_enqueues/vendor/swfobject.js
index 87e61553b3..e69de29bb2 100644
--- a/src/js/_enqueues/vendor/swfobject.js
+++ b/src/js/_enqueues/vendor/swfobject.js
@@ -1,4 +0,0 @@
-/* SWFObject v2.2 <http://code.google.com/p/swfobject/>
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
-*/
-var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+encodeURI(O.location).toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}(); \ No newline at end of file
diff --git a/src/js/_enqueues/vendor/swfupload/handlers.js b/src/js/_enqueues/vendor/swfupload/handlers.js
index 2de11ab6d9..e69de29bb2 100644
--- a/src/js/_enqueues/vendor/swfupload/handlers.js
+++ b/src/js/_enqueues/vendor/swfupload/handlers.js
@@ -1,54 +0,0 @@
-var topWin = window.dialogArguments || opener || parent || top;
-
-function fileDialogStart() {}
-function fileQueued() {}
-function uploadStart() {}
-function uploadProgress() {}
-function prepareMediaItem() {}
-function prepareMediaItemInit() {}
-function itemAjaxError() {}
-function deleteSuccess() {}
-function deleteError() {}
-function updateMediaForm() {}
-function uploadSuccess() {}
-function uploadComplete() {}
-function wpQueueError() {}
-function wpFileError() {}
-function fileQueueError() {}
-function fileDialogComplete() {}
-function uploadError() {}
-function cancelUpload() {}
-
-function switchUploader() {
- jQuery( '#' + swfu.customSettings.swfupload_element_id ).hide();
- jQuery( '#' + swfu.customSettings.degraded_element_id ).show();
- jQuery( '.upload-html-bypass' ).hide();
-}
-
-function swfuploadPreLoad() {
- switchUploader();
-}
-
-function swfuploadLoadFailed() {
- switchUploader();
-}
-
-jQuery(document).ready(function($){
- $( 'input[type="radio"]', '#media-items' ).on( 'click', function(){
- var tr = $(this).closest('tr');
-
- if ( $(tr).hasClass('align') )
- setUserSetting('align', $(this).val());
- else if ( $(tr).hasClass('image-size') )
- setUserSetting('imgsize', $(this).val());
- });
-
- $( 'button.button', '#media-items' ).on( 'click', function(){
- var c = this.className || '';
- c = c.match(/url([^ '"]+)/);
- if ( c && c[1] ) {
- setUserSetting('urlbutton', c[1]);
- $(this).siblings('.urlfield').val( $(this).attr('title') );
- }
- });
-});
diff --git a/src/js/_enqueues/vendor/swfupload/handlers.min.js b/src/js/_enqueues/vendor/swfupload/handlers.min.js
index 09bbaf9c3d..e69de29bb2 100644
--- a/src/js/_enqueues/vendor/swfupload/handlers.min.js
+++ b/src/js/_enqueues/vendor/swfupload/handlers.min.js
@@ -1 +0,0 @@
-function fileDialogStart(){}function fileQueued(){}function uploadStart(){}function uploadProgress(){}function prepareMediaItem(){}function prepareMediaItemInit(){}function itemAjaxError(){}function deleteSuccess(){}function deleteError(){}function updateMediaForm(){}function uploadSuccess(){}function uploadComplete(){}function wpQueueError(){}function wpFileError(){}function fileQueueError(){}function fileDialogComplete(){}function uploadError(){}function cancelUpload(){}function switchUploader(){jQuery("#"+swfu.customSettings.swfupload_element_id).hide(),jQuery("#"+swfu.customSettings.degraded_element_id).show(),jQuery(".upload-html-bypass").hide()}function swfuploadPreLoad(){switchUploader()}function swfuploadLoadFailed(){switchUploader()}var topWin=window.dialogArguments||opener||parent||top;jQuery(document).ready(function(a){a('input[type="radio"]',"#media-items").on("click",function(){var b=a(this).closest("tr");a(b).hasClass("align")?setUserSetting("align",a(this).val()):a(b).hasClass("image-size")&&setUserSetting("imgsize",a(this).val())}),a("button.button","#media-items").on("click",function(){var b=this.className||"";b=b.match(/url([^ '"]+)/),b&&b[1]&&(setUserSetting("urlbutton",b[1]),a(this).siblings(".urlfield").val(a(this).attr("title")))})}); \ No newline at end of file
diff --git a/src/js/_enqueues/vendor/swfupload/license.txt b/src/js/_enqueues/vendor/swfupload/license.txt
index 8252ca9e24..e69de29bb2 100644
--- a/src/js/_enqueues/vendor/swfupload/license.txt
+++ b/src/js/_enqueues/vendor/swfupload/license.txt
@@ -1,32 +0,0 @@
-/**
- * SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com
- *
- * mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/, http://www.vinterwebb.se/
- *
- * SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilzén and Mammon Media and is released under the MIT License:
- * http://www.opensource.org/licenses/mit-license.php
- *
- * SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License:
- * http://www.opensource.org/licenses/mit-license.php
- *
- */
-
-The MIT License
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. \ No newline at end of file
diff --git a/src/js/_enqueues/vendor/swfupload/swfupload.js b/src/js/_enqueues/vendor/swfupload/swfupload.js
index 14d58dcaf5..e69de29bb2 100644
--- a/src/js/_enqueues/vendor/swfupload/swfupload.js
+++ b/src/js/_enqueues/vendor/swfupload/swfupload.js
@@ -1,140 +0,0 @@
-/**
- * SWFUpload fallback
- *
- * @since 4.9.0
- */
-
-var SWFUpload;
-
-( function () {
- function noop() {}
-
- if (SWFUpload == undefined) {
- SWFUpload = function (settings) {
- this.initSWFUpload(settings);
- };
- }
-
- SWFUpload.prototype.initSWFUpload = function ( settings ) {
- function fallback() {
- var $ = window.jQuery;
- var $placeholder = settings.button_placeholder_id ? $( '#' + settings.button_placeholder_id ) : $( settings.button_placeholder );
-
- if ( ! $placeholder.length ) {
- return;
- }
-
- var $form = $placeholder.closest( 'form' );
-
- if ( ! $form.length ) {
- $form = $( '<form enctype="multipart/form-data" method="post">' );
- $form.attr( 'action', settings.upload_url );
- $form.insertAfter( $placeholder ).append( $placeholder );
- }
-
- $placeholder.replaceWith(
- $( '<div>' )
- .append(
- $( '<input type="file" multiple />' ).attr({
- name: settings.file_post_name || 'async-upload',
- accepts: settings.file_types || '*.*'
- })
- ).append(
- $( '<input type="submit" name="html-upload" class="button" value="Upload" />' )
- )
- );
- }
-
- try {
- // Try the built-in fallback.
- if ( typeof settings.swfupload_load_failed_handler === 'function' && settings.custom_settings ) {
-
- window.swfu = {
- customSettings: settings.custom_settings
- };
-
- settings.swfupload_load_failed_handler();
- } else {
- fallback();
- }
- } catch ( ex ) {
- fallback();
- }
- };
-
- SWFUpload.instances = {};
- SWFUpload.movieCount = 0;
- SWFUpload.version = "0";
- SWFUpload.QUEUE_ERROR = {};
- SWFUpload.UPLOAD_ERROR = {};
- SWFUpload.FILE_STATUS = {};
- SWFUpload.BUTTON_ACTION = {};
- SWFUpload.CURSOR = {};
- SWFUpload.WINDOW_MODE = {};
-
- SWFUpload.completeURL = noop;
- SWFUpload.prototype.initSettings = noop;
- SWFUpload.prototype.loadFlash = noop;
- SWFUpload.prototype.getFlashHTML = noop;
- SWFUpload.prototype.getFlashVars = noop;
- SWFUpload.prototype.getMovieElement = noop;
- SWFUpload.prototype.buildParamString = noop;
- SWFUpload.prototype.destroy = noop;
- SWFUpload.prototype.displayDebugInfo = noop;
- SWFUpload.prototype.addSetting = noop;
- SWFUpload.prototype.getSetting = noop;
- SWFUpload.prototype.callFlash = noop;
- SWFUpload.prototype.selectFile = noop;
- SWFUpload.prototype.selectFiles = noop;
- SWFUpload.prototype.startUpload = noop;
- SWFUpload.prototype.cancelUpload = noop;
- SWFUpload.prototype.stopUpload = noop;
- SWFUpload.prototype.getStats = noop;
- SWFUpload.prototype.setStats = noop;
- SWFUpload.prototype.getFile = noop;
- SWFUpload.prototype.addFileParam = noop;
- SWFUpload.prototype.removeFileParam = noop;
- SWFUpload.prototype.setUploadURL = noop;
- SWFUpload.prototype.setPostParams = noop;
- SWFUpload.prototype.addPostParam = noop;
- SWFUpload.prototype.removePostParam = noop;
- SWFUpload.prototype.setFileTypes = noop;
- SWFUpload.prototype.setFileSizeLimit = noop;
- SWFUpload.prototype.setFileUploadLimit = noop;
- SWFUpload.prototype.setFileQueueLimit = noop;
- SWFUpload.prototype.setFilePostName = noop;
- SWFUpload.prototype.setUseQueryString = noop;
- SWFUpload.prototype.setRequeueOnError = noop;
- SWFUpload.prototype.setHTTPSuccess = noop;
- SWFUpload.prototype.setAssumeSuccessTimeout = noop;
- SWFUpload.prototype.setDebugEnabled = noop;
- SWFUpload.prototype.setButtonImageURL = noop;
- SWFUpload.prototype.setButtonDimensions = noop;
- SWFUpload.prototype.setButtonText = noop;
- SWFUpload.prototype.setButtonTextPadding = noop;
- SWFUpload.prototype.setButtonTextStyle = noop;
- SWFUpload.prototype.setButtonDisabled = noop;
- SWFUpload.prototype.setButtonAction = noop;
- SWFUpload.prototype.setButtonCursor = noop;
- SWFUpload.prototype.queueEvent = noop;
- SWFUpload.prototype.executeNextEvent = noop;
- SWFUpload.prototype.unescapeFilePostParams = noop;
- SWFUpload.prototype.testExternalInterface = noop;
- SWFUpload.prototype.flashReady = noop;
- SWFUpload.prototype.cleanUp = noop;
- SWFUpload.prototype.fileDialogStart = noop;
- SWFUpload.prototype.fileQueued = noop;
- SWFUpload.prototype.fileQueueError = noop;
- SWFUpload.prototype.fileDialogComplete = noop;
- SWFUpload.prototype.uploadStart = noop;
- SWFUpload.prototype.returnUploadStart = noop;
- SWFUpload.prototype.uploadProgress = noop;
- SWFUpload.prototype.uploadError = noop;
- SWFUpload.prototype.uploadSuccess = noop;
- SWFUpload.prototype.uploadComplete = noop;
- SWFUpload.prototype.debug = noop;
- SWFUpload.prototype.debugMessage = noop;
- SWFUpload.Console = {
- writeLine: noop
- };
-}() );
diff --git a/src/js/media/views/uploader/status.js b/src/js/media/views/uploader/status.js
index 86c538b833..f629e0a343 100644
--- a/src/js/media/views/uploader/status.js
+++ b/src/js/media/views/uploader/status.js
@@ -124,8 +124,11 @@ UploaderStatus = View.extend(/** @lends wp.media.view.UploaderStatus.prototype *
this.views.add( '.upload-errors', statusError, { at: 0 } );
_.delay( function() {
buttonClose.trigger( 'focus' );
- wp.a11y.speak( error.get( 'message' ), 'assertive' );
}, 1000 );
+
+ _.delay( function() {
+ wp.a11y.speak( error.get( 'message' ) );
+ }, 1500 );
},
dismiss: function() {
@@ -135,6 +138,7 @@ UploaderStatus = View.extend(/** @lends wp.media.view.UploaderStatus.prototype *
_.invoke( errors, 'remove' );
}
wp.Uploader.errors.reset();
+ wp.a11y.speak( wp.i18n.__( 'Error dismissed.' ) );
// Move focus to the modal after the dismiss button gets removed from the DOM.
if ( this.controller.modal ) {
this.controller.modal.focusManager.focus();
diff --git a/src/readme.html b/src/readme.html
index b40b60ff4b..b70648eaec 100644
--- a/src/readme.html
+++ b/src/readme.html
@@ -59,7 +59,7 @@
<h3>Recommendations</h3>
<ul>
<li><a href="https://www.php.net/">PHP</a> version <strong>7.4</strong> or greater.</li>
- <li><a href="https://www.mysql.com/">MySQL</a> version <strong>8.0</strong> or greater OR <a href="https://mariadb.org/">MariaDB</a> version <strong>10.5</strong> or greater.</li>
+ <li><a href="https://www.mysql.com/">MySQL</a> version <strong>8.0</strong> or greater OR <a href="https://mariadb.org/">MariaDB</a> version <strong>10.6</strong> or greater.</li>
<li>The <a href="https://httpd.apache.org/docs/2.2/mod/mod_rewrite.html">mod_rewrite</a> Apache module.</li>
<li><a href="https://wordpress.org/news/2016/12/moving-toward-ssl/">HTTPS</a> support.</li>
<li>A link to <a href="https://wordpress.org/">wordpress.org</a> on your site.</li>
diff --git a/src/wp-admin/async-upload.php b/src/wp-admin/async-upload.php
index 2ac2f20e76..135568507c 100644
--- a/src/wp-admin/async-upload.php
+++ b/src/wp-admin/async-upload.php
@@ -112,12 +112,14 @@ if ( isset( $_REQUEST['post_id'] ) ) {
$id = media_handle_upload( 'async-upload', $post_id );
if ( is_wp_error( $id ) ) {
- $button_unique_id = uniqid( 'dismiss-' );
- $message = sprintf(
+ $button_unique_id = uniqid( 'dismiss-' );
+ $error_description_id = uniqid( 'error-description-' );
+ $message = sprintf(
'%s <strong>%s</strong><br />%s',
sprintf(
- '<button type="button" id="%s" class="dismiss button-link">%s</button>',
+ '<button type="button" id="%1$s" class="dismiss button-link" aria-describedby="%2$s">%3$s</button>',
esc_attr( $button_unique_id ),
+ esc_attr( $error_description_id ),
__( 'Dismiss' )
),
sprintf(
@@ -127,14 +129,23 @@ if ( is_wp_error( $id ) ) {
),
esc_html( $id->get_error_message() )
);
+
wp_admin_notice(
$message,
array(
+ 'id' => $error_description_id,
'additional_classes' => array( 'error-div', 'error' ),
'paragraph_wrap' => false,
)
);
- echo "<script>jQuery( 'button#{$button_unique_id}' ).on( 'click', function() {jQuery(this).parents('div.media-item').slideUp(200, function(){jQuery(this).remove();})});</script>\n";
+
+ $speak_message = sprintf(
+ /* translators: %s: Name of the file that failed to upload. */
+ __( '%s has failed to upload.' ),
+ esc_js( $_FILES['async-upload']['name'] )
+ );
+
+ echo "<script>_.delay(function() {wp.a11y.speak('" . esc_js( $speak_message ) . "');}, 1500);jQuery( 'button#{$button_unique_id}' ).on( 'click', function() {jQuery(this).parents('div.media-item').slideUp(200, function(){jQuery(this).remove();wp.a11y.speak( wp.i18n.__( 'Error dismissed.' ) );jQuery( '#plupload-browse-button' ).trigger( 'focus' );})});</script>\n";
exit;
}
diff --git a/src/wp-admin/css/common.css b/src/wp-admin/css/common.css
index c008d784ce..f8764e2b2d 100644
--- a/src/wp-admin/css/common.css
+++ b/src/wp-admin/css/common.css
@@ -3912,6 +3912,10 @@ img {
top: 7px;
}
+ .screen-reader-shortcut[href="#wp-toolbar"] {
+ display: none;
+ }
+
body {
min-width: 240px;
overflow-x: hidden;
diff --git a/src/wp-admin/css/list-tables.css b/src/wp-admin/css/list-tables.css
index da4bb599be..bc38d64b38 100644
--- a/src/wp-admin/css/list-tables.css
+++ b/src/wp-admin/css/list-tables.css
@@ -2064,7 +2064,6 @@ div.action-links,
}
.row-actions {
- margin-left: -8px;
margin-right: -8px;
padding-top: 4px;
}
@@ -2077,10 +2076,15 @@ div.action-links,
color: transparent;
}
+ .row-actions span {
+ font-size: 0;
+ }
+
.row-actions span a,
.row-actions span .button-link {
display: inline-block;
- padding: 4px 8px;
+ padding: 4px 16px 4px 0;
+ font-size: 13px;
line-height: 1.5;
}
diff --git a/src/wp-admin/css/revisions.css b/src/wp-admin/css/revisions.css
index 9d3a0b3a91..e16143cf48 100644
--- a/src/wp-admin/css/revisions.css
+++ b/src/wp-admin/css/revisions.css
@@ -572,6 +572,28 @@ div.revisions-controls > .wp-slider > .ui-slider-handle {
}
}
+@media screen and (max-width: 600px) {
+ .revisions-meta .author-card:not(.comparing-two-revisions .author-card) {
+ display: flex;
+ flex-direction: column;
+ width: fit-content;
+ gap: 16px;
+ }
+
+ .comparing-two-revisions .revisions-meta .restore-revision {
+ margin-top: 16px;
+ }
+
+ .revisions-controls {
+ padding-top: 0;
+ }
+
+ .revision-toggle-compare-mode {
+ position: relative;
+ padding: 1rem 0;
+ }
+}
+
@media screen and (max-width: 782px) {
#diff-next-revision,
#diff-previous-revision {
@@ -585,14 +607,18 @@ div.revisions-controls > .wp-slider > .ui-slider-handle {
.revisions-controls,
.comparing-two-revisions .revisions-controls {
- height: 170px;
+ height: fit-content;
}
.revisions-tooltip {
- bottom: 130px;
+ bottom: 155px;
z-index: 2;
}
+ .comparing-two-revisions .revisions-tooltip {
+ bottom: 200px;
+ }
+
.diff-meta {
overflow: hidden;
}
diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php
index 83b682634b..53635479e0 100644
--- a/src/wp-admin/includes/ajax-actions.php
+++ b/src/wp-admin/includes/ajax-actions.php
@@ -5354,7 +5354,7 @@ function wp_ajax_health_check_dotorg_communication() {
_doing_it_wrong(
'wp_ajax_health_check_dotorg_communication',
sprintf(
- // translators: 1: The Site Health action that is no longer used by core. 2: The new function that replaces it.
+ /* translators: 1: The Site Health action that is no longer used by core. 2: The new function that replaces it. */
__( 'The Site Health check for %1$s has been replaced with %2$s.' ),
'wp_ajax_health_check_dotorg_communication',
'WP_REST_Site_Health_Controller::test_dotorg_communication'
@@ -5387,7 +5387,7 @@ function wp_ajax_health_check_background_updates() {
_doing_it_wrong(
'wp_ajax_health_check_background_updates',
sprintf(
- // translators: 1: The Site Health action that is no longer used by core. 2: The new function that replaces it.
+ /* translators: 1: The Site Health action that is no longer used by core. 2: The new function that replaces it. */
__( 'The Site Health check for %1$s has been replaced with %2$s.' ),
'wp_ajax_health_check_background_updates',
'WP_REST_Site_Health_Controller::test_background_updates'
@@ -5420,7 +5420,7 @@ function wp_ajax_health_check_loopback_requests() {
_doing_it_wrong(
'wp_ajax_health_check_loopback_requests',
sprintf(
- // translators: 1: The Site Health action that is no longer used by core. 2: The new function that replaces it.
+ /* translators: 1: The Site Health action that is no longer used by core. 2: The new function that replaces it. */
__( 'The Site Health check for %1$s has been replaced with %2$s.' ),
'wp_ajax_health_check_loopback_requests',
'WP_REST_Site_Health_Controller::test_loopback_requests'
@@ -5470,7 +5470,7 @@ function wp_ajax_health_check_get_sizes() {
_doing_it_wrong(
'wp_ajax_health_check_get_sizes',
sprintf(
- // translators: 1: The Site Health action that is no longer used by core. 2: The new function that replaces it.
+ /* translators: 1: The Site Health action that is no longer used by core. 2: The new function that replaces it. */
__( 'The Site Health check for %1$s has been replaced with %2$s.' ),
'wp_ajax_health_check_get_sizes',
'WP_REST_Site_Health_Controller::get_directory_sizes'
diff --git a/src/wp-admin/includes/class-custom-image-header.php b/src/wp-admin/includes/class-custom-image-header.php
index 54be1d90e4..3716b55909 100644
--- a/src/wp-admin/includes/class-custom-image-header.php
+++ b/src/wp-admin/includes/class-custom-image-header.php
@@ -951,7 +951,7 @@ endif;
<p class="submit">
<?php submit_button( __( 'Crop and Publish' ), 'primary', 'submit', false ); ?>
<?php
- if ( isset( $oitar ) && 1 === $oitar
+ if ( 1 === $oitar
&& ( current_theme_supports( 'custom-header', 'flex-height' )
|| current_theme_supports( 'custom-header', 'flex-width' ) )
) {
diff --git a/src/wp-admin/includes/class-language-pack-upgrader.php b/src/wp-admin/includes/class-language-pack-upgrader.php
index 6f7cf742bd..89b9f9ac87 100644
--- a/src/wp-admin/includes/class-language-pack-upgrader.php
+++ b/src/wp-admin/includes/class-language-pack-upgrader.php
@@ -383,7 +383,7 @@ class Language_Pack_Upgrader extends WP_Upgrader {
case 'theme':
$theme = wp_get_theme( $update->slug );
if ( $theme->exists() ) {
- return $theme->Get( 'Name' );
+ return $theme->get( 'Name' );
}
break;
case 'plugin':
diff --git a/src/wp-admin/includes/class-wp-automatic-updater.php b/src/wp-admin/includes/class-wp-automatic-updater.php
index 4dccd94ccd..2facbeb1d5 100644
--- a/src/wp-admin/includes/class-wp-automatic-updater.php
+++ b/src/wp-admin/includes/class-wp-automatic-updater.php
@@ -411,7 +411,7 @@ class WP_Automatic_Updater {
case 'theme':
$upgrader_item = $item->theme;
$theme = wp_get_theme( $upgrader_item );
- $item_name = $theme->Get( 'Name' );
+ $item_name = $theme->get( 'Name' );
// Add the current version so that it can be reported in the notification email.
$item->current_version = $theme->get( 'Version' );
if ( empty( $item->current_version ) ) {
diff --git a/src/wp-admin/includes/class-wp-community-events.php b/src/wp-admin/includes/class-wp-community-events.php
index 008611af21..b5a65e298d 100644
--- a/src/wp-admin/includes/class-wp-community-events.php
+++ b/src/wp-admin/includes/class-wp-community-events.php
@@ -375,17 +375,13 @@ class WP_Community_Events {
* of the user who triggered the cache refresh, rather than their own.
*
* @since 4.8.0
- * @deprecated 5.6.0 No longer used in core.
+ * @deprecated 5.5.2 No longer used in core.
*
* @param array $response_body The response which contains the events.
* @return array The response with dates and times formatted.
*/
protected function format_event_data_time( $response_body ) {
- _deprecated_function(
- __METHOD__,
- '5.5.2',
- 'This is no longer used by core, and only kept for backward compatibility.'
- );
+ _deprecated_function( __METHOD__, '5.5.2' );
if ( isset( $response_body['events'] ) ) {
foreach ( $response_body['events'] as $key => $event ) {
diff --git a/src/wp-admin/includes/class-wp-debug-data.php b/src/wp-admin/includes/class-wp-debug-data.php
index cbb57a4b8c..cd04297684 100644
--- a/src/wp-admin/includes/class-wp-debug-data.php
+++ b/src/wp-admin/includes/class-wp-debug-data.php
@@ -682,6 +682,25 @@ class WP_Debug_Data {
);
}
+ // Get the image format transforms.
+ $mappings = wp_get_image_editor_output_format( '', '' );
+ $formatted_mappings = array();
+
+ if ( ! empty( $mappings ) ) {
+ foreach ( $mappings as $format => $mime_type ) {
+ $formatted_mappings[] = sprintf( '%s &rarr; %s', $format, $mime_type );
+ }
+ $mappings_display = implode( ', ', $formatted_mappings );
+ } else {
+ $mappings_display = __( 'No format transforms defined' );
+ }
+
+ $fields['image_format_transforms'] = array(
+ 'label' => __( 'Image format transforms' ),
+ 'value' => $mappings_display,
+ 'debug' => ( empty( $mappings ) ) ? 'No format transforms defined' : $mappings_display,
+ );
+
// Get GD information, if available.
if ( function_exists( 'gd_info' ) ) {
$gd = gd_info();
@@ -1860,10 +1879,14 @@ class WP_Debug_Data {
* Intended to supplement the array returned by `WP_Debug_Data::debug_data()`.
*
* @since 5.2.0
+ * @deprecated 5.6.0 Use WP_REST_Site_Health_Controller::get_directory_sizes()
+ * @see WP_REST_Site_Health_Controller::get_directory_sizes()
*
* @return array The sizes of the directories, also the database size and total installation size.
*/
public static function get_sizes() {
+ _deprecated_function( __METHOD__, '5.6.0', 'WP_REST_Site_Health_Controller::get_directory_sizes()' );
+
$size_db = self::get_database_size();
$upload_dir = wp_get_upload_dir();
diff --git a/src/wp-admin/includes/class-wp-filesystem-ftpext.php b/src/wp-admin/includes/class-wp-filesystem-ftpext.php
index 0294720ccd..7c721734c3 100644
--- a/src/wp-admin/includes/class-wp-filesystem-ftpext.php
+++ b/src/wp-admin/includes/class-wp-filesystem-ftpext.php
@@ -601,9 +601,11 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
}
/**
- * @param string $line
- * @return array {
- * Array of file information.
+ * Parses an individual entry from the FTP LIST command output.
+ *
+ * @param string $line A line from the directory listing.
+ * @return array|string {
+ * Array of file information. Empty string if the line could not be parsed.
*
* @type string $name Name of the file or directory.
* @type string $perms *nix representation of permissions.
@@ -658,7 +660,6 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
$lucifer = preg_split( '/[ ]/', $line, 9, PREG_SPLIT_NO_EMPTY );
if ( $lucifer ) {
- // echo $line."\n";
$lcount = count( $lucifer );
if ( $lcount < 8 ) {
diff --git a/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php b/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php
index 9a37d88c11..986fccf2cf 100644
--- a/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php
+++ b/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php
@@ -77,7 +77,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
return false;
}
- $this->ftp->setTimeout( FS_CONNECT_TIMEOUT );
+ $this->ftp->SetTimeout( FS_CONNECT_TIMEOUT );
if ( ! $this->ftp->SetServer( $this->options['hostname'], $this->options['port'] ) ) {
$this->errors->add(
@@ -120,7 +120,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
$this->ftp->SetType( FTP_BINARY );
$this->ftp->Passive( true );
- $this->ftp->setTimeout( FS_TIMEOUT );
+ $this->ftp->SetTimeout( FS_TIMEOUT );
return true;
}
diff --git a/src/wp-admin/includes/class-wp-list-table.php b/src/wp-admin/includes/class-wp-list-table.php
index 5a7fa0db8e..cdf31db597 100644
--- a/src/wp-admin/includes/class-wp-list-table.php
+++ b/src/wp-admin/includes/class-wp-list-table.php
@@ -72,10 +72,10 @@ class WP_List_Table {
protected $modes = array();
/**
- * Stores the value returned by ->get_column_info().
+ * Stores the value returned by ::get_column_info().
*
* @since 4.1.0
- * @var array
+ * @var array|null
*/
protected $_column_headers;
diff --git a/src/wp-admin/includes/class-wp-ms-sites-list-table.php b/src/wp-admin/includes/class-wp-ms-sites-list-table.php
index 01968869a1..6097f5e13e 100644
--- a/src/wp-admin/includes/class-wp-ms-sites-list-table.php
+++ b/src/wp-admin/includes/class-wp-ms-sites-list-table.php
@@ -37,7 +37,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
$this->status_list = array(
'archived' => array( 'site-archived', __( 'Archived' ) ),
'spam' => array( 'site-spammed', _x( 'Spam', 'site' ) ),
- 'deleted' => array( 'site-deleted', __( 'Deleted' ) ),
+ 'deleted' => array( 'site-deleted', __( 'Flagged for Deletion' ) ),
'mature' => array( 'site-mature', __( 'Mature' ) ),
);
@@ -256,8 +256,8 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
/* translators: %s: Number of sites. */
'deleted' => _n_noop(
- 'Deleted <span class="count">(%s)</span>',
- 'Deleted <span class="count">(%s)</span>'
+ 'Flagged for Deletion <span class="count">(%s)</span>',
+ 'Flagged for Deletion <span class="count">(%s)</span>'
),
);
@@ -667,7 +667,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
* @since 5.3.0
*
* @param string[] $site_states An array of site states. Default 'Main',
- * 'Archived', 'Mature', 'Spam', 'Deleted'.
+ * 'Archived', 'Mature', 'Spam', 'Flagged for Deletion'.
* @param WP_Site $site The current site object.
*/
$site_states = apply_filters( 'display_site_states', $site_states, $_site );
@@ -758,7 +758,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
'activateblog_' . $blog['blog_id']
)
),
- _x( 'Activate', 'site' )
+ _x( 'Remove Deletion Flag', 'site' )
);
} else {
$actions['deactivate'] = sprintf(
@@ -769,7 +769,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
'deactivateblog_' . $blog['blog_id']
)
),
- __( 'Deactivate' )
+ __( 'Flag for Deletion' )
);
}
@@ -830,7 +830,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
'deleteblog_' . $blog['blog_id']
)
),
- __( 'Delete' )
+ __( 'Delete Permanently' )
);
}
}
@@ -844,9 +844,9 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
/**
* Filters the action links displayed for each site in the Sites list table.
*
- * The 'Edit', 'Dashboard', 'Delete', and 'Visit' links are displayed by
+ * The 'Edit', 'Dashboard', 'Delete Permanently', and 'Visit' links are displayed by
* default for each site. The site's status determines whether to show the
- * 'Activate' or 'Deactivate' link, 'Unarchive' or 'Archive' links, and
+ * 'Remove Deletion Flag' or 'Flag for Deletion' link, 'Unarchive' or 'Archive' links, and
* 'Not Spam' or 'Spam' link for each site.
*
* @since 3.1.0
diff --git a/src/wp-admin/includes/class-wp-site-health.php b/src/wp-admin/includes/class-wp-site-health.php
index afcbfcb6f9..b7847d5e31 100644
--- a/src/wp-admin/includes/class-wp-site-health.php
+++ b/src/wp-admin/includes/class-wp-site-health.php
@@ -18,7 +18,7 @@ class WP_Site_Health {
private $mysql_server_version = '';
private $mysql_required_version = '5.5';
private $mysql_recommended_version = '8.0';
- private $mariadb_recommended_version = '10.5';
+ private $mariadb_recommended_version = '10.6';
public $php_memory_limit;
diff --git a/src/wp-admin/includes/file.php b/src/wp-admin/includes/file.php
index 40059273ba..0658662126 100644
--- a/src/wp-admin/includes/file.php
+++ b/src/wp-admin/includes/file.php
@@ -2622,7 +2622,7 @@ function request_filesystem_credentials( $form_post, $type = '', $error = false,
<?php
if ( isset( $types['ssh'] ) ) {
$hidden_class = '';
- if ( 'ssh' !== $connection_type || empty( $connection_type ) ) {
+ if ( 'ssh' !== $connection_type ) {
$hidden_class = ' class="hidden"';
}
?>
diff --git a/src/wp-admin/includes/media.php b/src/wp-admin/includes/media.php
index 5c0b5d0b38..7d9fd638fb 100644
--- a/src/wp-admin/includes/media.php
+++ b/src/wp-admin/includes/media.php
@@ -3337,7 +3337,7 @@ function attachment_submitbox_metadata() {
$uploaded_by_link = get_edit_user_link( $author->ID );
}
?>
- <div class="misc-pub-section misc-pub-uploadedby">
+ <div class="misc-pub-section misc-pub-uploadedby word-wrap-break-word">
<?php if ( $uploaded_by_link ) { ?>
<?php _e( 'Uploaded by:' ); ?> <a href="<?php echo $uploaded_by_link; ?>"><strong><?php echo $uploaded_by_name; ?></strong></a>
<?php } else { ?>
diff --git a/src/wp-admin/includes/misc.php b/src/wp-admin/includes/misc.php
index 979d237448..f42c247fb2 100644
--- a/src/wp-admin/includes/misc.php
+++ b/src/wp-admin/includes/misc.php
@@ -263,7 +263,7 @@ function save_mod_rewrite_rules() {
global $wp_rewrite;
if ( is_multisite() ) {
- return;
+ return null;
}
// Ensure get_home_path() is declared.
@@ -303,7 +303,7 @@ function iis7_save_url_rewrite_rules() {
global $wp_rewrite;
if ( is_multisite() ) {
- return;
+ return null;
}
// Ensure get_home_path() is declared.
@@ -988,7 +988,7 @@ function saveDomDocument( $doc, $filename ) { // phpcs:ignore WordPress.NamingCo
}
/**
- * Displays the default admin color scheme picker (Used in user-edit.php).
+ * Displays the default administration color scheme picker (Used in user-edit.php).
*
* @since 3.0.0
*
@@ -1025,7 +1025,7 @@ function admin_color_scheme_picker( $user_id ) {
<legend class="screen-reader-text"><span>
<?php
/* translators: Hidden accessibility text. */
- _e( 'Admin Color Scheme' );
+ _e( 'Administration Color Scheme' );
?>
</span></legend>
<?php
diff --git a/src/wp-admin/includes/post.php b/src/wp-admin/includes/post.php
index 40fac43d6e..ebdd61df34 100644
--- a/src/wp-admin/includes/post.php
+++ b/src/wp-admin/includes/post.php
@@ -2186,7 +2186,7 @@ function wp_autosave( $post_data ) {
*
* @param int $post_id Optional. Post ID.
*/
-function redirect_post( $post_id = '' ) {
+function redirect_post( $post_id = 0 ) {
if ( isset( $_POST['save'] ) || isset( $_POST['publish'] ) ) {
$status = get_post_status( $post_id );
diff --git a/src/wp-admin/includes/revision.php b/src/wp-admin/includes/revision.php
index df7201e958..ec2460c0ca 100644
--- a/src/wp-admin/includes/revision.php
+++ b/src/wp-admin/includes/revision.php
@@ -407,41 +407,43 @@ function wp_print_revision_templates() {
<strong id="diff-title-to"><?php _ex( 'To:', 'Followed by post revision info' ); ?></strong>
<# } #>
<div class="author-card<# if ( data.attributes.autosave ) { #> autosave<# } #>">
- {{{ data.attributes.author.avatar }}}
- <div class="author-info" id="diff-title-author">
- <# if ( data.attributes.autosave ) { #>
- <span class="byline">
- <?php
- printf(
- /* translators: %s: User's display name. */
- __( 'Autosave by %s' ),
- '<span class="author-name">{{ data.attributes.author.name }}</span>'
- );
- ?>
- </span>
- <# } else if ( data.attributes.current ) { #>
- <span class="byline">
- <?php
- printf(
- /* translators: %s: User's display name. */
- __( 'Current Revision by %s' ),
- '<span class="author-name">{{ data.attributes.author.name }}</span>'
- );
- ?>
- </span>
- <# } else { #>
- <span class="byline">
- <?php
- printf(
- /* translators: %s: User's display name. */
- __( 'Revision by %s' ),
- '<span class="author-name">{{ data.attributes.author.name }}</span>'
- );
- ?>
- </span>
- <# } #>
- <span class="time-ago">{{ data.attributes.timeAgo }}</span>
- <span class="date">({{ data.attributes.dateShort }})</span>
+ <div>
+ {{{ data.attributes.author.avatar }}}
+ <div class="author-info" id="diff-title-author">
+ <# if ( data.attributes.autosave ) { #>
+ <span class="byline">
+ <?php
+ printf(
+ /* translators: %s: User's display name. */
+ __( 'Autosave by %s' ),
+ '<span class="author-name">{{ data.attributes.author.name }}</span>'
+ );
+ ?>
+ </span>
+ <# } else if ( data.attributes.current ) { #>
+ <span class="byline">
+ <?php
+ printf(
+ /* translators: %s: User's display name. */
+ __( 'Current Revision by %s' ),
+ '<span class="author-name">{{ data.attributes.author.name }}</span>'
+ );
+ ?>
+ </span>
+ <# } else { #>
+ <span class="byline">
+ <?php
+ printf(
+ /* translators: %s: User's display name. */
+ __( 'Revision by %s' ),
+ '<span class="author-name">{{ data.attributes.author.name }}</span>'
+ );
+ ?>
+ </span>
+ <# } #>
+ <span class="time-ago">{{ data.attributes.timeAgo }}</span>
+ <span class="date">({{ data.attributes.dateShort }})</span>
+ </div>
</div>
<# if ( 'to' === data.type && data.attributes.restoreUrl ) { #>
<input <?php if ( wp_check_post_lock( $post->ID ) ) { ?>
diff --git a/src/wp-admin/includes/taxonomy.php b/src/wp-admin/includes/taxonomy.php
index 7765084fa7..359cfafe2f 100644
--- a/src/wp-admin/includes/taxonomy.php
+++ b/src/wp-admin/includes/taxonomy.php
@@ -75,7 +75,7 @@ function wp_create_category( $cat_name, $category_parent = 0 ) {
* @param int $post_id Optional. The post ID. Default empty.
* @return int[] Array of IDs of categories assigned to the given post.
*/
-function wp_create_categories( $categories, $post_id = '' ) {
+function wp_create_categories( $categories, $post_id = 0 ) {
$cat_ids = array();
foreach ( $categories as $category ) {
$id = category_exists( $category );
diff --git a/src/wp-admin/includes/template.php b/src/wp-admin/includes/template.php
index 127027d8f5..16da3388ae 100644
--- a/src/wp-admin/includes/template.php
+++ b/src/wp-admin/includes/template.php
@@ -817,9 +817,6 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
$tab_index_attribute = " tabindex=\"$tab_index\"";
}
- // @todo Remove this?
- // echo '<label for="timestamp" style="display: block;"><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp"'.$tab_index_attribute.' /> '.__( 'Edit timestamp' ).'</label><br />';
-
$post_date = ( $for_post ) ? $post->post_date : get_comment()->comment_date;
$jj = ( $edit ) ? mysql2date( 'd', $post_date, false ) : current_time( 'd' );
$mm = ( $edit ) ? mysql2date( 'm', $post_date, false ) : current_time( 'm' );
diff --git a/src/wp-admin/includes/update-core.php b/src/wp-admin/includes/update-core.php
index f1731f9c8f..2d925afa63 100644
--- a/src/wp-admin/includes/update-core.php
+++ b/src/wp-admin/includes/update-core.php
@@ -1023,6 +1023,7 @@ $_new_bundled_files = array(
* @global string[] $_old_requests_files
* @global string[] $_new_bundled_files
* @global wpdb $wpdb WordPress database abstraction object.
+ * @global string $wp_version The WordPress version string.
*
* @param string $from New release unzipped path.
* @param string $to Path to old WordPress installation.
diff --git a/src/wp-admin/install.php b/src/wp-admin/install.php
index 736c5138e9..13ebf730bd 100644
--- a/src/wp-admin/install.php
+++ b/src/wp-admin/install.php
@@ -233,9 +233,9 @@ if ( is_blog_installed() ) {
/**
* @global string $wp_version The WordPress version string.
- * @global string $required_php_version The required PHP version string.
+ * @global string $required_php_version The minimum required PHP version string.
* @global string[] $required_php_extensions The names of required PHP extensions.
- * @global string $required_mysql_version The required MySQL version string.
+ * @global string $required_mysql_version The minimum required MySQL version string.
* @global wpdb $wpdb WordPress database abstraction object.
*/
global $wp_version, $required_php_version, $required_php_extensions, $required_mysql_version, $wpdb;
diff --git a/src/wp-admin/menu.php b/src/wp-admin/menu.php
index 82136429ba..e4f92b38ba 100644
--- a/src/wp-admin/menu.php
+++ b/src/wp-admin/menu.php
@@ -378,7 +378,7 @@ $menu[75] = array( __( 'Tools' ), 'edit_posts', 'tools.php',
$submenu['tools.php'][20] = array( sprintf( __( 'Site Health %s' ), $site_health_count ), 'view_site_health_checks', 'site-health.php' );
$submenu['tools.php'][25] = array( __( 'Export Personal Data' ), 'export_others_personal_data', 'export-personal-data.php' );
$submenu['tools.php'][30] = array( __( 'Erase Personal Data' ), 'erase_others_personal_data', 'erase-personal-data.php' );
-if ( is_multisite() && ! is_main_site() ) {
+if ( is_multisite() && ! is_main_site() && '1' !== get_site()->deleted ) {
$submenu['tools.php'][35] = array( __( 'Delete Site' ), 'delete_site', 'ms-delete-site.php' );
}
if ( ! is_multisite() && defined( 'WP_ALLOW_MULTISITE' ) && WP_ALLOW_MULTISITE ) {
diff --git a/src/wp-admin/nav-menus.php b/src/wp-admin/nav-menus.php
index 36905bab63..82c8e264ad 100644
--- a/src/wp-admin/nav-menus.php
+++ b/src/wp-admin/nav-menus.php
@@ -1083,7 +1083,7 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
$menu_name_aria_desc = $add_new_screen ? ' aria-describedby="menu-name-desc"' : '';
if ( $one_theme_location_no_menus ) {
- $menu_name_val = 'value="' . esc_attr( 'Menu 1' ) . '"';
+ $menu_name_val = 'value="' . esc_attr__( 'Menu 1' ) . '"';
?>
<input type="hidden" name="zero-menu-state" value="true" />
<?php
diff --git a/src/wp-admin/network/site-info.php b/src/wp-admin/network/site-info.php
index 46f67cced5..a2a86a34e1 100644
--- a/src/wp-admin/network/site-info.php
+++ b/src/wp-admin/network/site-info.php
@@ -200,7 +200,7 @@ if ( ! empty( $messages ) ) {
if ( ! $is_main_site ) {
$attribute_fields['archived'] = __( 'Archived' );
$attribute_fields['spam'] = _x( 'Spam', 'site' );
- $attribute_fields['deleted'] = __( 'Deleted' );
+ $attribute_fields['deleted'] = __( 'Flagged for Deletion' );
}
$attribute_fields['mature'] = __( 'Mature' );
?>
diff --git a/src/wp-admin/network/site-new.php b/src/wp-admin/network/site-new.php
index a3b0919155..d1b0576113 100644
--- a/src/wp-admin/network/site-new.php
+++ b/src/wp-admin/network/site-new.php
@@ -204,7 +204,7 @@ if ( ! empty( $messages ) ) {
}
?>
<p><?php echo wp_required_field_message(); ?></p>
-<form method="post" action="<?php echo esc_url( network_admin_url( 'site-new.php?action=add-site' ) ); ?>" novalidate="novalidate">
+<form method="post" enctype="multipart/form-data" action="<?php echo esc_url( network_admin_url( 'site-new.php?action=add-site' ) ); ?>" novalidate="novalidate">
<?php wp_nonce_field( 'add-blog', '_wpnonce_add-blog' ); ?>
<table class="form-table" role="presentation">
<tr class="form-field form-required">
diff --git a/src/wp-admin/network/sites.php b/src/wp-admin/network/sites.php
index 69ee15d95c..17a072287d 100644
--- a/src/wp-admin/network/sites.php
+++ b/src/wp-admin/network/sites.php
@@ -33,8 +33,8 @@ get_current_screen()->add_help_tab(
'<p>' . __( 'Hovering over each site reveals seven options (three for the primary site):' ) . '</p>' .
'<ul><li>' . __( 'An Edit link to a separate Edit Site screen.' ) . '</li>' .
'<li>' . __( 'Dashboard leads to the Dashboard for that site.' ) . '</li>' .
- '<li>' . __( 'Deactivate, Archive, and Spam which lead to confirmation screens. These actions can be reversed later.' ) . '</li>' .
- '<li>' . __( 'Delete which is a permanent action after the confirmation screen.' ) . '</li>' .
+ '<li>' . __( 'Flag for Deletion, Archive, and Spam which lead to confirmation screens. These actions can be reversed later.' ) . '</li>' .
+ '<li>' . __( 'Delete Permanently which is a permanent action after the confirmation screen.' ) . '</li>' .
'<li>' . __( 'Visit to go to the front-end of the live site.' ) . '</li></ul>',
)
);
@@ -61,9 +61,9 @@ if ( isset( $_GET['action'] ) ) {
// A list of valid actions and their associated messaging for confirmation output.
$manage_actions = array(
/* translators: %s: Site URL. */
- 'activateblog' => __( 'You are about to activate the site %s.' ),
+ 'activateblog' => __( 'You are about to remove the deletion flag from the site %s.' ),
/* translators: %s: Site URL. */
- 'deactivateblog' => __( 'You are about to deactivate the site %s.' ),
+ 'deactivateblog' => __( 'You are about to flag the site %s for deletion.' ),
/* translators: %s: Site URL. */
'unarchiveblog' => __( 'You are about to unarchive the site %s.' ),
/* translators: %s: Site URL. */
@@ -106,6 +106,7 @@ if ( isset( $_GET['action'] ) ) {
$site_details = get_site( $id );
$site_address = untrailingslashit( $site_details->domain . $site_details->path );
+ $submit = __( 'Confirm' );
require_once ABSPATH . 'wp-admin/admin-header.php';
?>
@@ -124,8 +125,18 @@ if ( isset( $_GET['action'] ) ) {
<p><?php _e( 'Deleting a site is a permanent action that cannot be undone. This will delete the entire site and its uploads directory.' ); ?>
</div>
<?php
- } else {
- $submit = __( 'Confirm' );
+ } elseif ( 'archiveblog' === $site_action ) {
+ ?>
+ <div class="notice notice-warning inline">
+ <p><?php _e( 'Archiving a site makes the site unavailable to its users and visitors. This is a reversible action.' ); ?>
+ </div>
+ <?php
+ } elseif ( 'deactivateblog' === $site_action ) {
+ ?>
+ <div class="notice notice-warning inline">
+ <p><?php _e( 'Flagging a site for deletion makes the site unavailable to its users and visitors. This is a reversible action. A super admin can permanently delete the site at a later date.' ); ?>
+ </div>
+ <?php
}
?>
<p><?php printf( $manage_actions[ $site_action ], "<strong>{$site_address}</strong>" ); ?></p>
@@ -205,6 +216,9 @@ if ( isset( $_GET['action'] ) ) {
<input type="hidden" name="action" value="delete_sites" />
<input type="hidden" name="_wp_http_referer" value="<?php echo esc_attr( wp_get_referer() ); ?>" />
<?php wp_nonce_field( 'ms-delete-sites', '_wpnonce', false ); ?>
+ <div class="notice notice-warning inline">
+ <p><?php _e( 'Deleting a site is a permanent action that cannot be undone. This will delete the entire site and its uploads directory.' ); ?>
+ </div>
<p><?php _e( 'You are about to delete the following sites:' ); ?></p>
<ul class="ul-disc">
<?php
@@ -220,7 +234,7 @@ if ( isset( $_GET['action'] ) ) {
</li>
<?php endforeach; ?>
</ul>
- <?php submit_button( __( 'Confirm' ), 'primary' ); ?>
+ <?php submit_button( __( 'Delete these sites permanently' ), 'primary' ); ?>
</form>
</div>
<?php
@@ -271,22 +285,22 @@ if ( isset( $_GET['action'] ) ) {
update_blog_status( $id, 'deleted', '0' );
/**
- * Fires after a network site is activated.
+ * Fires after a network site has its deletion flag removed.
*
* @since MU (3.0.0)
*
- * @param int $id The ID of the activated site.
+ * @param int $id The ID of the reactivated site.
*/
do_action( 'activate_blog', $id );
break;
case 'deactivateblog':
/**
- * Fires before a network site is deactivated.
+ * Fires before a network site is flagged for deletion.
*
* @since MU (3.0.0)
*
- * @param int $id The ID of the site being deactivated.
+ * @param int $id The ID of the site being flagged for deletion.
*/
do_action( 'deactivate_blog', $id );
@@ -326,10 +340,10 @@ if ( isset( $_GET['updated'] ) ) {
$msg = __( 'Sites marked as spam.' );
break;
case 'all_delete':
- $msg = __( 'Sites deleted.' );
+ $msg = __( 'Sites permanently deleted.' );
break;
case 'delete':
- $msg = __( 'Site deleted.' );
+ $msg = __( 'Site permanently deleted.' );
break;
case 'not_deleted':
$msg = __( 'Sorry, you are not allowed to delete that site.' );
@@ -341,10 +355,10 @@ if ( isset( $_GET['updated'] ) ) {
$msg = __( 'Site unarchived.' );
break;
case 'activateblog':
- $msg = __( 'Site activated.' );
+ $msg = __( 'Site deletion flag removed.' );
break;
case 'deactivateblog':
- $msg = __( 'Site deactivated.' );
+ $msg = __( 'Site flagged for deletion.' );
break;
case 'unspamblog':
$msg = __( 'Site removed from spam.' );
diff --git a/src/wp-admin/options-discussion.php b/src/wp-admin/options-discussion.php
index 6bb8ce2f54..e0e12dc21f 100644
--- a/src/wp-admin/options-discussion.php
+++ b/src/wp-admin/options-discussion.php
@@ -309,6 +309,8 @@ $avatar_defaults = array(
'monsterid' => __( 'MonsterID (Generated)' ),
'retro' => __( 'Retro (Generated)' ),
'robohash' => __( 'RoboHash (Generated)' ),
+ 'initials' => __( 'Initials (Generated)' ),
+ 'color' => __( 'Color (Generated)' ),
);
/**
* Filters the default avatars.
diff --git a/src/wp-admin/post.php b/src/wp-admin/post.php
index 1b8214c9ce..468041c9ea 100644
--- a/src/wp-admin/post.php
+++ b/src/wp-admin/post.php
@@ -160,7 +160,7 @@ switch ( $action ) {
$submenu_file = 'upload.php';
$post_new_file = 'media-new.php';
} else {
- if ( isset( $post_type_object ) && $post_type_object->show_in_menu && true !== $post_type_object->show_in_menu ) {
+ if ( $post_type_object->show_in_menu && true !== $post_type_object->show_in_menu ) {
$parent_file = $post_type_object->show_in_menu;
} else {
$parent_file = "edit.php?post_type=$post_type";
diff --git a/src/wp-admin/upgrade.php b/src/wp-admin/upgrade.php
index ea98082704..f0c9cbbdfd 100644
--- a/src/wp-admin/upgrade.php
+++ b/src/wp-admin/upgrade.php
@@ -37,9 +37,9 @@ if ( 'upgrade_db' === $step ) {
/**
* @global string $wp_version The WordPress version string.
- * @global string $required_php_version The required PHP version string.
+ * @global string $required_php_version The minimum required PHP version string.
* @global string[] $required_php_extensions The names of required PHP extensions.
- * @global string $required_mysql_version The required MySQL version string.
+ * @global string $required_mysql_version The minimum required MySQL version string.
* @global wpdb $wpdb WordPress database abstraction object.
*/
global $wp_version, $required_php_version, $required_php_extensions, $required_mysql_version, $wpdb;
diff --git a/src/wp-admin/user-edit.php b/src/wp-admin/user-edit.php
index c476a294ad..6810425c77 100644
--- a/src/wp-admin/user-edit.php
+++ b/src/wp-admin/user-edit.php
@@ -333,11 +333,11 @@ switch ( $action ) {
<?php if ( count( $_wp_admin_css_colors ) > 1 && has_action( 'admin_color_scheme_picker' ) ) : ?>
<tr class="user-admin-color-wrap">
- <th scope="row"><?php _e( 'Admin Color Scheme' ); ?></th>
+ <th scope="row"><?php _e( 'Administration Color Scheme' ); ?></th>
<td>
<?php
/**
- * Fires in the 'Admin Color Scheme' section of the user editing screen.
+ * Fires in the 'Administration Color Scheme' section of the user editing screen.
*
* The section is only enabled if a callback is hooked to the action,
* and if there is more than one defined color scheme for the admin.
@@ -486,17 +486,35 @@ switch ( $action ) {
<tr class="user-first-name-wrap">
<th><label for="first_name"><?php _e( 'First Name' ); ?></label></th>
- <td><input type="text" name="first_name" id="first_name" value="<?php echo esc_attr( $profile_user->first_name ); ?>" class="regular-text" /></td>
+ <td>
+ <?php if ( IS_PROFILE_PAGE ) : ?>
+ <input type="text" name="first_name" id="first_name" value="<?php echo esc_attr( $profile_user->first_name ); ?>" autocomplete="given-name" class="regular-text" />
+ <?php else : ?>
+ <input type="text" name="first_name" id="first_name" value="<?php echo esc_attr( $profile_user->first_name ); ?>" class="regular-text" />
+ <?php endif; ?>
+ </td>
</tr>
<tr class="user-last-name-wrap">
<th><label for="last_name"><?php _e( 'Last Name' ); ?></label></th>
- <td><input type="text" name="last_name" id="last_name" value="<?php echo esc_attr( $profile_user->last_name ); ?>" class="regular-text" /></td>
+ <td>
+ <?php if ( IS_PROFILE_PAGE ) : ?>
+ <input type="text" name="last_name" id="last_name" value="<?php echo esc_attr( $profile_user->last_name ); ?>" autocomplete="family-name" class="regular-text" />
+ <?php else : ?>
+ <input type="text" name="last_name" id="last_name" value="<?php echo esc_attr( $profile_user->last_name ); ?>" class="regular-text" />
+ <?php endif; ?>
+ </td>
</tr>
<tr class="user-nickname-wrap">
<th><label for="nickname"><?php _e( 'Nickname' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th>
- <td><input type="text" name="nickname" id="nickname" value="<?php echo esc_attr( $profile_user->nickname ); ?>" class="regular-text" /></td>
+ <td>
+ <?php if ( IS_PROFILE_PAGE ) : ?>
+ <input type="text" name="nickname" id="nickname" value="<?php echo esc_attr( $profile_user->nickname ); ?>" autocomplete="nickname" class="regular-text" />
+ <?php else : ?>
+ <input type="text" name="nickname" id="nickname" value="<?php echo esc_attr( $profile_user->nickname ); ?>" class="regular-text" />
+ <?php endif; ?>
+ </td>
</tr>
<tr class="user-display-name-wrap">
@@ -546,7 +564,7 @@ switch ( $action ) {
<th><label for="email"><?php _e( 'Email' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th>
<td>
<?php if ( $profile_user->ID === $current_user->ID ) : ?>
- <input type="email" name="email" id="email" aria-describedby="email-description" value="<?php echo esc_attr( $profile_user->user_email ); ?>" class="regular-text ltr" />
+ <input type="email" name="email" id="email" aria-describedby="email-description" value="<?php echo esc_attr( $profile_user->user_email ); ?>" autocomplete="email" class="regular-text ltr" />
<p class="description" id="email-description">
<?php _e( 'If you change this, an email will be sent at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>' ); ?>
</p>
diff --git a/src/wp-content/themes/twentyeleven/inc/block-patterns.php b/src/wp-content/themes/twentyeleven/inc/block-patterns.php
index bdb2619422..27b37be500 100644
--- a/src/wp-content/themes/twentyeleven/inc/block-patterns.php
+++ b/src/wp-content/themes/twentyeleven/inc/block-patterns.php
@@ -39,7 +39,7 @@ if ( function_exists( 'register_block_pattern' ) ) {
<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column -->
<div class="wp-block-column"><!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none"} -->
- <figure class="wp-block-image size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/images/patterns/pattern-flower.jpg" alt="' . esc_attr( 'A yellow flower against a dark background.', 'twentyeleven' ) . '" /></figure>
+ <figure class="wp-block-image size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/images/patterns/pattern-flower.jpg" alt="' . esc_attr__( 'A yellow flower against a dark background.', 'twentyeleven' ) . '" /></figure>
<!-- /wp:image -->
<!-- wp:paragraph {"dropCap":true} -->
<p class="has-drop-cap">' . esc_html__( 'This is just an example post to showcase the featured post section on the showcase page. Who doesn&#8217;t like flowers? I like flowers. Nullam hendrerit enim nunc. Vestibulum eget nulla magna! Fusce lobortis neque eu neque egestas tincidunt. Duis elementum consequat lorem, in eleifend justo mollis at. Nam quis adipiscing magna. Duis adipiscing est ac nibh feugiat rhoncus. Donec non lorem felis, eget commodo purus.', 'twentyeleven' ) . '</p>
@@ -117,7 +117,7 @@ if ( function_exists( 'register_block_pattern' ) ) {
<!-- /wp:heading --><!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column -->
<div class="wp-block-column"><!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none"} -->
- <figure class="wp-block-image size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/images/patterns/pattern-woman.jpg" alt="' . esc_attr( 'Photo of a woman.', 'twentyeleven' ) . '" /></figure>
+ <figure class="wp-block-image size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/images/patterns/pattern-woman.jpg" alt="' . esc_attr__( 'Photo of a woman.', 'twentyeleven' ) . '" /></figure>
<!-- /wp:image --></div>
<!-- /wp:column -->
<!-- wp:column -->
diff --git a/src/wp-content/themes/twentyfourteen/css/blocks.css b/src/wp-content/themes/twentyfourteen/css/blocks.css
index 4d001f5289..102d5e2508 100644
--- a/src/wp-content/themes/twentyfourteen/css/blocks.css
+++ b/src/wp-content/themes/twentyfourteen/css/blocks.css
@@ -368,7 +368,7 @@ p.has-drop-cap:not(:focus)::first-letter {
color: #41a62a;
}
-.widget-area .wp-block-latest-comments__comment-meta a {
+.widget-area:where(:not(.content-sidebar)) .wp-block-latest-comments__comment-meta a {
color: #fff;
}
diff --git a/src/wp-content/themes/twentyfourteen/inc/block-patterns.php b/src/wp-content/themes/twentyfourteen/inc/block-patterns.php
index ac40532cfb..b3bc376192 100644
--- a/src/wp-content/themes/twentyfourteen/inc/block-patterns.php
+++ b/src/wp-content/themes/twentyfourteen/inc/block-patterns.php
@@ -55,7 +55,7 @@ if ( function_exists( 'register_block_pattern' ) ) {
'title' => esc_html__( 'Summary', 'twentyfourteen' ),
'categories' => array( 'twentyfourteen' ),
'viewportWidth' => 1000,
- 'content' => '<!-- wp:group {"backgroundColor":"light-gray"} --><div class="wp-block-group has-light-gray-background-color has-background"><div class="wp-block-group__inner-container"><!-- wp:spacer {"height":50} --><div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div><!-- /wp:spacer --><!-- wp:heading {"level":3,"style":{"typography":{"lineHeight":"1.5"}}} --><h3 style="line-height:1.5">' . esc_html__( 'Traveling Nostalgia', 'twentyfourteen' ) . '</h3><!-- /wp:heading --><!-- wp:paragraph --><p><em>' . esc_html__( 'Here are some photos from my all-time favorite destinations.', 'twentyfourteen' ) . '</em></p><!-- /wp:paragraph --><!-- wp:columns --><div class="wp-block-columns"><!-- wp:column --><div class="wp-block-column"><!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none"} --><figure class="wp-block-image size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/images/sunset.jpg" alt="' . esc_html__( 'Photo of a sunset', 'twentyfourteen' ) . '"/><figcaption><span class="has-inline-color has-dark-gray-color">' . esc_html__( 'Sunset', 'twentyfourteen' ) . '</span></figcaption></figure><!-- /wp:image --><!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none"} --><figure class="wp-block-image size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/images/bridge.jpg" alt="' . esc_attr__( 'Photo of a bridge', 'twentyfourteen' ) . '"/><figcaption><span class="has-inline-color has-dark-gray-color">' . esc_html__( 'Bridge', 'twentyfourteen' ) . '</span></figcaption></figure><!-- /wp:image --></div><!-- /wp:column --><!-- wp:column --><div class="wp-block-column"><!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none"} --><figure class="wp-block-image size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/images/street.jpg" alt="' . esc_attr__( 'Photo of a streetscape', 'twentyfourteen' ) . '"/><figcaption><span class="has-inline-color has-dark-gray-color">' . esc_html__( 'Streetscape', 'twentyfourteen' ) . '</span></figcaption></figure><!-- /wp:image --><!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none"} --><figure class="wp-block-image size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/images/clouds.jpg" alt="' . esc_attr__( 'Photo of a cloudy mountain', 'twentyfourteen' ) . '"/><figcaption><span class="has-inline-color has-dark-gray-color">' . esc_html__( 'Clouds', 'twentyfourteen' ) . '</span></figcaption></figure><!-- /wp:image --></div><!-- /wp:column --></div><!-- /wp:columns --><!-- wp:buttons --><div class="wp-block-buttons"><!-- wp:button {"borderRadius":0,"backgroundColor":"dark-gray"} --><div class="wp-block-button"><a class="wp-block-button__link has-dark-gray-background-color has-background no-border-radius">' . esc_html__( 'Read More', 'twentyfourteen' ) . '</a></div><!-- /wp:button --></div><!-- /wp:buttons --><!-- wp:spacer {"height":50} --><div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div><!-- /wp:spacer --></div></div><!-- /wp:group -->',
+ 'content' => '<!-- wp:group {"backgroundColor":"light-gray"} --><div class="wp-block-group has-light-gray-background-color has-background"><div class="wp-block-group__inner-container"><!-- wp:spacer {"height":50} --><div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div><!-- /wp:spacer --><!-- wp:heading {"level":3,"style":{"typography":{"lineHeight":"1.5"}}} --><h3 style="line-height:1.5">' . esc_html__( 'Traveling Nostalgia', 'twentyfourteen' ) . '</h3><!-- /wp:heading --><!-- wp:paragraph --><p><em>' . esc_html__( 'Here are some photos from my all-time favorite destinations.', 'twentyfourteen' ) . '</em></p><!-- /wp:paragraph --><!-- wp:columns --><div class="wp-block-columns"><!-- wp:column --><div class="wp-block-column"><!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none"} --><figure class="wp-block-image size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/images/sunset.jpg" alt="' . esc_attr__( 'Photo of a sunset', 'twentyfourteen' ) . '"/><figcaption><span class="has-inline-color has-dark-gray-color">' . esc_html__( 'Sunset', 'twentyfourteen' ) . '</span></figcaption></figure><!-- /wp:image --><!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none"} --><figure class="wp-block-image size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/images/bridge.jpg" alt="' . esc_attr__( 'Photo of a bridge', 'twentyfourteen' ) . '"/><figcaption><span class="has-inline-color has-dark-gray-color">' . esc_html__( 'Bridge', 'twentyfourteen' ) . '</span></figcaption></figure><!-- /wp:image --></div><!-- /wp:column --><!-- wp:column --><div class="wp-block-column"><!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none"} --><figure class="wp-block-image size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/images/street.jpg" alt="' . esc_attr__( 'Photo of a streetscape', 'twentyfourteen' ) . '"/><figcaption><span class="has-inline-color has-dark-gray-color">' . esc_html__( 'Streetscape', 'twentyfourteen' ) . '</span></figcaption></figure><!-- /wp:image --><!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none"} --><figure class="wp-block-image size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/images/clouds.jpg" alt="' . esc_attr__( 'Photo of a cloudy mountain', 'twentyfourteen' ) . '"/><figcaption><span class="has-inline-color has-dark-gray-color">' . esc_html__( 'Clouds', 'twentyfourteen' ) . '</span></figcaption></figure><!-- /wp:image --></div><!-- /wp:column --></div><!-- /wp:columns --><!-- wp:buttons --><div class="wp-block-buttons"><!-- wp:button {"borderRadius":0,"backgroundColor":"dark-gray"} --><div class="wp-block-button"><a class="wp-block-button__link has-dark-gray-background-color has-background no-border-radius">' . esc_html__( 'Read More', 'twentyfourteen' ) . '</a></div><!-- /wp:button --></div><!-- /wp:buttons --><!-- wp:spacer {"height":50} --><div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div><!-- /wp:spacer --></div></div><!-- /wp:group -->',
)
);
diff --git a/src/wp-content/themes/twentynineteen/sass/navigation/_menu-main-navigation.scss b/src/wp-content/themes/twentynineteen/sass/navigation/_menu-main-navigation.scss
index d1e30256f3..6d6d744ed8 100644
--- a/src/wp-content/themes/twentynineteen/sass/navigation/_menu-main-navigation.scss
+++ b/src/wp-content/themes/twentynineteen/sass/navigation/_menu-main-navigation.scss
@@ -433,9 +433,13 @@
white-space: inherit;
}
+ &:not(:has(.sub-menu.expanded-true)) {
+ overflow-y: scroll;
+ }
+
&.expanded-true {
- display: table;
+ display: block;
margin-top: 0;
opacity: 1;
padding-left: 0;
diff --git a/src/wp-content/themes/twentynineteen/style-rtl.css b/src/wp-content/themes/twentynineteen/style-rtl.css
index da1b3636c0..9f1700c012 100644
--- a/src/wp-content/themes/twentynineteen/style-rtl.css
+++ b/src/wp-content/themes/twentynineteen/style-rtl.css
@@ -3271,8 +3271,12 @@ body.page .main-navigation {
white-space: inherit;
}
+.main-navigation .main-menu .menu-item-has-children.off-canvas .sub-menu:not(:has(.sub-menu.expanded-true)) {
+ overflow-y: scroll;
+}
+
.main-navigation .main-menu .menu-item-has-children.off-canvas .sub-menu.expanded-true {
- display: table;
+ display: block;
margin-top: 0;
opacity: 1;
padding-right: 0;
diff --git a/src/wp-content/themes/twentynineteen/style.css b/src/wp-content/themes/twentynineteen/style.css
index 2124cf584f..634a947b3a 100644
--- a/src/wp-content/themes/twentynineteen/style.css
+++ b/src/wp-content/themes/twentynineteen/style.css
@@ -3271,8 +3271,12 @@ body.page .main-navigation {
white-space: inherit;
}
+.main-navigation .main-menu .menu-item-has-children.off-canvas .sub-menu:not(:has(.sub-menu.expanded-true)) {
+ overflow-y: scroll;
+}
+
.main-navigation .main-menu .menu-item-has-children.off-canvas .sub-menu.expanded-true {
- display: table;
+ display: block;
margin-top: 0;
opacity: 1;
padding-left: 0;
diff --git a/src/wp-content/themes/twentyseventeen/inc/block-patterns.php b/src/wp-content/themes/twentyseventeen/inc/block-patterns.php
index f013aa9a54..e924ce7e29 100644
--- a/src/wp-content/themes/twentyseventeen/inc/block-patterns.php
+++ b/src/wp-content/themes/twentyseventeen/inc/block-patterns.php
@@ -14,7 +14,7 @@ if ( function_exists( 'register_block_pattern_category' ) ) {
register_block_pattern_category(
'twentyseventeen',
- array( 'label' => __( 'Twenty Seventeen', 'twentyseventeen' ) )
+ array( 'label' => esc_html__( 'Twenty Seventeen', 'twentyseventeen' ) )
);
}
@@ -25,15 +25,15 @@ if ( function_exists( 'register_block_pattern' ) ) {
register_block_pattern(
'twentyseventeen/large-heading-with-button',
array(
- 'title' => __( 'Large Heading with Button', 'twentyseventeen' ),
+ 'title' => esc_html__( 'Large Heading with Button', 'twentyseventeen' ),
'categories' => array( 'twentyseventeen' ),
'content' => '<!-- wp:heading {"level":1,"textColor":"black","style":{"typography":{"fontSize":50}}} -->
- <h1 class="has-black-color has-text-color" style="font-size:50px">' . __( 'Attract Leads with Marketing Campaigns that Work', 'twentyseventeen' ) . '</h1>
+ <h1 class="has-black-color has-text-color" style="font-size:50px">' . esc_html__( 'Attract Leads with Marketing Campaigns that Work', 'twentyseventeen' ) . '</h1>
<!-- /wp:heading -->
<!-- wp:buttons -->
<div class="wp-block-buttons"><!-- wp:button {"borderRadius":0,"className":"is-style-fill"} -->
- <div class="wp-block-button is-style-fill"><a class="wp-block-button__link no-border-radius">' . __( 'Our Services', 'twentyseventeen' ) . '</a></div>
+ <div class="wp-block-button is-style-fill"><a class="wp-block-button__link no-border-radius">' . esc_html__( 'Our Services', 'twentyseventeen' ) . '</a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons -->',
)
@@ -42,7 +42,7 @@ if ( function_exists( 'register_block_pattern' ) ) {
register_block_pattern(
'twentyseventeen/images-with-text-and-link',
array(
- 'title' => __( 'Images with Text and Link', 'twentyseventeen' ),
+ 'title' => esc_html__( 'Images with Text and Link', 'twentyseventeen' ),
'categories' => array( 'twentyseventeen' ),
'content' => '<!-- wp:spacer -->
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
@@ -51,16 +51,16 @@ if ( function_exists( 'register_block_pattern' ) ) {
<div class="wp-block-columns"><!-- wp:column -->
<div class="wp-block-column">
<!-- wp:image {"className":"size-large"} -->
- <figure class="wp-block-image size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/stripes.jpg" alt="' . __( 'Black Stripes', 'twentyseventeen' ) . '"/></figure>
+ <figure class="wp-block-image size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/stripes.jpg" alt="' . esc_attr__( 'Black Stripes', 'twentyseventeen' ) . '"/></figure>
<!-- /wp:image -->
<!-- wp:heading {"textColor":"black","style":{"typography":{"fontSize":45}}} -->
- <h2 class="has-black-color has-text-color" style="font-size:45px">' . __( 'Branding', 'twentyseventeen' ) . '</h2>
+ <h2 class="has-black-color has-text-color" style="font-size:45px">' . esc_html__( 'Branding', 'twentyseventeen' ) . '</h2>
<!-- /wp:heading -->
<!-- wp:paragraph {"textColor":"black","style":{"typography":{"lineHeight":"1.8"}}} -->
- <p class="has-black-color has-text-color" style="line-height:1.8">' . __( 'Communicate your purpose and goals with a beautiful logo that encapsulates your business.', 'twentyseventeen' ) . '</p>
+ <p class="has-black-color has-text-color" style="line-height:1.8">' . esc_html__( 'Communicate your purpose and goals with a beautiful logo that encapsulates your business.', 'twentyseventeen' ) . '</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph {"style":{"typography":{"lineHeight":"3"}}} -->
- <p style="line-height:3"><a href="#"><strong>' . __( 'See Case Study', 'twentyseventeen' ) . ' →</strong></a></p>
+ <p style="line-height:3"><a href="#"><strong>' . esc_html__( 'See Case Study', 'twentyseventeen' ) . ' →</strong></a></p>
<!-- /wp:paragraph --></div>
<!-- /wp:column -->
<!-- wp:column -->
@@ -68,16 +68,16 @@ if ( function_exists( 'register_block_pattern' ) ) {
<div style="height:254px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- wp:image {"className":"size-large"} -->
- <figure class="wp-block-image size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/white-border.jpg" alt="' . __( 'White border', 'twentyseventeen' ) . '"/></figure>
+ <figure class="wp-block-image size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/white-border.jpg" alt="' . esc_attr__( 'White border', 'twentyseventeen' ) . '"/></figure>
<!-- /wp:image -->
<!-- wp:heading {"textColor":"black","style":{"typography":{"fontSize":45}}} -->
- <h2 class="has-black-color has-text-color" style="font-size:45px">' . __( 'Web Design', 'twentyseventeen' ) . '</h2>
+ <h2 class="has-black-color has-text-color" style="font-size:45px">' . esc_html__( 'Web Design', 'twentyseventeen' ) . '</h2>
<!-- /wp:heading -->
<!-- wp:paragraph {"textColor":"black","style":{"typography":{"lineHeight":"1.8"}}} -->
- <p class="has-black-color has-text-color" style="line-height:1.8">' . __( 'Need a website? We&#39;ve got you covered. Our design team will create a stunning design to transform your brand.', 'twentyseventeen' ) . '</p>
+ <p class="has-black-color has-text-color" style="line-height:1.8">' . esc_html__( 'Need a website? We&#39;ve got you covered. Our design team will create a stunning design to transform your brand.', 'twentyseventeen' ) . '</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph {"style":{"typography":{"lineHeight":"3.0"}}} -->
- <p style="line-height:3.0"><a href="#"><strong>' . __( 'See Case Study', 'twentyseventeen' ) . ' →</strong></a></p>
+ <p style="line-height:3.0"><a href="#"><strong>' . esc_html__( 'See Case Study', 'twentyseventeen' ) . ' →</strong></a></p>
<!-- /wp:paragraph --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->',
@@ -87,7 +87,7 @@ if ( function_exists( 'register_block_pattern' ) ) {
register_block_pattern(
'twentyseventeen/images-with-link',
array(
- 'title' => __( 'Images with Link', 'twentyseventeen' ),
+ 'title' => esc_html__( 'Images with Link', 'twentyseventeen' ),
'categories' => array( 'twentyseventeen' ),
'content' => '<!-- wp:spacer -->
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
@@ -97,13 +97,13 @@ if ( function_exists( 'register_block_pattern' ) ) {
<div class="wp-block-column"><!-- wp:group -->
<div class="wp-block-group"><div class="wp-block-group__inner-container">
<!-- wp:image {"align":"center","sizeSlug":"large","className":"is-style-default"} -->
- <div class="wp-block-image is-style-default"><figure class="aligncenter size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/stripes.jpg" alt="' . __( 'Black Stripes', 'twentyseventeen' ) . '"/></figure></div>
+ <div class="wp-block-image is-style-default"><figure class="aligncenter size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/stripes.jpg" alt="' . esc_attr__( 'Black Stripes', 'twentyseventeen' ) . '"/></figure></div>
<!-- /wp:image -->
<!-- wp:heading {"align":"left","textColor":"black","style":{"typography":{"fontSize":30}}} -->
- <h2 class="has-text-align-left has-black-color has-text-color" style="font-size:30px">' . __( 'Branding', 'twentyseventeen' ) . '</h2>
+ <h2 class="has-text-align-left has-black-color has-text-color" style="font-size:30px">' . esc_html__( 'Branding', 'twentyseventeen' ) . '</h2>
<!-- /wp:heading -->
<!-- wp:paragraph {"align":"left"} -->
- <p class="has-text-align-left"><a href="#">' . __( 'See Case Study', 'twentyseventeen' ) . ' →</a></p>
+ <p class="has-text-align-left"><a href="#">' . esc_html__( 'See Case Study', 'twentyseventeen' ) . ' →</a></p>
<!-- /wp:paragraph --></div></div>
<!-- /wp:group --></div>
<!-- /wp:column -->
@@ -111,13 +111,13 @@ if ( function_exists( 'register_block_pattern' ) ) {
<div class="wp-block-column"><!-- wp:group -->
<div class="wp-block-group"><div class="wp-block-group__inner-container">
<!-- wp:image {"align":"center","sizeSlug":"large","className":"is-style-default"} -->
- <div class="wp-block-image is-style-default"><figure class="aligncenter size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/white-border.jpg" alt="' . __( 'White border', 'twentyseventeen' ) . '"/></figure></div>
+ <div class="wp-block-image is-style-default"><figure class="aligncenter size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/white-border.jpg" alt="' . esc_attr__( 'White border', 'twentyseventeen' ) . '"/></figure></div>
<!-- /wp:image -->
<!-- wp:heading {"align":"left","textColor":"black","style":{"typography":{"fontSize":30}}} -->
- <h2 class="has-text-align-left has-black-color has-text-color" style="font-size:30px">' . __( 'Design', 'twentyseventeen' ) . '</h2>
+ <h2 class="has-text-align-left has-black-color has-text-color" style="font-size:30px">' . esc_html__( 'Design', 'twentyseventeen' ) . '</h2>
<!-- /wp:heading -->
<!-- wp:paragraph {"align":"left"} -->
- <p class="has-text-align-left"><a href="#">' . __( 'See Case Study', 'twentyseventeen' ) . ' →</a></p>
+ <p class="has-text-align-left"><a href="#">' . esc_html__( 'See Case Study', 'twentyseventeen' ) . ' →</a></p>
<!-- /wp:paragraph --></div></div>
<!-- /wp:group --></div>
<!-- /wp:column -->
@@ -125,13 +125,13 @@ if ( function_exists( 'register_block_pattern' ) ) {
<div class="wp-block-column"><!-- wp:group -->
<div class="wp-block-group"><div class="wp-block-group__inner-container">
<!-- wp:image {"align":"center","sizeSlug":"large","className":"is-style-default"} -->
- <div class="wp-block-image is-style-default"><figure class="aligncenter size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/direct-light.jpg" alt="' . __( 'Direct Light', 'twentyseventeen' ) . '"/></figure></div>
+ <div class="wp-block-image is-style-default"><figure class="aligncenter size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/direct-light.jpg" alt="' . esc_attr__( 'Direct Light', 'twentyseventeen' ) . '"/></figure></div>
<!-- /wp:image -->
<!-- wp:heading {"align":"left","textColor":"black","style":{"typography":{"fontSize":30}}} -->
- <h2 class="has-text-align-left has-black-color has-text-color" style="font-size:30px">' . __( 'Strategy', 'twentyseventeen' ) . '</h2>
+ <h2 class="has-text-align-left has-black-color has-text-color" style="font-size:30px">' . esc_html__( 'Strategy', 'twentyseventeen' ) . '</h2>
<!-- /wp:heading -->
<!-- wp:paragraph {"align":"left"} -->
- <p class="has-text-align-left"><a href="#">' . __( 'See Case Study', 'twentyseventeen' ) . ' →</a></p>
+ <p class="has-text-align-left"><a href="#">' . esc_html__( 'See Case Study', 'twentyseventeen' ) . ' →</a></p>
<!-- /wp:paragraph --></div></div>
<!-- /wp:group --></div>
<!-- /wp:column --></div>
@@ -145,21 +145,21 @@ if ( function_exists( 'register_block_pattern' ) ) {
register_block_pattern(
'twentyseventeen/services',
array(
- 'title' => __( 'Services', 'twentyseventeen' ),
+ 'title' => esc_html__( 'Services', 'twentyseventeen' ),
'categories' => array( 'twentyseventeen' ),
'content' => '<!-- wp:spacer -->
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- wp:heading {"level":1,"style":{"typography":{"fontSize":50}}} -->
- <h1 style="font-size:50px">' . __( 'Our Services', 'twentyseventeen' ) . '</h1>
+ <h1 style="font-size:50px">' . esc_html__( 'Our Services', 'twentyseventeen' ) . '</h1>
<!-- /wp:heading -->
<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column -->
<div class="wp-block-column">
<!-- wp:paragraph {"style":{"typography":{"fontSize":21, "lineHeight":"2.5"}}} -->
- <p style="font-size:21px"><a href="#">' . __( 'Branding', 'twentyseventeen' ) . ' →</a><br><a href="#">' . __( 'Web Design', 'twentyseventeen' ) . ' →</a><br><a href="#">' . __( 'Web Development', 'twentyseventeen' ) . ' →</a></p>
+ <p style="font-size:21px"><a href="#">' . esc_html__( 'Branding', 'twentyseventeen' ) . ' →</a><br><a href="#">' . esc_html__( 'Web Design', 'twentyseventeen' ) . ' →</a><br><a href="#">' . esc_html__( 'Web Development', 'twentyseventeen' ) . ' →</a></p>
<!-- /wp:paragraph -->
</div>
<!-- /wp:column -->
@@ -167,7 +167,7 @@ if ( function_exists( 'register_block_pattern' ) ) {
<!-- wp:column -->
<div class="wp-block-column">
<!-- wp:paragraph {"style":{"typography":{"fontSize":21, "lineHeight":"2.5"}}} -->
- <p style="font-size:21px"><a href="#">' . __( 'Content Strategy', 'twentyseventeen' ) . ' →</a><br><a href="#">' . __( 'Marketing &amp; SEO', 'twentyseventeen' ) . ' →</a><br><a href="#">' . __( 'Video Production', 'twentyseventeen' ) . ' →</a></p>
+ <p style="font-size:21px"><a href="#">' . esc_html__( 'Content Strategy', 'twentyseventeen' ) . ' →</a><br><a href="#">' . esc_html__( 'Marketing &amp; SEO', 'twentyseventeen' ) . ' →</a><br><a href="#">' . esc_html__( 'Video Production', 'twentyseventeen' ) . ' →</a></p>
<!-- /wp:paragraph --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->
@@ -181,16 +181,16 @@ if ( function_exists( 'register_block_pattern' ) ) {
register_block_pattern(
'twentyseventeen/contact-us',
array(
- 'title' => __( 'Contact Us', 'twentyseventeen' ),
+ 'title' => esc_html__( 'Contact Us', 'twentyseventeen' ),
'categories' => array( 'twentyseventeen' ),
'content' => '<!-- wp:cover {"customOverlayColor":"#93aab8","minHeight":700,"align":"center"} -->
<div class="wp-block-cover aligncenter has-background-dim" style="background-color:#93aab8;min-height:700px"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"left","textColor":"white","style":{"typography":{"fontSize":50}}} -->
- <p class="has-text-align-left has-white-color has-text-color" style="font-size:50px">' . __( 'We are proud to serve outstanding clients.', 'twentyseventeen' ) . '</p>
+ <p class="has-text-align-left has-white-color has-text-color" style="font-size:50px">' . esc_html__( 'We are proud to serve outstanding clients.', 'twentyseventeen' ) . '</p>
<!-- /wp:paragraph -->
<!-- wp:buttons -->
<div class="wp-block-buttons"><!-- wp:button {"borderRadius":0,"backgroundColor":"black","textColor":"white","className":"is-style-fill"} -->
- <div class="wp-block-button is-style-fill"><a class="wp-block-button__link has-white-color has-black-background-color has-text-color has-background no-border-radius">' . __( 'Contact us', 'twentyseventeen' ) . '</a></div>
+ <div class="wp-block-button is-style-fill"><a class="wp-block-button__link has-white-color has-black-background-color has-text-color has-background no-border-radius">' . esc_html__( 'Contact us', 'twentyseventeen' ) . '</a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons --></div></div>
<!-- /wp:cover -->',
diff --git a/src/wp-content/themes/twentysixteen/css/editor-blocks.css b/src/wp-content/themes/twentysixteen/css/editor-blocks.css
index 0ab68afe8a..a8648668cd 100644
--- a/src/wp-content/themes/twentysixteen/css/editor-blocks.css
+++ b/src/wp-content/themes/twentysixteen/css/editor-blocks.css
@@ -370,6 +370,10 @@ figure[class*="wp-block-"] > figcaption {
padding-right: 0;
}
+.wp-block-quote.is-style-plain {
+ border: none;
+}
+
@media screen and (min-width: 44.375em) {
.wp-block-quote.alignleft,
.wp-block-quote.alignright {
diff --git a/src/wp-content/themes/twentytwelve/css/editor-blocks.css b/src/wp-content/themes/twentytwelve/css/editor-blocks.css
index 85dd813bf2..25ddf21943 100644
--- a/src/wp-content/themes/twentytwelve/css/editor-blocks.css
+++ b/src/wp-content/themes/twentytwelve/css/editor-blocks.css
@@ -141,18 +141,14 @@ Description: Used to style blocks in the editor.
/* Captions */
+[class*=" wp-block-"] figcaption,
[class^="wp-block-"] figcaption,
[class^="wp-block-"] figcaption.editor-rich-text__tinymce.mce-content-body {
color: #757575;
font-size: 12px;
line-height: 2;
font-style: italic;
- text-align: left;
-}
-
-.rtl [class^="wp-block-"] figcaption,
-.rtl [class^="wp-block-"] figcaption.editor-rich-text__tinymce.mce-content-body {
- text-align: right;
+ text-align: start;
}
/* Definition Lists */
diff --git a/src/wp-content/themes/twentytwenty/assets/js/index.js b/src/wp-content/themes/twentytwenty/assets/js/index.js
index 258658a97e..35efcd6b60 100644
--- a/src/wp-content/themes/twentytwenty/assets/js/index.js
+++ b/src/wp-content/themes/twentytwenty/assets/js/index.js
@@ -257,7 +257,10 @@ twentytwenty.coverModals = {
clickedEl = false;
}
- _win.scrollTo( 0, Math.abs( _win.twentytwenty.scrolled + getAdminBarHeight() ) );
+ _win.scrollTo({
+ top: Math.abs( _win.twentytwenty.scrolled + getAdminBarHeight() ),
+ behavior: 'instant'
+ });
_win.twentytwenty.scrolled = 0;
}, 500 );
diff --git a/src/wp-content/themes/twentytwenty/functions.php b/src/wp-content/themes/twentytwenty/functions.php
index 96945243fa..a3ca940c4d 100644
--- a/src/wp-content/themes/twentytwenty/functions.php
+++ b/src/wp-content/themes/twentytwenty/functions.php
@@ -361,7 +361,11 @@ if ( ! function_exists( 'wp_body_open' ) ) {
* @since Twenty Twenty 1.0
*/
function wp_body_open() {
- /** This action is documented in wp-includes/general-template.php */
+ /**
+ * Triggered after the opening <body> tag.
+ *
+ * @since Twenty Twenty 1.0
+ */
do_action( 'wp_body_open' );
}
}
diff --git a/src/wp-content/themes/twentytwentyone/assets/js/primary-navigation.js b/src/wp-content/themes/twentytwentyone/assets/js/primary-navigation.js
index 8b3739865f..313a14a147 100644
--- a/src/wp-content/themes/twentytwentyone/assets/js/primary-navigation.js
+++ b/src/wp-content/themes/twentytwentyone/assets/js/primary-navigation.js
@@ -211,7 +211,7 @@ function twentytwentyoneExpandSubMenu( el ) { // jshint ignore:line
} );
};
- window.addEventListener( 'load', function() {
+ document.addEventListener( 'DOMContentLoaded', function() {
new navMenu( 'primary' );
} );
}() );
diff --git a/src/wp-includes/author-template.php b/src/wp-includes/author-template.php
index 184d7d0f38..a48a6d3e6e 100644
--- a/src/wp-includes/author-template.php
+++ b/src/wp-includes/author-template.php
@@ -286,7 +286,7 @@ function get_the_author_posts() {
if ( ! $post ) {
return 0;
}
- return count_user_posts( $post->post_author, $post->post_type );
+ return (int) count_user_posts( $post->post_author, $post->post_type );
}
/**
diff --git a/src/wp-includes/block-template-utils.php b/src/wp-includes/block-template-utils.php
index faea7d5e83..718eb31e33 100644
--- a/src/wp-includes/block-template-utils.php
+++ b/src/wp-includes/block-template-utils.php
@@ -344,11 +344,8 @@ function _get_block_template_file( $template_type, $slug ) {
return _add_block_template_part_area_info( $new_template_item );
}
- if ( 'wp_template' === $template_type ) {
- return _add_block_template_info( $new_template_item );
- }
-
- return $new_template_item;
+ // If it's not a `wp_template_part`, it must be a `wp_template`.
+ return _add_block_template_info( $new_template_item );
}
}
@@ -440,7 +437,7 @@ function _get_block_templates_files( $template_type, $query = array() ) {
if ( 'wp_template_part' === $template_type ) {
$candidate = _add_block_template_part_area_info( $new_template_item );
- if ( ! isset( $area ) || ( isset( $area ) && $area === $candidate['area'] ) ) {
+ if ( ! isset( $area ) || $area === $candidate['area'] ) {
$template_files[ $template_slug ] = $candidate;
}
}
diff --git a/src/wp-includes/block-template.php b/src/wp-includes/block-template.php
index affae1c09a..eecbe2d61d 100644
--- a/src/wp-includes/block-template.php
+++ b/src/wp-includes/block-template.php
@@ -253,7 +253,7 @@ function get_the_block_template_html() {
if ( is_user_logged_in() ) {
return '<h1>' . esc_html__( 'No matching template found' ) . '</h1>';
}
- return;
+ return '';
}
$content = $wp_embed->run_shortcode( $_wp_current_template_content );
diff --git a/src/wp-includes/blocks.php b/src/wp-includes/blocks.php
index 838cd84a19..56410779fe 100644
--- a/src/wp-includes/blocks.php
+++ b/src/wp-includes/blocks.php
@@ -328,8 +328,9 @@ function register_block_style_handle( $metadata, $field_name, $index = 0 ) {
$style_path_norm = wp_normalize_path( realpath( dirname( $metadata['file'] ) . '/' . $style_path ) );
$style_uri = get_block_asset_url( $style_path_norm );
- $version = ! $is_core_block && isset( $metadata['version'] ) ? $metadata['version'] : false;
- $result = wp_register_style(
+ $block_version = ! $is_core_block && isset( $metadata['version'] ) ? $metadata['version'] : false;
+ $version = $style_path_norm && defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? filemtime( $style_path_norm ) : $block_version;
+ $result = wp_register_style(
$style_handle_name,
$style_uri,
array(),
@@ -2403,11 +2404,32 @@ function parse_blocks( $content ) {
* @return string Updated post content.
*/
function do_blocks( $content ) {
- $blocks = parse_blocks( $content );
- $output = '';
+ $blocks = parse_blocks( $content );
+ $top_level_block_count = count( $blocks );
+ $output = '';
- foreach ( $blocks as $block ) {
- $output .= render_block( $block );
+ /**
+ * Parsed blocks consist of a list of top-level blocks. Those top-level
+ * blocks may themselves contain nested inner blocks. However, every
+ * top-level block is rendered independently, meaning there are no data
+ * dependencies between them.
+ *
+ * Ideally, therefore, the parser would only need to parse one complete
+ * top-level block at a time, render it, and move on. Unfortunately, this
+ * is not possible with {@see \parse_blocks()} because it must parse the
+ * entire given document at once.
+ *
+ * While the current implementation prevents this optimization, it’s still
+ * possible to reduce the peak memory use when calls to `render_block()`
+ * on those top-level blocks are memory-heavy (which many of them are).
+ * By setting each parsed block to `NULL` after rendering it, any memory
+ * allocated during the render will be freed and reused for the next block.
+ * Before making this change, that memory was retained and would lead to
+ * out-of-memory crashes for certain posts that now run with this change.
+ */
+ for ( $i = 0; $i < $top_level_block_count; $i++ ) {
+ $output .= render_block( $blocks[ $i ] );
+ $blocks[ $i ] = null;
}
// If there are blocks in this content, we shouldn't run wpautop() on it later.
diff --git a/src/wp-includes/capabilities.php b/src/wp-includes/capabilities.php
index d6c340c95e..2464ef5a79 100644
--- a/src/wp-includes/capabilities.php
+++ b/src/wp-includes/capabilities.php
@@ -470,7 +470,7 @@ function map_meta_cap( $cap, $user_id, ...$args ) {
if ( $meta_key ) {
$allowed = ! is_protected_meta( $meta_key, $object_type );
- if ( ! empty( $object_subtype ) && has_filter( "auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}" ) ) {
+ if ( has_filter( "auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}" ) ) {
/**
* Filters whether the user is allowed to edit a specific meta key of a specific object type and subtype.
@@ -512,36 +512,33 @@ function map_meta_cap( $cap, $user_id, ...$args ) {
$allowed = apply_filters( "auth_{$object_type}_meta_{$meta_key}", $allowed, $meta_key, $object_id, $user_id, $cap, $caps );
}
- if ( ! empty( $object_subtype ) ) {
-
- /**
- * Filters whether the user is allowed to edit meta for specific object types/subtypes.
- *
- * Return true to have the mapped meta caps from `edit_{$object_type}` apply.
- *
- * The dynamic portion of the hook name, `$object_type` refers to the object type being filtered.
- * The dynamic portion of the hook name, `$object_subtype` refers to the object subtype being filtered.
- * The dynamic portion of the hook name, `$meta_key`, refers to the meta key passed to map_meta_cap().
- *
- * @since 4.6.0 As `auth_post_{$post_type}_meta_{$meta_key}`.
- * @since 4.7.0 Renamed from `auth_post_{$post_type}_meta_{$meta_key}` to
- * `auth_{$object_type}_{$object_subtype}_meta_{$meta_key}`.
- * @deprecated 4.9.8 Use {@see 'auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}'} instead.
- *
- * @param bool $allowed Whether the user can add the object meta. Default false.
- * @param string $meta_key The meta key.
- * @param int $object_id Object ID.
- * @param int $user_id User ID.
- * @param string $cap Capability name.
- * @param string[] $caps Array of the user's capabilities.
- */
- $allowed = apply_filters_deprecated(
- "auth_{$object_type}_{$object_subtype}_meta_{$meta_key}",
- array( $allowed, $meta_key, $object_id, $user_id, $cap, $caps ),
- '4.9.8',
- "auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}"
- );
- }
+ /**
+ * Filters whether the user is allowed to edit meta for specific object types/subtypes.
+ *
+ * Return true to have the mapped meta caps from `edit_{$object_type}` apply.
+ *
+ * The dynamic portion of the hook name, `$object_type` refers to the object type being filtered.
+ * The dynamic portion of the hook name, `$object_subtype` refers to the object subtype being filtered.
+ * The dynamic portion of the hook name, `$meta_key`, refers to the meta key passed to map_meta_cap().
+ *
+ * @since 4.6.0 As `auth_post_{$post_type}_meta_{$meta_key}`.
+ * @since 4.7.0 Renamed from `auth_post_{$post_type}_meta_{$meta_key}` to
+ * `auth_{$object_type}_{$object_subtype}_meta_{$meta_key}`.
+ * @deprecated 4.9.8 Use {@see 'auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}'} instead.
+ *
+ * @param bool $allowed Whether the user can add the object meta. Default false.
+ * @param string $meta_key The meta key.
+ * @param int $object_id Object ID.
+ * @param int $user_id User ID.
+ * @param string $cap Capability name.
+ * @param string[] $caps Array of the user's capabilities.
+ */
+ $allowed = apply_filters_deprecated(
+ "auth_{$object_type}_{$object_subtype}_meta_{$meta_key}",
+ array( $allowed, $meta_key, $object_id, $user_id, $cap, $caps ),
+ '4.9.8',
+ "auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}"
+ );
if ( ! $allowed ) {
$caps[] = $cap;
@@ -1099,12 +1096,34 @@ function get_role( $role ) {
/**
* Adds a role, if it does not exist.
*
+ * The list of capabilities can be passed either as a numerically indexed array of capability names, or an
+ * associative array of boolean values keyed by the capability name. To explicitly deny the role a capability, set
+ * the value for that capability to false.
+ *
+ * Examples:
+ *
+ * // Add a role that can edit posts.
+ * add_role( 'custom_role', 'Custom Role', array(
+ * 'read',
+ * 'edit_posts',
+ * ) );
+ *
+ * Or, using an associative array:
+ *
+ * // Add a role that can edit posts but explicitly cannot not delete them.
+ * add_role( 'custom_role', 'Custom Role', array(
+ * 'read' => true,
+ * 'edit_posts' => true,
+ * 'delete_posts' => false,
+ * ) );
+ *
* @since 2.0.0
+ * @since x.y.z Support was added for a numerically indexed array of strings for the capabilities array.
*
- * @param string $role Role name.
- * @param string $display_name Display name for role.
- * @param bool[] $capabilities List of capabilities keyed by the capability name,
- * e.g. array( 'edit_posts' => true, 'delete_posts' => false ).
+ * @param string $role Role name.
+ * @param string $display_name Display name for role.
+ * @param array<string,bool>|array<int,string> $capabilities Capabilities to be added to the role.
+ * Default empty array.
* @return WP_Role|void WP_Role object, if the role is added.
*/
function add_role( $role, $display_name, $capabilities = array() ) {
diff --git a/src/wp-includes/category-template.php b/src/wp-includes/category-template.php
index 0525ae792a..b2c88c9c25 100644
--- a/src/wp-includes/category-template.php
+++ b/src/wp-includes/category-template.php
@@ -71,7 +71,7 @@ function get_category_parents( $category_id, $link = false, $separator = '/', $n
*
* @since 0.71
*
- * @param int $post_id Optional. The post ID. Defaults to current post ID.
+ * @param int|false $post_id Optional. The post ID. Defaults to current post ID.
* @return WP_Term[] Array of WP_Term objects, one for each category assigned to the post.
*/
function get_the_category( $post_id = false ) {
@@ -131,11 +131,11 @@ function get_the_category_by_ID( $cat_id ) { // phpcs:ignore WordPress.NamingCon
*
* @global WP_Rewrite $wp_rewrite WordPress rewrite component.
*
- * @param string $separator Optional. Separator between the categories. By default, the links are placed
- * in an unordered list. An empty string will result in the default behavior.
- * @param string $parents Optional. How to display the parents. Accepts 'multiple', 'single', or empty.
- * Default empty string.
- * @param int $post_id Optional. ID of the post to retrieve categories for. Defaults to the current post.
+ * @param string $separator Optional. Separator between the categories. By default, the links are placed
+ * in an unordered list. An empty string will result in the default behavior.
+ * @param string $parents Optional. How to display the parents. Accepts 'multiple', 'single', or empty.
+ * Default empty string.
+ * @param int|false $post_id Optional. ID of the post to retrieve categories for. Defaults to the current post.
* @return string Category list for a post.
*/
function get_the_category_list( $separator = '', $parents = '', $post_id = false ) {
@@ -251,7 +251,7 @@ function get_the_category_list( $separator = '', $parents = '', $post_id = false
*
* @param int|string|int[]|string[] $category Category ID, name, slug, or array of such
* to check against.
- * @param int|WP_Post $post Optional. Post to check. Defaults to the current post.
+ * @param int|null|WP_Post $post Optional. Post to check. Defaults to the current post.
* @return bool True if the current post is in any of the given categories.
*/
function in_category( $category, $post = null ) {
@@ -267,11 +267,11 @@ function in_category( $category, $post = null ) {
*
* @since 0.71
*
- * @param string $separator Optional. Separator between the categories. By default, the links are placed
- * in an unordered list. An empty string will result in the default behavior.
- * @param string $parents Optional. How to display the parents. Accepts 'multiple', 'single', or empty.
- * Default empty string.
- * @param int $post_id Optional. ID of the post to retrieve categories for. Defaults to the current post.
+ * @param string $separator Optional. Separator between the categories. By default, the links are placed
+ * in an unordered list. An empty string will result in the default behavior.
+ * @param string $parents Optional. How to display the parents. Accepts 'multiple', 'single', or empty.
+ * Default empty string.
+ * @param int|false $post_id Optional. ID of the post to retrieve categories for. Defaults to the current post.
*/
function the_category( $separator = '', $parents = '', $post_id = false ) {
echo get_the_category_list( $separator, $parents, $post_id );
@@ -793,7 +793,7 @@ function wp_tag_cloud( $args = '' ) {
* @return int Scaled count.
*/
function default_topic_count_scale( $count ) {
- return round( log10( $count + 1 ) * 100 );
+ return (int) round( log10( $count + 1 ) * 100 );
}
/**
diff --git a/src/wp-includes/certificates/ca-bundle.crt b/src/wp-includes/certificates/ca-bundle.crt
index 46fe2085ca..ba90f7a2d8 100644
--- a/src/wp-includes/certificates/ca-bundle.crt
+++ b/src/wp-includes/certificates/ca-bundle.crt
@@ -61,14 +61,14 @@ D/xwzoiQ
##
## Bundle of CA Root Certificates
##
-## Certificate data from Mozilla as of: Tue Feb 25 04:12:03 2025 GMT
+## Certificate data from Mozilla as of: Tue May 20 03:12:02 2025 GMT
##
## Find updated versions here: https://curl.se/docs/caextract.html
##
## This is a bundle of X.509 certificates of public Certificate Authorities
## (CA). These were automatically extracted from Mozilla's root certificates
## file (certdata.txt). This file can be found in the mozilla source tree:
-## https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
+## https://raw.githubusercontent.com/mozilla-firefox/firefox/refs/heads/release/security/nss/lib/ckfw/builtins/certdata.txt
##
## It contains the certificates in PEM format and therefore
## can be directly used with curl / libcurl / php_curl, or with
@@ -76,76 +76,10 @@ D/xwzoiQ
## Just configure this file as the SSLCACertificateFile.
##
## Conversion done with mk-ca-bundle.pl version 1.29.
-## SHA256: 620fd89c02acb0019f1899dab7907db5d20735904f5a9a0d3a8771a5857ac482
+## SHA256: 8944ec6b572b577daee4fc681a425881f841ec2660e4cb5f0eee727f84620697
##
-GlobalSign Root CA
-==================
------BEGIN CERTIFICATE-----
-MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
-GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
-b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
-BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
-VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
-DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
-THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
-Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
-c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
-gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
-HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
-AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
-Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
-j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
-hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
-X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
------END CERTIFICATE-----
-
-Entrust.net Premium 2048 Secure Server CA
-=========================================
------BEGIN CERTIFICATE-----
-MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
-ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
-bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
-BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
-NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
-d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
-MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
-ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
-MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
-Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
-hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
-nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
-VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E
-BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ
-KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy
-T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
-zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT
-J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e
-nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE=
------END CERTIFICATE-----
-
-Baltimore CyberTrust Root
-=========================
------BEGIN CERTIFICATE-----
-MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
-ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
-ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
-SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
-dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
-uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
-UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
-G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
-XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
-l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
-VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
-BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
-cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
-hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
-Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
-RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
------END CERTIFICATE-----
-
Entrust Root Certification Authority
====================================
-----BEGIN CERTIFICATE-----
@@ -172,30 +106,6 @@ W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
-----END CERTIFICATE-----
-Comodo AAA Services root
-========================
------BEGIN CERTIFICATE-----
-MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
-R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
-TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
-MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
-c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
-BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
-ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
-C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
-i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
-Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
-Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
-Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
-BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
-cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
-LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
-7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
-Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
-8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
-12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
------END CERTIFICATE-----
-
QuoVadis Root CA 2
==================
-----BEGIN CERTIFICATE-----
@@ -262,78 +172,6 @@ vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
-----END CERTIFICATE-----
-XRamp Global CA Root
-====================
------BEGIN CERTIFICATE-----
-MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
-BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
-dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
-dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
-HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
-U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
-dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
-IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
-foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
-zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
-AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
-xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
-EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
-oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
-AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
-/Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
-qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
-nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
-8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
------END CERTIFICATE-----
-
-Go Daddy Class 2 CA
-===================
------BEGIN CERTIFICATE-----
-MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
-VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
-ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
-A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
-RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
-ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
-2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
-qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
-YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
-vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
-BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
-atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
-MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
-A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
-PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
-I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
-HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
-Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
-vZ8=
------END CERTIFICATE-----
-
-Starfield Class 2 CA
-====================
------BEGIN CERTIFICATE-----
-MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
-U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
-Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
-MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
-A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
-SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
-bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
-JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
-epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
-F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
-MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
-hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
-bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
-QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
-afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
-PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
-xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
-KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
-QBFGmh95DmK/D5fs4C8fF5Q=
------END CERTIFICATE-----
-
DigiCert Assured ID Root CA
===========================
-----BEGIN CERTIFICATE-----
diff --git a/src/wp-includes/certificates/cacert.pem b/src/wp-includes/certificates/cacert.pem
index 584af3c0b4..4acd8e5365 100644
--- a/src/wp-includes/certificates/cacert.pem
+++ b/src/wp-includes/certificates/cacert.pem
@@ -1,14 +1,14 @@
##
## Bundle of CA Root Certificates
##
-## Certificate data from Mozilla as of: Tue Feb 25 04:12:03 2025 GMT
+## Certificate data from Mozilla as of: Tue May 20 03:12:02 2025 GMT
##
## Find updated versions here: https://curl.se/docs/caextract.html
##
## This is a bundle of X.509 certificates of public Certificate Authorities
## (CA). These were automatically extracted from Mozilla's root certificates
## file (certdata.txt). This file can be found in the mozilla source tree:
-## https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
+## https://raw.githubusercontent.com/mozilla-firefox/firefox/refs/heads/release/security/nss/lib/ckfw/builtins/certdata.txt
##
## It contains the certificates in PEM format and therefore
## can be directly used with curl / libcurl / php_curl, or with
@@ -16,76 +16,10 @@
## Just configure this file as the SSLCACertificateFile.
##
## Conversion done with mk-ca-bundle.pl version 1.29.
-## SHA256: 620fd89c02acb0019f1899dab7907db5d20735904f5a9a0d3a8771a5857ac482
+## SHA256: 8944ec6b572b577daee4fc681a425881f841ec2660e4cb5f0eee727f84620697
##
-GlobalSign Root CA
-==================
------BEGIN CERTIFICATE-----
-MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
-GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
-b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
-BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
-VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
-DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
-THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
-Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
-c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
-gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
-HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
-AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
-Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
-j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
-hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
-X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
------END CERTIFICATE-----
-
-Entrust.net Premium 2048 Secure Server CA
-=========================================
------BEGIN CERTIFICATE-----
-MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
-ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
-bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
-BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
-NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
-d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
-MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
-ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
-MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
-Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
-hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
-nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
-VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E
-BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ
-KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy
-T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
-zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT
-J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e
-nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE=
------END CERTIFICATE-----
-
-Baltimore CyberTrust Root
-=========================
------BEGIN CERTIFICATE-----
-MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
-ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
-ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
-SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
-dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
-uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
-UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
-G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
-XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
-l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
-VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
-BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
-cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
-hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
-Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
-RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
------END CERTIFICATE-----
-
Entrust Root Certification Authority
====================================
-----BEGIN CERTIFICATE-----
@@ -112,30 +46,6 @@ W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
-----END CERTIFICATE-----
-Comodo AAA Services root
-========================
------BEGIN CERTIFICATE-----
-MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
-R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
-TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
-MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
-c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
-BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
-ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
-C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
-i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
-Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
-Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
-Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
-BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
-cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
-LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
-7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
-Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
-8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
-12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
------END CERTIFICATE-----
-
QuoVadis Root CA 2
==================
-----BEGIN CERTIFICATE-----
@@ -202,78 +112,6 @@ vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
-----END CERTIFICATE-----
-XRamp Global CA Root
-====================
------BEGIN CERTIFICATE-----
-MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
-BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
-dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
-dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
-HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
-U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
-dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
-IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
-foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
-zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
-AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
-xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
-EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
-oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
-AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
-/Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
-qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
-nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
-8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
------END CERTIFICATE-----
-
-Go Daddy Class 2 CA
-===================
------BEGIN CERTIFICATE-----
-MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
-VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
-ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
-A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
-RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
-ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
-2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
-qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
-YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
-vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
-BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
-atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
-MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
-A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
-PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
-I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
-HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
-Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
-vZ8=
------END CERTIFICATE-----
-
-Starfield Class 2 CA
-====================
------BEGIN CERTIFICATE-----
-MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
-U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
-Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
-MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
-A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
-SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
-bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
-JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
-epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
-F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
-MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
-hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
-bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
-QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
-afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
-PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
-xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
-KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
-QBFGmh95DmK/D5fs4C8fF5Q=
------END CERTIFICATE-----
-
DigiCert Assured ID Root CA
===========================
-----BEGIN CERTIFICATE-----
diff --git a/src/wp-includes/class-wp-block-list.php b/src/wp-includes/class-wp-block-list.php
index e1151e6745..81f01eb0ca 100644
--- a/src/wp-includes/class-wp-block-list.php
+++ b/src/wp-includes/class-wp-block-list.php
@@ -19,7 +19,6 @@ class WP_Block_List implements Iterator, ArrayAccess, Countable {
*
* @since 5.5.0
* @var array[]|WP_Block[]
- * @access protected
*/
protected $blocks;
@@ -28,7 +27,6 @@ class WP_Block_List implements Iterator, ArrayAccess, Countable {
*
* @since 5.5.0
* @var array
- * @access protected
*/
protected $available_context;
@@ -37,7 +35,6 @@ class WP_Block_List implements Iterator, ArrayAccess, Countable {
*
* @since 5.5.0
* @var WP_Block_Type_Registry
- * @access protected
*/
protected $registry;
diff --git a/src/wp-includes/class-wp-block-pattern-categories-registry.php b/src/wp-includes/class-wp-block-pattern-categories-registry.php
index 3d37a5940a..2d5fbcf2fe 100644
--- a/src/wp-includes/class-wp-block-pattern-categories-registry.php
+++ b/src/wp-includes/class-wp-block-pattern-categories-registry.php
@@ -107,7 +107,7 @@ final class WP_Block_Pattern_Categories_Registry {
* @since 5.5.0
*
* @param string $category_name Pattern category name including namespace.
- * @return array Registered pattern properties.
+ * @return array|null Registered pattern properties, or `null` if the pattern category is not registered.
*/
public function get_registered( $category_name ) {
if ( ! $this->is_registered( $category_name ) ) {
diff --git a/src/wp-includes/class-wp-block-patterns-registry.php b/src/wp-includes/class-wp-block-patterns-registry.php
index 3b5f053bfd..2afa8a853f 100644
--- a/src/wp-includes/class-wp-block-patterns-registry.php
+++ b/src/wp-includes/class-wp-block-patterns-registry.php
@@ -188,7 +188,7 @@ final class WP_Block_Patterns_Registry {
* @since 5.5.0
*
* @param string $pattern_name Block pattern name including namespace.
- * @return array Registered pattern properties.
+ * @return array|null Registered pattern properties or `null` if the pattern is not registered.
*/
public function get_registered( $pattern_name ) {
if ( ! $this->is_registered( $pattern_name ) ) {
diff --git a/src/wp-includes/class-wp-block-styles-registry.php b/src/wp-includes/class-wp-block-styles-registry.php
index 9a990173b4..8fb5e2eb23 100644
--- a/src/wp-includes/class-wp-block-styles-registry.php
+++ b/src/wp-includes/class-wp-block-styles-registry.php
@@ -140,7 +140,7 @@ final class WP_Block_Styles_Registry {
*
* @param string $block_name Block type name including namespace.
* @param string $block_style_name Block style name.
- * @return array Registered block style properties.
+ * @return array|null Registered block style properties or `null` if the block style is not registered.
*/
public function get_registered( $block_name, $block_style_name ) {
if ( ! $this->is_registered( $block_name, $block_style_name ) ) {
diff --git a/src/wp-includes/class-wp-block.php b/src/wp-includes/class-wp-block.php
index d8fb177ebb..e3b97f6501 100644
--- a/src/wp-includes/class-wp-block.php
+++ b/src/wp-includes/class-wp-block.php
@@ -54,7 +54,6 @@ class WP_Block {
*
* @since 5.5.0
* @var array
- * @access protected
*/
protected $available_context = array();
@@ -63,7 +62,6 @@ class WP_Block {
*
* @since 5.9.0
* @var WP_Block_Type_Registry
- * @access protected
*/
protected $registry;
diff --git a/src/wp-includes/class-wp-classic-to-block-menu-converter.php b/src/wp-includes/class-wp-classic-to-block-menu-converter.php
index 6430aab6fa..b3cc819904 100644
--- a/src/wp-includes/class-wp-classic-to-block-menu-converter.php
+++ b/src/wp-includes/class-wp-classic-to-block-menu-converter.php
@@ -10,7 +10,6 @@
* Converts a Classic Menu to Block Menu blocks.
*
* @since 6.3.0
- * @access public
*/
class WP_Classic_To_Block_Menu_Converter {
diff --git a/src/wp-includes/class-wp-comment-query.php b/src/wp-includes/class-wp-comment-query.php
index 6a72c0d209..03d3479b6c 100644
--- a/src/wp-includes/class-wp-comment-query.php
+++ b/src/wp-includes/class-wp-comment-query.php
@@ -579,9 +579,7 @@ class WP_Comment_Query {
}
}
- if ( ! empty( $status_clauses ) ) {
- $approved_clauses[] = '( ' . implode( ' OR ', $status_clauses ) . ' )';
- }
+ $approved_clauses[] = '( ' . implode( ' OR ', $status_clauses ) . ' )';
}
// User IDs or emails whose unapproved comments are included, regardless of $status.
diff --git a/src/wp-includes/class-wp-customize-widgets.php b/src/wp-includes/class-wp-customize-widgets.php
index 3db46ad088..b24a9c8b47 100644
--- a/src/wp-includes/class-wp-customize-widgets.php
+++ b/src/wp-includes/class-wp-customize-widgets.php
@@ -921,10 +921,12 @@ final class WP_Customize_Widgets {
</button>
<h3>
<span class="customize-action">
- <?php
+ <?php
+ $panel = $this->manager->get_panel( 'widgets' );
+ $panel_title = isset( $panel->title ) ? $panel->title : __( 'Widgets' );
/* translators: &#9656; is the unicode right-pointing triangle. %s: Section title in the Customizer. */
- printf( __( 'Customizing &#9656; %s' ), esc_html( $this->manager->get_panel( 'widgets' )->title ) );
- ?>
+ printf( __( 'Customizing &#9656; %s' ), esc_html( $panel_title ) );
+ ?>
</span>
<?php _e( 'Add a Widget' ); ?>
</h3>
diff --git a/src/wp-includes/class-wp-image-editor-imagick.php b/src/wp-includes/class-wp-image-editor-imagick.php
index 66085ac503..f57e6f281f 100644
--- a/src/wp-includes/class-wp-image-editor-imagick.php
+++ b/src/wp-includes/class-wp-image-editor-imagick.php
@@ -305,7 +305,7 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
* image operations within the time of the HTTP request.
*
* @since 6.2.0
- * @since 6.3.0 This method was deprecated.
+ * @deprecated 6.3.0 No longer used in core.
*
* @return int|null The new limit on success, null on failure.
*/
@@ -484,37 +484,28 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
$this->image->setOption( 'png:compression-filter', '5' );
$this->image->setOption( 'png:compression-level', '9' );
$this->image->setOption( 'png:compression-strategy', '1' );
- // Check to see if a PNG is indexed, and find the pixel depth.
- if ( is_callable( array( $this->image, 'getImageDepth' ) ) ) {
- $indexed_pixel_depth = $this->image->getImageDepth();
-
- // Indexed PNG files get some additional handling.
- if ( 0 < $indexed_pixel_depth && 8 >= $indexed_pixel_depth ) {
- // Check for an alpha channel.
- if (
- is_callable( array( $this->image, 'getImageAlphaChannel' ) )
- && $this->image->getImageAlphaChannel()
- ) {
- $this->image->setOption( 'png:include-chunk', 'tRNS' );
- } else {
- $this->image->setOption( 'png:exclude-chunk', 'all' );
- }
-
- // Reduce colors in the images to maximum needed, using the global colorspace.
- $max_colors = pow( 2, $indexed_pixel_depth );
- if ( is_callable( array( $this->image, 'getImageColors' ) ) ) {
- $current_colors = $this->image->getImageColors();
- $max_colors = min( $max_colors, $current_colors );
- }
- $this->image->quantizeImage( $max_colors, $this->image->getColorspace(), 0, false, false );
-
- /**
- * If the colorspace is 'gray', use the png8 format to ensure it stays indexed.
- */
- if ( Imagick::COLORSPACE_GRAY === $this->image->getImageColorspace() ) {
- $this->image->setOption( 'png:format', 'png8' );
- }
+
+ // Indexed PNG files get some additional handling.
+ // See #63448 for details.
+ if (
+ is_callable( array( $this->image, 'getImageProperty' ) )
+ && '3' === $this->image->getImageProperty( 'png:IHDR.color-type-orig' )
+ ) {
+
+ // Check for an alpha channel.
+ if (
+ is_callable( array( $this->image, 'getImageAlphaChannel' ) )
+ && $this->image->getImageAlphaChannel()
+ ) {
+ $this->image->setOption( 'png:include-chunk', 'tRNS' );
+ } else {
+ $this->image->setOption( 'png:exclude-chunk', 'all' );
}
+ // Set the image format to Indexed PNG.
+ $this->image->setOption( 'png:format', 'png8' );
+
+ } else {
+ $this->image->setOption( 'png:exclude-chunk', 'all' );
}
}
diff --git a/src/wp-includes/class-wp-navigation-fallback.php b/src/wp-includes/class-wp-navigation-fallback.php
index 59fe023d80..573ab27f34 100644
--- a/src/wp-includes/class-wp-navigation-fallback.php
+++ b/src/wp-includes/class-wp-navigation-fallback.php
@@ -12,7 +12,6 @@
/**
* Manages fallback behavior for Navigation menus.
*
- * @access public
* @since 6.3.0
*/
class WP_Navigation_Fallback {
diff --git a/src/wp-includes/class-wp-oembed.php b/src/wp-includes/class-wp-oembed.php
index 2d59c2217d..8d153c8fa0 100644
--- a/src/wp-includes/class-wp-oembed.php
+++ b/src/wp-includes/class-wp-oembed.php
@@ -89,7 +89,6 @@ class WP_oEmbed {
'#https?://videopress\.com/v/.*#' => array( 'https://public-api.wordpress.com/oembed/?for=' . $host, true ),
'#https?://(www\.)?reddit\.com/r/[^/]+/comments/.*#i' => array( 'https://www.reddit.com/oembed', true ),
'#https?://(www\.)?speakerdeck\.com/.*#i' => array( 'https://speakerdeck.com/oembed.{format}', true ),
- '#https?://(www\.)?screencast\.com/.*#i' => array( 'https://api.screencast.com/external/oembed', true ),
'#https?://([a-z0-9-]+\.)?amazon\.(com|com\.mx|com\.br|ca)/.*#i' => array( 'https://read.amazon.com/kp/api/oembed', true ),
'#https?://([a-z0-9-]+\.)?amazon\.(co\.uk|de|fr|it|es|in|nl|ru)/.*#i' => array( 'https://read.amazon.co.uk/kp/api/oembed', true ),
'#https?://([a-z0-9-]+\.)?amazon\.(co\.jp|com\.au)/.*#i' => array( 'https://read.amazon.com.au/kp/api/oembed', true ),
@@ -216,6 +215,7 @@ class WP_oEmbed {
* | Meetup.com | meetup.com | 3.9.0 | 6.0.1 |
* | Meetup.com | meetu.ps | 3.9.0 | 6.0.1 |
* | SlideShare | slideshare.net | 3.5.0 | 6.6.0 |
+ * | Screencast | screencast.com | 4.8.0 | 6.8.2 |
*
* @see wp_oembed_add_provider()
*
@@ -739,9 +739,9 @@ class WP_oEmbed {
*
* @since 2.9.0
*
- * @param string $return The returned oEmbed HTML.
- * @param object $data A data object result from an oEmbed provider.
- * @param string $url The URL of the content to be embedded.
+ * @param string|false $return The returned oEmbed HTML, or false on failure.
+ * @param object $data A data object result from an oEmbed provider.
+ * @param string $url The URL of the content to be embedded.
*/
return apply_filters( 'oembed_dataparse', $return, $data, $url );
}
@@ -752,10 +752,10 @@ class WP_oEmbed {
* @since 2.9.0 as strip_scribd_newlines()
* @since 3.0.0
*
- * @param string $html Existing HTML.
- * @param object $data Data object from WP_oEmbed::data2html()
- * @param string $url The original URL passed to oEmbed.
- * @return string Possibly modified $html
+ * @param string|false $html Existing HTML.
+ * @param object $data Data object from WP_oEmbed::data2html()
+ * @param string $url The original URL passed to oEmbed.
+ * @return string|false Possibly modified $html.
*/
public function _strip_newlines( $html, $data, $url ) {
if ( ! str_contains( $html, "\n" ) ) {
diff --git a/src/wp-includes/class-wp-phpmailer.php b/src/wp-includes/class-wp-phpmailer.php
index c3f9f3088e..ce71eec458 100644
--- a/src/wp-includes/class-wp-phpmailer.php
+++ b/src/wp-includes/class-wp-phpmailer.php
@@ -67,7 +67,7 @@ class WP_PHPMailer extends PHPMailer\PHPMailer\PHPMailer {
'invalid_address' => __( 'Invalid address: ' ),
'invalid_header' => __( 'Invalid header name or value' ),
/* translators: There is a space after the colon. */
- 'invalid_hostentry' => __( 'Invalid hostentry: ' ),
+ 'invalid_hostentry' => __( 'Invalid host entry: ' ),
/* translators: There is a space after the colon. */
'invalid_host' => __( 'Invalid host: ' ),
/* translators: There is a space at the beginning. */
diff --git a/src/wp-includes/class-wp-roles.php b/src/wp-includes/class-wp-roles.php
index 95e08e6dc7..0b94e0f959 100644
--- a/src/wp-includes/class-wp-roles.php
+++ b/src/wp-includes/class-wp-roles.php
@@ -143,16 +143,34 @@ class WP_Roles {
*
* Updates the list of roles, if the role doesn't already exist.
*
- * The capabilities are defined in the following format: `array( 'read' => true )`.
- * To explicitly deny the role a capability, set the value for that capability to false.
+ * The list of capabilities can be passed either as a numerically indexed array of capability names, or an
+ * associative array of boolean values keyed by the capability name. To explicitly deny the role a capability, set
+ * the value for that capability to false.
+ *
+ * Examples:
+ *
+ * // Add a role that can edit posts.
+ * wp_roles()->add_role( 'custom_role', 'Custom Role', array(
+ * 'read',
+ * 'edit_posts',
+ * ) );
+ *
+ * Or, using an associative array:
+ *
+ * // Add a role that can edit posts but explicitly cannot not delete them.
+ * wp_roles()->add_role( 'custom_role', 'Custom Role', array(
+ * 'read' => true,
+ * 'edit_posts' => true,
+ * 'delete_posts' => false,
+ * ) );
*
* @since 2.0.0
+ * @since x.y.z Support was added for a numerically indexed array of strings for the capabilities array.
*
- * @param string $role Role name.
- * @param string $display_name Role display name.
- * @param bool[] $capabilities Optional. List of capabilities keyed by the capability name,
- * e.g. `array( 'edit_posts' => true, 'delete_posts' => false )`.
- * Default empty array.
+ * @param string $role Role name.
+ * @param string $display_name Role display name.
+ * @param array<string,bool>|array<int,string> $capabilities Capabilities to be added to the role.
+ * Default empty array.
* @return WP_Role|void WP_Role object, if the role is added.
*/
public function add_role( $role, $display_name, $capabilities = array() ) {
@@ -160,6 +178,10 @@ class WP_Roles {
return;
}
+ if ( wp_is_numeric_array( $capabilities ) ) {
+ $capabilities = array_fill_keys( $capabilities, true );
+ }
+
$this->roles[ $role ] = array(
'name' => $display_name,
'capabilities' => $capabilities,
diff --git a/src/wp-includes/class-wp-site.php b/src/wp-includes/class-wp-site.php
index fcd07cd5e3..715585316c 100644
--- a/src/wp-includes/class-wp-site.php
+++ b/src/wp-includes/class-wp-site.php
@@ -126,7 +126,7 @@ final class WP_Site {
public $spam = '0';
/**
- * Whether the site should be treated as deleted.
+ * Whether the site should be treated as flagged for deletion.
*
* A numeric string, for compatibility reasons.
*
diff --git a/src/wp-includes/class-wp-tax-query.php b/src/wp-includes/class-wp-tax-query.php
index 5a489f5662..c6ec3258cc 100644
--- a/src/wp-includes/class-wp-tax-query.php
+++ b/src/wp-includes/class-wp-tax-query.php
@@ -44,7 +44,7 @@ class WP_Tax_Query {
* Standard response when the query should not return any rows.
*
* @since 3.2.0
- * @var string
+ * @var array<string, array<string>>
*/
private static $no_results = array(
'join' => array( '' ),
diff --git a/src/wp-includes/class-wpdb.php b/src/wp-includes/class-wpdb.php
index c6e6099c26..1aec294317 100644
--- a/src/wp-includes/class-wpdb.php
+++ b/src/wp-includes/class-wpdb.php
@@ -43,7 +43,7 @@ define( 'ARRAY_N', 'ARRAY_N' );
* By default, WordPress uses this class to instantiate the global $wpdb object, providing
* access to the WordPress database.
*
- * It is possible to replace this class with your own by setting the $wpdb global variable
+ * It is possible to replace the global instance with your own by setting the $wpdb global variable
* in wp-content/db.php file to your class. The wpdb class will still be included, so you can
* extend it or simply use your own.
*
@@ -237,7 +237,6 @@ class wpdb {
* WordPress table prefix.
*
* You can set this to have multiple WordPress installations in a single database.
- * The second reason is for possible security precautions.
*
* @since 2.5.0
*
@@ -941,7 +940,7 @@ class wpdb {
/**
* Changes the current SQL mode, and ensures its WordPress compatibility.
*
- * If no modes are passed, it will ensure the current MySQL server modes are compatible.
+ * If no modes are passed, it will ensure the current SQL server modes are compatible.
*
* @since 3.9.0
*
@@ -1369,7 +1368,7 @@ class wpdb {
}
/**
- * Quotes an identifier for a MySQL database, e.g. table/field names.
+ * Quotes an identifier such as a table or field name.
*
* @since 6.2.0
*
@@ -1435,6 +1434,13 @@ class wpdb {
* 'foo'
* );
*
+ * $wpdb->prepare(
+ * "SELECT * FROM %i WHERE %i = %s",
+ * $table,
+ * $field,
+ * $value
+ * );
+ *
* @since 2.3.0
* @since 5.3.0 Formalized the existing and already documented `...$args` parameter
* by updating the function signature. The second parameter was changed
@@ -1957,7 +1963,7 @@ class wpdb {
$client_flags = defined( 'MYSQL_CLIENT_FLAGS' ) ? MYSQL_CLIENT_FLAGS : 0;
/*
- * Set the MySQLi error reporting off because WordPress handles its own.
+ * Switch error reporting off because WordPress handles its own.
* This is due to the default value change from `MYSQLI_REPORT_OFF`
* to `MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT` in PHP 8.1.
*/
@@ -2100,7 +2106,7 @@ class wpdb {
}
$host = ! empty( $matches['host'] ) ? $matches['host'] : '';
- // MySQLi port cannot be a string; must be null or an integer.
+ // Port cannot be a string; must be null or an integer.
$port = ! empty( $matches['port'] ) ? absint( $matches['port'] ) : null;
return array( $host, $port, $socket, $is_ipv6 );
@@ -2290,7 +2296,7 @@ class wpdb {
if ( $this->dbh instanceof mysqli ) {
$this->last_error = mysqli_error( $this->dbh );
} else {
- $this->last_error = __( 'Unable to retrieve the error message from MySQL' );
+ $this->last_error = __( 'Unable to retrieve the error message from the database server' );
}
if ( $this->last_error ) {
@@ -2866,8 +2872,12 @@ class wpdb {
* @return array {
* Array of values and formats keyed by their field names.
*
- * @type mixed $value The value to be formatted.
- * @type string $format The format to be mapped to the value.
+ * @type array ...$0 {
+ * Value and format for this field.
+ *
+ * @type mixed $value The value to be formatted.
+ * @type string $format The format to be mapped to the value.
+ * }
* }
*/
protected function process_field_formats( $data, $format ) {
@@ -3469,7 +3479,7 @@ class wpdb {
}
/**
- * Checks if the query is accessing a collation considered safe on the current version of MySQL.
+ * Checks if the query is accessing a collation considered safe.
*
* @since 4.2.0
*
@@ -3983,11 +3993,11 @@ class wpdb {
}
/**
- * Determines whether MySQL database is at least the required minimum version.
+ * Determines whether the database server is at least the required minimum version.
*
* @since 2.5.0
*
- * @global string $required_mysql_version The required MySQL version string.
+ * @global string $required_mysql_version The minimum required MySQL version string.
* @return void|WP_Error
*/
public function check_database_version() {
@@ -4043,7 +4053,7 @@ class wpdb {
*
* Capability sniffs for the database server and current version of WPDB.
*
- * Database sniffs are based on the version of MySQL the site is using.
+ * Database sniffs are based on the version of the database server in use.
*
* WPDB sniffs are added as new features are introduced to allow theme and plugin
* developers to determine feature support. This is to account for drop-ins which may
@@ -4115,7 +4125,7 @@ class wpdb {
}
/**
- * Retrieves the database server version.
+ * Retrieves the database server version number.
*
* @since 2.7.0
*
@@ -4126,11 +4136,11 @@ class wpdb {
}
/**
- * Returns the version of the MySQL server.
+ * Returns the raw version string of the database server.
*
* @since 5.5.0
*
- * @return string Server version as a string.
+ * @return string Database server version as a string.
*/
public function db_server_info() {
return mysqli_get_server_info( $this->dbh );
diff --git a/src/wp-includes/comment-template.php b/src/wp-includes/comment-template.php
index 9190cf6eff..59f89f3a84 100644
--- a/src/wp-includes/comment-template.php
+++ b/src/wp-includes/comment-template.php
@@ -834,12 +834,8 @@ function get_comment_link( $comment = null, $args = array() ) {
if ( $cpage && get_option( 'page_comments' ) ) {
if ( $wp_rewrite->using_permalinks() ) {
- if ( $cpage ) {
- $comment_link = trailingslashit( $comment_link ) . $wp_rewrite->comments_pagination_base . '-' . $cpage;
- }
-
- $comment_link = user_trailingslashit( $comment_link, 'comment' );
- } elseif ( $cpage ) {
+ $comment_link = trailingslashit( $comment_link ) . $wp_rewrite->comments_pagination_base . '-' . $cpage;
+ } else {
$comment_link = add_query_arg( 'cpage', $cpage, $comment_link );
}
}
@@ -1754,7 +1750,7 @@ function comments_popup_link( $zero = false, $one = false, $more = false, $css_c
* @param int|WP_Comment $comment Optional. Comment being replied to. Default current comment.
* @param int|WP_Post $post Optional. Post ID or WP_Post object the comment is going to be displayed on.
* Default current post.
- * @return string|false|null Link to show comment form, if successful. False, if comments are closed.
+ * @return string|false|null Link to show comment form on success. False if comments are closed. Null on failure.
*/
function get_comment_reply_link( $args = array(), $comment = null, $post = null ) {
$defaults = array(
@@ -1777,13 +1773,13 @@ function get_comment_reply_link( $args = array(), $comment = null, $post = null
$args['depth'] = (int) $args['depth'];
if ( 0 === $args['depth'] || $args['max_depth'] <= $args['depth'] ) {
- return;
+ return null;
}
$comment = get_comment( $comment );
if ( empty( $comment ) ) {
- return;
+ return null;
}
if ( empty( $post ) ) {
@@ -1911,9 +1907,9 @@ function comment_reply_link( $args = array(), $comment = null, $post = null ) {
* @type string $before Text or HTML to add before the reply link. Default empty.
* @type string $after Text or HTML to add after the reply link. Default empty.
* }
- * @param int|WP_Post $post Optional. Post ID or WP_Post object the comment is going to be displayed on.
- * Default current post.
- * @return string|false|null Link to show comment form, if successful. False, if comments are closed.
+ * @param int|WP_Post $post Optional. Post ID or WP_Post object the comment is going to be displayed on.
+ * Default current post.
+ * @return string|false Link to show comment form on success. False if comments are closed.
*/
function get_post_reply_link( $args = array(), $post = null ) {
$defaults = array(
@@ -2095,8 +2091,8 @@ function comment_id_fields( $post = null ) {
*
* Only affects users with JavaScript disabled.
*
- * @internal The $comment global must be present to allow template tags access to the current
- * comment. See https://core.trac.wordpress.org/changeset/36512.
+ * {@internal The $comment global must be present to allow template tags access to the current
+ * comment. See https://core.trac.wordpress.org/changeset/36512.}
*
* @since 2.7.0
* @since 6.2.0 Added the `$post` parameter.
@@ -2446,6 +2442,7 @@ function wp_list_comments( $args = array(), $comments = null ) {
* @since 4.6.0 Introduced the 'action' argument.
* @since 4.9.6 Introduced the 'cookies' default comment field.
* @since 5.5.0 Introduced the 'class_container' argument.
+ * @since 6.8.2 Introduced the 'novalidate' argument.
*
* @param array $args {
* Optional. Default arguments and form fields to override.
@@ -2467,6 +2464,7 @@ function wp_list_comments( $args = array(), $comments = null ) {
* Default 'Your email address will not be published.'.
* @type string $comment_notes_after HTML element for a message displayed after the textarea field.
* @type string $action The comment form element action attribute. Default '/wp-comments-post.php'.
+ * @type bool $novalidate Whether the novalidate attribute is added to the comment form. Default false.
* @type string $id_form The comment form element id attribute. Default 'commentform'.
* @type string $id_submit The comment submit element id attribute. Default 'submit'.
* @type string $class_container The comment form container class attribute. Default 'comment-respond'.
@@ -2646,6 +2644,7 @@ function comment_form( $args = array(), $post = null ) {
),
'comment_notes_after' => '',
'action' => site_url( '/wp-comments-post.php' ),
+ 'novalidate' => false,
'id_form' => 'commentform',
'id_submit' => 'submit',
'class_container' => 'comment-respond',
@@ -2729,7 +2728,7 @@ function comment_form( $args = array(), $post = null ) {
esc_url( $args['action'] ),
esc_attr( $args['id_form'] ),
esc_attr( $args['class_form'] ),
- ( $html5 ? ' novalidate' : '' )
+ ( $args['novalidate'] ? ' novalidate' : '' )
);
/**
diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php
index d0a7743c0e..aabe9f60db 100644
--- a/src/wp-includes/comment.php
+++ b/src/wp-includes/comment.php
@@ -446,6 +446,8 @@ function get_comment_count( $post_id = 0 ) {
/**
* Adds meta data field to a comment.
*
+ * For historical reasons both the meta key and the meta value are expected to be "slashed" (slashes escaped) on input.
+ *
* @since 2.9.0
*
* @link https://developer.wordpress.org/reference/functions/add_comment_meta/
@@ -474,6 +476,8 @@ function add_comment_meta( $comment_id, $meta_key, $meta_value, $unique = false
* value, will keep from removing duplicate metadata with the same key. It also
* allows removing all metadata matching key, if needed.
*
+ * For historical reasons both the meta key and the meta value are expected to be "slashed" (slashes escaped) on input.
+ *
* @since 2.9.0
*
* @link https://developer.wordpress.org/reference/functions/delete_comment_meta/
@@ -540,6 +544,8 @@ function wp_lazyload_comment_meta( array $comment_ids ) {
*
* If the meta field for the comment does not exist, it will be added.
*
+ * For historical reasons both the meta key and the meta value are expected to be "slashed" (slashes escaped) on input.
+ *
* @since 2.9.0
*
* @link https://developer.wordpress.org/reference/functions/update_comment_meta/
@@ -926,8 +932,8 @@ function wp_check_comment_flood( $is_flood, $ip, $email, $date, $avoid_die = fal
*
* @since 2.7.0
*
- * @param WP_Comment[] $comments Array of comments
- * @return WP_Comment[] Array of comments keyed by comment_type.
+ * @param WP_Comment[] $comments Array of comments.
+ * @return array<string, WP_Comment[]> Array of comments keyed by comment type.
*/
function separate_comments( &$comments ) {
$comments_by_type = array(
@@ -1044,7 +1050,7 @@ function get_page_of_comment( $comment_id, $args = array() ) {
$comment = get_comment( $comment_id );
if ( ! $comment ) {
- return;
+ return null;
}
$defaults = array(
@@ -3054,22 +3060,19 @@ function do_trackbacks( $post ) {
$post_title = apply_filters( 'the_title', $post->post_title, $post->ID );
$post_title = strip_tags( $post_title );
- if ( $to_ping ) {
- foreach ( (array) $to_ping as $tb_ping ) {
- $tb_ping = trim( $tb_ping );
- if ( ! in_array( $tb_ping, $pinged, true ) ) {
- trackback( $tb_ping, $post_title, $excerpt, $post->ID );
- $pinged[] = $tb_ping;
- } else {
- $wpdb->query(
- $wpdb->prepare(
- "UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, %s,
- '')) WHERE ID = %d",
- $tb_ping,
- $post->ID
- )
- );
- }
+ foreach ( (array) $to_ping as $tb_ping ) {
+ $tb_ping = trim( $tb_ping );
+ if ( ! in_array( $tb_ping, $pinged, true ) ) {
+ trackback( $tb_ping, $post_title, $excerpt, $post->ID );
+ $pinged[] = $tb_ping;
+ } else {
+ $wpdb->query(
+ $wpdb->prepare(
+ "UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, %s, '')) WHERE ID = %d",
+ $tb_ping,
+ $post->ID
+ )
+ );
}
}
}
@@ -3430,9 +3433,9 @@ function _prime_comment_caches( $comment_ids, $update_meta_cache = true ) {
* @since 2.7.0
* @access private
*
- * @param WP_Post $posts Post data object.
- * @param WP_Query $query Query object.
- * @return array
+ * @param WP_Post[] $posts Array of post objects.
+ * @param WP_Query $query Query object.
+ * @return WP_Post[]
*/
function _close_comments_for_old_posts( $posts, $query ) {
if ( empty( $posts ) || ! $query->is_singular() || ! get_option( 'close_comments_for_old_posts' ) ) {
diff --git a/src/wp-includes/compat.php b/src/wp-includes/compat.php
index fc6db436fe..f0bdf07974 100644
--- a/src/wp-includes/compat.php
+++ b/src/wp-includes/compat.php
@@ -13,6 +13,16 @@
// If gettext isn't available.
if ( ! function_exists( '_' ) ) {
+ /**
+ * Compat function to mimic _(), an alias of gettext().
+ *
+ * @since 0.71
+ *
+ * @see https://php.net/manual/en/function.gettext.php
+ *
+ * @param string $message The message being translated.
+ * @return string
+ */
function _( $message ) {
return $message;
}
diff --git a/src/wp-includes/css/wp-embed-template.css b/src/wp-includes/css/wp-embed-template.css
index b5a482b737..7b86fdd3d3 100644
--- a/src/wp-includes/css/wp-embed-template.css
+++ b/src/wp-includes/css/wp-embed-template.css
@@ -39,15 +39,15 @@ body {
}
.dashicons-admin-comments {
- background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M5%202h9q.82%200%201.41.59T16%204v7q0%20.82-.59%201.41T14%2013h-2l-5%205v-5H5q-.82%200-1.41-.59T3%2011V4q0-.82.59-1.41T5%202z%27%20fill%3D%27%2382878c%27%2F%3E%3C%2Fsvg%3E");
+ background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M5%202h9q.82%200%201.41.59T16%204v7q0%20.82-.59%201.41T14%2013h-2l-5%205v-5H5q-.82%200-1.41-.59T3%2011V4q0-.82.59-1.41T5%202z%27%20fill%3D%27%23646970%27%2F%3E%3C%2Fsvg%3E");
}
.wp-embed-comments a:hover .dashicons-admin-comments {
- background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M5%202h9q.82%200%201.41.59T16%204v7q0%20.82-.59%201.41T14%2013h-2l-5%205v-5H5q-.82%200-1.41-.59T3%2011V4q0-.82.59-1.41T5%202z%27%20fill%3D%27%230073aa%27%2F%3E%3C%2Fsvg%3E");
+ background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M5%202h9q.82%200%201.41.59T16%204v7q0%20.82-.59%201.41T14%2013h-2l-5%205v-5H5q-.82%200-1.41-.59T3%2011V4q0-.82.59-1.41T5%202z%27%20fill%3D%27%23135e96%27%2F%3E%3C%2Fsvg%3E");
}
.dashicons-share {
- background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.5%2012q1.24%200%202.12.88T17.5%2015t-.88%202.12-2.12.88-2.12-.88T11.5%2015q0-.34.09-.69l-4.38-2.3Q6.32%2013%205%2013q-1.24%200-2.12-.88T2%2010t.88-2.12T5%207q1.3%200%202.21.99l4.38-2.3q-.09-.35-.09-.69%200-1.24.88-2.12T14.5%202t2.12.88T17.5%205t-.88%202.12T14.5%208q-1.3%200-2.21-.99l-4.38%202.3Q8%209.66%208%2010t-.09.69l4.38%202.3q.89-.99%202.21-.99z%27%20fill%3D%27%2382878c%27%2F%3E%3C%2Fsvg%3E");
+ background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.5%2012q1.24%200%202.12.88T17.5%2015t-.88%202.12-2.12.88-2.12-.88T11.5%2015q0-.34.09-.69l-4.38-2.3Q6.32%2013%205%2013q-1.24%200-2.12-.88T2%2010t.88-2.12T5%207q1.3%200%202.21.99l4.38-2.3q-.09-.35-.09-.69%200-1.24.88-2.12T14.5%202t2.12.88T17.5%205t-.88%202.12T14.5%208q-1.3%200-2.21-.99l-4.38%202.3Q8%209.66%208%2010t-.09.69l4.38%202.3q.89-.99%202.21-.99z%27%20fill%3D%27%23646970%27%2F%3E%3C%2Fsvg%3E");
display: none;
}
@@ -56,7 +56,7 @@ body {
}
.wp-embed-share-dialog-open:hover .dashicons-share {
- background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.5%2012q1.24%200%202.12.88T17.5%2015t-.88%202.12-2.12.88-2.12-.88T11.5%2015q0-.34.09-.69l-4.38-2.3Q6.32%2013%205%2013q-1.24%200-2.12-.88T2%2010t.88-2.12T5%207q1.3%200%202.21.99l4.38-2.3q-.09-.35-.09-.69%200-1.24.88-2.12T14.5%202t2.12.88T17.5%205t-.88%202.12T14.5%208q-1.3%200-2.21-.99l-4.38%202.3Q8%209.66%208%2010t-.09.69l4.38%202.3q.89-.99%202.21-.99z%27%20fill%3D%27%230073aa%27%2F%3E%3C%2Fsvg%3E");
+ background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.5%2012q1.24%200%202.12.88T17.5%2015t-.88%202.12-2.12.88-2.12-.88T11.5%2015q0-.34.09-.69l-4.38-2.3Q6.32%2013%205%2013q-1.24%200-2.12-.88T2%2010t.88-2.12T5%207q1.3%200%202.21.99l4.38-2.3q-.09-.35-.09-.69%200-1.24.88-2.12T14.5%202t2.12.88T17.5%205t-.88%202.12T14.5%208q-1.3%200-2.21-.99l-4.38%202.3Q8%209.66%208%2010t-.09.69l4.38%202.3q.89-.99%202.21-.99z%27%20fill%3D%27%23135e96%27%2F%3E%3C%2Fsvg%3E");
}
.wp-embed {
@@ -65,7 +65,7 @@ body {
font-weight: 400;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
line-height: 1.5;
- color: #8c8f94;
+ color: #646970;
background: #fff;
border: 1px solid #dcdcde;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
@@ -75,7 +75,7 @@ body {
}
.wp-embed a {
- color: #8c8f94;
+ color: #646970;
text-decoration: none;
}
@@ -115,7 +115,8 @@ p.wp-embed-heading {
}
.wp-embed .wp-embed-more {
- color: #c3c4c7;
+ color: #2271b1;
+ text-decoration: underline;
}
.wp-embed-footer {
@@ -163,7 +164,7 @@ p.wp-embed-heading {
.wp-embed-meta a:hover {
text-decoration: none;
- color: #2271b1;
+ color: #135e96;
}
.wp-embed-comments a {
diff --git a/src/wp-includes/embed.php b/src/wp-includes/embed.php
index b5b30acead..c38a079003 100644
--- a/src/wp-includes/embed.php
+++ b/src/wp-includes/embed.php
@@ -765,7 +765,7 @@ function wp_oembed_ensure_format( $format ) {
* @param WP_HTTP_Response $result Result to send to the client. Usually a `WP_REST_Response`.
* @param WP_REST_Request $request Request used to generate the response.
* @param WP_REST_Server $server Server instance.
- * @return true
+ * @return bool True if the request was served, false otherwise.
*/
function _oembed_rest_pre_serve_request( $served, $result, $request, $server ) {
$params = $request->get_params();
@@ -843,10 +843,10 @@ function _oembed_create_xml( $data, $node = null ) {
*
* @since 5.2.0
*
- * @param string $result The oEmbed HTML result.
- * @param object $data A data object result from an oEmbed provider.
- * @param string $url The URL of the content to be embedded.
- * @return string The filtered oEmbed result.
+ * @param string|false $result The oEmbed HTML result.
+ * @param object $data A data object result from an oEmbed provider.
+ * @param string $url The URL of the content to be embedded.
+ * @return string|false The filtered oEmbed result.
*/
function wp_filter_oembed_iframe_title_attribute( $result, $data, $url ) {
if ( false === $result || ! in_array( $data->type, array( 'rich', 'video' ), true ) ) {
@@ -910,10 +910,10 @@ function wp_filter_oembed_iframe_title_attribute( $result, $data, $url ) {
*
* @since 4.4.0
*
- * @param string $result The oEmbed HTML result.
- * @param object $data A data object result from an oEmbed provider.
- * @param string $url The URL of the content to be embedded.
- * @return string The filtered and sanitized oEmbed result.
+ * @param string|false $result The oEmbed HTML result.
+ * @param object $data A data object result from an oEmbed provider.
+ * @param string $url The URL of the content to be embedded.
+ * @return string|false The filtered and sanitized oEmbed result.
*/
function wp_filter_oembed_result( $result, $data, $url ) {
if ( false === $result || ! in_array( $data->type, array( 'rich', 'video' ), true ) ) {
diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php
index 744eefeb82..234d71a2a1 100644
--- a/src/wp-includes/formatting.php
+++ b/src/wp-includes/formatting.php
@@ -2035,7 +2035,17 @@ function sanitize_file_name( $filename ) {
}
if ( $utf8_pcre ) {
- $filename = preg_replace( "#\x{00a0}#siu", ' ', $filename );
+ /**
+ * Replace all whitespace characters with a basic space (U+0020).
+ *
+ * The “Zs” in the pattern selects characters in the `Space_Separator`
+ * category, which is what Unicode considers space characters.
+ *
+ * @see https://www.unicode.org/reports/tr44/#General_Category_Values
+ * @see https://www.unicode.org/versions/Unicode16.0.0/core-spec/chapter-6/#G17548
+ * @see https://www.php.net/manual/en/regexp.reference.unicode.php
+ */
+ $filename = preg_replace( '#\p{Zs}#siu', ' ', $filename );
}
/**
@@ -2551,6 +2561,11 @@ function balanceTags( $text, $force = false ) { // phpcs:ignore WordPress.Namin
/**
* Balances tags of string using a modified stack.
*
+ * {@internal Modified by Scott Reilly (coffee2code) 02 Aug 2004
+ * 1.1 Fixed handling of append/stack pop order of end text
+ * Added Cleaning Hooks
+ * 1.0 First Version}
+ *
* @since 2.0.4
* @since 5.3.0 Improve accuracy and add support for custom element tags.
*
@@ -2559,10 +2574,6 @@ function balanceTags( $text, $force = false ) { // phpcs:ignore WordPress.Namin
* @copyright November 4, 2001
* @version 1.1
* @todo Make better - change loop condition to $text in 1.2
- * @internal Modified by Scott Reilly (coffee2code) 02 Aug 2004
- * 1.1 Fixed handling of append/stack pop order of end text
- * Added Cleaning Hooks
- * 1.0 First Version
*
* @param string $text Text to be balanced.
* @return string Balanced text.
diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php
index 7bb584af7c..09d344dd1e 100644
--- a/src/wp-includes/general-template.php
+++ b/src/wp-includes/general-template.php
@@ -2493,7 +2493,7 @@ function get_calendar( $args = array() ) {
$daysinmonth = (int) gmdate( 't', $unixmonth );
for ( $day = 1; $day <= $daysinmonth; ++$day ) {
- if ( isset( $newrow ) && $newrow ) {
+ if ( $newrow ) {
$calendar_output .= "\n\t</tr>\n\t<tr>\n\t\t";
}
diff --git a/src/wp-includes/kses.php b/src/wp-includes/kses.php
index ebb4a761b1..28bbce222a 100644
--- a/src/wp-includes/kses.php
+++ b/src/wp-includes/kses.php
@@ -2083,18 +2083,38 @@ function wp_kses_normalize_entities3( $matches ) {
/**
* Determines if a Unicode codepoint is valid.
*
+ * The definition of a valid Unicode codepoint is taken from the XML definition:
+ *
+ * > Characters
+ * >
+ * > …
+ * > Legal characters are tab, carriage return, line feed, and the legal characters of
+ * > Unicode and ISO/IEC 10646.
+ * > …
+ * > Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
+ *
* @since 2.7.0
*
+ * @see https://www.w3.org/TR/xml/#charsets
+ *
* @param int $i Unicode codepoint.
* @return bool Whether or not the codepoint is a valid Unicode codepoint.
*/
function valid_unicode( $i ) {
$i = (int) $i;
- return ( 0x9 === $i || 0xa === $i || 0xd === $i ||
- ( 0x20 <= $i && $i <= 0xd7ff ) ||
- ( 0xe000 <= $i && $i <= 0xfffd ) ||
- ( 0x10000 <= $i && $i <= 0x10ffff )
+ return (
+ 0x9 === $i || // U+0009 HORIZONTAL TABULATION (HT)
+ 0xA === $i || // U+000A LINE FEED (LF)
+ 0xD === $i || // U+000D CARRIAGE RETURN (CR)
+ /*
+ * The valid Unicode characters according to the XML specification:
+ *
+ * > any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
+ */
+ ( 0x20 <= $i && $i <= 0xD7FF ) ||
+ ( 0xE000 <= $i && $i <= 0xFFFD ) ||
+ ( 0x10000 <= $i && $i <= 0x10FFFF )
);
}
diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php
index 3e02c17853..cf41630c4a 100644
--- a/src/wp-includes/link-template.php
+++ b/src/wp-includes/link-template.php
@@ -4298,6 +4298,8 @@ function the_shortlink( $text = '', $title = '', $before = '', $after = '' ) {
* - 'monsterid' (a monster)
* - 'wavatar' (a cartoon face)
* - 'identicon' (the "quilt", a geometric pattern)
+ * - 'initials' (initials based avatar with background color)
+ * - 'color' (generated background color)
* - 'mystery', 'mm', or 'mysteryman' (The Oyster Man)
* - 'blank' (transparent GIF)
* - 'gravatar_default' (the Gravatar logo)
@@ -4366,6 +4368,8 @@ function is_avatar_comment_type( $comment_type ) {
* - 'monsterid' (a monster)
* - 'wavatar' (a cartoon face)
* - 'identicon' (the "quilt", a geometric pattern)
+ * - 'initials' (initials based avatar with background color)
+ * - 'color' (generated background color)
* - 'mystery', 'mm', or 'mysteryman' (The Oyster Man)
* - 'blank' (transparent GIF)
* - 'gravatar_default' (the Gravatar logo)
@@ -4545,6 +4549,33 @@ function get_avatar_data( $id_or_email, $args = null ) {
'r' => $args['rating'],
);
+ // Handle additional parameters for the 'initials' avatar type
+ if ( 'initials' === $args['default'] ) {
+ $name = '';
+
+ if ( $user ) {
+ $name = ! empty( $user->display_name ) ? $user->display_name :
+ ( ! empty( $user->first_name ) && ! empty( $user->last_name ) ?
+ $user->first_name . ' ' . $user->last_name : $user->user_login );
+ } elseif ( is_object( $id_or_email ) && isset( $id_or_email->comment_author ) ) {
+ $name = $id_or_email->comment_author;
+ } elseif ( is_string( $id_or_email ) && false !== strpos( $id_or_email, '@' ) ) {
+ $name = str_replace( array( '.', '_', '-' ), ' ', substr( $id_or_email, 0, strpos( $id_or_email, '@' ) ) );
+ }
+
+ if ( ! empty( $name ) ) {
+ if ( preg_match( '/\p{Han}|\p{Hiragana}|\p{Katakana}|\p{Hangul}/u', $name ) || false === strpos( $name, ' ' ) ) {
+ $initials = mb_substr( $name, 0, min( 2, mb_strlen( $name, 'UTF-8' ) ), 'UTF-8' );
+ } else {
+ $first = mb_substr( $name, 0, 1, 'UTF-8' );
+ $last = mb_substr( $name, strrpos( $name, ' ' ) + 1, 1, 'UTF-8' );
+ $initials = $first . $last;
+ }
+
+ $url_args['initials'] = $initials;
+ }
+ }
+
/*
* Gravatars are always served over HTTPS.
*
diff --git a/src/wp-includes/load.php b/src/wp-includes/load.php
index 0526cb175d..e51c322908 100644
--- a/src/wp-includes/load.php
+++ b/src/wp-includes/load.php
@@ -139,15 +139,18 @@ function wp_populate_basic_auth_from_authorization_header() {
}
/**
- * Checks for the required PHP version, and the mysqli extension or
- * a database drop-in.
+ * Checks the server requirements.
+ *
+ * - PHP version
+ * - PHP extensions
+ * - MySQL or MariaDB version (unless a database drop-in is present)
*
* Dies if requirements are not met.
*
* @since 3.0.0
* @access private
*
- * @global string $required_php_version The required PHP version string.
+ * @global string $required_php_version The minimum required PHP version string.
* @global string[] $required_php_extensions The names of required PHP extensions.
* @global string $wp_version The WordPress version string.
*/
diff --git a/src/wp-includes/media-template.php b/src/wp-includes/media-template.php
index 86fe200f8d..4e7592bd74 100644
--- a/src/wp-includes/media-template.php
+++ b/src/wp-includes/media-template.php
@@ -443,7 +443,7 @@ function wp_print_media_templates() {
?>
</h2>
<div class="uploaded"><strong><?php _e( 'Uploaded on:' ); ?></strong> {{ data.dateFormatted }}</div>
- <div class="uploaded-by">
+ <div class="uploaded-by word-wrap-break-word">
<strong><?php _e( 'Uploaded by:' ); ?></strong>
<# if ( data.authorLink ) { #>
<a href="{{ data.authorLink }}">{{ data.authorName }}</a>
@@ -605,7 +605,7 @@ function wp_print_media_templates() {
<div class="centered">
<# if ( data.image && data.image.src && data.image.src !== data.icon ) { #>
<img src="{{ data.image.src }}" class="thumbnail" draggable="false" alt="" />
- <# } else if ( data.sizes ) {
+ <# } else if ( data.sizes ) {
if ( data.sizes.medium ) { #>
<img src="{{ data.sizes.medium.url }}" class="thumbnail" draggable="false" alt="" />
<# } else { #>
diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php
index da46ef90a7..5d95b0a188 100644
--- a/src/wp-includes/media.php
+++ b/src/wp-includes/media.php
@@ -2992,9 +2992,6 @@ function wp_underscore_playlist_templates() {
function wp_playlist_scripts( $type ) {
wp_enqueue_style( 'wp-mediaelement' );
wp_enqueue_script( 'wp-playlist' );
- ?>
-<!--[if lt IE 9]><script>document.createElement('<?php echo esc_js( $type ); ?>');</script><![endif]-->
- <?php
add_action( 'wp_footer', 'wp_underscore_playlist_templates', 0 );
add_action( 'admin_footer', 'wp_underscore_playlist_templates', 0 );
}
@@ -3502,14 +3499,7 @@ function wp_audio_shortcode( $attr, $content = '' ) {
}
}
- $html = '';
-
- if ( 'mediaelement' === $library && 1 === $instance ) {
- $html .= "<!--[if lt IE 9]><script>document.createElement('audio');</script><![endif]-->\n";
- }
-
- $html .= sprintf( '<audio %s controls="controls">', implode( ' ', $attr_strings ) );
-
+ $html = sprintf( '<audio %s controls="controls">', implode( ' ', $attr_strings ) );
$fileurl = '';
$source = '<source type="%s" src="%s" />';
@@ -3787,14 +3777,7 @@ function wp_video_shortcode( $attr, $content = '' ) {
}
}
- $html = '';
-
- if ( 'mediaelement' === $library && 1 === $instance ) {
- $html .= "<!--[if lt IE 9]><script>document.createElement('video');</script><![endif]-->\n";
- }
-
- $html .= sprintf( '<video %s controls="controls">', implode( ' ', $attr_strings ) );
-
+ $html = sprintf( '<video %s controls="controls">', implode( ' ', $attr_strings ) );
$fileurl = '';
$source = '<source type="%s" src="%s" />';
diff --git a/src/wp-includes/meta.php b/src/wp-includes/meta.php
index 6982e618c3..d60bf5e875 100644
--- a/src/wp-includes/meta.php
+++ b/src/wp-includes/meta.php
@@ -15,12 +15,14 @@ require ABSPATH . WPINC . '/class-wp-metadata-lazyloader.php';
/**
* Adds metadata for the specified object.
*
+ * For historical reasons both the meta key and the meta value are expected to be "slashed" (slashes escaped) on input.
+ *
* @since 2.9.0
*
* @global wpdb $wpdb WordPress database abstraction object.
*
- * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table.
+ * @param string $meta_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table.
* @param int $object_id ID of the object metadata is for.
* @param string $meta_key Metadata key.
* @param mixed $meta_value Metadata value. Arrays and objects are stored as serialized data and
@@ -65,11 +67,12 @@ function add_metadata( $meta_type, $object_id, $meta_key, $meta_value, $unique =
* Short-circuits adding metadata of a specific type.
*
* The dynamic portion of the hook name, `$meta_type`, refers to the meta object type
- * (post, comment, term, user, or any other type with an associated meta table).
+ * (blog, post, comment, term, user, or any other type with an associated meta table).
* Returning a non-null value will effectively short-circuit the function.
*
* Possible hook names include:
*
+ * - `add_blog_metadata`
* - `add_post_metadata`
* - `add_comment_metadata`
* - `add_term_metadata`
@@ -77,11 +80,12 @@ function add_metadata( $meta_type, $object_id, $meta_key, $meta_value, $unique =
*
* @since 3.1.0
*
- * @param null|bool $check Whether to allow adding metadata for the given type.
- * @param int $object_id ID of the object metadata is for.
- * @param string $meta_key Metadata key.
- * @param mixed $meta_value Metadata value. Must be serializable if non-scalar.
- * @param bool $unique Whether the specified meta key should be unique for the object.
+ * @param null|int|false $check Whether to allow adding metadata for the given type. Return false or a meta ID
+ * to short-circuit the function. Return null to continue with the default behavior.
+ * @param int $object_id ID of the object metadata is for.
+ * @param string $meta_key Metadata key.
+ * @param mixed $meta_value Metadata value. Must be serializable if non-scalar.
+ * @param bool $unique Whether the specified meta key should be unique for the object.
*/
$check = apply_filters( "add_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $unique );
if ( null !== $check ) {
@@ -105,10 +109,11 @@ function add_metadata( $meta_type, $object_id, $meta_key, $meta_value, $unique =
* Fires immediately before meta of a specific type is added.
*
* The dynamic portion of the hook name, `$meta_type`, refers to the meta object type
- * (post, comment, term, user, or any other type with an associated meta table).
+ * (blog, post, comment, term, user, or any other type with an associated meta table).
*
* Possible hook names include:
*
+ * - `add_blog_meta`
* - `add_post_meta`
* - `add_comment_meta`
* - `add_term_meta`
@@ -143,10 +148,11 @@ function add_metadata( $meta_type, $object_id, $meta_key, $meta_value, $unique =
* Fires immediately after meta of a specific type is added.
*
* The dynamic portion of the hook name, `$meta_type`, refers to the meta object type
- * (post, comment, term, user, or any other type with an associated meta table).
+ * (blog, post, comment, term, user, or any other type with an associated meta table).
*
* Possible hook names include:
*
+ * - `added_blog_meta`
* - `added_post_meta`
* - `added_comment_meta`
* - `added_term_meta`
@@ -168,12 +174,14 @@ function add_metadata( $meta_type, $object_id, $meta_key, $meta_value, $unique =
* Updates metadata for the specified object. If no value already exists for the specified object
* ID and metadata key, the metadata will be added.
*
+ * For historical reasons both the meta key and the meta value are expected to be "slashed" (slashes escaped) on input.
+ *
* @since 2.9.0
*
* @global wpdb $wpdb WordPress database abstraction object.
*
- * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table.
+ * @param string $meta_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table.
* @param int $object_id ID of the object metadata is for.
* @param string $meta_key Metadata key.
* @param mixed $meta_value Metadata value. Must be serializable if non-scalar.
@@ -218,11 +226,12 @@ function update_metadata( $meta_type, $object_id, $meta_key, $meta_value, $prev_
* Short-circuits updating metadata of a specific type.
*
* The dynamic portion of the hook name, `$meta_type`, refers to the meta object type
- * (post, comment, term, user, or any other type with an associated meta table).
+ * (blog, post, comment, term, user, or any other type with an associated meta table).
* Returning a non-null value will effectively short-circuit the function.
*
* Possible hook names include:
*
+ * - `update_blog_metadata`
* - `update_post_metadata`
* - `update_comment_metadata`
* - `update_term_metadata`
@@ -277,10 +286,11 @@ function update_metadata( $meta_type, $object_id, $meta_key, $meta_value, $prev_
* Fires immediately before updating metadata of a specific type.
*
* The dynamic portion of the hook name, `$meta_type`, refers to the meta object type
- * (post, comment, term, user, or any other type with an associated meta table).
+ * (blog, post, comment, term, user, or any other type with an associated meta table).
*
* Possible hook names include:
*
+ * - `update_blog_meta`
* - `update_post_meta`
* - `update_comment_meta`
* - `update_term_meta`
@@ -323,10 +333,11 @@ function update_metadata( $meta_type, $object_id, $meta_key, $meta_value, $prev_
* Fires immediately after updating metadata of a specific type.
*
* The dynamic portion of the hook name, `$meta_type`, refers to the meta object type
- * (post, comment, term, user, or any other type with an associated meta table).
+ * (blog, post, comment, term, user, or any other type with an associated meta table).
*
* Possible hook names include:
*
+ * - `updated_blog_meta`
* - `updated_post_meta`
* - `updated_comment_meta`
* - `updated_term_meta`
@@ -363,12 +374,14 @@ function update_metadata( $meta_type, $object_id, $meta_key, $meta_value, $prev_
/**
* Deletes metadata for the specified object.
*
+ * For historical reasons both the meta key and the meta value are expected to be "slashed" (slashes escaped) on input.
+ *
* @since 2.9.0
*
* @global wpdb $wpdb WordPress database abstraction object.
*
- * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table.
+ * @param string $meta_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table.
* @param int $object_id ID of the object metadata is for.
* @param string $meta_key Metadata key.
* @param mixed $meta_value Optional. Metadata value. Must be serializable if non-scalar.
@@ -411,11 +424,12 @@ function delete_metadata( $meta_type, $object_id, $meta_key, $meta_value = '', $
* Short-circuits deleting metadata of a specific type.
*
* The dynamic portion of the hook name, `$meta_type`, refers to the meta object type
- * (post, comment, term, user, or any other type with an associated meta table).
+ * (blog, post, comment, term, user, or any other type with an associated meta table).
* Returning a non-null value will effectively short-circuit the function.
*
* Possible hook names include:
*
+ * - `delete_blog_metadata`
* - `delete_post_metadata`
* - `delete_comment_metadata`
* - `delete_term_metadata`
@@ -466,10 +480,11 @@ function delete_metadata( $meta_type, $object_id, $meta_key, $meta_value = '', $
* Fires immediately before deleting metadata of a specific type.
*
* The dynamic portion of the hook name, `$meta_type`, refers to the meta object type
- * (post, comment, term, user, or any other type with an associated meta table).
+ * (blog, post, comment, term, user, or any other type with an associated meta table).
*
* Possible hook names include:
*
+ * - `delete_blog_meta`
* - `delete_post_meta`
* - `delete_comment_meta`
* - `delete_term_meta`
@@ -515,10 +530,11 @@ function delete_metadata( $meta_type, $object_id, $meta_key, $meta_value = '', $
* Fires immediately after deleting metadata of a specific type.
*
* The dynamic portion of the hook name, `$meta_type`, refers to the meta object type
- * (post, comment, term, user, or any other type with an associated meta table).
+ * (blog, post, comment, term, user, or any other type with an associated meta table).
*
* Possible hook names include:
*
+ * - `deleted_blog_meta`
* - `deleted_post_meta`
* - `deleted_comment_meta`
* - `deleted_term_meta`
@@ -563,8 +579,8 @@ function delete_metadata( $meta_type, $object_id, $meta_key, $meta_value = '', $
* @see get_metadata_raw()
* @see get_metadata_default()
*
- * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table.
+ * @param string $meta_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table.
* @param int $object_id ID of the object metadata is for.
* @param string $meta_key Optional. Metadata key. If not specified, retrieve all metadata for
* the specified object. Default empty string.
@@ -596,8 +612,8 @@ function get_metadata( $meta_type, $object_id, $meta_key = '', $single = false )
*
* @since 5.5.0
*
- * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table.
+ * @param string $meta_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table.
* @param int $object_id ID of the object metadata is for.
* @param string $meta_key Optional. Metadata key. If not specified, retrieve all metadata for
* the specified object. Default empty string.
@@ -623,11 +639,12 @@ function get_metadata_raw( $meta_type, $object_id, $meta_key = '', $single = fal
* Short-circuits the return value of a meta field.
*
* The dynamic portion of the hook name, `$meta_type`, refers to the meta object type
- * (post, comment, term, user, or any other type with an associated meta table).
+ * (blog, post, comment, term, user, or any other type with an associated meta table).
* Returning a non-null value will effectively short-circuit the function.
*
* Possible filter names include:
*
+ * - `get_blog_metadata`
* - `get_post_metadata`
* - `get_comment_metadata`
* - `get_term_metadata`
@@ -641,8 +658,8 @@ function get_metadata_raw( $meta_type, $object_id, $meta_key = '', $single = fal
* @param int $object_id ID of the object metadata is for.
* @param string $meta_key Metadata key.
* @param bool $single Whether to return only the first value of the specified `$meta_key`.
- * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table.
+ * @param string $meta_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table.
*/
$check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single, $meta_type );
if ( null !== $check ) {
@@ -687,8 +704,8 @@ function get_metadata_raw( $meta_type, $object_id, $meta_key = '', $single = fal
*
* @since 5.5.0
*
- * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table.
+ * @param string $meta_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table.
* @param int $object_id ID of the object metadata is for.
* @param string $meta_key Metadata key.
* @param bool $single Optional. If true, return only the first value of the specified `$meta_key`.
@@ -707,10 +724,11 @@ function get_metadata_default( $meta_type, $object_id, $meta_key, $single = fals
* Filters the default metadata value for a specified meta key and object.
*
* The dynamic portion of the hook name, `$meta_type`, refers to the meta object type
- * (post, comment, term, user, or any other type with an associated meta table).
+ * (blog, post, comment, term, user, or any other type with an associated meta table).
*
* Possible filter names include:
*
+ * - `default_blog_metadata`
* - `default_post_metadata`
* - `default_comment_metadata`
* - `default_term_metadata`
@@ -723,8 +741,8 @@ function get_metadata_default( $meta_type, $object_id, $meta_key, $single = fals
* @param int $object_id ID of the object metadata is for.
* @param string $meta_key Metadata key.
* @param bool $single Whether to return only the first value of the specified `$meta_key`.
- * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table.
+ * @param string $meta_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table.
*/
$value = apply_filters( "default_{$meta_type}_metadata", $value, $object_id, $meta_key, $single, $meta_type );
@@ -740,8 +758,8 @@ function get_metadata_default( $meta_type, $object_id, $meta_key, $single = fals
*
* @since 3.3.0
*
- * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table.
+ * @param string $meta_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table.
* @param int $object_id ID of the object metadata is for.
* @param string $meta_key Metadata key.
* @return bool Whether a meta field with the given key exists.
@@ -783,8 +801,8 @@ function metadata_exists( $meta_type, $object_id, $meta_key ) {
*
* @global wpdb $wpdb WordPress database abstraction object.
*
- * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table.
+ * @param string $meta_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table.
* @param int $meta_id ID for a specific meta row.
* @return stdClass|false {
* Metadata object, or boolean `false` if the metadata doesn't exist.
@@ -793,6 +811,7 @@ function metadata_exists( $meta_type, $object_id, $meta_key ) {
* @type mixed $meta_value The unserialized meta value.
* @type string $meta_id Optional. The meta ID when the meta type is any value except 'user'.
* @type string $umeta_id Optional. The meta ID when the meta type is 'user'.
+ * @type string $blog_id Optional. The object ID when the meta type is 'blog'.
* @type string $post_id Optional. The object ID when the meta type is 'post'.
* @type string $comment_id Optional. The object ID when the meta type is 'comment'.
* @type string $term_id Optional. The object ID when the meta type is 'term'.
@@ -820,11 +839,12 @@ function get_metadata_by_mid( $meta_type, $meta_id ) {
* Short-circuits the return value when fetching a meta field by meta ID.
*
* The dynamic portion of the hook name, `$meta_type`, refers to the meta object type
- * (post, comment, term, user, or any other type with an associated meta table).
+ * (blog, post, comment, term, user, or any other type with an associated meta table).
* Returning a non-null value will effectively short-circuit the function.
*
* Possible hook names include:
*
+ * - `get_blog_metadata_by_mid`
* - `get_post_metadata_by_mid`
* - `get_comment_metadata_by_mid`
* - `get_term_metadata_by_mid`
@@ -862,8 +882,8 @@ function get_metadata_by_mid( $meta_type, $meta_id ) {
*
* @global wpdb $wpdb WordPress database abstraction object.
*
- * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table.
+ * @param string $meta_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table.
* @param int $meta_id ID for a specific meta row.
* @param string $meta_value Metadata value. Must be serializable if non-scalar.
* @param string|false $meta_key Optional. You can provide a meta key to update it. Default false.
@@ -894,11 +914,12 @@ function update_metadata_by_mid( $meta_type, $meta_id, $meta_value, $meta_key =
* Short-circuits updating metadata of a specific type by meta ID.
*
* The dynamic portion of the hook name, `$meta_type`, refers to the meta object type
- * (post, comment, term, user, or any other type with an associated meta table).
+ * (blog, post, comment, term, user, or any other type with an associated meta table).
* Returning a non-null value will effectively short-circuit the function.
*
* Possible hook names include:
*
+ * - `update_blog_metadata_by_mid`
* - `update_post_metadata_by_mid`
* - `update_comment_metadata_by_mid`
* - `update_term_metadata_by_mid`
@@ -988,8 +1009,8 @@ function update_metadata_by_mid( $meta_type, $meta_id, $meta_value, $meta_key =
*
* @global wpdb $wpdb WordPress database abstraction object.
*
- * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table.
+ * @param string $meta_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table.
* @param int $meta_id ID for a specific meta row.
* @return bool True on successful delete, false on failure.
*/
@@ -1019,11 +1040,12 @@ function delete_metadata_by_mid( $meta_type, $meta_id ) {
* Short-circuits deleting metadata of a specific type by meta ID.
*
* The dynamic portion of the hook name, `$meta_type`, refers to the meta object type
- * (post, comment, term, user, or any other type with an associated meta table).
+ * (blog, post, comment, term, user, or any other type with an associated meta table).
* Returning a non-null value will effectively short-circuit the function.
*
* Possible hook names include:
*
+ * - `delete_blog_metadata_by_mid`
* - `delete_post_metadata_by_mid`
* - `delete_comment_metadata_by_mid`
* - `delete_term_metadata_by_mid`
@@ -1059,8 +1081,6 @@ function delete_metadata_by_mid( $meta_type, $meta_id ) {
*
* - `delete_postmeta`
* - `delete_commentmeta`
- * - `delete_termmeta`
- * - `delete_usermeta`
*
* @since 3.4.0
*
@@ -1090,8 +1110,6 @@ function delete_metadata_by_mid( $meta_type, $meta_id ) {
*
* - `deleted_postmeta`
* - `deleted_commentmeta`
- * - `deleted_termmeta`
- * - `deleted_usermeta`
*
* @since 3.4.0
*
@@ -1115,8 +1133,8 @@ function delete_metadata_by_mid( $meta_type, $meta_id ) {
*
* @global wpdb $wpdb WordPress database abstraction object.
*
- * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table.
+ * @param string $meta_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table.
* @param string|int[] $object_ids Array or comma delimited list of object IDs to update cache for.
* @return array|false Metadata cache for the specified objects, or false on failure.
*/
@@ -1145,11 +1163,12 @@ function update_meta_cache( $meta_type, $object_ids ) {
* Short-circuits updating the metadata cache of a specific type.
*
* The dynamic portion of the hook name, `$meta_type`, refers to the meta object type
- * (post, comment, term, user, or any other type with an associated meta table).
+ * (blog, post, comment, term, user, or any other type with an associated meta table).
* Returning a non-null value will effectively short-circuit the function.
*
* Possible hook names include:
*
+ * - `update_blog_metadata_cache`
* - `update_post_metadata_cache`
* - `update_comment_metadata_cache`
* - `update_term_metadata_cache`
@@ -1268,8 +1287,8 @@ function get_meta_sql( $meta_query, $type, $primary_table, $primary_id_column, $
*
* @global wpdb $wpdb WordPress database abstraction object.
*
- * @param string $type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table.
+ * @param string $type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table.
* @return string|false Metadata table name, or false if no metadata table exists
*/
function _get_meta_table( $type ) {
@@ -1290,8 +1309,8 @@ function _get_meta_table( $type ) {
* @since 3.1.3
*
* @param string $meta_key Metadata key.
- * @param string $meta_type Optional. Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table. Default empty string.
+ * @param string $meta_type Optional. Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table. Default empty string.
* @return bool Whether the meta key is considered protected.
*/
function is_protected_meta( $meta_key, $meta_type = '' ) {
@@ -1305,8 +1324,8 @@ function is_protected_meta( $meta_key, $meta_type = '' ) {
*
* @param bool $protected Whether the key is considered protected.
* @param string $meta_key Metadata key.
- * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table.
+ * @param string $meta_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table.
*/
return apply_filters( 'is_protected_meta', $protected, $meta_key, $meta_type );
}
@@ -1319,8 +1338,8 @@ function is_protected_meta( $meta_key, $meta_type = '' ) {
*
* @param string $meta_key Metadata key.
* @param mixed $meta_value Metadata value to sanitize.
- * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table.
+ * @param string $object_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table.
* @param string $object_subtype Optional. The subtype of the object type. Default empty string.
* @return mixed Sanitized $meta_value.
*/
@@ -1331,15 +1350,15 @@ function sanitize_meta( $meta_key, $meta_value, $object_type, $object_subtype =
* Filters the sanitization of a specific meta key of a specific meta type and subtype.
*
* The dynamic portions of the hook name, `$object_type`, `$meta_key`,
- * and `$object_subtype`, refer to the metadata object type (comment, post, term, or user),
+ * and `$object_subtype`, refer to the metadata object type (blog, comment, post, term, or user),
* the meta key value, and the object subtype respectively.
*
* @since 4.9.8
*
* @param mixed $meta_value Metadata value to sanitize.
* @param string $meta_key Metadata key.
- * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table.
+ * @param string $object_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table.
* @param string $object_subtype Object subtype.
*/
return apply_filters( "sanitize_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $meta_value, $meta_key, $object_type, $object_subtype );
@@ -1349,15 +1368,15 @@ function sanitize_meta( $meta_key, $meta_value, $object_type, $object_subtype =
* Filters the sanitization of a specific meta key of a specific meta type.
*
* The dynamic portions of the hook name, `$meta_type`, and `$meta_key`,
- * refer to the metadata object type (comment, post, term, or user) and the meta
+ * refer to the metadata object type (blog, comment, post, term, or user) and the meta
* key value, respectively.
*
* @since 3.3.0
*
* @param mixed $meta_value Metadata value to sanitize.
* @param string $meta_key Metadata key.
- * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table.
+ * @param string $object_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table.
*/
return apply_filters( "sanitize_{$object_type}_meta_{$meta_key}", $meta_value, $meta_key, $object_type );
}
@@ -1369,7 +1388,7 @@ function sanitize_meta( $meta_key, $meta_value, $object_type, $object_subtype =
* an object subtype is omitted, the meta key will be registered for the entire object type, however it can be partly
* overridden in case a more specific meta key of the same name exists for the same object type and a subtype.
*
- * If an object type does not support any subtypes, such as users or comments, you should commonly call this function
+ * If an object type does not support any subtypes, such as blogs, users, or comments, you should commonly call this function
* without passing a subtype.
*
* @since 3.3.0
@@ -1382,8 +1401,8 @@ function sanitize_meta( $meta_key, $meta_value, $object_type, $object_subtype =
* @since 6.4.0 The `$revisions_enabled` argument was added to the arguments array.
* @since 6.7.0 The `label` argument was added to the arguments array.
*
- * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table.
+ * @param string $object_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table.
* @param string $meta_key Meta key to register.
* @param array $args {
* Data used to describe the meta key when registered.
@@ -1461,8 +1480,8 @@ function register_meta( $object_type, $meta_key, $args, $deprecated = null ) {
*
* @param array $args Array of meta registration arguments.
* @param array $defaults Array of default arguments.
- * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table.
+ * @param string $object_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table.
* @param string $meta_key Meta key.
*/
$args = apply_filters( 'register_meta_args', $args, $defaults, $object_type, $meta_key );
@@ -1557,8 +1576,8 @@ function register_meta( $object_type, $meta_key, $args, $deprecated = null ) {
* @param string $meta_key Metadata key.
* @param bool $single If true, return only the first value of the specified `$meta_key`.
* This parameter has no effect if `$meta_key` is not specified.
- * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table.
+ * @param string $meta_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table.
* @return mixed An array of default values if `$single` is false.
* The default value of the meta field if `$single` is true.
*/
@@ -1612,8 +1631,8 @@ function filter_default_metadata( $value, $object_id, $meta_key, $single, $meta_
* @since 4.6.0
* @since 4.9.8 The `$object_subtype` parameter was added.
*
- * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table.
+ * @param string $object_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table.
* @param string $meta_key Metadata key.
* @param string $object_subtype Optional. The subtype of the object type. Default empty string.
* @return bool True if the meta key is registered to the object type and, if provided,
@@ -1631,8 +1650,8 @@ function registered_meta_key_exists( $object_type, $meta_key, $object_subtype =
* @since 4.6.0
* @since 4.9.8 The `$object_subtype` parameter was added.
*
- * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table.
+ * @param string $object_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table.
* @param string $meta_key Metadata key.
* @param string $object_subtype Optional. The subtype of the object type. Default empty string.
* @return bool True if successful. False if the meta key was not registered.
@@ -1681,8 +1700,8 @@ function unregister_meta_key( $object_type, $meta_key, $object_subtype = '' ) {
* @since 4.6.0
* @since 4.9.8 The `$object_subtype` parameter was added.
*
- * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table.
+ * @param string $object_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table.
* @param string $object_subtype Optional. The subtype of the object type. Default empty string.
* @return array[] List of registered metadata args, keyed by their meta keys.
*/
@@ -1704,8 +1723,8 @@ function get_registered_meta_keys( $object_type, $object_subtype = '' ) {
*
* @since 4.6.0
*
- * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table.
+ * @param string $object_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table.
* @param int $object_id ID of the object the metadata is for.
* @param string $meta_key Optional. Registered metadata key. If not specified, retrieve all registered
* metadata for the specified object.
@@ -1767,8 +1786,8 @@ function _wp_register_meta_args_allowed_list( $args, $default_args ) {
*
* @since 4.9.8
*
- * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
- * or any other object type with an associated meta table.
+ * @param string $object_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
+ * 'user', or any other object type with an associated meta table.
* @param int $object_id ID of the object to retrieve its subtype.
* @return string The object subtype or an empty string if unspecified subtype.
*/
@@ -1814,13 +1833,14 @@ function get_object_subtype( $object_type, $object_id ) {
}
/**
- * Filters the object subtype identifier for a non-standard object type.
+ * Filters the object subtype identifier.
*
* The dynamic portion of the hook name, `$object_type`, refers to the meta object type
- * (post, comment, term, user, or any other type with an associated meta table).
+ * (blog, post, comment, term, user, or any other type with an associated meta table).
*
* Possible hook names include:
*
+ * - `get_object_subtype_blog`
* - `get_object_subtype_post`
* - `get_object_subtype_comment`
* - `get_object_subtype_term`
@@ -1828,7 +1848,7 @@ function get_object_subtype( $object_type, $object_id ) {
*
* @since 4.9.8
*
- * @param string $object_subtype Empty string to override.
+ * @param string $object_subtype Object subtype or empty string to override.
* @param int $object_id ID of the object to get the subtype for.
*/
return apply_filters( "get_object_subtype_{$object_type}", $object_subtype, $object_id );
diff --git a/src/wp-includes/ms-load.php b/src/wp-includes/ms-load.php
index 0708bc4dcd..b8d5228d09 100644
--- a/src/wp-includes/ms-load.php
+++ b/src/wp-includes/ms-load.php
@@ -129,9 +129,9 @@ function ms_site_check() {
/**
* Retrieves the closest matching network for a domain and path.
*
- * @since 3.9.0
+ * {@internal In 4.4.0, converted to a wrapper for WP_Network::get_by_path()}
*
- * @internal In 4.4.0, converted to a wrapper for WP_Network::get_by_path()
+ * @since 3.9.0
*
* @param string $domain Domain to check.
* @param string $path Path to check.
@@ -552,12 +552,12 @@ function wpmu_current_site() {
/**
* Retrieves an object containing information about the requested network.
*
+ * {@internal In 4.6.0, converted to use get_network()}
+ *
* @since 3.9.0
* @deprecated 4.7.0 Use get_network()
* @see get_network()
*
- * @internal In 4.6.0, converted to use get_network()
- *
* @param object|int $network The network's database row or ID.
* @return WP_Network|false Object containing network information if found, false if not.
*/
diff --git a/src/wp-includes/ms-site.php b/src/wp-includes/ms-site.php
index 2a2b1474c5..0058d1a482 100644
--- a/src/wp-includes/ms-site.php
+++ b/src/wp-includes/ms-site.php
@@ -1022,6 +1022,8 @@ function clean_blog_cache( $blog ) {
/**
* Adds metadata to a site.
*
+ * For historical reasons both the meta key and the meta value are expected to be "slashed" (slashes escaped) on input.
+ *
* @since 5.1.0
*
* @param int $site_id Site ID.
@@ -1048,6 +1050,8 @@ function add_site_meta( $site_id, $meta_key, $meta_value, $unique = false ) {
* value, will keep from removing duplicate metadata with the same key. It also
* allows removing all metadata matching key, if needed.
*
+ * For historical reasons both the meta key and the meta value are expected to be "slashed" (slashes escaped) on input.
+ *
* @since 5.1.0
*
* @param int $site_id Site ID.
@@ -1090,11 +1094,13 @@ function get_site_meta( $site_id, $key = '', $single = false ) {
/**
* Updates metadata for a site.
*
- * Use the $prev_value parameter to differentiate between meta fields with the
+ * Use the `$prev_value` parameter to differentiate between meta fields with the
* same key and site ID.
*
* If the meta field for the site does not exist, it will be added.
*
+ * For historical reasons both the meta key and the meta value are expected to be "slashed" (slashes escaped) on input.
+ *
* @since 5.1.0
*
* @param int $site_id Site ID.
@@ -1237,7 +1243,7 @@ function wp_maybe_transition_site_statuses_on_update( $new_site, $old_site = nul
if ( '1' === $new_site->deleted ) {
/**
- * Fires when the 'deleted' status is added to a site.
+ * Fires when the 'flagged for deletion' status is added to a site.
*
* @since 3.5.0
*
@@ -1247,7 +1253,7 @@ function wp_maybe_transition_site_statuses_on_update( $new_site, $old_site = nul
} else {
/**
- * Fires when the 'deleted' status is removed from a site.
+ * Fires when the 'flagged for deletion' status is removed from a site.
*
* @since 3.5.0
*
diff --git a/src/wp-includes/option.php b/src/wp-includes/option.php
index 0280d53758..3b4f461724 100644
--- a/src/wp-includes/option.php
+++ b/src/wp-includes/option.php
@@ -1880,7 +1880,7 @@ function wp_set_all_user_settings( $user_settings ) {
}
if ( ! is_user_member_of_blog() ) {
- return;
+ return null;
}
$settings = '';
diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php
index e7ce2edb41..1dbac5e1d7 100644
--- a/src/wp-includes/pluggable.php
+++ b/src/wp-includes/pluggable.php
@@ -446,10 +446,10 @@ if ( ! function_exists( 'wp_mail' ) ) :
$phpmailer->addAddress( $address, $recipient_name );
break;
case 'cc':
- $phpmailer->addCc( $address, $recipient_name );
+ $phpmailer->addCC( $address, $recipient_name );
break;
case 'bcc':
- $phpmailer->addBcc( $address, $recipient_name );
+ $phpmailer->addBCC( $address, $recipient_name );
break;
case 'reply_to':
$phpmailer->addReplyTo( $address, $recipient_name );
@@ -2676,9 +2676,11 @@ if ( ! function_exists( 'wp_hash_password' ) ) :
* - `PASSWORD_ARGON2ID`
* - `PASSWORD_DEFAULT`
*
+ * The values of the algorithm constants are strings in PHP 7.4+ and integers in PHP 7.3 and earlier.
+ *
* @since 6.8.0
*
- * @param string $algorithm The hashing algorithm. Default is the value of the `PASSWORD_BCRYPT` constant.
+ * @param string|int $algorithm The hashing algorithm. Default is the value of the `PASSWORD_BCRYPT` constant.
*/
$algorithm = apply_filters( 'wp_hash_password_algorithm', PASSWORD_BCRYPT );
@@ -2688,12 +2690,14 @@ if ( ! function_exists( 'wp_hash_password' ) ) :
* The default hashing algorithm is bcrypt, but this can be changed via the {@see 'wp_hash_password_algorithm'}
* filter. You must ensure that the options are appropriate for the algorithm in use.
*
+ * The values of the algorithm constants are strings in PHP 7.4+ and integers in PHP 7.3 and earlier.
+ *
* @since 6.8.0
*
- * @param array $options Array of options to pass to the password hashing functions.
- * By default this is an empty array which means the default
- * options will be used.
- * @param string $algorithm The hashing algorithm in use.
+ * @param array $options Array of options to pass to the password hashing functions.
+ * By default this is an empty array which means the default
+ * options will be used.
+ * @param string|int $algorithm The hashing algorithm in use.
*/
$options = apply_filters( 'wp_hash_password_options', array(), $algorithm );
@@ -3048,6 +3052,8 @@ if ( ! function_exists( 'get_avatar' ) ) :
* - 'monsterid' (a monster)
* - 'wavatar' (a cartoon face)
* - 'identicon' (the "quilt", a geometric pattern)
+ * - 'initials' (initials based avatar with background color)
+ * - 'color' (generated background color)
* - 'mystery', 'mm', or 'mysteryman' (The Oyster Man)
* - 'blank' (transparent GIF)
* - 'gravatar_default' (the Gravatar logo)
diff --git a/src/wp-includes/plugin.php b/src/wp-includes/plugin.php
index bed67a9d96..5b4079b0bd 100644
--- a/src/wp-includes/plugin.php
+++ b/src/wp-includes/plugin.php
@@ -359,7 +359,7 @@ function remove_all_filters( $hook_name, $priority = false ) {
*
* @global string[] $wp_current_filter Stores the list of current filters with the current one last
*
- * @return string Hook name of the current filter.
+ * @return string|false Hook name of the current filter, false if no filter is running.
*/
function current_filter() {
global $wp_current_filter;
@@ -632,7 +632,7 @@ function remove_all_actions( $hook_name, $priority = false ) {
*
* @since 3.9.0
*
- * @return string Hook name of the current action.
+ * @return string|false Hook name of the current action, false if no action is running.
*/
function current_action() {
return current_filter();
diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
index 19fada6383..d9efb1e06a 100644
--- a/src/wp-includes/post.php
+++ b/src/wp-includes/post.php
@@ -2608,6 +2608,8 @@ function get_posts( $args = null ) {
*
* Post meta data is called "Custom Fields" on the Administration Screen.
*
+ * For historical reasons both the meta key and the meta value are expected to be "slashed" (slashes escaped) on input.
+ *
* @since 1.5.0
*
* @param int $post_id Post ID.
@@ -2640,6 +2642,8 @@ function add_post_meta( $post_id, $meta_key, $meta_value, $unique = false ) {
* value, will keep from removing duplicate metadata with the same key. It also
* allows removing all metadata matching the key, if needed.
*
+ * For historical reasons both the meta key and the meta value are expected to be "slashed" (slashes escaped) on input.
+ *
* @since 1.5.0
*
* @param int $post_id Post ID.
@@ -2695,6 +2699,8 @@ function get_post_meta( $post_id, $key = '', $single = false ) {
*
* Can be used in place of add_post_meta().
*
+ * For historical reasons both the meta key and the meta value are expected to be "slashed" (slashes escaped) on input.
+ *
* @since 1.5.0
*
* @param int $post_id Post ID.
@@ -4868,6 +4874,15 @@ function wp_insert_post( $postarr, $wp_error = false, $fire_after_hooks = true )
}
}
+ /**
+ * Fires immediately before a new post is inserted in the database.
+ *
+ * @since 6.9.0
+ *
+ * @param array $data Array of unslashed post data.
+ */
+ do_action( 'pre_post_insert', $data );
+
if ( false === $wpdb->insert( $wpdb->posts, $data ) ) {
if ( $wp_error ) {
if ( 'attachment' === $post_type ) {
@@ -6094,7 +6109,7 @@ function get_page_by_path( $page_path, $output = OBJECT, $post_type = 'page' ) {
if ( false !== $cached ) {
// Special case: '0' is a bad `$page_path`.
if ( '0' === $cached || 0 === $cached ) {
- return;
+ return null;
} else {
return get_post( $cached, $output );
}
@@ -6862,7 +6877,9 @@ function wp_get_attachment_metadata( $attachment_id = 0, $unfiltered = false ) {
*
* @param int $attachment_id Attachment post ID.
* @param array $data Attachment meta data.
- * @return int|false False if $post is invalid.
+ * @return int|bool Whether the metadata was successfully updated.
+ * True on success, the Meta ID if the key didn't exist.
+ * False if $post is invalid, on failure, or if $data is the same as the existing metadata.
*/
function wp_update_attachment_metadata( $attachment_id, $data ) {
$attachment_id = (int) $attachment_id;
@@ -8153,6 +8170,10 @@ function wp_queue_posts_for_term_meta_lazyload( $posts ) {
* @param WP_Post $post Post object.
*/
function _update_term_count_on_transition_post_status( $new_status, $old_status, $post ) {
+ if ( $new_status === $old_status ) {
+ return;
+ }
+
// Update counts for the post's terms.
foreach ( (array) get_object_taxonomies( $post->post_type ) as $taxonomy ) {
$tt_ids = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'tt_ids' ) );
diff --git a/src/wp-includes/rest-api/class-wp-rest-response.php b/src/wp-includes/rest-api/class-wp-rest-response.php
index c6ea11be83..0861d190d0 100644
--- a/src/wp-includes/rest-api/class-wp-rest-response.php
+++ b/src/wp-includes/rest-api/class-wp-rest-response.php
@@ -43,7 +43,7 @@ class WP_REST_Response extends WP_HTTP_Response {
/**
* Adds a link to the response.
*
- * @internal The $rel parameter is first, as this looks nicer when sending multiple.
+ * {@internal The $rel parameter is first, as this looks nicer when sending multiple.}
*
* @since 4.4.0
*
@@ -135,7 +135,7 @@ class WP_REST_Response extends WP_HTTP_Response {
/**
* Sets a single link header.
*
- * @internal The $rel parameter is first, as this looks nicer when sending multiple.
+ * {@internal The $rel parameter is first, as this looks nicer when sending multiple.}
*
* @since 4.4.0
*
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php
index b0ac65a647..767917d6f6 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php
@@ -802,7 +802,16 @@ class WP_REST_Application_Passwords_Controller extends WP_REST_Controller {
'app_id' => array(
'description' => __( 'A UUID provided by the application to uniquely identify it. It is recommended to use an UUID v5 with the URL or DNS namespace.' ),
'type' => 'string',
- 'format' => 'uuid',
+ 'oneOf' => array(
+ array(
+ 'type' => 'string',
+ 'format' => 'uuid',
+ ),
+ array(
+ 'type' => 'string',
+ 'enum' => array( '' ),
+ ),
+ ),
'context' => array( 'view', 'edit', 'embed' ),
),
'name' => array(
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php
index 4b960d6c6b..0474613b2e 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php
@@ -662,11 +662,11 @@ abstract class WP_REST_Controller {
/**
* Sanitizes the slug value.
*
- * @since 4.7.0
- *
- * @internal We can't use sanitize_title() directly, as the second
+ * {@internal We can't use sanitize_title() directly, as the second
* parameter is the fallback title, which would end up being set to the
- * request object.
+ * request object.}
+ *
+ * @since 4.7.0
*
* @see https://github.com/WP-API/WP-API/issues/1585
*
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
index 51c1ac29b8..908ebe4bcc 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
@@ -88,7 +88,7 @@ class WP_REST_Global_Styles_Controller extends WP_REST_Posts_Controller {
// Lists/updates a single global style variation based on the given id.
register_rest_route(
$this->namespace,
- '/' . $this->rest_base . '/(?P<id>[\/\w-]+)',
+ '/' . $this->rest_base . '/(?P<id>[\/\d+]+)',
array(
array(
'methods' => WP_REST_Server::READABLE,
@@ -96,9 +96,8 @@ class WP_REST_Global_Styles_Controller extends WP_REST_Posts_Controller {
'permission_callback' => array( $this, 'get_item_permissions_check' ),
'args' => array(
'id' => array(
- 'description' => __( 'The id of a template' ),
- 'type' => 'string',
- 'sanitize_callback' => array( $this, '_sanitize_global_styles_callback' ),
+ 'description' => __( 'ID of global styles config.' ),
+ 'type' => 'integer',
),
),
),
@@ -115,17 +114,17 @@ class WP_REST_Global_Styles_Controller extends WP_REST_Posts_Controller {
}
/**
- * Sanitize the global styles ID or stylesheet to decode endpoint.
+ * Sanitize the global styles stylesheet to decode endpoint.
* For example, `wp/v2/global-styles/twentytwentytwo%200.4.0`
* would be decoded to `twentytwentytwo 0.4.0`.
*
* @since 5.9.0
*
- * @param string $id_or_stylesheet Global styles ID or stylesheet.
- * @return string Sanitized global styles ID or stylesheet.
+ * @param string $stylesheet Global styles stylesheet.
+ * @return string Sanitized global styles stylesheet.
*/
- public function _sanitize_global_styles_callback( $id_or_stylesheet ) {
- return urldecode( $id_or_stylesheet );
+ public function _sanitize_global_styles_callback( $stylesheet ) {
+ return urldecode( $stylesheet );
}
/**
@@ -139,7 +138,7 @@ class WP_REST_Global_Styles_Controller extends WP_REST_Posts_Controller {
protected function get_post( $id ) {
$error = new WP_Error(
'rest_global_styles_not_found',
- __( 'No global styles config exist with that id.' ),
+ __( 'No global styles config exists with that ID.' ),
array( 'status' => 404 )
);
@@ -464,7 +463,7 @@ class WP_REST_Global_Styles_Controller extends WP_REST_Posts_Controller {
'properties' => array(
'id' => array(
'description' => __( 'ID of global styles config.' ),
- 'type' => 'string',
+ 'type' => 'integer',
'context' => array( 'embed', 'view', 'edit' ),
'readonly' => true,
),
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php
index 004f5851a2..f3c4295370 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php
@@ -145,7 +145,19 @@ class WP_REST_Settings_Controller extends WP_REST_Controller {
public function update_item( $request ) {
$options = $this->get_registered_options();
- $params = $request->get_params();
+ $params = array_diff_key( $request->get_params(), $request->get_query_params() );
+
+ if ( empty( $params ) || ! empty( array_diff_key( $params, $options ) ) ) {
+ $message = empty( $params )
+ ? __( 'Request body cannot be empty.' )
+ : __( 'Invalid parameter(s) provided.' );
+
+ return new WP_Error(
+ 'rest_invalid_param',
+ $message,
+ array( 'status' => 400 )
+ );
+ }
foreach ( $options as $name => $args ) {
if ( ! array_key_exists( $name, $params ) ) {
diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php
index d439629882..cd2c06e4cc 100644
--- a/src/wp-includes/script-loader.php
+++ b/src/wp-includes/script-loader.php
@@ -396,7 +396,7 @@ function wp_default_packages_inline_scripts( $scripts ) {
"\n",
array(
'( function() {',
- ' var userId = ' . get_current_user_ID() . ';',
+ ' var userId = ' . get_current_user_id() . ';',
' var storageKey = "WP_DATA_USER_" + userId;',
' wp.data',
' .use( wp.data.plugins.persistence, { storageKey: storageKey } );',
@@ -997,8 +997,6 @@ function wp_default_scripts( $scripts ) {
// Not used in core, replaced by imgAreaSelect.
$scripts->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.min.js', array( 'jquery' ), '0.9.15' );
- $scripts->add( 'swfobject', '/wp-includes/js/swfobject.js', array(), '2.2-20120417' );
-
// Error messages for Plupload.
$uploader_l10n = array(
'queue_limit_exceeded' => __( 'You have attempted to queue too many files.' ),
@@ -1046,12 +1044,6 @@ function wp_default_scripts( $scripts ) {
$scripts->add( 'wp-plupload', "/wp-includes/js/plupload/wp-plupload$suffix.js", array( 'plupload', 'jquery', 'json2', 'media-models' ), false, 1 );
did_action( 'init' ) && $scripts->localize( 'wp-plupload', 'pluploadL10n', $uploader_l10n );
- // Keep 'swfupload' for back-compat.
- $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', array(), '2201-20110113' );
- $scripts->add( 'swfupload-all', false, array( 'swfupload' ), '2201' );
- $scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array( 'swfupload-all', 'jquery' ), '2201-20110524' );
- did_action( 'init' ) && $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', $uploader_l10n );
-
$scripts->add( 'comment-reply', "/wp-includes/js/comment-reply$suffix.js", array(), false, 1 );
did_action( 'init' ) && $scripts->add_data( 'comment-reply', 'strategy', 'async' );
diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php
index 3e235b780f..935212652c 100644
--- a/src/wp-includes/taxonomy.php
+++ b/src/wp-includes/taxonomy.php
@@ -1292,6 +1292,8 @@ function get_term_to_edit( $id, $taxonomy ) {
*
* Prior to 4.5.0, taxonomy was passed as the first parameter of `get_terms()`.
*
+ * {@internal The `$deprecated` parameter is parsed for backward compatibility only.}
+ *
* @since 2.3.0
* @since 4.2.0 Introduced 'name' and 'childless' parameters.
* @since 4.4.0 Introduced the ability to pass 'term_id' as an alias of 'id' for the `orderby` parameter.
@@ -1301,8 +1303,6 @@ function get_term_to_edit( $id, $taxonomy ) {
* Introduced 'meta_key' and 'meta_value' parameters. Introduced the ability to order results by metadata.
* @since 4.8.0 Introduced 'suppress_filter' parameter.
*
- * @internal The `$deprecated` parameter is parsed for backward compatibility only.
- *
* @param array|string $args Optional. Array or string of arguments. See WP_Term_Query::__construct()
* for information on accepted arguments. Default empty array.
* @param array|string $deprecated Optional. Argument array, when using the legacy function parameter format.
@@ -1382,6 +1382,8 @@ function get_terms( $args = array(), $deprecated = '' ) {
/**
* Adds metadata to a term.
*
+ * For historical reasons both the meta key and the meta value are expected to be "slashed" (slashes escaped) on input.
+ *
* @since 4.4.0
*
* @param int $term_id Term ID.
@@ -1409,6 +1411,8 @@ function add_term_meta( $term_id, $meta_key, $meta_value, $unique = false ) {
/**
* Removes metadata matching criteria from a term.
*
+ * For historical reasons both the meta key and the meta value are expected to be "slashed" (slashes escaped) on input.
+ *
* @since 4.4.0
*
* @param int $term_id Term ID.
@@ -1455,6 +1459,8 @@ function get_term_meta( $term_id, $key = '', $single = false ) {
*
* If the meta field for the term does not exist, it will be added.
*
+ * For historical reasons both the meta key and the meta value are expected to be "slashed" (slashes escaped) on input.
+ *
* @since 4.4.0
*
* @param int $term_id Term ID.
@@ -1927,11 +1933,11 @@ function sanitize_term_field( $field, $value, $term_id, $taxonomy, $context ) {
*
* Default $args is 'hide_empty' which can be 'hide_empty=true' or array('hide_empty' => true).
*
+ * {@internal The `$deprecated` parameter is parsed for backward compatibility only.}
+ *
* @since 2.3.0
* @since 5.6.0 Changed the function signature so that the `$args` array can be provided as the first parameter.
*
- * @internal The `$deprecated` parameter is parsed for backward compatibility only.
- *
* @param array|string $args Optional. Array or string of arguments. See WP_Term_Query::__construct()
* for information on accepted arguments. Default empty array.
* @param array|string $deprecated Optional. Argument array, when using the legacy function parameter format.
@@ -2137,11 +2143,11 @@ function wp_delete_term( $term, $taxonomy, $args = array() ) {
)
);
- if ( 1 === count( $terms ) && isset( $default ) ) {
+ if ( 1 === count( $terms ) ) {
$terms = array( $default );
} else {
$terms = array_diff( $terms, array( $term ) );
- if ( isset( $default ) && isset( $force_default ) && $force_default ) {
+ if ( isset( $force_default ) && $force_default ) {
$terms = array_merge( $terms, array( $default ) );
}
}
@@ -4892,11 +4898,13 @@ function is_object_in_term( $object_id, $taxonomy, $terms = null ) {
if ( is_wp_error( $object_terms ) ) {
return $object_terms;
}
+
if ( empty( $object_terms ) ) {
return false;
}
+
if ( empty( $terms ) ) {
- return ( ! empty( $object_terms ) );
+ return true;
}
$terms = (array) $terms;
diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php
index b4a71d855a..0727086aee 100644
--- a/src/wp-includes/theme.php
+++ b/src/wp-includes/theme.php
@@ -4349,6 +4349,8 @@ function create_initial_theme_features() {
*
* @since 5.9.0
*
+ * @global string[] $wp_theme_directories
+ *
* @return bool Whether the active theme is a block-based theme or not.
*/
function wp_is_block_theme() {
diff --git a/src/wp-includes/user.php b/src/wp-includes/user.php
index 6d53726327..60da3d2831 100644
--- a/src/wp-includes/user.php
+++ b/src/wp-includes/user.php
@@ -477,7 +477,7 @@ function wp_authenticate_application_password(
*/
do_action( 'wp_authenticate_application_password_errors', $error, $user, $item, $password );
- if ( is_wp_error( $error ) && $error->has_errors() ) {
+ if ( $error->has_errors() ) {
/** This action is documented in wp-includes/user.php */
do_action( 'application_password_failed_authentication', $error );
@@ -637,7 +637,7 @@ function count_user_posts( $userid, $post_type = 'post', $public_only = false )
* @since 4.1.0 Added `$post_type` argument.
* @since 4.3.1 Added `$public_only` argument.
*
- * @param int $count The user's post count.
+ * @param string $count The user's post count as a numeric string.
* @param int $userid User ID.
* @param string|array $post_type Single post type or array of post types to count the number of posts for.
* @param bool $public_only Whether to limit counted posts to public posts.
@@ -1126,7 +1126,7 @@ function get_blogs_of_user( $user_id, $all = false ) {
* @param object[] $sites An array of site objects belonging to the user.
* @param int $user_id User ID.
* @param bool $all Whether the returned sites array should contain all sites, including
- * those marked 'deleted', 'archived', or 'spam'. Default false.
+ * those flagged for deletion, archived, or marked as spam.
*/
return apply_filters( 'get_blogs_of_user', $sites, $user_id, $all );
}
@@ -1202,6 +1202,8 @@ function is_user_member_of_blog( $user_id = 0, $blog_id = 0 ) {
/**
* Adds meta data to a user.
*
+ * For historical reasons both the meta key and the meta value are expected to be "slashed" (slashes escaped) on input.
+ *
* @since 3.0.0
*
* @param int $user_id User ID.
@@ -1228,6 +1230,8 @@ function add_user_meta( $user_id, $meta_key, $meta_value, $unique = false ) {
* value, will keep from removing duplicate metadata with the same key. It also
* allows removing all metadata matching key, if needed.
*
+ * For historical reasons both the meta key and the meta value are expected to be "slashed" (slashes escaped) on input.
+ *
* @since 3.0.0
*
* @link https://developer.wordpress.org/reference/functions/delete_user_meta/
@@ -1279,6 +1283,8 @@ function get_user_meta( $user_id, $key = '', $single = false ) {
*
* If the meta field for the user does not exist, it will be added.
*
+ * For historical reasons both the meta key and the meta value are expected to be "slashed" (slashes escaped) on input.
+ *
* @since 3.0.0
*
* @link https://developer.wordpress.org/reference/functions/update_user_meta/
@@ -2280,7 +2286,10 @@ function wp_insert_user( $userdata ) {
*/
$user_nicename = apply_filters( 'pre_user_nicename', $user_nicename );
- if ( mb_strlen( $user_nicename ) > 50 ) {
+ // Check if the sanitized nicename is empty.
+ if ( empty( $user_nicename ) ) {
+ return new WP_Error( 'empty_user_nicename', __( 'Cannot create a user with an empty nicename.' ) );
+ } elseif ( mb_strlen( $user_nicename ) > 50 ) {
return new WP_Error( 'user_nicename_too_long', __( 'Nicename may not be longer than 50 characters.' ) );
}
diff --git a/src/wp-includes/version.php b/src/wp-includes/version.php
index 324ee3279f..3b43518692 100644
--- a/src/wp-includes/version.php
+++ b/src/wp-includes/version.php
@@ -33,7 +33,7 @@ $wp_db_version = 58975;
$tinymce_version = '49110-20201110';
/**
- * Holds the required PHP version.
+ * Holds the minimum required PHP version.
*
* @global string $required_php_version
*/
@@ -50,7 +50,7 @@ $required_php_extensions = array(
);
/**
- * Holds the required MySQL version.
+ * Holds the minimum required MySQL version.
*
* @global string $required_mysql_version
*/
diff --git a/src/wp-includes/widgets/class-wp-widget-media-gallery.php b/src/wp-includes/widgets/class-wp-widget-media-gallery.php
index ecc446c221..a2527a6554 100644
--- a/src/wp-includes/widgets/class-wp-widget-media-gallery.php
+++ b/src/wp-includes/widgets/class-wp-widget-media-gallery.php
@@ -240,7 +240,6 @@ class WP_Widget_Media_Gallery extends WP_Widget_Media {
* Whether the widget has content to show.
*
* @since 4.9.0
- * @access protected
*
* @param array $instance Widget instance props.
* @return bool Whether widget has content.
diff --git a/src/wp-settings.php b/src/wp-settings.php
index f5a0929db8..60ffc307c5 100644
--- a/src/wp-settings.php
+++ b/src/wp-settings.php
@@ -25,9 +25,9 @@ define( 'WPINC', 'wp-includes' );
* @global string $wp_version The WordPress version string.
* @global int $wp_db_version WordPress database version.
* @global string $tinymce_version TinyMCE version.
- * @global string $required_php_version The required PHP version string.
+ * @global string $required_php_version The minimum required PHP version string.
* @global string[] $required_php_extensions The names of required PHP extensions.
- * @global string $required_mysql_version The required MySQL version string.
+ * @global string $required_mysql_version The minimum required MySQL version string.
* @global string $wp_local_package Locale code of the package.
*/
global $wp_version, $wp_db_version, $tinymce_version, $required_php_version, $required_php_extensions, $required_mysql_version, $wp_local_package;
@@ -35,7 +35,7 @@ require ABSPATH . WPINC . '/version.php';
require ABSPATH . WPINC . '/compat.php';
require ABSPATH . WPINC . '/load.php';
-// Check for the required PHP version and for the MySQL extension or a database drop-in.
+// Check the server requirements.
wp_check_php_mysql_versions();
// Include files required for initialization.
diff --git a/tests/e2e/specs/install.test.js b/tests/e2e/specs/install.test.js
index 27bc56575e..cc237b8145 100644
--- a/tests/e2e/specs/install.test.js
+++ b/tests/e2e/specs/install.test.js
@@ -58,7 +58,7 @@ test.describe( 'WordPress installation process', () => {
await page.getByLabel( 'Password', { exact: true } ).fill( '' );
await page.getByLabel( 'Password', { exact: true } ).fill( 'password' );
await page.getByLabel( /Confirm use of weak password/ ).check()
- await page.getByLabel( 'Your Email' ).fill( 'test@test.com' );
+ await page.getByLabel( 'Your Email' ).fill( 'test@example.com' );
await page.getByRole( 'button', { name: 'Install WordPress' } ).click();
diff --git a/tests/phpunit/data/images/png-tests/grayscale-test-image.png b/tests/phpunit/data/images/png-tests/grayscale-test-image.png
new file mode 100644
index 0000000000..10f537a71b
--- /dev/null
+++ b/tests/phpunit/data/images/png-tests/grayscale-test-image.png
Binary files differ
diff --git a/tests/phpunit/data/images/png-tests/vivid-green-bird.png b/tests/phpunit/data/images/png-tests/vivid-green-bird.png
new file mode 100644
index 0000000000..7b55b3d5e7
--- /dev/null
+++ b/tests/phpunit/data/images/png-tests/vivid-green-bird.png
Binary files differ
diff --git a/tests/phpunit/includes/abstract-testcase.php b/tests/phpunit/includes/abstract-testcase.php
index f665bdafb1..29ce8d8b53 100644
--- a/tests/phpunit/includes/abstract-testcase.php
+++ b/tests/phpunit/includes/abstract-testcase.php
@@ -1,5 +1,6 @@
<?php
+require_once __DIR__ . '/build-visual-html-tree.php';
require_once __DIR__ . '/factory.php';
require_once __DIR__ . '/trac.php';
@@ -13,7 +14,6 @@ require_once __DIR__ . '/trac.php';
* All WordPress unit tests should inherit from this class.
*/
abstract class WP_UnitTestCase_Base extends PHPUnit_Adapter_TestCase {
-
protected static $forced_tickets = array();
protected $expected_deprecated = array();
protected $caught_deprecated = array();
@@ -136,6 +136,21 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Adapter_TestCase {
$this->start_transaction();
$this->expectDeprecated();
add_filter( 'wp_die_handler', array( $this, 'get_wp_die_handler' ) );
+ add_filter( 'wp_hash_password_options', array( $this, 'wp_hash_password_options' ), 1, 2 );
+ }
+
+ /**
+ * Sets the bcrypt cost option for password hashing during tests.
+ *
+ * @param array $options The options for password hashing.
+ * @param string|int $algorithm The algorithm to use for hashing. This is a string in PHP 7.4+ and an integer in PHP 7.3 and earlier.
+ */
+ public function wp_hash_password_options( array $options, $algorithm ): array {
+ if ( PASSWORD_BCRYPT === $algorithm ) {
+ $options['cost'] = 5;
+ }
+
+ return $options;
}
/**
@@ -1181,6 +1196,44 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Adapter_TestCase {
}
/**
+ * Check HTML markup (including blocks) for semantic equivalence.
+ *
+ * Given two markup strings, assert that they translate to the same semantic HTML tree,
+ * normalizing tag names, attribute names, and attribute order. Furthermore, attributes
+ * and class names are sorted and deduplicated, and whitespace in style attributes
+ * is normalized. Finally, block delimiter comments are recognized and normalized,
+ * applying the same principles.
+ *
+ * @since 6.9.0
+ *
+ * @param string $expected The expected HTML.
+ * @param string $actual The actual HTML.
+ * @param string|null $fragment_context Optional. The fragment context, for example "<td>" expected HTML
+ * must occur within "<table><tr>" fragment context. Default "<body>".
+ * Only "<body>" or `null` are supported at this time.
+ * Set to `null` to parse a full HTML document.
+ * @param string|null $message Optional. The assertion error message.
+ */
+ public function assertEqualHTML( string $expected, string $actual, ?string $fragment_context = '<body>', $message = 'HTML markup was not equivalent.' ): void {
+ try {
+ $tree_expected = build_visual_html_tree( $expected, $fragment_context );
+ $tree_actual = build_visual_html_tree( $actual, $fragment_context );
+ } catch ( Exception $e ) {
+ // For PHP 8.4+, we can retry, using the built-in DOM\HTMLDocument parser.
+ if ( class_exists( 'DOM\HtmlDocument' ) ) {
+ $dom_expected = DOM\HtmlDocument::createFromString( $expected, LIBXML_NOERROR );
+ $tree_expected = build_visual_html_tree( $dom_expected->saveHtml(), $fragment_context );
+ $dom_actual = DOM\HtmlDocument::createFromString( $actual, LIBXML_NOERROR );
+ $tree_actual = build_visual_html_tree( $dom_actual->saveHtml(), $fragment_context );
+ } else {
+ throw $e;
+ }
+ }
+
+ $this->assertSame( $tree_expected, $tree_actual, $message );
+ }
+
+ /**
* Helper function to convert a single-level array containing text strings to a named data provider.
*
* The value of the data set will also be used as the name of the data set.
diff --git a/tests/phpunit/includes/build-visual-html-tree.php b/tests/phpunit/includes/build-visual-html-tree.php
new file mode 100644
index 0000000000..e0f6c3ac3d
--- /dev/null
+++ b/tests/phpunit/includes/build-visual-html-tree.php
@@ -0,0 +1,304 @@
+<?php
+
+/* phpcs:disable WordPress.Security.EscapeOutput.ExceptionNotEscaped */
+
+/**
+ * Generates representation of the semantic HTML tree structure.
+ *
+ * This is inspired by the representation used by the HTML5lib tests. It's been extended here for
+ * blocks to render the semantic structure of blocks and their attributes.
+ * The order of attributes and class names is normalized both for HTML tags and blocks,
+ * as is the whitespace in HTML tags' style attribute.
+ *
+ * For example, consider the following block markup:
+ *
+ * <!-- wp:separator {"className":"is-style-default has-custom-classname","style":{"spacing":{"margin":{"top":"50px","bottom":"50px"}}},"backgroundColor":"accent-1"} -->
+ * <hr class="wp-block-separator is-style-default has-custom-classname" style="margin-top: 50px; margin-bottom: 50px" />
+ * <!-- /wp:separator -->
+ *
+ * This will be represented as:
+ *
+ * BLOCK["core/separator"]
+ * {
+ * "backgroundColor": "accent-1",
+ * "className": "has-custom-classname is-style-default",
+ * "style": {
+ * "spacing": {
+ * "margin": {
+ * "top": "50px",
+ * "bottom": "50px"
+ * }
+ * }
+ * }
+ * }
+ * <hr>
+ * class="has-custom-classname is-style-default wp-block-separator"
+ * style="margin-top:50px;margin-bottom:50px;"
+ *
+ *
+ * @see https://github.com/WordPress/wordpress-develop/blob/trunk/tests/phpunit/data/html5lib-tests/tree-construction/README.md
+ *
+ * @since 6.9.0
+ *
+ * @throws WP_HTML_Unsupported_Exception|Error If the markup could not be parsed.
+ *
+ * @param string $html Given test HTML.
+ * @param string|null $fragment_context Context element in which to parse HTML, such as BODY or SVG.
+ * @return string Tree structure of parsed HTML, if supported.
+ */
+function build_visual_html_tree( string $html, ?string $fragment_context ): string {
+ $processor = $fragment_context
+ ? WP_HTML_Processor::create_fragment( $html, $fragment_context )
+ : WP_HTML_Processor::create_full_parser( $html );
+ if ( null === $processor ) {
+ throw new Error( 'Could not create a parser.' );
+ }
+ $tree_indent = ' ';
+
+ $output = '';
+ $indent_level = 0;
+ $was_text = null;
+ $text_node = '';
+
+ $block_context = array();
+
+ while ( $processor->next_token() ) {
+ if ( null !== $processor->get_last_error() ) {
+ break;
+ }
+
+ $token_name = $processor->get_token_name();
+ $token_type = $processor->get_token_type();
+ $is_closer = $processor->is_tag_closer();
+
+ if ( $was_text && '#text' !== $token_name ) {
+ if ( '' !== $text_node ) {
+ $output .= "{$text_node}\"\n";
+ }
+ $was_text = false;
+ $text_node = '';
+ }
+
+ switch ( $token_type ) {
+ case '#doctype':
+ $doctype = $processor->get_doctype_info();
+ $output .= "<!DOCTYPE {$doctype->name}";
+ if ( null !== $doctype->public_identifier || null !== $doctype->system_identifier ) {
+ $output .= " \"{$doctype->public_identifier}\" \"{$doctype->system_identifier}\"";
+ }
+ $output .= ">\n";
+ break;
+
+ case '#tag':
+ $namespace = $processor->get_namespace();
+ $tag_name = 'html' === $namespace
+ ? strtolower( $processor->get_tag() )
+ : "{$namespace} {$processor->get_qualified_tag_name()}";
+
+ if ( $is_closer ) {
+ --$indent_level;
+
+ if ( 'html' === $namespace && 'TEMPLATE' === $token_name ) {
+ --$indent_level;
+ }
+
+ break;
+ }
+
+ $tag_indent = $indent_level;
+
+ if ( $processor->expects_closer() ) {
+ ++$indent_level;
+ }
+
+ $output .= str_repeat( $tree_indent, $tag_indent ) . "<{$tag_name}>\n";
+
+ $attribute_names = $processor->get_attribute_names_with_prefix( '' );
+ if ( $attribute_names ) {
+ $sorted_attributes = array();
+ foreach ( $attribute_names as $attribute_name ) {
+ $sorted_attributes[ $attribute_name ] = $processor->get_qualified_attribute_name( $attribute_name );
+ }
+
+ /*
+ * Sorts attributes to match html5lib sort order.
+ *
+ * - First comes normal HTML attributes.
+ * - Then come adjusted foreign attributes; these have spaces in their names.
+ * - Finally come non-adjusted foreign attributes; these have a colon in their names.
+ *
+ * Example:
+ *
+ * From: <math xlink:author definitionurl xlink:title xlink:show>
+ * Sorted: 'definitionURL', 'xlink show', 'xlink title', 'xlink:author'
+ */
+ uasort(
+ $sorted_attributes,
+ static function ( $a, $b ) {
+ $a_has_ns = str_contains( $a, ':' );
+ $b_has_ns = str_contains( $b, ':' );
+
+ // Attributes with `:` should follow all other attributes.
+ if ( $a_has_ns !== $b_has_ns ) {
+ return $a_has_ns ? 1 : -1;
+ }
+
+ $a_has_sp = str_contains( $a, ' ' );
+ $b_has_sp = str_contains( $b, ' ' );
+
+ // Attributes with a namespace ' ' should come after those without.
+ if ( $a_has_sp !== $b_has_sp ) {
+ return $a_has_sp ? 1 : -1;
+ }
+
+ return $a <=> $b;
+ }
+ );
+
+ foreach ( $sorted_attributes as $attribute_name => $display_name ) {
+ $val = $processor->get_attribute( $attribute_name );
+ /*
+ * Attributes with no value are `true` with the HTML API,
+ * we use the empty string value in the tree structure.
+ */
+ if ( true === $val ) {
+ $val = '';
+ } elseif ( 'class' === $attribute_name ) {
+ $class_names = iterator_to_array( $processor->class_list() );
+ sort( $class_names, SORT_STRING );
+ $val = implode( ' ', $class_names );
+ } elseif ( 'style' === $attribute_name ) {
+ $normalized_style = '';
+ foreach ( explode( ';', $val ) as $style ) {
+ if ( empty( trim( $style ) ) ) {
+ continue;
+ }
+ list( $style_key, $style_val ) = explode( ':', $style );
+
+ $style_key = trim( $style_key );
+ $style_val = trim( $style_val );
+
+ $normalized_style .= "{$style_key}:{$style_val};";
+ }
+ $val = $normalized_style;
+ }
+ $output .= str_repeat( $tree_indent, $tag_indent + 1 ) . "{$display_name}=\"{$val}\"\n";
+ }
+ }
+
+ // Self-contained tags contain their inner contents as modifiable text.
+ $modifiable_text = $processor->get_modifiable_text();
+ if ( '' !== $modifiable_text ) {
+ $output .= str_repeat( $tree_indent, $tag_indent + 1 ) . "\"{$modifiable_text}\"\n";
+ }
+
+ if ( 'html' === $namespace && 'TEMPLATE' === $token_name ) {
+ $output .= str_repeat( $tree_indent, $indent_level ) . "content\n";
+ ++$indent_level;
+ }
+
+ break;
+
+ case '#cdata-section':
+ case '#text':
+ $text_content = $processor->get_modifiable_text();
+ if ( '' === trim( $text_content, " \f\t\r\n" ) ) {
+ break;
+ }
+ $was_text = true;
+ if ( '' === $text_node ) {
+ $text_node .= str_repeat( $tree_indent, $indent_level ) . '"';
+ }
+ $text_node .= $text_content;
+ break;
+
+ case '#funky-comment':
+ // Comments must be "<" then "!-- " then the data then " -->".
+ $output .= str_repeat( $tree_indent, $indent_level ) . "<!-- {$processor->get_modifiable_text()} -->\n";
+ break;
+
+ case '#comment':
+ // Comments must be "<" then "!--" then the data then "-->".
+ $comment = "<!--{$processor->get_full_comment_text()}-->";
+
+ // Maybe the comment is a block delimiter.
+ $parser = new WP_Block_Parser();
+ $parser->document = $comment;
+ $parser->offset = 0;
+ list( $delimiter_type, $block_name, $block_attrs, $start_offset, $token_length ) = $parser->next_token();
+
+ switch ( $delimiter_type ) {
+ case 'block-opener':
+ case 'void-block':
+ $output .= str_repeat( $tree_indent, $indent_level ) . "BLOCK[\"{$block_name}\"]\n";
+
+ if ( 'block-opener' === $delimiter_type ) {
+ $block_context[] = $block_name;
+ ++$indent_level;
+ }
+
+ // If they're no attributes, we're done here.
+ if ( empty( $block_attrs ) ) {
+ break;
+ }
+
+ // Normalize attribute order.
+ ksort( $block_attrs, SORT_STRING );
+
+ if ( isset( $block_attrs['className'] ) ) {
+ // Normalize class name order (and de-duplicate), as we need to be tolerant of different orders.
+ // (Style attributes don't need this treatment, as they are parsed into a nested array.)
+ $block_class_processor = new WP_HTML_Tag_Processor( '<div>' );
+ $block_class_processor->next_token();
+ $block_class_processor->set_attribute( 'class', $block_attrs['className'] );
+ $class_names = iterator_to_array( $block_class_processor->class_list() );
+ sort( $class_names, SORT_STRING );
+ $block_attrs['className'] = implode( ' ', $class_names );
+ }
+
+ $block_attrs = json_encode( $block_attrs, JSON_PRETTY_PRINT );
+ // Fix indentation by "halving" it (2 spaces instead of 4).
+ // Additionally, we need to indent each line by the current indentation level.
+ $block_attrs = preg_replace( '/^( +)\1/m', str_repeat( $tree_indent, $indent_level ) . '$1', $block_attrs );
+ // Finally, indent the first line, and the last line (with the closing curly brace).
+ $output .= str_repeat( $tree_indent, $indent_level ) . substr( $block_attrs, 0, -1 ) . str_repeat( $tree_indent, $indent_level ) . "}\n";
+ break;
+ case 'block-closer':
+ // Is this a closer for the currently open block?
+ if ( ! empty( $block_context ) && end( $block_context ) === $block_name ) {
+ // If it's a closer, we don't add it to the output.
+ // Instead, we decrease indentation and remove the block from block context stack.
+ --$indent_level;
+ array_pop( $block_context );
+ }
+ break;
+ default: // Not a block delimiter.
+ $output .= str_repeat( $tree_indent, $indent_level ) . $comment . "\n";
+ break;
+ }
+ break;
+ default:
+ // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export
+ $serialized_token_type = var_export( $processor->get_token_type(), true );
+ throw new Error( "Unhandled token type for tree construction: {$serialized_token_type}" );
+ }
+ }
+
+ if ( null !== $processor->get_unsupported_exception() ) {
+ throw $processor->get_unsupported_exception();
+ }
+
+ if ( null !== $processor->get_last_error() ) {
+ throw new Error( "Parser error: {$processor->get_last_error()}" );
+ }
+
+ if ( $processor->paused_at_incomplete_token() ) {
+ throw new Error( 'Paused at incomplete token.' );
+ }
+
+ if ( '' !== $text_node ) {
+ $output .= "{$text_node}\"\n";
+ }
+
+ return $output;
+}
diff --git a/tests/phpunit/includes/factory/class-wp-unittest-factory-for-attachment.php b/tests/phpunit/includes/factory/class-wp-unittest-factory-for-attachment.php
index 262c6c4640..2c1872795f 100644
--- a/tests/phpunit/includes/factory/class-wp-unittest-factory-for-attachment.php
+++ b/tests/phpunit/includes/factory/class-wp-unittest-factory-for-attachment.php
@@ -50,12 +50,13 @@ class WP_UnitTest_Factory_For_Attachment extends WP_UnitTest_Factory_For_Post {
}
/**
- * Saves an attachment.
+ * Saves a file as an attachment.
*
* @since 4.4.0
* @since 6.2.0 Returns a WP_Error object on failure.
*
- * @param string $file The file name to create attachment object for.
+ * @param string $file Full path to the file to create an attachment object for.
+ * The name of the file will be used as the attachment name.
* @param int $parent_post_id ID of the post to attach the file to.
*
* @return int|WP_Error The attachment ID on success, WP_Error object on failure.
diff --git a/tests/phpunit/includes/object-cache.php b/tests/phpunit/includes/object-cache.php
index ef03546892..daffcabac5 100644
--- a/tests/phpunit/includes/object-cache.php
+++ b/tests/phpunit/includes/object-cache.php
@@ -160,8 +160,8 @@ function wp_cache_cas( $cas_token, $key, $value, $group = '', $expiration = 0 )
*
* @link https://www.php.net/manual/en/memcached.casbykey.php
*
- * @param string $server_key The key identifying the server to store the value on.
* @param float $cas_token Unique value associated with the existing item. Generated by memcached.
+ * @param string $server_key The key identifying the server to store the value on.
* @param string $key The key under which to store the value.
* @param mixed $value The value to store.
* @param string $group The group value appended to the $key.
@@ -1238,8 +1238,8 @@ class WP_Object_Cache {
*
* @link https://www.php.net/manual/en/memcached.casbykey.php
*
- * @param string $server_key The key identifying the server to store the value on.
* @param float $cas_token Unique value associated with the existing item. Generated by memcached.
+ * @param string $server_key The key identifying the server to store the value on.
* @param string $key The key under which to store the value.
* @param mixed $value The value to store.
* @param string $group The group value appended to the $key.
@@ -1929,12 +1929,12 @@ class WP_Object_Cache {
*
* @link https://www.php.net/manual/en/memcached.replace.php
*
- * @param string $server_key The key identifying the server to store the value on.
* @param string $key The key under which to store the value.
* @param mixed $value The value to store.
* @param string $group The group value appended to the $key.
- * @param bool $by_key True to store in internal cache by key; false to not store by key.
* @param int $expiration The expiration time, defaults to 0.
+ * @param string $server_key The key identifying the server to store the value on.
+ * @param bool $by_key True to store in internal cache by key; false to not store by key.
* @return bool True on success, false on failure.
*/
public function replace( $key, $value, $group = 'default', $expiration = 0, $server_key = '', $by_key = false ) {
diff --git a/tests/phpunit/tests/admin/includesPlugin.php b/tests/phpunit/tests/admin/includesPlugin.php
index e95697810d..4d47fb7db0 100644
--- a/tests/phpunit/tests/admin/includesPlugin.php
+++ b/tests/phpunit/tests/admin/includesPlugin.php
@@ -4,7 +4,16 @@
* @group admin
*/
class Tests_Admin_IncludesPlugin extends WP_UnitTestCase {
+
+ /**
+ * Admin user ID.
+ *
+ * @var int $admin_id
+ */
+ public static $admin_id;
+
public static function wpSetUpBeforeClass( $factory ) {
+ self::$admin_id = $factory->user->create( array( 'role' => 'administrator' ) );
self::_back_up_mu_plugins();
}
@@ -37,7 +46,7 @@ class Tests_Admin_IncludesPlugin extends WP_UnitTestCase {
public function test_menu_page_url() {
$current_user = get_current_user_id();
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
+ wp_set_current_user( self::$admin_id );
update_option( 'siteurl', 'http://example.com' );
// Add some pages.
@@ -81,7 +90,7 @@ class Tests_Admin_IncludesPlugin extends WP_UnitTestCase {
global $submenu;
global $menu;
$current_user = get_current_user_id();
- $admin_user = self::factory()->user->create( array( 'role' => 'administrator' ) );
+ $admin_user = self::$admin_id;
wp_set_current_user( $admin_user );
set_current_screen( 'dashboard' );
@@ -134,7 +143,7 @@ class Tests_Admin_IncludesPlugin extends WP_UnitTestCase {
$menu = array();
$current_user = get_current_user_id();
- $admin_user = self::factory()->user->create( array( 'role' => 'administrator' ) );
+ $admin_user = self::$admin_id;
wp_set_current_user( $admin_user );
set_current_screen( 'dashboard' );
@@ -283,7 +292,7 @@ class Tests_Admin_IncludesPlugin extends WP_UnitTestCase {
$submenu = array();
$menu = array();
$current_user = get_current_user_id();
- $admin_user = self::factory()->user->create( array( 'role' => 'administrator' ) );
+ $admin_user = self::$admin_id;
wp_set_current_user( $admin_user );
set_current_screen( 'dashboard' );
@@ -316,7 +325,7 @@ class Tests_Admin_IncludesPlugin extends WP_UnitTestCase {
$submenu = array();
$menu = array();
$current_user = get_current_user_id();
- $admin_user = self::factory()->user->create( array( 'role' => 'administrator' ) );
+ $admin_user = self::$admin_id;
wp_set_current_user( $admin_user );
set_current_screen( 'dashboard' );
@@ -344,7 +353,7 @@ class Tests_Admin_IncludesPlugin extends WP_UnitTestCase {
$submenu = array();
$menu = array();
$current_user = get_current_user_id();
- $admin_user = self::factory()->user->create( array( 'role' => 'administrator' ) );
+ $admin_user = self::$admin_id;
wp_set_current_user( $admin_user );
set_current_screen( 'dashboard' );
diff --git a/tests/phpunit/tests/admin/includesTemplate.php b/tests/phpunit/tests/admin/includesTemplate.php
index 66e3befd5f..909aff217a 100644
--- a/tests/phpunit/tests/admin/includesTemplate.php
+++ b/tests/phpunit/tests/admin/includesTemplate.php
@@ -3,6 +3,16 @@
* @group admin
*/
class Tests_Admin_IncludesTemplate extends WP_UnitTestCase {
+ /**
+ * Editor user ID.
+ *
+ * @var int $editor_id
+ */
+ public static $editor_id;
+
+ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
+ self::$editor_id = $factory->user->create( array( 'role' => 'editor' ) );
+ }
/**
* @ticket 51137
@@ -64,7 +74,7 @@ class Tests_Admin_IncludesTemplate extends WP_UnitTestCase {
wp_set_object_terms( $post->ID, $term['term_id'], 'wptests_tax_1' );
// Test that get_inline_data() has `post_category` div containing the assigned term.
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'editor' ) ) );
+ wp_set_current_user( self::$editor_id );
get_inline_data( $post );
$this->expectOutputRegex( '/<div class="post_category" id="wptests_tax_1_' . $post->ID . '">' . $term['term_id'] . '<\/div>/' );
}
@@ -90,7 +100,7 @@ class Tests_Admin_IncludesTemplate extends WP_UnitTestCase {
wp_set_object_terms( $post->ID, $term['term_id'], 'wptests_tax_1' );
// Test that get_inline_data() has `tags_input` div containing the assigned term.
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'editor' ) ) );
+ wp_set_current_user( self::$editor_id );
get_inline_data( $post );
$this->expectOutputRegex( '/<div class="tags_input" id="wptests_tax_1_' . $post->ID . '">Test<\/div>/' );
}
diff --git a/tests/phpunit/tests/admin/wpPluginsListTable.php b/tests/phpunit/tests/admin/wpPluginsListTable.php
index af44861324..0b10881c46 100644
--- a/tests/phpunit/tests/admin/wpPluginsListTable.php
+++ b/tests/phpunit/tests/admin/wpPluginsListTable.php
@@ -57,7 +57,7 @@ class Tests_Admin_wpPluginsListTable extends WP_UnitTestCase {
'role' => 'administrator',
'user_login' => 'test_wp_plugins_list_table',
'user_pass' => 'password',
- 'user_email' => 'testadmin@test.com',
+ 'user_email' => 'testadmin@example.com',
)
);
self::$original_s = $s;
diff --git a/tests/phpunit/tests/ajax/wpAjaxSendAttachmentToEditor.php b/tests/phpunit/tests/ajax/wpAjaxSendAttachmentToEditor.php
index 29066ff287..351485afd1 100644
--- a/tests/phpunit/tests/ajax/wpAjaxSendAttachmentToEditor.php
+++ b/tests/phpunit/tests/ajax/wpAjaxSendAttachmentToEditor.php
@@ -14,6 +14,28 @@ require_once ABSPATH . 'wp-admin/includes/ajax-actions.php';
class Tests_Ajax_wpAjaxSendAttachmentToEditor extends WP_Ajax_UnitTestCase {
/**
+ * Shared user ID for the tests.
+ *
+ * @var int
+ */
+ public static $user_id = 0;
+
+ /**
+ * Set up shared fixtures.
+ *
+ * @param WP_UnitTest_Factory $factory
+ */
+ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
+ self::$user_id = $factory->user->create(
+ array(
+ 'role' => 'administrator',
+ 'user_login' => 'user_36578_administrator',
+ 'user_email' => 'user_36578_administrator@example.com',
+ )
+ );
+ }
+
+ /**
* @ticket 36578
*
* @covers ::get_image_send_to_editor
@@ -105,13 +127,7 @@ class Tests_Ajax_wpAjaxSendAttachmentToEditor extends WP_Ajax_UnitTestCase {
public function test_wp_ajax_set_attachment_thumbnail_success() {
// Become an administrator.
$post = $_POST;
- $user_id = self::factory()->user->create(
- array(
- 'role' => 'administrator',
- 'user_login' => 'user_36578_administrator',
- 'user_email' => 'user_36578_administrator@example.com',
- )
- );
+ $user_id = self::$user_id;
wp_set_current_user( $user_id );
$_POST = array_merge( $_POST, $post );
@@ -151,13 +167,7 @@ class Tests_Ajax_wpAjaxSendAttachmentToEditor extends WP_Ajax_UnitTestCase {
public function test_wp_ajax_set_attachment_thumbnail_missing_nonce() {
// Become an administrator.
$post = $_POST;
- $user_id = self::factory()->user->create(
- array(
- 'role' => 'administrator',
- 'user_login' => 'user_36578_administrator',
- 'user_email' => 'user_36578_administrator@example.com',
- )
- );
+ $user_id = self::$user_id;
wp_set_current_user( $user_id );
$_POST = array_merge( $_POST, $post );
diff --git a/tests/phpunit/tests/ajax/wpCustomizeNavMenus.php b/tests/phpunit/tests/ajax/wpCustomizeNavMenus.php
index 1dfe5f684d..08353f6e65 100644
--- a/tests/phpunit/tests/ajax/wpCustomizeNavMenus.php
+++ b/tests/phpunit/tests/ajax/wpCustomizeNavMenus.php
@@ -38,6 +38,26 @@ class Tests_Ajax_wpCustomizeNavMenus extends WP_Ajax_UnitTestCase {
*/
public static $terms;
+
+ /**
+ * Admin user ID.
+ *
+ * @var int
+ */
+ public static $admin_user_id = 0;
+
+ /**
+ * User IDs keyed by role.
+ *
+ * @var int[]
+ */
+ public static $user_ids = array();
+
+ /**
+ * Set up shared fixtures.
+ *
+ * @param WP_UnitTest_Factory $factory The factory.
+ */
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
// Make some post objects.
self::$posts = $factory->post->create_many( 5 );
@@ -45,6 +65,13 @@ class Tests_Ajax_wpCustomizeNavMenus extends WP_Ajax_UnitTestCase {
// Some terms too.
self::$terms = $factory->term->create_many( 5 );
+
+ // Create an admin user.
+ self::$admin_user_id = $factory->user->create( array( 'role' => 'administrator' ) );
+
+ foreach ( array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' ) as $role ) {
+ self::$user_ids[ $role ] = $factory->user->create( array( 'role' => $role ) );
+ }
}
/**
@@ -53,7 +80,7 @@ class Tests_Ajax_wpCustomizeNavMenus extends WP_Ajax_UnitTestCase {
public function set_up() {
parent::set_up();
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
+ wp_set_current_user( self::$admin_user_id );
global $wp_customize;
$this->wp_customize = new WP_Customize_Manager();
$wp_customize = $this->wp_customize;
@@ -91,7 +118,7 @@ class Tests_Ajax_wpCustomizeNavMenus extends WP_Ajax_UnitTestCase {
$this->expectExceptionMessage( '-1' );
}
- wp_set_current_user( self::factory()->user->create( array( 'role' => $role ) ) );
+ wp_set_current_user( self::$user_ids[ $role ] );
$_POST = array(
'action' => 'load-available-menu-items-customizer',
@@ -485,7 +512,7 @@ class Tests_Ajax_wpCustomizeNavMenus extends WP_Ajax_UnitTestCase {
$this->expectExceptionMessage( '-1' );
}
- wp_set_current_user( self::factory()->user->create( array( 'role' => $role ) ) );
+ wp_set_current_user( self::$user_ids[ $role ] );
$_POST = array(
'action' => 'search-available-menu-items-customizer',
@@ -705,7 +732,7 @@ class Tests_Ajax_wpCustomizeNavMenus extends WP_Ajax_UnitTestCase {
$this->assertSame( 'bad_nonce', $response['data'] );
// Bad nonce.
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'subscriber' ) ) );
+ wp_set_current_user( self::$user_ids['subscriber'] );
$_POST = wp_slash(
array(
'customize-menus-nonce' => wp_create_nonce( 'customize-menus' ),
@@ -718,7 +745,7 @@ class Tests_Ajax_wpCustomizeNavMenus extends WP_Ajax_UnitTestCase {
$this->assertSame( 'customize_not_allowed', $response['data'] );
// Missing params.
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
+ wp_set_current_user( self::$user_ids['administrator'] );
$_POST = wp_slash(
array(
'customize-menus-nonce' => wp_create_nonce( 'customize-menus' ),
diff --git a/tests/phpunit/tests/auth.php b/tests/phpunit/tests/auth.php
index 3bdcb98b65..a490842ebd 100644
--- a/tests/phpunit/tests/auth.php
+++ b/tests/phpunit/tests/auth.php
@@ -1579,12 +1579,7 @@ class Tests_Auth extends WP_UnitTestCase {
* @covers ::wp_validate_application_password
*/
public function test_application_password_authentication() {
- $user_id = self::factory()->user->create(
- array(
- 'user_login' => 'http_auth_login',
- 'user_pass' => 'http_auth_pass', // Shouldn't be allowed for API login.
- )
- );
+ $user_id = self::$_user->ID;
// Create a new app-only password.
list( $user_app_password, $item ) = WP_Application_Passwords::create_new_application_password( $user_id, array( 'name' => 'phpunit' ) );
@@ -1594,8 +1589,8 @@ class Tests_Auth extends WP_UnitTestCase {
add_filter( 'wp_is_application_passwords_available', '__return_true' );
// Fake an HTTP Auth request with the regular account password first.
- $_SERVER['PHP_AUTH_USER'] = 'http_auth_login';
- $_SERVER['PHP_AUTH_PW'] = 'http_auth_pass';
+ $_SERVER['PHP_AUTH_USER'] = self::USER_LOGIN;
+ $_SERVER['PHP_AUTH_PW'] = self::USER_PASS;
$this->assertNull(
wp_validate_application_password( null ),
@@ -2094,9 +2089,6 @@ class Tests_Auth extends WP_UnitTestCase {
}
private static function get_default_bcrypt_cost(): int {
- $hash = password_hash( 'password', PASSWORD_BCRYPT );
- $info = password_get_info( $hash );
-
- return $info['options']['cost'];
+ return 5;
}
}
diff --git a/tests/phpunit/tests/build-visual-html-tree.php b/tests/phpunit/tests/build-visual-html-tree.php
new file mode 100644
index 0000000000..42e35c5b74
--- /dev/null
+++ b/tests/phpunit/tests/build-visual-html-tree.php
@@ -0,0 +1,144 @@
+<?php
+
+/**
+ * Tests for build_visual_html_tree().
+ *
+ * @package WordPress
+ *
+ * @group testsuite
+ */
+class Tests_Build_Equivalent_HTML_Semantic_Tree extends WP_UnitTestCase {
+ public function data_build_equivalent_html_semantic_tree() {
+ $block_markup = <<<END
+ <!-- wp:separator {"className":"is-style-default has-custom-classname","style":{"spacing":{"margin":{"top":"50px","bottom":"50px"}}},"backgroundColor":"accent-1"} -->
+ <hr class="wp-block-separator is-style-default has-custom-classname" style="margin-top: 50px; margin-bottom: 50px" />
+ <!-- /wp:separator -->
+END;
+
+ $tree_structure = <<<END
+BLOCK["core/separator"]
+ {
+ "backgroundColor": "accent-1",
+ "className": "has-custom-classname is-style-default",
+ "style": {
+ "spacing": {
+ "margin": {
+ "top": "50px",
+ "bottom": "50px"
+ }
+ }
+ }
+ }
+ <hr>
+ class="has-custom-classname is-style-default wp-block-separator"
+ style="margin-top:50px;margin-bottom:50px;"
+
+END;
+
+ return array(
+ 'Block delimiter' => array( $block_markup, $tree_structure ),
+ );
+ }
+
+ /**
+ * @ticket 63527
+ *
+ * @covers ::build_visual_html_tree
+ *
+ * @dataProvider data_build_equivalent_html_semantic_tree
+ */
+ public function test_build_equivalent_html_semantic_tree( $markup, $expected ) {
+ $actual = build_visual_html_tree( $markup, '<body>' );
+ $this->assertSame( $expected, $actual );
+ }
+
+ public function data_build_equivalent_html_semantic_tree_with_equivalent_html() {
+ return array(
+ 'Different attribute order' => array(
+ '<img src="wp.png" alt="The WordPress logo">',
+ '<img alt="The WordPress logo" src="wp.png">',
+ ),
+ 'Different class name order' => array(
+ '<hr class="wp-block-separator is-style-default">',
+ '<hr class="is-style-default wp-block-separator">',
+ ),
+ 'Differences in style attribute whitespace and trailing semicolon' => array(
+ '<hr style="margin-top: 50px; margin-bottom: 50px;">',
+ '<hr style="margin-top:50px;margin-bottom: 50px">',
+ ),
+ 'Different block attribute order' => array(
+ '<!-- wp:separator {"className":"is-style-default","backgroundColor":"accent-1"} -->',
+ '<!-- wp:separator {"backgroundColor":"accent-1","className":"is-style-default"} -->',
+ ),
+ 'Different block class name order' => array(
+ '<!-- wp:separator {"className":"is-style-default has-custom-classname"} -->',
+ '<!-- wp:separator {"className":"has-custom-classname is-style-default"} -->',
+ ),
+ 'Different whitespace in block class name' => array(
+ '<!-- wp:separator {"className":"wp-block-separator is-style-default"} -->',
+ '<!-- wp:separator {"className":"wp-block-separator is-style-default "} -->',
+ ),
+ 'Duplicated block class names' => array(
+ '<!-- wp:separator {"className":"wp-block-separator is-style-default"} -->',
+ '<!-- wp:separator {"className":"wp-block-separator is-style-default wp-block-separator"} -->',
+ ),
+ 'Different Capitalization of tag' => array(
+ '<IMG src="wp.png" alt="The WordPress logo">',
+ '<img src="wp.png" alt="The WordPress logo">',
+ ),
+ );
+ }
+
+ /**
+ * @ticket 63527
+ *
+ * @covers ::build_visual_html_tree
+ *
+ * @dataProvider data_build_equivalent_html_semantic_tree_with_equivalent_html
+ */
+ public function test_build_equivalent_html_semantic_tree_with_equivalent_html( $expected, $actual ) {
+ $tree_expected = build_visual_html_tree( $expected, '<body>' );
+ $tree_actual = build_visual_html_tree( $actual, '<body>' );
+
+ $this->assertSame( $tree_expected, $tree_actual );
+ }
+
+ public function data_build_equivalent_html_semantic_tree_with_non_equivalent_html() {
+ return array(
+ 'Different attributes' => array(
+ '<img src="wp.png" alt="The WordPress logo">',
+ '<img alt="The WordPress logo" src="wp.png" title="WordPress">',
+ ),
+ 'Different class names' => array(
+ '<hr class="wp-block-separator is-style-default">',
+ '<hr class="is-style-default wp-block-hairline">',
+ ),
+ 'Different styles' => array(
+ '<hr style="margin-top: 50px; margin-bottom: 50px;">',
+ '<hr style="margin-top: 50px; margin-bottom: 100px">',
+ ),
+ 'Different comments' => array(
+ '<!-- abc -->',
+ '<!-- xyz -->',
+ ),
+ 'Semantically relevant whitespace' => array(
+ '<div style="color: rgb(50 139 31)">Test</div>',
+ '<div style="color:rgb(5013931)">Test</div>',
+ ),
+ );
+ }
+
+ /**
+ * @ticket 63527
+ *
+ * @covers ::build_visual_html_tree
+ *
+ * @dataProvider data_build_equivalent_html_semantic_tree_with_non_equivalent_html
+ */
+ public function test_build_equivalent_html_semantic_tree_with_non_equivalent_html( $expected, $actual ) {
+ $tree_expected = build_visual_html_tree( $expected, '<body>' );
+ $tree_actual = build_visual_html_tree( $actual, '<body>' );
+
+ $this->assertNotSame( $tree_expected, $tree_actual );
+ }
+}
diff --git a/tests/phpunit/tests/comment.php b/tests/phpunit/tests/comment.php
index 2af822f456..be36ba4059 100644
--- a/tests/phpunit/tests/comment.php
+++ b/tests/phpunit/tests/comment.php
@@ -21,7 +21,7 @@ class Tests_Comment extends WP_UnitTestCase {
'role' => 'author',
'user_login' => 'test_wp_user_get',
'user_pass' => 'password',
- 'user_email' => 'test@test.com',
+ 'user_email' => 'author@example.com',
)
);
@@ -95,7 +95,7 @@ class Tests_Comment extends WP_UnitTestCase {
'comment_post_ID' => self::$post_id,
'comment_author' => 'Author',
'comment_author_url' => 'http://example.localhost/',
- 'comment_author_email' => 'test@test.com',
+ 'comment_author_email' => 'author@example.com',
'user_id' => $admin_id_1,
'comment_content' => 'This is a comment',
)
@@ -108,7 +108,7 @@ class Tests_Comment extends WP_UnitTestCase {
'role' => 'administrator',
'user_login' => 'test_wp_admin_get',
'user_pass' => 'password',
- 'user_email' => 'testadmin@test.com',
+ 'user_email' => 'testadmin@example.com',
)
);
@@ -139,7 +139,7 @@ class Tests_Comment extends WP_UnitTestCase {
'comment_post_ID' => self::$post_id,
'comment_author' => 'Author',
'comment_author_url' => 'http://example.localhost/',
- 'comment_author_email' => 'test@test.com',
+ 'comment_author_email' => 'author@example.com',
'user_id' => self::$user_id,
'comment_content' => '<a href="http://example.localhost/something.html">click</a>',
)
@@ -152,7 +152,7 @@ class Tests_Comment extends WP_UnitTestCase {
'role' => 'administrator',
'user_login' => 'test_wp_admin_get',
'user_pass' => 'password',
- 'user_email' => 'testadmin@test.com',
+ 'user_email' => 'testadmin@example.com',
)
);
@@ -1445,10 +1445,10 @@ class Tests_Comment extends WP_UnitTestCase {
// Post authors possibly notified when a comment is approved on their post.
wp_set_comment_status( $comment, 'approve' );
- // Check to see if a notification email was sent to the post author `test@test.com`.
+ // Check to see if a notification email was sent to the post author `author@example.com`.
if ( isset( $GLOBALS['phpmailer']->mock_sent )
&& ! empty( $GLOBALS['phpmailer']->mock_sent )
- && 'test@test.com' === $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0]
+ && 'author@example.com' === $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0]
) {
$email_sent_when_comment_approved = true;
} else {
@@ -1467,10 +1467,10 @@ class Tests_Comment extends WP_UnitTestCase {
);
wp_new_comment( $data );
- // Check to see if a notification email was sent to the post author `test@test.com`.
+ // Check to see if a notification email was sent to the post author `author@example.com`.
if ( isset( $GLOBALS['phpmailer']->mock_sent ) &&
! empty( $GLOBALS['phpmailer']->mock_sent ) &&
- 'test@test.com' === $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0] ) {
+ 'author@example.com' === $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0] ) {
$email_sent_when_comment_added = true;
reset_phpmailer_instance();
} else {
@@ -1566,6 +1566,8 @@ class Tests_Comment extends WP_UnitTestCase {
$lengths = wp_get_comment_fields_max_lengths();
+ $this->assertNotEmpty( $lengths );
+
foreach ( $lengths as $field => $length ) {
$this->assertSame( $expected[ $field ], $length );
}
diff --git a/tests/phpunit/tests/comment/commentForm.php b/tests/phpunit/tests/comment/commentForm.php
index 771cbc1b57..e3dab07e24 100644
--- a/tests/phpunit/tests/comment/commentForm.php
+++ b/tests/phpunit/tests/comment/commentForm.php
@@ -193,4 +193,38 @@ class Tests_Comment_CommentForm extends WP_UnitTestCase {
$post_hidden_field = "<input type='hidden' name='comment_post_ID' value='{$post_id}' id='comment_post_ID' />";
$this->assertStringContainsString( $post_hidden_field, $form );
}
+
+ /**
+ * Tests novalidate attribute on the comment form.
+ *
+ * @ticket 47595
+ */
+ public function test_comment_form_and_novalidate_attribute() {
+ $post_id = self::$post_id;
+
+ // By default, the novalidate is not emitted.
+ $form = get_echo( 'comment_form', array( array(), $post_id ) );
+ $p = new WP_HTML_Tag_Processor( $form );
+ $this->assertTrue( $p->next_tag( array( 'tag_name' => 'FORM' ) ), 'Expected FORM tag.' );
+ $this->assertNull( $p->get_attribute( 'novalidate' ), 'Expected FORM to not have novalidate attribute by default.' );
+
+ // Opt in to the novalidate attribute by passing an arg to comment_form().
+ $form = get_echo( 'comment_form', array( array( 'novalidate' => true ), $post_id ) );
+ $p = new WP_HTML_Tag_Processor( $form );
+ $this->assertTrue( $p->next_tag( array( 'tag_name' => 'FORM' ) ), 'Expected FORM tag.' );
+ $this->assertTrue( $p->get_attribute( 'novalidate' ), 'Expected FORM to have the novalidate attribute.' );
+
+ // Opt in to the novalidate attribute via the comment_form_defaults filter.
+ add_filter(
+ 'comment_form_defaults',
+ static function ( array $defaults ): array {
+ $defaults['novalidate'] = true;
+ return $defaults;
+ }
+ );
+ $form = get_echo( 'comment_form', array( array(), $post_id ) );
+ $p = new WP_HTML_Tag_Processor( $form );
+ $this->assertTrue( $p->next_tag( array( 'tag_name' => 'FORM' ) ), 'Expected FORM tag.' );
+ $this->assertTrue( $p->get_attribute( 'novalidate' ), 'Expected FORM to have novalidate attribute.' );
+ }
}
diff --git a/tests/phpunit/tests/comment/commentsTemplate.php b/tests/phpunit/tests/comment/commentsTemplate.php
index 7fa51f79f9..bc260545ad 100644
--- a/tests/phpunit/tests/comment/commentsTemplate.php
+++ b/tests/phpunit/tests/comment/commentsTemplate.php
@@ -566,6 +566,9 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase {
// Find the comment permalinks.
preg_match_all( '|href="(.*?#comment-([0-9]+))|', $found_p1, $matches );
+ $this->assertNotEmpty( $matches );
+ $this->assertNotEmpty( $matches[1] );
+
// This is the main post page, so we don't expect any cpage param.
foreach ( $matches[1] as $m ) {
$this->assertStringNotContainsString( 'cpage', $m );
@@ -586,6 +589,9 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase {
// Find the comment permalinks.
preg_match_all( '|href="(.*?#comment-([0-9]+))|', $found_p2, $matches );
+ $this->assertNotEmpty( $matches );
+ $this->assertNotEmpty( $matches[1] );
+
// They should all be on page 2.
foreach ( $matches[1] as $m ) {
$this->assertStringContainsString( 'cpage=2', $m );
@@ -659,6 +665,9 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase {
// Find the comment permalinks.
preg_match_all( '|href="(.*?#comment-([0-9]+))|', $found_p0, $matches );
+ $this->assertNotEmpty( $matches );
+ $this->assertNotEmpty( $matches[1] );
+
foreach ( $matches[1] as $m ) {
$this->assertStringContainsString( 'cpage=3', $m );
}
@@ -678,6 +687,9 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase {
// Find the comment permalinks.
preg_match_all( '|href="(.*?#comment-([0-9]+))|', $found_p2, $matches );
+ $this->assertNotEmpty( $matches );
+ $this->assertNotEmpty( $matches[1] );
+
// They should all be on page 2.
foreach ( $matches[1] as $m ) {
$this->assertStringContainsString( 'cpage=2', $m );
@@ -699,6 +711,9 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase {
// Find the comment permalinks.
preg_match_all( '|href="(.*?#comment-([0-9]+))|', $found_p1, $matches );
+ $this->assertNotEmpty( $matches );
+ $this->assertNotEmpty( $matches[1] );
+
// They should all be on page 2.
foreach ( $matches[1] as $m ) {
$this->assertStringContainsString( 'cpage=1', $m );
diff --git a/tests/phpunit/tests/comment/metaCache.php b/tests/phpunit/tests/comment/metaCache.php
index 75695ccfa9..92337d9571 100644
--- a/tests/phpunit/tests/comment/metaCache.php
+++ b/tests/phpunit/tests/comment/metaCache.php
@@ -195,23 +195,23 @@ class Tests_Comment_MetaCache extends WP_UnitTestCase {
$this->go_to( get_permalink( $p ) );
- if ( have_posts() ) {
- while ( have_posts() ) {
- the_post();
-
- // Load comments with `comments_template()`.
- $cform = get_echo( 'comments_template' );
-
- // First request will hit the database.
- $num_queries = get_num_queries();
- get_comment_meta( $comment_ids[0], 'sauce' );
- $this->assertSame( 1, get_num_queries() - $num_queries );
-
- // Second and third requests should be in cache.
- get_comment_meta( $comment_ids[1], 'sauce' );
- get_comment_meta( $comment_ids[2], 'sauce' );
- $this->assertSame( 1, get_num_queries() - $num_queries );
- }
+ $this->assertTrue( have_posts() );
+
+ while ( have_posts() ) {
+ the_post();
+
+ // Load comments with `comments_template()`.
+ $cform = get_echo( 'comments_template' );
+
+ // First request will hit the database.
+ $num_queries = get_num_queries();
+ get_comment_meta( $comment_ids[0], 'sauce' );
+ $this->assertSame( 1, get_num_queries() - $num_queries );
+
+ // Second and third requests should be in cache.
+ get_comment_meta( $comment_ids[1], 'sauce' );
+ get_comment_meta( $comment_ids[2], 'sauce' );
+ $this->assertSame( 1, get_num_queries() - $num_queries );
}
}
diff --git a/tests/phpunit/tests/comment/wpHandleCommentSubmission.php b/tests/phpunit/tests/comment/wpHandleCommentSubmission.php
index 49d54e3da5..3f2ba84194 100644
--- a/tests/phpunit/tests/comment/wpHandleCommentSubmission.php
+++ b/tests/phpunit/tests/comment/wpHandleCommentSubmission.php
@@ -9,6 +9,7 @@ class Tests_Comment_wpHandleCommentSubmission extends WP_UnitTestCase {
protected static $post;
protected static $author_id;
+ protected static $author_id2;
protected static $editor_id;
protected $preprocess_comment_data = array();
@@ -22,6 +23,13 @@ class Tests_Comment_wpHandleCommentSubmission extends WP_UnitTestCase {
)
);
+ self::$author_id2 = $factory->user->create(
+ array(
+ 'role' => 'author',
+ 'user_url' => 'http://user.example.org',
+ )
+ );
+
self::$editor_id = $factory->user->create(
array(
'role' => 'editor',
@@ -223,11 +231,7 @@ class Tests_Comment_wpHandleCommentSubmission extends WP_UnitTestCase {
public function test_submitting_valid_comment_as_logged_in_user_succeeds() {
- $user = self::factory()->user->create_and_get(
- array(
- 'user_url' => 'http://user.example.org',
- )
- );
+ $user = get_user_by( 'id', self::$author_id2 );
wp_set_current_user( $user->ID );
@@ -314,11 +318,7 @@ class Tests_Comment_wpHandleCommentSubmission extends WP_UnitTestCase {
$error = 'comment_id_not_found';
- $user = self::factory()->user->create_and_get(
- array(
- 'role' => 'author',
- )
- );
+ $user = get_user_by( 'id', self::$author_id2 );
wp_set_current_user( $user->ID );
@@ -343,11 +343,7 @@ class Tests_Comment_wpHandleCommentSubmission extends WP_UnitTestCase {
$error = 'comment_id_not_found';
- $user = self::factory()->user->create_and_get(
- array(
- 'role' => 'author',
- )
- );
+ $user = get_user_by( 'id', self::$author_id2 );
wp_set_current_user( $user->ID );
@@ -834,12 +830,8 @@ class Tests_Comment_wpHandleCommentSubmission extends WP_UnitTestCase {
/**
* @ticket 36901
*/
- public function test_comments_flood_user_is_admin() {
- $user = self::factory()->user->create_and_get(
- array(
- 'role' => 'administrator',
- )
- );
+ public function test_comments_flood_user_can_moderate_comments() {
+ $user = get_user_by( 'id', self::$editor_id );
wp_set_current_user( $user->ID );
$data = array(
@@ -853,8 +845,9 @@ class Tests_Comment_wpHandleCommentSubmission extends WP_UnitTestCase {
$data['comment'] = 'Wow! I am quick!';
$second_comment = wp_handle_comment_submission( $data );
- $this->assertNotWPError( $second_comment );
- $this->assertSame( (string) self::$post->ID, $second_comment->comment_post_ID );
+ $this->assertTrue( current_user_can( 'moderate_comments' ), 'Test user should have the moderate_comments capability' );
+ $this->assertNotWPError( $second_comment, 'Second comment should not trigger comment flooding error.' );
+ $this->assertSame( (string) self::$post->ID, $second_comment->comment_post_ID, 'Second comment should be made against initial post.' );
}
/**
diff --git a/tests/phpunit/tests/customize/control.php b/tests/phpunit/tests/customize/control.php
index d472eacad9..ea3311e15c 100644
--- a/tests/phpunit/tests/customize/control.php
+++ b/tests/phpunit/tests/customize/control.php
@@ -18,11 +18,27 @@ class Test_WP_Customize_Control extends WP_UnitTestCase {
public $wp_customize;
/**
+ * Shared user ID for the tests.
+
+ * @var int
+ */
+ public static $user_id = 0;
+
+ /**
+ * Set up shared fixtures.
+ *
+ * @param WP_UnitTest_Factory $factory Factory.
+ */
+ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
+ self::$user_id = $factory->user->create( array( 'role' => 'administrator' ) );
+ }
+
+ /**
* Set up.
*/
public function set_up() {
parent::set_up();
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
+ wp_set_current_user( self::$user_id );
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
$GLOBALS['wp_customize'] = new WP_Customize_Manager();
$this->wp_customize = $GLOBALS['wp_customize'];
diff --git a/tests/phpunit/tests/customize/custom-css-setting.php b/tests/phpunit/tests/customize/custom-css-setting.php
index 015b6308af..65cc3f717f 100644
--- a/tests/phpunit/tests/customize/custom-css-setting.php
+++ b/tests/phpunit/tests/customize/custom-css-setting.php
@@ -23,24 +23,40 @@ class Test_WP_Customize_Custom_CSS_Setting extends WP_UnitTestCase {
public $setting;
/**
- * Set up the test case.
+ * The user ID to use for the tests.
*
- * @see WP_UnitTestCase_Base::set_up()
+ * @var int
*/
- public function set_up() {
- parent::set_up();
- require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
+ public static $user_id = 0;
- $user_id = self::factory()->user->create(
+ /**
+ * Set up the test case.
+ *
+ * @see WP_UnitTestCase::set_up()
+ */
+ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
+ // Create a user to use for the tests.
+ self::$user_id = $factory->user->create(
array(
'role' => 'administrator',
)
);
+
if ( is_multisite() ) {
- grant_super_admin( $user_id );
+ grant_super_admin( self::$user_id );
}
+ }
+
+ /**
+ * Set up the test case.
+ *
+ * @see WP_UnitTestCase_Base::set_up()
+ */
+ public function set_up() {
+ parent::set_up();
+ require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
- wp_set_current_user( $user_id );
+ wp_set_current_user( self::$user_id );
global $wp_customize;
$this->wp_customize = new WP_Customize_Manager();
diff --git a/tests/phpunit/tests/customize/manager.php b/tests/phpunit/tests/customize/manager.php
index 0f8ddb2d9b..21bdd85eeb 100644
--- a/tests/phpunit/tests/customize/manager.php
+++ b/tests/phpunit/tests/customize/manager.php
@@ -27,6 +27,13 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase {
protected static $admin_user_id;
/**
+ * Second admin user ID.
+ *
+ * @var int
+ */
+ protected static $other_admin_user_id;
+
+ /**
* Subscriber user ID.
*
* @var int
@@ -46,8 +53,9 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase {
* @param WP_UnitTest_Factory $factory Factory.
*/
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
- self::$subscriber_user_id = $factory->user->create( array( 'role' => 'subscriber' ) );
- self::$admin_user_id = $factory->user->create( array( 'role' => 'administrator' ) );
+ self::$subscriber_user_id = $factory->user->create( array( 'role' => 'subscriber' ) );
+ self::$admin_user_id = $factory->user->create( array( 'role' => 'administrator' ) );
+ self::$other_admin_user_id = $factory->user->create( array( 'role' => 'administrator' ) );
}
/**
@@ -153,7 +161,7 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase {
*/
public function test_constructor_deferred_changeset_uuid() {
wp_set_current_user( self::$admin_user_id );
- $other_admin_user_id = self::factory()->user->create( array( 'role' => 'admin' ) );
+ $other_admin_user_id = self::$other_admin_user_id;
$data = array(
'blogname' => array(
@@ -1254,7 +1262,7 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase {
*/
public function test_save_changeset_post_without_kses_corrupting_json() {
global $wp_customize;
- $lesser_admin_user_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
+ $lesser_admin_user_id = self::$other_admin_user_id;
$uuid = wp_generate_uuid4();
$wp_customize = new WP_Customize_Manager(
@@ -1499,7 +1507,7 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase {
add_theme_support( 'custom-background' );
wp_set_current_user( self::$admin_user_id );
- $other_admin_user_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
+ $other_admin_user_id = self::$other_admin_user_id;
$uuid = wp_generate_uuid4();
$wp_customize = $this->create_test_manager( $uuid );
@@ -1714,7 +1722,7 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase {
add_theme_support( 'custom-background' );
wp_set_current_user( self::$admin_user_id );
- $other_admin_user_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
+ $other_admin_user_id = self::$other_admin_user_id;
$uuid = wp_generate_uuid4();
$wp_customize = $this->create_test_manager( $uuid );
@@ -1877,7 +1885,7 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase {
$r = $wp_customize->save_changeset_post(
array(
'autosave' => true,
- 'user_id' => self::factory()->user->create( array( 'role' => 'administrator' ) ),
+ 'user_id' => self::$other_admin_user_id,
)
);
$this->assertSame( 'illegal_autosave_with_non_current_user', $r->get_error_code() );
@@ -3009,7 +3017,7 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase {
* @see WP_Customize_Manager::set_return_url()
*/
public function test_return_url() {
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'author' ) ) );
+ wp_set_current_user( self::$subscriber_user_id );
$this->assertSame( home_url( '/' ), $this->manager->get_return_url() );
wp_set_current_user( self::$admin_user_id );
diff --git a/tests/phpunit/tests/customize/nav-menu-item-setting.php b/tests/phpunit/tests/customize/nav-menu-item-setting.php
index 22d4bc7de7..eb5aa46e89 100644
--- a/tests/phpunit/tests/customize/nav-menu-item-setting.php
+++ b/tests/phpunit/tests/customize/nav-menu-item-setting.php
@@ -14,6 +14,22 @@ class Test_WP_Customize_Nav_Menu_Item_Setting extends WP_UnitTestCase {
public $wp_customize;
/**
+ * ID of the administrator user.
+ *
+ * @var int
+ */
+ public static $administrator_id;
+
+ /**
+ * Set up the shared fixture.
+ *
+ * @param WP_UnitTest_Factory $factory Factory instance.
+ */
+ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
+ self::$administrator_id = $factory->user->create( array( 'role' => 'administrator' ) );
+ }
+
+ /**
* Set up a test case.
*
* @see WP_UnitTestCase_Base::set_up()
@@ -21,7 +37,7 @@ class Test_WP_Customize_Nav_Menu_Item_Setting extends WP_UnitTestCase {
public function set_up() {
parent::set_up();
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
+ wp_set_current_user( self::$administrator_id );
global $wp_customize;
$this->wp_customize = new WP_Customize_Manager();
diff --git a/tests/phpunit/tests/customize/nav-menu-setting.php b/tests/phpunit/tests/customize/nav-menu-setting.php
index 6d50c96ee0..1348c86395 100644
--- a/tests/phpunit/tests/customize/nav-menu-setting.php
+++ b/tests/phpunit/tests/customize/nav-menu-setting.php
@@ -15,6 +15,22 @@ class Test_WP_Customize_Nav_Menu_Setting extends WP_UnitTestCase {
public $wp_customize;
/**
+ * ID of the administrator user.
+ *
+ * @var int
+ */
+ public static $administrator_id;
+
+ /**
+ * Set up the shared fixture.
+ *
+ * @param WP_UnitTest_Factory $factory Factory instance.
+ */
+ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
+ self::$administrator_id = $factory->user->create( array( 'role' => 'administrator' ) );
+ }
+
+ /**
* Set up a test case.
*
* @see WP_UnitTestCase_Base::set_up()
@@ -22,7 +38,7 @@ class Test_WP_Customize_Nav_Menu_Setting extends WP_UnitTestCase {
public function set_up() {
parent::set_up();
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
+ wp_set_current_user( self::$administrator_id );
global $wp_customize;
$this->wp_customize = new WP_Customize_Manager();
diff --git a/tests/phpunit/tests/customize/nav-menus.php b/tests/phpunit/tests/customize/nav-menus.php
index e731774693..e25418242a 100644
--- a/tests/phpunit/tests/customize/nav-menus.php
+++ b/tests/phpunit/tests/customize/nav-menus.php
@@ -15,6 +15,22 @@ class Test_WP_Customize_Nav_Menus extends WP_UnitTestCase {
public $wp_customize;
/**
+ * ID of the administrator user.
+ *
+ * @var int
+ */
+ public static $administrator_id;
+
+ /**
+ * Set up the shared fixture.
+ *
+ * @param WP_UnitTest_Factory $factory Factory instance.
+ */
+ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
+ self::$administrator_id = $factory->user->create( array( 'role' => 'administrator' ) );
+ }
+
+ /**
* Set up a test case.
*
* @see WP_UnitTestCase_Base::set_up()
@@ -22,7 +38,7 @@ class Test_WP_Customize_Nav_Menus extends WP_UnitTestCase {
public function set_up() {
parent::set_up();
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
+ wp_set_current_user( self::$administrator_id );
global $wp_customize;
$this->wp_customize = new WP_Customize_Manager();
$wp_customize = $this->wp_customize;
@@ -766,25 +782,27 @@ class Test_WP_Customize_Nav_Menus extends WP_UnitTestCase {
$this->assertStringContainsString( $expected, $template );
$post_types = get_post_types( array( 'show_in_nav_menus' => true ), 'object' );
- if ( $post_types ) {
- foreach ( $post_types as $type ) {
- $this->assertStringContainsString( 'available-menu-items-post_type-' . esc_attr( $type->name ), $template );
- $this->assertMatchesRegularExpression( '#<h4 class="accordion-section-title".*>\s*<button type="button" class="accordion-trigger" aria-expanded="false" aria-controls=".*">\s*' . esc_html( $type->labels->name ) . '#', $template );
- $this->assertStringContainsString( 'data-type="post_type"', $template );
- $this->assertStringContainsString( 'data-object="' . esc_attr( $type->name ) . '"', $template );
- $this->assertStringContainsString( 'data-type_label="' . esc_attr( $type->labels->singular_name ) . '"', $template );
- }
+
+ $this->assertNotEmpty( $post_types );
+
+ foreach ( $post_types as $type ) {
+ $this->assertStringContainsString( 'available-menu-items-post_type-' . esc_attr( $type->name ), $template );
+ $this->assertMatchesRegularExpression( '#<h4 class="accordion-section-title".*>\s*<button type="button" class="accordion-trigger" aria-expanded="false" aria-controls=".*">\s*' . esc_html( $type->labels->name ) . '#', $template );
+ $this->assertStringContainsString( 'data-type="post_type"', $template );
+ $this->assertStringContainsString( 'data-object="' . esc_attr( $type->name ) . '"', $template );
+ $this->assertStringContainsString( 'data-type_label="' . esc_attr( $type->labels->singular_name ) . '"', $template );
}
$taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'object' );
- if ( $taxonomies ) {
- foreach ( $taxonomies as $tax ) {
- $this->assertStringContainsString( 'available-menu-items-taxonomy-' . esc_attr( $tax->name ), $template );
- $this->assertMatchesRegularExpression( '#<h4 class="accordion-section-title".*>\s*<button type="button" class="accordion-trigger" aria-expanded="false" aria-controls=".*">\s*' . esc_html( $tax->labels->name ) . '#', $template );
- $this->assertStringContainsString( 'data-type="taxonomy"', $template );
- $this->assertStringContainsString( 'data-object="' . esc_attr( $tax->name ) . '"', $template );
- $this->assertStringContainsString( 'data-type_label="' . esc_attr( $tax->labels->singular_name ) . '"', $template );
- }
+
+ $this->assertNotEmpty( $taxonomies );
+
+ foreach ( $taxonomies as $tax ) {
+ $this->assertStringContainsString( 'available-menu-items-taxonomy-' . esc_attr( $tax->name ), $template );
+ $this->assertMatchesRegularExpression( '#<h4 class="accordion-section-title".*>\s*<button type="button" class="accordion-trigger" aria-expanded="false" aria-controls=".*">\s*' . esc_html( $tax->labels->name ) . '#', $template );
+ $this->assertStringContainsString( 'data-type="taxonomy"', $template );
+ $this->assertStringContainsString( 'data-object="' . esc_attr( $tax->name ) . '"', $template );
+ $this->assertStringContainsString( 'data-type_label="' . esc_attr( $tax->labels->singular_name ) . '"', $template );
}
$this->assertStringContainsString( 'available-menu-items-custom_type', $template );
@@ -852,7 +870,7 @@ class Test_WP_Customize_Nav_Menus extends WP_UnitTestCase {
$menus = new WP_Customize_Nav_Menus( $this->wp_customize );
$contributor_user_id = self::factory()->user->create( array( 'role' => 'contributor' ) );
$author_user_id = self::factory()->user->create( array( 'role' => 'author' ) );
- $administrator_user_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
+ $administrator_user_id = self::$administrator_id;
$contributor_post_id = self::factory()->post->create(
array(
diff --git a/tests/phpunit/tests/customize/panel.php b/tests/phpunit/tests/customize/panel.php
index 40f198675a..bd191e65d7 100644
--- a/tests/phpunit/tests/customize/panel.php
+++ b/tests/phpunit/tests/customize/panel.php
@@ -8,6 +8,22 @@
class Tests_WP_Customize_Panel extends WP_UnitTestCase {
/**
+ * ID of the administrator user.
+ *
+ * @var int
+ */
+ public static $administrator_id;
+
+ /**
+ * Set up the shared fixture.
+ *
+ * @param WP_UnitTest_Factory $factory Factory instance.
+ */
+ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
+ self::$administrator_id = $factory->user->create( array( 'role' => 'administrator' ) );
+ }
+
+ /**
* @var WP_Customize_Manager
*/
protected $manager;
@@ -131,8 +147,7 @@ class Tests_WP_Customize_Panel extends WP_UnitTestCase {
* @see WP_Customize_Panel::check_capabilities()
*/
public function test_check_capabilities() {
- $user_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
- wp_set_current_user( $user_id );
+ wp_set_current_user( self::$administrator_id );
$panel = new WP_Customize_Panel( $this->manager, 'foo' );
$this->assertTrue( $panel->check_capabilities() );
@@ -157,7 +172,7 @@ class Tests_WP_Customize_Panel extends WP_UnitTestCase {
* @see WP_Customize_Panel::maybe_render()
*/
public function test_maybe_render() {
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
+ wp_set_current_user( self::$administrator_id );
$panel = new WP_Customize_Panel( $this->manager, 'bar' );
$customize_render_panel_count = did_action( 'customize_render_panel' );
add_action( 'customize_render_panel', array( $this, 'action_customize_render_panel_test' ) );
@@ -182,7 +197,7 @@ class Tests_WP_Customize_Panel extends WP_UnitTestCase {
* @see WP_Customize_Panel::print_template()
*/
public function test_print_templates_standard() {
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
+ wp_set_current_user( self::$administrator_id );
$panel = new WP_Customize_Panel( $this->manager, 'baz' );
ob_start();
@@ -200,7 +215,7 @@ class Tests_WP_Customize_Panel extends WP_UnitTestCase {
* @see WP_Customize_Panel::print_template()
*/
public function test_print_templates_custom() {
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
+ wp_set_current_user( self::$administrator_id );
$panel = new Custom_Panel_Test( $this->manager, 'baz' );
ob_start();
diff --git a/tests/phpunit/tests/customize/selective-refresh-ajax.php b/tests/phpunit/tests/customize/selective-refresh-ajax.php
index 39d3d45a70..8d9305962b 100644
--- a/tests/phpunit/tests/customize/selective-refresh-ajax.php
+++ b/tests/phpunit/tests/customize/selective-refresh-ajax.php
@@ -29,6 +29,22 @@ class Test_WP_Customize_Selective_Refresh_Ajax extends WP_UnitTestCase {
public $selective_refresh;
/**
+ * Shared user ID for the tests.
+ *
+ * @var int
+ */
+ public static $user_id = 0;
+
+ /**
+ * Set up shared fixtures.
+ *
+ * @param WP_UnitTest_Factory $factory Factory.
+ */
+ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
+ self::$user_id = $factory->user->create( array( 'role' => 'administrator' ) );
+ }
+
+ /**
* Set up the test fixture.
*/
public function set_up() {
@@ -79,7 +95,7 @@ class Test_WP_Customize_Selective_Refresh_Ajax extends WP_UnitTestCase {
$this->assertSame( 'expected_customize_preview', $output['data'] );
// Check expected_customize_preview.
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
+ wp_set_current_user( self::$user_id );
$_REQUEST['nonce'] = wp_create_nonce( 'preview-customize_' . $this->wp_customize->theme()->get_stylesheet() );
ob_start();
try {
@@ -121,7 +137,7 @@ class Test_WP_Customize_Selective_Refresh_Ajax extends WP_UnitTestCase {
* Set the current user to be an admin, add the preview nonce, and set the query var.
*/
private function setup_valid_render_partials_request_environment() {
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
+ wp_set_current_user( self::$user_id );
$_REQUEST['nonce'] = wp_create_nonce( 'preview-customize_' . $this->wp_customize->theme()->get_stylesheet() );
$_POST[ WP_Customize_Selective_Refresh::RENDER_QUERY_VAR ] = '1';
$this->do_customize_boot_actions();
@@ -171,7 +187,7 @@ class Test_WP_Customize_Selective_Refresh_Ajax extends WP_UnitTestCase {
*/
public function test_handle_render_partials_request_for_non_rendering_partial() {
$this->setup_valid_render_partials_request_environment();
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
+ wp_set_current_user( self::$user_id );
$this->wp_customize->add_setting( 'home' );
$this->wp_customize->selective_refresh->add_partial( 'foo', array( 'settings' => array( 'home' ) ) );
$context_data = array();
@@ -208,7 +224,7 @@ class Test_WP_Customize_Selective_Refresh_Ajax extends WP_UnitTestCase {
*/
public function test_handle_rendering_disallowed_partial() {
$this->setup_valid_render_partials_request_environment();
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
+ wp_set_current_user( self::$user_id );
$this->wp_customize->add_setting(
'secret_message',
array(
@@ -244,7 +260,7 @@ class Test_WP_Customize_Selective_Refresh_Ajax extends WP_UnitTestCase {
*/
public function test_handle_rendering_partial_with_missing_settings() {
$this->setup_valid_render_partials_request_environment();
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
+ wp_set_current_user( self::$user_id );
$this->wp_customize->selective_refresh->add_partial( 'bar', array( 'settings' => 'bar' ) );
$context_data = array();
diff --git a/tests/phpunit/tests/customize/setting.php b/tests/phpunit/tests/customize/setting.php
index 62861a2726..8150a2f03d 100644
--- a/tests/phpunit/tests/customize/setting.php
+++ b/tests/phpunit/tests/customize/setting.php
@@ -17,6 +17,22 @@ class Tests_WP_Customize_Setting extends WP_UnitTestCase {
*/
public $undefined;
+ /**
+ * Shared admin user ID for the tests.
+ *
+ * @var int
+ */
+ public static $admin_id = 0;
+
+ /**
+ * Set up shared fixtures.
+ *
+ * @param WP_UnitTest_Factory $factory Factory.
+ */
+ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
+ self::$admin_id = $factory->user->create( array( 'role' => 'administrator' ) );
+ }
+
public function set_up() {
parent::set_up();
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
@@ -137,7 +153,7 @@ class Tests_WP_Customize_Setting extends WP_UnitTestCase {
* @see WP_Customize_Setting::value()
*/
public function test_preview_standard_types_non_multidimensional() {
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
+ wp_set_current_user( self::$admin_id );
$_POST['customized'] = wp_slash( wp_json_encode( $this->post_data_overrides ) );
// Try non-multidimensional settings.
@@ -216,7 +232,7 @@ class Tests_WP_Customize_Setting extends WP_UnitTestCase {
* @see WP_Customize_Setting::value()
*/
public function test_preview_standard_types_multidimensional() {
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
+ wp_set_current_user( self::$admin_id );
$_POST['customized'] = wp_slash( wp_json_encode( $this->post_data_overrides ) );
foreach ( $this->standard_type_configs as $type => $type_options ) {
@@ -362,7 +378,7 @@ class Tests_WP_Customize_Setting extends WP_UnitTestCase {
* @see WP_Customize_Setting::preview()
*/
public function test_preview_custom_type() {
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
+ wp_set_current_user( self::$admin_id );
$type = 'custom_type';
$post_data_overrides = array(
"unset_{$type}_with_post_value" => "unset_{$type}_without_post_value\\o/",
@@ -513,7 +529,7 @@ class Tests_WP_Customize_Setting extends WP_UnitTestCase {
$this->assertTrue( 0 === did_action( 'customize_save_foo' ) );
// Satisfy all requirements for save to happen.
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
+ wp_set_current_user( self::$admin_id );
$this->assertNotFalse( $setting->save() );
$this->assertTrue( 1 === did_action( 'customize_update_custom' ) );
$this->assertTrue( 1 === did_action( 'customize_save_foo' ) );
@@ -551,7 +567,7 @@ class Tests_WP_Customize_Setting extends WP_UnitTestCase {
* @ticket 31428
*/
public function test_is_current_blog_previewed() {
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
+ wp_set_current_user( self::$admin_id );
$type = 'option';
$name = 'blogname';
$post_value = __FUNCTION__;
@@ -573,7 +589,7 @@ class Tests_WP_Customize_Setting extends WP_UnitTestCase {
* @group ms-required
*/
public function test_previewing_with_switch_to_blog() {
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
+ wp_set_current_user( self::$admin_id );
$type = 'option';
$name = 'blogdescription';
$post_value = __FUNCTION__;
@@ -596,7 +612,7 @@ class Tests_WP_Customize_Setting extends WP_UnitTestCase {
*/
public function test_option_autoloading() {
global $wpdb;
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
+ wp_set_current_user( self::$admin_id );
$name = 'autoloaded1';
$setting = new WP_Customize_Setting(
@@ -743,7 +759,7 @@ class Tests_WP_Customize_Setting extends WP_UnitTestCase {
* @ticket 37294
*/
public function test_multidimensional_value_when_previewed() {
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
+ wp_set_current_user( self::$admin_id );
WP_Customize_Setting::reset_aggregated_multidimensionals();
$initial_value = 456;
diff --git a/tests/phpunit/tests/customize/widgets.php b/tests/phpunit/tests/customize/widgets.php
index 77b1419440..5b64f85ce3 100644
--- a/tests/phpunit/tests/customize/widgets.php
+++ b/tests/phpunit/tests/customize/widgets.php
@@ -20,6 +20,22 @@ class Tests_WP_Customize_Widgets extends WP_UnitTestCase {
*/
protected $backup_registered_sidebars;
+ /**
+ * ID of the administrator user.
+ *
+ * @var int
+ */
+ public static $administrator_id;
+
+ /**
+ * Set up the shared fixture.
+ *
+ * @param WP_UnitTest_Factory $factory Factory instance.
+ */
+ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
+ self::$administrator_id = $factory->user->create( array( 'role' => 'administrator' ) );
+ }
+
public function set_up() {
parent::set_up();
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
@@ -27,8 +43,7 @@ class Tests_WP_Customize_Widgets extends WP_UnitTestCase {
add_theme_support( 'customize-selective-refresh-widgets' );
add_action( 'widgets_init', array( $this, 'remove_widgets_block_editor' ) );
- $user_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
- wp_set_current_user( $user_id );
+ wp_set_current_user( self::$administrator_id );
update_option(
'widget_search',
@@ -857,4 +872,42 @@ class Tests_WP_Customize_Widgets extends WP_UnitTestCase {
$this->manager->widgets->prepreview_added_widget_instance();
$this->manager->widgets->remove_prepreview_filters();
}
+
+ /**
+ * Test that output_widget_control_templates() works without sidebars.
+ * This test verifies that the fix for accessing panel title works correctly
+ * when no sidebars are registered or the widgets panel doesn't exist.
+ *
+ * @ticket 63151
+ *
+ * @covers WP_Customize_Widgets::output_widget_control_templates
+ */
+ public function test_output_widget_control_templates_without_sidebars() {
+ global $wp_registered_sidebars;
+
+ $original_sidebars = $wp_registered_sidebars;
+ $wp_registered_sidebars = array();
+ $manager = new WP_Customize_Manager();
+ $widgets = new WP_Customize_Widgets( $manager );
+
+ if ( $manager->get_panel( 'widgets' ) ) {
+ $manager->remove_panel( 'widgets' );
+ }
+
+ ob_start();
+
+ $widgets->output_widget_control_templates();
+
+ $output = ob_get_clean();
+ $wp_registered_sidebars = $original_sidebars;
+
+ $this->assertStringNotContainsString( 'Warning', $output, 'Failed asserting that the output does not contain "Warning".' );
+ $this->assertStringNotContainsString( 'Notice', $output, 'Failed asserting that the output does not contain "Notice".' );
+ $this->assertStringNotContainsString( 'Error', $output, 'Failed asserting that the output does not contain "Error".' );
+
+ // Check that the output contains expected widget controls HTML.
+ $this->assertStringContainsString( 'id="widgets-left"', $output, 'Failed asserting that the output contains "id=widgets-left".' );
+ $this->assertStringContainsString( 'id="available-widgets"', $output, 'Failed asserting that the output contains "id=available-widgets".' );
+ $this->assertStringNotContainsString( 'id="accordion-panel-widgets"', $output, 'Failed asserting that the output does not contain "id=accordion-panel-widgets".' );
+ }
}
diff --git a/tests/phpunit/tests/db/charset.php b/tests/phpunit/tests/db/charset.php
index 26074e74b8..8b3fdb2f10 100644
--- a/tests/phpunit/tests/db/charset.php
+++ b/tests/phpunit/tests/db/charset.php
@@ -829,6 +829,8 @@ class Tests_DB_Charset extends WP_UnitTestCase {
self::$_wpdb->query( $drop );
self::$_wpdb->query( $create );
+ $this->assertNotEmpty( $expected_charset );
+
foreach ( $expected_charset as $column => $charset ) {
if ( self::$utf8_is_utf8mb3 && 'utf8' === $charset ) {
$charset = 'utf8mb3';
@@ -854,6 +856,8 @@ class Tests_DB_Charset extends WP_UnitTestCase {
self::$_wpdb->query( $create );
+ $this->assertNotEmpty( $columns );
+
$columns = array_keys( $columns );
foreach ( $columns as $column => $charset ) {
$this->assertFalse( self::$_wpdb->get_col_charset( $table, $column ) );
@@ -877,6 +881,8 @@ class Tests_DB_Charset extends WP_UnitTestCase {
self::$_wpdb->query( $create );
+ $this->assertNotEmpty( $columns );
+
$columns = array_keys( $columns );
foreach ( $columns as $column => $charset ) {
$this->assertFalse( self::$_wpdb->get_col_charset( $table, $column ) );
@@ -1070,6 +1076,8 @@ class Tests_DB_Charset extends WP_UnitTestCase {
)
);
+ $this->assertNotEmpty( $always_true );
+
foreach ( $always_true as $true_query ) {
$return = self::$_wpdb->check_safe_collation( $true_query );
$this->assertTrue(
diff --git a/tests/phpunit/tests/dependencies/scripts.php b/tests/phpunit/tests/dependencies/scripts.php
index 89bfb4ef92..d00c77b5a1 100644
--- a/tests/phpunit/tests/dependencies/scripts.php
+++ b/tests/phpunit/tests/dependencies/scripts.php
@@ -79,7 +79,7 @@ JS;
$expected .= "<script type='text/javascript' src='http://example.com?ver=1.2' id='empty-deps-version-js'></script>\n";
$expected .= "<script type='text/javascript' src='http://example.com' id='empty-deps-null-version-js'></script>\n";
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
// No scripts left to print.
$this->assertSame( '', get_echo( 'wp_print_scripts' ) );
@@ -125,7 +125,7 @@ JS;
'id' => 'ms-isa-1-js-after',
)
);
- $this->assertEqualMarkup( $expected, $output, 'Inline scripts in the "after" position, that are attached to a deferred main script, are failing to print/execute.' );
+ $this->assertEqualHTML( $expected, $output, '<body>', 'Inline scripts in the "after" position, that are attached to a deferred main script, are failing to print/execute.' );
}
/**
@@ -154,7 +154,7 @@ JS;
)
);
- $this->assertEqualMarkup( $expected, $output, 'Inline scripts in the "after" position, that are attached to a blocking main script, are failing to print/execute.' );
+ $this->assertEqualHTML( $expected, $output, '<body>', 'Inline scripts in the "after" position, that are attached to a blocking main script, are failing to print/execute.' );
}
/**
@@ -187,9 +187,9 @@ JS;
'id' => 'ds-i1-1-js-before',
)
);
- $expected .= "<script type='text/javascript' src='http://example.org/ds-i1-1.js' id='ds-i1-1-js' $strategy data-wp-strategy='{$strategy}'></script>\n";
- $expected .= "<script type='text/javascript' src='http://example.org/ds-i1-2.js' id='ds-i1-2-js' $strategy data-wp-strategy='{$strategy}'></script>\n";
- $expected .= "<script type='text/javascript' src='http://example.org/ds-i1-3.js' id='ds-i1-3-js' $strategy data-wp-strategy='{$strategy}'></script>\n";
+ $expected .= "<script type='text/javascript' src='http://example.org/ds-i1-1.js' id='ds-i1-1-js' {$strategy}='{$strategy}' data-wp-strategy='{$strategy}'></script>\n";
+ $expected .= "<script type='text/javascript' src='http://example.org/ds-i1-2.js' id='ds-i1-2-js' {$strategy}='{$strategy}' data-wp-strategy='{$strategy}'></script>\n";
+ $expected .= "<script type='text/javascript' src='http://example.org/ds-i1-3.js' id='ds-i1-3-js' {$strategy}='{$strategy}' data-wp-strategy='{$strategy}'></script>\n";
$expected .= wp_get_inline_script_tag(
'console.log("before last");',
array(
@@ -197,9 +197,9 @@ JS;
'type' => 'text/javascript',
)
);
- $expected .= "<script type='text/javascript' src='http://example.org/ms-i1-1.js' id='ms-i1-1-js' {$strategy} data-wp-strategy='{$strategy}'></script>\n";
+ $expected .= "<script type='text/javascript' src='http://example.org/ms-i1-1.js' id='ms-i1-1-js' {$strategy}='{$strategy}' data-wp-strategy='{$strategy}'></script>\n";
- $this->assertEqualMarkup( $expected, $output, 'Inline scripts in the "before" position, that are attached to a deferred main script, are failing to print/execute.' );
+ $this->assertEqualHTML( $expected, $output, '<body>', 'Inline scripts in the "before" position, that are attached to a deferred main script, are failing to print/execute.' );
}
/**
@@ -216,8 +216,8 @@ JS;
// No dependents, No dependencies then async.
wp_enqueue_script( 'main-script-a1', '/main-script-a1.js', array(), null, array( 'strategy' => 'async' ) );
$output = get_echo( 'wp_print_scripts' );
- $expected = "<script type='text/javascript' src='/main-script-a1.js' id='main-script-a1-js' async data-wp-strategy='async'></script>\n";
- $this->assertEqualMarkup( $expected, $output, 'Scripts enqueued with an async loading strategy are failing to have the async attribute applied to the script handle when being printed.' );
+ $expected = "<script type='text/javascript' src='/main-script-a1.js' id='main-script-a1-js' async='async' data-wp-strategy='async'></script>\n";
+ $this->assertEqualHTML( $expected, $output, '<body>', 'Scripts enqueued with an async loading strategy are failing to have the async attribute applied to the script handle when being printed.' );
}
/**
@@ -238,9 +238,9 @@ JS;
wp_enqueue_script( 'dependency-script-a2', '/dependency-script-a2.js', array(), null );
wp_enqueue_script( 'main-script-a2', '/main-script-a2.js', array( 'dependency-script-a2' ), null, compact( 'strategy' ) );
$output = get_echo( 'wp_print_scripts' );
- $expected = "<script id='dependency-script-a2-js' src='/dependency-script-a2.js'></script>\n";
- $expected .= "<script type='text/javascript' src='/main-script-a2.js' id='main-script-a2-js' {$strategy} data-wp-strategy='{$strategy}'></script>";
- $this->assertEqualMarkup( $expected, $output, 'Dependents of a blocking dependency are free to have any strategy.' );
+ $expected = "<script id='dependency-script-a2-js' src='/dependency-script-a2.js' type='text/javascript'></script>\n";
+ $expected .= "<script type='text/javascript' src='/main-script-a2.js' id='main-script-a2-js' {$strategy}='{$strategy}' data-wp-strategy='{$strategy}'></script>";
+ $this->assertEqualHTML( $expected, $output, '<body>', 'Dependents of a blocking dependency are free to have any strategy.' );
}
/**
@@ -264,7 +264,7 @@ JS;
<script type='text/javascript' src='/main-script-a3.js' id='main-script-a3-js' data-wp-strategy='{$strategy}'></script>
<script id="dependent-script-a3-js" src="/dependent-script-a3.js" type="text/javascript"></script>
JS;
- $this->assertEqualMarkup( $expected, $output, 'Blocking dependents must force delayed dependencies to become blocking.' );
+ $this->assertEqualHTML( $expected, $output, '<body>', 'Blocking dependents must force delayed dependencies to become blocking.' );
}
/**
@@ -511,18 +511,26 @@ JS;
},
'expected_markup' => <<<HTML
<script id="blocking-not-async-without-dependency-js-before" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "blocking-not-async-without-dependency: before inline" )
+/* ]]> */
</script>
<script type='text/javascript' src='https://example.com/external.js?script_event_log=blocking-not-async-without-dependency:%20script' id='blocking-not-async-without-dependency-js'></script>
<script id="blocking-not-async-without-dependency-js-after" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "blocking-not-async-without-dependency: after inline" )
+/* ]]> */
</script>
<script id="async-with-blocking-dependency-js-before" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "async-with-blocking-dependency: before inline" )
+/* ]]> */
</script>
<script type='text/javascript' src='https://example.com/external.js?script_event_log=async-with-blocking-dependency:%20script' id='async-with-blocking-dependency-js' data-wp-strategy='async'></script>
<script id="async-with-blocking-dependency-js-after" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "async-with-blocking-dependency: after inline" )
+/* ]]> */
</script>
HTML
,
@@ -548,25 +556,37 @@ HTML
},
'expected_markup' => <<<HTML
<script id="async-no-dependency-js-before" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "async-no-dependency: before inline" )
+/* ]]> */
</script>
<script type='text/javascript' src='https://example.com/external.js?script_event_log=async-no-dependency:%20script' id='async-no-dependency-js' data-wp-strategy='async'></script>
<script id="async-no-dependency-js-after" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "async-no-dependency: after inline" )
+/* ]]> */
</script>
<script id="async-one-async-dependency-js-before" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "async-one-async-dependency: before inline" )
+/* ]]> */
</script>
<script type='text/javascript' src='https://example.com/external.js?script_event_log=async-one-async-dependency:%20script' id='async-one-async-dependency-js' data-wp-strategy='async'></script>
<script id="async-one-async-dependency-js-after" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "async-one-async-dependency: after inline" )
+/* ]]> */
</script>
<script id="async-two-async-dependencies-js-before" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "async-two-async-dependencies: before inline" )
+/* ]]> */
</script>
<script type='text/javascript' src='https://example.com/external.js?script_event_log=async-two-async-dependencies:%20script' id='async-two-async-dependencies-js' data-wp-strategy='async'></script>
<script id="async-two-async-dependencies-js-after" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "async-two-async-dependencies: after inline" )
+/* ]]> */
</script>
HTML
,
@@ -584,18 +604,26 @@ HTML
},
'expected_markup' => <<<HTML
<script id="async-with-blocking-dependent-js-before" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "async-with-blocking-dependent: before inline" )
+/* ]]> */
</script>
<script type='text/javascript' src='https://example.com/external.js?script_event_log=async-with-blocking-dependent:%20script' id='async-with-blocking-dependent-js' data-wp-strategy='async'></script>
<script id="async-with-blocking-dependent-js-after" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "async-with-blocking-dependent: after inline" )
+/* ]]> */
</script>
<script id="blocking-dependent-of-async-js-before" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "blocking-dependent-of-async: before inline" )
+/* ]]> */
</script>
<script type='text/javascript' src='https://example.com/external.js?script_event_log=blocking-dependent-of-async:%20script' id='blocking-dependent-of-async-js'></script>
<script id="blocking-dependent-of-async-js-after" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "blocking-dependent-of-async: after inline" )
+/* ]]> */
</script>
HTML
,
@@ -613,18 +641,26 @@ HTML
},
'expected_markup' => <<<HTML
<script id="async-with-defer-dependent-js-before" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "async-with-defer-dependent: before inline" )
+/* ]]> */
</script>
<script type='text/javascript' src='https://example.com/external.js?script_event_log=async-with-defer-dependent:%20script' id='async-with-defer-dependent-js' data-wp-strategy='async'></script>
<script id="async-with-defer-dependent-js-after" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "async-with-defer-dependent: after inline" )
+/* ]]> */
</script>
<script id="defer-dependent-of-async-js-before" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "defer-dependent-of-async: before inline" )
+/* ]]> */
</script>
<script type='text/javascript' src='https://example.com/external.js?script_event_log=defer-dependent-of-async:%20script' id='defer-dependent-of-async-js' data-wp-strategy='defer'></script>
<script id="defer-dependent-of-async-js-after" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "defer-dependent-of-async: after inline" )
+/* ]]> */
</script>
HTML
,
@@ -645,17 +681,25 @@ HTML
},
'expected_markup' => <<<HTML
<script id="blocking-bundle-of-none-js-before" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "blocking-bundle-of-none: before inline" )
+/* ]]> */
</script>
<script id="blocking-bundle-of-none-js-after" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "blocking-bundle-of-none: after inline" )
+/* ]]> */
</script>
<script id="defer-dependent-of-blocking-bundle-of-none-js-before" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "defer-dependent-of-blocking-bundle-of-none: before inline" )
+/* ]]> */
</script>
<script type='text/javascript' src='https://example.com/external.js?script_event_log=defer-dependent-of-blocking-bundle-of-none:%20script' id='defer-dependent-of-blocking-bundle-of-none-js' data-wp-strategy='defer'></script>
<script id="defer-dependent-of-blocking-bundle-of-none-js-after" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "defer-dependent-of-blocking-bundle-of-none: after inline" )
+/* ]]> */
</script>
HTML
,
@@ -679,25 +723,37 @@ HTML
},
'expected_markup' => <<<HTML
<script id="blocking-bundle-member-one-js-before" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "blocking-bundle-member-one: before inline" )
+/* ]]> */
</script>
<script type='text/javascript' src='https://example.com/external.js?script_event_log=blocking-bundle-member-one:%20script' id='blocking-bundle-member-one-js'></script>
<script id="blocking-bundle-member-one-js-after" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "blocking-bundle-member-one: after inline" )
+/* ]]> */
</script>
<script id="blocking-bundle-member-two-js-before" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "blocking-bundle-member-two: before inline" )
+/* ]]> */
</script>
<script type='text/javascript' src='https://example.com/external.js?script_event_log=blocking-bundle-member-two:%20script' id='blocking-bundle-member-two-js'></script>
<script id="blocking-bundle-member-two-js-after" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "blocking-bundle-member-two: after inline" )
+/* ]]> */
</script>
<script id="defer-dependent-of-blocking-bundle-of-two-js-before" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "defer-dependent-of-blocking-bundle-of-two: before inline" )
+/* ]]> */
</script>
<script type='text/javascript' src='https://example.com/external.js?script_event_log=defer-dependent-of-blocking-bundle-of-two:%20script' id='defer-dependent-of-blocking-bundle-of-two-js' data-wp-strategy='defer'></script>
<script id="defer-dependent-of-blocking-bundle-of-two-js-after" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "defer-dependent-of-blocking-bundle-of-two: after inline" )
+/* ]]> */
</script>
HTML
,
@@ -720,17 +776,25 @@ HTML
},
'expected_markup' => <<<HTML
<script id="defer-bundle-of-none-js-before" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "defer-bundle-of-none: before inline" )
+/* ]]> */
</script>
<script id="defer-bundle-of-none-js-after" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "defer-bundle-of-none: after inline" )
+/* ]]> */
</script>
<script id="defer-dependent-of-defer-bundle-of-none-js-before" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "defer-dependent-of-defer-bundle-of-none: before inline" )
+/* ]]> */
</script>
<script type='text/javascript' src='https://example.com/external.js?script_event_log=defer-dependent-of-defer-bundle-of-none:%20script' id='defer-dependent-of-defer-bundle-of-none-js' data-wp-strategy='defer'></script>
<script id="defer-dependent-of-defer-bundle-of-none-js-after" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "defer-dependent-of-defer-bundle-of-none: after inline" )
+/* ]]> */
</script>
HTML
,
@@ -751,25 +815,37 @@ HTML
},
'expected_markup' => <<<HTML
<script id="blocking-dependency-with-defer-following-dependency-js-before" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "blocking-dependency-with-defer-following-dependency: before inline" )
+/* ]]> */
</script>
<script type='text/javascript' src='https://example.com/external.js?script_event_log=blocking-dependency-with-defer-following-dependency:%20script' id='blocking-dependency-with-defer-following-dependency-js'></script>
<script id="blocking-dependency-with-defer-following-dependency-js-after" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "blocking-dependency-with-defer-following-dependency: after inline" )
+/* ]]> */
</script>
<script id="defer-dependency-with-blocking-preceding-dependency-js-before" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "defer-dependency-with-blocking-preceding-dependency: before inline" )
+/* ]]> */
</script>
<script type='text/javascript' src='https://example.com/external.js?script_event_log=defer-dependency-with-blocking-preceding-dependency:%20script' id='defer-dependency-with-blocking-preceding-dependency-js' data-wp-strategy='defer'></script>
<script id="defer-dependency-with-blocking-preceding-dependency-js-after" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "defer-dependency-with-blocking-preceding-dependency: after inline" )
+/* ]]> */
</script>
<script id="defer-dependent-of-blocking-and-defer-dependencies-js-before" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "defer-dependent-of-blocking-and-defer-dependencies: before inline" )
+/* ]]> */
</script>
<script type='text/javascript' src='https://example.com/external.js?script_event_log=defer-dependent-of-blocking-and-defer-dependencies:%20script' id='defer-dependent-of-blocking-and-defer-dependencies-js' data-wp-strategy='defer'></script>
<script id="defer-dependent-of-blocking-and-defer-dependencies-js-after" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "defer-dependent-of-blocking-and-defer-dependencies: after inline" )
+/* ]]> */
</script>
HTML
,
@@ -790,25 +866,37 @@ HTML
},
'expected_markup' => <<<HTML
<script id="defer-dependency-with-blocking-following-dependency-js-before" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "defer-dependency-with-blocking-following-dependency: before inline" )
+/* ]]> */
</script>
<script type='text/javascript' src='https://example.com/external.js?script_event_log=defer-dependency-with-blocking-following-dependency:%20script' id='defer-dependency-with-blocking-following-dependency-js' data-wp-strategy='defer'></script>
<script id="defer-dependency-with-blocking-following-dependency-js-after" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "defer-dependency-with-blocking-following-dependency: after inline" )
+/* ]]> */
</script>
<script id="blocking-dependency-with-defer-preceding-dependency-js-before" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "blocking-dependency-with-defer-preceding-dependency: before inline" )
+/* ]]> */
</script>
<script type='text/javascript' src='https://example.com/external.js?script_event_log=blocking-dependency-with-defer-preceding-dependency:%20script' id='blocking-dependency-with-defer-preceding-dependency-js'></script>
<script id="blocking-dependency-with-defer-preceding-dependency-js-after" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "blocking-dependency-with-defer-preceding-dependency: after inline" )
+/* ]]> */
</script>
<script id="defer-dependent-of-defer-and-blocking-dependencies-js-before" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "defer-dependent-of-defer-and-blocking-dependencies: before inline" )
+/* ]]> */
</script>
<script type='text/javascript' src='https://example.com/external.js?script_event_log=defer-dependent-of-defer-and-blocking-dependencies:%20script' id='defer-dependent-of-defer-and-blocking-dependencies-js' data-wp-strategy='defer'></script>
<script id="defer-dependent-of-defer-and-blocking-dependencies-js-after" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "defer-dependent-of-defer-and-blocking-dependencies: after inline" )
+/* ]]> */
</script>
HTML
,
@@ -826,18 +914,26 @@ HTML
},
'expected_markup' => <<<HTML
<script id="defer-with-async-dependent-js-before" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "defer-with-async-dependent: before inline" )
+/* ]]> */
</script>
<script type='text/javascript' src='https://example.com/external.js?script_event_log=defer-with-async-dependent:%20script' id='defer-with-async-dependent-js' data-wp-strategy='defer'></script>
<script id="defer-with-async-dependent-js-after" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "defer-with-async-dependent: after inline" )
+/* ]]> */
</script>
<script id="async-dependent-of-defer-js-before" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "async-dependent-of-defer: before inline" )
+/* ]]> */
</script>
<script type='text/javascript' src='https://example.com/external.js?script_event_log=async-dependent-of-defer:%20script' id='async-dependent-of-defer-js' data-wp-strategy='async'></script>
<script id="async-dependent-of-defer-js-after" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "async-dependent-of-defer: after inline" )
+/* ]]> */
</script>
HTML
,
@@ -851,9 +947,11 @@ HTML
},
'expected_markup' => <<<HTML
<script id="defer-with-before-inline-js-before" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "defer-with-before-inline: before inline" )
+/* ]]> */
</script>
-<script type='text/javascript' src='https://example.com/external.js?script_event_log=defer-with-before-inline:%20script' id='defer-with-before-inline-js' defer data-wp-strategy='defer'></script>
+<script type='text/javascript' src='https://example.com/external.js?script_event_log=defer-with-before-inline:%20script' id='defer-with-before-inline-js' defer='defer' data-wp-strategy='defer'></script>
HTML
,
),
@@ -867,7 +965,9 @@ HTML
'expected_markup' => <<<HTML
<script type='text/javascript' src='https://example.com/external.js?script_event_log=defer-with-after-inline:%20script' id='defer-with-after-inline-js' data-wp-strategy='defer'></script>
<script id="defer-with-after-inline-js-after" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "defer-with-after-inline: after inline" )
+/* ]]> */
</script>
HTML
,
@@ -883,9 +983,9 @@ HTML
wp_enqueue_script( 'theme-functions', 'https://example.com/theme-functions.js', array( 'jquery' ), null, array( 'strategy' => 'defer' ) );
},
'expected_markup' => <<<HTML
-<script type='text/javascript' src='http://$wp_tests_domain/wp-includes/js/jquery/jquery.js' id='jquery-core-js' defer data-wp-strategy='defer'></script>
-<script type='text/javascript' src='http://$wp_tests_domain/wp-includes/js/jquery/jquery-migrate.js' id='jquery-migrate-js' defer data-wp-strategy='defer'></script>
-<script type='text/javascript' src='https://example.com/theme-functions.js' id='theme-functions-js' defer data-wp-strategy='defer'></script>
+<script type='text/javascript' src='http://$wp_tests_domain/wp-includes/js/jquery/jquery.js' id='jquery-core-js' defer='defer' data-wp-strategy='defer'></script>
+<script type='text/javascript' src='http://$wp_tests_domain/wp-includes/js/jquery/jquery-migrate.js' id='jquery-migrate-js' defer='defer' data-wp-strategy='defer'></script>
+<script type='text/javascript' src='https://example.com/theme-functions.js' id='theme-functions-js' defer='defer' data-wp-strategy='defer'></script>
HTML
,
),
@@ -912,11 +1012,15 @@ HTML
<script type='text/javascript' src='https://example.com/external.js?script_event_log=inner-bundle-member-two:%20script' id='inner-bundle-member-two-js' data-wp-strategy='defer'></script>
<script type='text/javascript' src='https://example.com/external.js?script_event_log=outer-bundle-leaf-member:%20script' id='outer-bundle-leaf-member-js'></script>
<script id="defer-dependent-of-nested-aliases-js-before" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "defer-dependent-of-nested-aliases: before inline" )
+/* ]]> */
</script>
<script type='text/javascript' src='https://example.com/external.js?script_event_log=defer-dependent-of-nested-aliases:%20script' id='defer-dependent-of-nested-aliases-js' data-wp-strategy='defer'></script>
<script id="defer-dependent-of-nested-aliases-js-after" type="text/javascript">
+/* <![CDATA[ */
scriptEventLog.push( "defer-dependent-of-nested-aliases: after inline" )
+/* ]]> */
</script>
HTML
,
@@ -935,9 +1039,9 @@ HTML
$this->enqueue_test_script( 'defer-dependent-of-async-aliases', 'defer', array( $alias_handle ) );
},
'expected_markup' => <<<HTML
-<script type='text/javascript' src='https://example.com/external.js?script_event_log=async1:%20script' id='async1-js' defer data-wp-strategy='async'></script>
-<script type='text/javascript' src='https://example.com/external.js?script_event_log=async2:%20script' id='async2-js' defer data-wp-strategy='async'></script>
-<script type='text/javascript' src='https://example.com/external.js?script_event_log=defer-dependent-of-async-aliases:%20script' id='defer-dependent-of-async-aliases-js' defer data-wp-strategy='defer'></script>
+<script type='text/javascript' src='https://example.com/external.js?script_event_log=async1:%20script' id='async1-js' defer='defer' data-wp-strategy='async'></script>
+<script type='text/javascript' src='https://example.com/external.js?script_event_log=async2:%20script' id='async2-js' defer='defer' data-wp-strategy='async'></script>
+<script type='text/javascript' src='https://example.com/external.js?script_event_log=defer-dependent-of-async-aliases:%20script' id='defer-dependent-of-async-aliases-js' defer='defer' data-wp-strategy='defer'></script>
HTML
,
),
@@ -960,7 +1064,7 @@ HTML
public function test_various_strategy_dependency_chains( $set_up, $expected_markup ) {
$set_up();
$actual_markup = get_echo( 'wp_print_scripts' );
- $this->assertEqualMarkup( trim( $expected_markup ), trim( $actual_markup ), "Actual markup:\n{$actual_markup}" );
+ $this->assertEqualHTML( trim( $expected_markup ), trim( $actual_markup ), '<body>', "Actual markup:\n{$actual_markup}" );
}
/**
@@ -1036,12 +1140,12 @@ HTML
wp_enqueue_script( 'dependent-script-d4-2', '/dependent-script-d4-2.js', array( 'dependent-script-d4-1' ), null, array( 'strategy' => 'async' ) );
wp_enqueue_script( 'dependent-script-d4-3', '/dependent-script-d4-3.js', array( 'dependent-script-d4-2' ), null, array( 'strategy' => 'defer' ) );
$output = get_echo( 'wp_print_scripts' );
- $expected = "<script type='text/javascript' src='/main-script-d4.js' id='main-script-d4-js' defer data-wp-strategy='defer'></script>\n";
- $expected .= "<script type='text/javascript' src='/dependent-script-d4-1.js' id='dependent-script-d4-1-js' defer data-wp-strategy='defer'></script>\n";
- $expected .= "<script type='text/javascript' src='/dependent-script-d4-2.js' id='dependent-script-d4-2-js' defer data-wp-strategy='async'></script>\n";
- $expected .= "<script type='text/javascript' src='/dependent-script-d4-3.js' id='dependent-script-d4-3-js' defer data-wp-strategy='defer'></script>\n";
+ $expected = "<script type='text/javascript' src='/main-script-d4.js' id='main-script-d4-js' defer='defer' data-wp-strategy='defer'></script>\n";
+ $expected .= "<script type='text/javascript' src='/dependent-script-d4-1.js' id='dependent-script-d4-1-js' defer='defer' data-wp-strategy='defer'></script>\n";
+ $expected .= "<script type='text/javascript' src='/dependent-script-d4-2.js' id='dependent-script-d4-2-js' defer='defer' data-wp-strategy='async'></script>\n";
+ $expected .= "<script type='text/javascript' src='/dependent-script-d4-3.js' id='dependent-script-d4-3-js' defer='defer' data-wp-strategy='defer'></script>\n";
- $this->assertEqualMarkup( $expected, $output, 'Scripts registered as defer but that have dependents that are async are expected to have said dependents deferred.' );
+ $this->assertEqualHTML( $expected, $output, '<body>', 'Scripts registered as defer but that have dependents that are async are expected to have said dependents deferred.' );
}
/**
@@ -1113,7 +1217,7 @@ HTML
$expected_header .= "<script type='text/javascript' src='/enqueue-header-old.js' id='enqueue-header-old-js'></script>\n";
$expected_header .= "<script type='text/javascript' src='/enqueue-header-new.js' id='enqueue-header-new-js'></script>\n";
- $this->assertEqualMarkup( $expected_header, $actual_header, 'Scripts registered/enqueued using the older $in_footer parameter or the newer $args parameter should have the same outcome.' );
+ $this->assertEqualHTML( $expected_header, $actual_header, '<body>', 'Scripts registered/enqueued using the older $in_footer parameter or the newer $args parameter should have the same outcome.' );
$this->assertEmpty( $actual_footer, 'Expected footer to be empty since all scripts were for head.' );
}
@@ -1141,7 +1245,7 @@ HTML
$expected_footer .= "<script type='text/javascript' src='/enqueue-footer-new.js' id='enqueue-footer-new-js'></script>\n";
$this->assertEmpty( $actual_header, 'Expected header to be empty since all scripts targeted footer.' );
- $this->assertEqualMarkup( $expected_footer, $actual_footer, 'Scripts registered/enqueued using the older $in_footer parameter or the newer $args parameter should have the same outcome.' );
+ $this->assertEqualHTML( $expected_footer, $actual_footer, '<body>', 'Scripts registered/enqueued using the older $in_footer parameter or the newer $args parameter should have the same outcome.' );
}
/**
@@ -1260,7 +1364,7 @@ HTML
wp_register_script( 'invalid-strategy', '/defaults.js', array(), null, array( 'strategy' => 'random-strategy' ) );
wp_enqueue_script( 'invalid-strategy' );
- $this->assertEqualMarkup(
+ $this->assertEqualHTML(
"<script type='text/javascript' src='/defaults.js' id='invalid-strategy-js'></script>\n",
get_echo( 'wp_print_scripts' )
);
@@ -1285,7 +1389,7 @@ HTML
wp_script_add_data( 'invalid-strategy', 'strategy', 'random-strategy' );
wp_enqueue_script( 'invalid-strategy' );
- $this->assertEqualMarkup(
+ $this->assertEqualHTML(
"<script type='text/javascript' src='/defaults.js' id='invalid-strategy-js'></script>\n",
get_echo( 'wp_print_scripts' )
);
@@ -1306,7 +1410,7 @@ HTML
public function test_script_strategy_doing_it_wrong_via_enqueue() {
wp_enqueue_script( 'invalid-strategy', '/defaults.js', array(), null, array( 'strategy' => 'random-strategy' ) );
- $this->assertEqualMarkup(
+ $this->assertEqualHTML(
"<script type='text/javascript' src='/defaults.js' id='invalid-strategy-js'></script>\n",
get_echo( 'wp_print_scripts' )
);
@@ -1342,9 +1446,9 @@ HTML
$concatenate_scripts = $old_value;
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&amp;load%5Bchunk_0%5D=one-concat-dep,two-concat-dep,three-concat-dep&amp;ver={$wp_version}'></script>\n";
- $expected .= "<script type='text/javascript' src='/main-script.js' id='main-defer-script-js' defer data-wp-strategy='defer'></script>\n";
+ $expected .= "<script type='text/javascript' src='/main-script.js' id='main-defer-script-js' defer='defer' data-wp-strategy='defer'></script>\n";
- $this->assertEqualMarkup( $expected, $print_scripts, 'Scripts are being incorrectly concatenated when a main script is registered with a "defer" loading strategy. Deferred scripts should not be part of the script concat loading query.' );
+ $this->assertEqualHTML( $expected, $print_scripts, '<body>', 'Scripts are being incorrectly concatenated when a main script is registered with a "defer" loading strategy. Deferred scripts should not be part of the script concat loading query.' );
}
/**
@@ -1377,9 +1481,9 @@ HTML
$concatenate_scripts = $old_value;
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&amp;load%5Bchunk_0%5D=one-concat-dep-1,two-concat-dep-1,three-concat-dep-1&amp;ver={$wp_version}'></script>\n";
- $expected .= "<script type='text/javascript' src='/main-script.js' id='main-async-script-1-js' async data-wp-strategy='async'></script>\n";
+ $expected .= "<script type='text/javascript' src='/main-script.js' id='main-async-script-1-js' async='async' data-wp-strategy='async'></script>\n";
- $this->assertEqualMarkup( $expected, $print_scripts, 'Scripts are being incorrectly concatenated when a main script is registered with an "async" loading strategy. Async scripts should not be part of the script concat loading query.' );
+ $this->assertEqualHTML( $expected, $print_scripts, '<body>', 'Scripts are being incorrectly concatenated when a main script is registered with an "async" loading strategy. Async scripts should not be part of the script concat loading query.' );
}
/**
@@ -1416,9 +1520,9 @@ HTML
$concatenate_scripts = $old_value;
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&amp;load%5Bchunk_0%5D=one-concat-dep-2,two-concat-dep-2,three-concat-dep-2,four-concat-dep-2,five-concat-dep-2,six-concat-dep-2&amp;ver={$wp_version}'></script>\n";
- $expected .= "<script type='text/javascript' src='/main-script.js' id='deferred-script-2-js' defer data-wp-strategy='defer'></script>\n";
+ $expected .= "<script type='text/javascript' src='/main-script.js' id='deferred-script-2-js' defer='defer' data-wp-strategy='defer'></script>\n";
- $this->assertEqualMarkup( $expected, $print_scripts, 'Scripts are being incorrectly concatenated when a main script is registered as deferred after other blocking scripts are registered. Deferred scripts should not be part of the script concat loader query string. ' );
+ $this->assertEqualHTML( $expected, $print_scripts, '<body>', 'Scripts are being incorrectly concatenated when a main script is registered as deferred after other blocking scripts are registered. Deferred scripts should not be part of the script concat loader query string. ' );
}
/**
@@ -1427,6 +1531,8 @@ HTML
public function test_wp_enqueue_script_with_html5_support_does_not_contain_type_attribute() {
global $wp_version;
+ $this->add_html5_script_theme_support();
+
$GLOBALS['wp_scripts'] = new WP_Scripts();
$GLOBALS['wp_scripts']->default_version = get_bloginfo( 'version' );
@@ -1434,7 +1540,7 @@ HTML
$expected = "<script src='http://example.com?ver={$wp_version}' id='empty-deps-no-version-js'></script>\n";
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
/**
@@ -1473,7 +1579,7 @@ HTML
$expected .= "<script type='text/javascript' src='{$wp_scripts->base_url}ftp://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver={$wp_version}' id='jquery-ftp-js'></script>\n";
// Go!
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
// No scripts left to print.
$this->assertSame( '', get_echo( 'wp_print_scripts' ) );
@@ -1516,7 +1622,7 @@ HTML
$expected .= "<script type='text/javascript' src='http://example.com' id='test-only-data-js'></script>\n";
// Go!
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
// No scripts left to print.
$this->assertSame( '', get_echo( 'wp_print_scripts' ) );
@@ -1531,10 +1637,10 @@ HTML
// Enqueue and add conditional comments.
wp_enqueue_script( 'test-only-conditional', 'example.com', array(), null );
wp_script_add_data( 'test-only-conditional', 'conditional', 'gt IE 7' );
- $expected = "<!--[if gt IE 7]>\n<script type='text/javascript' src='http://example.com' id='test-only-conditional-js'></script>\n<![endif]-->\n";
+ $expected = "<!--[if gt IE 7]>\n<script type=\"text/javascript\" src=\"http://example.com\" id=\"test-only-conditional-js\"></script>\n<![endif]-->\n";
// Go!
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
// No scripts left to print.
$this->assertSame( '', get_echo( 'wp_print_scripts' ) );
@@ -1555,7 +1661,7 @@ HTML
$expected = str_replace( "'", '"', $expected );
// Go!
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
// No scripts left to print.
$this->assertSame( '', get_echo( 'wp_print_scripts' ) );
@@ -1573,10 +1679,10 @@ HTML
$expected = "<script type='text/javascript' src='http://example.com' id='test-invalid-js'></script>\n";
// Go!
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
// No scripts left to print.
- $this->assertEqualMarkup( '', get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( '', get_echo( 'wp_print_scripts' ) );
}
/**
@@ -1602,7 +1708,7 @@ HTML
wp_enqueue_script( 'handle-three' );
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
/**
@@ -1690,8 +1796,8 @@ HTML
$expected_header .= "<script type='text/javascript' src='/child-head.js' id='child-head-js'></script>\n";
$expected_footer = "<script type='text/javascript' src='/parent.js' id='parent-js'></script>\n";
- $this->assertEqualMarkup( $expected_header, $header, 'Expected same header markup.' );
- $this->assertEqualMarkup( $expected_footer, $footer, 'Expected same footer markup.' );
+ $this->assertEqualHTML( $expected_header, $header, '<body>', 'Expected same header markup.' );
+ $this->assertEqualHTML( $expected_footer, $footer, '<body>', 'Expected same footer markup.' );
}
/**
@@ -1711,8 +1817,8 @@ HTML
$expected_footer = "<script type='text/javascript' src='/child-footer.js' id='child-footer-js'></script>\n";
$expected_footer .= "<script type='text/javascript' src='/parent.js' id='parent-js'></script>\n";
- $this->assertEqualMarkup( $expected_header, $header, 'Expected same header markup.' );
- $this->assertEqualMarkup( $expected_footer, $footer, 'Expected same footer markup.' );
+ $this->assertEqualHTML( $expected_header, $header, '<body>', 'Expected same header markup.' );
+ $this->assertEqualHTML( $expected_footer, $footer, '<body>', 'Expected same footer markup.' );
}
/**
@@ -1742,8 +1848,8 @@ HTML
$expected_footer .= "<script type='text/javascript' src='/child2-footer.js' id='child2-footer-js'></script>\n";
$expected_footer .= "<script type='text/javascript' src='/parent-footer.js' id='parent-footer-js'></script>\n";
- $this->assertEqualMarkup( $expected_header, $header, 'Expected same header markup.' );
- $this->assertEqualMarkup( $expected_footer, $footer, 'Expected same footer markup.' );
+ $this->assertEqualHTML( $expected_header, $header, '<body>', 'Expected same header markup.' );
+ $this->assertEqualHTML( $expected_footer, $footer, '<body>', 'Expected same footer markup.' );
}
/**
@@ -1770,10 +1876,16 @@ HTML
wp_enqueue_script( 'test-example', 'example.com', array(), null );
wp_add_inline_script( 'test-example', 'console.log("before");', 'before' );
- $expected = "<script type='text/javascript' id='test-example-js-before'>\nconsole.log(\"before\");\n</script>\n";
+ $expected = <<<HTML
+<script type='text/javascript' id='test-example-js-before'>
+/* <![CDATA[ */
+console.log("before");
+/* ]]> */
+</script>
+HTML;
$expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
/**
@@ -1784,9 +1896,15 @@ HTML
wp_add_inline_script( 'test-example', 'console.log("after");' );
$expected = "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
- $expected .= "<script type='text/javascript' id='test-example-js-after'>\nconsole.log(\"after\");\n</script>\n";
+ $expected .= <<<HTML
+<script type='text/javascript' id='test-example-js-after'>
+/* <![CDATA[ */
+console.log("after");
+/* ]]> */
+</script>
+HTML;
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
/**
@@ -1797,11 +1915,11 @@ HTML
wp_add_inline_script( 'test-example', 'console.log("before");', 'before' );
wp_add_inline_script( 'test-example', 'console.log("after");' );
- $expected = "<script type='text/javascript' id='test-example-js-before'>\nconsole.log(\"before\");\n</script>\n";
+ $expected = "<script type='text/javascript' id='test-example-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before\");\n/* ]]> */\n</script>\n";
$expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
- $expected .= "<script type='text/javascript' id='test-example-js-after'>\nconsole.log(\"after\");\n</script>\n";
+ $expected .= "<script type='text/javascript' id='test-example-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after\");\n/* ]]> */\n</script>\n";
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
/**
@@ -1812,9 +1930,9 @@ HTML
wp_enqueue_script( 'test-example' );
wp_add_inline_script( 'test-example', 'console.log("before");', 'before' );
- $expected = "<script type='text/javascript' id='test-example-js-before'>\nconsole.log(\"before\");\n</script>\n";
+ $expected = "<script type='text/javascript' id='test-example-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before\");\n/* ]]> */\n</script>\n";
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
/**
@@ -1825,9 +1943,9 @@ HTML
wp_enqueue_script( 'test-example' );
wp_add_inline_script( 'test-example', 'console.log("after");' );
- $expected = "<script type='text/javascript' id='test-example-js-after'>\nconsole.log(\"after\");\n</script>\n";
+ $expected = "<script type='text/javascript' id='test-example-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after\");\n/* ]]> */\n</script>\n";
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
/**
@@ -1839,10 +1957,10 @@ HTML
wp_add_inline_script( 'test-example', 'console.log("before");', 'before' );
wp_add_inline_script( 'test-example', 'console.log("after");' );
- $expected = "<script type='text/javascript' id='test-example-js-before'>\nconsole.log(\"before\");\n</script>\n";
- $expected .= "<script type='text/javascript' id='test-example-js-after'>\nconsole.log(\"after\");\n</script>\n";
+ $expected = "<script type='text/javascript' id='test-example-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before\");\n/* ]]> */\n</script>\n";
+ $expected .= "<script type='text/javascript' id='test-example-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after\");\n/* ]]> */\n</script>\n";
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
/**
@@ -1855,11 +1973,11 @@ HTML
wp_add_inline_script( 'test-example', 'console.log("after");' );
wp_add_inline_script( 'test-example', 'console.log("after");' );
- $expected = "<script type='text/javascript' id='test-example-js-before'>\nconsole.log(\"before\");\nconsole.log(\"before\");\n</script>\n";
+ $expected = "<script type='text/javascript' id='test-example-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before\");\nconsole.log(\"before\");\n/* ]]> */\n</script>\n";
$expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
- $expected .= "<script type='text/javascript' id='test-example-js-after'>\nconsole.log(\"after\");\nconsole.log(\"after\");\n</script>\n";
+ $expected .= "<script type='text/javascript' id='test-example-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after\");\nconsole.log(\"after\");\n/* ]]> */\n</script>\n";
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
/**
@@ -1872,11 +1990,11 @@ HTML
wp_add_inline_script( 'test-example', 'console.log("after");' );
$expected = "<script type='text/javascript' id='test-example-js-extra'>\n/* <![CDATA[ */\nvar testExample = {\"foo\":\"bar\"};\n/* ]]> */\n</script>\n";
- $expected .= "<script type='text/javascript' id='test-example-js-before'>\nconsole.log(\"before\");\n</script>\n";
+ $expected .= "<script type='text/javascript' id='test-example-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before\");\n/* ]]> */\n</script>\n";
$expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
- $expected .= "<script type='text/javascript' id='test-example-js-after'>\nconsole.log(\"after\");\n</script>\n";
+ $expected .= "<script type='text/javascript' id='test-example-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after\");\n/* ]]> */\n</script>\n";
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
/**
@@ -1895,13 +2013,13 @@ HTML
wp_add_inline_script( 'one', 'console.log("before one");', 'before' );
wp_add_inline_script( 'two', 'console.log("before two");', 'before' );
- $expected = "<script type='text/javascript' id='one-js-before'>\nconsole.log(\"before one\");\n</script>\n";
+ $expected = "<script type='text/javascript' id='one-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before one\");\n/* ]]> */\n</script>\n";
$expected .= "<script type='text/javascript' src='{$this->default_scripts_dir}one.js?ver={$wp_version}' id='one-js'></script>\n";
- $expected .= "<script type='text/javascript' id='two-js-before'>\nconsole.log(\"before two\");\n</script>\n";
+ $expected .= "<script type='text/javascript' id='two-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before two\");\n/* ]]> */\n</script>\n";
$expected .= "<script type='text/javascript' src='{$this->default_scripts_dir}two.js?ver={$wp_version}' id='two-js'></script>\n";
$expected .= "<script type='text/javascript' src='{$this->default_scripts_dir}three.js?ver={$wp_version}' id='three-js'></script>\n";
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
/**
@@ -1919,12 +2037,12 @@ HTML
wp_add_inline_script( 'one', 'console.log("before one");', 'before' );
- $expected = "<script type='text/javascript' id='one-js-before'>\nconsole.log(\"before one\");\n</script>\n";
+ $expected = "<script type='text/javascript' id='one-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before one\");\n/* ]]> */\n</script>\n";
$expected .= "<script type='text/javascript' src='{$this->default_scripts_dir}one.js?ver={$wp_version}' id='one-js'></script>\n";
$expected .= "<script type='text/javascript' src='{$this->default_scripts_dir}two.js?ver={$wp_version}' id='two-js'></script>\n";
$expected .= "<script type='text/javascript' src='{$this->default_scripts_dir}three.js?ver={$wp_version}' id='three-js'></script>\n";
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
/**
@@ -1946,12 +2064,12 @@ HTML
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&amp;load%5Bchunk_0%5D=one&amp;ver={$wp_version}'></script>\n";
$expected .= "<script type='text/javascript' src='{$this->default_scripts_dir}two.js?ver={$wp_version}' id='two-js'></script>\n";
- $expected .= "<script type='text/javascript' id='two-js-after'>\nconsole.log(\"after two\");\n</script>\n";
+ $expected .= "<script type='text/javascript' id='two-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after two\");\n/* ]]> */\n</script>\n";
$expected .= "<script type='text/javascript' src='{$this->default_scripts_dir}three.js?ver={$wp_version}' id='three-js'></script>\n";
- $expected .= "<script type='text/javascript' id='three-js-after'>\nconsole.log(\"after three\");\n</script>\n";
+ $expected .= "<script type='text/javascript' id='three-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after three\");\n/* ]]> */\n</script>\n";
$expected .= "<script type='text/javascript' src='{$this->default_scripts_dir}four.js?ver={$wp_version}' id='four-js'></script>\n";
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
/**
@@ -1969,9 +2087,9 @@ HTML
$expected_localized = str_replace( "'", '"', $expected_localized );
$expected = "<!--[if gte IE 9]>\n";
- $expected .= "<script type='text/javascript' id='test-example-js-before'>\nconsole.log(\"before\");\n</script>\n";
+ $expected .= "<script type='text/javascript' id='test-example-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before\");\n/* ]]> */\n</script>\n";
$expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
- $expected .= "<script type='text/javascript' id='test-example-js-after'>\nconsole.log(\"after\");\n</script>\n";
+ $expected .= "<script type='text/javascript' id='test-example-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after\");\n/* ]]> */\n</script>\n";
$expected .= "<![endif]-->\n";
$expected = str_replace( "'", '"', $expected );
@@ -1982,7 +2100,7 @@ HTML
wp_script_add_data( 'test-example', 'conditional', 'gte IE 9' );
$this->assertSame( $expected_localized, get_echo( 'wp_print_scripts' ) );
- $this->assertEqualMarkup( $expected, $wp_scripts->print_html );
+ $this->assertEqualHTML( $expected, $wp_scripts->print_html );
$this->assertTrue( $wp_scripts->do_concat );
}
@@ -1999,7 +2117,7 @@ HTML
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&amp;load%5Bchunk_0%5D=jquery-core,jquery-migrate&amp;ver={$wp_version}'></script>\n";
$expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
- $expected .= "<script type='text/javascript' id='test-example-js-after'>\nconsole.log(\"after\");\n</script>\n";
+ $expected .= "<script type='text/javascript' id='test-example-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after\");\n/* ]]> */\n</script>\n";
wp_enqueue_script( 'test-example', 'http://example.com', array( 'jquery' ), null );
wp_add_inline_script( 'test-example', 'console.log("after");' );
@@ -2007,7 +2125,7 @@ HTML
wp_print_scripts();
$print_scripts = get_echo( '_print_scripts' );
- $this->assertEqualMarkup( $expected, $print_scripts );
+ $this->assertEqualHTML( $expected, $print_scripts );
}
/**
@@ -2023,8 +2141,8 @@ HTML
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&amp;load%5Bchunk_0%5D=jquery-core,jquery-migrate&amp;ver={$wp_version}'></script>\n";
$expected .= "<!--[if gte IE 9]>\n";
- $expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
- $expected .= "<script type='text/javascript' id='test-example-js-after'>\nconsole.log(\"after\");\n</script>\n";
+ $expected .= "<script type=\"text/javascript\" src=\"http://example.com\" id=\"test-example-js\"></script>\n";
+ $expected .= "<script type=\"text/javascript\" id=\"test-example-js-after\">\n/* <![CDATA[ */\nconsole.log(\"after\");\n/* ]]> */\n</script>\n";
$expected .= "<![endif]-->\n";
wp_enqueue_script( 'test-example', 'http://example.com', array( 'jquery' ), null );
@@ -2034,7 +2152,7 @@ HTML
wp_print_scripts();
$print_scripts = get_echo( '_print_scripts' );
- $this->assertEqualMarkup( $expected, $print_scripts );
+ $this->assertEqualHTML( $expected, $print_scripts );
}
/**
@@ -2050,7 +2168,7 @@ HTML
$wp_scripts->do_concat = true;
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&amp;load%5Bchunk_0%5D=jquery-core,jquery-migrate&amp;ver={$wp_version}'></script>\n";
- $expected .= "<script type='text/javascript' id='test-example-js-before'>\nconsole.log(\"before\");\n</script>\n";
+ $expected .= "<script type='text/javascript' id='test-example-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before\");\n/* ]]> */\n</script>\n";
$expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
wp_enqueue_script( 'test-example', 'http://example.com', array( 'jquery' ), null );
@@ -2059,7 +2177,7 @@ HTML
wp_print_scripts();
$print_scripts = get_echo( '_print_scripts' );
- $this->assertEqualMarkup( $expected, $print_scripts );
+ $this->assertEqualHTML( $expected, $print_scripts );
}
/**
@@ -2075,15 +2193,17 @@ HTML
$wp_scripts->do_concat = true;
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&amp;load%5Bchunk_0%5D=jquery-core,jquery-migrate,wp-dom-ready,wp-hooks&amp;ver={$wp_version}'></script>\n";
- $expected .= "<script type='text/javascript' id='test-example-js-before'>\nconsole.log(\"before\");\n</script>\n";
+ $expected .= "<script type='text/javascript' id='test-example-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before\");\n/* ]]> */\n</script>\n";
$expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
$expected .= "<script type='text/javascript' src='/wp-includes/js/dist/i18n.min.js' id='wp-i18n-js'></script>\n";
$expected .= "<script type='text/javascript' id='wp-i18n-js-after'>\n";
+ $expected .= "/* <![CDATA[ */\n";
$expected .= "wp.i18n.setLocaleData( { 'text direction\u0004ltr': [ 'ltr' ] } );\n";
+ $expected .= "/* ]]> */\n";
$expected .= "</script>\n";
$expected .= "<script type='text/javascript' src='/wp-includes/js/dist/a11y.min.js' id='wp-a11y-js'></script>\n";
$expected .= "<script type='text/javascript' src='http://example2.com' id='test-example2-js'></script>\n";
- $expected .= "<script type='text/javascript' id='test-example2-js-after'>\nconsole.log(\"after\");\n</script>\n";
+ $expected .= "<script type='text/javascript' id='test-example2-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after\");\n/* ]]> */\n</script>\n";
wp_enqueue_script( 'test-example', 'http://example.com', array( 'jquery' ), null );
wp_add_inline_script( 'test-example', 'console.log("before");', 'before' );
@@ -2109,7 +2229,7 @@ HTML
$print_scripts // Printed scripts.
);
- $this->assertEqualMarkup( $expected, $print_scripts );
+ $this->assertEqualHTML( $expected, $print_scripts );
}
/**
@@ -2126,7 +2246,9 @@ HTML
$expected_tail = "<script type='text/javascript' src='/customize-dependency.js' id='customize-dependency-js'></script>\n";
$expected_tail .= "<script type='text/javascript' id='customize-dependency-js-after'>\n";
+ $expected_tail .= "/* <![CDATA[ */\n";
$expected_tail .= "tryCustomizeDependency()\n";
+ $expected_tail .= "/* ]]> */\n";
$expected_tail .= "</script>\n";
$handle = 'customize-dependency';
@@ -2142,7 +2264,7 @@ HTML
$tail = substr( $print_scripts, strrpos( $print_scripts, '<script type="text/javascript" src="/customize-dependency.js" id="customize-dependency-js">' ) );
- $this->assertEqualMarkup( $expected_tail, $tail );
+ $this->assertEqualHTML( $expected_tail, $tail );
}
/**
@@ -2161,12 +2283,12 @@ HTML
wp_enqueue_script( 'four', '/wp-includes/js/script4.js' );
$expected = "<script type='text/javascript' src='/wp-includes/js/script.js?ver={$wp_version}' id='one-js'></script>\n";
- $expected .= "<script type='text/javascript' id='one-js-after'>\nconsole.log(\"after one\");\n</script>\n";
+ $expected .= "<script type='text/javascript' id='one-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after one\");\n/* ]]> */\n</script>\n";
$expected .= "<script type='text/javascript' src='/wp-includes/js/script2.js?ver={$wp_version}' id='two-js'></script>\n";
$expected .= "<script type='text/javascript' src='/wp-includes/js/script3.js?ver={$wp_version}' id='three-js'></script>\n";
$expected .= "<script type='text/javascript' src='/wp-includes/js/script4.js?ver={$wp_version}' id='four-js'></script>\n";
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
/**
@@ -2185,11 +2307,11 @@ HTML
wp_enqueue_script( 'four', '/wp-includes/js/script4.js' );
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&amp;load%5Bchunk_0%5D=one,two&amp;ver={$wp_version}'></script>\n";
- $expected .= "<script type='text/javascript' id='three-js-before'>\nconsole.log(\"before three\");\n</script>\n";
+ $expected .= "<script type='text/javascript' id='three-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before three\");\n/* ]]> */\n</script>\n";
$expected .= "<script type='text/javascript' src='/wp-includes/js/script3.js?ver={$wp_version}' id='three-js'></script>\n";
$expected .= "<script type='text/javascript' src='/wp-includes/js/script4.js?ver={$wp_version}' id='four-js'></script>\n";
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
/**
@@ -2206,7 +2328,7 @@ HTML
),
'delayed' => false,
'expected_data' => '/*before foo 1*/',
- 'expected_tag' => "<script id='foo-js-before' type='text/javascript'>\n/*before foo 1*/\n</script>\n",
+ 'expected_tag' => "<script id='foo-js-before' type='text/javascript'>\n/* <![CDATA[ */\n/*before foo 1*/\n/* ]]> */\n</script>\n",
),
'after-blocking' => array(
'position' => 'after',
@@ -2216,7 +2338,7 @@ HTML
),
'delayed' => false,
'expected_data' => "/*after foo 1*/\n/*after foo 2*/",
- 'expected_tag' => "<script id='foo-js-after' type='text/javascript'>\n/*after foo 1*/\n/*after foo 2*/\n</script>\n",
+ 'expected_tag' => "<script id='foo-js-after' type='text/javascript'>\n/* <![CDATA[ */\n/*after foo 1*/\n/*after foo 2*/\n/* ]]> */\n</script>\n",
),
'before-delayed' => array(
'position' => 'before',
@@ -2225,7 +2347,7 @@ HTML
),
'delayed' => true,
'expected_data' => '/*before foo 1*/',
- 'expected_tag' => "<script id='foo-js-before' type='text/javascript'>\n/*before foo 1*/\n</script>\n",
+ 'expected_tag' => "<script id='foo-js-before' type='text/javascript'>\n/* <![CDATA[ */\n/*before foo 1*/\n/* ]]> */\n</script>\n",
),
'after-delayed' => array(
'position' => 'after',
@@ -2235,7 +2357,7 @@ HTML
),
'delayed' => true,
'expected_data' => "/*after foo 1*/\n/*after foo 2*/",
- 'expected_tag' => "<script id='foo-js-after' type='text/javascript'>\n/*after foo 1*/\n/*after foo 2*/\n</script>\n",
+ 'expected_tag' => "<script id='foo-js-after' type='text/javascript'>\n/* <![CDATA[ */\n/*after foo 1*/\n/*after foo 2*/\n/* ]]> */\n</script>\n",
),
);
}
@@ -2287,13 +2409,13 @@ HTML
$this->assertSame( $expected_data, $wp_scripts->get_inline_script_data( $handle, $position ) );
$this->assertSame( $expected_data, $wp_scripts->print_inline_script( $handle, $position, false ) );
- $this->assertEqualMarkup(
+ $this->assertEqualHTML(
$expected_tag,
$wp_scripts->get_inline_script_tag( $handle, $position )
);
ob_start();
$output = $wp_scripts->print_inline_script( $handle, $position, true );
- $this->assertEqualMarkup( $expected_tag, ob_get_clean() );
+ $this->assertEqualHTML( $expected_tag, ob_get_clean() );
$this->assertEquals( $expected_data, $output );
}
@@ -2321,7 +2443,7 @@ HTML
);
$expected .= "<script type='text/javascript' src='/wp-includes/js/script.js' id='test-example-js'></script>\n";
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
/**
@@ -2348,7 +2470,7 @@ HTML
);
$expected .= "<script type='text/javascript' src='/wp-content/plugins/my-plugin/js/script.js' id='plugin-example-js'></script>\n";
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
/**
@@ -2375,7 +2497,7 @@ HTML
);
$expected .= "<script type='text/javascript' src='/wp-content/themes/my-theme/js/script.js' id='theme-example-js'></script>\n";
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
/**
@@ -2402,7 +2524,7 @@ HTML
);
$expected .= "<script type='text/javascript' src='/wp-admin/js/script.js' id='script-handle-js'></script>\n";
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
/**
@@ -2432,7 +2554,7 @@ HTML
$expected = "<script type='text/javascript' src='/wp-includes/js/dist/wp-i18n.js' id='wp-i18n-js'></script>\n";
$expected .= "<script type='text/javascript' src='/wp-admin/js/script.js' id='test-example-js'></script>\n";
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
/**
@@ -2461,7 +2583,7 @@ HTML
);
$expected .= "<script type='text/javascript' src='/wp-includes/js/script.js' id='test-example-js'></script>\n";
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
/**
@@ -2491,7 +2613,7 @@ HTML
$expected .= "<script type='text/javascript' src='/wp-includes/js/script.js' id='test-dependency-js'></script>\n";
$expected .= "<script type='text/javascript' src='/wp-includes/js/script2.js' id='test-example-js'></script>\n";
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
/**
@@ -2880,7 +3002,7 @@ HTML
$expected = "<script type='text/javascript' id='test-example-js-extra'>\n/* <![CDATA[ */\nvar testExample = {$expected};\n/* ]]> */\n</script>\n";
$expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
- $this->assertEqualMarkup( $expected, get_echo( 'wp_print_scripts' ) );
+ $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) );
}
/**
@@ -2945,7 +3067,7 @@ HTML
$expected .= "<script type='text/javascript' src='/plugins/wp-i18n.js' id='wp-i18n-js'></script>\n";
$expected .= "<script type='text/javascript' src='/default/common.js' id='common-js'></script>\n";
- $this->assertEqualMarkup( $expected, $print_scripts );
+ $this->assertEqualHTML( $expected, $print_scripts );
}
/**
@@ -2981,87 +3103,6 @@ HTML
}
/**
- * Parse an HTML markup fragment.
- *
- * @param string $markup Markup.
- * @return DOMDocument Document containing the normalized markup fragment.
- */
- protected function parse_markup_fragment( $markup ) {
- $dom = new DOMDocument();
- $dom->loadHTML(
- "<!DOCTYPE html><html><head><meta charset=utf8></head><body>{$markup}</body></html>"
- );
-
- /** @var DOMElement $body */
- $body = $dom->getElementsByTagName( 'body' )->item( 0 );
-
- // Trim whitespace nodes added before/after which can be added when parsing.
- foreach ( array( $body->firstChild, $body->lastChild ) as $node ) {
- if ( $node instanceof DOMText && '' === trim( $node->data ) ) {
- $body->removeChild( $node );
- }
- }
-
- // Normalize other whitespace nodes.
- $xpath = new DOMXPath( $dom );
- foreach ( $xpath->query( '//text()' ) as $node ) {
- /** @var DOMText $node */
- if ( preg_match( '/^\s+$/', $node->nodeValue ) ) {
- $node->nodeValue = ' ';
- }
- }
-
- return $dom;
- }
-
- /**
- * Assert markup is equal after normalizing script tags.
- *
- * @param string $expected Expected markup.
- * @param string $actual Actual markup.
- * @param string $message Message.
- */
- protected function assertEqualMarkup( $expected, $actual, $message = '' ) {
- $expected_dom = $this->parse_markup_fragment( $expected );
- $actual_dom = $this->parse_markup_fragment( $actual );
- foreach ( array( $expected_dom, $actual_dom ) as $dom ) {
- $xpath = new DOMXPath( $dom );
- /** @var DOMElement $script */
-
- // Normalize type attribute. When missing, it defaults to text/javascript.
- foreach ( $xpath->query( '//script[ not( @type ) ]' ) as $script ) {
- $script->setAttribute( 'type', 'text/javascript' );
- }
-
- // Normalize script contents to remove CDATA wrapper.
- foreach ( $xpath->query( '//script[ contains( text(), "<![CDATA[" ) ]' ) as $script ) {
- $script->textContent = str_replace(
- array(
- "/* <![CDATA[ */\n",
- "\n/* ]]> */",
- ),
- '',
- $script->textContent
- );
- }
-
- // Normalize XHTML-compatible boolean attributes to HTML5 ones.
- foreach ( array( 'async', 'defer' ) as $attribute ) {
- foreach ( iterator_to_array( $xpath->query( "//script[ @{$attribute} = '{$attribute}' ]" ) ) as $script ) {
- $script->removeAttribute( $attribute );
- $script->setAttributeNode( $dom->createAttribute( $attribute ) );
- }
- }
- }
-
- $this->assertEquals(
- $expected_dom->getElementsByTagName( 'body' )->item( 0 ),
- $actual_dom->getElementsByTagName( 'body' )->item( 0 ),
- $message
- );
- }
-
- /**
* Adds html5 script theme support.
*/
protected function add_html5_script_theme_support() {
@@ -3100,8 +3141,8 @@ HTML
wp_scripts()->do_footer_items();
$footer = ob_get_clean();
- $this->assertEqualMarkup( $expected_header, $header, 'Expected header script markup to match.' );
- $this->assertEqualMarkup( $expected_footer, $footer, 'Expected footer script markup to match.' );
+ $this->assertEqualHTML( $expected_header, $header, '<body>', 'Expected header script markup to match.' );
+ $this->assertEqualHTML( $expected_footer, $footer, '<body>', 'Expected footer script markup to match.' );
$this->assertEqualSets( $expected_in_footer, wp_scripts()->in_footer, 'Expected to have the same handles for in_footer.' );
$this->assertEquals( $expected_groups, wp_scripts()->groups, 'Expected groups to match.' );
}
diff --git a/tests/phpunit/tests/feed/atom.php b/tests/phpunit/tests/feed/atom.php
index dae234f51c..99d4e837af 100644
--- a/tests/phpunit/tests/feed/atom.php
+++ b/tests/phpunit/tests/feed/atom.php
@@ -279,6 +279,8 @@ class Tests_Feed_Atom extends WP_UnitTestCase {
$entries = xml_find( $xml, 'feed', 'entry' );
$entries = array_slice( $entries, 0, 1 );
+ $this->assertNotEmpty( $entries );
+
foreach ( $entries as $key => $entry ) {
$links = xml_find( $entries[ $key ]['child'], 'link' );
$i = 0;
diff --git a/tests/phpunit/tests/feed/rss2.php b/tests/phpunit/tests/feed/rss2.php
index 4eea99965c..c4f8807d7b 100644
--- a/tests/phpunit/tests/feed/rss2.php
+++ b/tests/phpunit/tests/feed/rss2.php
@@ -289,6 +289,8 @@ class Tests_Feed_RSS2 extends WP_UnitTestCase {
// Get all the rss -> channel -> item elements.
$items = xml_find( $xml, 'rss', 'channel', 'item' );
+ $this->assertNotEmpty( $items );
+
// Check each of the items against the known post data.
foreach ( $items as $key => $item ) {
// Get post for comparison.
diff --git a/tests/phpunit/tests/file.php b/tests/phpunit/tests/file.php
index c99f1baffd..9a29e4e676 100644
--- a/tests/phpunit/tests/file.php
+++ b/tests/phpunit/tests/file.php
@@ -40,6 +40,8 @@ class Tests_File extends WP_UnitTestCase {
'AuthorURI' => 'http://binarybonsai.com/',
);
+ $this->assertNotEmpty( $actual );
+
foreach ( $actual as $header => $value ) {
$this->assertSame( $expected[ $header ], $value, $header );
}
@@ -64,6 +66,8 @@ class Tests_File extends WP_UnitTestCase {
'Author' => 'A Very Old Mac',
);
+ $this->assertNotEmpty( $actual );
+
foreach ( $actual as $header => $value ) {
$this->assertSame( $expected[ $header ], $value, $header );
}
@@ -84,6 +88,8 @@ class Tests_File extends WP_UnitTestCase {
'TemplateName' => 'Something',
);
+ $this->assertNotEmpty( $actual );
+
foreach ( $actual as $header => $value ) {
$this->assertSame( $expected[ $header ], $value, $header );
}
diff --git a/tests/phpunit/tests/formatting/escUrl.php b/tests/phpunit/tests/formatting/escUrl.php
index 769ecacfdc..6fdd582617 100644
--- a/tests/phpunit/tests/formatting/escUrl.php
+++ b/tests/phpunit/tests/formatting/escUrl.php
@@ -124,7 +124,11 @@ class Tests_Formatting_EscUrl extends WP_UnitTestCase {
)
);
- foreach ( wp_allowed_protocols() as $scheme ) {
+ $protocols = wp_allowed_protocols();
+
+ $this->assertNotEmpty( $protocols );
+
+ foreach ( $protocols as $scheme ) {
$this->assertSame( "{$scheme}://example.com", esc_url( "{$scheme}://example.com" ), $scheme );
$this->assertSame(
"{$scheme}://example.com",
diff --git a/tests/phpunit/tests/formatting/sanitizeFileName.php b/tests/phpunit/tests/formatting/sanitizeFileName.php
index d0fac9e232..d0e366f121 100644
--- a/tests/phpunit/tests/formatting/sanitizeFileName.php
+++ b/tests/phpunit/tests/formatting/sanitizeFileName.php
@@ -35,13 +35,17 @@ class Tests_Formatting_SanitizeFileName extends WP_UnitTestCase {
* Test that spaces are correctly replaced with dashes.
*
* @ticket 16330
+ * @ticket 62995
*/
public function test_replaces_spaces() {
$urls = array(
- 'unencoded space.png' => 'unencoded-space.png',
- 'encoded-space.jpg' => 'encoded-space.jpg',
- 'plus+space.jpg' => 'plusspace.jpg',
- 'multi %20 +space.png' => 'multi-20-space.png',
+ 'unencoded space.png' => 'unencoded-space.png',
+ 'encoded-space.jpg' => 'encoded-space.jpg',
+ 'plus+space.jpg' => 'plusspace.jpg',
+ 'multi %20 +space.png' => 'multi-20-space.png',
+ "Screenshot 2025-02-19 at 2.17.33\u{202F}PM.png" => 'Screenshot-2025-02-19-at-2.17.33-PM.png',
+ "Filename with non-breaking\u{00A0}space.txt" => 'Filename-with-non-breaking-space.txt',
+ "Filename with thin\u{2009}space.txt" => 'Filename-with-thin-space.txt',
);
foreach ( $urls as $test => $expected ) {
diff --git a/tests/phpunit/tests/formatting/sanitizePost.php b/tests/phpunit/tests/formatting/sanitizePost.php
index 60ef8927aa..0366cf77c7 100644
--- a/tests/phpunit/tests/formatting/sanitizePost.php
+++ b/tests/phpunit/tests/formatting/sanitizePost.php
@@ -29,6 +29,9 @@ class Tests_Formatting_SanitizePost extends WP_UnitTestCase {
case 'string':
$this->assertIsString( $post->$field, "field $field" );
break;
+ default:
+ $this->fail( "Type $type is not handled by this test." );
+ break;
}
}
}
diff --git a/tests/phpunit/tests/formatting/wpSpecialchars.php b/tests/phpunit/tests/formatting/wpSpecialchars.php
index 890fb99c94..edbf29336c 100644
--- a/tests/phpunit/tests/formatting/wpSpecialchars.php
+++ b/tests/phpunit/tests/formatting/wpSpecialchars.php
@@ -17,6 +17,8 @@ class Tests_Formatting_wpSpecialchars extends WP_UnitTestCase {
public function test_allowed_entity_names() {
global $allowedentitynames;
+ $this->assertNotEmpty( $allowedentitynames );
+
// Allowed entities should be unchanged.
foreach ( $allowedentitynames as $ent ) {
if ( 'apos' === $ent ) {
diff --git a/tests/phpunit/tests/formatting/wpTrimExcerpt.php b/tests/phpunit/tests/formatting/wpTrimExcerpt.php
index 0f9c6e9cb7..688ba7731f 100644
--- a/tests/phpunit/tests/formatting/wpTrimExcerpt.php
+++ b/tests/phpunit/tests/formatting/wpTrimExcerpt.php
@@ -29,11 +29,12 @@ class Tests_Formatting_wpTrimExcerpt extends WP_UnitTestCase {
'post__in' => array( $post2 ),
)
);
- if ( $q->have_posts() ) {
- while ( $q->have_posts() ) {
- $q->the_post();
- $this->assertSame( 'Post 2 Page 1', wp_trim_excerpt() );
- }
+
+ $this->assertTrue( $q->have_posts() );
+
+ while ( $q->have_posts() ) {
+ $q->the_post();
+ $this->assertSame( 'Post 2 Page 1', wp_trim_excerpt() );
}
}
@@ -60,11 +61,12 @@ class Tests_Formatting_wpTrimExcerpt extends WP_UnitTestCase {
'post__in' => array( $post2 ),
)
);
- if ( $q->have_posts() ) {
- while ( $q->have_posts() ) {
- $q->the_post();
- $this->assertSame( 'Post 2 Page 1', wp_trim_excerpt() );
- }
+
+ $this->assertTrue( $q->have_posts() );
+
+ while ( $q->have_posts() ) {
+ $q->the_post();
+ $this->assertSame( 'Post 2 Page 1', wp_trim_excerpt() );
}
}
diff --git a/tests/phpunit/tests/functions.php b/tests/phpunit/tests/functions.php
index d2775393a6..2c458d968c 100644
--- a/tests/phpunit/tests/functions.php
+++ b/tests/phpunit/tests/functions.php
@@ -1145,6 +1145,8 @@ class Tests_Functions extends WP_UnitTestCase {
public function test_wp_ext2type() {
$extensions = wp_get_ext_types();
+ $this->assertNotEmpty( $extensions );
+
foreach ( $extensions as $type => $extension_list ) {
foreach ( $extension_list as $extension ) {
$this->assertSame( $type, wp_ext2type( $extension ) );
diff --git a/tests/phpunit/tests/general/template.php b/tests/phpunit/tests/general/template.php
index 5aaf93be4e..d3b35a2c46 100644
--- a/tests/phpunit/tests/general/template.php
+++ b/tests/phpunit/tests/general/template.php
@@ -32,7 +32,29 @@ class Tests_General_Template extends WP_UnitTestCase {
*/
public static $home_page_id;
+ /**
+ * ID of the administrator user.
+ *
+ * @var int
+ */
+ public static $administrator_id;
+
+ /**
+ * ID of the author user.
+ *
+ * @var int
+ */
+ public static $author_id;
+
+ /**
+ * Set up the shared fixtures.
+ *
+ * @param WP_UnitTest_Factory $factory Factory instance.
+ */
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
+ self::$administrator_id = $factory->user->create( array( 'role' => 'administrator' ) );
+ self::$author_id = $factory->user->create( array( 'role' => 'author' ) );
+
/*
* Declare theme support for custom logo.
*
@@ -212,7 +234,7 @@ class Tests_General_Template extends WP_UnitTestCase {
*/
public function test_customize_preview_wp_site_icon_empty() {
global $wp_customize;
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
+ wp_set_current_user( self::$administrator_id );
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
$wp_customize = new WP_Customize_Manager();
@@ -230,7 +252,7 @@ class Tests_General_Template extends WP_UnitTestCase {
*/
public function test_customize_preview_wp_site_icon_dirty() {
global $wp_customize;
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
+ wp_set_current_user( self::$administrator_id );
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
$wp_customize = new WP_Customize_Manager();
@@ -763,16 +785,8 @@ class Tests_General_Template extends WP_UnitTestCase {
* @covers ::get_the_archive_title
*/
public function test_get_the_archive_title_is_correct_for_author_queries() {
- $user_with_posts = self::factory()->user->create_and_get(
- array(
- 'role' => 'author',
- )
- );
- $user_with_no_posts = self::factory()->user->create_and_get(
- array(
- 'role' => 'author',
- )
- );
+ $user_with_posts = get_user_by( 'id', self::$administrator_id );
+ $user_with_no_posts = get_user_by( 'id', self::$author_id );
self::factory()->post->create(
array(
diff --git a/tests/phpunit/tests/image/editorImagick.php b/tests/phpunit/tests/image/editorImagick.php
index 8b00f3ac12..1edbf579c3 100644
--- a/tests/phpunit/tests/image/editorImagick.php
+++ b/tests/phpunit/tests/image/editorImagick.php
@@ -770,6 +770,8 @@ class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
* @ticket 36477
*
* @dataProvider data_resizes_are_small_for_16bit_images
+ *
+ * @param string $file Path to the image file.
*/
public function test_resizes_are_small_for_16bit_images( $file ) {
@@ -783,7 +785,7 @@ class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
$imagick_image_editor->resize( $size['width'] * .5, $size['height'] * .5 );
- $saved = $imagick_image_editor->save( $temp_file );
+ $imagick_image_editor->save( $temp_file );
$new_filesize = filesize( $temp_file );
@@ -793,7 +795,7 @@ class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
}
/**
- * data_test_resizes_are_small_for_16bit
+ * Data provider for test_resizes_are_small_for_16bit_images.
*
* @return array[]
*/
@@ -816,4 +818,59 @@ class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
),
);
}
+
+ /**
+ * Tests that the 'png:IHDR.color-type-orig' property is preserved after resizing
+ * Used to identify indexed PNG images, see https://www.w3.org/TR/PNG-Chunks.html#C.IHDR.
+ *
+ * @ticket 63448
+ * @dataProvider data_png_color_type_after_resize
+ *
+ * @param string $file_path Path to the image file.
+ * @param int $expected_color_type The expected original color type.
+ */
+ public function test_png_color_type_is_preserved_after_resize( $file_path, $expected_color_type ) {
+
+ $temp_file = DIR_TESTDATA . '/images/test-temp.png';
+
+ $imagick_image_editor = new WP_Image_Editor_Imagick( $file_path );
+ $imagick_image_editor->load();
+
+ $size = $imagick_image_editor->get_size();
+ $imagick_image_editor->resize( $size['width'] * 0.5, $size['height'] * 0.5 );
+ $imagick_image_editor->save( $temp_file );
+
+ $imagick = new Imagick( $temp_file );
+ $actual_color_type = $imagick->getImageProperty( 'png:IHDR.color-type-orig' );
+
+ unlink( $temp_file );
+
+ $this->assertSame( (string) $expected_color_type, $actual_color_type, "The PNG original color type should be preserved after resize for {$file_path}." );
+ }
+
+ /**
+ * Data provider for test_png_color_type_is_preserved_after_resize.
+ *
+ * @return array[]
+ */
+ public static function data_png_color_type_after_resize() {
+ return array(
+ 'vivid-green-bird_color_type_6' => array(
+ DIR_TESTDATA . '/images/png-tests/vivid-green-bird.png',
+ 6, // RGBA.
+ ),
+ 'grayscale-test-image_color_type_4' => array(
+ DIR_TESTDATA . '/images/png-tests/grayscale-test-image.png',
+ 4, // Grayscale with Alpha.
+ ),
+ 'rabbit-time-paletted-or8_color_type_3' => array(
+ DIR_TESTDATA . '/images/png-tests/rabbit-time-paletted-or8.png',
+ 3, // Paletted.
+ ),
+ 'test8_color_type_3' => array(
+ DIR_TESTDATA . '/images/png-tests/test8.png',
+ 3, // Paletted.
+ ),
+ );
+ }
}
diff --git a/tests/phpunit/tests/kses.php b/tests/phpunit/tests/kses.php
index 16d447fd4c..256a3866ec 100644
--- a/tests/phpunit/tests/kses.php
+++ b/tests/phpunit/tests/kses.php
@@ -489,6 +489,8 @@ EOF;
$tags = wp_kses_allowed_html( 'post' );
+ $this->assertNotEmpty( $tags );
+
foreach ( $tags as $tag ) {
$this->assertTrue( $tag['class'] );
$this->assertTrue( $tag['dir'] );
diff --git a/tests/phpunit/tests/l10n.php b/tests/phpunit/tests/l10n.php
index 7926a804da..2f7992c340 100644
--- a/tests/phpunit/tests/l10n.php
+++ b/tests/phpunit/tests/l10n.php
@@ -16,6 +16,17 @@ class Tests_L10n extends WP_UnitTestCase {
private $long_text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';
/**
+ * Editor user ID.
+ *
+ * @var int $editor_id
+ */
+ public static $editor_id;
+
+ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
+ self::$editor_id = $factory->user->create( array( 'role' => 'editor' ) );
+ }
+
+ /**
* @ticket 35961
*
* @covers ::_n_noop
@@ -464,7 +475,7 @@ class Tests_L10n extends WP_UnitTestCase {
* and return a string instead of null, which would otherwise cause a PHP 8.1
* "passing null to non-nullable" deprecation notice.
*/
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'editor' ) ) );
+ wp_set_current_user( self::$editor_id );
$args = array(
'post_content' => $this->long_text,
@@ -503,7 +514,7 @@ class Tests_L10n extends WP_UnitTestCase {
* and return a string instead of null, which would otherwise cause a PHP 8.1
* "passing null to non-nullable" deprecation notice.
*/
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'editor' ) ) );
+ wp_set_current_user( self::$editor_id );
$args = array(
'post_content' => $this->long_text,
@@ -542,7 +553,7 @@ class Tests_L10n extends WP_UnitTestCase {
* and return a string instead of null, which would otherwise cause a PHP 8.1
* "passing null to non-nullable" deprecation notice.
*/
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'editor' ) ) );
+ wp_set_current_user( self::$editor_id );
$args = array(
'post_content' => str_repeat( 'あ', 200 ),
diff --git a/tests/phpunit/tests/l10n/getUserLocale.php b/tests/phpunit/tests/l10n/getUserLocale.php
index 76492b3b70..e4eaf7a260 100644
--- a/tests/phpunit/tests/l10n/getUserLocale.php
+++ b/tests/phpunit/tests/l10n/getUserLocale.php
@@ -9,34 +9,61 @@
class Tests_L10n_GetUserLocale extends WP_UnitTestCase {
protected $user_id;
- public function set_up() {
- parent::set_up();
+ /**
+ * ID of the administrator user with de_DE local.
+ *
+ * @var int
+ */
+ public static $administrator_de_de;
+
+ /**
+ * ID of the user with es_ES local.
+ *
+ * @var int
+ */
+ public static $user_es_es;
- $this->user_id = self::factory()->user->create(
+ /**
+ * Set up the shared fixtures.
+ *
+ * @param WP_UnitTest_Factory $factory Factory instance.
+ */
+ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
+ self::$administrator_de_de = $factory->user->create(
array(
'role' => 'administrator',
'locale' => 'de_DE',
)
);
- wp_set_current_user( $this->user_id );
+ self::$user_es_es = self::factory()->user->create(
+ array(
+ 'locale' => 'es_ES',
+ )
+ );
+ }
+
+ public function set_up() {
+ parent::set_up();
+
+ wp_set_current_user( self::$administrator_de_de );
}
public function test_user_locale_property() {
set_current_screen( 'dashboard' );
$this->assertSame( 'de_DE', get_user_locale() );
- $this->assertSame( get_user_by( 'id', $this->user_id )->locale, get_user_locale() );
+ $this->assertSame( get_user_by( 'id', self::$administrator_de_de )->locale, get_user_locale() );
}
public function test_update_user_locale() {
set_current_screen( 'dashboard' );
- update_user_meta( $this->user_id, 'locale', 'fr_FR' );
+ update_user_meta( self::$administrator_de_de, 'locale', 'fr_FR' );
$this->assertSame( 'fr_FR', get_user_locale() );
}
public function test_returns_site_locale_if_empty() {
set_current_screen( 'dashboard' );
- update_user_meta( $this->user_id, 'locale', '' );
+ update_user_meta( self::$administrator_de_de, 'locale', '' );
$this->assertSame( get_locale(), get_user_locale() );
}
@@ -78,11 +105,7 @@ class Tests_L10n_GetUserLocale extends WP_UnitTestCase {
}
public function test_user_id_argument_with_id() {
- $user_id = self::factory()->user->create(
- array(
- 'locale' => 'es_ES',
- )
- );
+ $user_id = self::$user_es_es;
$user_locale1 = get_user_locale( $user_id );
@@ -95,11 +118,7 @@ class Tests_L10n_GetUserLocale extends WP_UnitTestCase {
}
public function test_user_id_argument_with_wp_user_object() {
- $user_id = self::factory()->user->create(
- array(
- 'locale' => 'es_ES',
- )
- );
+ $user_id = self::$user_es_es;
$user = get_user_by( 'id', $user_id );
diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php
index d8aac58d2a..a1e70c2ff1 100644
--- a/tests/phpunit/tests/media.php
+++ b/tests/phpunit/tests/media.php
@@ -999,7 +999,6 @@ VIDEO;
$content = apply_filters( 'the_content', $video );
$expected = '<div style="width: ' . $width . 'px;" class="wp-video">' .
- "<!--[if lt IE 9]><script>document.createElement('video');</script><![endif]-->\n" .
'<video class="wp-video-shortcode" id="video-' . $post_id . '-1" width="' . $width . '" height="' . $h . '" preload="metadata" controls="controls">' .
'<source type="video/mp4" src="http://domain.tld/wp-content/uploads/2013/12/xyz.mp4?_=1" />' .
'<!-- WebM/VP8 for Firefox4, Opera, and Chrome --><source type="video/webm" src="myvideo.webm" />' .
@@ -1847,6 +1846,8 @@ EOF;
// Calculate a srcset array.
$sizes = explode( ', ', wp_calculate_image_srcset( $size_array, $image_url, $image_meta ) );
+ $this->assertNotEmpty( $sizes );
+
// Test to confirm all sources in the array include the same edit hash.
foreach ( $sizes as $size ) {
$this->assertStringContainsString( $hash, $size );
@@ -3780,6 +3781,8 @@ EOF;
$query = $this->get_new_wp_query_for_published_post();
+ $this->assertTrue( have_posts() );
+
while ( have_posts() ) {
the_post();
@@ -3837,6 +3840,8 @@ EOF;
// Use the filter to alter the threshold for not lazy-loading to the first five elements.
$this->force_omit_loading_attr_threshold( 5 );
+ $this->assertTrue( have_posts() );
+
while ( have_posts() ) {
the_post();
diff --git a/tests/phpunit/tests/meta.php b/tests/phpunit/tests/meta.php
index 857414190a..6431a15861 100644
--- a/tests/phpunit/tests/meta.php
+++ b/tests/phpunit/tests/meta.php
@@ -9,16 +9,15 @@ class Tests_Meta extends WP_UnitTestCase {
/**
* @var \WP_User
*/
- private $author;
+ private static $author;
- private $meta_id;
- private $delete_meta_id;
+ private static $meta_id;
+ private static $delete_meta_id;
- public function set_up() {
- parent::set_up();
- $this->author = new WP_User( self::factory()->user->create( array( 'role' => 'author' ) ) );
- $this->meta_id = add_metadata( 'user', $this->author->ID, 'meta_key', 'meta_value' );
- $this->delete_meta_id = add_metadata( 'user', $this->author->ID, 'delete_meta_key', 'delete_meta_value' );
+ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
+ self::$author = new WP_User( $factory->user->create( array( 'role' => 'author' ) ) );
+ self::$meta_id = add_metadata( 'user', self::$author->ID, 'meta_key', 'meta_value' );
+ self::$delete_meta_id = add_metadata( 'user', self::$author->ID, 'delete_meta_key', 'delete_meta_value' );
}
public function meta_sanitize_cb( $meta_value, $meta_key, $meta_type ) {
@@ -37,51 +36,51 @@ class Tests_Meta extends WP_UnitTestCase {
public function test_delete_metadata_by_mid() {
// Let's try and delete a non-existing ID, non existing meta.
$this->assertFalse( delete_metadata_by_mid( 'user', 0 ) );
- $this->assertFalse( delete_metadata_by_mid( 'non_existing_meta', $this->delete_meta_id ) );
+ $this->assertFalse( delete_metadata_by_mid( 'non_existing_meta', self::$delete_meta_id ) );
// Now let's delete the real meta data.
- $this->assertTrue( delete_metadata_by_mid( 'user', $this->delete_meta_id ) );
+ $this->assertTrue( delete_metadata_by_mid( 'user', self::$delete_meta_id ) );
// And make sure it's been deleted.
- $this->assertFalse( get_metadata_by_mid( 'user', $this->delete_meta_id ) );
+ $this->assertFalse( get_metadata_by_mid( 'user', self::$delete_meta_id ) );
// Make sure the caches are cleared.
- $this->assertFalse( (bool) get_user_meta( $this->author->ID, 'delete_meta_key' ) );
+ $this->assertFalse( (bool) get_user_meta( self::$author->ID, 'delete_meta_key' ) );
}
public function test_update_metadata_by_mid() {
// Setup.
- $meta = get_metadata_by_mid( 'user', $this->meta_id );
+ $meta = get_metadata_by_mid( 'user', self::$meta_id );
// Update the meta value.
- $this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, 'meta_new_value' ) );
- $meta = get_metadata_by_mid( 'user', $this->meta_id );
+ $this->assertTrue( update_metadata_by_mid( 'user', self::$meta_id, 'meta_new_value' ) );
+ $meta = get_metadata_by_mid( 'user', self::$meta_id );
$this->assertSame( 'meta_new_value', $meta->meta_value );
// Update the meta value.
- $this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, 'meta_new_value', 'meta_new_key' ) );
- $meta = get_metadata_by_mid( 'user', $this->meta_id );
+ $this->assertTrue( update_metadata_by_mid( 'user', self::$meta_id, 'meta_new_value', 'meta_new_key' ) );
+ $meta = get_metadata_by_mid( 'user', self::$meta_id );
$this->assertSame( 'meta_new_key', $meta->meta_key );
// Update the key and value.
- $this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, 'meta_value', 'meta_key' ) );
- $meta = get_metadata_by_mid( 'user', $this->meta_id );
+ $this->assertTrue( update_metadata_by_mid( 'user', self::$meta_id, 'meta_value', 'meta_key' ) );
+ $meta = get_metadata_by_mid( 'user', self::$meta_id );
$this->assertSame( 'meta_key', $meta->meta_key );
$this->assertSame( 'meta_value', $meta->meta_value );
// Update the value that has to be serialized.
- $this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, array( 'first', 'second' ) ) );
- $meta = get_metadata_by_mid( 'user', $this->meta_id );
+ $this->assertTrue( update_metadata_by_mid( 'user', self::$meta_id, array( 'first', 'second' ) ) );
+ $meta = get_metadata_by_mid( 'user', self::$meta_id );
$this->assertSame( array( 'first', 'second' ), $meta->meta_value );
// Let's try some invalid meta data.
$this->assertFalse( update_metadata_by_mid( 'user', 0, 'meta_value' ) );
- $this->assertFalse( update_metadata_by_mid( 'user', $this->meta_id, 'meta_value', array( 'invalid', 'key' ) ) );
+ $this->assertFalse( update_metadata_by_mid( 'user', self::$meta_id, 'meta_value', array( 'invalid', 'key' ) ) );
// Let's see if caches get cleared after updates.
- $meta = get_metadata_by_mid( 'user', $this->meta_id );
+ $meta = get_metadata_by_mid( 'user', self::$meta_id );
$first = get_user_meta( $meta->user_id, $meta->meta_key );
- $this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, 'other_meta_value' ) );
+ $this->assertTrue( update_metadata_by_mid( 'user', self::$meta_id, 'other_meta_value' ) );
$second = get_user_meta( $meta->user_id, $meta->meta_key );
$this->assertFalse( $first === $second );
}
@@ -107,14 +106,16 @@ class Tests_Meta extends WP_UnitTestCase {
$found = $this->updated_mids;
$this->updated_mids = array();
+ $this->assertNotEmpty( $found );
+
foreach ( $found as $action => $mids ) {
$this->assertCount( 2, $mids );
}
}
public function test_metadata_exists() {
- $this->assertFalse( metadata_exists( 'user', $this->author->ID, 'foobarbaz' ) );
- $this->assertTrue( metadata_exists( 'user', $this->author->ID, 'meta_key' ) );
+ $this->assertFalse( metadata_exists( 'user', self::$author->ID, 'foobarbaz' ) );
+ $this->assertTrue( metadata_exists( 'user', self::$author->ID, 'meta_key' ) );
$this->assertFalse( metadata_exists( 'user', 1234567890, 'foobarbaz' ) );
$this->assertFalse( metadata_exists( 'user', 1234567890, 'meta_key' ) );
}
@@ -125,7 +126,7 @@ class Tests_Meta extends WP_UnitTestCase {
public function test_metadata_exists_with_filter() {
// Let's see if it returns the correct value when adding a filter.
add_filter( 'get_user_metadata', '__return_zero' );
- $this->assertFalse( metadata_exists( 'user', $this->author->ID, 'meta_key' ) ); // Existing meta key.
+ $this->assertFalse( metadata_exists( 'user', self::$author->ID, 'meta_key' ) ); // Existing meta key.
$this->assertFalse( metadata_exists( 'user', 1234567890, 'meta_key' ) );
remove_filter( 'get_user_metadata', '__return_zero' );
}
@@ -148,7 +149,7 @@ class Tests_Meta extends WP_UnitTestCase {
$this->assertCount( 1, $u );
// User found is not locally defined author (it's the admin).
- $this->assertNotEquals( $this->author->user_login, $u[0]->user_login );
+ $this->assertNotEquals( self::$author->user_login, $u[0]->user_login );
// Test EXISTS and NOT EXISTS together, no users should be found.
$this->assertCount(
@@ -183,7 +184,7 @@ class Tests_Meta extends WP_UnitTestCase {
)
);
- delete_metadata( 'user', $this->author->ID, 'meta_key' );
+ delete_metadata( 'user', self::$author->ID, 'meta_key' );
$this->assertCount(
2,
@@ -206,28 +207,28 @@ class Tests_Meta extends WP_UnitTestCase {
$expected = 'Testsingleslash';
$value2 = 'Test\\\\doubleslash';
$expected2 = 'Test\\doubleslash';
- $this->assertFalse( metadata_exists( 'user', $this->author->ID, $key ) );
- $this->assertFalse( delete_metadata( 'user', $this->author->ID, $key ) );
- $this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) );
- $this->assertIsInt( add_metadata( 'user', $this->author->ID, $key, $value ) );
- $this->assertSame( $expected, get_metadata( 'user', $this->author->ID, $key, true ) );
- $this->assertTrue( delete_metadata( 'user', $this->author->ID, $key ) );
- $this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) );
- $this->assertIsInt( update_metadata( 'user', $this->author->ID, $key, $value ) );
- $this->assertSame( $expected, get_metadata( 'user', $this->author->ID, $key, true ) );
- $this->assertTrue( update_metadata( 'user', $this->author->ID, $key, 'blah' ) );
- $this->assertSame( 'blah', get_metadata( 'user', $this->author->ID, $key, true ) );
- $this->assertTrue( delete_metadata( 'user', $this->author->ID, $key ) );
- $this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) );
- $this->assertFalse( metadata_exists( 'user', $this->author->ID, $key ) );
+ $this->assertFalse( metadata_exists( 'user', self::$author->ID, $key ) );
+ $this->assertFalse( delete_metadata( 'user', self::$author->ID, $key ) );
+ $this->assertSame( '', get_metadata( 'user', self::$author->ID, $key, true ) );
+ $this->assertIsInt( add_metadata( 'user', self::$author->ID, $key, $value ) );
+ $this->assertSame( $expected, get_metadata( 'user', self::$author->ID, $key, true ) );
+ $this->assertTrue( delete_metadata( 'user', self::$author->ID, $key ) );
+ $this->assertSame( '', get_metadata( 'user', self::$author->ID, $key, true ) );
+ $this->assertIsInt( update_metadata( 'user', self::$author->ID, $key, $value ) );
+ $this->assertSame( $expected, get_metadata( 'user', self::$author->ID, $key, true ) );
+ $this->assertTrue( update_metadata( 'user', self::$author->ID, $key, 'blah' ) );
+ $this->assertSame( 'blah', get_metadata( 'user', self::$author->ID, $key, true ) );
+ $this->assertTrue( delete_metadata( 'user', self::$author->ID, $key ) );
+ $this->assertSame( '', get_metadata( 'user', self::$author->ID, $key, true ) );
+ $this->assertFalse( metadata_exists( 'user', self::$author->ID, $key ) );
// Test overslashing.
- $this->assertIsInt( add_metadata( 'user', $this->author->ID, $key, $value2 ) );
- $this->assertSame( $expected2, get_metadata( 'user', $this->author->ID, $key, true ) );
- $this->assertTrue( delete_metadata( 'user', $this->author->ID, $key ) );
- $this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) );
- $this->assertIsInt( update_metadata( 'user', $this->author->ID, $key, $value2 ) );
- $this->assertSame( $expected2, get_metadata( 'user', $this->author->ID, $key, true ) );
+ $this->assertIsInt( add_metadata( 'user', self::$author->ID, $key, $value2 ) );
+ $this->assertSame( $expected2, get_metadata( 'user', self::$author->ID, $key, true ) );
+ $this->assertTrue( delete_metadata( 'user', self::$author->ID, $key ) );
+ $this->assertSame( '', get_metadata( 'user', self::$author->ID, $key, true ) );
+ $this->assertIsInt( update_metadata( 'user', self::$author->ID, $key, $value2 ) );
+ $this->assertSame( $expected2, get_metadata( 'user', self::$author->ID, $key, true ) );
}
/**
@@ -344,7 +345,7 @@ class Tests_Meta extends WP_UnitTestCase {
* @ticket 37746
*/
public function test_negative_meta_id() {
- $negative_mid = $this->meta_id * -1;
+ $negative_mid = self::$meta_id * -1;
$this->assertLessThan( 0, $negative_mid );
$this->assertFalse( get_metadata_by_mid( 'user', $negative_mid ) );
@@ -356,7 +357,7 @@ class Tests_Meta extends WP_UnitTestCase {
* @ticket 37746
*/
public function test_floating_meta_id() {
- $floating_mid = $this->meta_id + 0.1337;
+ $floating_mid = self::$meta_id + 0.1337;
$this->assertTrue( floor( $floating_mid ) !== $floating_mid );
$this->assertFalse( get_metadata_by_mid( 'user', $floating_mid ) );
@@ -368,7 +369,7 @@ class Tests_Meta extends WP_UnitTestCase {
* @ticket 37746
*/
public function test_string_point_zero_meta_id() {
- $meta_id = add_metadata( 'user', $this->author->ID, 'meta_key', 'meta_value_2' );
+ $meta_id = add_metadata( 'user', self::$author->ID, 'meta_key', 'meta_value_2' );
$string_mid = "{$meta_id}.0";
@@ -385,8 +386,8 @@ class Tests_Meta extends WP_UnitTestCase {
public function test_get_metadata_with_empty_key_array_value() {
$data = array( 1, 2 );
$value = serialize( $data );
- add_metadata( 'user', $this->author->ID, 'foo', $data );
- $found = get_metadata( 'user', $this->author->ID );
+ add_metadata( 'user', self::$author->ID, 'foo', $data );
+ $found = get_metadata( 'user', self::$author->ID );
$this->assertSame( array( $value ), $found['foo'] );
}
@@ -398,8 +399,8 @@ class Tests_Meta extends WP_UnitTestCase {
$data = new stdClass();
$data->foo = 'bar';
$value = serialize( $data );
- add_metadata( 'user', $this->author->ID, 'foo', $data );
- $found = get_metadata( 'user', $this->author->ID );
+ add_metadata( 'user', self::$author->ID, 'foo', $data );
+ $found = get_metadata( 'user', self::$author->ID );
$this->assertSame( array( $value ), $found['foo'] );
}
@@ -413,8 +414,8 @@ class Tests_Meta extends WP_UnitTestCase {
array( 3, 4 ),
);
$value = serialize( $data );
- add_metadata( 'user', $this->author->ID, 'foo', $data );
- $found = get_metadata( 'user', $this->author->ID );
+ add_metadata( 'user', self::$author->ID, 'foo', $data );
+ $found = get_metadata( 'user', self::$author->ID );
$this->assertSame( array( $value ), $found['foo'] );
}
diff --git a/tests/phpunit/tests/oembed/controller.php b/tests/phpunit/tests/oembed/controller.php
index 9011b789bb..aa0275c4c8 100644
--- a/tests/phpunit/tests/oembed/controller.php
+++ b/tests/phpunit/tests/oembed/controller.php
@@ -304,11 +304,7 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
}
public function test_request_json() {
- $user = self::factory()->user->create_and_get(
- array(
- 'display_name' => 'John Doe',
- )
- );
+ $user = get_user_by( 'id', self::$subscriber );
$post = self::factory()->post->create_and_get(
array(
'post_author' => $user->ID,
@@ -391,11 +387,7 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
}
public function test_request_xml() {
- $user = self::factory()->user->create_and_get(
- array(
- 'display_name' => 'John Doe',
- )
- );
+ $user = get_user_by( 'id', self::$subscriber );
$post = self::factory()->post->create_and_get(
array(
'post_author' => $user->ID,
@@ -461,11 +453,7 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
}
public function test_rest_pre_serve_request() {
- $user = self::factory()->user->create_and_get(
- array(
- 'display_name' => 'John Doe',
- )
- );
+ $user = get_user_by( 'id', self::$subscriber );
$post = self::factory()->post->create_and_get(
array(
'post_author' => $user->ID,
@@ -677,11 +665,7 @@ class Test_oEmbed_Controller extends WP_UnitTestCase {
public function test_proxy_with_internal_url() {
wp_set_current_user( self::$editor );
- $user = self::factory()->user->create_and_get(
- array(
- 'display_name' => 'John Doe',
- )
- );
+ $user = get_user_by( 'id', self::$subscriber );
$post = self::factory()->post->create_and_get(
array(
'post_author' => $user->ID,
diff --git a/tests/phpunit/tests/oembed/wpOembed.php b/tests/phpunit/tests/oembed/wpOembed.php
index 051a7efe3d..76d733dbce 100644
--- a/tests/phpunit/tests/oembed/wpOembed.php
+++ b/tests/phpunit/tests/oembed/wpOembed.php
@@ -11,6 +11,22 @@ class Tests_WP_oEmbed extends WP_UnitTestCase {
public $pre_oembed_result_filtered = false;
+ /**
+ * ID of the user.
+ *
+ * @var int
+ */
+ public static $user_id;
+
+ /**
+ * Set up the shared fixture.
+ *
+ * @param WP_UnitTest_Factory $factory Factory instance.
+ */
+ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
+ self::$user_id = $factory->user->create();
+ }
+
public function set_up() {
parent::set_up();
@@ -96,7 +112,7 @@ class Tests_WP_oEmbed extends WP_UnitTestCase {
* @group ms-required
*/
public function test_wp_filter_pre_oembed_result_multisite_sub_samesub() {
- $user_id = self::factory()->user->create();
+ $user_id = self::$user_id;
$blog_id = self::factory()->blog->create(
array(
@@ -125,7 +141,7 @@ class Tests_WP_oEmbed extends WP_UnitTestCase {
* @group ms-required
*/
public function test_wp_filter_pre_oembed_result_multisite_sub_othersub() {
- $user_id = self::factory()->user->create();
+ $user_id = self::$user_id;
$blog_id = self::factory()->blog->create(
array(
@@ -164,7 +180,7 @@ class Tests_WP_oEmbed extends WP_UnitTestCase {
public function test_wp_filter_pre_oembed_result_multisite_sub_main() {
$post_id = self::factory()->post->create();
$permalink = get_permalink( $post_id );
- $user_id = self::factory()->user->create();
+ $user_id = self::$user_id;
$blog_id = self::factory()->blog->create(
array(
'user_id' => $user_id,
@@ -189,7 +205,7 @@ class Tests_WP_oEmbed extends WP_UnitTestCase {
* @group ms-required
*/
public function test_wp_filter_pre_oembed_result_multisite_preserves_switched_state() {
- $user_id = self::factory()->user->create();
+ $user_id = self::$user_id;
$blog_id = self::factory()->blog->create( array( 'user_id' => $user_id ) );
switch_to_blog( $blog_id );
@@ -220,7 +236,7 @@ class Tests_WP_oEmbed extends WP_UnitTestCase {
public function test_wp_filter_pre_oembed_result_multisite_restores_state_if_no_post_is_found() {
$current_blog_id = get_current_blog_id();
- $user_id = self::factory()->user->create();
+ $user_id = self::$user_id;
$blog_id = self::factory()->blog->create(
array(
'user_id' => $user_id,
diff --git a/tests/phpunit/tests/post.php b/tests/phpunit/tests/post.php
index 6e0207add2..36c337939e 100644
--- a/tests/phpunit/tests/post.php
+++ b/tests/phpunit/tests/post.php
@@ -269,6 +269,9 @@ class Tests_Post extends WP_UnitTestCase {
$terms = get_terms( $tax );
$term = reset( $terms );
+ $this->assertNotEmpty( $matches );
+ $this->assertNotEmpty( $matches[1] );
+
foreach ( $matches[1] as $url ) {
$this->assertStringContainsString( 'tag_ID=' . $term->term_id, $url );
$this->assertStringContainsString( 'post_type=new_post_type', $url );
diff --git a/tests/phpunit/tests/post/getPages.php b/tests/phpunit/tests/post/getPages.php
index 76735bae86..dad85ddc69 100644
--- a/tests/phpunit/tests/post/getPages.php
+++ b/tests/phpunit/tests/post/getPages.php
@@ -6,6 +6,42 @@
* @covers ::get_pages
*/
class Tests_Post_GetPages extends WP_UnitTestCase {
+
+ /**
+ * ID of the first author.
+ *
+ * @var int
+ */
+ public static $author_id_1;
+
+ /**
+ * ID of the second author.
+ *
+ * @var int
+ */
+ public static $author_id_2;
+
+ /**
+ * Set up the shared fixture.
+ *
+ * @param WP_UnitTest_Factory $factory Factory instance.
+ */
+ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
+ self::$author_id_1 = $factory->user->create(
+ array(
+ 'user_login' => 'author1',
+ 'role' => 'author',
+ )
+ );
+
+ self::$author_id_2 = $factory->user->create(
+ array(
+ 'user_login' => 'author2',
+ 'role' => 'author',
+ )
+ );
+ }
+
/**
* @ticket 23167
*/
@@ -963,12 +999,7 @@ class Tests_Post_GetPages extends WP_UnitTestCase {
* @ticket 12821
*/
public function test_get_pages_author() {
- $author_1 = self::factory()->user->create(
- array(
- 'user_login' => 'author1',
- 'role' => 'author',
- )
- );
+ $author_1 = self::$author_id_1;
$posts = self::factory()->post->create_many(
2,
array(
@@ -989,12 +1020,7 @@ class Tests_Post_GetPages extends WP_UnitTestCase {
* @ticket 12821
*/
public function test_get_pages_multiple_authors() {
- $author_1 = self::factory()->user->create(
- array(
- 'user_login' => 'author1',
- 'role' => 'author',
- )
- );
+ $author_1 = self::$author_id_1;
$post_1 = self::factory()->post->create(
array(
'post_title' => 'Page 1',
@@ -1004,12 +1030,7 @@ class Tests_Post_GetPages extends WP_UnitTestCase {
)
);
- $author_2 = self::factory()->user->create(
- array(
- 'user_login' => 'author2',
- 'role' => 'author',
- )
- );
+ $author_2 = self::$author_id_2;
$post_2 = self::factory()->post->create(
array(
'post_title' => 'Page 2',
@@ -1031,12 +1052,7 @@ class Tests_Post_GetPages extends WP_UnitTestCase {
* @ticket 12821
*/
public function test_get_pages_multiple_authors_by_user_login() {
- $author_1 = self::factory()->user->create(
- array(
- 'user_login' => 'author1',
- 'role' => 'author',
- )
- );
+ $author_1 = self::$author_id_1;
$post_1 = self::factory()->post->create(
array(
'post_title' => 'Page 1',
@@ -1046,12 +1062,7 @@ class Tests_Post_GetPages extends WP_UnitTestCase {
)
);
- $author_2 = self::factory()->user->create(
- array(
- 'user_login' => 'author2',
- 'role' => 'author',
- )
- );
+ $author_2 = self::$author_id_2;
$post_2 = self::factory()->post->create(
array(
'post_title' => 'Page 2',
diff --git a/tests/phpunit/tests/post/getPostsByAuthorSql.php b/tests/phpunit/tests/post/getPostsByAuthorSql.php
index fc6f1e8526..e2657a3fdf 100644
--- a/tests/phpunit/tests/post/getPostsByAuthorSql.php
+++ b/tests/phpunit/tests/post/getPostsByAuthorSql.php
@@ -5,6 +5,30 @@
*/
class Tests_Post_GetPostsByAuthorSql extends WP_UnitTestCase {
+ /**
+ * ID of the first user.
+ *
+ * @var int
+ */
+ public static $user_id_1;
+
+ /**
+ * ID of the second user.
+ *
+ * @var int
+ */
+ public static $user_id_2;
+
+ /**
+ * Set up the shared fixture.
+ *
+ * @param WP_UnitTest_Factory $factory Factory instance.
+ */
+ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
+ self::$user_id_1 = $factory->user->create();
+ self::$user_id_2 = $factory->user->create();
+ }
+
public function test_post_type_post() {
$maybe_string = get_posts_by_author_sql( 'post' );
$this->assertStringContainsString( "post_type = 'post'", $maybe_string );
@@ -59,7 +83,7 @@ class Tests_Post_GetPostsByAuthorSql extends WP_UnitTestCase {
public function test_public_only_true_should_not_allow_any_private_posts_for_loggedin_user() {
$current_user = get_current_user_id();
- $u = self::factory()->user->create();
+ $u = self::$user_id_1;
wp_set_current_user( $u );
$maybe_string = get_posts_by_author_sql( 'post', true, $u, true );
@@ -70,7 +94,7 @@ class Tests_Post_GetPostsByAuthorSql extends WP_UnitTestCase {
public function test_public_only_should_default_to_false() {
$current_user = get_current_user_id();
- $u = self::factory()->user->create();
+ $u = self::$user_id_1;
wp_set_current_user( $u );
$this->assertSame( get_posts_by_author_sql( 'post', true, $u, false ), get_posts_by_author_sql( 'post', true, $u ) );
@@ -80,7 +104,7 @@ class Tests_Post_GetPostsByAuthorSql extends WP_UnitTestCase {
public function test_public_only_false_should_allow_current_user_access_to_own_private_posts_when_current_user_matches_post_author() {
$current_user = get_current_user_id();
- $u = self::factory()->user->create();
+ $u = self::$user_id_1;
wp_set_current_user( $u );
$maybe_string = get_posts_by_author_sql( 'post', true, $u, false );
@@ -91,8 +115,8 @@ class Tests_Post_GetPostsByAuthorSql extends WP_UnitTestCase {
public function test_public_only_false_should_not_allow_access_to_private_posts_if_current_user_is_not_post_author() {
$current_user = get_current_user_id();
- $u1 = self::factory()->user->create();
- $u2 = self::factory()->user->create();
+ $u1 = self::$user_id_1;
+ $u2 = self::$user_id_2;
wp_set_current_user( $u1 );
$maybe_string = get_posts_by_author_sql( 'post', true, $u2, false );
@@ -103,7 +127,7 @@ class Tests_Post_GetPostsByAuthorSql extends WP_UnitTestCase {
public function test_public_only_false_should_allow_current_user_access_to_own_private_posts_when_post_author_is_not_provided() {
$current_user = get_current_user_id();
- $u = self::factory()->user->create();
+ $u = self::$user_id_1;
wp_set_current_user( $u );
$maybe_string = get_posts_by_author_sql( 'post', true, $u, false );
diff --git a/tests/phpunit/tests/post/revisions.php b/tests/phpunit/tests/post/revisions.php
index a4e45aefcf..699c10d29b 100644
--- a/tests/phpunit/tests/post/revisions.php
+++ b/tests/phpunit/tests/post/revisions.php
@@ -230,6 +230,8 @@ class Tests_Post_Revisions extends WP_UnitTestCase {
$this->assertCount( 1, $revisions );
$this->assertTrue( user_can( self::$editor_user_id, 'read_post', $post_id ) );
+ $this->assertNotEmpty( $revisions );
+
foreach ( $revisions as $revision ) {
$this->assertTrue( user_can( self::$editor_user_id, 'read_post', $revision->ID ) );
}
diff --git a/tests/phpunit/tests/post/updateTermCountOnTransitionPostStatus.php b/tests/phpunit/tests/post/updateTermCountOnTransitionPostStatus.php
new file mode 100644
index 0000000000..8467f8e92d
--- /dev/null
+++ b/tests/phpunit/tests/post/updateTermCountOnTransitionPostStatus.php
@@ -0,0 +1,180 @@
+<?php
+
+/**
+ * Tests for the _update_term_count_on_transition_post_status function.
+ *
+ * See Tests_Term_WpSetObjectTerms for tests that cover changing terms on a post when saving it.
+ *
+ * @group taxonomy
+ *
+ * @covers ::_update_term_count_on_transition_post_status
+ */
+class Tests_Taxonomy_UpdateTermCountOnTransitionPostStatus extends WP_UnitTestCase {
+
+ /**
+ * @var int Post ID.
+ */
+ protected static $post_id;
+
+ /**
+ * @var int Term ID.
+ */
+ protected static $term_id;
+
+ /**
+ * @var string Post type.
+ */
+ protected static $post_type = 'post';
+
+ /**
+ * @var string Taxonomy name.
+ */
+ protected static $taxonomy = 'category';
+
+ /**
+ * Create shared fixtures.
+ */
+ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
+ self::$post_id = $factory->post->create(
+ array(
+ 'post_type' => self::$post_type,
+ 'post_status' => 'publish',
+ )
+ );
+
+ self::$term_id = $factory->term->create(
+ array(
+ 'taxonomy' => self::$taxonomy,
+ 'name' => 'Test Category',
+ )
+ );
+
+ wp_set_object_terms( self::$post_id, self::$term_id, self::$taxonomy );
+ }
+
+ /**
+ * Test that the term count is updated when a post is published.
+ *
+ * @ticket 42522
+ */
+ public function test_update_term_count_on_publish() {
+ $this->assertTermCount( 1, self::$term_id );
+
+ // Change post status to draft.
+ wp_update_post(
+ array(
+ 'ID' => self::$post_id,
+ 'post_status' => 'draft',
+ )
+ );
+
+ $this->assertTermCount( 0, self::$term_id );
+
+ // Change post status back to publish.
+ wp_update_post(
+ array(
+ 'ID' => self::$post_id,
+ 'post_status' => 'publish',
+ )
+ );
+
+ $this->assertTermCount( 1, self::$term_id );
+ }
+
+ /**
+ * Test that the term count is updated when a post is moved to trash.
+ *
+ * @ticket 42522
+ */
+ public function test_update_term_count_on_trash() {
+ $this->assertTermCount( 1, self::$term_id );
+
+ // Move post to trash.
+ wp_trash_post( self::$post_id );
+
+ $this->assertTermCount( 0, self::$term_id );
+ }
+
+ /**
+ * Test that the term count is updated when a post is restored from trash.
+ *
+ * @ticket 42522
+ */
+ public function test_update_term_count_on_restore() {
+ $this->assertTermCount( 1, self::$term_id );
+
+ // Move post to trash.
+ wp_trash_post( self::$post_id );
+
+ $this->assertTermCount( 0, self::$term_id, 'Post is in trash.' );
+
+ // Restore post from trash.
+ wp_untrash_post( self::$post_id );
+
+ $this->assertTermCount( 0, self::$term_id, 'Post is in draft after untrashing.' );
+
+ // re-publish post.
+ wp_publish_post( self::$post_id );
+
+ $this->assertTermCount( 1, self::$term_id, 'Post is in publish after publishing.' );
+ }
+
+ /**
+ * Test that the term count is updated when a post is deleted permanently.
+ *
+ * @ticket 42522
+ */
+ public function test_update_term_count_on_delete() {
+ $this->assertTermCount( 1, self::$term_id );
+
+ // Delete post permanently.
+ wp_delete_post( self::$post_id, true );
+
+ $this->assertTermCount( 0, self::$term_id );
+ }
+
+ /**
+ * Test that the term count is not recalculated when neither the terms nor the post status change.
+ *
+ * @ticket 42522
+ */
+ public function test_term_count_is_not_recalculated_when_status_does_not_change() {
+ $post_id = self::factory()->post->create(
+ array(
+ 'post_type' => self::$post_type,
+ 'post_status' => 'publish',
+ )
+ );
+
+ wp_set_object_terms(
+ $post_id,
+ self::$term_id,
+ self::$taxonomy
+ );
+ $edited_term_taxonomy_count = did_action( 'edited_term_taxonomy' );
+
+ // Change something about the post but not its status.
+ wp_update_post(
+ array(
+ 'ID' => $post_id,
+ 'post_content' => get_post( $post_id )->post_content . ' - updated',
+ )
+ );
+
+ $this->assertSame( 0, did_action( 'edited_term_taxonomy' ) - $edited_term_taxonomy_count, 'Term taxonomy count should not be recalculated when post status does not change.' );
+ $this->assertTermCount( 2, self::$term_id );
+ }
+
+ /**
+ * Assert that the term count is correct.
+ *
+ * @since 6.9.0
+ *
+ * @param int $expected_count Expected term count.
+ * @param int $term_id Term ID.
+ */
+ protected function assertTermCount( $expected_count, $term_id, $message = '' ) {
+ $term = get_term( $term_id );
+ $this->assertSame( $expected_count, $term->count, $message );
+ }
+}
diff --git a/tests/phpunit/tests/post/wpPostType.php b/tests/phpunit/tests/post/wpPostType.php
index 0eb9f1e203..23ec325a65 100644
--- a/tests/phpunit/tests/post/wpPostType.php
+++ b/tests/phpunit/tests/post/wpPostType.php
@@ -7,6 +7,8 @@ class Tests_Post_WP_Post_Type extends WP_UnitTestCase {
public function test_instances() {
global $wp_post_types;
+ $this->assertNotEmpty( $wp_post_types );
+
foreach ( $wp_post_types as $post_type ) {
$this->assertInstanceOf( 'WP_Post_Type', $post_type );
}
diff --git a/tests/phpunit/tests/query.php b/tests/phpunit/tests/query.php
index 37dd51a063..40d23816d1 100644
--- a/tests/phpunit/tests/query.php
+++ b/tests/phpunit/tests/query.php
@@ -17,6 +17,9 @@ class Tests_Query extends WP_UnitTestCase {
$nested_post_id = self::factory()->post->create();
$first_query = new WP_Query( array( 'post__in' => array( $post_id ) ) );
+
+ $this->assertTrue( $first_query->have_posts() );
+
while ( $first_query->have_posts() ) {
$first_query->the_post();
$second_query = new WP_Query( array( 'post__in' => array( $nested_post_id ) ) );
diff --git a/tests/phpunit/tests/query/conditionals.php b/tests/phpunit/tests/query/conditionals.php
index 05278ffd7a..4b47317889 100644
--- a/tests/phpunit/tests/query/conditionals.php
+++ b/tests/phpunit/tests/query/conditionals.php
@@ -14,6 +14,22 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
protected $page_ids;
protected $post_ids;
+ /**
+ * ID of the user-a.
+ *
+ * @var int
+ */
+ public static $user_a_id;
+
+ /**
+ * Set up the shared fixture.
+ *
+ * @param WP_UnitTest_Factory $factory Factory instance.
+ */
+ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
+ self::$user_a_id = $factory->user->create( array( 'user_login' => 'user-a' ) );
+ }
+
public function set_up() {
parent::set_up();
@@ -588,7 +604,6 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
// 'author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?author_name=$matches[1]&feed=$matches[2]',
// 'author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?author_name=$matches[1]&feed=$matches[2]',
public function test_author_feed() {
- self::factory()->user->create( array( 'user_login' => 'user-a' ) );
// Check the long form.
$types = array( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
foreach ( $types as $type ) {
@@ -607,7 +622,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
// 'author/([^/]+)/page/?([0-9]{1,})/?$' => 'index.php?author_name=$matches[1]&paged=$matches[2]',
public function test_author_paged() {
update_option( 'posts_per_page', 2 );
- $user_id = self::factory()->user->create( array( 'user_login' => 'user-a' ) );
+ $user_id = self::$user_a_id;
self::factory()->post->create_many( 3, array( 'post_author' => $user_id ) );
$this->go_to( '/author/user-a/page/2/' );
$this->assertQueryTrue( 'is_archive', 'is_author', 'is_paged' );
@@ -615,14 +630,13 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
// 'author/([^/]+)/?$' => 'index.php?author_name=$matches[1]',
public function test_author() {
- $user_id = self::factory()->user->create( array( 'user_login' => 'user-a' ) );
+ $user_id = self::$user_a_id;
self::factory()->post->create( array( 'post_author' => $user_id ) );
$this->go_to( '/author/user-a/' );
$this->assertQueryTrue( 'is_archive', 'is_author' );
}
public function test_author_with_no_posts() {
- $user_id = self::factory()->user->create( array( 'user_login' => 'user-a' ) );
$this->go_to( '/author/user-a/' );
$this->assertQueryTrue( 'is_archive', 'is_author' );
}
@@ -1122,7 +1136,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
* @ticket 24674
*/
public function test_is_author_with_nicename_that_begins_with_a_number_that_clashes_with_another_author_id() {
- $u1 = self::factory()->user->create();
+ $u1 = self::$user_a_id;
$u2_name = $u1 . '_user';
$u2 = self::factory()->user->create(
@@ -1279,7 +1293,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
global $wpdb;
// We need a non-post that shares an ID with a post assigned a template.
- $user_id = self::factory()->user->create();
+ $user_id = self::$user_a_id;
if ( ! get_post( $user_id ) ) {
$post_id = self::factory()->post->create( array( 'post_type' => 'post' ) );
$wpdb->update( $wpdb->posts, array( 'ID' => $user_id ), array( 'ID' => $post_id ), array( '%d' ) );
@@ -1352,12 +1366,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
* @ticket 35902
*/
public function test_is_author_should_not_match_numeric_id_to_nickname_beginning_with_id() {
- $u1 = self::factory()->user->create(
- array(
- 'nickname' => 'Foo',
- 'user_nicename' => 'foo',
- )
- );
+ $u1 = self::$user_a_id;
$u2 = self::factory()->user->create(
array(
'nickname' => "$u1 Foo",
@@ -1375,12 +1384,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
* @ticket 35902
*/
public function test_is_author_should_not_match_numeric_id_to_user_nicename_beginning_with_id() {
- $u1 = self::factory()->user->create(
- array(
- 'nickname' => 'Foo',
- 'user_nicename' => 'foo',
- )
- );
+ $u1 = self::$user_a_id;
$u2 = self::factory()->user->create(
array(
'nickname' => 'Foo',
diff --git a/tests/phpunit/tests/query/postStatus.php b/tests/phpunit/tests/query/postStatus.php
index 238551b524..95e7968951 100644
--- a/tests/phpunit/tests/query/postStatus.php
+++ b/tests/phpunit/tests/query/postStatus.php
@@ -240,7 +240,11 @@ class Tests_Query_PostStatus extends WP_UnitTestCase {
)
);
- foreach ( get_post_stati( array( 'public' => true ) ) as $status ) {
+ $stati = get_post_stati( array( 'public' => true ) );
+
+ $this->assertNotEmpty( $stati );
+
+ foreach ( $stati as $status ) {
$this->assertStringContainsString( "post_status = '$status'", $q->request );
}
}
diff --git a/tests/phpunit/tests/query/setupPostdata.php b/tests/phpunit/tests/query/setupPostdata.php
index 985ae06f7a..ef6b3479d8 100644
--- a/tests/phpunit/tests/query/setupPostdata.php
+++ b/tests/phpunit/tests/query/setupPostdata.php
@@ -121,6 +121,9 @@ class Tests_Query_SetupPostdata extends WP_UnitTestCase {
'posts_per_page' => 1,
)
);
+
+ $this->assertTrue( $q->have_posts() );
+
if ( $q->have_posts() ) {
while ( $q->have_posts() ) {
$q->the_post();
@@ -221,6 +224,9 @@ class Tests_Query_SetupPostdata extends WP_UnitTestCase {
'post__in' => array( $post2 ),
)
);
+
+ $this->assertTrue( $q->have_posts() );
+
if ( $q->have_posts() ) {
while ( $q->have_posts() ) {
$q->the_post();
@@ -281,6 +287,9 @@ class Tests_Query_SetupPostdata extends WP_UnitTestCase {
'posts_per_page' => 1,
)
);
+
+ $this->assertTrue( $q->have_posts() );
+
if ( $q->have_posts() ) {
while ( $q->have_posts() ) {
$q->the_post();
@@ -367,6 +376,9 @@ class Tests_Query_SetupPostdata extends WP_UnitTestCase {
'posts_per_page' => 1,
)
);
+
+ $this->assertTrue( $q->have_posts() );
+
if ( $q->have_posts() ) {
while ( $q->have_posts() ) {
$q->the_post();
diff --git a/tests/phpunit/tests/readme.php b/tests/phpunit/tests/readme.php
index 85ffffcdf6..b9c643e221 100644
--- a/tests/phpunit/tests/readme.php
+++ b/tests/phpunit/tests/readme.php
@@ -70,15 +70,21 @@ class Tests_Readme extends WP_UnitTestCase {
$readme = file_get_contents( ABSPATH . 'readme.html' );
preg_match( '#Recommendations.*MariaDB</a> version <strong>([0-9.]*)#s', $readme, $matches );
- $matches[1] = str_replace( '.', '', $matches[1] );
- $response_body = $this->get_response_body( "https://mariadb.com/kb/en/release-notes-mariadb-{$matches[1]}-series/" );
+ $response_body = $this->get_response_body( 'https://downloads.mariadb.org/rest-api/mariadb/' );
+ $releases = json_decode( $response_body, true );
- // Retrieve the date of the first stable release for the recommended branch.
- preg_match( '#.*Stable.*?(\d{2} [A-Za-z]{3} \d{4})#s', $response_body, $mariadb_matches );
+ foreach ( $releases['major_releases'] as $release ) {
+ if ( isset( $release['release_id'] ) && $release['release_id'] === $matches[1] ) {
+ $mariadb_eol = $release['release_eol_date'];
+ }
+ }
+
+ // If the release ID is not found the version is unsupported.
+ if ( ! isset( $mariadb_eol ) ) {
+ $this->fail( "{$matches[1]} is not included in MariaDB's list of supported versions. Remember to update the WordPress.org Requirements page, too." );
+ }
- // Per https://mariadb.org/about/#maintenance-policy, MariaDB releases are supported for 5 years.
- $mariadb_eol = gmdate( 'Y-m-d', strtotime( $mariadb_matches[1] . ' +5 years' ) );
$current_date = gmdate( 'Y-m-d' );
$this->assertLessThan( $mariadb_eol, $current_date, "readme.html's Recommended MariaDB version is too old. Remember to update the WordPress.org Requirements page, too." );
diff --git a/tests/phpunit/tests/rest-api/rest-application-passwords-controller.php b/tests/phpunit/tests/rest-api/rest-application-passwords-controller.php
index 7a06bb006d..060a5c0912 100644
--- a/tests/phpunit/tests/rest-api/rest-application-passwords-controller.php
+++ b/tests/phpunit/tests/rest-api/rest-application-passwords-controller.php
@@ -848,6 +848,49 @@ class WP_Test_REST_Application_Passwords_Controller extends WP_Test_REST_Control
}
/**
+ * @ticket 53692
+ */
+ public function test_create_item_with_empty_app_id() {
+ wp_set_current_user( self::$admin );
+
+ $request = new WP_REST_Request( 'POST', '/wp/v2/users/me/application-passwords' );
+ $request->set_body_params(
+ array(
+ 'name' => 'Test',
+ 'app_id' => '',
+ )
+ );
+
+ $response = rest_get_server()->dispatch( $request );
+ $data = $response->get_data();
+
+ $this->assertSame( 201, $response->get_status() );
+ $this->assertSame( '', $data['app_id'] );
+ }
+
+ /**
+ * @ticket 53692
+ */
+ public function test_create_item_with_uuid_app_id() {
+ wp_set_current_user( self::$admin );
+
+ $uuid = wp_generate_uuid4();
+ $request = new WP_REST_Request( 'POST', '/wp/v2/users/me/application-passwords' );
+ $request->set_body_params(
+ array(
+ 'name' => 'Test',
+ 'app_id' => $uuid,
+ )
+ );
+
+ $response = rest_get_server()->dispatch( $request );
+ $data = $response->get_data();
+
+ $this->assertSame( 201, $response->get_status() );
+ $this->assertSame( $uuid, $data['app_id'] );
+ }
+
+ /**
* Checks the password response matches the expected format.
*
* @since 5.6.0
diff --git a/tests/phpunit/tests/rest-api/rest-comments-controller.php b/tests/phpunit/tests/rest-api/rest-comments-controller.php
index 647d5df03d..0bfe4e778d 100644
--- a/tests/phpunit/tests/rest-api/rest-comments-controller.php
+++ b/tests/phpunit/tests/rest-api/rest-comments-controller.php
@@ -3442,9 +3442,7 @@ class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase
$this->assertSame( $comment->comment_author_IP, $data['author_ip'] );
$this->assertSame( $comment->comment_agent, $data['author_user_agent'] );
$this->assertSame( $comment->comment_content, $data['content']['raw'] );
- }
-
- if ( 'edit' !== $context ) {
+ } else {
$this->assertArrayNotHasKey( 'author_email', $data );
$this->assertArrayNotHasKey( 'author_ip', $data );
$this->assertArrayNotHasKey( 'author_user_agent', $data );
diff --git a/tests/phpunit/tests/rest-api/rest-global-styles-controller.php b/tests/phpunit/tests/rest-api/rest-global-styles-controller.php
index b55c7c3d60..59986e597c 100644
--- a/tests/phpunit/tests/rest-api/rest-global-styles-controller.php
+++ b/tests/phpunit/tests/rest-api/rest-global-styles-controller.php
@@ -133,13 +133,13 @@ class WP_REST_Global_Styles_Controller_Test extends WP_Test_REST_Controller_Test
public function test_register_routes() {
$routes = rest_get_server()->get_routes();
$this->assertArrayHasKey(
- '/wp/v2/global-styles/(?P<id>[\/\w-]+)',
+ '/wp/v2/global-styles/(?P<id>[\/\d+]+)',
$routes,
'Single global style based on the given ID route does not exist'
);
$this->assertCount(
2,
- $routes['/wp/v2/global-styles/(?P<id>[\/\w-]+)'],
+ $routes['/wp/v2/global-styles/(?P<id>[\/\d+]+)'],
'Single global style based on the given ID route does not have exactly two elements'
);
$this->assertArrayHasKey(
@@ -408,7 +408,7 @@ class WP_REST_Global_Styles_Controller_Test extends WP_Test_REST_Controller_Test
// Themes deep in subdirectories.
'2 subdirectories deep' => array(
'theme_dirname' => 'subdir/subsubdir/mytheme',
- 'expected' => 'rest_global_styles_not_found',
+ 'expected' => 'rest_no_route',
),
);
}
@@ -776,4 +776,54 @@ class WP_REST_Global_Styles_Controller_Test extends WP_Test_REST_Controller_Test
$this->assertArrayHasKey( 'https://api.w.org/action-edit-css', $links );
}
}
+
+ /**
+ * Test that the route accepts integer IDs.
+ *
+ * @ticket 61911
+ */
+ public function test_global_styles_route_accepts_integer_id() {
+ wp_set_current_user( self::$admin_id );
+ $request = new WP_REST_Request( 'GET', '/wp/v2/global-styles/' . self::$global_styles_id );
+ $response = rest_get_server()->dispatch( $request );
+
+ $this->assertEquals( 200, $response->get_status() );
+
+ $data = $response->get_data();
+ $this->assertIsInt( $data['id'] );
+ $this->assertSame( self::$global_styles_id, $data['id'] );
+ }
+
+ /**
+ * Test that the schema defines ID as an integer.
+ *
+ * @ticket 61911
+ */
+ public function test_global_styles_schema_id_type() {
+ $request = new WP_REST_Request( 'OPTIONS', '/wp/v2/global-styles/' . self::$global_styles_id );
+ $response = rest_get_server()->dispatch( $request );
+
+ $data = $response->get_data();
+ $schema = $data['schema'];
+
+ $this->assertArrayHasKey( 'properties', $schema );
+ $this->assertArrayHasKey( 'id', $schema['properties'] );
+ $this->assertArrayHasKey( 'type', $schema['properties']['id'] );
+ $this->assertSame( 'integer', $schema['properties']['id']['type'] );
+ }
+
+ /**
+ * Test that the route argument schema defines ID as an integer.
+ *
+ * @ticket 61911
+ */
+ public function test_global_styles_route_args_schema() {
+ $routes = rest_get_server()->get_routes();
+ $route_data = $routes['/wp/v2/global-styles/(?P<id>[\/\d+]+)'];
+
+ $this->assertArrayHasKey( 'args', $route_data[0] );
+ $this->assertArrayHasKey( 'id', $route_data[0]['args'] );
+ $this->assertArrayHasKey( 'type', $route_data[0]['args']['id'] );
+ $this->assertSame( 'integer', $route_data[0]['args']['id']['type'] );
+ }
}
diff --git a/tests/phpunit/tests/rest-api/rest-posts-controller.php b/tests/phpunit/tests/rest-api/rest-posts-controller.php
index 6462bb9241..bd0b9a3af4 100644
--- a/tests/phpunit/tests/rest-api/rest-posts-controller.php
+++ b/tests/phpunit/tests/rest-api/rest-posts-controller.php
@@ -876,6 +876,9 @@ class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te
$this->assertSame( 200, $response->get_status() );
$all_data = $response->get_data();
+
+ $this->assertNotEmpty( $all_data );
+
foreach ( $all_data as $post ) {
$this->assertNotEquals( $draft_id, $post['id'] );
}
diff --git a/tests/phpunit/tests/rest-api/rest-schema-setup.php b/tests/phpunit/tests/rest-api/rest-schema-setup.php
index 03dcb0631f..7f8de5f0dd 100644
--- a/tests/phpunit/tests/rest-api/rest-schema-setup.php
+++ b/tests/phpunit/tests/rest-api/rest-schema-setup.php
@@ -133,7 +133,7 @@ class WP_Test_REST_Schema_Initialization extends WP_Test_REST_TestCase {
'/wp/v2/users/(?P<user_id>(?:[\\d]+|me))/application-passwords/(?P<uuid>[\\w\\-]+)',
'/wp/v2/comments',
'/wp/v2/comments/(?P<id>[\\d]+)',
- '/wp/v2/global-styles/(?P<id>[\/\w-]+)',
+ '/wp/v2/global-styles/(?P<id>[\/\d+]+)',
'/wp/v2/global-styles/(?P<parent>[\d]+)/revisions',
'/wp/v2/global-styles/(?P<parent>[\d]+)/revisions/(?P<id>[\d]+)',
'/wp/v2/global-styles/themes/(?P<stylesheet>[\/\s%\w\.\(\)\[\]\@_\-]+)/variations',
diff --git a/tests/phpunit/tests/rest-api/rest-server.php b/tests/phpunit/tests/rest-api/rest-server.php
index dc991eb672..9cd80005f5 100644
--- a/tests/phpunit/tests/rest-api/rest-server.php
+++ b/tests/phpunit/tests/rest-api/rest-server.php
@@ -1871,6 +1871,8 @@ class Tests_REST_Server extends WP_Test_REST_TestCase {
public function test_get_routes_respects_namespace_parameter() {
$routes = rest_get_server()->get_routes( 'oembed/1.0' );
+ $this->assertNotEmpty( $routes );
+
foreach ( $routes as $route => $handlers ) {
$this->assertStringStartsWith( '/oembed/1.0', $route );
}
diff --git a/tests/phpunit/tests/rest-api/rest-settings-controller.php b/tests/phpunit/tests/rest-api/rest-settings-controller.php
index e8f90b53f2..c6b42c365f 100644
--- a/tests/phpunit/tests/rest-api/rest-settings-controller.php
+++ b/tests/phpunit/tests/rest-api/rest-settings-controller.php
@@ -385,14 +385,24 @@ class WP_Test_REST_Settings_Controller extends WP_Test_REST_Controller_Testcase
}
/**
- * @doesNotPerformAssertions
+ * Settings can't be created
*/
public function test_create_item() {
- // Controller does not implement create_item().
+ wp_set_current_user( self::$administrator );
+
+ $request = new WP_REST_Request( 'POST', '/wp/v2/settings' );
+ $request->set_param( 'new_setting', 'New value' );
+ $response = rest_get_server()->dispatch( $request );
+
+ $this->assertSame( 400, $response->get_status() );
}
+ /**
+ * @ticket 41604
+ */
public function test_update_item() {
wp_set_current_user( self::$administrator );
+
$request = new WP_REST_Request( 'PUT', '/wp/v2/settings' );
$request->set_param( 'title', 'The new title!' );
$response = rest_get_server()->dispatch( $request );
@@ -403,6 +413,63 @@ class WP_Test_REST_Settings_Controller extends WP_Test_REST_Controller_Testcase
$this->assertSame( get_option( 'blogname' ), $data['title'] );
}
+ /**
+ * @ticket 41604
+ */
+ public function test_update_item_with_global_parameters_present() {
+ wp_set_current_user( self::$administrator );
+
+ $request = new WP_REST_Request( 'PUT', '/wp/v2/settings' );
+ $request->set_param( 'title', 'The new title!' );
+ $request->set_url_params( array( '_locale' => 'user' ) );
+ $response = rest_get_server()->dispatch( $request );
+ $data = $response->get_data();
+
+ $this->assertSame( 200, $response->get_status() );
+ $this->assertSame( 'The new title!', $data['title'] );
+ $this->assertSame( get_option( 'blogname' ), $data['title'] );
+ }
+
+ /**
+ * @ticket 41604
+ */
+ public function test_update_item_with_empty_body() {
+ wp_set_current_user( self::$administrator );
+
+ $request = new WP_REST_Request( 'PUT', '/wp/v2/settings' );
+ $response = rest_get_server()->dispatch( $request );
+ $data = $response->get_data();
+
+ $this->assertSame( 400, $response->get_status() );
+ }
+
+ /**
+ * @ticket 41604
+ */
+ public function test_update_nonexistent_item() {
+ wp_set_current_user( self::$administrator );
+
+ $request = new WP_REST_Request( 'PUT', '/wp/v2/settings' );
+ $request->set_param( 'i_do_no_exist', 'New value' );
+ $response = rest_get_server()->dispatch( $request );
+
+ $this->assertSame( 400, $response->get_status() );
+ }
+
+ /**
+ * @ticket 41604
+ */
+ public function test_update_partially_valid_items() {
+ wp_set_current_user( self::$administrator );
+
+ $request = new WP_REST_Request( 'PUT', '/wp/v2/settings' );
+ $request->set_param( 'title', 'The new title!' );
+ $request->set_param( 'i_do_no_exist', 'New value' );
+ $response = rest_get_server()->dispatch( $request );
+
+ $this->assertSame( 400, $response->get_status() );
+ }
+
public function update_setting_custom_callback( $result, $name, $value, $args ) {
if ( 'title' === $name && 'The new title!' === $value ) {
// Do not allow changing the title in this case.
diff --git a/tests/phpunit/tests/rest-api/rest-users-controller.php b/tests/phpunit/tests/rest-api/rest-users-controller.php
index 2f4a2f4982..db34f88752 100644
--- a/tests/phpunit/tests/rest-api/rest-users-controller.php
+++ b/tests/phpunit/tests/rest-api/rest-users-controller.php
@@ -308,6 +308,8 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase {
$rest_post_types = array_values( get_post_types( array( 'show_in_rest' => true ), 'names' ) );
+ $this->assertNotEmpty( $users );
+
foreach ( $users as $user ) {
$this->assertNotEmpty( count_user_posts( $user['id'], $rest_post_types ) );
@@ -3359,9 +3361,7 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase {
$this->assertSame( $user->user_login, $data['username'] );
$this->assertSame( $user->roles, $data['roles'] );
$this->assertSame( get_user_locale( $user ), $data['locale'] );
- }
-
- if ( 'edit' !== $context ) {
+ } else {
$this->assertArrayNotHasKey( 'roles', $data );
$this->assertArrayNotHasKey( 'capabilities', $data );
$this->assertArrayNotHasKey( 'registered_date', $data );
diff --git a/tests/phpunit/tests/shortcode.php b/tests/phpunit/tests/shortcode.php
index 2c5b04d02e..269da2b05e 100644
--- a/tests/phpunit/tests/shortcode.php
+++ b/tests/phpunit/tests/shortcode.php
@@ -693,10 +693,11 @@ EOF;
private function sub_registration( $input, $expected ) {
add_shortcode( $input, '' );
$actual = shortcode_exists( $input );
- $this->assertSame( $expected, $actual );
if ( $actual ) {
remove_shortcode( $input );
}
+
+ $this->assertSame( $expected, $actual );
}
public function data_registration_bad() {
diff --git a/tests/phpunit/tests/taxonomy.php b/tests/phpunit/tests/taxonomy.php
index 2a4ee3b560..13528c3015 100644
--- a/tests/phpunit/tests/taxonomy.php
+++ b/tests/phpunit/tests/taxonomy.php
@@ -4,6 +4,18 @@
* @group taxonomy
*/
class Tests_Taxonomy extends WP_UnitTestCase {
+
+ /**
+ * Editor user ID.
+ *
+ * @var int $editor_id
+ */
+ public static $editor_id;
+
+ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
+ self::$editor_id = $factory->user->create( array( 'role' => 'editor' ) );
+ }
+
public function test_get_post_taxonomies() {
$this->assertSame( array( 'category', 'post_tag', 'post_format' ), get_object_taxonomies( 'post' ) );
}
@@ -28,7 +40,11 @@ class Tests_Taxonomy extends WP_UnitTestCase {
}
public function test_get_post_taxonomy() {
- foreach ( get_object_taxonomies( 'post' ) as $taxonomy ) {
+ $taxonomies = get_object_taxonomies( 'post' );
+
+ $this->assertNotEmpty( $taxonomies );
+
+ foreach ( $taxonomies as $taxonomy ) {
$tax = get_taxonomy( $taxonomy );
// Should return an object with the correct taxonomy object type.
$this->assertIsObject( $tax );
@@ -110,7 +126,11 @@ class Tests_Taxonomy extends WP_UnitTestCase {
}
public function test_get_link_taxonomy() {
- foreach ( get_object_taxonomies( 'link' ) as $taxonomy ) {
+ $taxonomies = get_object_taxonomies( 'link' );
+
+ $this->assertNotEmpty( $taxonomies );
+
+ foreach ( $taxonomies as $taxonomy ) {
$tax = get_taxonomy( $taxonomy );
// Should return an object with the correct taxonomy object type.
$this->assertIsObject( $tax );
@@ -1002,7 +1022,7 @@ class Tests_Taxonomy extends WP_UnitTestCase {
)
);
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'editor' ) ) );
+ wp_set_current_user( self::$editor_id );
$updated_post_id = edit_post(
array(
'post_ID' => $post->ID,
@@ -1028,7 +1048,7 @@ class Tests_Taxonomy extends WP_UnitTestCase {
*/
public function test_default_term_for_custom_taxonomy() {
- wp_set_current_user( self::factory()->user->create( array( 'role' => 'editor' ) ) );
+ wp_set_current_user( self::$editor_id );
$tax = 'custom-tax';
diff --git a/tests/phpunit/tests/term/cache.php b/tests/phpunit/tests/term/cache.php
index 99a73f7823..76eff31adf 100644
--- a/tests/phpunit/tests/term/cache.php
+++ b/tests/phpunit/tests/term/cache.php
@@ -222,6 +222,8 @@ class Tests_Term_Cache extends WP_UnitTestCase {
update_term_cache( $terms );
+ $this->assertNotEmpty( $terms );
+
foreach ( $terms as $term ) {
$this->assertSame( $p, $term->object_id );
}
diff --git a/tests/phpunit/tests/term/meta.php b/tests/phpunit/tests/term/meta.php
index 248d190917..a1eed9d335 100644
--- a/tests/phpunit/tests/term/meta.php
+++ b/tests/phpunit/tests/term/meta.php
@@ -132,26 +132,26 @@ class Tests_Term_Meta extends WP_UnitTestCase {
$this->go_to( get_permalink( $p ) );
remove_action( 'pre_get_posts', array( $this, 'set_cache_results' ) );
- if ( have_posts() ) {
- while ( have_posts() ) {
- the_post();
-
- // First request will hit the database.
- $num_queries = get_num_queries();
- $this->assertSame( 'bar', get_term_meta( $terms[0], 'foo', true ) );
- ++$num_queries;
- $this->assertSame( $num_queries, get_num_queries() );
-
- // Second and third requests should be in cache.
- $this->assertSame( 'bar', get_term_meta( $terms[1], 'foo', true ) );
- $this->assertSame( 'bar', get_term_meta( $terms[2], 'foo', true ) );
- $this->assertSame( $num_queries, get_num_queries() );
-
- // Querying a term not primed should result in a hit.
- ++$num_queries;
- $this->assertSame( 'bar', get_term_meta( $orphan_term, 'foo', true ) );
- $this->assertSame( $num_queries, get_num_queries() );
- }
+ $this->assertTrue( have_posts() );
+
+ while ( have_posts() ) {
+ the_post();
+
+ // First request will hit the database.
+ $num_queries = get_num_queries();
+ $this->assertSame( 'bar', get_term_meta( $terms[0], 'foo', true ) );
+ ++$num_queries;
+ $this->assertSame( $num_queries, get_num_queries() );
+
+ // Second and third requests should be in cache.
+ $this->assertSame( 'bar', get_term_meta( $terms[1], 'foo', true ) );
+ $this->assertSame( 'bar', get_term_meta( $terms[2], 'foo', true ) );
+ $this->assertSame( $num_queries, get_num_queries() );
+
+ // Querying a term not primed should result in a hit.
+ ++$num_queries;
+ $this->assertSame( 'bar', get_term_meta( $orphan_term, 'foo', true ) );
+ $this->assertSame( $num_queries, get_num_queries() );
}
}
@@ -201,20 +201,20 @@ class Tests_Term_Meta extends WP_UnitTestCase {
)
);
- if ( $q->have_posts() ) {
- while ( $q->have_posts() ) {
- $q->the_post();
+ $this->assertTrue( $q->have_posts() );
- // Requests will hit the database.
- $num_queries = get_num_queries();
- $this->assertSame( 'bar', get_term_meta( $terms[0], 'foo', true ) );
- ++$num_queries;
- $this->assertSame( $num_queries, get_num_queries() );
+ while ( $q->have_posts() ) {
+ $q->the_post();
- $this->assertSame( 'bar', get_term_meta( $terms[1], 'foo', true ) );
- ++$num_queries;
- $this->assertSame( $num_queries, get_num_queries() );
- }
+ // Requests will hit the database.
+ $num_queries = get_num_queries();
+ $this->assertSame( 'bar', get_term_meta( $terms[0], 'foo', true ) );
+ ++$num_queries;
+ $this->assertSame( $num_queries, get_num_queries() );
+
+ $this->assertSame( 'bar', get_term_meta( $terms[1], 'foo', true ) );
+ ++$num_queries;
+ $this->assertSame( $num_queries, get_num_queries() );
}
}
diff --git a/tests/phpunit/tests/term/wpGenerateTagCloud.php b/tests/phpunit/tests/term/wpGenerateTagCloud.php
index 62de4a0c26..4b7a27fb47 100644
--- a/tests/phpunit/tests/term/wpGenerateTagCloud.php
+++ b/tests/phpunit/tests/term/wpGenerateTagCloud.php
@@ -156,6 +156,8 @@ class Tests_WP_Generate_Tag_Cloud extends WP_UnitTestCase {
)
);
+ $this->assertNotEmpty( $tags );
+
foreach ( $tags as $tag ) {
$this->assertStringContainsString( '>' . $tag->name . '<', $found );
}
@@ -187,6 +189,8 @@ class Tests_WP_Generate_Tag_Cloud extends WP_UnitTestCase {
$this->assertMatchesRegularExpression( "|^<ul class='wp-tag-cloud' role='list'>|", $found );
$this->assertMatchesRegularExpression( "|</ul>\n|", $found );
+ $this->assertNotEmpty( $tags );
+
foreach ( $tags as $tag ) {
$this->assertStringContainsString( '>' . $tag->name . '<', $found );
}
diff --git a/tests/phpunit/tests/term/wpGetObjectTerms.php b/tests/phpunit/tests/term/wpGetObjectTerms.php
index 948ba1e1c3..128e4a19a8 100644
--- a/tests/phpunit/tests/term/wpGetObjectTerms.php
+++ b/tests/phpunit/tests/term/wpGetObjectTerms.php
@@ -110,6 +110,9 @@ class Tests_Term_WpGetObjectTerms extends WP_UnitTestCase {
add_filter( 'wp_get_object_terms', array( $this, 'filter_get_object_terms' ) );
$terms = wp_get_object_terms( $post_id, $this->taxonomy );
remove_filter( 'wp_get_object_terms', array( $this, 'filter_get_object_terms' ) );
+
+ $this->assertNotEmpty( $terms );
+
foreach ( $terms as $term ) {
$this->assertIsObject( $term );
}
@@ -845,6 +848,8 @@ class Tests_Term_WpGetObjectTerms extends WP_UnitTestCase {
)
);
+ $this->assertNotEmpty( $found );
+
foreach ( $found as $f ) {
$this->assertSame( $p, $f->object_id );
}
diff --git a/tests/phpunit/tests/term/wpTaxonomy.php b/tests/phpunit/tests/term/wpTaxonomy.php
index 4106e60f3b..845497ad06 100644
--- a/tests/phpunit/tests/term/wpTaxonomy.php
+++ b/tests/phpunit/tests/term/wpTaxonomy.php
@@ -7,6 +7,8 @@ class Tests_WP_Taxonomy extends WP_UnitTestCase {
public function test_instances() {
global $wp_taxonomies;
+ $this->assertNotEmpty( $wp_taxonomies );
+
foreach ( $wp_taxonomies as $taxonomy ) {
$this->assertInstanceOf( 'WP_Taxonomy', $taxonomy );
}
diff --git a/tests/phpunit/tests/theme.php b/tests/phpunit/tests/theme.php
index 40a8534c43..64a226d004 100644
--- a/tests/phpunit/tests/theme.php
+++ b/tests/phpunit/tests/theme.php
@@ -89,6 +89,9 @@ class Tests_Theme extends WP_UnitTestCase {
*/
public function test_get_theme() {
$themes = get_themes();
+
+ $this->assertNotEmpty( $themes );
+
foreach ( array_keys( $themes ) as $name ) {
$theme = get_theme( $name );
// WP_Theme implements ArrayAccess. Even ArrayObject returns false for is_array().
@@ -100,6 +103,9 @@ class Tests_Theme extends WP_UnitTestCase {
public function test_wp_get_theme() {
$themes = wp_get_themes();
+
+ $this->assertNotEmpty( $themes );
+
foreach ( $themes as $theme ) {
$this->assertInstanceOf( 'WP_Theme', $theme );
$this->assertFalse( $theme->errors() );
@@ -115,6 +121,9 @@ class Tests_Theme extends WP_UnitTestCase {
*/
public function test_get_themes_contents() {
$themes = get_themes();
+
+ $this->assertNotEmpty( $themes );
+
// Generic tests that should hold true for any theme.
foreach ( $themes as $k => $theme ) {
// Don't run these checks for custom themes.
@@ -361,6 +370,8 @@ class Tests_Theme extends WP_UnitTestCase {
public function test_switch_theme() {
$themes = get_themes();
+ $this->assertNotEmpty( $themes );
+
// Switch to each theme in sequence.
// Do it twice to make sure we switch to the first theme, even if it's our starting theme.
// Do it a third time to ensure switch_theme() works with one argument.
diff --git a/tests/phpunit/tests/url.php b/tests/phpunit/tests/url.php
index 4768e25b77..37ceb69cba 100644
--- a/tests/phpunit/tests/url.php
+++ b/tests/phpunit/tests/url.php
@@ -7,6 +7,17 @@
*/
class Tests_URL extends WP_UnitTestCase {
+ /**
+ * Author user ID.
+ *
+ * @var int $author_id
+ */
+ public static $author_id;
+
+ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
+ self::$author_id = $factory->user->create( array( 'role' => 'author' ) );
+ }
+
public function set_up() {
parent::set_up();
$GLOBALS['pagenow'] = '';
@@ -386,7 +397,7 @@ class Tests_URL extends WP_UnitTestCase {
* @covers ::get_adjacent_post
*/
public function test_get_adjacent_post_should_return_private_posts_belonging_to_the_current_user() {
- $u = self::factory()->user->create( array( 'role' => 'author' ) );
+ $u = self::$author_id;
$old_uid = get_current_user_id();
wp_set_current_user( $u );
@@ -425,7 +436,7 @@ class Tests_URL extends WP_UnitTestCase {
* @covers ::get_adjacent_post
*/
public function test_get_adjacent_post_should_return_private_posts_belonging_to_other_users_if_the_current_user_can_read_private_posts() {
- $u1 = self::factory()->user->create( array( 'role' => 'author' ) );
+ $u1 = self::$author_id;
$u2 = self::factory()->user->create( array( 'role' => 'administrator' ) );
$old_uid = get_current_user_id();
wp_set_current_user( $u2 );
@@ -465,7 +476,7 @@ class Tests_URL extends WP_UnitTestCase {
* @covers ::get_adjacent_post
*/
public function test_get_adjacent_post_should_not_return_private_posts_belonging_to_other_users_if_the_current_user_cannot_read_private_posts() {
- $u1 = self::factory()->user->create( array( 'role' => 'author' ) );
+ $u1 = self::$author_id;
$u2 = self::factory()->user->create( array( 'role' => 'author' ) );
$old_uid = get_current_user_id();
wp_set_current_user( $u2 );
diff --git a/tests/phpunit/tests/user.php b/tests/phpunit/tests/user.php
index 9e1faa2dca..df9f74b7e8 100644
--- a/tests/phpunit/tests/user.php
+++ b/tests/phpunit/tests/user.php
@@ -49,7 +49,7 @@ class Tests_User extends WP_UnitTestCase {
self::$user_ids[] = self::$admin_id;
self::$editor_id = $factory->user->create(
array(
- 'user_email' => 'test@test.com',
+ 'user_email' => 'test@example.com',
'role' => 'editor',
)
);
@@ -820,7 +820,7 @@ class Tests_User extends WP_UnitTestCase {
*/
public function test_validate_username_string() {
$this->assertTrue( validate_username( 'johndoe' ) );
- $this->assertTrue( validate_username( 'test@test.com' ) );
+ $this->assertTrue( validate_username( 'test@example.com' ) );
}
/**
@@ -1035,7 +1035,7 @@ class Tests_User extends WP_UnitTestCase {
$u = wp_insert_user(
array(
'user_login' => 'test',
- 'user_email' => 'test@example.com',
+ 'user_email' => 'urltest@example.com',
'user_pass' => 'password',
'user_url' => $user_url,
)
@@ -1083,7 +1083,7 @@ class Tests_User extends WP_UnitTestCase {
* @ticket 35750
*/
public function test_wp_update_user_should_delete_userslugs_cache() {
- $u = self::factory()->user->create();
+ $u = self::$sub_id;
$user = get_userdata( $u );
wp_update_user(
@@ -1256,7 +1256,7 @@ class Tests_User extends WP_UnitTestCase {
// Alter the case of the email address (which stays the same).
$userdata = array(
'ID' => self::$editor_id,
- 'user_email' => 'test@TEST.com',
+ 'user_email' => 'test@EXAMPLE.com',
);
$update = wp_update_user( $userdata );
@@ -1270,7 +1270,7 @@ class Tests_User extends WP_UnitTestCase {
// Change the email address.
$userdata = array(
'ID' => self::$editor_id,
- 'user_email' => 'test2@test.com',
+ 'user_email' => 'test2@example.com',
);
$update = wp_update_user( $userdata );
@@ -1279,7 +1279,7 @@ class Tests_User extends WP_UnitTestCase {
// Verify that the email address has been updated.
$user = get_userdata( self::$editor_id );
- $this->assertSame( $user->user_email, 'test2@test.com' );
+ $this->assertSame( $user->user_email, 'test2@example.com' );
}
/**
@@ -1939,11 +1939,7 @@ class Tests_User extends WP_UnitTestCase {
$_GET = array();
$_REQUEST = array();
- $administrator = self::factory()->user->create(
- array(
- 'role' => 'administrator',
- )
- );
+ $administrator = self::$admin_id;
wp_set_current_user( $administrator );
@@ -1957,11 +1953,7 @@ class Tests_User extends WP_UnitTestCase {
$this->assertSame( array( 'administrator' ), get_userdata( $administrator )->roles );
// Promote an editor to an administrator.
- $editor = self::factory()->user->create(
- array(
- 'role' => 'editor',
- )
- );
+ $editor = self::$editor_id;
$_POST['role'] = 'administrator';
$_POST['email'] = 'administrator@administrator.test';
@@ -1978,7 +1970,7 @@ class Tests_User extends WP_UnitTestCase {
* @ticket 43547
*/
public function test_wp_user_personal_data_exporter_no_user() {
- $actual = wp_user_personal_data_exporter( 'not-a-user-email@test.com' );
+ $actual = wp_user_personal_data_exporter( 'not-a-user-email@example.com' );
$expected = array(
'data' => array(),
diff --git a/tests/phpunit/tests/user/capabilities.php b/tests/phpunit/tests/user/capabilities.php
index 65942dca27..783dd18a4e 100644
--- a/tests/phpunit/tests/user/capabilities.php
+++ b/tests/phpunit/tests/user/capabilities.php
@@ -993,6 +993,29 @@ class Tests_User_Capabilities extends WP_UnitTestCase {
}
/**
+ * Test add_role with implied capabilities grant successfully grants capabilities.
+ *
+ * @ticket 43421
+ */
+ public function test_add_role_with_single_level_capabilities() {
+ $role_name = 'janitor';
+ add_role(
+ $role_name,
+ 'Janitor',
+ array(
+ 'foo',
+ )
+ );
+ $this->flush_roles();
+
+ // Assign a user to that role.
+ $id = self::factory()->user->create( array( 'role' => $role_name ) );
+ $user = new WP_User( $id );
+
+ $this->assertTrue( $user->has_cap( 'foo' ) );
+ }
+
+ /**
* Change the capabilities associated with a role and make sure the change
* is reflected in has_cap().
*/
diff --git a/tests/phpunit/tests/user/getTheAuthorPosts.php b/tests/phpunit/tests/user/getTheAuthorPosts.php
index 5cd87bc79b..3a0abac5de 100644
--- a/tests/phpunit/tests/user/getTheAuthorPosts.php
+++ b/tests/phpunit/tests/user/getTheAuthorPosts.php
@@ -42,7 +42,7 @@ class Tests_User_GetTheAuthorPosts extends WP_UnitTestCase {
// Test with no global post, result should be 0 because no author is found.
$this->assertSame( 0, get_the_author_posts() );
$GLOBALS['post'] = self::$post_id;
- $this->assertEquals( 1, get_the_author_posts() );
+ $this->assertSame( 1, get_the_author_posts() );
}
/**
@@ -60,7 +60,7 @@ class Tests_User_GetTheAuthorPosts extends WP_UnitTestCase {
);
$GLOBALS['post'] = $cpt_ids[0];
- $this->assertEquals( 2, get_the_author_posts() );
+ $this->assertSame( 2, get_the_author_posts() );
_unregister_post_type( 'wptests_pt' );
}
diff --git a/tests/phpunit/tests/xmlrpc/wp/getComments.php b/tests/phpunit/tests/xmlrpc/wp/getComments.php
index edeb6254f0..606f9e0e85 100644
--- a/tests/phpunit/tests/xmlrpc/wp/getComments.php
+++ b/tests/phpunit/tests/xmlrpc/wp/getComments.php
@@ -28,6 +28,7 @@ class Tests_XMLRPC_wp_getComments extends WP_XMLRPC_UnitTestCase {
$results = $this->myxmlrpcserver->wp_getComments( array( 1, 'editor', 'editor', array() ) );
$this->assertNotIXRError( $results );
+ $this->assertNotEmpty( $results );
foreach ( $results as $result ) {
$comment = get_comment( $result['comment_id'], ARRAY_A );
@@ -52,6 +53,7 @@ class Tests_XMLRPC_wp_getComments extends WP_XMLRPC_UnitTestCase {
)
);
$this->assertNotIXRError( $results );
+ $this->assertNotEmpty( $results );
foreach ( $results as $result ) {
$this->assertEquals( $this->post_id, $result['post_id'] );
diff --git a/tests/phpunit/tests/xmlrpc/wp/getPageList.php b/tests/phpunit/tests/xmlrpc/wp/getPageList.php
index 15d14b748f..abf936c799 100644
--- a/tests/phpunit/tests/xmlrpc/wp/getPageList.php
+++ b/tests/phpunit/tests/xmlrpc/wp/getPageList.php
@@ -41,6 +41,7 @@ class Tests_XMLRPC_wp_getPageList extends WP_XMLRPC_UnitTestCase {
$results = $this->myxmlrpcserver->wp_getPageList( array( 1, 'editor', 'editor' ) );
$this->assertNotIXRError( $results );
+ $this->assertNotEmpty( $results );
foreach ( $results as $result ) {
$page = get_post( $result->page_id );
diff --git a/tests/phpunit/tests/xmlrpc/wp/getPages.php b/tests/phpunit/tests/xmlrpc/wp/getPages.php
index eb99caf5c1..9e120c87cc 100644
--- a/tests/phpunit/tests/xmlrpc/wp/getPages.php
+++ b/tests/phpunit/tests/xmlrpc/wp/getPages.php
@@ -47,6 +47,7 @@ class Tests_XMLRPC_wp_getPages extends WP_XMLRPC_UnitTestCase {
public function test_capable_user() {
$results = $this->myxmlrpcserver->wp_getPages( array( 1, 'administrator', 'administrator' ) );
$this->assertNotIXRError( $results );
+ $this->assertNotEmpty( $results );
foreach ( $results as $result ) {
$page = get_post( $result['page_id'] );
diff --git a/tests/phpunit/tests/xmlrpc/wp/getPosts.php b/tests/phpunit/tests/xmlrpc/wp/getPosts.php
index 814f0c1018..1369aaaae2 100644
--- a/tests/phpunit/tests/xmlrpc/wp/getPosts.php
+++ b/tests/phpunit/tests/xmlrpc/wp/getPosts.php
@@ -100,6 +100,8 @@ class Tests_XMLRPC_wp_getPosts extends WP_XMLRPC_UnitTestCase {
);
$results2 = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter2 ) );
$this->assertNotIXRError( $results2 );
+ $this->assertNotEmpty( $results2 );
+
$last_comment_count = 100;
foreach ( $results2 as $post ) {
$comment_count = (int) get_comments_number( $post['post_id'] );
diff --git a/tests/phpunit/tests/xmlrpc/wp/getTerms.php b/tests/phpunit/tests/xmlrpc/wp/getTerms.php
index 3487c320da..d538a4efd2 100644
--- a/tests/phpunit/tests/xmlrpc/wp/getTerms.php
+++ b/tests/phpunit/tests/xmlrpc/wp/getTerms.php
@@ -46,6 +46,7 @@ class Tests_XMLRPC_wp_getTerms extends WP_XMLRPC_UnitTestCase {
$results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category' ) );
$this->assertNotIXRError( $results );
+ $this->assertNotEmpty( $results );
foreach ( $results as $term ) {
$this->assertIsInt( $term['count'] );
diff --git a/tests/phpunit/tests/xmlrpc/wp/getUsers.php b/tests/phpunit/tests/xmlrpc/wp/getUsers.php
index 0cf340c0d6..2c8c4ec245 100644
--- a/tests/phpunit/tests/xmlrpc/wp/getUsers.php
+++ b/tests/phpunit/tests/xmlrpc/wp/getUsers.php
@@ -117,6 +117,7 @@ class Tests_XMLRPC_wp_getUsers extends WP_XMLRPC_UnitTestCase {
);
$results = $this->myxmlrpcserver->wp_getUsers( array( 1, 'administrator', 'administrator', $filter ) );
$this->assertNotIXRError( $results );
+ $this->assertNotEmpty( $results );
$last_email = '';
foreach ( $results as $user ) {
diff --git a/tests/qunit/fixtures/wp-api-generated.js b/tests/qunit/fixtures/wp-api-generated.js
index ad54301d25..6626758a8a 100644
--- a/tests/qunit/fixtures/wp-api-generated.js
+++ b/tests/qunit/fixtures/wp-api-generated.js
@@ -6896,7 +6896,7 @@ mockedApiResponse.Schema = {
}
]
},
- "/wp/v2/global-styles/(?P<id>[\\/\\w-]+)": {
+ "/wp/v2/global-styles/(?P<id>[\\/\\d+]+)": {
"namespace": "wp/v2",
"methods": [
"GET",
@@ -6914,8 +6914,8 @@ mockedApiResponse.Schema = {
},
"args": {
"id": {
- "description": "The id of a template",
- "type": "string",
+ "description": "ID of global styles config.",
+ "type": "integer",
"required": false
}
}
@@ -10053,7 +10053,18 @@ mockedApiResponse.Schema = {
"app_id": {
"description": "A UUID provided by the application to uniquely identify it. It is recommended to use an UUID v5 with the URL or DNS namespace.",
"type": "string",
- "format": "uuid",
+ "oneOf": [
+ {
+ "type": "string",
+ "format": "uuid"
+ },
+ {
+ "type": "string",
+ "enum": [
+ ""
+ ]
+ }
+ ],
"required": false
},
"name": {
@@ -10137,7 +10148,18 @@ mockedApiResponse.Schema = {
"app_id": {
"description": "A UUID provided by the application to uniquely identify it. It is recommended to use an UUID v5 with the URL or DNS namespace.",
"type": "string",
- "format": "uuid",
+ "oneOf": [
+ {
+ "type": "string",
+ "format": "uuid"
+ },
+ {
+ "type": "string",
+ "enum": [
+ ""
+ ]
+ }
+ ],
"required": false
},
"name": {
diff --git a/tools/local-env/scripts/docker.js b/tools/local-env/scripts/docker.js
index c1dc2b27e1..e39b42a812 100644
--- a/tools/local-env/scripts/docker.js
+++ b/tools/local-env/scripts/docker.js
@@ -1,21 +1,36 @@
-const dotenv = require( 'dotenv' );
+/* jshint node:true */
+
+const dotenv = require( 'dotenv' );
const dotenvExpand = require( 'dotenv-expand' );
-const { execSync } = require( 'child_process' );
+const { spawnSync } = require( 'child_process' );
const local_env_utils = require( './utils' );
dotenvExpand.expand( dotenv.config() );
const composeFiles = local_env_utils.get_compose_files();
-if (process.argv.includes('--coverage-html')) {
+if ( process.argv.includes( '--coverage-html' ) ) {
process.env.LOCAL_PHP_XDEBUG = 'true';
process.env.LOCAL_PHP_XDEBUG_MODE = 'coverage';
}
-// This try-catch prevents the superfluous Node.js debugging information from being shown if the command fails.
-try {
- // Execute any Docker compose command passed to this script.
- execSync( 'docker compose ' + composeFiles + ' ' + process.argv.slice( 2 ).join( ' ' ), { stdio: 'inherit' } );
-} catch ( error ) {
- process.exit( 1 );
+// Add --no-TTY (-T) arg after exec and run commands when STDIN is not a TTY.
+const dockerCommand = process.argv.slice( 2 );
+if ( [ 'exec', 'run' ].includes( dockerCommand[0] ) && ! process.stdin.isTTY ) {
+ dockerCommand.splice( 1, 0, '--no-TTY' );
}
+
+// Execute any Docker compose command passed to this script.
+const returns = spawnSync(
+ 'docker',
+ [
+ 'compose',
+ ...composeFiles
+ .map( ( composeFile ) => [ '-f', composeFile ] )
+ .flat(),
+ ...dockerCommand,
+ ],
+ { stdio: 'inherit' }
+);
+
+process.exit( returns.status );
diff --git a/tools/local-env/scripts/install.js b/tools/local-env/scripts/install.js
index f205047a5a..19a0f46e08 100644
--- a/tools/local-env/scripts/install.js
+++ b/tools/local-env/scripts/install.js
@@ -1,9 +1,10 @@
+/* jshint node:true */
+
const dotenv = require( 'dotenv' );
const dotenvExpand = require( 'dotenv-expand' );
const wait_on = require( 'wait-on' );
const { execSync } = require( 'child_process' );
-const { renameSync, readFileSync, writeFileSync } = require( 'fs' );
-const { utils } = require( './utils.js' );
+const { readFileSync, writeFileSync } = require( 'fs' );
const local_env_utils = require( './utils' );
dotenvExpand.expand( dotenv.config() );
@@ -12,7 +13,10 @@ dotenvExpand.expand( dotenv.config() );
local_env_utils.determine_auth_option();
// Create wp-config.php.
-wp_cli( 'config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --force' );
+wp_cli( `config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --force --config-file="wp-config.php"` );
+
+// Since WP-CLI runs as root, the wp-config.php created above will be read-only. This needs to be writable for the sake of E2E tests.
+execSync( 'node ./tools/local-env/scripts/docker.js exec cli chmod 666 wp-config.php' );
// Add the debug settings to wp-config.php.
// Windows requires this to be done as an additional step, rather than using the --extra-php option in the previous step.
@@ -23,26 +27,35 @@ wp_cli( `config set SCRIPT_DEBUG ${process.env.LOCAL_SCRIPT_DEBUG} --raw --type=
wp_cli( `config set WP_ENVIRONMENT_TYPE ${process.env.LOCAL_WP_ENVIRONMENT_TYPE} --type=constant` );
wp_cli( `config set WP_DEVELOPMENT_MODE ${process.env.LOCAL_WP_DEVELOPMENT_MODE} --type=constant` );
-// Move wp-config.php to the base directory, so it doesn't get mixed up in the src or build directories.
-renameSync( `${process.env.LOCAL_DIR}/wp-config.php`, 'wp-config.php' );
-
// Read in wp-tests-config-sample.php, edit it to work with our config, then write it to wp-tests-config.php.
const testConfig = readFileSync( 'wp-tests-config-sample.php', 'utf8' )
.replace( 'youremptytestdbnamehere', 'wordpress_develop_tests' )
.replace( 'yourusernamehere', 'root' )
.replace( 'yourpasswordhere', 'password' )
.replace( 'localhost', 'mysql' )
- .replace( "'WP_TESTS_DOMAIN', 'example.org'", `'WP_TESTS_DOMAIN', '${process.env.LOCAL_WP_TESTS_DOMAIN}'` )
- .concat( "\ndefine( 'FS_METHOD', 'direct' );\n" );
+ .replace( `'WP_TESTS_DOMAIN', 'example.org'`, `'WP_TESTS_DOMAIN', '${process.env.LOCAL_WP_TESTS_DOMAIN}'` )
+ .concat( `\ndefine( 'FS_METHOD', 'direct' );\n` );
writeFileSync( 'wp-tests-config.php', testConfig );
// Once the site is available, install WordPress!
-wait_on( { resources: [ `tcp:localhost:${process.env.LOCAL_PORT}`] } )
+wait_on( {
+ resources: [ `tcp:localhost:${process.env.LOCAL_PORT}`],
+ timeout: 3000,
+} )
+ .catch( err => {
+ console.error( `Error: It appears the development environment has not been started. Message: ${ err.message }` );
+ console.error( `Did you forget to do 'npm run env:start'?` );
+ process.exit( 1 );
+ } )
.then( () => {
wp_cli( 'db reset --yes' );
const installCommand = process.env.LOCAL_MULTISITE === 'true' ? 'multisite-install' : 'install';
- wp_cli( `core ${ installCommand } --title="WordPress Develop" --admin_user=admin --admin_password=password --admin_email=test@test.com --skip-email --url=http://localhost:${process.env.LOCAL_PORT}` );
+ wp_cli( `core ${ installCommand } --title="WordPress Develop" --admin_user=admin --admin_password=password --admin_email=test@example.com --skip-email --url=http://localhost:${process.env.LOCAL_PORT}` );
+ } )
+ .catch( err => {
+ console.error( `Error: Unable to reset DB and install WordPress. Message: ${ err.message }` );
+ process.exit( 1 );
} );
/**
@@ -51,7 +64,5 @@ wait_on( { resources: [ `tcp:localhost:${process.env.LOCAL_PORT}`] } )
* @param {string} cmd The WP-CLI command to run.
*/
function wp_cli( cmd ) {
- const composeFiles = local_env_utils.get_compose_files();
-
- execSync( `docker compose ${composeFiles} run --quiet-pull --rm cli ${cmd} --path=/var/www/${process.env.LOCAL_DIR}`, { stdio: 'inherit' } );
+ execSync( `npm --silent run env:cli -- ${cmd} --path=/var/www/${process.env.LOCAL_DIR}`, { stdio: 'inherit' } );
}
diff --git a/tools/local-env/scripts/start.js b/tools/local-env/scripts/start.js
index 0dc8b95700..b0389b2fb0 100644
--- a/tools/local-env/scripts/start.js
+++ b/tools/local-env/scripts/start.js
@@ -1,11 +1,13 @@
+/* jshint node:true */
+
const dotenv = require( 'dotenv' );
const dotenvExpand = require( 'dotenv-expand' );
-const { execSync } = require( 'child_process' );
+const { execSync, spawnSync } = require( 'child_process' );
const local_env_utils = require( './utils' );
const { constants, copyFile } = require( 'node:fs' );
// Copy the default .env file when one is not present.
-copyFile( '.env.example', '.env', constants.COPYFILE_EXCL, (e) => {
+copyFile( '.env.example', '.env', constants.COPYFILE_EXCL, () => {
console.log( '.env file already exists. .env.example was not copied.' );
});
@@ -28,18 +30,38 @@ try {
}
// Start the local-env containers.
-const containers = ( process.env.LOCAL_PHP_MEMCACHED === 'true' )
- ? 'wordpress-develop memcached'
- : 'wordpress-develop';
-execSync( `docker compose ${composeFiles} up --quiet-pull -d ${containers}`, { stdio: 'inherit' } );
+const containers = [ 'wordpress-develop', 'cli' ];
+if ( process.env.LOCAL_PHP_MEMCACHED === 'true' ) {
+ containers.push( 'memcached' );
+}
+
+spawnSync(
+ 'docker',
+ [
+ 'compose',
+ ...composeFiles.map( ( composeFile ) => [ '-f', composeFile ] ).flat(),
+ 'up',
+ '--quiet-pull',
+ '-d',
+ ...containers,
+ ],
+ { stdio: 'inherit' }
+);
// If Docker Toolbox is being used, we need to manually forward LOCAL_PORT to the Docker VM.
if ( process.env.DOCKER_TOOLBOX_INSTALL_PATH ) {
// VBoxManage is added to the PATH on every platform except Windows.
- const vboxmanage = process.env.VBOX_MSI_INSTALL_PATH ? `${ process.env.VBOX_MSI_INSTALL_PATH }/VBoxManage` : 'VBoxManage'
+ const vboxmanage = process.env.VBOX_MSI_INSTALL_PATH ? `${ process.env.VBOX_MSI_INSTALL_PATH }/VBoxManage` : 'VBoxManage';
// Check if the port forwarding is already configured for this port.
- const vminfoBuffer = execSync( `"${ vboxmanage }" showvminfo "${ process.env.DOCKER_MACHINE_NAME }" --machinereadable` );
+ const vminfoBuffer = spawnSync(
+ vboxmanage,
+ [
+ 'showvminfo',
+ process.env.DOCKER_MACHINE_NAME,
+ '--machinereadable'
+ ]
+ ).stdout;
const vminfo = vminfoBuffer.toString().split( /[\r\n]+/ );
vminfo.forEach( ( info ) => {
@@ -53,10 +75,29 @@ if ( process.env.DOCKER_TOOLBOX_INSTALL_PATH ) {
// Delete rules that are using the port we need.
if ( rule[ 3 ] === process.env.LOCAL_PORT || rule[ 5 ] === process.env.LOCAL_PORT ) {
- execSync( `"${ vboxmanage }" controlvm "${ process.env.DOCKER_MACHINE_NAME }" natpf1 delete ${ rule[ 0 ] }`, { stdio: 'inherit' } );
+ spawnSync(
+ vboxmanage,
+ [
+ 'controlvm',
+ process.env.DOCKER_MACHINE_NAME,
+ 'natpf1',
+ 'delete',
+ rule[ 0 ]
+ ],
+ { stdio: 'inherit' }
+ );
}
} );
// Add our port forwarding rule.
- execSync( `"${ vboxmanage }" controlvm "${ process.env.DOCKER_MACHINE_NAME }" natpf1 "tcp-port${ process.env.LOCAL_PORT },tcp,127.0.0.1,${ process.env.LOCAL_PORT },,${ process.env.LOCAL_PORT }"`, { stdio: 'inherit' } );
+ spawnSync(
+ vboxmanage,
+ [
+ 'controlvm',
+ process.env.DOCKER_MACHINE_NAME,
+ 'natpf1',
+ `tcp-port${ process.env.LOCAL_PORT },tcp,127.0.0.1,${ process.env.LOCAL_PORT },,${ process.env.LOCAL_PORT }`
+ ],
+ { stdio: 'inherit' }
+ );
}
diff --git a/tools/local-env/scripts/utils.js b/tools/local-env/scripts/utils.js
index d76f3068a5..3f3e601db2 100644
--- a/tools/local-env/scripts/utils.js
+++ b/tools/local-env/scripts/utils.js
@@ -1,3 +1,5 @@
+/* jshint node:true */
+
const { existsSync } = require( 'node:fs' );
const local_env_utils = {
@@ -10,12 +12,14 @@ const local_env_utils = {
*
* When PHP 7.2 or 7.3 is used in combination with MySQL 8.4, an override file will also be returned to ensure
* that the mysql_native_password plugin authentication plugin is on and available for use.
+ *
+ * @return {string[]} Compose files.
*/
get_compose_files: function() {
- var composeFiles = '-f docker-compose.yml';
+ const composeFiles = [ 'docker-compose.yml' ];
if ( existsSync( 'docker-compose.override.yml' ) ) {
- composeFiles = composeFiles + ' -f docker-compose.override.yml';
+ composeFiles.push( 'docker-compose.override.yml' );
}
if ( process.env.LOCAL_DB_TYPE !== 'mysql' ) {
@@ -28,7 +32,7 @@ const local_env_utils = {
// PHP 7.2/7.3 in combination with MySQL 8.4 requires additional configuration to function properly.
if ( process.env.LOCAL_DB_VERSION === '8.4' ) {
- composeFiles = composeFiles + ' -f tools/local-env/old-php-mysql-84.override.yml';
+ composeFiles.push( 'tools/local-env/old-php-mysql-84.override.yml' );
}
return composeFiles;