Commit Graph

41990 Commits

Author SHA1 Message Date
Sergey Biryukov
43c193f58b Tests: Ignore EOL differences in email tests using multiline string assertions.
Unix vs. Windows EOL style mismatches can cause misleading failures in tests using the heredoc syntax (`<<<`) or multiline strings as the expected result.

Follow-up to [46612], [48033].

Props davidbaumwald.
See #31432, #41750.

git-svn-id: https://develop.svn.wordpress.org/trunk@48443 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-11 23:27:51 +00:00
Sergey Biryukov
accf884aac Docs: Correct comments in tests/formatting/WPSlash.php per the documentation standards.
See #49572.

git-svn-id: https://develop.svn.wordpress.org/trunk@48442 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-11 22:50:36 +00:00
Sergey Biryukov
4d964a8cf2 Docs: Synchronize @since notes for add_magic_quotes() and wp_slash().
Follow-up to [48205], [48433].

See #49572.

git-svn-id: https://develop.svn.wordpress.org/trunk@48441 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-11 22:46:27 +00:00
Sergey Biryukov
7137014901 Bootstrap/Load: Adjust the logic in add_magic_quotes() for better readability.
Follow-up to [48205].

See #48605.

git-svn-id: https://develop.svn.wordpress.org/trunk@48440 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-11 22:42:35 +00:00
Sergey Biryukov
a9368a89e5 Menus: Simplify the test for wp_update_nav_menu_item() with special characters in category name.
The `menu-item-title` value is saved as a `post_title` property, so the resulting property can be checked directly, without a callback.

Follow-up to [48416].

See #48011.

git-svn-id: https://develop.svn.wordpress.org/trunk@48439 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-11 21:46:29 +00:00
Sergey Biryukov
d5cfd5c63c Revisions: Restore the return value of wp_get_post_autosave() to the documented type of WP_Post for backward compatibility.
Follow-up to [48422].

See #34560.

git-svn-id: https://develop.svn.wordpress.org/trunk@48438 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-11 21:13:56 +00:00
Timothy Jacobs
8f39f8ebb7 REST API: Sanitize block renderer attributes.
In [48069] the Block Renderer was changed to register a single route for all dynamic blocks. Validation was dynamically applied based on the requested block, but sanitization was not. This commit adds the same sanitization back to the block attributes.

Props manooweb.
Fixes #50620. See #48079.


git-svn-id: https://develop.svn.wordpress.org/trunk@48437 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-11 20:32:19 +00:00
Sergey Biryukov
c42b6b5ddb Revisions: Replace array_shift() with reset() in register_and_do_post_meta_boxes() for better performance.
Follow-up to [31829], [48422].

See #34560.

git-svn-id: https://develop.svn.wordpress.org/trunk@48436 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-11 12:28:07 +00:00
Sergey Biryukov
b4232b7de7 Coding Standards: Use strict type check for in_array() in wp-includes/feed.php.
Additionally:
* Correct inline comments per the documentation standards.
* Correct the `@ticket` reference in `tests/feed/atom.php`.

Follow-up to [48429].

See #33591.

git-svn-id: https://develop.svn.wordpress.org/trunk@48435 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-11 12:12:46 +00:00
Jake Spurlock
8dc7f1c348 Build/Test Tools: Bump lodash as part of an npm audit.
lodash 4.17.17 👉 4.17.19

See #49768.


git-svn-id: https://develop.svn.wordpress.org/trunk@48434 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-11 00:34:59 +00:00
Jake Spurlock
21273c3c49 Formatting: Prevent wp_slash from returning non-strings as strings.
If a bool/float/int is passed into wp_slash it will be coerced into a string.

This changes the behavior to only slash strings. At the same time, handles recursion a little nicer by calling array_map for arrays.

Fixes #42195, #24106.

Props johnbillion, andizer, jrf, ryotasakamoto, SergeyBiryukov, donmhico, TobiasBg, markoheijnen, ryan, nacin, devesine, whyisjake.



git-svn-id: https://develop.svn.wordpress.org/trunk@48433 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-11 00:11:57 +00:00
Jake Spurlock
d42bdcb877 Formatting: Improve the docblock for sanitize_title().
Since sanitize title is largely used for html attributes, or post slugs, make note that accents will be removed and that the string will be limited to alphanumeric characters, underscores, and dashes.

Fixes #33756.
Props ericlewis, swissspidy, wonderboymusic, psdtohtmlguru, DrewAPicture, SergeyBiryukov, sjmur, gma992, shulard, ebinnion, whyisjake.



git-svn-id: https://develop.svn.wordpress.org/trunk@48432 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-10 23:26:31 +00:00
Jake Spurlock
7c1ff0845f Coding Standards: Ensure strict type check.
See [48429], #33591.


git-svn-id: https://develop.svn.wordpress.org/trunk@48431 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-10 23:13:16 +00:00
Andrew Ozz
5d85a53292 Media: Tiny logic fix in wp_image_file_matches_image_meta() after [48329]. No need to look in sizes if the full size image path/URL matches.
See #50543.

git-svn-id: https://develop.svn.wordpress.org/trunk@48430 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-10 23:04:08 +00:00
Jake Spurlock
4337c258dc Feeds: Ensure that enclosures produce valid XML.
Metadata that is stored on newlines has the possibility of missing values, so rather then coercing values, we can check for them and then implicity set the values.

Fixes #33591.
Props jonnybot, stevenkword, vtieu, birgire, SergeyBiryukov, davidbaumwald, rebasaurus, whyisjake.



git-svn-id: https://develop.svn.wordpress.org/trunk@48429 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-10 22:21:22 +00:00
Sergey Biryukov
99499966cf Themes: Correct closing tag for the "Enable auto-updates" button in the JS template for theme auto-update setting.
Follow-up to [48418].

See #50516.

git-svn-id: https://develop.svn.wordpress.org/trunk@48428 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-10 22:01:57 +00:00
Sergey Biryukov
d0b6778654 Docs: Improve description for the JS function that hides the update button for expired plugin or theme uploads.
Add missing `@since` tag.

Follow-up to [48417].

See #50612.

git-svn-id: https://develop.svn.wordpress.org/trunk@48427 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-10 21:13:25 +00:00
Sergey Biryukov
72d5862069 Docs: Improve @return tags for various conditional tags.
Props stevenlinx, SergeyBiryukov.
Fixes #50626.

git-svn-id: https://develop.svn.wordpress.org/trunk@48426 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-10 20:21:01 +00:00
Sergey Biryukov
a7a91ba8dc Sitemaps: Remove some extra space from WP_Sitemaps_Stylesheet::get_stylesheet_css().
Follow-up to [48414].

See #50449.

git-svn-id: https://develop.svn.wordpress.org/trunk@48425 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-10 16:10:07 +00:00
Sergey Biryukov
5e160ea4a9 Administration: Bring some consistency to handling list table view modes.
* Remove duplicate variables and DocBlocks.
* Add missing description for the `$mode` global.
* Use sentence case for "Compact view" and "Extended view" labels.

Follow-up to [48398], [48423].

Props afercia, Offereins, SergeyBiryukov.
See #49715.

git-svn-id: https://develop.svn.wordpress.org/trunk@48424 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-10 16:02:00 +00:00
Sergey Biryukov
6c4f6693e5 Administration: Make some adjustments to WP_Screen::render_view_mode():
* Restore the `$mode` global for backward compatibility.
* Remove redundant check, as `$mode` is already set at this point, and already defaults to `list` via `get_user_setting()`'s second argument.
* Use sentence case for "View mode" and "Extended view" labels.

Follow-up to [48398].

See #49715.

git-svn-id: https://develop.svn.wordpress.org/trunk@48423 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-10 16:00:42 +00:00
Adam Silverstein
4adb926ce8 Revisions: optimize performance when post has large number of revisions.
Improve speed and reduce the memory footprint when loading posts with many revisions.

* Use a direct query in `wp_get_post_autosave` to avoid loading all revisions.
* Query for IDs vs full objects in `register_and_do_post_meta_boxes`.

Props pdfernhout, johnnyb, miqrogroove, ocean90, senatorman, DBrumbaugh10Up, martijn-van-der-kooij, pavelevap, mackensen, mikeyarce, whyisjake.
Fixes #34560.



git-svn-id: https://develop.svn.wordpress.org/trunk@48422 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-10 15:12:00 +00:00
Sergey Biryukov
73d3e9cfd9 Coding Standards: Use strict comparison in WP_List_Util::filter().
Correct comments per the documentation standards.

See #49542, #49572.

git-svn-id: https://develop.svn.wordpress.org/trunk@48421 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-10 12:44:38 +00:00
Sergey Biryukov
7b27f3f00a Docs: Correct documentation for customize_controls_head hook and _customizer_mobile_viewport_meta() function.
Follow-up to [48412].

See #47369.

git-svn-id: https://develop.svn.wordpress.org/trunk@48420 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-10 11:34:41 +00:00
Jake Spurlock
26e29a513a Administration: Better align labels on the discussion options page.
The labels for Comment Moderation, and Comment Blocklist are now aligned properly with the adjacent text.

Fixes #37384.
Props ankit-k-gupta, karmatosed, FolioVision, desrosj, valentinbora, samful, whyisjake.


git-svn-id: https://develop.svn.wordpress.org/trunk@48419 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-10 06:46:03 +00:00
Jake Spurlock
1b251feeec Upgrade/Install: Use ARIA button class on plugin and theme auto-updates action links
According to the [accesability guidelines](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/accessibility/#semantics-for-controls), the control should be a link when JavaScript is not available and a button the rest of the time.

In addition, handlers were added for spacebar usage, and some changes to the a11y speak verbiage.

Fixes #50516.
Props ryokuhi, audrasjb, afercia, whyisjake/




git-svn-id: https://develop.svn.wordpress.org/trunk@48418 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-10 06:16:06 +00:00
Jake Spurlock
bf93e9699f Upgrade/Install: Ensure cleanup after canceled update.
Ensure that the uploaded zip is hidden from the media library, where a task will remove failed installs after two hours.

Fixes #50612.

Props psykro, desrosj, joyously, azaozz, noisysocks, whyisjake. 


git-svn-id: https://develop.svn.wordpress.org/trunk@48417 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-10 06:06:46 +00:00
Jake Spurlock
3667d18943 Menus: Ensure that category menus with special characters can be updated.
Slashes and HTML encoding could cause some menus not to be updated.

Fixes #48011.

Props zaheerahmad, achyuthajoy, desrosj, pento, SergeyBiryukov, donmhico, audrasjb, birgire, mikeschroder.



git-svn-id: https://develop.svn.wordpress.org/trunk@48416 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-10 05:58:49 +00:00
Jake Spurlock
80e2a20c53 Coding Standards: Some missed code formatting.
Unprops: whyisjake.



git-svn-id: https://develop.svn.wordpress.org/trunk@48415 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-10 00:59:58 +00:00
Jake Spurlock
36f9f6c70d Sitemaps: Add better support for RTL sites.
While the URLs are intended to be machine readable, they should always be LTR, while other data would be RTL in the sitemap.

Fixes #50449.

Props joyously, SergeyBiryukov, pbiron. apedog, ramiy.



git-svn-id: https://develop.svn.wordpress.org/trunk@48414 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-10 00:48:54 +00:00
Jake Spurlock
0802e754a2 Formatting: Ensure that wp_filter_object_list() will return an array when being passed an object with magic methods.
Fixes #50095.

Props johnjamesjacoby.


git-svn-id: https://develop.svn.wordpress.org/trunk@48413 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-10 00:29:48 +00:00
Jake Spurlock
0999a01956 Administration: Remove multiple viewport meta tags from mobile pages.
In addition, add the `wp_admin_viewport_meta()` function, paired to the `admin_viewport_meta` filter to control attributes of the meta tag.

Fixes #47369.
Props BettyJJ, mukesh27, SergeyBiryukov, ajayghaghretiya1, msaggiorato, talldanwp, davidbaumwald, donmhico, audrasjb.



git-svn-id: https://develop.svn.wordpress.org/trunk@48412 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-09 23:27:28 +00:00
Sergey Biryukov
9683101398 Docs: Synchronize and correct documentation for various metadata functions and filters.
Follow-up to [47390], [47611], [48192], [48402].

See #49572, #43941, #45464.

git-svn-id: https://develop.svn.wordpress.org/trunk@48411 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-09 11:24:43 +00:00
Sergey Biryukov
c3993eb19d Widgets: Adjust formatting for displaying the closing </nav> tag in widgets for consistency with the opening tag.
Follow-up to [48349].

See #48170.

git-svn-id: https://develop.svn.wordpress.org/trunk@48410 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-08 13:42:30 +00:00
Sergey Biryukov
c66bdb8b5a Widgets: Correct the logic for displaying the after_widget parameter of the Archives widget.
Follow-up to [48349].

Props mukesh27, joyously.
Fixes #50609.

git-svn-id: https://develop.svn.wordpress.org/trunk@48409 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-08 13:26:20 +00:00
Sergey Biryukov
8b89be2676 Docs: Miscellaneous DocBlock corrections.
See #49572.

git-svn-id: https://develop.svn.wordpress.org/trunk@48408 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-08 13:13:50 +00:00
Sergey Biryukov
de37c09c7b Docs: Further improve documentation for have_posts() and have_comments().
Follow-up to [48406]

Props stevenlinx.
See #50610.

git-svn-id: https://develop.svn.wordpress.org/trunk@48407 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-08 11:13:22 +00:00
Sergey Biryukov
3dc074ed1d Docs: Improve documentation for have_posts(), have_comments(), and their WP_Query counterparts.
Props stevenlinx.
Fixes #50610.

git-svn-id: https://develop.svn.wordpress.org/trunk@48406 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-08 11:09:08 +00:00
Sergey Biryukov
e76307655d Upgrade/Install: Prevent the upgrade routine for updating the comment_type field in the comments table from running twice.
Follow-up to [47597], [48400].

See #50413, #49236.

git-svn-id: https://develop.svn.wordpress.org/trunk@48405 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-08 10:56:22 +00:00
Sergey Biryukov
660fc1703d Post WordPress 5.5 Beta 1 version bump.
git-svn-id: https://develop.svn.wordpress.org/trunk@48404 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-07 21:51:26 +00:00
Sergey Biryukov
a99e0fd425 WordPress 5.5 Beta 1.
git-svn-id: https://develop.svn.wordpress.org/trunk@48403 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-07 20:59:16 +00:00
Timothy Jacobs
612eeb92a8 REST API, Meta: Introduce support for default metadata values.
The `register_meta()` API now officially supports specifying a default metadata value. When `get_metadata()` is called for a meta key that does not yet exist for the object, this default value will be returned instead of an empty string.

A new function is introduced `get_metadata_raw` to retrieve the raw metadata value from the database, without applying the registered default.

Props spacedmonkey, flixos90, rmccue, kadamwhite, mnelson4, johnbillion, chrisvanpatten, TimothyBlynJacobs.
Fixes #43941.



git-svn-id: https://develop.svn.wordpress.org/trunk@48402 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-07 20:45:55 +00:00
Jonathan Desrosiers
dd64c95f65 Administration: Fix failing tests as a result of [48397].
Because of changes to how PHP handles arrays used in `foreach()` loops in PHP >= 7.0, [48397] resulted in a failing test for PHP 5.6.

This calls `reset()` after using the `$results` array in the `foreach()` to ensure the array is treated the same and as expected.

Props azaozz, desrosj, SergeyBiryukov, xknown.
See #50448.

git-svn-id: https://develop.svn.wordpress.org/trunk@48401 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-07 20:36:41 +00:00
Jonathan Desrosiers
7d3b647a16 Upgrade/Install: Prevent some 5.5.0 upgrade routines from running twice.
This will prevent the options renamed for 5.5.0 from being converted twice. If a new update routine is added before 5.5 is released, the option values would be erased for anyone running `trunk` or nightlies without this change.

Props azaozz, desrosj, SergeyBiryukov, whyisjake.
Fixes #50413.

git-svn-id: https://develop.svn.wordpress.org/trunk@48400 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-07 19:19:03 +00:00
Jonathan Desrosiers
61803a37a4 Upgrade/Install: Add hook_extra parameter to the upgrader_pre_download filter.
This provides additional context to code running on this hook, including which plugin or theme update will be downloaded. It also brings consistency to this filter with others throughout the upgrade process.

Props obliviousharmony, desrosj.
Fixes #49686.

git-svn-id: https://develop.svn.wordpress.org/trunk@48399 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-07 19:13:30 +00:00
Jake Spurlock
86ffb51a33 Administration: Introduce extensibility to posts and comments list table views, for accessibility purposes.
At default, expands the excerpt view to become an extended view. Includes a new `table_view_mode` filter to allow further configuration.

Fixes #49715.
Props joedolson, audrasjb, afercia, whyisjake.



git-svn-id: https://develop.svn.wordpress.org/trunk@48398 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-07 19:10:46 +00:00
Jonathan Desrosiers
bfb896ce08 Administration: Prevent repeat emails for identical plugin or theme auto-update attempt failures.
This change adds a throttle mechanism to plugin and theme auto-update failure emails using similar logic to the email sent for a Core auto-update.

The first time a plugin or theme auto-update fails, the package and `new_version` will be tracked in the `auto_plugin_theme_update_emails` option. An email for this specific update attempt will not be resent.

However, if this update fails again and non-repeat failures or successful updates are also present, then the failure information will be included in that email (an email needs to be sent for the new events regardless).

Props johnbillion, arpitgshah, desrosj, audrasjb, pbiron, earnjam.
Fixes #50448.

git-svn-id: https://develop.svn.wordpress.org/trunk@48397 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-07 18:58:32 +00:00
Dominik Schilling
a7dc1bbef1 I18N: Use wp.i18n for translatable strings in wp-admin/js/set-post-thumbnail.js.
This removes the usage of `wp_localize_script()` for passing translations to the script and instead adds the translatable strings in the script directly through the use of `wp.i18n` and its utilities.

Props swissspidy, ocean90.
See #20491.
Fixes #50605.

git-svn-id: https://develop.svn.wordpress.org/trunk@48396 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-07 18:53:50 +00:00
Dominik Schilling
25417b5d49 I18N: Use wp.i18n for translatable strings in wp-admin/js/comment.js.
This removes the usage of `wp_localize_script()` for passing translations to the script and instead adds the translatable strings in the script directly through the use of `wp.i18n` and its utilities.

Props swissspidy, ocean90.
See #20491.
Fixes #50604.

git-svn-id: https://develop.svn.wordpress.org/trunk@48395 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-07 18:38:20 +00:00
Dominik Schilling
189f23fd27 I18N: Use wp.i18n for translatable strings in wp-admin/js/nav-menu.js.
This removes the usage of `wp_localize_script()` for passing translations to the script and instead adds the translatable strings in the script directly through the use of `wp.i18n` and its utilities.

Props swissspidy, ocean90.
See #20491.
Fixes #50603.

git-svn-id: https://develop.svn.wordpress.org/trunk@48394 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-07 18:28:41 +00:00