2799 Commits

Author SHA1 Message Date
Sergey Biryukov
9a76fbceab Privacy: fix unit tests after [43012].
Props iandunn.
Merges [43015] to the 4.9 branch.
See #43546.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43093 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-02 02:16:59 +00:00
Sergey Biryukov
ccccd321f6 Privacy: add helper function for anonymizing data in a standardized way.
Props jesperher, allendav, iandunn, birgire, azaozz, joemcgill.
Merges [42971] and [43081] to the 4.9 branch.
Fixes #43545.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43082 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-02 00:48:23 +00:00
Sergey Biryukov
f1dce1678f Privacy: add functionality to anonymize commenters.
Props xkon, fclaussen, allendav, birgire, azaozz.
Merges [42994] to the 4.9 branch.
See #43442.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43080 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-02 00:20:31 +00:00
Sergey Biryukov
a5d2916bdf Privacy: fix docs, formatting, white space, add tests for the personal data from comments exporter.
Props birgire.
Merges [42987] to the 4.9 branch.
See #43440.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43077 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-02 00:11:50 +00:00
Sergey Biryukov
61018a787a Tests: Update the REST API fixtures.
[42967] included new post statii, but didn't add them to the REST API tests.

Props pento.
Merges [42972] to the 4.9 branch.
See #43481.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43072 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-01 23:45:35 +00:00
Sergey Biryukov
d9d156de80 REST API: Add who=authors as a query parameter for GET wp/v2/users.
Any WordPress user who can `edit_posts` of a post type with `show_in_rest=true` can query for authors. This maps to current WordPress behavior where a WordPress user who can view the Manage Posts view for a post type can see any WordPress user assigned to a post (whether published or draft).

This implementation, over restricting `who=authors` to users with `list_users`, gives us future flexibility in displaying lists of posts. It still respects more restrictive permissions for `context=edit`.

Props danielbachhuber.
Merges [43001] to the 4.9 branch.
Fixes #42202.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43067 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-01 22:17:26 +00:00
Sergey Biryukov
dae28e7c84 REST API: Include viewable attribute on Post Type resource for edit context.
For the block editor to be able to expose the Preview button correctly, it needs to know the `is_post_type_viewable()` setting, this change adds it to the Post Type response.

Props danielbachhuber.
Merges [43007] to the 4.9 branch.
Fixes #43739.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43038 602fd350-edb4-49c9-b593-d223f7449a82
2018-04-30 04:30:23 +00:00
Sergey Biryukov
c125a27018 General: Introduce a polyfill for is_iterable() function added in PHP 7.1.
Props jrf, schlessera, desrosj.
Merges [43036] to the 4.9 branch.
See #43619.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43037 602fd350-edb4-49c9-b593-d223f7449a82
2018-04-30 04:16:43 +00:00
Sergey Biryukov
170e2df167 General: Introduce a polyfill for is_countable() function added in PHP 7.3.
Props jrf, ayeshrajans, desrosj.
Merges [43034] to the 4.9 branch.
See #43583.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43035 602fd350-edb4-49c9-b593-d223f7449a82
2018-04-30 03:46:07 +00:00
Sergey Biryukov
342cac1a88 Formatting: Avoid a PHP 7.2 warning in wp_kses_attr() when one of $allowedtags elements is an uncountable value.
Props andrei0x309, soulseekah, SergeyBiryukov.
Merges [42860] to the 4.9 branch.
Fixes #43312.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@42861 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-20 21:36:04 +00:00
Joe McGill
a035fa16b6 Update unit test following r42839.
This updates the expected version number for Hello Dolly in `Tests_Ajax_Update_Plugin::test_update_plugin` following [42839].

See #43555.

Merges [42841] to the 4.9 branch.


git-svn-id: https://develop.svn.wordpress.org/branches/4.9@42842 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-17 20:59:30 +00:00
Joe McGill
1d3974aee4 Revert max-width styles on caption shortcodes.
This is a partial revert of [41724], so image captions include an
inline `width` style instead of `max-width`.

This returns the caption shortcode to the pre-4.9.0 behavior, while
retaining the extra unit test coverage added in [41724].

Fixes #43123. See #33981.

Merges [42837] to the 4.9 branch.


git-svn-id: https://develop.svn.wordpress.org/branches/4.9@42838 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-16 20:18:48 +00:00
Mike Schroder
1e1f116671 Media: Correctly allow changing PDF thumbnail crop value.
Corrects logic that kept plugins from setting crop value of intermediate image sizes for rendered PDFs.
Adds test.

Props leemon, SergeyBiryukov, chetan200891, birgire.
Merges [42792] to the 4.9 branch.
Fixes #43226.


git-svn-id: https://develop.svn.wordpress.org/branches/4.9@42813 602fd350-edb4-49c9-b593-d223f7449a82
2018-03-09 03:20:52 +00:00
Sergey Biryukov
fc91f93c7a Customize: Ensure media playlists get initialized after selective refresh; expose new wp.playlist.initialize() API.
In particular allows audio and video playlists to be added to the Text widget and previewed.

Props bpayton, westonruter.
See #40854.
Merges [42613], [42617] to the 4.9 branch.
Fixes #42495.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@42622 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-30 14:55:25 +00:00
Sergey Biryukov
99d37cc0fb Customize: Include nav menu item for Home custom link in search results for "Home".
Props audrasjb, westonruter.
Merges [42611] to the 4.9 branch.
Fixes #42991.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@42621 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-30 14:45:55 +00:00
Sergey Biryukov
58b2a6e572 Customize: Ensure customize_autosaved requests only use revision of logged-in user.
Props dlh, westonruter.
See #42433, #39896.
Merges [42615] to the 4.9 branch.
Fixes #42450.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@42620 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-30 14:43:55 +00:00
Aaron Jorbin
049b63a3fa Query: Fix warning on counting non countable
Merges [42581], [42585], and [42594] to the 4.9 branch.

Adds tests to continue the behavior for both null and strings. Skip the tests on PHP 5.2 as they require ReflectionMethod.

See https://wiki.php.net/rfc/counting_non_countables for information on the PHP change.

Fixes #42860.
Props dd32 for test skipping and janak007 and ayeshrajans for initial patches.


git-svn-id: https://develop.svn.wordpress.org/branches/4.9@42597 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-24 21:43:17 +00:00
Sergey Biryukov
5d91d4eb94 Tests: Update emoji base URL in Tests_Formatting_Emoji after [42590].
Merges [42592] to the 4.9 branch.
See #42862.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@42593 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-24 17:30:11 +00:00
Gary Pendergast
1cc2b3f6b6 Canonical URLs: Redirect to the correct URL when the post date changes.
When a post slug is changed, we store a copy of the old slug, so that we can redirect visitors visiting the old URL to the new URL.

In the same way, this stores a copy of the old date, when the post date changes, so we can redirect visitors to the new URL.

Merge of [42401,42587,42588] to the 4.9 branch.

Props nickmomrik, frank-klein.
Fixes #15397.



git-svn-id: https://develop.svn.wordpress.org/branches/4.9@42589 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-24 07:11:40 +00:00
Aaron Jorbin
bf3f29c4eb REST API: Add existing term_id to the error data object when attempting to create a duplicate term.
Merges [42350] into 4.9

Props shooper, coleh, rachelbaker.
Fixes #42597. See #41370.


git-svn-id: https://develop.svn.wordpress.org/branches/4.9@42578 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-23 20:21:46 +00:00
Sergey Biryukov
5793802833 Media: Add small-audio.flac for a unit test added in [42451].
Merges [42453] to the 4.9 branch.
See #42225.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@42454 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-15 22:35:55 +00:00
Sergey Biryukov
b8d69fe82d Media: Add flac to the list of allowed file types.
Props blobfolio.
Merges [42451] to the 4.9 branch.
Fixes #42225.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@42452 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-15 22:23:24 +00:00
Dion Hulse
6935ebbaad Formatting: Do not run formatting and texturization on author bios.
Removes the formatting and texturization added to author bios in #40040 due to back-compatibility concerns.

Reverts [41172], [41173].

Props 0x6f0, rabmalin for review, peterwilsoncc.
Merges [42441] to the 4.9 branch.
Fixes #42578.


git-svn-id: https://develop.svn.wordpress.org/branches/4.9@42445 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-15 00:09:39 +00:00
Rachel Baker
1408fa7aec EST API: Adjust unit testes to expect a 401 status code in error responses from permission callbacks when user is not authenticated.
Missed in [42421].

Merges [42423] to the 4.9 branch.
Fixes #42828.


git-svn-id: https://develop.svn.wordpress.org/branches/4.9@42427 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-06 19:28:44 +00:00
Boone Gorges
efdbf4ba23 category_description() should be taxonomy-agnostic.
This change reinstates the previous de facto behavior of `category_description()`.
See [40979], [42364]. Because `term_description()` no longer passes `$taxonomy` to
`get_term_field()`, the parameter is no longer needed and has been deprecated.

Merges [42368] to the 4.9 branch.

Fixes #42605. See #42771.


git-svn-id: https://develop.svn.wordpress.org/branches/4.9@42372 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-04 22:03:52 +00:00
Boone Gorges
aac8a92f96 get_the_category_by_ID() should be taxonomy-agnostic.
Prior to 4.9, this function was accidentally taxonomy-agnostic in most cases.
The fix in [40979] caused a regression in this function. For backward
compatibility, we make it explicit that the query is by ID only.

Merges [42367] to the 4.9 branch.

See #42771.


git-svn-id: https://develop.svn.wordpress.org/branches/4.9@42371 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-04 21:59:33 +00:00
Boone Gorges
85fcc21d30 Fix regression in get_tag_link() since 4.9.
See [42364] for description of the problem.

Because `get_category_link()` is now totally taxonomy-agnostic, `get_tag_link()`
can become a simple wrapper.
 
Merges [42366] to the 4.9 branch.

Props juiiee8487, markjaquith.
See #42771.


git-svn-id: https://develop.svn.wordpress.org/branches/4.9@42370 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-04 21:57:28 +00:00
Boone Gorges
04299d18e9 Don't do a strict taxonomy check in get_category_link().
Prior to version 4.9, a quirk in the implementation of `get_term()` caused
`get_category_link( 123 )` to fetch the taxonomy archive link for term 123
even if 123 is not in the 'category' taxonomy. The quirk was fixed in [40979];
see #40671. This bugfix introduced a regression for theme authors who were
expecting the old behavior.

By lifting the 'category' restriction, we allow the template function to work
in the old way.

Merges [42364], [42365] to the 4.9 branch.

Fixes #42717. See #42771.


git-svn-id: https://develop.svn.wordpress.org/branches/4.9@42369 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-04 21:54:15 +00:00
Konstantin Obenland
27af285dfb Widgets: Don't try mapping empty sidebars.
Fixes a bug where the mapping logic would try mapping empty sidebars, resulting in PHP warnings.

Props ionvv, chetan200891 for initial patch.
See #42603.

Merges [42362] to the 4.9 branch.



git-svn-id: https://develop.svn.wordpress.org/branches/4.9@42363 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-04 20:16:43 +00:00
Dion Hulse
f46b558688 WPDB: Fix the parsing of sockets which contain colons within the socket name (used on some cloud providers).
Props natacado.
Merges [42226] to the 4.9 branch.
Fixes #42634 for 4.9.


git-svn-id: https://develop.svn.wordpress.org/branches/4.9@42229 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-27 00:55:11 +00:00
Weston Ruter
2aedf55c21 Settings: Replace count() call with empty() in get_settings_errors() to prevent PHP 7.2 warnings when $wp_settings_errors is null.
Props pross, dd32, westonruter.
See #40109.
Fixes #42498 for 4.9.


git-svn-id: https://develop.svn.wordpress.org/branches/4.9@42147 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-10 22:31:58 +00:00
Weston Ruter
d6aece2a33 Bundled Themes: Fix fragile update-theme phpunit test which broke after version updates in [42105].
See #42090.


git-svn-id: https://develop.svn.wordpress.org/trunk@42106 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-02 01:25:57 +00:00
Gary Pendergast
a39d599adf Database: Restore numbered placeholders in wpdb::prepare().
[41496] removed support for numbered placeholders in queries send through `wpdb::prepare()`, which, despite being undocumented, were quite commonly used.

This change restores support for numbered placeholders (as well as a subset of placeholder formatting), while also adding extra checks to ensure the correct number of arguments are being passed to `wpdb::prepare()`, given the number of placeholders.

See #41925.



git-svn-id: https://develop.svn.wordpress.org/trunk@42056 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-31 11:59:43 +00:00
Felix Arntz
43396e2b42 Multisite: Pass network object instead of ID to pre_get_main_site_id.
In the original function introduced in [41380], and subsequently [41861], only the network ID was passed to the new `pre_get_main_site_id` filter. In order to make give quick access to other network properties, it was decided to pass the whole object instead. The changeset includes an additional test.

Fixes #29684.


git-svn-id: https://develop.svn.wordpress.org/trunk@42043 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-30 19:55:09 +00:00
Weston Ruter
8f661ef667 Customize: Allow 0:00-0:59 in date/time control when 24-hour time used.
* Let min hour be 0 and max be 23 in 24-hour time; let min hour be 1 and max be 12 in 12-hour time.
* Show error notification when an invalid date value is provided, not just when not a future date.
* Fix translation of custom validity message.
* Start checking for validity after all inputs have been initially populated.
* Remove support for being able to enter 24:00.
* Cease forcing date input elements from being casted to integers, to allow for invalid inputs to be detected.

Props westonruter, Presskopp, peterwilsoncc, atachibana for testing.
See #39896, #28721.
Fixes #42373.


git-svn-id: https://develop.svn.wordpress.org/trunk@42042 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-30 16:39:06 +00:00
Weston Ruter
a9405baf66 Tests: Remove references to deleted JS files in QUnit tests.
Amends [41570], [40584].
See #41755, #40690.


git-svn-id: https://develop.svn.wordpress.org/trunk@42041 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-30 04:05:20 +00:00
Weston Ruter
01bb1fd6cb Customize: Deprecate nav menu classes that are no longer used, instead of removing them immediately.
* Deprecate PHP classes `WP_Customize_New_Menu_Section` and `WP_Customize_New_Menu_Control`.
* Deprecate JS class `wp.customize.Menus.NewMenuControl`.
* Also introduce `wp.customize.Menus.createNavMenu()` for logic to create nav menus separately from the logic for handling UI interactions.

Amends [41768].
See #40104, #42364.
Fixes #42357.


git-svn-id: https://develop.svn.wordpress.org/trunk@42034 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-28 05:47:06 +00:00
Gary Pendergast
698747975a Tests: Update wp-api-generated.js.
[41979] caused a change in `wp-api-generated.js`, so it needs to be updated.

See #39996.



git-svn-id: https://develop.svn.wordpress.org/trunk@42032 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-28 01:56:00 +00:00
Weston Ruter
6eacf2f06b Widgets: Prevent showing underlying attachment excerpt as caption when empty caption value is supplied in Image widget.
Allow underlying attachment to display if `caption` is `null`.

Props miyauchi, westonruter.
See #39993.
Fixes #42350.


git-svn-id: https://develop.svn.wordpress.org/trunk@42030 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-27 05:04:04 +00:00
Konstantin Obenland
2ddcc549d2 Menus: Add menu-$i slugs to mapping groups
Helps to future proof the feature.
Also orders slugs by popularity to optimize mapping time.

See #39692.


git-svn-id: https://develop.svn.wordpress.org/trunk@42026 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-25 22:28:43 +00:00
Ian Dunn
cac531f50b Dashboard: Strip ports from IPs to avoid PHP warnings.
Fixes #41083.
Props pento, iandunn, EatonZ, birgire, dd32.


git-svn-id: https://develop.svn.wordpress.org/trunk@42016 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-25 00:06:06 +00:00
John Blackbourn
3e9a42ed27 Filesystem API: Add more specificity to the rules for valid files in validate_file().
This now treats files containing `./` as valid, and also treats files containing a trailing `../` as valid due to widespread use of this pattern in theme and plugin zip files.

Adds tests.

Props Ipstenu, borgesbruno, DavidAnderson, philipjohn, birgire
Fixes #42016, #36170


git-svn-id: https://develop.svn.wordpress.org/trunk@42011 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-24 23:14:33 +00:00
Weston Ruter
18a231bad6 Embeds: Improve consistency of update and refresh logic for oEmbed caching between oembed_cache and post meta.
* Allow updating oEmbed cache during `parse-embed` requests for non-post editors (such as widgets).
* Update any existing `oembed_cache` post when `usecache` and TTL has passed.
* Do not overwrite a previously valid cache with `{{unknown}}`.

Props dlh.
See #34115.
Fixes #42310.


git-svn-id: https://develop.svn.wordpress.org/trunk@42009 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-24 23:09:43 +00:00
Joe Hoyle
fb2e44456e REST API: Don’t remove unregistered properties from objects in schema.
In r41727 the ability to sanitise and validate objects from JSON schema was added, with a whitelist approach. It was decided we should pass through all non-registered properties to reflect the behaviour of the root object in register_rest_route. To prevent arbitrary extra data via setting objects, we force additionalProperties to false in the settings endpoint.

See #38583.

git-svn-id: https://develop.svn.wordpress.org/trunk@42000 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-24 21:04:50 +00:00
Weston Ruter
a411d5571a Code Editor: Fix phpunit tests related to gutters after [41974].
See #12423.


git-svn-id: https://develop.svn.wordpress.org/trunk@41994 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-24 16:57:10 +00:00
Sergey Biryukov
18f91933fb Canonical: Strip trailing punctuation from permalinks.
Previously attempted in [40256], which caused the test for decoded curly quotes to fail in some environments.

`$_SERVER['REQUEST_URI']` contains the encoded URI, so this version removes the failing tests and only checks for encoded curly quotes.

Props joostdevalk, lancewillett, SergeyBiryukov.
Fixes #20383.

git-svn-id: https://develop.svn.wordpress.org/trunk@41991 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-24 14:17:22 +00:00
Peter Wilson
733a81d74d Comments: Check if wp_new_comment() returns an error.
Adds checks throughout to allow for `wp_new_comment()` returning a `WP_Error` instance.

Updates the docs for the `pre_comment_approved` filter to include that it can be passed an error.

Props enrico.sorcinelli, ryotsun.
Fixes #39730.



git-svn-id: https://develop.svn.wordpress.org/trunk@41980 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-23 22:11:11 +00:00
Weston Ruter
a0910276f1 REST API: Allow passing existing template value for posts even when template no longer exists.
Also remove `enum` for validating allowed templates to allow plugins to dynamically supply their own templates for specific posts, even when they are not in the theme.

Props TimothyBlynJacobs, jnylen0, swissspidy.
Fixes #39996.


git-svn-id: https://develop.svn.wordpress.org/trunk@41979 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-23 22:10:48 +00:00
Pascal Birchler
af799224b7 Themes: Add files missed in [41975].
See #41717.


git-svn-id: https://develop.svn.wordpress.org/trunk@41976 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-23 20:22:44 +00:00
Pascal Birchler
87d77bc24a Themes: Show templates from both parent and child theme when calling WP_Theme::get_post_templates().
Props birgire for initial patch.
Fixes #41717.


git-svn-id: https://develop.svn.wordpress.org/trunk@41975 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-23 20:07:06 +00:00