Commit Graph

38650 Commits

Author SHA1 Message Date
Jonathan Desrosiers 82a8632367 REST API: Fire actions after items are completely updated/inserted.
The existing `rest_insert_*` actions are fired before meta and additional fields are updated. These new `rest_after_*` actions fire after all write operations have completed.

Props timothyblynjacobs, danielbachhuber.

Merges [43737] to trunk.

Fixes #42864.

git-svn-id: https://develop.svn.wordpress.org/trunk@43987 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-12 21:11:27 +00:00
Jonathan Desrosiers 8c85f2dfec REST API: Don't add fields to object when not included in `?_fields=`.
In [43087], we improved REST API performance by only rendering the fields specified in the request. Similarly, any fields registered with `register_rest_field()` should only be rendered when included in `?_fields=`.

Props dlh, danielbachhuber.

Merges [43736] to trunk.

Fixes #45099.

git-svn-id: https://develop.svn.wordpress.org/trunk@43986 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-12 20:50:22 +00:00
Jeremy Felt 140a95cf08 REST API: Introduce themes endpoint to expose theme-supports values for the active theme.
In order to correctly render parts of its UI, the new editor needs to be aware of the active theme's post-formats and post-thumbnails support. This data is exposed by querying for the active theme on a new /wp/v2/themes endpoint for sufficiently privileged users.

Merges [43734], [43735] to trunk.

props desrosj.
Fixes #45016.


git-svn-id: https://develop.svn.wordpress.org/trunk@43985 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-12 03:32:21 +00:00
Jeremy Felt a73e82011f KSES: Add selected ARIA attributes support.
Allow low-privileged users to use the ARIA attributes `aria-describedby`, `aria-details`, `aria-label`, `aria-labelledby` and `aria-hidden`.

Merges [43731] to trunk.

Props mattheu, swissspidy, rianrietveld, afercia, GaryJ.
See #30421.


git-svn-id: https://develop.svn.wordpress.org/trunk@43984 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-12 03:14:47 +00:00
Jeremy Felt 805326cbd4 Load: Disable PHP errors for JSON requests
Because WP REST API requests aren't identified until `parse_request`, it's impractical to reference the `REST_REQUEST` constant in `wp_debug_mode()`. Instead, it's more helpful to assume that a request wanting a JSON response probably doesn't want PHP errors breaking the response.

Merges [43730] to trunk.

Props chrisl27, duanestorey, earnjam.
Fixes #44534.


git-svn-id: https://develop.svn.wordpress.org/trunk@43983 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-12 03:07:58 +00:00
Jeremy Felt 2ad4d85ed5 REST API: Move object type-specific metadata integrations from the wrapper functions to the low-level Meta API functions.
Object type-specific actions that should happen before or after modification of metadata have so far been part of the respective wrapper functions. By using action and filter hooks, this changeset ensures they are always executed, even when calling the lower-level Meta API functions directly, which the REST API does as a prime example.

Merges [43729] to trunk.

Props flixos90, spacedmonkey.
Fixes #44467.


git-svn-id: https://develop.svn.wordpress.org/trunk@43982 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-12 03:02:00 +00:00
Jeremy Felt 1c9f359857 KSES: Allow HTML data-* attributes.
Add global support for HTML attributes prefixed `data-` for authors and contributors, as required by the new editor.

Merges [43727] to trunk.

Props azaozz, peterwilsoncc.
Fixes #33121.


git-svn-id: https://develop.svn.wordpress.org/trunk@43981 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-12 02:38:14 +00:00
Jeremy Felt 894a8e02d2 REST API: Include permalink_template/generated_slug for Posts
In order for clients to present permalink previews, the REST API must share the computed results of get_sample_permalink(). These two values are now exposed as permalink_template and generated_slug for public, viewable post types, but only for context=edit.

Merges [43720] to trunk.

Props danielbachhuber, rahulsprajapati.
Fixes #45017.


git-svn-id: https://develop.svn.wordpress.org/trunk@43980 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-12 02:11:22 +00:00
Jonathan Desrosiers c0e80b028a REST API: Enable users with read_private_posts to query for them.
An authorized request with the read_private_posts capability for a post type should be able to GET /wp/v2/posts for posts of status=private. This query is further sanity-checked by WP_REST_Posts_Controller->check_read_permission(), which is unchanged.

Props rachelbaker, soulseekah, twoelevenjay.

Moves [43694] from the 5.0 branch to trunk.

Fixes #43701.

git-svn-id: https://develop.svn.wordpress.org/trunk@43979 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-11 22:29:36 +00:00
Anton Timmermans f173141c5b Build tools: Combine webpack config files.
This prepares us for building the Gutenberg packages.

Merges [43687] to trunk.
See #45065.


git-svn-id: https://develop.svn.wordpress.org/trunk@43978 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-11 16:38:21 +00:00
Anton Timmermans b8fb0eaeca Build/Test: Update dependencies for 5.0
Updates package dependencies to more modern versions, also adds .nvmrc and package-lock.json as followups to [43683] and [43571].

Merge notes: trunk already had an identical .nvmrc. package-lock.json exists in trunk, but has some changes based on the dependency updates.

Props jorbin.
Merges [43684], [43685] and [43686] to trunk.
See #44600.
Fixes #45064.


git-svn-id: https://develop.svn.wordpress.org/trunk@43977 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-11 16:12:13 +00:00
Aaron Jorbin 7ec7fadfe7 PHPCS: Fix errors
Fix errors introduced in [43973] due to Jorbin not running the correct tag of wpcs.

Unprops jorbin.



git-svn-id: https://develop.svn.wordpress.org/trunk@43976 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-11 04:44:16 +00:00
jorbin b4d7e7a878 Build/Test Tools: Use 7.3 for PHP 7.3
Travis now supports PHP7.3 without workarounds, so let's remove the workarounds.

Merges [43726] to trunk.

See #44771.


git-svn-id: https://develop.svn.wordpress.org/trunk@43975 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-11 04:20:02 +00:00
Aaron Jorbin 7f544b912b REST API: Declare unfiltered_html capability in links.
Because user capabilities can be modified at runtime, the REST API needs to expose them in some evaluated but declarative manner for clients to interpret. JSON Hyper Schema targetSchema provides an appropriate paradigm for doing so.

Merges [43682] to trunk.

Props timothyblynjacobs.

Fixes #45014.


git-svn-id: https://develop.svn.wordpress.org/trunk@43974 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-11 04:12:56 +00:00
Aaron Jorbin 891394af73 REST API: Persist attributes for attachment links
In [43437], the link definition implementation caused attachment links to be unexpectedly nested under an attributes key. This changeset restores the prior behavior.

Merges [43681] to trunk.

Props TimothyBlynJacobs, danielbachhuber.
Fixes #44750.


git-svn-id: https://develop.svn.wordpress.org/trunk@43973 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-11 04:00:37 +00:00
Gary Pendergast 5d92e0c0a9 Bump the trunk package.json version to 5.1.0.
git-svn-id: https://develop.svn.wordpress.org/trunk@43678 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-05 20:42:10 +00:00
Gary Pendergast ddc67854a4 Bump trunk version to 5.1-alpha.
git-svn-id: https://develop.svn.wordpress.org/trunk@43677 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-05 20:19:12 +00:00
Aaron Jorbin a6adbc226f Build/Test Tools: Add PHP7.3 RC1 to the build matrix
Currently, we need to do some extra steps to run 7.3, but this will help us with testing compatibility.

See: https://github.com/travis-ci/travis-ci/issues/9717

See #44771.


git-svn-id: https://develop.svn.wordpress.org/trunk@43673 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-04 02:04:53 +00:00
Mel Choyce cd574077c8 List Table: Fix formatting issue introduced in r43671.
Props dd32.
See #45028.


git-svn-id: https://develop.svn.wordpress.org/trunk@43672 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-03 21:11:16 +00:00
Mel Choyce 29e8c152f1 List Table: Restore the List Table items property to allow Bulk Actions to be properly determined.
This fixes the display of Bulk Actions where there exists only a single page of results.

Props shaneeckert, jobthomas, dd32.
Fixes #45028.


git-svn-id: https://develop.svn.wordpress.org/trunk@43671 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-03 19:46:51 +00:00
Mel Choyce cec0385656 List Tables: Arrange action items into a grid with extra space.
On small screens, list table actions were cramped. This makes it easy to press the wrong action by mistake. The items are now arranged into a grid and given extra room to create a larger tap-target.

The plugins list table was excluded because it's current layout doesn't match the others, and we should add more space to this in a future commit.

Props jobthomas, ryelle.
Fixes #45024.


git-svn-id: https://develop.svn.wordpress.org/trunk@43670 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-03 18:55:35 +00:00
Gary Pendergast 1f4ed43c65 Plugin Installer: Allow 4 columns of search results on wide screens.
For screens wider than 2300px, show 4 colums of search results, as 3 columns looked quite stretched out.

This change also increases the default number of search results from 30 to 36, so that the columns have an even number of results, regardless of whether there are 2, 3, or 4 of them.

Props nielslange.
Fixes #43573.



git-svn-id: https://develop.svn.wordpress.org/trunk@43669 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-02 20:06:37 +00:00
Gary Pendergast 9bdb0eb1d5 i18n: Improve consistency of translator comments.
Props ramonopoly.
Fixes #44998.



git-svn-id: https://develop.svn.wordpress.org/trunk@43668 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-02 19:50:48 +00:00
Gary Pendergast 53264d2463 Plugins: Pluralise the "unexpected output during activation" message.
When a plugin is activated, it can trigger a warning message if it outputs data at that time. This error message was being run through `__()`, instead of `_n()`, so it wasn't possible to correctly pluralise the message.

Props jamosova.
Fixes #42355.



git-svn-id: https://develop.svn.wordpress.org/trunk@43667 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-02 19:29:18 +00:00
Gary Pendergast 456e243224 Taxonomies: Improve description of default category behaviour.
Add some extra information to the Categories list screen, explaining why the default category doesn't have a Delete button.

Props Codestor.
Fixes #44961.



git-svn-id: https://develop.svn.wordpress.org/trunk@43666 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-02 19:18:58 +00:00
Gary Pendergast 2b49d4660b Docs: Replace incorrect usage of "who's" with "whose".
Whom can say who's "whose" is who's? Is it a Who that Horton heard? Maybe it's The Who whose "who" knowledge will hook whomever hoots "who's" instead of "whose".

Hoot. Hoot.

Props Hafiz.
Fixes #45026.



git-svn-id: https://develop.svn.wordpress.org/trunk@43665 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-02 16:22:46 +00:00
Gary Pendergast ad1f484317 Posts: Remove the slug from Quick Edit for CPTs with `publicly_queryable` disabled.
In the full edit screen, CPTs that have disabled the `publicly_queryable` option will hide the slug field, as it doesn't need to be edited. This change brings the Quick Edit view into line with that behaviour.

Props bhargavmehta, krutidugade.
Fixes #43278.



git-svn-id: https://develop.svn.wordpress.org/trunk@43664 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-02 15:52:15 +00:00
Gary Pendergast 75c7cb5acf Taxonomy: Remove the "Note" label from the notes on the Category edit list.
There are notes on both the Tag and Category pages, but only the latter prefixes it with a "Note" label.

Props joanrho, pratikthink, jainnidhi.
Fixes #43800.



git-svn-id: https://develop.svn.wordpress.org/trunk@43663 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-01 21:55:33 +00:00
Gary Pendergast a386f726da Docs: Add a file header comment to version.php.
Props sephsekla, bruceallen.
Fixes #43765.



git-svn-id: https://develop.svn.wordpress.org/trunk@43662 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-01 20:59:26 +00:00
Sergey Biryukov a2017354e2 Docs: Document that the `$src` parameter of `WP_Dependencies::add()` can be boolean.
Props dimadin.
Fixes #45009.

git-svn-id: https://develop.svn.wordpress.org/trunk@43661 602fd350-edb4-49c9-b593-d223f7449a82
2018-09-28 21:50:45 +00:00
Sergey Biryukov c2ab97264d Users: Pass the current `WP_User_Query` instance to `found_users_query` filter.
Props spacedmonkey.
Fixes #43679.

git-svn-id: https://develop.svn.wordpress.org/trunk@43660 602fd350-edb4-49c9-b593-d223f7449a82
2018-09-24 22:53:12 +00:00
Sergey Biryukov 45efe978fc Twenty Seventeen: Use a simple counter incremented with each call instead of `uniqid()` for generating unique IDs for HTML elements.
Props westonruter.
Fixes #44883.

git-svn-id: https://develop.svn.wordpress.org/trunk@43659 602fd350-edb4-49c9-b593-d223f7449a82
2018-09-24 20:56:59 +00:00
Sergey Biryukov e1ff4cd7cd General: Introduce `wp_unique_id()`, a PHP implementation of Underscore's `uniqueId` method.
A static variable contains an integer that is incremented with each call. This number is returned with the optional prefix.
As such the returned value is not universally unique, but it is unique across the life of the PHP process.

Props westonruter, dlh.
See #44883.

git-svn-id: https://develop.svn.wordpress.org/trunk@43658 602fd350-edb4-49c9-b593-d223f7449a82
2018-09-24 20:56:30 +00:00
Sergey Biryukov 75a5293460 Docs: Add a line break to `wp_is_uuid()` DocBlock for better readability.
See #42505.

git-svn-id: https://develop.svn.wordpress.org/trunk@43657 602fd350-edb4-49c9-b593-d223f7449a82
2018-09-24 20:45:01 +00:00
Felix Arntz c12a0cf4f3 Multisite: Fix coding standard errors after [43654].
See #41333.


git-svn-id: https://develop.svn.wordpress.org/trunk@43655 602fd350-edb4-49c9-b593-d223f7449a82
2018-09-24 15:22:01 +00:00
Felix Arntz 1795dbe25a Multisite: Introduce a site initialization and uninitialization API.
This changeset makes the new CRUD API for sites introduced in [43548] usable for real-world sites. A new function `wp_initialize_site()`, which takes care of creating a site's database tables and populating them with initial values, is hooked into the site insertion process that is initiated when calling `wp_insert_site()`. Similarly, a new function `wp_uninitialize_site()`, which takes care of dropping a site's database tables, is hooked into the site deletion process that is initiated when calling `wp_delete_site()`.

A new function `wp_is_site_initialized()` completes the API, allowing to check whether a site is initialized. Since this function always makes a database request in its default behavior, it should be called with caution. Plugins that would like to use site initialization in special ways can leverage a `pre_wp_is_site_initialized` filter to alter that default behavior.

The separate handling of the site's row in the `wp_blogs` database table and the actual site setup allows for more flexibility in controlling whether or how a site's data is set up. For example, a unit test that only checks data from the site's database table row can unhook the site initialization process to improve performance. At the same time, developers consuming the new sites API only need to know about the CRUD functions, since the initialization and uninitialization processes happen internally.

With this changeset, the foundation for a sites REST API endpoint is fully available. The previously recommended functions `wpmu_create_blog()` and `wpmu_delete_blog()` now call the new respective function internally. Further follow-up work to this includes replacing calls to `wpmu_create_blog()` with `wp_insert_site()`, `update_blog_details()` with `wp_update_site()` and `wpmu_delete_blog()` with `wp_delete_blog()` throughout the codebase.

As a side-effect of this work, the `wpmu_new_blog`, `delete_blog`, and `deleted_blog` actions and the `install_blog()` function have been deprecated.

Fixes #41333. See #40364.


git-svn-id: https://develop.svn.wordpress.org/trunk@43654 602fd350-edb4-49c9-b593-d223f7449a82
2018-09-24 15:08:32 +00:00
Aaron Jorbin 6604782cd9 General: PHP7.3 throws an `E_WARNING` when using continue to target a switch
Applying continue to a switch is equivalent to using break and quite possibly, a continue targeting a higher level control structure is actually intended.

To target the higher level control structure, a numeric argument has to be passed to continue. This fixes two cases in WordPress Core where this is currently happening.

See: https://github.com/php/php-src/pull/3364
See: https://wiki.php.net/rfc/continue_on_switch_deprecation

Props jrf.
Fixes #44543.



git-svn-id: https://develop.svn.wordpress.org/trunk@43653 602fd350-edb4-49c9-b593-d223f7449a82
2018-09-23 22:49:02 +00:00
SergeyBiryukov fb2699f28d Tests: Add missing `public` access modifier to `Tests_REST_Server` methods.
Props andizer.
Fixes #44939.

git-svn-id: https://develop.svn.wordpress.org/trunk@43652 602fd350-edb4-49c9-b593-d223f7449a82
2018-09-23 15:45:02 +00:00
Sergey Biryukov 33074d8c67 Users: Add `LIMIT 1` to SQL query in `WP_User::get_data_by()`, as only one row is requested.
Props spacedmonkey.
Fixes #43692.

git-svn-id: https://develop.svn.wordpress.org/trunk@43651 602fd350-edb4-49c9-b593-d223f7449a82
2018-09-23 15:32:48 +00:00
Sergey Biryukov e9eaabaf14 Upgrade/Install: Adjust table prefix string check in `setup-config.php` for the coding standards change in [42343].
Props shashwatmittal, allendav.
Fixes #44318.

git-svn-id: https://develop.svn.wordpress.org/trunk@43650 602fd350-edb4-49c9-b593-d223f7449a82
2018-09-20 05:14:21 +00:00
Sergey Biryukov 2724e2d0fe Tests: Restore `restapi` group on `WP_Test_REST_Revisions_Controller`.
See #40510.

git-svn-id: https://develop.svn.wordpress.org/trunk@43647 602fd350-edb4-49c9-b593-d223f7449a82
2018-09-18 03:44:57 +00:00
John Blackbourn 629c76c31b Build/Test Tools: Implement the automatic retry functionality that Travis CI provides.
This functionality will cause the command to be retried up to three times in case of a non-zero return value. Implementing it on commands that perform network requests means that intermittent network failures are less likely to cause a build to fail, as they'll be retried up to three times.

See #44858


git-svn-id: https://develop.svn.wordpress.org/trunk@43645 602fd350-edb4-49c9-b593-d223f7449a82
2018-09-15 09:21:55 +00:00
John Blackbourn 3493feaa5a Docs: Improve docblocks within `wp-login.php`.
Props birgire

See #42505


git-svn-id: https://develop.svn.wordpress.org/trunk@43644 602fd350-edb4-49c9-b593-d223f7449a82
2018-09-14 13:47:01 +00:00
John Blackbourn 948a5ef28b Docs: Correct and improve docblocks for user session management functionality.
See #42505


git-svn-id: https://develop.svn.wordpress.org/trunk@43643 602fd350-edb4-49c9-b593-d223f7449a82
2018-09-14 13:44:50 +00:00
John Blackbourn b2374bf1ad Docs: Correct and improve some docblocks.
See #42505


git-svn-id: https://develop.svn.wordpress.org/trunk@43642 602fd350-edb4-49c9-b593-d223f7449a82
2018-09-14 13:34:50 +00:00
Felix Arntz ffa16fa771 Upgrade/Install: Properly exclude the `admin/includesSchema.php` tests file for the `WordPress.DB.PreparedSQL.NotPrepared` sniff.
The way this was implemented in [43630] caused the file to be excluded for all sniffs, since PHPCS does not support file-wide ignores of a specific sniff at this point.

Props jrf.
See #44896.


git-svn-id: https://develop.svn.wordpress.org/trunk@43641 602fd350-edb4-49c9-b593-d223f7449a82
2018-09-14 07:54:53 +00:00
Ian Dunn 7d22ba1961 Privacy: Add test for `wp_privacy_export_expiration` filter.
Props desrosj.
See #44233.


git-svn-id: https://develop.svn.wordpress.org/trunk@43640 602fd350-edb4-49c9-b593-d223f7449a82
2018-09-13 17:25:31 +00:00
Sergey Biryukov df261c632a Docs: Correct `@since` value for `_wp_privacy_statuses()`.
Fix typo in `@since` entry for `WP_Privacy_Policy_Content:add()`.

Props dimadin.
Fixes #44915.

git-svn-id: https://develop.svn.wordpress.org/trunk@43638 602fd350-edb4-49c9-b593-d223f7449a82
2018-09-13 10:19:28 +00:00
K. Adam White e29d895ffd REST API: Pass correct ID to `meta->update_value` to permit setting term meta during term creation.
Props joehoyle.
Fixes #44834.



git-svn-id: https://develop.svn.wordpress.org/trunk@43636 602fd350-edb4-49c9-b593-d223f7449a82
2018-09-12 23:55:47 +00:00
Dominik Schilling (ocean90) 82bf9baa32 I18N: In the POMO library, replace `chr()` calls for static values with their string representation.
Props ccismaru, ocean90.
Fixes #17128.

git-svn-id: https://develop.svn.wordpress.org/trunk@43635 602fd350-edb4-49c9-b593-d223f7449a82
2018-09-12 06:10:42 +00:00