2712 Commits

Author SHA1 Message Date
John Blackbourn
e86a6dfdb5 Build/Test Tools: Allow the unit test framework to be used without the data directory in place.
Fixes #43982

Merges [43315] to the 4.9 branch.


git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43316 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-25 22:47:39 +00:00
Boone Gorges
f27af570cd Taxonomy: Improve cache handling when querying for terms using all_with_object_id.
When a term query using `fields=all_with_object_id` hits the cache, the
cached `stdClass` objects must be converted to `WP_Term` objects. This
was overlooked when `WP_Term_Query` was refactored to support object
queries in [38667].

Merges [43313] to the 4.9 branch.

Props dlh.
Fixes #44221.


git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43314 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-25 01:25:55 +00:00
Sergey Biryukov
b6f00e0c4c General: Skip test_is_countable_ResourceBundle() on PHP 5.3 and below.
`ResourceBundle` is only countable in PHP 5.4+, which can be considered an acceptable edge case for WordPress core purposes.

Props jrf, ayeshrajans.
Merges [43226] to the 4.9 branch.
Fixes #43583.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43227 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-10 20:17:00 +00:00
Sergey Biryukov
ef2fccb0f9 General: In the is_countable() polyfill, if the provided object implements SimpleXMLElement or ResourceBundle, consider it countable.
Props ayeshrajans, jrf, desrosj.
Merges [43220] to the 4.9 branch.
Fixes #43583.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43221 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-10 17:58:46 +00:00
Sergey Biryukov
39fd607088 Privacy: Mark processed requests as completed instead of confirmed.
r43008 refactored the request flow to make several improvements, but accidentally marked `completed` requests as `confirmed`. This commit restores the intended statuses, so that the data and corresponding UI reflect reality.

Props allendav, birgire.
Merges [43183] to the 4.9 branch.
Fixes #43913.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43187 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-09 14:30:59 +00:00
Andrew Ozz
bb3e7f4779 Privacy: rename manage_privacy_policy to manage_privacy_options.
Props desrosj.
Merges [43155] to the 4.9 branch.
Fixes #43935.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43156 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-03 19:34:21 +00:00
Andrew Ozz
64279d7f38 Privacy: Limit Privacy Settings screen to Super Admins in Multisite.
In many common Multisite use cases, the network administrator will want to set a network-wide privacy policy -- via the privacy_policy_url filter -- for consistency and convenience. When that's done, the Privacy Settings screen on individual sites becomes unnecessary, and may confuse administrators of those sites when they see that their changes don't have any effect on the policy link in the footer.

Since we can't programatically determine which behavior the network admins would like, the safest default setting is to restrict the ability to super admins, and let them delegate it to individual site owners via a plugin, if they'd like to.

Merhes [43147] to the 4.9 branch.
Fixes #43935.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43153 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-03 18:41:18 +00:00
Sergey Biryukov
b1b7009e55 Privacy: add user information to the personal data export file.
Props TZ-Media, desrosj.
Merges [43055] and [43116] to the 4.9 branch.
See #43547.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43117 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-02 04:20:35 +00:00
Sergey Biryukov
e8e4f97a73 Privacy: Limit export and erasure to super admins on Multisite.
Multisite networks have a variety of use cases, and in many of them single-site administrators are not trusted to take actions that affect the whole network, require making decisions about legal compliance, etc. By default, those actions should require super admin capabilities. Plugins can be used to override that behavior if a particular site's use case calls for it.

Props allendav, jeremyfelt, iandunn.
Merges [43085] to the 4.9 branch.
Fixes #43919.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43111 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-02 03:48:27 +00:00
Sergey Biryukov
c9b8dffac9 Privacy: improve wp_privacy_erase_personal_data(), return boolean values.
Props ericdaams.
Merges [43061] to the 4.9 branch.
See #43602.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43110 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-02 03:43:37 +00:00
Sergey Biryukov
c3a2cff3f8 Privacy: Add template tags for building link to privacy policy page.
This introduces the `get_the_privacy_policy_link()` and `the_privacy_policy_link()` functions, as well as the `privacy_policy_url` filter.

A new `tests/url/` folder was added to better organize tests related to `get_*_url()` functions. Previously, those tests were placed in `tests/url.php` and `tests/link/`, but neither of those locations are optimal. Placing tests in `tests/url.php` violates the guideline of creating separate files/classes for each function under test, and using `tests/link/` conflates two distinct -- albeit related -- groups of functions. Over time, URL-related tests can be migrated to the new folder.

Props birgire, xkon, azaozz, iandunn.
Merges [43002] to the 4.9 branch.
See #43850.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43109 602fd350-edb4-49c9-b593-d223f7449a82
2018-05-02 03:38:23 +00:00
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
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