Commit Graph

3945 Commits

Author SHA1 Message Date
David Baumwald
07ce792fd6 I18N: Combine escaping and translation functions.
There are a few instances where two separate functions are used for both escaping and translating output.  This change combines the two functions into the appropriate Core helper function.

Props dimadin, SergeyBiryukov.
Fixes #53153.

git-svn-id: https://develop.svn.wordpress.org/trunk@50931 602fd350-edb4-49c9-b593-d223f7449a82
2021-05-19 18:09:27 +00:00
Sergey Biryukov
0f45b89ffd Plugins: Add support for Update URI header.
This allows third-party plugins to avoid accidentally being overwritten with an update of a plugin of a similar name from the WordPress.org Plugin Directory.

Additionally, introduce the `update_plugins_{$hostname}` filter, which third-party plugins can use to offer updates for a given hostname.

If set, the `Update URI` header field should be a URI and have a unique hostname.

Some examples include:

* `https://wordpress.org/plugins/example-plugin/`
* `https://example.com/my-plugin/`
* `my-custom-plugin-name`

`Update URI: false` also works, and unless there is code handling the `false` hostname, the plugin will never get an update notification.

If the header is present, the WordPress.org API will currently only return updates for the plugin if it matches the following format:

* `https://wordpress.org/plugins/{$slug}/`
* `w.org/plugin/{$slug}`

If the header has any other value, the API will not return a result and will ignore the plugin for update purposes.

Props dd32, DavidAnderson, meloniq, markjaquith, DrewAPicture, mweichert, design_dolphin, filosofo, sean212, nhuja, JeroenReumkens, infolu, dingdang, joyously, earnjam, williampatton, grapplerulrich, markparnell, apedog, afragen, miqrogroove, rmccue, crazycoders, jdgrimes, damonganto, joostdevalk, jorbin, georgestephanis, khromov, GeekStreetWP, jb510, Rarst, juliobox, Ipstenu, mikejolley, Otto42, gMagicScott, TJNowell, GaryJ, knutsp, mordauk, nvartolomei, aspexi, chriscct7, benoitchantre, ryno267, lev0, gregorlove, dougwollison, SergeyBiryukov.
See #14179, #23318, #32101.

git-svn-id: https://develop.svn.wordpress.org/trunk@50921 602fd350-edb4-49c9-b593-d223f7449a82
2021-05-17 17:02:49 +00:00
Sergey Biryukov
32151af6e4 Docs: Miscellaneous DocBlock corrections.
See #52628.

git-svn-id: https://develop.svn.wordpress.org/trunk@50916 602fd350-edb4-49c9-b593-d223f7449a82
2021-05-15 17:36:49 +00:00
Sergey Biryukov
127da0ecae Coding Standards: Adds spacing so define() statements displayed when creating a network.
This ensures that the code intended to be copied to `wp-config.php` conforms to WordPress Coding Standards.

Props paulschreiber, johnjamesjacoby.
Fixes #53182.

git-svn-id: https://develop.svn.wordpress.org/trunk@50839 602fd350-edb4-49c9-b593-d223f7449a82
2021-05-11 17:08:45 +00:00
Sergey Biryukov
2b2f309d6f Site Health: Improve the appearance of Site Health Status dashboard widget.
This better utilizes the available screen space on wider screens.

Props mblach, hedgefield, Clorith.
Fixes #52966.

git-svn-id: https://develop.svn.wordpress.org/trunk@50833 602fd350-edb4-49c9-b593-d223f7449a82
2021-05-10 14:54:57 +00:00
Sergey Biryukov
180e7a2721 Coding Standards: Use strict comparison in wp-admin/includes/screen.php.
See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50832 602fd350-edb4-49c9-b593-d223f7449a82
2021-05-09 20:25:41 +00:00
Sergey Biryukov
f8a5eb35e1 Docs: Correct @since tags for new properties and functions related to infinite scrolling in Media Library.
Follow-up to [50829].

See #50105, #40330, #52628.

git-svn-id: https://develop.svn.wordpress.org/trunk@50831 602fd350-edb4-49c9-b593-d223f7449a82
2021-05-08 11:20:02 +00:00
Joe Dolson
85f53ca0a6 Media: Remove infinite scroll from media library and modal.
Replace infinitely autoloading behavior on scroll with a user-controlled load more button. Fix a long standing accessibility issue in the media library. Infinite scroll poses a wide range of problems for accessibility, usability, and performance.

This change modifies the library to load 40 items in the initial view, with a load more button to load the next 40 items and a button to move focus from the load more region to the first of the most recently added items.

The text for communicating the jump target was broadly discussed, agreeing that the text incorporated here would most concisely and clearly convey the purpose of the button, and any further detail is learnable from use.
 
Props afercia, adamsilverstein, joedolson, audrasjb, francina 
Fixes #50105. See #40330. 

git-svn-id: https://develop.svn.wordpress.org/trunk@50829 602fd350-edb4-49c9-b593-d223f7449a82
2021-05-07 23:17:33 +00:00
John Blackbourn
0a3a3c5119 Docs: Miscellaneous docblock updates.
See #52628


git-svn-id: https://develop.svn.wordpress.org/trunk@50828 602fd350-edb4-49c9-b593-d223f7449a82
2021-05-07 20:14:22 +00:00
Jonathan Desrosiers
d5407ec719 Docs: Use correct @since tag notation.
This corrects the version number specified by the `@since` tag for the `delete_theme` and `deleted_theme` action hooks introduced in [50826] to contain a full, 3 digit version.

Props ocean90.
See #16401.

git-svn-id: https://develop.svn.wordpress.org/trunk@50827 602fd350-edb4-49c9-b593-d223f7449a82
2021-05-07 18:24:23 +00:00
Jonathan Desrosiers
d6a37f9046 Themes: Introduce the delete_theme and deleted_theme action hooks.
This change introduces the `delete_theme` and `deleted_theme` action hooks, which fire immediately before and after an attempt to delete a theme, respectively.

Props scottconnerly, ptahdunbar, pbiron, vetyst, desrosj.
Fixes #16401.

git-svn-id: https://develop.svn.wordpress.org/trunk@50826 602fd350-edb4-49c9-b593-d223f7449a82
2021-05-07 16:08:42 +00:00
Sergey Biryukov
35c1cdee74 Plugins: Escape the currently installed version number on Add Plugins screen.
The number is displayed in the plugin details modal if a newer version is already installed.

Props m0ze, bmcculley, ayeshrajans.
Fixes #53020.

git-svn-id: https://develop.svn.wordpress.org/trunk@50825 602fd350-edb4-49c9-b593-d223f7449a82
2021-05-07 13:48:12 +00:00
Jonathan Desrosiers
970f904de5 Site Health: Include more ImageMagick/Imagick information in the Media Handling section.
This adds additional information to the Media Handling section of the Site Health Info page. When ImageMagick is used as the site’s image editor, a full list of file formats supported will now be shown. This will help site owners debug any issues they encounter as support for newer, more modern image formats is added (such as WebP in [50810]).

Additionally, the version of Imagick installed. This will help site owners debug issues with generating images on the PHP side.

Some variables have also been renamed to more accurately represent what is being stored.

Props Clorith, desrosj.
Fixes #53022.

git-svn-id: https://develop.svn.wordpress.org/trunk@50817 602fd350-edb4-49c9-b593-d223f7449a82
2021-05-05 19:20:55 +00:00
Sergey Biryukov
bf17cc67ce Media: Move retrieving WebP image size information into wp_getimagesize().
Remove `_wp_get_image_size()`.

Follow-up to [50146], [50810], [50814].

Props johnjamesjacoby.
See #35725.

git-svn-id: https://develop.svn.wordpress.org/trunk@50815 602fd350-edb4-49c9-b593-d223f7449a82
2021-05-05 18:46:10 +00:00
Adam Silverstein
6a5ff5aa03 Images: enable WebP support.
Add support for uploading, editing and saving WebP images when supported by the server.

Add 'image/webp' to supported mime types. Correctly identify WebP images and sizes even when PHP doesn't support WebP. Resize uploaded WebP files (when supported) and use for front end markup.

Props markoheijne, blobfolio, Clorith, joemcgill, atjn, desrosj, spacedmonkey, marylauc, mikeschroder, hellofromtonya, flixos90.
Fixes #35725.



git-svn-id: https://develop.svn.wordpress.org/trunk@50810 602fd350-edb4-49c9-b593-d223f7449a82
2021-05-04 14:43:36 +00:00
Jonathan Desrosiers
80302b7b35 General: Use correct escaping function for form action attributes.
Props chintan1896, audrasjb.
Fixes #53150.

git-svn-id: https://develop.svn.wordpress.org/trunk@50809 602fd350-edb4-49c9-b593-d223f7449a82
2021-05-04 13:46:06 +00:00
Jonathan Desrosiers
3eb51f7546 General: Use correct escaping function for the plugin icon URL.
Props chintan1896, audrasjb.
Fixes #53151.

git-svn-id: https://develop.svn.wordpress.org/trunk@50808 602fd350-edb4-49c9-b593-d223f7449a82
2021-05-04 13:37:50 +00:00
Sergey Biryukov
65fb405e87 Coding Standards: Fix a whitespace at end of line issue in wp-admin/includes/class-wp-comments-list-table.php.
Includes minor code layout fixes for better readability.

See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50805 602fd350-edb4-49c9-b593-d223f7449a82
2021-05-03 14:08:13 +00:00
Sergey Biryukov
1415ac7ca7 Coding Standards: Use strict comparison in wp-admin/includes/class-wp-posts-list-table.php.
Includes minor code layout fixes for better readability.

See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50804 602fd350-edb4-49c9-b593-d223f7449a82
2021-05-03 13:55:08 +00:00
Sergey Biryukov
a8323bf8e7 Coding Standards: Fix a precision alignment issue in wp-admin/includes/template.php.
Follow-up to [49223].

See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50795 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-28 18:53:04 +00:00
Sergey Biryukov
32ca843154 Plugins: When loading a plugin in a "sandbox" on activation, do it once.
This avoids a fatal error if the plugin is already included, e.g. in unit tests.

Follow-up to [50787].

See #31104.

git-svn-id: https://develop.svn.wordpress.org/trunk@50788 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-25 13:19:54 +00:00
Sergey Biryukov
93290c44f6 Plugins: When loading a plugin in a "sandbox" on activation, do it in a separate function.
This avoids accidentally overriding some variables in the scope of `activate_plugin()`, e.g. `$silent` or `$network_wide`.

Plugins expecting to have access to `$network_wide` directly on inclusion should receive it as an argument of the activation hook callback instead, on any of these actions:

* `activate_plugin`
* `activate_{$plugin}`
* `activated_plugin`

Follow-up to [28644].

Props Mike_Cowobo, dd32, DrewAPicture, mensmaximus, SergeyBiryukov.
Fixes #31104.

git-svn-id: https://develop.svn.wordpress.org/trunk@50787 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-24 18:02:39 +00:00
Sergey Biryukov
edd6ec0389 Coding Standards: Use strict comparison in wp-admin/includes/update-core.php.
Includes minor code layout fixes for better readability.

See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50785 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-23 14:49:51 +00:00
Sergey Biryukov
2464d69d8d Coding Standards: Remove loose comparison in wp-admin/includes/plugin-install.php.
This more closely represents how the active installations count is displayed in the Plugin Directory.

See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50783 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-22 19:16:42 +00:00
Sergey Biryukov
5aae96ba8b Coding Standards: Use strict comparison in wp-admin/includes/class-wp-terms-list-table.php.
Includes minor code layout fixes for better readability.

See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50780 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-21 18:51:33 +00:00
Greg Ziółkowski
a19f589a5f Editor: Abstract block editor configuration
There are several WordPress hooks defined on the server that depend on $post object that isn’t present on the new screens like edit site, edit widgets, or edit navigation. This patch deprecates existing filters and introduces replacements that are context-aware.

Props azaozz, andraganescu, jeremyfelt, nosolosw, youknowriad.
See #52920.





git-svn-id: https://develop.svn.wordpress.org/trunk@50776 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-21 05:10:56 +00:00
Sergey Biryukov
c072116d6a Coding Standards: Use strict comparison in wp-admin/includes/class-wp-media-list-table.php.
Includes minor code layout fixes for better readability.

See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50770 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-19 11:39:54 +00:00
Sergey Biryukov
e01bbd48f4 Coding Standards: Fix WPCS issues in wp-admin/includes/class-wp-comments-list-table.php.
* Rename method argument in `WP_Comments_List_Table::floated_admin_avatar()` per the naming conventions.
* Use strict comparison in `WP_Comments_List_Table::handle_row_actions()`.

See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50768 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-18 13:54:00 +00:00
Sergey Biryukov
5e8b165a54 Coding Standards: Use strict comparison in wp-admin/includes/class-walker-nav-menu-edit.php.
See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50767 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-17 12:20:44 +00:00
Marius L. J
a32a192ede Site Health: Support custom sub-menus and pages.
Allow developers to extend the Site Health screen with their own custom navigation tabs and pages.

This implements a new filter, `site_health_navigation_tabs`, which takes an associated array of tab identifiers/slugs, and tab labels, allowing developers to add their own subpage to the Site Health interface as new tabs.

To output a custom page, or add to an existing page, the `site_health_tab_content` action is triggered whenever the `tab` query argument is present and not empty. This action includes the current tab as its argument, which a developer would match against to only output content when relevant.

Props ramiy for initial patch.
Fixes #47225.

git-svn-id: https://develop.svn.wordpress.org/trunk@50764 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-17 01:12:25 +00:00
Sergey Biryukov
6caebf6fc2 Coding Standards: Use strict comparison in wp-admin/includes/class-wp-automatic-updater.php.
Includes minor code layout fixes for better readability.

See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50762 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-16 11:59:14 +00:00
Sergey Biryukov
fd6ccf4540 Coding Standards: Give a variable in WP_Automatic_Updater::after_core_update() a more meaningful name.
Follow-up to [25841], [25873], [25882].

See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50759 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-15 10:29:21 +00:00
David Baumwald
f7799b9455 Privacy: Ensure "Export Personal Data" does not generate invalid JSON.
Previously, when exporting personal data, if the JSON encoding of the data failed, the invalid JSON was still written to `export.json`.  This change captures the JSON encoding failure and adds a notice to the UI.  

Props hellofromTonya, jrf, SergeyBiryukov.
Fixes #52892.

git-svn-id: https://develop.svn.wordpress.org/trunk@50713 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-14 21:26:58 +00:00
Sergey Biryukov
83b4b89c5a Site Health: Correct test result status for the HTTPS test.
The supported status values for Site Health tests are `good`, `recommended`, and `critical`.

Follow-up to [50660].

Props TimothyBlynJacobs.
Fixes #52783.

git-svn-id: https://develop.svn.wordpress.org/trunk@50710 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-14 13:00:52 +00:00
Sergey Biryukov
66b035ab3b Coding Standards: Use strict comparison in wp-admin/includes/class-custom-image-header.php.
Includes minor code layout fixes for better readability.

See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50707 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-13 19:03:07 +00:00
Sergey Biryukov
27ddc687c4 Coding Standards: Use strict comparison in wp-admin/includes/class-custom-background.php.
Includes minor code layout fixes for better readability.

See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50706 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-13 17:59:45 +00:00
David Baumwald
8b74b031c5 I18N: Add context to strings when updating a plugin or theme with a ZIP package.
After [48390], plugins and themes can be updated with an uploaded ZIP file.  Strings were added for comparing the "current" and "uploaded" versions of a plugin or theme, but lacked context for each as to the object being referenced.  This change adds a `plugin` or `theme` context to each of these strings for disambiguation.

Props dimadin, SergeyBiryukov.
Fixes #53017.

git-svn-id: https://develop.svn.wordpress.org/trunk@50705 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-13 17:36:39 +00:00
Sergey Biryukov
69d11640be Coding Standards: Rewrite a fragment in request_filesystem_credentials() for clarity and to avoid repetition.
Follow-up to [8540], [8865].

See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50701 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-12 18:32:39 +00:00
Sergey Biryukov
94a8a4c5ec Coding Standards: Use strict comparison in wp-admin/includes/file.php.
Includes minor code layout fixes for better readability.

See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50700 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-12 18:17:37 +00:00
Sergey Biryukov
d2c95cede3 Coding Standards: Simplify the check for parent terms in export_wp().
This is more consistent with similar checks elsewhere in core.

See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50699 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-11 13:42:25 +00:00
Sergey Biryukov
4e5569ddd3 Coding Standards: Remove unnecessary unset() calls in WP_Importer methods.
Variables created within the scope of a function are discarded automatically when PHP leaves the scope of the function, i.e. on `return`, so doing a call to `unset()` straight before a `return` statement is redundant.

Props jrf, ravipatel, rachelbaker, mukesh27.
Fixes #52996.

git-svn-id: https://develop.svn.wordpress.org/trunk@50692 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-08 11:10:16 +00:00
Sergey Biryukov
ab3dbadec4 Coding Standards: Use strict comparison in wp-admin/includes/dashboard.php.
Includes minor code layout fixes for better readability.

See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50689 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-07 18:32:01 +00:00
Sergey Biryukov
6b8d5df24e Coding Standards: Use strict comparison in wp-admin/includes/credits.php.
See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50665 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-06 13:45:47 +00:00
Sergey Biryukov
4ca1ee8c0e Coding Standards: Use strict comparison in wp-admin/includes/comment.php.
See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50664 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-06 13:43:56 +00:00
Peter Wilson
c4eddfdfed Site Health: Reduce false reports of HTTPS failures.
Reduce severity of failing HTTPS tests from critical to warning. Stop reporting failures if the site is being accessed over HTTPS but `wp_is_https_supported()` indicates a lack of support.

Props annalamprou, AnotherDave, ayeshrajans, bobbingwide, Clorith, dragongate, eatsleepcode, gab81, geoffrey1963, Ipstenu, k3nsai, mmuyskens, nicegamer7, peterwilsoncc, pwallner, SergeyBiryukov, TimothyBlynJacobs, Toru.
Fixes #52783.


git-svn-id: https://develop.svn.wordpress.org/trunk@50659 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-06 03:22:08 +00:00
Sergey Biryukov
868081ff3a Coding Standards: Give some variables in WP_Importer a more meaningful name.
See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50658 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-05 10:48:11 +00:00
Sergey Biryukov
b0f74b74a5 Coding Standards: Use strict comparison in wp-admin/includes/class-wp-filesystem-*.php.
See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50657 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-05 10:36:17 +00:00
Sergey Biryukov
0f4d1d674c Coding Standards: Use strict comparison in wp-admin/includes/class-core-upgrader.php.
See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50652 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-04 16:47:48 +00:00
Sergey Biryukov
4a8aefaf72 Coding Standards: Remove some extra whitespace in _wp_translate_postdata().
See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50618 602fd350-edb4-49c9-b593-d223f7449a82
2021-03-30 15:17:05 +00:00
Sergey Biryukov
1dafd53d20 Code Modernization: Check if the _export_data_grouped post meta is an array when generating a personal data export file.
This avoids a fatal error on PHP 8 in `wp_privacy_generate_personal_data_export_file()` if the `_export_data_grouped` post meta exists but is not an array.

Additionally, refactor unit tests for the function to:
* Reduce redundant code
* Switch to data provider
* Test on the full HTML output instead of select pieces of the output
* Expand unhappy path coverage

Follow-up to [43012], [44786], [47146], [47278].

Props hellofromTonya, jrf, xknown.
See #51423.

git-svn-id: https://develop.svn.wordpress.org/trunk@50613 602fd350-edb4-49c9-b593-d223f7449a82
2021-03-29 19:35:36 +00:00