Commit Graph

42403 Commits

Author SHA1 Message Date
Sergey Biryukov
c8b5610b91 Taxonomy: Make sure wp_terms_checklist() and Walker_Category_Checklist::start_el() properly handle an array of strings as selected_cats or popular_cats values.
Even with these values documented as an array of integers, they can technically also accept an array of strings, e.g. as form results.

Add a unit test.

Props brianhogg, TimothyBlynJacobs, SergeyBiryukov.
Fixes #51137.

git-svn-id: https://develop.svn.wordpress.org/trunk@48880 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-27 02:46:22 +00:00
Sergey Biryukov
3f7add7d99 Tests: Update one more test to account for lazy-loading being disabled for custom logos by default.
Follow-up to [48870], [48874].

Props desrosj.
See #50933.

git-svn-id: https://develop.svn.wordpress.org/trunk@48878 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-27 02:01:51 +00:00
Sergey Biryukov
3066546426 Comments: Correct the check for reply element existence in comment-reply.js.
`document.getElementById()` returns `null` if no matching element was found, so the previous comparison didn't work as expected.

Follow-up to [47506].

Props mailnew2ster, sarahricker.
Fixes #38009.

git-svn-id: https://develop.svn.wordpress.org/trunk@48876 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-27 01:56:39 +00:00
Sergey Biryukov
c77798da22 Tests: Update unit tests to account for lazy-loading being disabled for custom logos by default.
Follow-up to [48870].

See #50933.

git-svn-id: https://develop.svn.wordpress.org/trunk@48874 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-27 01:53:48 +00:00
Peter Wilson
bae635f1a0 Sitemaps: Prevent incorrect redirection of paged sitemap requests.
Update `redirect_canonical()` to account for custom pagination and URL format used by sitemaps in order to follow standard practices.

Introduce the function `get_sitemap_url()` to simplify getting the index and provider URLs as needed.

Props jonathanstegall, pbiron, GamerZ, salvoaranzulla, peterwilsoncc.
Fixes #50910.



git-svn-id: https://develop.svn.wordpress.org/trunk@48872 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-27 01:28:24 +00:00
Jonathan Desrosiers
066882a4a8 Media: Disable lazy-loading for custom logos by default.
Custom site logos are most commonly displayed above the fold, so lazy-loading is unnecessary.

Props demetris, khag7, johnbillion, rebasaurus, audrasjb.
Fixes #50933.

git-svn-id: https://develop.svn.wordpress.org/trunk@48870 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-27 01:06:01 +00:00
Sergey Biryukov
c7f5af72dc Upgrade/Install: Make the check for empty home option in __get_option() more resilient.
This addresses a regression in [47808], where the `home` check expected an empty string to use `siteurl` as a fallback, but `wpdb::get_var()` returns `null` if the option is empty.

Props fjarrett.
Fixes #51011.

git-svn-id: https://develop.svn.wordpress.org/trunk@48868 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-26 16:55:36 +00:00
Sergey Biryukov
2a9c68872e Quick/Bulk Edit: Revert [48134] to address the bottom "Bulk actions" dropdown not functioning properly on Posts and Users list tables.
A better solution for the original issue will be explored in a future release.

Props audrasjb, garrett-eclipse, webzunft, Krstarica, chunkysteveo, SergeyBiryukov.
Fixes #50882, #50998. See #46872.

git-svn-id: https://develop.svn.wordpress.org/trunk@48866 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-26 14:16:12 +00:00
Sergey Biryukov
efc5c63254 Editor: Remove some hardcoded text color values from patterns that have body text with no specific background color.
This ensures that the patterns respect the theme's default color for body text and avoids contrast issues, particularly in dark themes.

Props nrqsnchz, mapk, fullofcaffeine.
Fixes #50892.

git-svn-id: https://develop.svn.wordpress.org/trunk@48864 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-26 13:32:05 +00:00
Sergey Biryukov
cae856c8eb Administration: Remove non-color related styling from Modern color scheme.
Color schemes should only affect colors, to avoid diverging from a consistent and predictable layout, especially if core CSS rules subsequently change.

Follow-up to [48277], [48286], [48345].

Props Joen, johnbillion, afercia, johnjamesjacoby.
Fixes #51127. See #50504.

git-svn-id: https://develop.svn.wordpress.org/trunk@48862 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-26 13:17:36 +00:00
Sergey Biryukov
ad9f02ed80 Twenty Twenty: Add context to adjectives and homonyms.
This allows for better localization in languages where adjectives are translated differently depending on which noun they modify, or when a different translation is required for a noun vs. a verb.

Props dimadin, justinahinon.
Fixes #49797.

git-svn-id: https://develop.svn.wordpress.org/trunk@48861 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-26 01:33:45 +00:00
Sergey Biryukov
04d555e91d Editor: Make some hardcoded strings in block patterns translatable.
Follow-up to [48726].

Props justinahinon, audrasjb, nabilmoqbel, tobifjellner, yoavf, ramiy.
Fixes #50845.

git-svn-id: https://develop.svn.wordpress.org/trunk@48859 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-25 12:38:21 +00:00
Sergey Biryukov
c20372e0aa Tests: Clean up some existing @covers tags.
The `()` at the end is unnecessary and disregarded by PHPUnit, so can be removed.

Props jrf.
See #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@48858 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-25 00:57:17 +00:00
Sergey Biryukov
25c9718a1e Bootstrap/Load: Add local environment type to wp_get_environment_type().
This gives developers a better control over their existing development workflow and ensures that `local` is not the exact same as `development` if it does not need to be.

Props claytoncollie, johnbillion, jeremyfelt, kreppar, dushakov, TimothyBlynJacobs, Ipstenu, khag7, knutsp, Clorith, markjaquith, joostdevalk, SergeyBiryukov.
Fixes #51064.

git-svn-id: https://develop.svn.wordpress.org/trunk@48856 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-24 22:30:36 +00:00
Sergey Biryukov
8e7e3c5b72 Docs: Improve documentation for wp_lazy_loading_enabled() per the documentation standards.
See #50768.

git-svn-id: https://develop.svn.wordpress.org/trunk@48855 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-24 22:14:17 +00:00
Sergey Biryukov
4869de2a1c Docs: Add a @since note about the $srcset and $sizes attributes added to wp_get_attachment_image().
Follow-up to [34855].

See #51122.

git-svn-id: https://develop.svn.wordpress.org/trunk@48853 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-24 22:10:25 +00:00
Sergey Biryukov
62260b9fbf Docs: Add documentation and a @since note about the loading attribute added to wp_get_attachment_image().
Follow-up to [48272].

Props audrasjb.
Fixes #51122.

git-svn-id: https://develop.svn.wordpress.org/trunk@48852 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-24 22:02:44 +00:00
Sergey Biryukov
ce10049fcc Administration: Don't print the .php-error class in the admin header for PHP notices in wp-config.php.
Any notices in that file happen before `WP_DEBUG` takes effect,	and should not be displayed with the `error_reporting` level previously set in `wp-load.php`.

Adding the class when there is no notice displayed results in extra padding under the admin bar, which should be avoided.

Follow-up to [20102], [21025], [26620], [47745].

Props akissz, tw2113, laxman-prajapati, sabernhardt, johnbillion, SergeyBiryukov.
Fixes #51073.

git-svn-id: https://develop.svn.wordpress.org/trunk@48850 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-24 10:46:30 +00:00
Sergey Biryukov
a6bb0120ac Tests: Correct a number of malformed @covers tags.
As per the documentation of the `@covers` tag, global functions being covered should be prefixed with `::`. Also, the `()` after the function name is redundant.

Follow-up to [39918].

Props jrf.
See #50267.

git-svn-id: https://develop.svn.wordpress.org/trunk@48848 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-23 17:23:52 +00:00
Sergey Biryukov
e353e266a0 Build/Test Tools: Update code coverage setup in the phpunit.xml.dist file to point to the build directory.
This makes the configuration consistent with the `WP_RUN_CORE_TESTS` constant being set to `1` in the same config file.

Additionally, update the list to be in line with the current codebase, excluding the plugins and themes bundled with WordPress core from being considered for code coverage.

Note: If you have a local `phpunit.xml` file that changes the `WP_RUN_CORE_TESTS` constant to `0`, you should also - in the same file - change the code coverage setup to use the `src` directory.

Follow-up to [42665], [43311].

Props jrf, mmarco9.
See #50267.

git-svn-id: https://develop.svn.wordpress.org/trunk@48847 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-23 17:22:28 +00:00
Sergey Biryukov
631f440506 Tests: Update wp-api-generated.js to reflect the new "Reusable Blocks" post type label.
Follow-up to [48829].

See #50755.

git-svn-id: https://develop.svn.wordpress.org/trunk@48846 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-23 14:38:40 +00:00
Sergey Biryukov
cc7fa67925 General: Ensure svn:eol-style is consistently set for all recently added files.
Fixes #51113.

git-svn-id: https://develop.svn.wordpress.org/trunk@48845 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-23 14:34:06 +00:00
Sergey Biryukov
c90037ca47 Tests: Clear any previous term IDs from the metadata lazyloader queue in term meta lazy-loading test.
This fixes random test failures when one of the term IDs from previous tests coincides with the orphan term ID from this test that should not be lazy-loaded.

Follow-up to [34529], [36566].

Fixes #51109.

git-svn-id: https://develop.svn.wordpress.org/trunk@48844 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-23 03:46:41 +00:00
Sergey Biryukov
380145e073 Docs: Update the description for the $legacy parameter of wp_count_terms() for consistency with get_terms().
Follow-up to [48840].

See #36399.

git-svn-id: https://develop.svn.wordpress.org/trunk@48843 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-23 00:06:04 +00:00
Sergey Biryukov
153d07b93a REST API: In WP_REST_Block_Directory_Controller::get_items(), make sure the blocks data for a plugin is not empty before proceeding.
This avoids a PHP notice if the API returns a plugin with empty data for `blocks` key.

Props khag7, TwentyZeroTwo, justinahinon, TimothyBlynJacobs, dd32, SergeyBiryukov.
Fixes #51018.

git-svn-id: https://develop.svn.wordpress.org/trunk@48842 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-22 01:52:42 +00:00
Sergey Biryukov
2e2ef9e538 Editor: Use wp_add_inline_script() instead of wp_localize_script() to pass the _wpMetaBoxUrl value to the wp-editor script.
This fixes a PHP 8 "Only the first byte will be assigned to the string offset" warning on Edit Post screen.

The correct usage of `wp_localize_script()` is to pass an array of data, not a string.

Fixes #51108.

git-svn-id: https://develop.svn.wordpress.org/trunk@48841 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-22 00:03:01 +00:00
Felix Arntz
0228dd6a5d Taxonomy: Allow for wp_count_terms( $args ) signature, making passing a taxonomy optional.
This brings `wp_count_terms()` in line with other taxonomy functions such as `get_terms()` which technically no longer require a taxonomy. Similar to the previously modified functions, no deprecation warning is triggered when using the legacy signature.

Fixes #36399.


git-svn-id: https://develop.svn.wordpress.org/trunk@48840 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-21 22:30:06 +00:00
Sergey Biryukov
3b1d1bfa7a Code Modernization: Fix PHP 8 "ArgumentCountError: array_merge() does not accept unknown named parameters" fatal error in retrieve_widgets().
As per the documentation of `call_user_func_array()`, the `$param_arr` should be a (numerically) indexed array, not a string-keyed array.

As we can use the spread operator in PHP 5.6+, there isn't really any need to use `call_user_func_array()` anyhow, we can call the `array_merge()` function directly.

The caveat to this is that the spread operator only works on numerically indexed arrays, so we need to wrap the `$sidebars_widgets` variable in a call to `array_values()` when using the spread operator.

Using `array_values()` in the existing `call_user_func_array()` call would also have solved this, but the solution now proposed, has the added benefit of getting rid of the overhead of `call_user_func_array()`.

Props jrf.
See #50913.

git-svn-id: https://develop.svn.wordpress.org/trunk@48839 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-21 21:49:02 +00:00
Sergey Biryukov
29bfc56ca2 Code Modernization: Fix PHP 8 "argument must be passed by reference, value given" error in WP_Comment_Query::get_comments().
The WP native `get_comment()` function expects the first argument `$comment` to be passed by reference.

The PHP `array_map()` function, however, passes by value, not by reference, resulting in an "arguments must be passed by reference, value given" error.

The PHP native `array_walk()` function does pass by reference. Using this prevents the error on PHP 8 and maintains the existing behaviour on PHP < 8.

Props jrf.
See #50913.

git-svn-id: https://develop.svn.wordpress.org/trunk@48838 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-21 21:32:49 +00:00
Sergey Biryukov
387bbeb286 Twenty Nineteen: Remove trailing commas after selectors in style-editor.scss.
Remove one empty CSS block.

Props justinahinon.
Fixes #51095.

git-svn-id: https://develop.svn.wordpress.org/trunk@48837 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-21 15:40:56 +00:00
Sergey Biryukov
493a88c666 Privacy: Avoid a PHP 7.4 notice in WP_Privacy_Policy_Content::text_change_check().
When iterating over the items stored in '_wp_suggested_privacy_policy_content` meta value for the Privacy Policy page, make sure the item is an array before accessing its properties.

Props treibstoff.
Fixes #51084.

git-svn-id: https://develop.svn.wordpress.org/trunk@48836 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-21 01:11:19 +00:00
Sergey Biryukov
e87d86b2ae Docs: Correct references to WP_Filesystem_Base methods in various DocBlocks.
Props pbiron.
Fixes #51087.

git-svn-id: https://develop.svn.wordpress.org/trunk@48835 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-21 00:41:43 +00:00
Sergey Biryukov
5ad8969179 Customize: Add / character to <img> tag in WP_Customize_Manager and WP_Customize_Header_Image_Control JS templates.
While this has no effect on void elements in HTML5, it fixes a minor inconsistency with the rest of core.

Props laxman-prajapati.
Fixes #51077.

git-svn-id: https://develop.svn.wordpress.org/trunk@48834 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-20 13:11:36 +00:00
Sergey Biryukov
1b78e495b2 Docs: Update documentation for get_custom_logo() and the_custom_logo() to mention the unlink-homepage-logo theme feature.
Follow-up to [48039], [48283], [48749], [48757], [48758].

Props sabernhardt.
Fixes #51075.

git-svn-id: https://develop.svn.wordpress.org/trunk@48832 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-20 10:39:12 +00:00
Sergey Biryukov
ca5c4cebef Coding Standards: Fix WPCS issue in [48830].
See #51044.

git-svn-id: https://develop.svn.wordpress.org/trunk@48831 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-19 16:33:02 +00:00
Sergey Biryukov
62562f8428 Tests: Update unit tests to account for comment_agent and comment_author_IP values being passed to the preprocess_comment filter.
See #51044.

git-svn-id: https://develop.svn.wordpress.org/trunk@48830 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-19 16:06:27 +00:00
Jonathan Desrosiers
de70dabf63 Editor: Update the post type labels for the reusable blocks post type.
Previously, the labels for the reusable block post type were just “block”. The document settings tab in the block editor has been changed to use the post type label specified instead to be more specific. Changing the reusable block post type labels to “reusable block” prevents two “Block” tabs from showing in the editor.

Props desaiuditd, peterwilsoncc.
Fixes #50755.

git-svn-id: https://develop.svn.wordpress.org/trunk@48829 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-19 13:38:56 +00:00
Sergey Biryukov
ab12557628 Docs: Add a @since note to register_rest_route() about the _doing_it_wrong() notice when the required permission_callback argument is not set.
Follow-up to [48526].

Props psykro.
Fixes #51060.

git-svn-id: https://develop.svn.wordpress.org/trunk@48827 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-19 12:29:34 +00:00
Sergey Biryukov
de73a6a8e9 Docs: Improve description for WP_Admin_Bar::add_group().
Props stevenlinx.
Fixes #50779.

git-svn-id: https://develop.svn.wordpress.org/trunk@48826 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-19 02:44:38 +00:00
Sergey Biryukov
c101a86baf Bundled Themes: Correct punctuation in "Your comment is awaiting moderation" string.
Props llizard, mayankmajeji.
Fixes #49867.

git-svn-id: https://develop.svn.wordpress.org/trunk@48825 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-19 02:25:46 +00:00
Sergey Biryukov
27a2494ebe Comments: Correct punctuation in "Your comment is awaiting moderation" string in Walker_Comment.
Props llizard.
See #49867.

git-svn-id: https://develop.svn.wordpress.org/trunk@48824 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-19 02:25:13 +00:00
Sergey Biryukov
2b3bf40907 Comments: Revert unintended changes from [48822].
See #51044.

git-svn-id: https://develop.svn.wordpress.org/trunk@48823 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-19 01:57:29 +00:00
Sergey Biryukov
5f861293e6 Comments: Make sure the comment data passed to the preprocess_comment filter includes the comment_agent and comment_author_IP values.
Props zodiac1978, SergeyBiryukov.
Fixes #51044.

git-svn-id: https://develop.svn.wordpress.org/trunk@48822 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-19 01:55:12 +00:00
Sergey Biryukov
c65973e0f5 Plugins: Avoid a PHP notice if the update-supported key in plugin data is not set.
Props sanzeeb3.
Fixes #51052.

git-svn-id: https://develop.svn.wordpress.org/trunk@48820 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-18 20:36:42 +00:00
Jonathan Desrosiers
5cec68d0c9 Build/Test Tools: Update several NPM dependencies.
These updates were applied by running `npm audit fix`.

See #50769.

git-svn-id: https://develop.svn.wordpress.org/trunk@48818 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-18 15:16:57 +00:00
Sergey Biryukov
76c599ced2 Formatting: Make the check for empty text in wp_trim_excerpt() more resilient.
This addresses a regression in [47808], which caused excerpts to be generated from post content if an empty string is passed, but not for other values considered empty, e.g. `null` or `false`.

Props riaanlom, laxman-prajapati, SergeyBiryukov.
Fixes #51042.

git-svn-id: https://develop.svn.wordpress.org/trunk@48817 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-18 15:08:19 +00:00
Sergey Biryukov
1911eae4a1 Docs: Correct alignment for some DocBlocks in WP_Query::get_posts().
See #50768.

git-svn-id: https://develop.svn.wordpress.org/trunk@48816 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-18 12:37:39 +00:00
Sergey Biryukov
89ea6ce552 Docs: Add a @since note to get_the_archive_title() about the title part being wrapped in a <span> element.
Follow-up to [48294].

Props justinahinon, audrasjb.
Fixes #51050.

git-svn-id: https://develop.svn.wordpress.org/trunk@48814 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-18 12:03:24 +00:00
Sergey Biryukov
7d0dc26c96 Accessibility: Toolbar: Don't output the "Skip to toolbar" link in modern themes that support the wp_body_open action.
The links is unnecessary there, as the toolbar is the first thing in the DOM within the `<body>` element.

For themes that don't implement the `wp_body_open` action yet and render the admin bar in the footer, the "Skip to toolbar" link with `tabindex="1"` is still necessary, to ensure it's the first focusable element in the page.

Props sarahricker, afercia, erikjandelange, audrasjb.
Fixes #50702.

git-svn-id: https://develop.svn.wordpress.org/trunk@48812 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-17 14:24:30 +00:00
Sergey Biryukov
09a3a6e7bd Help/About: Fix typo and remove trailing spaces from some strings.
Props mukesh27, casiepa, davidbaumwald.
Fixes #51028.

git-svn-id: https://develop.svn.wordpress.org/trunk@48809 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-17 02:10:55 +00:00