Commit Graph

2499 Commits

Author SHA1 Message Date
Boone Gorges 04b5965866 Introduce `paged` argument to `WP_Comment_Query`.
Using `paged` with `number` allows developers to request
paginated comment results without having to do a manual offset
calculation.

Props AdamWills.
Fixes #38268.

git-svn-id: https://develop.svn.wordpress.org/trunk@41287 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-21 15:34:19 +00:00
John Blackbourn 5d068e3149 Build/Test tools: Revert [41278] because the PHP 5.2 environment on Travis doesn't support OpenSSL, hence the tests fail.
See #41676


git-svn-id: https://develop.svn.wordpress.org/trunk@41279 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-20 12:58:59 +00:00
John Blackbourn dcfe7794c6 Build/Test tools: Don't skip tests which rely on OpenSSL when the `openssl` extension isn't loaded.
See #41676


git-svn-id: https://develop.svn.wordpress.org/trunk@41278 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-20 12:30:26 +00:00
Felix Arntz f16b2a650e Role/Capability: Introduce capabilities dedicated to installing and updating language files.
The new meta capabilities are called `install_languages` and `update_languages`. Prior to this change, there were no proper capability checks applied. Instead only the filesystem and related constants were checked, and for actual permissions a rather vague fallback was used where a user needed to have at least one of the other updating capabilities. In addition to being generally more verbose, the new capabilities make it possible for example to allow a user to update languages, but nothing else. By default they fall back to the original way of how they were handled.

Props johnbillion, flixos90.
Fixes #39677.


git-svn-id: https://develop.svn.wordpress.org/trunk@41268 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-18 18:30:28 +00:00
Felix Arntz c56dd07a30 Post Thumbnails: Pass post ID to `post_thumbnail_size` filter.
In addition to the enhancement, tests for the filter usage including the new parameter have been added.

Props NathanAtmoz.
Fixes #39030.


git-svn-id: https://develop.svn.wordpress.org/trunk@41267 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-18 18:18:51 +00:00
Konstantin Obenland 677082be4b Widgets: Add tests for `retrieve_widgets()`.
Helps with maintaining back compat when making changes in the future.

See #39693.



git-svn-id: https://develop.svn.wordpress.org/trunk@41266 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-18 15:03:43 +00:00
Gary Pendergast e78fe9ec6d Tests: Rename ignored tests in `multisite.xml`.
For  bonus :yolo: :friday:, this repeats [41262] for `multisite.xml`, which duplicates the ignored file list from `phpunit.xml.dist`.

See #41658.



git-svn-id: https://develop.svn.wordpress.org/trunk@41263 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-18 10:59:38 +00:00
Gary Pendergast 243053dfd3 Tests: Rename tests with underscore in the name
There were a handful of files with an underscore in the name, which violated our naming scheme, and caused problems for anyone how enforced the scheme on their own systems.

This commit renames all of the files to the correct camelCase scheme.

Fixes #41658.



git-svn-id: https://develop.svn.wordpress.org/trunk@41261 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-18 09:57:12 +00:00
Weston Ruter 66ee109e0a Widgets: Prevent visual Text widget from decoding encoded HTML.
Also apply `the_editor_content` filters on widget `text` with `format_for_editor()` as is done for the post editor.

Amends [40631].
Props westonruter, azaozz.
See #35243.
Fixes #41596.


git-svn-id: https://develop.svn.wordpress.org/trunk@41260 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-17 23:36:53 +00:00
John Blackbourn 9cd6551e54 Options, Meta APIs: Update the multisite unit tests after [41254], [41164], and [41163].
This moves some more previously Multisite-only tests into the main test suite, and makes small adjustments to their assertions.

See #39118, #16470, #39117


git-svn-id: https://develop.svn.wordpress.org/trunk@41255 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-15 09:15:53 +00:00
Weston Ruter 242efb0a24 Widgets: Suppress PHP warnings raised by `DOMDocument::loadHTML()` in `WP_Widget_Text::is_legacy_instance()` which could appear in Text widget forms.
Also explicitly use HTML5 doctype when parsing Text widget contents in legacy mode detection.

Amends [41050].
See #40951.
Fixes #41622.


git-svn-id: https://develop.svn.wordpress.org/trunk@41251 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-14 05:58:23 +00:00
Weston Ruter 3c8584e87f Widgets: Fix extensibility of Text widgets so that JS logic will initialize on subclassed widgets.
Amends [40631].
See #35243.
Fixes #41540.


git-svn-id: https://develop.svn.wordpress.org/trunk@41245 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-13 05:24:14 +00:00
Weston Ruter b4a8af7e35 Customize: Prevent `_delete_option_fresh_site()` from hitting DB if `fresh_site` flag already cleared.
Amends [38991].
Props dlh, westonruter.
Fixes #41039.


git-svn-id: https://develop.svn.wordpress.org/trunk@41244 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-13 00:56:24 +00:00
Weston Ruter 7bff33a6eb Customize: Fix PHP warning raised when deleting a setting from changeset via passing `null` as params in `WP_Customize_Manager::save_changeset_post()`.
Props dlh.
Fixes #41621.


git-svn-id: https://develop.svn.wordpress.org/trunk@41243 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-12 21:20:23 +00:00
Felix Arntz 440c8692e3 Multisite: Remove references to `$wpdb->siteid` and use `get_current_network_id()` instead.
Props sathyapulse, spacedmonkey.
Fixes #41507.


git-svn-id: https://develop.svn.wordpress.org/trunk@41242 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-12 13:10:24 +00:00
James Nylen d570de32ca REST API: Always call `rest_get_server()` instead of accessing the `$wp_rest_server` global.
This is a consistency improvement and also a bug fix for fairly obscure cases involving modified WP load order.

Fixes #41555.


git-svn-id: https://develop.svn.wordpress.org/trunk@41238 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-10 01:37:30 +00:00
Konstantin Obenland d339af1bc1 Map nav menu locations on theme switch
This will send nav menu locations through three levels of mapping:
1. If both themes have only one location, that gets mapped.
2. If both themes have locations with the same slug, they get mapped.
3. Locations that (even partially) match slugs from a similar kind of menu location will get mapped.

Menu locations are mapped for Live Previews in the Customizer and during theme switches.

Props westonruter, obenland, welcher, melchoyce.
Fixes #39692.



git-svn-id: https://develop.svn.wordpress.org/trunk@41237 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-09 21:03:16 +00:00
John Blackbourn 3e5005c30c Media: Move the `Tests_Media::test_video_shortcode_body()` method so it runs before other tests in the class that depend on it.
The following tests were never executed as they have `@depends` annotations which means they get skipped because the `test_video_shortcode_body()` test has not run by the time they run. Re-ordering the test methods fixes this.

* `test_wp_video_shortcode_with_empty_params()`
* `test_wp_video_shortcode_with_bad_attr()`
* `test_wp_video_shortcode_attributes()`
* `test_wp_video_shortcode_youtube_remove_feature()`
* `test_wp_video_shortcode_youtube_force_ssl()`
* `test_wp_video_shortcode_vimeo_force_ssl_remove_query_args()`
* `test_wp_video_shortcode_vimeo_adds_loop()`
* `test_wp_video_shortcode_vimeo_force_adds_loop_true()`

See #35367


git-svn-id: https://develop.svn.wordpress.org/trunk@41229 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-04 14:05:27 +00:00
John Blackbourn 14ff8eb16b REST API: Populate some missing tests from test cases which extend the controller test case.
See #41463


git-svn-id: https://develop.svn.wordpress.org/trunk@41228 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-04 13:55:04 +00:00
Felix Arntz 1e9777c220 REST API: Allow site administrators to edit user roles in multisite.
While site administrators cannot generally edit users in multisite, they have always been able to change the roles of users on their site. In the REST API however, this has not been possible so far. This changeset brings parity with how it is handled in the administration panel: A REST request to edit only a user's roles succeeds correctly, while a REST request to edit any further details of a user fails.

Props jnylen0.
Fixes #40263.


git-svn-id: https://develop.svn.wordpress.org/trunk@41226 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-03 21:58:50 +00:00
flixos90 0dc1e0633b Multisite: Introduce a `can_add_user_to_blog` filter to prevent adding a user to a site.
Under certain circumstances, it can be necessary that a user should not be added to a site, beyond the restrictions that WordPress core applies. With the new `can_add_user_to_blog` filter, plugin developers can run custom checks and return an error in case of a failure, that will prevent the user from being added.

The user-facing parts and the REST API route that interact with `add_user_to_blog()` have been adjusted accordingly to provide appropriate error feedback when a user could not be added to a site. Furthermore, two existing error feedback messages in the site admin's "New User" screen have been adjusted to properly show inside an error notice instead of a success notice.

Props jmdodd.
Fixes #41101.


git-svn-id: https://develop.svn.wordpress.org/trunk@41225 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-03 21:40:02 +00:00
James Nylen da5ece4d6d REST API: Exclude numeric parameters from regex parsing
The list of endpoint parameters should only include explicitly named and requested parameters.

Props flixos90, rmccue, jnylen0.
Fixes #40704.


git-svn-id: https://develop.svn.wordpress.org/trunk@41223 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-03 19:54:56 +00:00
John Blackbourn 3aadc71579 General: Fix various instances of incorrect filter docs and incorrect filter and action parameters.
Props keesiemeijer for identifying the issues

See #38462


git-svn-id: https://develop.svn.wordpress.org/trunk@41219 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-03 15:42:45 +00:00
Weston Ruter 9c1005410f Customize: Introduce `settings_previewed` arg and getter on `WP_Customize_Manager` which controls whether `WP_Customize_Setting::preview()` should be called on settings.
The `settings_previewed` property eliminates the need for the Customizer components from having to look at global `doing_ajax` state. This is in particular needed when saving settings, as some settings will short-circuit the update operation if they detect no changes are introduced. This is also needed for low-level integrations with the Customizer, such as in REST API endpoints under development.

Props stubgo, westonruter, utkarshpatel for testing.
See #38900.
Fixes #39221.


git-svn-id: https://develop.svn.wordpress.org/trunk@41205 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-02 05:34:32 +00:00
Weston Ruter 57e57505ba Customize: For selective refresh of nav menus, prevent `preg_replace()` from dropping backslashes in JSON replaced into the `data-customize-partial-placement-context` HTML attribute.
Props dlh, westonruter.
Fixes #41488.


git-svn-id: https://develop.svn.wordpress.org/trunk@41204 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-02 05:10:05 +00:00
Weston Ruter a0748817c6 Media: Upgrade MediaElement.js from 2.22.0 to 4.2.3.
Props rafa8626, grosbouff, westonruter, azaozz, Plastikschnitzer for testing.
See #39686.


git-svn-id: https://develop.svn.wordpress.org/trunk@41198 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-01 04:42:58 +00:00
Boone Gorges 37a8fe8b9b Comments: Ignore the 'fields' parameter in the comment query cache.
`WP_Comment_Query` always queries runs an ID query, and so is unaffected
by the 'fields' parameter. As such, 'fields' can be ignored when building
a cache key for the results of the ID query.

Props spacedmonkey.
Fixes #41348.

git-svn-id: https://develop.svn.wordpress.org/trunk@41190 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-30 14:55:17 +00:00
Boone Gorges a42a7970d9 Ensure that an assertion takes place in `Tests_Comment_Query::test_comment_query_should_be_cached()`.
Missed during [37608]. See #36906.

Fixes #41357.

git-svn-id: https://develop.svn.wordpress.org/trunk@41188 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-30 14:42:56 +00:00
Sergey Biryukov ddc6fafd06 Post Formats: In `bulk_edit_posts()`, set post format before the post is updated, for consistency with `edit_post()`.
This makes sure that plugins hooked to `save_post` get the right post format.

Props Chouby, SergeyBiryukov.
Fixes #41396.

git-svn-id: https://develop.svn.wordpress.org/trunk@41187 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-30 14:40:42 +00:00
Sergey Biryukov 37ce2ffe85 Tests: Fully reset MockPHPMailer between tests.
Props pessoft.
Fixes #41485.

git-svn-id: https://develop.svn.wordpress.org/trunk@41185 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-29 20:52:45 +00:00
John Blackbourn 3304df16d8 REST API: Add some missing assertions to various REST API tests.
See #41463


git-svn-id: https://develop.svn.wordpress.org/trunk@41176 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-27 19:03:45 +00:00
John Blackbourn e0dd90123d General: Avoid counting uncountable values when reading theme directories, and in some unit tests.
See #40109


git-svn-id: https://develop.svn.wordpress.org/trunk@41174 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-27 16:59:36 +00:00
John Blackbourn c880ed1c97 Formatting: Update the author description tests since the formatting change made in [41172].
See #40040


git-svn-id: https://develop.svn.wordpress.org/trunk@41173 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-27 16:05:19 +00:00
John Blackbourn 1071986cb9 Users: Further fixes to entitiy decoding in the user email address change confirmation email, and the corresponding tests.
See #16470, #40015


git-svn-id: https://develop.svn.wordpress.org/trunk@41171 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-27 14:58:06 +00:00
John Blackbourn b59d96d978 Users: Update some tests for admin email change confirmation emails after [41164].
See #40015, #39117


git-svn-id: https://develop.svn.wordpress.org/trunk@41170 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-27 14:33:31 +00:00
John Blackbourn 8fe419340a Build/Test Tools: Clarify the error message when running the test suite without the WordPress Importer plugin present in the test suite.
See #41345


git-svn-id: https://develop.svn.wordpress.org/trunk@41169 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-27 14:00:16 +00:00
John Blackbourn 34ee8c9d28 Users: Require a confirmation link in an email to be clicked when a user attempts to change their email address.
This adds this previously Multisite-only functionality to single site installations too. This change prevents accidental or erroneous email address changes from potentially locking users out of their account.

Props rodrigosprimo, tharsheblows, johnbillion

Fixes #16470


git-svn-id: https://develop.svn.wordpress.org/trunk@41163 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-27 02:09:51 +00:00
Gary Pendergast 7fc914baa2 REST API: Update the fixture data for `wp-api.js` tests.
[41139] changed how the REST API URL is generated, but included an incorrect version of `wp-api-generated.js`.

This updates the generator to create the correct `wp-api-generated.js`, and updates ``wp-api-generated.js`.

See #40886.



git-svn-id: https://develop.svn.wordpress.org/trunk@41154 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-26 03:52:41 +00:00
Gary Pendergast 029ce05801 REST API: Always add `index.php` to the REST URL when pretty permalinks are disabled.
When pretty permalinks are disabled, the web server will internally forward requests to `index.php`. Unfortunately, nginx only forwards HTTP/1.0 methods: `PUT`, `PATCH`, and `DELETE` methods will return a 405 error.

To work around this nginx behaviour, including `index.php` in the REST URL skips the internal redirect.

Fixes #40886.



git-svn-id: https://develop.svn.wordpress.org/trunk@41139 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-25 00:49:22 +00:00
John Blackbourn 44491ba49f Users: Ensure that users with no role on a site are taken into consideration when listing users on Multisite.
This ensures that users who are a member of a site but have no role are correctly listed on the Users screen and can be filtered from the 'None' role filter.

Props tobi823, flixos90, scottlee

Fixes #36196


git-svn-id: https://develop.svn.wordpress.org/trunk@41138 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-25 00:23:44 +00:00
Weston Ruter 021dcb13a1 Widgets: Improve notice in Text widget's legacy mode.
Also fixes phpunit test which broke in [41132].

Props melchoyce, westonruter, gk.loveweb.
See #41394, #35243, #40951, #40907.
Fixes #41386.


git-svn-id: https://develop.svn.wordpress.org/trunk@41134 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-24 23:10:06 +00:00
Weston Ruter 0cfe1b9136 Widgets: Rename Text widget's `legacy` mode to non-`visual` mode, restore boolean `filter` prop, and improve compatibility for `widget_text` filters applied in Custom HTML widget.
Props westonruter, obenland, timmydcrawford for testing.
Amends [41050].
See #35243, #40951, #40907.
Fixes #41394.


git-svn-id: https://develop.svn.wordpress.org/trunk@41132 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-24 22:45:55 +00:00
John Blackbourn 7a965fcfe6 Comments: Ensure the correct comment ID is passed to the `get_comment_author_url` filter.
Props dominik.schwind

Fixes #41334


git-svn-id: https://develop.svn.wordpress.org/trunk@41127 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-24 22:02:45 +00:00
Sergey Biryukov cf84ec6a30 Tests: Fix typo in `Tests_Functions_AllowedProtocols::data_example_urls()`.
Props redrambles.
Fixes #41415.

git-svn-id: https://develop.svn.wordpress.org/trunk@41124 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-24 10:02:52 +00:00
John Blackbourn 28e67acdce Docs: Correct some inline docs for the Ajax test case.
See #41017


git-svn-id: https://develop.svn.wordpress.org/trunk@41119 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-23 00:01:39 +00:00
Weston Ruter 94d95184b0 Widgets: Fix typo in phpunit test for Custom HTML widget in [41116].
Fixed was applied in 4.8 branch via [41117].
See #41392.


git-svn-id: https://develop.svn.wordpress.org/trunk@41118 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-21 21:21:29 +00:00
Weston Ruter 36c2f88a60 Widgets: Include `widget_text` class name on Custom HTML widget wrapper for theme styling compatibility, in addition to previously-added `textwidget` class on nested content container.
Amends [40893], [41115].
See #40907.
Fixes #41392 for trunk.


git-svn-id: https://develop.svn.wordpress.org/trunk@41116 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-21 21:01:45 +00:00
Weston Ruter 642693bb91 Widgets: Improve theme styling compatibility for Custom HTML widget by adding container with `textwidget` class.
The same styling from the Text widget should apply to the Custom HTML widget since users are expected to copy HTML from the (legacy) Text widget into the latter.

Amends [40893].
See #40907.
Fixes #41392.


git-svn-id: https://develop.svn.wordpress.org/trunk@41115 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-21 18:12:43 +00:00
James Nylen db6b7c6257 Tests: Be more helpful when the `wordpress-importer` plugin is missing.
Link to some documentation that explains the problem and how to resolve it.

Props enrico.sorcinelli.
Fixes #41345.


git-svn-id: https://develop.svn.wordpress.org/trunk@41090 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-19 10:37:41 +00:00
Weston Ruter c941da4468 Widgets: Replace adding `balanceTags` on `widget_custom_html_content` filter in favor of just applying `widget_text` filters in the Custom HTML widget.
Ensures that users who copy HTML from the Text widget in legacy mode over to the Custom HTML widget will continue to get all of the same filters applied, including tag balancing and shortcodes, if a plugin added support. Plugins still have the `widget_text_content` and `widget_custom_html_content` filters they can use to target the specific widget types.

Amends [40893].
See #40951.
Fixes #40907 for trunk.


git-svn-id: https://develop.svn.wordpress.org/trunk@41086 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-18 22:10:41 +00:00