diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml
index 6a249a93..06744200 100755
--- a/.github/workflows/coding-standards.yml
+++ b/.github/workflows/coding-standards.yml
@@ -48,13 +48,13 @@ jobs:
# Performs the following steps:
# - Checks out the repository.
# - Sets up PHP.
- # - Logs debug information.
# - Configures caching for PHPCS scans.
- # - Installs Composer dependencies (use cache if possible).
+ # - Installs Composer dependencies.
# - Make Composer packages available globally.
- # - Logs PHP_CodeSniffer debug information.
# - Runs PHPCS on the full codebase with warnings suppressed.
+ # - Generate a report for displaying issues as pull request annotations.
# - Runs PHPCS on the `tests` directory without warnings suppressed.
+ # - Generate a report for displaying `test` directory issues as pull request annotations.
# - Ensures version-controlled files are not modified or deleted.
phpcs:
name: PHP coding standards
@@ -71,12 +71,7 @@ jobs:
with:
php-version: '7.4'
coverage: none
- tools: composer, cs2pr
-
- - name: Log debug information
- run: |
- php --version
- composer --version
+ tools: cs2pr
# This date is used to ensure that the PHPCS cache is cleared at least once every week.
# http://man7.org/linux/man-pages/man1/date.1.html
@@ -90,17 +85,16 @@ jobs:
path: .cache/phpcs.json
key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcs-cache-${{ hashFiles('**/composer.json', 'phpcs.xml.dist') }}
+ # Since Composer dependencies are installed using `composer update` and no lock file is in version control,
+ # passing a custom cache suffix ensures that the cache is flushed at least once per week.
- name: Install Composer dependencies
uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
with:
- composer-options: "--no-progress --no-ansi"
+ custom-cache-suffix: ${{ steps.get-date.outputs.date }}
- name: Make Composer packages available globally
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
- - name: Log PHPCS debug information
- run: phpcs -i
-
- name: Run PHPCS on all Core files
id: phpcs-core
run: phpcs -n --report-full --report-checkstyle=./.cache/phpcs-report.xml
@@ -126,10 +120,9 @@ jobs:
#
# Performs the following steps:
# - Checks out the repository.
+ # - Sets up Node.js.
# - Logs debug information about the GitHub Action runner.
- # - Installs Node.js.
- # - Logs updated debug information.
- # _ Installs npm dependencies.
+ # - Installs npm dependencies.
# - Run the WordPress JSHint checks.
# - Ensures version-controlled files are not modified or deleted.
jshint:
@@ -144,14 +137,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- - name: Log debug information
- run: |
- npm --version
- node --version
- git --version
- svn --version
-
- - name: Install Node.js
+ - name: Set up Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
@@ -161,8 +147,10 @@ jobs:
run: |
npm --version
node --version
+ git --version
+ svn --version
- - name: Install Dependencies
+ - name: Install npm Dependencies
run: npm ci
- name: Run JSHint
diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml
index 1d642ff4..661ec67d 100755
--- a/.github/workflows/end-to-end-tests.yml
+++ b/.github/workflows/end-to-end-tests.yml
@@ -35,12 +35,11 @@ jobs:
# Performs the following steps:
# - Sets environment variables.
# - Checks out the repository.
+ # - Sets up Node.js.
# - Logs debug information about the GitHub Action runner.
- # - Installs Node.js.
- # _ Installs npm dependencies.
+ # - Installs npm dependencies.
# - Builds WordPress to run from the `build` directory.
# - Starts the WordPress Docker container.
- # - Logs general debug information.
# - Logs the running Docker containers.
# - Logs Docker debug information (about both the Docker installation within the runner and the WordPress container).
# - Install WordPress within the Docker container.
@@ -61,6 +60,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
+ - name: Set up Node.js
+ uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
+ with:
+ node-version-file: '.nvmrc'
+ cache: npm
+
- name: Log debug information
run: |
npm --version
@@ -68,17 +73,9 @@ jobs:
curl --version
git --version
svn --version
- php --version
- php -i
locale -a
- - name: Install Node.js
- uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
- with:
- node-version-file: '.nvmrc'
- cache: npm
-
- - name: Install Dependencies
+ - name: Install npm Dependencies
run: npm ci
- name: Build WordPress
@@ -88,14 +85,6 @@ jobs:
run: |
npm run env:start
- - name: General debug information
- run: |
- npm --version
- node --version
- curl --version
- git --version
- svn --version
-
- name: Log running Docker containers
run: docker ps -a
diff --git a/.github/workflows/javascript-tests.yml b/.github/workflows/javascript-tests.yml
index 2eeeb9a8..a64dc43c 100755
--- a/.github/workflows/javascript-tests.yml
+++ b/.github/workflows/javascript-tests.yml
@@ -43,10 +43,9 @@ jobs:
#
# Performs the following steps:
# - Checks out the repository.
+ # - Sets up Node.js.
# - Logs debug information about the GitHub Action runner.
- # - Installs Node.js.
- # - Logs updated debug information.
- # _ Installs npm dependencies.
+ # - Installs npm dependencies.
# - Run the WordPress QUnit tests.
# - Ensures version-controlled files are not modified or deleted.
test-js:
@@ -59,14 +58,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- - name: Log debug information
- run: |
- npm --version
- node --version
- git --version
- svn --version
-
- - name: Install Node.js
+ - name: Set up Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
@@ -76,8 +68,10 @@ jobs:
run: |
npm --version
node --version
+ git --version
+ svn --version
- - name: Install Dependencies
+ - name: Install npm Dependencies
run: npm ci
- name: Run QUnit tests
diff --git a/.github/workflows/php-compatibility.yml b/.github/workflows/php-compatibility.yml
index 411da95d..fce29378 100755
--- a/.github/workflows/php-compatibility.yml
+++ b/.github/workflows/php-compatibility.yml
@@ -46,10 +46,10 @@ jobs:
# - Sets up PHP.
# - Logs debug information.
# - Configures caching for PHP compatibility scans.
- # - Installs Composer dependencies (use cache if possible).
+ # - Installs Composer dependencies.
# - Make Composer packages available globally.
- # - Logs PHP_CodeSniffer debug information.
# - Runs the PHP compatibility tests.
+ # - Generate a report for displaying issues as pull request annotations.
# - Ensures version-controlled files are not modified or deleted.
php-compatibility:
name: Check PHP compatibility
@@ -66,11 +66,10 @@ jobs:
with:
php-version: '7.4'
coverage: none
- tools: composer, cs2pr
+ tools: cs2pr
- name: Log debug information
run: |
- php --version
composer --version
# This date is used to ensure that the PHP compatibility cache is cleared at least once every week.
@@ -85,17 +84,16 @@ jobs:
path: .cache/phpcompat.json
key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcompat-cache-${{ hashFiles('**/composer.json', 'phpcompat.xml.dist') }}
+ # Since Composer dependencies are installed using `composer update` and no lock file is in version control,
+ # passing a custom cache suffix ensures that the cache is flushed at least once per week.
- name: Install Composer dependencies
uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
with:
- composer-options: "--no-progress --no-ansi"
+ custom-cache-suffix: ${{ steps.get-date.outputs.date }}
- name: Make Composer packages available globally
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
- - name: Log PHPCS debug information
- run: phpcs -i
-
- name: Run PHP compatibility tests
id: phpcs
run: phpcs --standard=phpcompat.xml.dist --report-full --report-checkstyle=./.cache/phpcs-compat-report.xml
diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml
index c2276ca0..92ca0766 100755
--- a/.github/workflows/phpunit-tests.yml
+++ b/.github/workflows/phpunit-tests.yml
@@ -36,22 +36,20 @@ jobs:
#
# Performs the following steps:
# - Sets environment variables.
- # - Sets up the environment variables needed for testing with memcached (if desired).
- # - Installs Node.js.
- # - Installs npm dependencies
- # - Configures caching for Composer.
+ # - Checks out the repository.
+ # - Sets up Node.js.
+ # - Sets up PHP.
# - Installs Composer dependencies.
+ # - Installs npm dependencies
+ # - Logs general debug information about the runner.
# - Logs Docker debug information (about the Docker installation within the runner).
# - Starts the WordPress Docker container.
- # - Logs general debug information about the runner.
# - Logs the running Docker containers.
- # - Logs debug information from inside the WordPress Docker container.
# - Logs debug information about what's installed within the WordPress Docker containers.
# - Install WordPress within the Docker container.
# - Run the PHPUnit tests.
# - Ensures version-controlled files are not modified or deleted.
# - Checks out the WordPress Test reporter repository.
- # - Reconnect the directory to the Git repository.
# - Submit the test results to the WordPress.org host test results.
test-php:
name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
@@ -108,43 +106,44 @@ jobs:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- - name: Install Node.js
+ - name: Set up Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
cache: npm
- - name: Install Dependencies
- run: npm ci
-
- # This date is used to ensure that the Composer cache is refreshed at least once every week.
- # http://man7.org/linux/man-pages/man1/date.1.html
- - name: "Get last Monday's date"
- id: get-date
- run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT
-
- - name: Get Composer cache directory
- id: composer-cache
- run: echo "composer_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
-
- - name: Cache Composer dependencies
- uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.11
- env:
- cache-name: cache-composer-dependencies
+ ##
+ # This allows Composer dependencies to be installed using a single step.
+ #
+ # Since the tests are currently run within the Docker containers where the PHP version varies,
+ # the same PHP version needs to be configured for the action runner machine so that the correct
+ # dependency versions are installed and cached.
+ ##
+ - name: Set up PHP
+ uses: shivammathur/setup-php@1a18b2267f80291a81ca1d33e7c851fe09e7dfc4 # v2.22.0
with:
- path: ${{ steps.composer-cache.outputs.composer_dir }}
- key: ${{ runner.os }}-php-${{ matrix.php }}-date-${{ steps.get-date.outputs.date }}-composer-${{ hashFiles('**/composer.json') }}
+ php-version: '${{ matrix.php }}'
+ coverage: none
+ # Since Composer dependencies are installed using `composer update` and no lock file is in version control,
+ # passing a custom cache suffix ensures that the cache is flushed at least once per week.
- name: Install Composer dependencies
- run: |
- docker-compose run --rm php composer --version
+ uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
+ with:
+ custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F")
- # Install using `composer update` as there is no `composer.lock` file.
- if [ ${{ env.LOCAL_PHP }} == '8.2-fpm' ]; then
- docker-compose run --rm php composer update --ignore-platform-req=php+
- else
- docker-compose run --rm php composer update
- fi
+ - name: Install npm dependencies
+ run: npm ci
+
+ - name: General debug information
+ run: |
+ npm --version
+ node --version
+ curl --version
+ git --version
+ svn --version
+ composer --version
+ locale -a
- name: Docker debug information
run: |
@@ -155,14 +154,6 @@ jobs:
run: |
npm run env:start
- - name: General debug information
- run: |
- npm --version
- node --version
- curl --version
- git --version
- svn --version
-
- name: Log running Docker containers
run: docker ps -a
diff --git a/.github/workflows/test-and-zip-default-themes.yml b/.github/workflows/test-and-zip-default-themes.yml
index 9c6cb3a6..f24efb45 100755
--- a/.github/workflows/test-and-zip-default-themes.yml
+++ b/.github/workflows/test-and-zip-default-themes.yml
@@ -49,9 +49,9 @@ jobs:
#
# Performs the following steps:
# - Checks out the repository.
- # - Installs Node.js (only when theme has a build process)
- # - Installs npm dependencies (only when theme has a build process)
- # - Runs the theme build script (only when theme has a build process)
+ # - Sets up Node.js.
+ # - Installs npm dependencies.
+ # - Runs the theme build script.
# - Ensures version-controlled files are not modified or deleted.
test-build-scripts:
name: Test ${{ matrix.theme }} build script
@@ -77,7 +77,7 @@ jobs:
with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.branch || github.ref }}
- - name: Install Node.js
+ - name: Set up Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
diff --git a/.github/workflows/test-coverage.yml b/.github/workflows/test-coverage.yml
index f91647ba..e07a7560 100755
--- a/.github/workflows/test-coverage.yml
+++ b/.github/workflows/test-coverage.yml
@@ -32,26 +32,25 @@ env:
LOCAL_PHP_MEMCACHED: ${{ false }}
jobs:
- # Sets up WordPress for testing or development use.
+ # Runs the PHPUnit tests for WordPress.
#
# Performs the following steps:
# - Sets environment variables.
# - Checks out the repository.
- # - Checks out the WordPress Importer plugin (needed for the Core PHPUnit tests).
- # - Logs debug information about the GitHub Action runner.
- # - Installs Node.js.
- # _ Installs npm dependencies.
+ # - Sets up Node.js.
+ # - Sets up PHP.
+ # - Installs Composer dependencies.
+ # - Installs npm dependencies
+ # - Logs general debug information about the runner.
# - Logs Docker debug information (about the Docker installation within the runner).
# - Starts the WordPress Docker container.
- # - Logs debug general information.
# - Logs the running Docker containers.
- # - Logs WordPress Docker container debug information.
# - Logs debug information about what's installed within the WordPress Docker containers.
# - Install WordPress within the Docker container.
# - Run the PHPUnit tests as a single site.
# - Ensures version-controlled files are not modified or deleted.
# - Upload the single site code coverage report to Codecov.io.
- # - Run the PHPUnit tests as a multisite.
+ # - Run the PHPUnit tests as a multisite installation.
# - Ensures version-controlled files are not modified or deleted.
# - Upload the multisite code coverage report to Codecov.io.
test-coverage-report:
@@ -73,6 +72,35 @@ jobs:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
+ - name: Set up Node.js
+ uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
+ with:
+ node-version-file: '.nvmrc'
+ cache: npm
+
+ ##
+ # This allows Composer dependencies to be installed using a single step.
+ #
+ # Since the tests are currently run within the Docker containers where the PHP version varies,
+ # the same PHP version needs to be configured for the action runner machine so that the correct
+ # dependency versions are installed and cached.
+ ##
+ - name: Set up PHP
+ uses: shivammathur/setup-php@1a18b2267f80291a81ca1d33e7c851fe09e7dfc4 # v2.22.0
+ with:
+ php-version: '7.4'
+ coverage: none
+
+ # Since Composer dependencies are installed using `composer update` and no lock file is in version control,
+ # passing a custom cache suffix ensures that the cache is flushed at least once per week.
+ - name: Install Composer dependencies
+ uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
+ with:
+ custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F")
+
+ - name: Install npm Dependencies
+ run: npm ci
+
- name: Log debug information
run: |
echo "$GITHUB_REF"
@@ -82,44 +110,9 @@ jobs:
curl --version
git --version
svn --version
- php --version
- php -i
+ composer --version
locale -a
- - name: Install Node.js
- uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
- with:
- node-version-file: '.nvmrc'
- cache: npm
-
- - name: Install Dependencies
- run: npm ci
-
- # This date is used to ensure that the Composer cache is refreshed at least once every week.
- # http://man7.org/linux/man-pages/man1/date.1.html
- - name: "Get last Monday's date"
- id: get-date
- run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT
-
- - name: Get Composer cache directory
- id: composer-cache
- run: echo "composer_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
-
- - name: Cache Composer dependencies
- uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.11
- env:
- cache-name: cache-composer-dependencies
- with:
- path: ${{ steps.composer-cache.outputs.composer_dir }}
- key: ${{ runner.os }}-php-${{ matrix.php }}-date-${{ steps.get-date.outputs.date }}-composer-${{ hashFiles('**/composer.json') }}
-
- - name: Install Composer dependencies
- run: |
- docker-compose run --rm php composer --version
-
- # Install using `composer update` as there is no `composer.lock` file.
- docker-compose run --rm php composer update
-
- name: Docker debug information
run: |
docker -v
@@ -129,14 +122,6 @@ jobs:
run: |
npm run env:start
- - name: General debug information
- run: |
- npm --version
- node --version
- curl --version
- git --version
- svn --version
-
- name: Log running Docker containers
run: docker ps -a
diff --git a/.github/workflows/test-npm.yml b/.github/workflows/test-npm.yml
index 7f38dd77..59b8adca 100755
--- a/.github/workflows/test-npm.yml
+++ b/.github/workflows/test-npm.yml
@@ -41,9 +41,9 @@ jobs:
#
# Performs the following steps:
# - Checks out the repository.
+ # - Sets up Node.js.
# - Logs debug information about the GitHub Action runner.
- # - Installs Node.js.
- # _ Installs npm dependencies.
+ # - Installs npm dependencies.
# - Builds WordPress to run from the `build` directory.
# - Cleans up after building WordPress to the `build` directory.
# - Ensures version-controlled files are not modified or deleted.
@@ -64,6 +64,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
+ - name: Set up Node.js
+ uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
+ with:
+ node-version-file: '.nvmrc'
+ cache: npm
+
- name: Log debug information
run: |
npm --version
@@ -72,13 +78,7 @@ jobs:
git --version
svn --version
- - name: Install Node.js
- uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
- with:
- node-version-file: '.nvmrc'
- cache: npm
-
- - name: Install Dependencies
+ - name: Install npm Dependencies
run: npm ci
- name: Build WordPress in /src
@@ -104,11 +104,15 @@ jobs:
# This is separate from the job above in order to use stricter conditions about when to run.
# This avoids unintentionally consuming excessive minutes, as MacOS jobs consume minutes at a 10x rate.
#
+ # The `matrix` and `runner` contexts are not available for use within `if` expressions. So there is
+ # currently no way to determine the OS being used on a given job.
+ # See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability.
+ #
# Performs the following steps:
# - Checks out the repository.
+ # - Sets up Node.js.
# - Logs debug information about the GitHub Action runner.
- # - Installs Node.js.
- # _ Installs npm dependencies.
+ # - Installs npm dependencies.
# - Builds WordPress to run from the `build` directory.
# - Cleans up after building WordPress to the `build` directory.
# - Ensures version-controlled files are not modified or deleted.
@@ -124,6 +128,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
+ - name: Set up Node.js
+ uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
+ with:
+ node-version-file: '.nvmrc'
+ cache: npm
+
- name: Log debug information
run: |
npm --version
@@ -132,13 +142,7 @@ jobs:
git --version
svn --version
- - name: Install Node.js
- uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
- with:
- node-version-file: '.nvmrc'
- cache: npm
-
- - name: Install Dependencies
+ - name: Install npm Dependencies
run: npm ci
- name: Build WordPress in /src
diff --git a/src/js/_enqueues/lib/nav-menu.js b/src/js/_enqueues/lib/nav-menu.js
index 10b1330a..9877f782 100755
--- a/src/js/_enqueues/lib/nav-menu.js
+++ b/src/js/_enqueues/lib/nav-menu.js
@@ -1557,14 +1557,14 @@
});
});
- // Show bulk action
+ // Show bulk action.
$( document ).on( 'menu-item-added', function() {
if ( ! $( '.bulk-actions' ).is( ':visible' ) ) {
$( '.bulk-actions' ).show();
}
} );
- // Hide bulk action
+ // Hide bulk action.
$( document ).on( 'menu-removing-item', function( e, el ) {
var menuElement = $( el ).parents( '#menu-to-edit' );
if ( menuElement.find( 'li' ).length === 1 && $( '.bulk-actions' ).is( ':visible' ) ) {
diff --git a/src/wp-admin/css/list-tables.css b/src/wp-admin/css/list-tables.css
index 440d2a53..00a6d8c4 100755
--- a/src/wp-admin/css/list-tables.css
+++ b/src/wp-admin/css/list-tables.css
@@ -1636,6 +1636,7 @@ div.action-links,
font-style: normal;
margin: 0;
padding: 100px 0 0;
+ width: 100%;
text-align: center;
}
diff --git a/src/wp-admin/includes/class-wp-site-health-auto-updates.php b/src/wp-admin/includes/class-wp-site-health-auto-updates.php
index f6fb7d79..e3c02d06 100755
--- a/src/wp-admin/includes/class-wp-site-health-auto-updates.php
+++ b/src/wp-admin/includes/class-wp-site-health-auto-updates.php
@@ -277,7 +277,7 @@ public function test_vcs_abspath() {
public function test_check_wp_filesystem_method() {
// Make sure the `request_filesystem_credentials()` function is available during our REST API call.
if ( ! function_exists( 'request_filesystem_credentials' ) ) {
- require_once ABSPATH . '/wp-admin/includes/file.php';
+ require_once ABSPATH . 'wp-admin/includes/file.php';
}
$skin = new Automatic_Upgrader_Skin;
@@ -328,7 +328,7 @@ public function test_all_files_writable() {
// Make sure the `get_core_checksums()` function is available during our REST API call.
if ( ! function_exists( 'get_core_checksums' ) ) {
- require_once ABSPATH . '/wp-admin/includes/update.php';
+ require_once ABSPATH . 'wp-admin/includes/update.php';
}
$checksums = get_core_checksums( $wp_version, 'en_US' );
diff --git a/src/wp-admin/includes/class-wp-site-health.php b/src/wp-admin/includes/class-wp-site-health.php
index abe0fc61..4300abd8 100755
--- a/src/wp-admin/includes/class-wp-site-health.php
+++ b/src/wp-admin/includes/class-wp-site-health.php
@@ -65,7 +65,7 @@ public function __construct() {
*/
public function show_site_health_tab( $tab ) {
if ( 'debug' === $tab ) {
- require_once ABSPATH . '/wp-admin/site-health-info.php';
+ require_once ABSPATH . 'wp-admin/site-health-info.php';
}
}
diff --git a/src/wp-admin/includes/class-wp-upgrader.php b/src/wp-admin/includes/class-wp-upgrader.php
index a2b2c9ed..88c6d5d6 100755
--- a/src/wp-admin/includes/class-wp-upgrader.php
+++ b/src/wp-admin/includes/class-wp-upgrader.php
@@ -911,6 +911,8 @@ public function maintenance_mode( $enable = false ) {
*
* @since 4.5.0
*
+ * @global wpdb $wpdb The WordPress database abstraction object.
+ *
* @param string $lock_name The name of this unique lock.
* @param int $release_timeout Optional. The duration in seconds to respect an existing lock.
* Default: 1 hour.
diff --git a/src/wp-admin/includes/export.php b/src/wp-admin/includes/export.php
index 1c7694f0..ac673ec5 100755
--- a/src/wp-admin/includes/export.php
+++ b/src/wp-admin/includes/export.php
@@ -519,7 +519,8 @@ function wxr_filter_postmeta( $return_me, $meta_key ) {
" />
@@ -2442,7 +2443,7 @@ function request_filesystem_credentials( $form_post, $type = '', $error = false,
// Make sure the `submit_button()` function is available during the REST API call
// from WP_Site_Health_Auto_Updates::test_check_wp_filesystem_method().
if ( ! function_exists( 'submit_button' ) ) {
- require_once ABSPATH . '/wp-admin/includes/template.php';
+ require_once ABSPATH . 'wp-admin/includes/template.php';
}
?>
diff --git a/src/wp-admin/includes/ms.php b/src/wp-admin/includes/ms.php
index 741d02e9..8b98c229 100755
--- a/src/wp-admin/includes/ms.php
+++ b/src/wp-admin/includes/ms.php
@@ -8,7 +8,7 @@
*/
/**
- * Determine if uploaded file exceeds space quota.
+ * Determines whether uploaded file exceeds space quota.
*
* @since 3.0.0
*
@@ -53,7 +53,7 @@ function check_upload_size( $file ) {
}
/**
- * Delete a site.
+ * Deletes a site.
*
* @since 3.0.0
* @since 5.1.0 Use wp_delete_site() internally to delete the site row from the database.
@@ -130,7 +130,7 @@ function wpmu_delete_blog( $blog_id, $drop = false ) {
}
/**
- * Delete a user from the network and remove from all sites.
+ * Deletes a user from the network and remove from all sites.
*
* @since 3.0.0
*
@@ -139,7 +139,7 @@ function wpmu_delete_blog( $blog_id, $drop = false ) {
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param int $id The user ID.
- * @return bool True if the user was deleted, otherwise false.
+ * @return bool True if the user was deleted, false otherwise.
*/
function wpmu_delete_user( $id ) {
global $wpdb;
@@ -213,7 +213,7 @@ function wpmu_delete_user( $id ) {
}
/**
- * Check whether a site has used its allotted upload space.
+ * Checks whether a site has used its allotted upload space.
*
* @since MU (3.0.0)
*
@@ -269,12 +269,12 @@ function display_space_usage() {
}
/**
- * Get the remaining upload space for this site.
+ * Gets the remaining upload space for this site.
*
* @since MU (3.0.0)
*
- * @param int $size Current max size in bytes
- * @return int Max size in bytes
+ * @param int $size Current max size in bytes.
+ * @return int Max size in bytes.
*/
function fix_import_form_size( $size ) {
if ( upload_is_user_over_quota( false ) ) {
@@ -783,7 +783,7 @@ function choose_primary_blog() {
update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id );
}
} else {
- echo 'N/A';
+ _e( 'Not available' );
}
?>
@@ -793,7 +793,7 @@ function choose_primary_blog() {
}
/**
- * Whether or not we can edit this network from this page.
+ * Determines whether or not this network from this page can be edited.
*
* By default editing of network is restricted to the Network Admin for that `$network_id`.
* This function allows for this to be overridden.
@@ -801,7 +801,7 @@ function choose_primary_blog() {
* @since 3.1.0
*
* @param int $network_id The network ID to check.
- * @return bool True if network can be edited, otherwise false.
+ * @return bool True if network can be edited, false otherwise.
*/
function can_edit_network( $network_id ) {
if ( get_current_network_id() === (int) $network_id ) {
@@ -822,7 +822,7 @@ function can_edit_network( $network_id ) {
}
/**
- * Thickbox image paths for Network Admin.
+ * Prints thickbox image paths for Network Admin.
*
* @since 3.1.0
*
@@ -981,7 +981,7 @@ function confirm_delete_users( $users ) {
}
/**
- * Print JavaScript in the header on the Network Settings screen.
+ * Prints JavaScript in the header on the Network Settings screen.
*
* @since 4.1.0
*/
diff --git a/src/wp-admin/includes/nav-menu.php b/src/wp-admin/includes/nav-menu.php
index ad8b04cf..0e09d311 100755
--- a/src/wp-admin/includes/nav-menu.php
+++ b/src/wp-admin/includes/nav-menu.php
@@ -524,7 +524,7 @@ function wp_nav_menu_item_post_type_meta_box( $data_object, $box ) {
-
+
diff --git a/src/wp-admin/includes/update-core.php b/src/wp-admin/includes/update-core.php
index 9aa6ba40..e8c234d7 100755
--- a/src/wp-admin/includes/update-core.php
+++ b/src/wp-admin/includes/update-core.php
@@ -10,6 +10,8 @@
/**
* Stores files to be deleted.
*
+ * Bundled theme files should not be included in this list.
+ *
* @since 2.7.0
*
* @global array $_old_files
@@ -592,8 +594,8 @@ function update_core( $from, $to ) {
// Deactivate the REST API plugin if its version is 2.0 Beta 4 or lower.
_upgrade_440_force_deactivate_incompatible_plugins();
- // Deactivate the Gutenberg plugin if its version is 11.8 or lower.
- _upgrade_590_force_deactivate_incompatible_plugins();
+ // Deactivate incompatible plugins.
+ _upgrade_core_deactivate_incompatible_plugins();
// Upgrade DB with separate request.
/** This filter is documented in wp-admin/includes/update-core.php */
@@ -792,14 +794,16 @@ function _upgrade_440_force_deactivate_incompatible_plugins() {
/**
* @access private
* @ignore
- * @since 5.9.0
+ * @since 5.8.0
+ * @since 5.9.0 The minimum compatible version of Gutenberg is 11.9.
+ * @since 6.1.1 The minimum compatible version of Gutenberg is 14.1.
*/
-function _upgrade_590_force_deactivate_incompatible_plugins() {
- if ( defined( 'GUTENBERG_VERSION' ) && version_compare( GUTENBERG_VERSION, '11.9', '<' ) ) {
+function _upgrade_core_deactivate_incompatible_plugins() {
+ if ( defined( 'GUTENBERG_VERSION' ) && version_compare( GUTENBERG_VERSION, '14.1', '<' ) ) {
$deactivated_gutenberg['gutenberg'] = array(
'plugin_name' => 'Gutenberg',
'version_deactivated' => GUTENBERG_VERSION,
- 'version_compatible' => '11.9',
+ 'version_compatible' => '14.1',
);
if ( is_plugin_active_for_network( 'gutenberg/gutenberg.php' ) ) {
$deactivated_plugins = get_site_option( 'wp_force_deactivated_plugins', array() );
diff --git a/src/wp-admin/install-helper.php b/src/wp-admin/install-helper.php
index 733321c1..d9aaaba5 100755
--- a/src/wp-admin/install-helper.php
+++ b/src/wp-admin/install-helper.php
@@ -1,28 +1,30 @@
comments, 'comment_author', 'tinytext' ) ) {
* echo "ok\n";
* }
*
- * $error_count = 0;
- * $tablename = $wpdb->links;
* // Check the column.
* if ( ! check_column( $wpdb->links, 'link_description', 'varchar( 255 )' ) ) {
* $ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
* $q = $wpdb->query( $ddl );
* }
*
+ * $error_count = 0;
+ * $tablename = $wpdb->links;
+ *
* if ( check_column( $wpdb->links, 'link_description', 'varchar( 255 )' ) ) {
* $res .= $tablename . ' - ok ';
* } else {
@@ -59,9 +61,10 @@ function maybe_create_table( $table_name, $create_ddl ) {
}
// Didn't find it, so try to create it.
+ // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
$wpdb->query( $create_ddl );
- // We cannot directly tell that whether this succeeded!
+ // We cannot directly tell whether this succeeded!
foreach ( $wpdb->get_col( 'SHOW TABLES', 0 ) as $table ) {
if ( $table === $table_name ) {
return true;
@@ -88,6 +91,7 @@ function maybe_create_table( $table_name, $create_ddl ) {
function maybe_add_column( $table_name, $column_name, $create_ddl ) {
global $wpdb;
+ // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
if ( $column === $column_name ) {
return true;
@@ -95,9 +99,11 @@ function maybe_add_column( $table_name, $column_name, $create_ddl ) {
}
// Didn't find it, so try to create it.
+ // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
$wpdb->query( $create_ddl );
- // We cannot directly tell that whether this succeeded!
+ // We cannot directly tell whether this succeeded!
+ // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
if ( $column === $column_name ) {
return true;
@@ -123,13 +129,16 @@ function maybe_add_column( $table_name, $column_name, $create_ddl ) {
function maybe_drop_column( $table_name, $column_name, $drop_ddl ) {
global $wpdb;
+ // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
if ( $column === $column_name ) {
// Found it, so try to drop it.
+ // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
$wpdb->query( $drop_ddl );
- // We cannot directly tell that whether this succeeded!
+ // We cannot directly tell whether this succeeded!
+ // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
if ( $column === $column_name ) {
return false;
@@ -147,16 +156,16 @@ function maybe_drop_column( $table_name, $column_name, $drop_ddl ) {
*
* Uses the SQL DESC for retrieving the table info for the column. It will help
* understand the parameters, if you do more research on what column information
- * is returned by the SQL statement. Pass in null to skip checking that
- * criteria.
+ * is returned by the SQL statement. Pass in null to skip checking that criteria.
+ *
+ * Column names returned from DESC table are case sensitive and are as listed:
*
- * Column names returned from DESC table are case sensitive and are listed:
- * Field
- * Type
- * Null
- * Key
- * Default
- * Extra
+ * - Field
+ * - Type
+ * - Null
+ * - Key
+ * - Default
+ * - Extra
*
* @since 1.0.0
*
@@ -174,7 +183,9 @@ function maybe_drop_column( $table_name, $column_name, $drop_ddl ) {
function check_column( $table_name, $col_name, $col_type, $is_null = null, $key = null, $default_value = null, $extra = null ) {
global $wpdb;
- $diffs = 0;
+ $diffs = 0;
+
+ // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
$results = $wpdb->get_results( "DESC $table_name" );
foreach ( $results as $row ) {
diff --git a/src/wp-admin/ms-delete-site.php b/src/wp-admin/ms-delete-site.php
index 77246a4d..be66975f 100755
--- a/src/wp-admin/ms-delete-site.php
+++ b/src/wp-admin/ms-delete-site.php
@@ -65,11 +65,10 @@
be asked to confirm again so only click this link if you are absolutely certain:
###URL_DELETE###
-If you delete your site, please consider opening a new site here
-some time in the future! (But remember your current site and username
-are gone forever.)
+If you delete your site, please consider opening a new site here some time in
+the future! (But remember that your current site and username are gone forever.)
-Thanks for using the site,
+Thank you for using the site,
All at ###SITENAME###
###SITEURL###"
);
diff --git a/src/wp-admin/nav-menus.php b/src/wp-admin/nav-menus.php
index e95bb68a..28dbc821 100755
--- a/src/wp-admin/nav-menus.php
+++ b/src/wp-admin/nav-menus.php
@@ -1040,7 +1040,7 @@ function wp_nav_menu_max_depth( $classes ) {
-
+
-
+
|
diff --git a/src/wp-cron.php b/src/wp-cron.php
index 164e4ef1..f4211d82 100755
--- a/src/wp-cron.php
+++ b/src/wp-cron.php
@@ -23,7 +23,7 @@
header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
}
-/* Don't make the request block till we finish, if possible. */
+// Don't run cron until the request finishes, if possible.
if ( PHP_VERSION_ID >= 70016 && function_exists( 'fastcgi_finish_request' ) ) {
fastcgi_finish_request();
} elseif ( function_exists( 'litespeed_finish_request' ) ) {
@@ -35,7 +35,7 @@
}
/**
- * Tell WordPress we are doing the cron task.
+ * Tell WordPress the cron task is running.
*
* @var bool
*/
diff --git a/src/wp-includes/class-wp-dependencies.php b/src/wp-includes/class-wp-dependencies.php
index 68b33be3..0bc42bb2 100755
--- a/src/wp-includes/class-wp-dependencies.php
+++ b/src/wp-includes/class-wp-dependencies.php
@@ -241,7 +241,7 @@ public function all_deps( $handles, $recursion = false, $group = false ) {
* @param string $handle Name of the item. Should be unique.
* @param string|false $src Full URL of the item, or path of the item relative
* to the WordPress root directory. If source is set to false,
- * item is an alias of other items it depends on.
+ * the item is an alias of other items it depends on.
* @param string[] $deps Optional. An array of registered item handles this item depends on.
* Default empty array.
* @param string|bool|null $ver Optional. String specifying item version number, if it has one,
diff --git a/src/wp-includes/class-wp-dependency.php b/src/wp-includes/class-wp-dependency.php
index a0188117..bcc78082 100755
--- a/src/wp-includes/class-wp-dependency.php
+++ b/src/wp-includes/class-wp-dependency.php
@@ -29,8 +29,10 @@ class _WP_Dependency {
/**
* The handle source.
*
+ * If source is set to false, the item is an alias of other items it depends on.
+ *
* @since 2.6.0
- * @var string
+ * @var string|false
*/
public $src;
diff --git a/src/wp-includes/class-wp-list-util.php b/src/wp-includes/class-wp-list-util.php
index a2ccfb54..3648cd89 100755
--- a/src/wp-includes/class-wp-list-util.php
+++ b/src/wp-includes/class-wp-list-util.php
@@ -207,9 +207,10 @@ public function pluck( $field, $index_key = null ) {
* @since 4.7.0
*
* @param string|array $orderby Optional. Either the field name to order by or an array
- * of multiple orderby fields as $orderby => $order.
- * @param string $order Optional. Either 'ASC' or 'DESC'. Only used if $orderby
- * is a string.
+ * of multiple orderby fields as `$orderby => $order`.
+ * Default empty array.
+ * @param string $order Optional. Either 'ASC' or 'DESC'. Only used if `$orderby`
+ * is a string. Default 'ASC'.
* @param bool $preserve_keys Optional. Whether to preserve keys. Default false.
* @return array The sorted array.
*/
diff --git a/src/wp-includes/class-wp-locale.php b/src/wp-includes/class-wp-locale.php
index ca98f9d3..b001a099 100755
--- a/src/wp-includes/class-wp-locale.php
+++ b/src/wp-includes/class-wp-locale.php
@@ -124,7 +124,6 @@ public function __construct() {
* @since 2.1.0
*
* @global string $text_direction
- * @global string $wp_version The WordPress version string.
*/
public function init() {
// The weekdays.
diff --git a/src/wp-includes/class-wp-oembed-controller.php b/src/wp-includes/class-wp-oembed-controller.php
index 22fceb54..a36fff98 100755
--- a/src/wp-includes/class-wp-oembed-controller.php
+++ b/src/wp-includes/class-wp-oembed-controller.php
@@ -160,13 +160,14 @@ public function get_proxy_item_permissions_check() {
* @since 4.8.0
*
* @see WP_oEmbed::get_html()
- * @global WP_Embed $wp_embed
+ * @global WP_Embed $wp_embed
+ * @global WP_Scripts $wp_scripts
*
* @param WP_REST_Request $request Full data about the request.
* @return object|WP_Error oEmbed response data or WP_Error on failure.
*/
public function get_proxy_item( $request ) {
- global $wp_embed;
+ global $wp_embed, $wp_scripts;
$args = $request->get_params();
@@ -204,7 +205,6 @@ public function get_proxy_item( $request ) {
$html = $wp_embed->get_embed_handler_html( $args, $url );
if ( $html ) {
- global $wp_scripts;
// Check if any scripts were enqueued by the shortcode, and include them in the response.
$enqueued_scripts = array();
diff --git a/src/wp-includes/class-wp-tax-query.php b/src/wp-includes/class-wp-tax-query.php
index e7b1e2a9..881e0ce2 100755
--- a/src/wp-includes/class-wp-tax-query.php
+++ b/src/wp-includes/class-wp-tax-query.php
@@ -589,8 +589,6 @@ private function clean_query( &$query ) {
*
* @since 3.2.0
*
- * @global wpdb $wpdb The WordPress database abstraction object.
- *
* @param array $query The single query. Passed by reference.
* @param string $resulting_field The resulting field. Accepts 'slug', 'name', 'term_taxonomy_id',
* or 'term_id'. Default 'term_id'.
diff --git a/src/wp-includes/class-wp-taxonomy.php b/src/wp-includes/class-wp-taxonomy.php
index 1f7eed96..a73be9ea 100755
--- a/src/wp-includes/class-wp-taxonomy.php
+++ b/src/wp-includes/class-wp-taxonomy.php
@@ -278,8 +278,6 @@ final class WP_Taxonomy {
*
* @since 4.7.0
*
- * @global WP $wp Current WordPress environment instance.
- *
* @param string $taxonomy Taxonomy key, must not exceed 32 characters.
* @param array|string $object_type Name of the object type for the taxonomy object.
* @param array|string $args Optional. Array or query string of arguments for registering a taxonomy.
diff --git a/src/wp-includes/class-wp-term-query.php b/src/wp-includes/class-wp-term-query.php
index 18c85e89..ae391bfc 100755
--- a/src/wp-includes/class-wp-term-query.php
+++ b/src/wp-includes/class-wp-term-query.php
@@ -910,8 +910,6 @@ public function get_terms() {
*
* @since 4.6.0
*
- * @global wpdb $wpdb WordPress database abstraction object.
- *
* @param string $orderby_raw Alias for the field to order by.
* @return string|false Value to used in the ORDER clause. False otherwise.
*/
diff --git a/src/wp-includes/class-wp-xmlrpc-server.php b/src/wp-includes/class-wp-xmlrpc-server.php
index 97234880..0c574475 100755
--- a/src/wp-includes/class-wp-xmlrpc-server.php
+++ b/src/wp-includes/class-wp-xmlrpc-server.php
@@ -6819,6 +6819,8 @@ public function mt_publishPost( $args ) {
*
* @since 1.5.0
*
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
* @param array $args {
* Method arguments. Note: arguments must be ordered as documented.
*
diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php
index b5be18ed..ca79d54a 100755
--- a/src/wp-includes/comment.php
+++ b/src/wp-includes/comment.php
@@ -3783,6 +3783,8 @@ function wp_register_comment_personal_data_eraser( $erasers ) {
*
* @since 4.9.6
*
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
* @param string $email_address The comment author email address.
* @param int $page Comment page.
* @return array
diff --git a/src/wp-includes/compat.php b/src/wp-includes/compat.php
index 60e8c077..31112336 100755
--- a/src/wp-includes/compat.php
+++ b/src/wp-includes/compat.php
@@ -156,7 +156,7 @@ function mb_strlen( $string, $encoding = null ) {
/**
* Internal compat function to mimic mb_strlen().
*
- * Only understands UTF-8 and 8bit. All other character sets will be treated as 8bit.
+ * Only understands UTF-8 and 8bit. All other character sets will be treated as 8bit.
* For `$encoding === UTF-8`, the `$str` input is expected to be a valid UTF-8 byte
* sequence. The behavior of this function for invalid inputs is undefined.
*
diff --git a/src/wp-includes/customize/class-wp-customize-date-time-control.php b/src/wp-includes/customize/class-wp-customize-date-time-control.php
index 55bf64db..a055b4ee 100755
--- a/src/wp-includes/customize/class-wp-customize-date-time-control.php
+++ b/src/wp-includes/customize/class-wp-customize-date-time-control.php
@@ -234,7 +234,7 @@ public function get_timezone_info() {
if ( $tz ) {
$now = new DateTime( 'now', $tz );
- $formatted_gmt_offset = $this->format_gmt_offset( $tz->getOffset( $now ) / 3600 );
+ $formatted_gmt_offset = $this->format_gmt_offset( $tz->getOffset( $now ) / HOUR_IN_SECONDS );
$tz_name = str_replace( '_', ' ', $tz->getName() );
$timezone_info['abbr'] = $now->format( 'T' );
diff --git a/src/wp-includes/deprecated.php b/src/wp-includes/deprecated.php
index 6273a7f2..26185a68 100755
--- a/src/wp-includes/deprecated.php
+++ b/src/wp-includes/deprecated.php
@@ -4484,7 +4484,7 @@ function global_terms_enabled() {
* @return array The unmodified clauses.
*/
function _filter_query_attachment_filenames( $clauses ) {
- _deprecated_function( __FUNCTION__, '4.9.9', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )' );
+ _deprecated_function( __FUNCTION__, '6.0.3', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )' );
remove_filter( 'posts_clauses', __FUNCTION__ );
return $clauses;
}
diff --git a/src/wp-includes/feed-atom-comments.php b/src/wp-includes/feed-atom-comments.php
index b43f8d4e..e11955f7 100755
--- a/src/wp-includes/feed-atom-comments.php
+++ b/src/wp-includes/feed-atom-comments.php
@@ -93,7 +93,8 @@
' . get_comment_author_url() . '';}
+ echo '' . get_comment_author_url() . '';
+ }
?>
diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
index a38c78cc..8cb36f5e 100755
--- a/src/wp-includes/functions.php
+++ b/src/wp-includes/functions.php
@@ -163,8 +163,6 @@ function wp_timezone() {
* @since 0.71
* @since 5.3.0 Converted into a wrapper for wp_date().
*
- * @global WP_Locale $wp_locale WordPress date and time locale object.
- *
* @param string $format Format to display the date.
* @param int|bool $timestamp_with_offset Optional. A sum of Unix timestamp and timezone offset
* in seconds. Default false.
@@ -934,7 +932,7 @@ function do_enclose( $content, $post ) {
* @since 4.4.0
*
* @param string[] $post_links An array of enclosure links.
- * @param int $post_ID Post ID.
+ * @param int $post_id Post ID.
*/
$post_links = apply_filters( 'enclosure_links', $post_links, $post->ID );
@@ -3330,7 +3328,7 @@ function wp_get_mime_types() {
* @since 3.5.0
*
* @param string[] $wp_get_mime_types Mime types keyed by the file extension regex
- * corresponding to those types.
+ * corresponding to those types.
*/
return apply_filters(
'mime_types',
@@ -5200,9 +5198,10 @@ function wp_list_pluck( $list, $field, $index_key = null ) {
*
* @param array $list An array of objects or arrays to sort.
* @param string|array $orderby Optional. Either the field name to order by or an array
- * of multiple orderby fields as $orderby => $order.
- * @param string $order Optional. Either 'ASC' or 'DESC'. Only used if $orderby
- * is a string.
+ * of multiple orderby fields as `$orderby => $order`.
+ * Default empty array.
+ * @param string $order Optional. Either 'ASC' or 'DESC'. Only used if `$orderby`
+ * is a string. Default 'ASC'.
* @param bool $preserve_keys Optional. Whether to preserve keys. Default false.
* @return array The sorted array.
*/
diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php
index 9cae9b93..561ed30b 100755
--- a/src/wp-includes/general-template.php
+++ b/src/wp-includes/general-template.php
@@ -3683,6 +3683,9 @@ function wp_preload_resources() {
*
* @since 4.6.0
*
+ * @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts.
+ * @global WP_Styles $wp_styles The WP_Styles object for printing styles.
+ *
* @return string[] A list of unique hosts of enqueued scripts and styles.
*/
function wp_dependencies_unique_hosts() {
diff --git a/src/wp-includes/l10n.php b/src/wp-includes/l10n.php
index c5148a02..40c653fd 100755
--- a/src/wp-includes/l10n.php
+++ b/src/wp-includes/l10n.php
@@ -176,7 +176,7 @@ function determine_locale() {
* *Note:* Don't use translate() directly, use __() or related functions.
*
* @since 2.2.0
- * @since 5.5.0 Introduced gettext-{$domain} filter.
+ * @since 5.5.0 Introduced `gettext-{$domain}` filter.
*
* @param string $text Text to translate.
* @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
@@ -242,7 +242,7 @@ function before_last_bar( $string ) {
* *Note:* Don't use translate_with_gettext_context() directly, use _x() or related functions.
*
* @since 2.8.0
- * @since 5.5.0 Introduced gettext_with_context-{$domain} filter.
+ * @since 5.5.0 Introduced `gettext_with_context-{$domain}` filter.
*
* @param string $text Text to translate.
* @param string $context Context information for the translators.
@@ -463,7 +463,7 @@ function esc_html_x( $text, $context, $domain = 'default' ) {
* printf( _n( '%s person', '%s people', $count, 'text-domain' ), number_format_i18n( $count ) );
*
* @since 2.8.0
- * @since 5.5.0 Introduced ngettext-{$domain} filter.
+ * @since 5.5.0 Introduced `ngettext-{$domain}` filter.
*
* @param string $single The text to be used if the number is singular.
* @param string $plural The text to be used if the number is plural.
@@ -521,7 +521,7 @@ function _n( $single, $plural, $number, $domain = 'default' ) {
* printf( _nx( '%s group', '%s groups', $animals, 'group of animals', 'text-domain' ), number_format_i18n( $animals ) );
*
* @since 2.8.0
- * @since 5.5.0 Introduced ngettext_with_context-{$domain} filter.
+ * @since 5.5.0 Introduced `ngettext_with_context-{$domain}` filter.
*
* @param string $single The text to be used if the number is singular.
* @param string $plural The text to be used if the number is plural.
@@ -1022,9 +1022,9 @@ function load_theme_textdomain( $domain, $path = false ) {
}
/**
- * Loads the child themes translated strings.
+ * Loads the child theme's translated strings.
*
- * If the current locale exists as a .mo file in the child themes
+ * If the current locale exists as a .mo file in the child theme's
* root directory, it will be included in the translated strings by the $domain.
*
* The .mo files must be named based on the locale exactly.
@@ -1361,7 +1361,8 @@ function translate_user_role( $name, $domain = 'default' ) {
*
* @param string $dir A directory to search for language files.
* Default WP_LANG_DIR.
- * @return string[] An array of language codes or an empty array if no languages are present. Language codes are formed by stripping the .mo extension from the language file names.
+ * @return string[] An array of language codes or an empty array if no languages are present.
+ * Language codes are formed by stripping the .mo extension from the language file names.
*/
function get_available_languages( $dir = null ) {
$languages = array();
diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php
index de9988be..25de7c79 100755
--- a/src/wp-includes/link-template.php
+++ b/src/wp-includes/link-template.php
@@ -1752,11 +1752,13 @@ function get_edit_user_link( $user_id = null ) {
*
* @since 1.5.0
*
- * @param bool $in_same_term Optional. Whether post should be in a same taxonomy term. Default false.
- * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
- * @return WP_Post|null|string Post object if successful. Null if global $post is not set. Empty string if no
- * corresponding post exists.
+ * @param bool $in_same_term Optional. Whether post should be in the same taxonomy term.
+ * Default false.
+ * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * Default empty.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
+ * @return WP_Post|null|string Post object if successful. Null if global `$post` is not set.
+ * Empty string if no corresponding post exists.
*/
function get_previous_post( $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
return get_adjacent_post( $in_same_term, $excluded_terms, true, $taxonomy );
@@ -1767,11 +1769,13 @@ function get_previous_post( $in_same_term = false, $excluded_terms = '', $taxono
*
* @since 1.5.0
*
- * @param bool $in_same_term Optional. Whether post should be in a same taxonomy term. Default false.
- * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
- * @return WP_Post|null|string Post object if successful. Null if global $post is not set. Empty string if no
- * corresponding post exists.
+ * @param bool $in_same_term Optional. Whether post should be in the same taxonomy term.
+ * Default false.
+ * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * Default empty.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
+ * @return WP_Post|null|string Post object if successful. Null if global `$post` is not set.
+ * Empty string if no corresponding post exists.
*/
function get_next_post( $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
return get_adjacent_post( $in_same_term, $excluded_terms, false, $taxonomy );
@@ -1786,12 +1790,15 @@ function get_next_post( $in_same_term = false, $excluded_terms = '', $taxonomy =
*
* @global wpdb $wpdb WordPress database abstraction object.
*
- * @param bool $in_same_term Optional. Whether post should be in a same taxonomy term. Default false.
- * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty string.
- * @param bool $previous Optional. Whether to retrieve previous post. Default true
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
- * @return WP_Post|null|string Post object if successful. Null if global $post is not set. Empty string if no
- * corresponding post exists.
+ * @param bool $in_same_term Optional. Whether post should be in the same taxonomy term.
+ * Default false.
+ * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * Default empty string.
+ * @param bool $previous Optional. Whether to retrieve previous post.
+ * Default true.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
+ * @return WP_Post|null|string Post object if successful. Null if global `$post` is not set.
+ * Empty string if no corresponding post exists.
*/
function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
global $wpdb;
@@ -1919,7 +1926,7 @@ function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previo
* @since 4.4.0 Added the `$taxonomy` and `$post` parameters.
*
* @param string $join The JOIN clause in the SQL.
- * @param bool $in_same_term Whether post should be in a same taxonomy term.
+ * @param bool $in_same_term Whether post should be in the same taxonomy term.
* @param int[]|string $excluded_terms Array of excluded term IDs. Empty string if none were provided.
* @param string $taxonomy Taxonomy. Used to identify the term used when `$in_same_term` is true.
* @param WP_Post $post WP_Post object.
@@ -1941,7 +1948,7 @@ function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previo
* @since 4.4.0 Added the `$taxonomy` and `$post` parameters.
*
* @param string $where The `WHERE` clause in the SQL.
- * @param bool $in_same_term Whether post should be in a same taxonomy term.
+ * @param bool $in_same_term Whether post should be in the same taxonomy term.
* @param int[]|string $excluded_terms Array of excluded term IDs. Empty string if none were provided.
* @param string $taxonomy Taxonomy. Used to identify the term used when `$in_same_term` is true.
* @param WP_Post $post WP_Post object.
@@ -2001,10 +2008,13 @@ function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previo
* @since 2.8.0
*
* @param string $title Optional. Link title format. Default '%title'.
- * @param bool $in_same_term Optional. Whether link should be in a same taxonomy term. Default false.
- * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
- * @param bool $previous Optional. Whether to display link to previous or next post. Default true.
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
+ * Default false.
+ * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * Default empty.
+ * @param bool $previous Optional. Whether to display link to previous or next post.
+ * Default true.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
* @return string|void The adjacent post relational link URL.
*/
function get_adjacent_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
@@ -2065,9 +2075,11 @@ function get_adjacent_post_rel_link( $title = '%title', $in_same_term = false, $
* @since 2.8.0
*
* @param string $title Optional. Link title format. Default '%title'.
- * @param bool $in_same_term Optional. Whether link should be in a same taxonomy term. Default false.
- * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
+ * Default false.
+ * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * Default empty.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
*/
function adjacent_posts_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, true, $taxonomy );
@@ -2100,9 +2112,11 @@ function adjacent_posts_rel_link_wp_head() {
* @see get_adjacent_post_rel_link()
*
* @param string $title Optional. Link title format. Default '%title'.
- * @param bool $in_same_term Optional. Whether link should be in a same taxonomy term. Default false.
- * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
+ * Default false.
+ * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * Default empty.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
*/
function next_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, false, $taxonomy );
@@ -2116,9 +2130,11 @@ function next_post_rel_link( $title = '%title', $in_same_term = false, $excluded
* @see get_adjacent_post_rel_link()
*
* @param string $title Optional. Link title format. Default '%title'.
- * @param bool $in_same_term Optional. Whether link should be in a same taxonomy term. Default false.
- * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default true.
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
+ * Default false.
+ * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * Default true.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
*/
function prev_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, true, $taxonomy );
@@ -2128,17 +2144,18 @@ function prev_post_rel_link( $title = '%title', $in_same_term = false, $excluded
* Retrieves the boundary post.
*
* Boundary being either the first or last post by publish date within the constraints specified
- * by $in_same_term or $excluded_terms.
+ * by `$in_same_term` or `$excluded_terms`.
*
* @since 2.8.0
*
- * @param bool $in_same_term Optional. Whether returned post should be in a same taxonomy term.
+ * @param bool $in_same_term Optional. Whether returned post should be in the same taxonomy term.
* Default false.
* @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
* Default empty.
- * @param bool $start Optional. Whether to retrieve first or last post. Default true
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
- * @return null|array Array containing the boundary post object if successful, null otherwise.
+ * @param bool $start Optional. Whether to retrieve first or last post.
+ * Default true.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
+ * @return array|null Array containing the boundary post object if successful, null otherwise.
*/
function get_boundary_post( $in_same_term = false, $excluded_terms = '', $start = true, $taxonomy = 'category' ) {
$post = get_post();
@@ -2198,9 +2215,11 @@ function get_boundary_post( $in_same_term = false, $excluded_terms = '', $start
*
* @param string $format Optional. Link anchor format. Default '« %link'.
* @param string $link Optional. Link permalink format. Default '%title'.
- * @param bool $in_same_term Optional. Whether link should be in a same taxonomy term. Default false.
- * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
+ * Default false.
+ * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * Default empty.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
* @return string The link URL of the previous post in relation to the current post.
*/
function get_previous_post_link( $format = '« %link', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
@@ -2216,9 +2235,11 @@ function get_previous_post_link( $format = '« %link', $link = '%title', $i
*
* @param string $format Optional. Link anchor format. Default '« %link'.
* @param string $link Optional. Link permalink format. Default '%title'.
- * @param bool $in_same_term Optional. Whether link should be in a same taxonomy term. Default false.
- * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
+ * Default false.
+ * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * Default empty.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
*/
function previous_post_link( $format = '« %link', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
echo get_previous_post_link( $format, $link, $in_same_term, $excluded_terms, $taxonomy );
@@ -2231,9 +2252,11 @@ function previous_post_link( $format = '« %link', $link = '%title', $in_sa
*
* @param string $format Optional. Link anchor format. Default '« %link'.
* @param string $link Optional. Link permalink format. Default '%title'.
- * @param bool $in_same_term Optional. Whether link should be in a same taxonomy term. Default false.
- * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
+ * Default false.
+ * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * Default empty.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
* @return string The link URL of the next post in relation to the current post.
*/
function get_next_post_link( $format = '%link »', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
@@ -2248,10 +2271,12 @@ function get_next_post_link( $format = '%link »', $link = '%title', $in_sa
* @see get_next_post_link()
*
* @param string $format Optional. Link anchor format. Default '« %link'.
- * @param string $link Optional. Link permalink format. Default '%title'
- * @param bool $in_same_term Optional. Whether link should be in a same taxonomy term. Default false.
- * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @param string $link Optional. Link permalink format. Default '%title'.
+ * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
+ * Default false.
+ * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * Default empty.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
*/
function next_post_link( $format = '%link »', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
echo get_next_post_link( $format, $link, $in_same_term, $excluded_terms, $taxonomy );
@@ -2266,10 +2291,13 @@ function next_post_link( $format = '%link »', $link = '%title', $in_same_t
*
* @param string $format Link anchor format.
* @param string $link Link permalink format.
- * @param bool $in_same_term Optional. Whether link should be in a same taxonomy term. Default false.
- * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded terms IDs. Default empty.
- * @param bool $previous Optional. Whether to display link to previous or next post. Default true.
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
+ * Default false.
+ * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded terms IDs.
+ * Default empty.
+ * @param bool $previous Optional. Whether to display link to previous or next post.
+ * Default true.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
* @return string The link URL of the previous or next post in relation to the current post.
*/
function get_adjacent_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
@@ -2318,11 +2346,11 @@ function get_adjacent_post_link( $format, $link, $in_same_term = false, $exclude
* @since 2.6.0
* @since 4.2.0 Added the `$adjacent` parameter.
*
- * @param string $output The adjacent post link.
- * @param string $format Link anchor format.
- * @param string $link Link permalink format.
- * @param WP_Post $post The adjacent post.
- * @param string $adjacent Whether the post is previous or next.
+ * @param string $output The adjacent post link.
+ * @param string $format Link anchor format.
+ * @param string $link Link permalink format.
+ * @param WP_Post|string $post The adjacent post. Empty string if no corresponding post exists.
+ * @param string $adjacent Whether the post is previous or next.
*/
return apply_filters( "{$adjacent}_post_link", $output, $format, $link, $post, $adjacent );
}
@@ -2336,10 +2364,13 @@ function get_adjacent_post_link( $format, $link, $in_same_term = false, $exclude
*
* @param string $format Link anchor format.
* @param string $link Link permalink format.
- * @param bool $in_same_term Optional. Whether link should be in a same taxonomy term. Default false.
- * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded category IDs. Default empty.
- * @param bool $previous Optional. Whether to display link to previous or next post. Default true.
- * @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
+ * Default false.
+ * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded category IDs.
+ * Default empty.
+ * @param bool $previous Optional. Whether to display link to previous or next post.
+ * Default true.
+ * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
*/
function adjacent_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
echo get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, $previous, $taxonomy );
@@ -2353,8 +2384,8 @@ function adjacent_post_link( $format, $link, $in_same_term = false, $excluded_te
* @global WP_Rewrite $wp_rewrite WordPress rewrite component.
*
* @param int $pagenum Optional. Page number. Default 1.
- * @param bool $escape Optional. Whether to escape the URL for display, with esc_url(). Defaults to true.
- * Otherwise, prepares the URL with sanitize_url().
+ * @param bool $escape Optional. Whether to escape the URL for display, with esc_url().
+ * If set to false, prepares the URL with sanitize_url(). Default true.
* @return string The link URL for the given page number.
*/
function get_pagenum_link( $pagenum = 1, $escape = true ) {
@@ -2683,12 +2714,17 @@ function posts_nav_link( $sep = '', $prelabel = '', $nxtlabel = '' ) {
* @param array $args {
* Optional. Default post navigation arguments. Default empty array.
*
- * @type string $prev_text Anchor text to display in the previous post link. Default '%title'.
- * @type string $next_text Anchor text to display in the next post link. Default '%title'.
- * @type bool $in_same_term Whether link should be in a same taxonomy term. Default false.
- * @type int[]|string $excluded_terms Array or comma-separated list of excluded term IDs. Default empty.
+ * @type string $prev_text Anchor text to display in the previous post link.
+ * Default '%title'.
+ * @type string $next_text Anchor text to display in the next post link.
+ * Default '%title'.
+ * @type bool $in_same_term Whether link should be in the same taxonomy term.
+ * Default false.
+ * @type int[]|string $excluded_terms Array or comma-separated list of excluded term IDs.
+ * Default empty.
* @type string $taxonomy Taxonomy, if `$in_same_term` is true. Default 'category'.
- * @type string $screen_reader_text Screen reader text for the nav element. Default 'Post navigation'.
+ * @type string $screen_reader_text Screen reader text for the nav element.
+ * Default 'Post navigation'.
* @type string $aria_label ARIA label text for the nav element. Default 'Posts'.
* @type string $class Custom class for the nav element. Default 'post-navigation'.
* }
diff --git a/src/wp-includes/load.php b/src/wp-includes/load.php
index 3cf4b0d2..52453802 100755
--- a/src/wp-includes/load.php
+++ b/src/wp-includes/load.php
@@ -1322,10 +1322,10 @@ function get_current_network_id() {
* @access private
*
* @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry.
- * @global WP_Locale $wp_locale WordPress date and time locale object.
+ * @global WP_Locale $wp_locale WordPress date and time locale object.
*/
function wp_load_translations_early() {
- global $wp_locale, $wp_textdomain_registry;
+ global $wp_textdomain_registry, $wp_locale;
static $loaded = false;
if ( $loaded ) {
diff --git a/src/wp-includes/nav-menu.php b/src/wp-includes/nav-menu.php
index 8df3cd2c..3ef281f6 100755
--- a/src/wp-includes/nav-menu.php
+++ b/src/wp-includes/nav-menu.php
@@ -143,7 +143,7 @@ function register_nav_menu( $location, $description ) {
*
* @global array $_wp_registered_nav_menus
*
- * @return string[] Associative array of egistered navigation menu descriptions keyed
+ * @return string[] Associative array of registered navigation menu descriptions keyed
* by their location. If none are registered, an empty array.
*/
function get_registered_nav_menus() {
diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
index dbd4e54f..4f32ff30 100755
--- a/src/wp-includes/post.php
+++ b/src/wp-includes/post.php
@@ -1375,9 +1375,8 @@ function get_post_types( $args = array(), $output = 'names', $operator = 'and' )
*
* @global array $wp_post_types List of post types.
*
- * @param string $post_type Post type key. Must not exceed 20 characters and may
- * only contain lowercase alphanumeric characters, dashes,
- * and underscores. See sanitize_key().
+ * @param string $post_type Post type key. Must not exceed 20 characters and may only contain
+ * lowercase alphanumeric characters, dashes, and underscores. See sanitize_key().
* @param array|string $args {
* Array or string of arguments for registering a post type.
*
@@ -2885,7 +2884,7 @@ function wp_count_posts( $type = 'post', $perm = '' ) {
wp_cache_set( $cache_key, $counts, 'counts' );
/**
- * Modifies returned post counts by status for the current post type.
+ * Filters the post counts by status for the current post type.
*
* @since 3.7.0
*
@@ -2937,7 +2936,7 @@ function wp_count_attachments( $mime_type = '' ) {
}
/**
- * Modifies returned attachment counts by mime type.
+ * Filters the attachment counts by mime type.
*
* @since 3.7.0
*
@@ -4026,7 +4025,7 @@ function wp_insert_post( $postarr, $wp_error = false, $fire_after_hooks = true )
if ( $update && strtolower( urlencode( $post_name ) ) == $check_name && get_post_field( 'post_name', $post_ID ) == $check_name ) {
$post_name = $check_name;
- } else { // new post, or slug has changed.
+ } else { // New post, or slug has changed.
$post_name = sanitize_title( $post_name );
}
}
diff --git a/src/wp-includes/rest-api/class-wp-rest-server.php b/src/wp-includes/rest-api/class-wp-rest-server.php
index 1690a00e..0770c97a 100755
--- a/src/wp-includes/rest-api/class-wp-rest-server.php
+++ b/src/wp-includes/rest-api/class-wp-rest-server.php
@@ -553,7 +553,7 @@ public function serve_request( $path = null ) {
* Converts a response to data to send.
*
* @since 4.4.0
- * @since 5.4.0 The $embed parameter can now contain a list of link relations to include.
+ * @since 5.4.0 The `$embed` parameter can now contain a list of link relations to include.
*
* @param WP_REST_Response $response Response object.
* @param bool|string[] $embed Whether to embed all links, a filtered list of link relations, or no links.
@@ -677,7 +677,7 @@ public static function get_compact_response_links( $response ) {
* Embeds the links from the data into the request.
*
* @since 4.4.0
- * @since 5.4.0 The $embed parameter can now contain a list of link relations to include.
+ * @since 5.4.0 The `$embed` parameter can now contain a list of link relations to include.
*
* @param array $data Data from the request.
* @param bool|string[] $embed Whether to embed all links or a filtered list of link relations.
@@ -759,7 +759,7 @@ protected function embed_links( $data, $embed = true ) {
* data instead.
*
* @since 4.4.0
- * @since 6.0.0 The $embed parameter can now contain a list of link relations to include
+ * @since 6.0.0 The `$embed` parameter can now contain a list of link relations to include.
*
* @param WP_REST_Response $response Response object.
* @param bool|string[] $embed Whether to embed all links, a filtered list of link relations, or no links.
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
index 804e8ed2..5cbec60f 100755
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
@@ -659,11 +659,9 @@ public function create_item( $request ) {
&& in_array( $prepared_post->post_status, array( 'draft', 'pending' ), true )
) {
/*
- * `wp_unique_post_slug()` returns the same
- * slug for 'draft' or 'pending' posts.
+ * `wp_unique_post_slug()` returns the same slug for 'draft' or 'pending' posts.
*
- * To ensure that a unique slug is generated,
- * pass the post data with the 'publish' status.
+ * To ensure that a unique slug is generated, pass the post data with the 'publish' status.
*/
$prepared_post->post_name = wp_unique_post_slug(
$prepared_post->post_name,
@@ -862,15 +860,19 @@ public function update_item( $request ) {
}
/*
- * `wp_unique_post_slug()` returns the same
- * slug for 'draft' or 'pending' posts.
+ * `wp_unique_post_slug()` returns the same slug for 'draft' or 'pending' posts.
*
- * To ensure that a unique slug is generated,
- * pass the post data with the 'publish' status.
+ * To ensure that a unique slug is generated, pass the post data with the 'publish' status.
*/
if ( ! empty( $post->post_name ) && in_array( $post_status, array( 'draft', 'pending' ), true ) ) {
$post_parent = ! empty( $post->post_parent ) ? $post->post_parent : 0;
- $post->post_name = wp_unique_post_slug( $post->post_name, $post->ID, 'publish', $post->post_type, $post_parent );
+ $post->post_name = wp_unique_post_slug(
+ $post->post_name,
+ $post->ID,
+ 'publish',
+ $post->post_type,
+ $post_parent
+ );
}
// Convert the post object to an array, otherwise wp_update_post() will expect non-escaped input.
@@ -1795,7 +1797,7 @@ public function prepare_item_for_response( $item, $request ) {
* with the site's timezone offset applied.
*/
if ( '0000-00-00 00:00:00' === $post->post_modified_gmt ) {
- $post_modified_gmt = gmdate( 'Y-m-d H:i:s', strtotime( $post->post_modified ) - ( get_option( 'gmt_offset' ) * 3600 ) );
+ $post_modified_gmt = gmdate( 'Y-m-d H:i:s', strtotime( $post->post_modified ) - ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) );
} else {
$post_modified_gmt = $post->post_modified_gmt;
}
diff --git a/src/wp-includes/revision.php b/src/wp-includes/revision.php
index 0f76f908..9d3ca6f4 100755
--- a/src/wp-includes/revision.php
+++ b/src/wp-includes/revision.php
@@ -859,7 +859,7 @@ function _wp_upgrade_revisions_of_post( $post, $revisions ) {
return false;
}
- if ( $locked > $now - 3600 ) {
+ if ( $locked > $now - HOUR_IN_SECONDS ) {
// Lock is not too old: some other process may be upgrading this post. Bail.
return false;
}
diff --git a/src/wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php b/src/wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php
index a5454787..dff85a70 100755
--- a/src/wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php
+++ b/src/wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php
@@ -221,7 +221,7 @@ protected function get_posts_query_args( $post_type ) {
'no_found_rows' => true,
'update_post_term_cache' => false,
'update_post_meta_cache' => false,
- 'ignore_sticky_posts' => true, // sticky posts will still appear, but they won't be moved to the front.
+ 'ignore_sticky_posts' => true, // Sticky posts will still appear, but they won't be moved to the front.
),
$post_type
);
diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php
index 5b709681..ac73242b 100755
--- a/src/wp-includes/taxonomy.php
+++ b/src/wp-includes/taxonomy.php
@@ -390,8 +390,8 @@ function is_taxonomy_hierarchical( $taxonomy ) {
*
* @global WP_Taxonomy[] $wp_taxonomies Registered taxonomies.
*
- * @param string $taxonomy Taxonomy key, must not exceed 32 characters and may only contain lowercase alphanumeric
- * characters, dashes, and underscores. See sanitize_key().
+ * @param string $taxonomy Taxonomy key. Must not exceed 32 characters and may only contain
+ * lowercase alphanumeric characters, dashes, and underscores. See sanitize_key().
* @param array|string $object_type Object type or array of object types with which the taxonomy should be associated.
* @param array|string $args {
* Optional. Array or query string of arguments for registering a taxonomy.
diff --git a/src/wp-includes/theme-compat/header.php b/src/wp-includes/theme-compat/header.php
index daa0088d..cbd84eb2 100755
--- a/src/wp-includes/theme-compat/header.php
+++ b/src/wp-includes/theme-compat/header.php
@@ -43,7 +43,8 @@
diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php
index 4814aaef..940083a6 100755
--- a/src/wp-includes/theme.php
+++ b/src/wp-includes/theme.php
@@ -3564,7 +3564,7 @@ function _wp_customize_publish_changeset( $new_status, $old_status, $changeset_p
remove_action( 'customize_register', array( $wp_customize, 'register_controls' ) );
$wp_customize->register_controls();
- /** This filter is documented in /wp-includes/class-wp-customize-manager.php */
+ /** This filter is documented in wp-includes/class-wp-customize-manager.php */
do_action( 'customize_register', $wp_customize );
}
$wp_customize->_publish_changeset_values( $changeset_post->ID );
diff --git a/src/wp-links-opml.php b/src/wp-links-opml.php
index ca43c3d4..746c287a 100755
--- a/src/wp-links-opml.php
+++ b/src/wp-links-opml.php
@@ -83,7 +83,8 @@
get_error_message();
}
- // We couldn't post, for whatever reason. Better move forward to the next email.
+ // The post wasn't inserted or updated, for whatever reason. Better move forward to the next email.
if ( empty( $post_ID ) ) {
continue;
}
diff --git a/src/wp-settings.php b/src/wp-settings.php
index 19aac7f9..f5be2a74 100755
--- a/src/wp-settings.php
+++ b/src/wp-settings.php
@@ -19,8 +19,8 @@
* Version information for the current WordPress release.
*
* These can't be directly globalized in version.php. When updating,
- * we're including version.php from another installation and don't want
- * these values to be overridden if already set.
+ * include version.php from another installation and don't override
+ * these values if already set.
*
* @global string $wp_version The WordPress version string.
* @global int $wp_db_version WordPress database version.
@@ -60,7 +60,7 @@
// Set initial default constants including WP_MEMORY_LIMIT, WP_MAX_MEMORY_LIMIT, WP_DEBUG, SCRIPT_DEBUG, WP_CONTENT_DIR and WP_CACHE.
wp_initial_constants();
-// Make sure we register the shutdown handler for fatal errors as soon as possible.
+// Register the shutdown handler for fatal errors as soon as possible.
wp_register_fatal_error_handler();
// WordPress calculates offsets from UTC.
@@ -70,13 +70,13 @@
// Standardize $_SERVER variables across setups.
wp_fix_server_vars();
-// Check if we're in maintenance mode.
+// Check if the site is in maintenance mode.
wp_maintenance();
// Start loading timer.
timer_start();
-// Check if we're in WP_DEBUG mode.
+// Check if WP_DEBUG mode is enabled.
wp_debug_mode();
/**
@@ -145,7 +145,7 @@
register_shutdown_function( 'shutdown_action_hook' );
-// Stop most of WordPress from being loaded if we just want the basics.
+// Stop most of WordPress from being loaded if SHORTINIT is enabled.
if ( SHORTINIT ) {
return false;
}
diff --git a/src/wp-trackback.php b/src/wp-trackback.php
index d7d18814..7512e33f 100755
--- a/src/wp-trackback.php
+++ b/src/wp-trackback.php
@@ -76,7 +76,7 @@ function trackback_response( $error = 0, $error_message = '' ) {
$blog_name = mb_convert_encoding( $blog_name, get_option( 'blog_charset' ), $charset );
}
-// Now that mb_convert_encoding() has been given a swing, we need to escape these three.
+// Escape values to use in the trackback.
$title = wp_slash( $title );
$excerpt = wp_slash( $excerpt );
$blog_name = wp_slash( $blog_name );
diff --git a/src/xmlrpc.php b/src/xmlrpc.php
index 341a6dc8..ecac4c7c 100755
--- a/src/xmlrpc.php
+++ b/src/xmlrpc.php
@@ -12,7 +12,7 @@
*/
define( 'XMLRPC_REQUEST', true );
-// Some browser-embedded clients send cookies. We don't want them.
+// Discard unneeded cookies sent by some browser-embedded clients.
$_COOKIE = array();
// $HTTP_RAW_POST_DATA was deprecated in PHP 5.6 and removed in PHP 7.0.
diff --git a/tests/phpunit/includes/abstract-testcase.php b/tests/phpunit/includes/abstract-testcase.php
index 38f846e5..6cfeaa30 100755
--- a/tests/phpunit/includes/abstract-testcase.php
+++ b/tests/phpunit/includes/abstract-testcase.php
@@ -322,7 +322,7 @@ protected function reset__SERVER() {
* Saves the action and filter-related globals so they can be restored later.
*
* Stores $wp_actions, $wp_current_filter, and $wp_filter on a class variable
- * so they can be restored on tearDown() using _restore_hooks().
+ * so they can be restored on tear_down() using _restore_hooks().
*
* @global array $wp_actions
* @global array $wp_current_filter
@@ -340,7 +340,7 @@ protected function _backup_hooks() {
}
/**
- * Restores the hook-related globals to their state at setUp()
+ * Restores the hook-related globals to their state at set_up()
* so that future tests aren't affected by hooks set during this last test.
*
* @global array $wp_actions
@@ -1365,11 +1365,12 @@ public function rmdir( $path ) {
/**
* Deletes files added to the `uploads` directory during tests.
*
- * This method works in tandem with the `setUp()` and `rmdir()` methods:
- * - `setUp()` scans the `uploads` directory before every test, and stores its contents inside of the
- * `$ignore_files` property.
- * - `rmdir()` and its helper methods only delete files that are not listed in the `$ignore_files` property. If
- * called during `tearDown()` in tests, this will only delete files added during the previously run test.
+ * This method works in tandem with the `set_up()` and `rmdir()` methods:
+ * - `set_up()` scans the `uploads` directory before every test, and stores
+ * its contents inside of the `$ignore_files` property.
+ * - `rmdir()` and its helper methods only delete files that are not listed
+ * in the `$ignore_files` property. If called during `tear_down()` in tests,
+ * this will only delete files added during the previously run test.
*/
public function remove_added_uploads() {
$uploads = wp_upload_dir();
diff --git a/tests/phpunit/includes/bootstrap.php b/tests/phpunit/includes/bootstrap.php
index be0c0180..5610d671 100755
--- a/tests/phpunit/includes/bootstrap.php
+++ b/tests/phpunit/includes/bootstrap.php
@@ -302,7 +302,7 @@ function wp_tests_options( $value ) {
}
// Load WordPress.
-require_once ABSPATH . '/wp-settings.php';
+require_once ABSPATH . 'wp-settings.php';
// Delete any default posts & related data.
_delete_all_posts();
diff --git a/tests/phpunit/includes/install.php b/tests/phpunit/includes/install.php
index 1357b4d5..3157fd93 100755
--- a/tests/phpunit/includes/install.php
+++ b/tests/phpunit/includes/install.php
@@ -37,10 +37,10 @@
tests_add_filter( 'wp_die_handler', '_wp_die_handler_filter_exit' );
-require_once ABSPATH . '/wp-settings.php';
+require_once ABSPATH . 'wp-settings.php';
-require_once ABSPATH . '/wp-admin/includes/upgrade.php';
-require_once ABSPATH . '/wp-includes/class-wpdb.php';
+require_once ABSPATH . 'wp-admin/includes/upgrade.php';
+require_once ABSPATH . 'wp-includes/class-wpdb.php';
// Override the PHPMailer.
global $phpmailer;
diff --git a/tests/phpunit/includes/testcase-canonical.php b/tests/phpunit/includes/testcase-canonical.php
index 833df23e..26916fac 100755
--- a/tests/phpunit/includes/testcase-canonical.php
+++ b/tests/phpunit/includes/testcase-canonical.php
@@ -37,7 +37,7 @@ public function set_up() {
/**
* Generate fixtures to be shared between canonical tests.
*
- * Abstracted here because it's invoked by setUpBeforeClass() in more than one class.
+ * Abstracted here because it's invoked by wpSetUpBeforeClass() in more than one class.
*
* @since 4.1.0
*/
@@ -46,7 +46,7 @@ public static function generate_shared_fixtures( WP_UnitTest_Factory $factory )
self::$author_id = $factory->user->create( array( 'user_login' => 'canonical-author' ) );
/*
- * Also set in self::setUp(), but we must configure here to make sure that
+ * Also set in self::set_up(), but we must configure here to make sure that
* post authorship is properly attributed for fixtures.
*/
wp_set_current_user( self::$author_id );
diff --git a/tests/phpunit/includes/utils.php b/tests/phpunit/includes/utils.php
index 16b331b6..1b839878 100755
--- a/tests/phpunit/includes/utils.php
+++ b/tests/phpunit/includes/utils.php
@@ -459,12 +459,12 @@ function gen_tests_array( $name, $array ) {
}
/**
- * Use to create objects by yourself
+ * Use to create objects by yourself.
*/
class MockClass extends stdClass {}
/**
- * Drops all tables from the WordPress database
+ * Drops all tables from the WordPress database.
*/
function drop_tables() {
global $wpdb;
diff --git a/tests/phpunit/tests/customize/custom-css-setting.php b/tests/phpunit/tests/customize/custom-css-setting.php
index f651b509..015b6308 100755
--- a/tests/phpunit/tests/customize/custom-css-setting.php
+++ b/tests/phpunit/tests/customize/custom-css-setting.php
@@ -25,7 +25,7 @@ class Test_WP_Customize_Custom_CSS_Setting extends WP_UnitTestCase {
/**
* Set up the test case.
*
- * @see WP_UnitTestCase::setup()
+ * @see WP_UnitTestCase_Base::set_up()
*/
public function set_up() {
parent::set_up();
diff --git a/tests/phpunit/tests/customize/nav-menu-item-setting.php b/tests/phpunit/tests/customize/nav-menu-item-setting.php
index 212f8717..256e5f57 100755
--- a/tests/phpunit/tests/customize/nav-menu-item-setting.php
+++ b/tests/phpunit/tests/customize/nav-menu-item-setting.php
@@ -16,7 +16,7 @@ class Test_WP_Customize_Nav_Menu_Item_Setting extends WP_UnitTestCase {
/**
* Set up a test case.
*
- * @see WP_UnitTestCase::setup()
+ * @see WP_UnitTestCase_Base::set_up()
*/
public function set_up() {
parent::set_up();
diff --git a/tests/phpunit/tests/customize/nav-menu-setting.php b/tests/phpunit/tests/customize/nav-menu-setting.php
index 4a727618..6d50c96e 100755
--- a/tests/phpunit/tests/customize/nav-menu-setting.php
+++ b/tests/phpunit/tests/customize/nav-menu-setting.php
@@ -17,7 +17,7 @@ class Test_WP_Customize_Nav_Menu_Setting extends WP_UnitTestCase {
/**
* Set up a test case.
*
- * @see WP_UnitTestCase::setup()
+ * @see WP_UnitTestCase_Base::set_up()
*/
public function set_up() {
parent::set_up();
diff --git a/tests/phpunit/tests/customize/nav-menus.php b/tests/phpunit/tests/customize/nav-menus.php
index 57855581..7b8ee433 100755
--- a/tests/phpunit/tests/customize/nav-menus.php
+++ b/tests/phpunit/tests/customize/nav-menus.php
@@ -17,7 +17,7 @@ class Test_WP_Customize_Nav_Menus extends WP_UnitTestCase {
/**
* Set up a test case.
*
- * @see WP_UnitTestCase::setup()
+ * @see WP_UnitTestCase_Base::set_up()
*/
public function set_up() {
parent::set_up();
diff --git a/tests/phpunit/tests/customize/widgets.php b/tests/phpunit/tests/customize/widgets.php
index 94630bc7..68e908ad 100755
--- a/tests/phpunit/tests/customize/widgets.php
+++ b/tests/phpunit/tests/customize/widgets.php
@@ -470,7 +470,7 @@ public function test_sanitize_widget_instance_empty_instance() {
*/
private function get_test_widget_control_args() {
global $wp_registered_widgets;
- require_once ABSPATH . '/wp-admin/includes/widgets.php';
+ require_once ABSPATH . 'wp-admin/includes/widgets.php';
$widget_id = 'search-2';
$widget = $wp_registered_widgets[ $widget_id ];
$args = array(
diff --git a/tests/phpunit/tests/db/dbDelta.php b/tests/phpunit/tests/db/dbDelta.php
index 6667f9ab..03426fa7 100755
--- a/tests/phpunit/tests/db/dbDelta.php
+++ b/tests/phpunit/tests/db/dbDelta.php
@@ -99,7 +99,7 @@ public function tear_down() {
parent::tear_down();
- // This has to be called after the parent `tearDown()` method.
+ // This has to be called after the parent `tear_down()` method.
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}dbdelta_test" );
}
diff --git a/tests/phpunit/tests/feed/wpSimplePieFile.php b/tests/phpunit/tests/feed/wpSimplePieFile.php
index f9748e3a..fe16352c 100755
--- a/tests/phpunit/tests/feed/wpSimplePieFile.php
+++ b/tests/phpunit/tests/feed/wpSimplePieFile.php
@@ -19,8 +19,8 @@ class Tests_Feed_wpSimplePieFile extends WP_UnitTestCase {
public static function set_up_before_class() {
parent::set_up_before_class();
- require_once ABSPATH . '/wp-includes/class-simplepie.php';
- require_once ABSPATH . '/wp-includes/class-wp-simplepie-file.php';
+ require_once ABSPATH . 'wp-includes/class-simplepie.php';
+ require_once ABSPATH . 'wp-includes/class-wp-simplepie-file.php';
}
/**
diff --git a/tests/phpunit/tests/functions.php b/tests/phpunit/tests/functions.php
index ea7488a5..7f855e11 100755
--- a/tests/phpunit/tests/functions.php
+++ b/tests/phpunit/tests/functions.php
@@ -2065,41 +2065,6 @@ public function test_wp_get_default_extension_for_mime_type() {
$this->assertFalse( wp_get_default_extension_for_mime_type( null ), 'false not returned when null as mime type supplied' );
}
- /**
- * @ticket 49412
- * @covers ::wp_filesize
- */
- function test_wp_filesize_with_nonexistent_file() {
- $file = 'nonexistent/file.jpg';
- $this->assertSame( 0, wp_filesize( $file ) );
- }
-
- /**
- * @ticket 49412
- * @covers ::wp_filesize
- */
- function test_wp_filesize() {
- $file = DIR_TESTDATA . '/images/test-image-upside-down.jpg';
-
- $this->assertSame( filesize( $file ), wp_filesize( $file ) );
-
- $filter = function() {
- return 999;
- };
-
- add_filter( 'wp_filesize', $filter );
-
- $this->assertSame( 999, wp_filesize( $file ) );
-
- $pre_filter = function() {
- return 111;
- };
-
- add_filter( 'pre_wp_filesize', $pre_filter );
-
- $this->assertSame( 111, wp_filesize( $file ) );
- }
-
/**
* @ticket 55505
* @covers ::wp_recursive_ksort
diff --git a/tests/phpunit/tests/functions/sizeFormat.php b/tests/phpunit/tests/functions/sizeFormat.php
index 1337bb39..72c383ff 100755
--- a/tests/phpunit/tests/functions/sizeFormat.php
+++ b/tests/phpunit/tests/functions/sizeFormat.php
@@ -14,58 +14,58 @@ class Tests_Functions_SizeFormat extends WP_UnitTestCase {
public function _data_size_format() {
return array(
- // Invalid values
+ // Invalid values.
array( array(), 0, false ),
array( 'baba', 0, false ),
array( '', 0, false ),
array( '-1', 0, false ),
array( -1, 0, false ),
- // Bytes
+ // Bytes.
array( 0, 0, '0 B' ),
array( 1, 0, '1 B' ),
array( 1023, 0, '1,023 B' ),
- // Kilobytes
+ // Kilobytes.
array( KB_IN_BYTES, 0, '1 KB' ),
array( KB_IN_BYTES, 2, '1.00 KB' ),
array( 2.5 * KB_IN_BYTES, 0, '3 KB' ),
array( 2.5 * KB_IN_BYTES, 2, '2.50 KB' ),
array( 10 * KB_IN_BYTES, 0, '10 KB' ),
- // Megabytes
+ // Megabytes.
array( (string) 1024 * KB_IN_BYTES, 2, '1.00 MB' ),
array( MB_IN_BYTES, 0, '1 MB' ),
array( 2.5 * MB_IN_BYTES, 0, '3 MB' ),
array( 2.5 * MB_IN_BYTES, 2, '2.50 MB' ),
- // Gigabytes
+ // Gigabytes.
array( (string) 1024 * MB_IN_BYTES, 2, '1.00 GB' ),
array( GB_IN_BYTES, 0, '1 GB' ),
array( 2.5 * GB_IN_BYTES, 0, '3 GB' ),
array( 2.5 * GB_IN_BYTES, 2, '2.50 GB' ),
- // Terabytes
+ // Terabytes.
array( (string) 1024 * GB_IN_BYTES, 2, '1.00 TB' ),
array( TB_IN_BYTES, 0, '1 TB' ),
array( 2.5 * TB_IN_BYTES, 0, '3 TB' ),
array( 2.5 * TB_IN_BYTES, 2, '2.50 TB' ),
- // Petabytes
+ // Petabytes.
array( (string) 1024 * TB_IN_BYTES, 2, '1.00 PB' ),
array( PB_IN_BYTES, 0, '1 PB' ),
array( 2.5 * PB_IN_BYTES, 0, '3 PB' ),
array( 2.5 * PB_IN_BYTES, 2, '2.50 PB' ),
- // Exabytes
+ // Exabytes.
array( (string) 1024 * PB_IN_BYTES, 2, '1.00 EB' ),
array( EB_IN_BYTES, 0, '1 EB' ),
array( 2.5 * EB_IN_BYTES, 0, '3 EB' ),
array( 2.5 * EB_IN_BYTES, 2, '2.50 EB' ),
- // Zettabytes
+ // Zettabytes.
array( (string) 1024 * EB_IN_BYTES, 2, '1.00 ZB' ),
array( ZB_IN_BYTES, 0, '1 ZB' ),
array( 2.5 * ZB_IN_BYTES, 0, '3 ZB' ),
array( 2.5 * ZB_IN_BYTES, 2, '2.50 ZB' ),
- // Yottabytes
+ // Yottabytes.
array( (string) 1024 * ZB_IN_BYTES, 2, '1.00 YB' ),
array( YB_IN_BYTES, 0, '1 YB' ),
array( 2.5 * YB_IN_BYTES, 0, '3 YB' ),
array( 2.5 * YB_IN_BYTES, 2, '2.50 YB' ),
- // Edge values
+ // Edge values.
array( TB_IN_BYTES + ( TB_IN_BYTES / 2 ) + MB_IN_BYTES, 1, '1.5 TB' ),
array( TB_IN_BYTES - MB_IN_BYTES - KB_IN_BYTES, 3, '1,023.999 GB' ),
);
diff --git a/tests/phpunit/tests/functions/wpFilesize.php b/tests/phpunit/tests/functions/wpFilesize.php
new file mode 100644
index 00000000..f0e510dd
--- /dev/null
+++ b/tests/phpunit/tests/functions/wpFilesize.php
@@ -0,0 +1,53 @@
+assertSame( filesize( $file ), wp_filesize( $file ) );
+ }
+
+ /**
+ * @ticket 49412
+ */
+ public function test_wp_filesize_filters() {
+ $file = DIR_TESTDATA . '/images/test-image-upside-down.jpg';
+
+ add_filter(
+ 'wp_filesize',
+ static function() {
+ return 999;
+ }
+ );
+
+ $this->assertSame( 999, wp_filesize( $file ) );
+
+ add_filter(
+ 'pre_wp_filesize',
+ static function() {
+ return 111;
+ }
+ );
+
+ $this->assertSame( 111, wp_filesize( $file ) );
+ }
+
+ /**
+ * @ticket 49412
+ */
+ public function test_wp_filesize_with_nonexistent_file() {
+ $file = 'nonexistent/file.jpg';
+
+ $this->assertSame( 0, wp_filesize( $file ) );
+ }
+}
diff --git a/tests/phpunit/tests/functions/wpListSort.php b/tests/phpunit/tests/functions/wpListSort.php
index 7159af49..e493cd23 100755
--- a/tests/phpunit/tests/functions/wpListSort.php
+++ b/tests/phpunit/tests/functions/wpListSort.php
@@ -12,7 +12,7 @@ class Tests_Functions_wpListSort extends WP_UnitTestCase {
* @dataProvider data_test_wp_list_sort
*
* @param string|array $orderby Either the field name to order by or an array
- * of multiple orderby fields as $orderby => $order.
+ * of multiple orderby fields as `$orderby => $order`.
* @param string $order Either 'ASC' or 'DESC'.
*/
public function test_wp_list_sort( $list, $orderby, $order, $expected ) {
@@ -337,7 +337,7 @@ public function data_test_wp_list_sort() {
* @dataProvider data_test_wp_list_sort_preserve_keys
*
* @param string|array $orderby Either the field name to order by or an array
- * of multiple orderby fields as $orderby => $order.
+ * of multiple orderby fields as `$orderby => $order`.
* @param string $order Either 'ASC' or 'DESC'.
*/
public function test_wp_list_sort_preserve_keys( $list, $orderby, $order, $expected ) {
diff --git a/tests/phpunit/tests/functions/wpListUtil.php b/tests/phpunit/tests/functions/wpListUtil.php
index e27831fc..f455c949 100755
--- a/tests/phpunit/tests/functions/wpListUtil.php
+++ b/tests/phpunit/tests/functions/wpListUtil.php
@@ -64,7 +64,8 @@ public function test_wp_list_util_get_output() {
* @param array $target_array The array to create the list from.
* @param string $target_key The key to pluck.
* @param array $expected The expected array.
- * @param string $index_key Optional. Field from the element to use as keys for the new array. Default null.
+ * @param string $index_key Optional. Field from the element to use as keys for the new array.
+ * Default null.
*/
public function test_wp_list_util_pluck( $target_array, $target_key, $expected, $index_key = null ) {
$util = new WP_List_Util( $target_array );
@@ -156,9 +157,11 @@ public function test_wp_list_util_sort_simple() {
*
* @param array $expected The expected array.
* @param array $target_array The array to create a list from.
- * @param array $orderby Optional. Either the field name to order by or an array of multiple orderby fields as $orderby => $order.
+ * @param array $orderby Optional. Either the field name to order by or an array
+ * of multiple orderby fields as `$orderby => $order`.
* Default empty array.
- * @param string $order Optional. Either 'ASC' or 'DESC'. Only used if $orderby is a string. Default 'ASC'.
+ * @param string $order Optional. Either 'ASC' or 'DESC'. Only used if `$orderby`
+ * is a string. Default 'ASC'.
* @param bool $preserve_keys Optional. Whether to preserve keys. Default false.
*/
public function test_wp_list_util_sort( $expected, $target_array, $orderby = array(), $order = 'ASC', $preserve_keys = false ) {
@@ -955,9 +958,11 @@ public function data_wp_list_util_sort_object_arrays() {
*
* @param array $expected The expected array.
* @param array $target_array The array to create a list from.
- * @param array $orderby Optional. Either the field name to order by or an array of multiple orderby fields as $orderby => $order.
+ * @param array $orderby Optional. Either the field name to order by or an array
+ * of multiple orderby fields as `$orderby => $order`.
* Default empty array.
- * @param string $order Optional. Either 'ASC' or 'DESC'. Only used if $orderby is a string. Default 'ASC'.
+ * @param string $order Optional. Either 'ASC' or 'DESC'. Only used if `$orderby`
+ * is a string. Default 'ASC'.
* @param bool $preserve_keys Optional. Whether to preserve keys. Default false.
*/
public function test_wp_list_util_sort_php_7_or_greater( $expected, $target_array, $orderby = array(), $order = 'ASC', $preserve_keys = false ) {
diff --git a/tests/phpunit/tests/functions/wpNonceField.php b/tests/phpunit/tests/functions/wpNonceField.php
index ec2c6872..2596402b 100755
--- a/tests/phpunit/tests/functions/wpNonceField.php
+++ b/tests/phpunit/tests/functions/wpNonceField.php
@@ -14,7 +14,6 @@ class Tests_Functions_wpNonceField extends WP_UnitTestCase {
* @ticket 55578
*/
public function test_wp_nonce_field() {
-
wp_nonce_field();
$this->expectOutputRegex( '#^$#' );
}
@@ -24,14 +23,13 @@ public function test_wp_nonce_field() {
*
* @dataProvider data_wp_nonce_field
*
- * @param int|string $action Action name.
- * @param string $name Nonce name.
- * @param bool $referer Whether to set the referer field fior validation.
- * @param string $expected_reg_exp The expected regular expression.
+ * @param int|string $action Action name.
+ * @param string $name Nonce name.
+ * @param bool $referer Whether to set the referer field for validation.
+ * @param string $expected_regexp The expected regular expression.
*/
- public function test_wp_nonce_field_return( $action, $name, $referer, $expected_reg_exp ) {
-
- $this->assertMatchesRegularExpression( $expected_reg_exp, wp_nonce_field( $action, $name, $referer, false ) );
+ public function test_wp_nonce_field_return( $action, $name, $referer, $expected_regexp ) {
+ $this->assertMatchesRegularExpression( $expected_regexp, wp_nonce_field( $action, $name, $referer, false ) );
}
/**
@@ -40,37 +38,36 @@ public function test_wp_nonce_field_return( $action, $name, $referer, $expected_
* @return array
*/
public function data_wp_nonce_field() {
-
return array(
'default' => array(
- 'action' => - 1,
- 'name' => '_wpnonce',
- 'referer' => true,
- 'expected_reg_exp' => '#^$#',
+ 'action' => -1,
+ 'name' => '_wpnonce',
+ 'referer' => true,
+ 'expected_regexp' => '#^$#',
),
'nonce_name' => array(
- 'action' => - 1,
- 'name' => 'nonce_name',
- 'referer' => true,
- 'expected_reg_exp' => '#^$#',
+ 'action' => -1,
+ 'name' => 'nonce_name',
+ 'referer' => true,
+ 'expected_regexp' => '#^$#',
),
'action_name' => array(
- 'action' => 'action_name',
- 'name' => '_wpnonce',
- 'referer' => true,
- 'expected_reg_exp' => '#^$#',
+ 'action' => 'action_name',
+ 'name' => '_wpnonce',
+ 'referer' => true,
+ 'expected_regexp' => '#^$#',
),
'no_referer' => array(
- 'action' => - 1,
- 'name' => '_wpnonce',
- 'referer' => false,
- 'expected_reg_exp' => '#^$#',
+ 'action' => -1,
+ 'name' => '_wpnonce',
+ 'referer' => false,
+ 'expected_regexp' => '#^$#',
),
'& in name' => array(
- 'action' => - 1,
- 'name' => 'a&b',
- 'referer' => false,
- 'expected_reg_exp' => '#^$#',
+ 'action' => -1,
+ 'name' => 'a&b',
+ 'referer' => false,
+ 'expected_regexp' => '#^$#',
),
);
}
diff --git a/tests/phpunit/tests/functions/wpRefererField.php b/tests/phpunit/tests/functions/wpRefererField.php
index 6442e7a0..ca72d078 100755
--- a/tests/phpunit/tests/functions/wpRefererField.php
+++ b/tests/phpunit/tests/functions/wpRefererField.php
@@ -14,8 +14,8 @@ class Tests_Functions_wpRefererField extends WP_UnitTestCase {
* @ticket 55578
*/
public function test_wp_referer_field() {
-
$_SERVER['REQUEST_URI'] = '/test/';
+
wp_referer_field();
$this->expectOutputString( '' );
}
@@ -24,7 +24,6 @@ public function test_wp_referer_field() {
* @ticket 55578
*/
public function test_wp_referer_field_return() {
-
$_SERVER['REQUEST_URI'] = '/test/';
$this->assertSame( '', wp_referer_field( false ) );
diff --git a/tests/phpunit/tests/media/wpGenerateAttachmentMetadata.php b/tests/phpunit/tests/media/wpGenerateAttachmentMetadata.php
new file mode 100644
index 00000000..82fe7dab
--- /dev/null
+++ b/tests/phpunit/tests/media/wpGenerateAttachmentMetadata.php
@@ -0,0 +1,89 @@
+remove_added_uploads();
+
+ parent::tear_down();
+ }
+
+ /**
+ * Tests that filesize meta is generated for JPEGs.
+ *
+ * @ticket 49412
+ *
+ * @covers ::wp_create_image_subsizes
+ */
+ public function test_wp_generate_attachment_metadata_includes_filesize_in_jpg_meta() {
+ $attachment = $this->factory->attachment->create_upload_object( DIR_TESTDATA . '/images/canola.jpg' );
+
+ $metadata = wp_get_attachment_metadata( $attachment );
+
+ $this->assertSame( wp_filesize( get_attached_file( $attachment ) ), $metadata['filesize'] );
+
+ foreach ( $metadata['sizes'] as $intermediate_size ) {
+ $this->assertArrayHasKey( 'filesize', $intermediate_size );
+ $this->assertNotEmpty( $intermediate_size['filesize'] );
+ $this->assertIsNumeric( $intermediate_size['filesize'] );
+ }
+ }
+
+ /**
+ * Checks that filesize meta is generated for PNGs.
+ *
+ * @ticket 49412
+ *
+ * @covers ::wp_create_image_subsizes
+ */
+ public function test_wp_generate_attachment_metadata_includes_filesize_in_png_meta() {
+ $attachment = $this->factory->attachment->create_upload_object( DIR_TESTDATA . '/images/test-image.png' );
+
+ $metadata = wp_get_attachment_metadata( $attachment );
+
+ $this->assertSame( wp_filesize( get_attached_file( $attachment ) ), $metadata['filesize'] );
+ }
+
+ /**
+ * Checks that filesize meta is generated for PDFs.
+ *
+ * @ticket 49412
+ */
+ public function test_wp_generate_attachment_metadata_includes_filesize_in_pdf_meta() {
+ $attachment = $this->factory->attachment->create_upload_object( DIR_TESTDATA . '/images/wordpress-gsoc-flyer.pdf' );
+
+ $metadata = wp_get_attachment_metadata( $attachment );
+
+ $this->assertSame( wp_filesize( get_attached_file( $attachment ) ), $metadata['filesize'] );
+ }
+
+ /**
+ * Checks that filesize meta is generated for PSDs.
+ *
+ * @ticket 49412
+ */
+ public function test_wp_generate_attachment_metadata_includes_filesize_in_psd_meta() {
+ if ( is_multisite() ) {
+ // PSD mime type is not allowed by default on multisite.
+ add_filter(
+ 'upload_mimes',
+ static function( $mimes ) {
+ $mimes['psd'] = 'application/octet-stream';
+ return $mimes;
+ }
+ );
+ }
+
+ $attachment = $this->factory->attachment->create_upload_object( DIR_TESTDATA . '/images/test-image.psd' );
+
+ $metadata = wp_get_attachment_metadata( $attachment );
+
+ $this->assertSame( wp_filesize( get_attached_file( $attachment ) ), $metadata['filesize'] );
+ }
+}
diff --git a/tests/phpunit/tests/media/wpImageTagAddDecodingAttr.php b/tests/phpunit/tests/media/wpImageTagAddDecodingAttr.php
index 76fa203b..3ffe1bc6 100755
--- a/tests/phpunit/tests/media/wpImageTagAddDecodingAttr.php
+++ b/tests/phpunit/tests/media/wpImageTagAddDecodingAttr.php
@@ -1,7 +1,7 @@
assertFileExists( $file1['file'] );
$this->assertFileDoesNotExist( $file2['file'] );
+
+ unlink( $file1['file'] );
}
}
diff --git a/tests/phpunit/tests/multisite/site.php b/tests/phpunit/tests/multisite/site.php
index 6507fbbf..a3e179a8 100755
--- a/tests/phpunit/tests/multisite/site.php
+++ b/tests/phpunit/tests/multisite/site.php
@@ -398,6 +398,8 @@ public function test_upload_directories_after_multiple_wpmu_delete_blog() {
// The file on the main site should still exist. The file on the deleted site should not.
$this->assertFileExists( $file1['file'] );
$this->assertFileDoesNotExist( $file2['file'] );
+
+ unlink( $file1['file'] );
}
public function test_wpmu_update_blogs_date() {
diff --git a/tests/phpunit/tests/pluggable/signatures.php b/tests/phpunit/tests/pluggable/signatures.php
index a802b037..71c70296 100755
--- a/tests/phpunit/tests/pluggable/signatures.php
+++ b/tests/phpunit/tests/pluggable/signatures.php
@@ -76,7 +76,7 @@ public function test_all_pluggable_functions_exist() {
*/
public function get_defined_pluggable_functions() {
- require_once ABSPATH . '/wp-admin/includes/upgrade.php';
+ require_once ABSPATH . 'wp-admin/includes/upgrade.php';
$test_functions = array(
'install_network',
@@ -103,7 +103,7 @@ public function get_defined_pluggable_functions() {
}
foreach ( $test_files as $file ) {
- preg_match_all( '#^\t?function (\w+)#m', file_get_contents( ABSPATH . '/' . $file ), $functions );
+ preg_match_all( '#^\t?function (\w+)#m', file_get_contents( ABSPATH . $file ), $functions );
foreach ( $functions[1] as $function ) {
$data[] = array(
diff --git a/tests/phpunit/tests/pluggable/wpMail.php b/tests/phpunit/tests/pluggable/wpMail.php
index bbe27bd8..68982d60 100755
--- a/tests/phpunit/tests/pluggable/wpMail.php
+++ b/tests/phpunit/tests/pluggable/wpMail.php
@@ -173,7 +173,7 @@ public function test_wp_mail_return_value() {
$this->assertTrue( wp_mail( 'valid@address.com', 'subject', 'body' ) );
// Non-fatal errors.
- $this->assertTrue( wp_mail( 'valid@address.com', 'subject', 'body', "Cc: invalid-address\nBcc: @invalid.address", ABSPATH . '/non-existent-file.html' ) );
+ $this->assertTrue( wp_mail( 'valid@address.com', 'subject', 'body', "Cc: invalid-address\nBcc: @invalid.address", ABSPATH . 'non-existent-file.html' ) );
// Fatal errors.
$this->assertFalse( wp_mail( 'invalid.address', 'subject', 'body', '', array() ) );
diff --git a/tests/phpunit/tests/pomo/po.php b/tests/phpunit/tests/pomo/po.php
index d7652f27..8c58099b 100755
--- a/tests/phpunit/tests/pomo/po.php
+++ b/tests/phpunit/tests/pomo/po.php
@@ -48,7 +48,7 @@ class Tests_POMO_PO extends WP_UnitTestCase {
public static function set_up_before_class() {
parent::set_up_before_class();
- require_once ABSPATH . '/wp-includes/pomo/po.php';
+ require_once ABSPATH . 'wp-includes/pomo/po.php';
}
public function test_prepend_each_line() {
diff --git a/tests/phpunit/tests/post.php b/tests/phpunit/tests/post.php
index 7d0a5bc0..14da9703 100755
--- a/tests/phpunit/tests/post.php
+++ b/tests/phpunit/tests/post.php
@@ -285,7 +285,7 @@ public function test_utf8mb3_post_saves_with_emoji() {
$this->markTestSkipped( 'This test is only useful with the utf8 character set.' );
}
- require_once ABSPATH . '/wp-admin/includes/post.php';
+ require_once ABSPATH . 'wp-admin/includes/post.php';
$post_id = self::factory()->post->create();
diff --git a/tests/phpunit/tests/query/postStatus.php b/tests/phpunit/tests/query/postStatus.php
index 1ab8aa84..238551b5 100755
--- a/tests/phpunit/tests/query/postStatus.php
+++ b/tests/phpunit/tests/query/postStatus.php
@@ -87,7 +87,7 @@ public function set_up() {
* Register custom post types and statuses used in multiple tests.
*
* CPTs and CPSs are reset between each test run so need to be registered
- * in both the wpSetUpBeforeClass() and setUp() methods.
+ * in both the wpSetUpBeforeClass() and set_up() methods.
*/
public static function register_custom_post_objects() {
register_post_type(
diff --git a/tests/phpunit/tests/rest-api/rest-posts-controller.php b/tests/phpunit/tests/rest-api/rest-posts-controller.php
index df64b296..899b7fa8 100755
--- a/tests/phpunit/tests/rest-api/rest-posts-controller.php
+++ b/tests/phpunit/tests/rest-api/rest-posts-controller.php
@@ -1529,6 +1529,7 @@ public function test_get_items_not_sticky_with_exclude_no_sticky_posts() {
/**
* @ticket 55592
+ *
* @covers WP_REST_Posts_Controller::get_items
* @covers ::update_post_thumbnail_cache
*/
@@ -1566,6 +1567,7 @@ public function test_get_items_primes_thumbnail_cache_for_featured_media() {
/**
* @ticket 55593
+ *
* @covers WP_REST_Posts_Controller::get_items
* @covers ::update_post_parent_caches
*/
diff --git a/tests/phpunit/tests/user/capabilities.php b/tests/phpunit/tests/user/capabilities.php
index a3b81b54..9cb46270 100755
--- a/tests/phpunit/tests/user/capabilities.php
+++ b/tests/phpunit/tests/user/capabilities.php
@@ -1707,7 +1707,7 @@ public function test_borked_current_user_can_for_blog() {
}
public function nullify_current_user() {
- // Prevents fatal errors in ::tearDown()'s and other uses of restore_current_blog().
+ // Prevents fatal errors in ::tear_down()'s and other uses of restore_current_blog().
$function_stack = wp_debug_backtrace_summary( null, 0, false );
if ( in_array( 'restore_current_blog', $function_stack, true ) ) {
return;
diff --git a/tests/phpunit/tests/widgets.php b/tests/phpunit/tests/widgets.php
index 440bac21..a89f7c8d 100755
--- a/tests/phpunit/tests/widgets.php
+++ b/tests/phpunit/tests/widgets.php
@@ -708,7 +708,7 @@ public function test_wp_widget_control() {
);
wp_widgets_init();
- require_once ABSPATH . '/wp-admin/includes/widgets.php';
+ require_once ABSPATH . 'wp-admin/includes/widgets.php';
$widget_id = 'search-2';
$widget = $wp_registered_widgets[ $widget_id ];
$params = array(