Commit Graph

38672 Commits

Author SHA1 Message Date
Felix Arntz b0c83c8ee7 General: Provide context parameters to `doing_it_wrong_trigger_error` filter.
`$function`, `$message`, and `$version` have historically been passed to the `doing_it_wrong_run` action. It makes sense to pass those to the filter as well, so that one can conditionally determine the filter value to return.

Fixes #34183.


git-svn-id: https://develop.svn.wordpress.org/trunk@43587 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-28 13:37:26 +00:00
Felix Arntz aa5b179247 REST API: Fix failing tests after [43584] and [43585].
See #40510.


git-svn-id: https://develop.svn.wordpress.org/trunk@43586 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-28 13:04:07 +00:00
Felix Arntz 65cadaab62 REST API: Fix failing tests after [43584].
See #40510.


git-svn-id: https://develop.svn.wordpress.org/trunk@43585 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-28 12:43:50 +00:00
Felix Arntz e5d6ddfeee REST API: Support pagination, order, search and other common query parameters for revisions.
The original REST API revisions controller relied on `wp_get_post_revisions()`, getting all revisions of a post without any possibility to restrict the result. This changeset replaces that function call with a proper `WP_Query` setup, replicating how `wp_get_post_revisions()` works while offering parameters to alter the default behavior.

Props adamsilverstein, birgire, flixos90.
Fixes #40510.


git-svn-id: https://develop.svn.wordpress.org/trunk@43584 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-28 12:22:48 +00:00
John Blackbourn ecf24cd572 Docs: Improve inline documentation for `WP_Scripts`.
Props desrosj

See #42505


git-svn-id: https://develop.svn.wordpress.org/trunk@43583 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-27 14:33:35 +00:00
John Blackbourn 5af7160563 Docs: Correct and improve various inline documentation.
See #42505


git-svn-id: https://develop.svn.wordpress.org/trunk@43582 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-27 14:27:22 +00:00
Andrew Ozz 28dcba340c TinyMCE: remove stray CSS map reference from `skin.min.css`.
Props: pross.
Fixes #44785.

git-svn-id: https://develop.svn.wordpress.org/trunk@43581 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-20 15:08:15 +00:00
Andrew Ozz fa35f06219 Script loader: remove (PHP based) compression from `load-styles.php` and `load-scripts.php`. WIth the amount of scripts and stylesheets grown a lot over the years, it has become pretty slow and consumes a lot of server resources. Also, most servers are set to compress PHP output anyway.
Props LucasRolff, azaozz.

Fixes #44815.
See #43308.

git-svn-id: https://develop.svn.wordpress.org/trunk@43580 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-20 13:50:49 +00:00
Andrew Ozz 9d6176e3c9 Reorder `quicktags.js` a bit to account for the order of defining vars and functions after [43577].
See #44371.

git-svn-id: https://develop.svn.wordpress.org/trunk@43579 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-20 13:33:59 +00:00
Felix Arntz 1e4e60f11c Customize: Safeguard a check on the `customize_validate_{$setting_id}` filter value to ensure it is a `WP_Error`.
While the filter is documented to only support a `WP_Error`, it has been a common practice to return true in a validation function if no errors have occurred. This was already caught when the same filter was executed in `WP_Customize_Setting`, it was however missing in `WP_Customize_Manager::validate_setting_values()`.

Fixes #44809.


git-svn-id: https://develop.svn.wordpress.org/trunk@43578 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-19 16:37:12 +00:00
Omar Reiss 8347d7e22f General: Explicitly assigns all JS globals to the window.
Many variables in the JavaScript were defined in the global scope without being explicitly assigned to the window. When built with Webpack, the code gets encapsulated in anonymous functions and those implicit globals get assigned to the wrong scope. This patch prevents that from happening.

Fixes #44371. See #43731.


git-svn-id: https://develop.svn.wordpress.org/trunk@43577 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-19 13:32:27 +00:00
John Blackbourn 7d54198c7c Docs: Remove an erroneous closing brace from the description of `wp_list_pages()`.
Props birgire

See #42505


git-svn-id: https://develop.svn.wordpress.org/trunk@43576 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-19 11:16:59 +00:00
John Blackbourn 8454fd7918 Customize: Increase the colour contrast of the line numbers in CodeMirror.
Props earnjam, abdullahramzan, audrasjb, Luminus

Fixes #44763


git-svn-id: https://develop.svn.wordpress.org/trunk@43574 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-19 11:00:46 +00:00
Sergey Biryukov 8bbae6aeb1 Administration: Remove `$title_class` variable, unused since [18683].
Props hitendra-chopda, torontodigits.
Fixes #44812.

git-svn-id: https://develop.svn.wordpress.org/trunk@43573 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-19 10:17:50 +00:00
Gary Pendergast 63acd3caaa Tests: Revert `wp-api-generated.js` change added in [43571].
The fixtures file was accidentally included in [43571], but that caused other tests to fail.

See #39122.



git-svn-id: https://develop.svn.wordpress.org/trunk@43572 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-17 04:11:48 +00:00
Gary Pendergast a75d153eee Coding Standards: Upgrade WPCS to 1.0.0
WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues.

This change includes three notable additions:
- Multiline function calls must now put each parameter on a new line.
- Auto-formatting files is now part of the `grunt precommit` script. 
- Auto-fixable coding standards issues will now cause Travis failures.

Fixes #44600.



git-svn-id: https://develop.svn.wordpress.org/trunk@43571 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-17 01:50:26 +00:00
Boone Gorges fed48ba3fe Introduce `wp_insert_term_duplicate_term_check` filter.
This filter allows plugins to intervene in the duplicate-term check
that takes place at the time of term creation. See [30238], #22023.

Props strategio.
Fixes #43271.

git-svn-id: https://develop.svn.wordpress.org/trunk@43570 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-15 19:49:50 +00:00
Gary Pendergast cb3d1777b1 Coding Standards: Prepare for upgrading WPCS to 1.0.0.
In order to get the best result when running `phpcbf` across the codebase, there are some manual tweaks we need to make.

These fall into three categories:
- Fixing incorrectly indented code which has flow-on effects when auto-fixing.
- Tweaking the layout of inline PHP inside HTML tags.
- Moving more complex inline PHP inside HTML tags, to execute earlier.

See #44600.



git-svn-id: https://develop.svn.wordpress.org/trunk@43569 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-15 06:22:00 +00:00
Sergey Biryukov c5d013bf95 Privacy: Ensure the user request email is sent in the requested user's locale (or the site's default locale if they are not a registered user) when the administrator creating the request uses a different locale.
Props desrosj, Chouby, iandunn, lbenicio, birgire, earnjam, swissspidy, garrett-eclipse.
Fixes #43985.

git-svn-id: https://develop.svn.wordpress.org/trunk@43568 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-13 16:31:31 +00:00
K. Adam White 20ab5ca79e Tests: Improve coverage for REST API term meta registration.
Introduce tests to validate that register_meta and register_term_meta work as expected in WP_REST_Terms_Controller.

props timmydcrawford.
Fixes #39122.


git-svn-id: https://develop.svn.wordpress.org/trunk@43567 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-12 00:05:39 +00:00
K. Adam White 245fb8e9b0 REST API: generate a valid fallback URI in wp.api.utils.getRootURL.
When window.location.origin isn't set, correctly insert two slashes between the protocol and host when constructing the fallback URL.

props abdullahramzan.
Fixes #44764.


git-svn-id: https://develop.svn.wordpress.org/trunk@43566 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-11 18:50:23 +00:00
Sergey Biryukov 244f435e22 Script/Style Dependencies: Make sure that inline scripts for handles without a source are printed.
See [36550] for `WP_Styles`.

Props bpayton.
Fixes #44551.

git-svn-id: https://develop.svn.wordpress.org/trunk@43565 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-11 17:41:29 +00:00
Sergey Biryukov cbf8f438d7 Script/Style Dependencies: Simplify some logic in `WP_Styles::do_item()`.
Combine repetitive assignments, make the code more consistent with `WP_Scripts::do_item()`.

See #44551.

git-svn-id: https://develop.svn.wordpress.org/trunk@43564 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-11 17:41:02 +00:00
Sergey Biryukov b87cc1ceb9 Docs: Correct description for `WP_Scripts::$default_version`.
See #42505.

git-svn-id: https://develop.svn.wordpress.org/trunk@43563 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-11 15:08:23 +00:00
Sergey Biryukov 3b4b754f2a Tests: Avoid a race condition in `test_date_i18n_handles_shorthand_formats()` by using a delta for comparing timestamps.
See #20973, #38381.

git-svn-id: https://develop.svn.wordpress.org/trunk@43562 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-11 13:28:26 +00:00
Sergey Biryukov 28a6760634 Customize: Pass missing parameter to dynamic `option_{$option}` filter in `WP_Customize_Widgets::capture_filter_pre_get_option()`.
Props dlh.
Fixes #44770.

git-svn-id: https://develop.svn.wordpress.org/trunk@43561 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-11 12:44:22 +00:00
Rachel Baker 7e879f48f1 Docs: Update $meta_type descriptions to include ’term’ as a valid type in meta.php and class-wp-term-query.php.
Props macbookandrew.
Merges [43557] to trunk.
Fixes #44751.


git-svn-id: https://develop.svn.wordpress.org/trunk@43560 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-08 21:44:31 +00:00
Boone Gorges ed2fff61d7 Correct param documentation for `WP_Term_Query`.
The description of `$meta_type` introduced in [40053] was incorrect.

Props dlh.
Fixes #44608.

git-svn-id: https://develop.svn.wordpress.org/trunk@43559 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-08 19:22:39 +00:00
Boone Gorges 90a3ab5f80 Taxonomy: Introduce new hooks when registering/unregistering taxonomies for object types.
Props soulseekah.
Fixes #44733.

git-svn-id: https://develop.svn.wordpress.org/trunk@43558 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-08 19:14:08 +00:00
obenland c52e7c79b2 Toolbar: Check if `obj` is set before using it.
Props pento.
See #44526.


git-svn-id: https://develop.svn.wordpress.org/trunk@43556 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-06 19:32:12 +00:00
Sergey Biryukov 4ce3db3e8d Build/Test Tools: Add documentation for `tests_add_filter()`, `_test_filter_build_unique_id()`, `_delete_all_data()`, `_delete_all_posts()`.
Props andizer.
Fixes #44703.

git-svn-id: https://develop.svn.wordpress.org/trunk@43555 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-02 22:35:10 +00:00
laurelfulford 49a6596d7e Twenty Seventeen: Correct date in changelog for 4.9.8 release.
Props pbiron, laurelfulford.
Fixes #44646.



git-svn-id: https://develop.svn.wordpress.org/trunk@43550 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-02 15:32:26 +00:00
Sergey Biryukov e26a5d64d1 Docs: Correct parameter name in `strip_shortcodes_tagnames` filter DocBlock.
Props uttam007.
Fixes #44691.

git-svn-id: https://develop.svn.wordpress.org/trunk@43549 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-02 15:12:56 +00:00
Felix Arntz c29d019762 Multisite: Complete the new CRUD API for managing sites.
New functions `wp_insert_site( $data )`, `wp_update_site( $id, $data )` and `wp_delete_site( $id )` are introduced to manage site rows in the `wp_blogs` table, forming the new CRUD API together with the existing `get_site()` / `get_sites()`. The new API provides various benefits over the previously existing API, fixing several cache invalidation issues and being hook-driven so that normalization and validation of the passed data can be fully customized.

New hooks introduced as part of this are the actions `wp_insert_site`, `wp_update_site`, `wp_delete_site`, `wp_validate_site_data` and the filter `wp_normalize_site_data`.

At this point, `wp_insert_site()` does not handle setting up the site's database tables, and `wp_delete_site()` does not handle dropping the site's database tables, so the two can not yet be used directly as full replacements of `wpmu_create_blog()` and `wpmu_delete_blog()`. Managing the site's database tables will be added via hooks as part of the follow-up ticket #41333.

The existing functions `wpmu_create_blog()`, `update_blog_details()`, and `wpmu_delete_blog()` make use of the respective new counterpart and will be obsolete once #41333 has been completed.

Props flixos90, jeremyfelt, spacedmonkey.
Fixes #40364.


git-svn-id: https://develop.svn.wordpress.org/trunk@43548 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-01 13:05:44 +00:00
Aaron Jorbin df9dd119a5 Gutenbeg: you can't remove call outs that don't exist
This commit should have just gone into the 4.9 branch. It did in [43544].

See: #44680
Unprops jorbin
props ocean90


git-svn-id: https://develop.svn.wordpress.org/trunk@43545 602fd350-edb4-49c9-b593-d223f7449a82
2018-07-31 15:15:31 +00:00
Aaron Jorbin 8ed24bbbda Gutenberg: Restrict "Try Gutenberg" based on capability and gutenstatus
When Gutenberg is either not installed, or not activated, only show the callout to users with the install_plugins capability.
When Gutenberg is activated, expand that to include all users with the edit_posts capability.

Props pento.
Fixes #44680.


git-svn-id: https://develop.svn.wordpress.org/trunk@43543 602fd350-edb4-49c9-b593-d223f7449a82
2018-07-31 14:41:46 +00:00
John Blackbourn ae69878202 Login and Registration: Pass the `$errors` parameter to the `lost_password` action.
Props sebakurzyn

Fixes #44512


git-svn-id: https://develop.svn.wordpress.org/trunk@43542 602fd350-edb4-49c9-b593-d223f7449a82
2018-07-28 13:01:30 +00:00
laurelfulford a3dcfa9f91 Twenty Seventeen: Bump version number and update changelog for 4.9.8 release.
Props pbiron.
Fixes #44646.


git-svn-id: https://develop.svn.wordpress.org/trunk@43541 602fd350-edb4-49c9-b593-d223f7449a82
2018-07-27 18:36:35 +00:00
Peter Wilson a32ea2d35d Cron: Add hooks and a function to allow hijacking cron implementation.
This allows sites with a large cron option or a custom cron implementation to hijack the cron option to store cron data using custom functionality.

`wp_get_scheduled_event()` is new function to retrieve the event object for a given event based on the hook name, arguments and timestamp. If no timestamp is specified the next occurence is returned.

Preflight filters are added to all functions that read from or modify the cron option: `pre_schedule_event`, `pre_reschedule_event`, `pre_unschedule_event`, `pre_clear_scheduled_hook`, `pre_unschedule_hook`, `pre_get_scheduled_event` and `pre_next_scheduled`.

Additionally, the post scheduling hooks `next_scheduled` and `get_schedule` to allow plugins to modify an event after retrieving it from WordPress.

Props rmccue, DavidAnderson, ethitter, peterwilsoncc.
Fixes #32656.



git-svn-id: https://develop.svn.wordpress.org/trunk@43540 602fd350-edb4-49c9-b593-d223f7449a82
2018-07-27 02:22:50 +00:00
Sergey Biryukov 927cd42632 Posts, Post Types: Introduce `edit_post_{$post->post_type}` hook.
The hook fires before the general `edit_post` hook and has the same parameters.

It also complements the `save_post_{$post->post_type}` hook added in [25050].

Props Mte90, garrett-eclipse.
Fixes #34706.

git-svn-id: https://develop.svn.wordpress.org/trunk@43535 602fd350-edb4-49c9-b593-d223f7449a82
2018-07-25 20:56:39 +00:00
Sergey Biryukov ddc8f803c6 Privacy: Revert [43525].
The commenter cookies checkbox is not legally required, so should be disabled by default.

Fixes #44373.

git-svn-id: https://develop.svn.wordpress.org/trunk@43531 602fd350-edb4-49c9-b593-d223f7449a82
2018-07-24 17:05:56 +00:00
Sergey Biryukov 0f7e947546 REST API: Ensure attachments created with `WP_REST_Attachments_Controller::create_item()` on Windows have a relative path.
Props ocean90, SergeyBiryukov, redcastor.
Fixes #40861.

git-svn-id: https://develop.svn.wordpress.org/trunk@43529 602fd350-edb4-49c9-b593-d223f7449a82
2018-07-24 16:51:09 +00:00
Sergey Biryukov 6c32fcd011 I18N: Separate two "About" strings with different context.
Props desrosj, XpertOne, Nao.
Fixes #44139.

git-svn-id: https://develop.svn.wordpress.org/trunk@43527 602fd350-edb4-49c9-b593-d223f7449a82
2018-07-24 15:03:19 +00:00
Sergey Biryukov 335b69cedc Privacy: Remove the setting to enable comment cookies consent added in [43469].
This needs some more work to ensure expected behaviour.

See #44373.

git-svn-id: https://develop.svn.wordpress.org/trunk@43525 602fd350-edb4-49c9-b593-d223f7449a82
2018-07-24 12:50:55 +00:00
K. Adam White 3aba622692 Docs: Add `$object_subtype` param documentation for `sanitize_meta()`.
Props timothyblynjacobs.

See #38323.


git-svn-id: https://develop.svn.wordpress.org/trunk@43521 602fd350-edb4-49c9-b593-d223f7449a82
2018-07-23 17:13:40 +00:00
K. Adam White 9fd092fb71 Docs: Update @since version to 4.9.8 for meta registration subtype handling.
This feature has been backported to 4.9.8 so 5.0.0 is inaccurate.

See #38323.


git-svn-id: https://develop.svn.wordpress.org/trunk@43520 602fd350-edb4-49c9-b593-d223f7449a82
2018-07-23 17:01:02 +00:00
John Blackbourn 796bac8645 Docs: Correct the parameter type for `WP_REST_Post_Types_Controller::prepare_item_for_response()`.
Props subrataemfluence

Fixes #44437


git-svn-id: https://develop.svn.wordpress.org/trunk@43519 602fd350-edb4-49c9-b593-d223f7449a82
2018-07-22 12:25:48 +00:00
Sergey Biryukov 8a0aac2ccb Comments: Ensure that themes overriding default `comment_form()` fields still display the cookies consent checkbox.
The `comment_form_default_fields` filter can be used to remove the checkbox.

Props pross, SergeyBiryukov.
Fixes #44126.

git-svn-id: https://develop.svn.wordpress.org/trunk@43518 602fd350-edb4-49c9-b593-d223f7449a82
2018-07-20 00:37:40 +00:00
obenland 9d4b0ec88f Toolbar: Fail gracefully when adding events to non-existent elements
Avoids a type error when `obj` is not set.

Fixes #44526.


git-svn-id: https://develop.svn.wordpress.org/trunk@43517 602fd350-edb4-49c9-b593-d223f7449a82
2018-07-19 21:59:23 +00:00
Sergey Biryukov e7d9ee5051 Privacy: Improve grammar on Privacy Settings screen.
Props ianbelanger, garrett-eclipse.
Fixes #44612.

git-svn-id: https://develop.svn.wordpress.org/trunk@43513 602fd350-edb4-49c9-b593-d223f7449a82
2018-07-19 20:13:29 +00:00