Commit Graph

2734 Commits

Author SHA1 Message Date
Adam Silverstein 74ccb68c56 Taxonomy: restore TagSearch unit tests and correct deprecated version string.
Reverts unit test removal, instead changing them to expect the function to be deprecated.
Correct the version the ajax callback was deprecated.

Amends [42614].

Props dlh, ocean90.
Fixes #38922.



git-svn-id: https://develop.svn.wordpress.org/trunk@42737 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-25 16:27:57 +00:00
Sergey Biryukov 3f4fe54b43 Menus: When checking if a Custom Link matches the current URL to add the `current-menu-item` class, check for decoded URL as well.
Props soulseekah, campusboy1987.
Fixes #43401.

git-svn-id: https://develop.svn.wordpress.org/trunk@42732 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-24 13:43:07 +00:00
Gary Pendergast 1e3781cd71 REST API: Show taxonomy visibility settings.
For Gutenberg and other admin-type interfaces, it's useful to be able to see the visibility settings for taxonomies.

Props joehoyle, pento.
Fixes #42707.



git-svn-id: https://develop.svn.wordpress.org/trunk@42729 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-22 00:24:00 +00:00
Aaron Jorbin 53a61339e4 Community Events Dashboard: Always show a WordCamp if one is coming up
WordCamps are celebrations of the local WordPress Community and once a local one is scheduled, people in that community should know it is coming. This adjusts the WordPress Events in the dashboard widgets to always display a WordCamp, even if there are multiple Meetups happening first.

Props iandunn, metalandcoffee, warmlaundry, alejandroxlopez, jorbin.
Fixes #41112.



git-svn-id: https://develop.svn.wordpress.org/trunk@42726 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-21 23:00:50 +00:00
Sergey Biryukov 9e31509293 Tests: Replace use of `$this->server` with `rest_get_server()` for better memory recycling.
Props danielbachhuber.
Fixes #41641.

git-svn-id: https://develop.svn.wordpress.org/trunk@42724 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-21 16:24:30 +00:00
Sergey Biryukov 0711e585fb Media: After [42693], update HTML4 markup in `img_caption_shortcode()` to avoid an empty ID attribute as well.
Add a unit test for `aria-describedby` in `img_caption_shortcode()`.

See #34595.

git-svn-id: https://develop.svn.wordpress.org/trunk@42694 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-11 15:39:20 +00:00
Helen Hou-Sandi 05b37069a4 Options: Use strings in the test suite that follow community guidelines.
Also somewhat explain to future maintainers why this pairing of strings was chosen, besides this committer's musical preferences. Social opinions on cancer are fairly clear, as are commonly accepted definitions of profanity and family-friendly language.

Shout out to the close contender, which would have been particularly appropriate here: "You could be the king // But watch the queen conquer".

see #43207, #38176


git-svn-id: https://develop.svn.wordpress.org/trunk@42667 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-07 22:41:48 +00:00
Aaron Jorbin 2c6f1b18f4 Options: Use most appropriate language in the test suite.
The test suite's opinion of cancer should be clear.

Reverts r42659.

See #43207, #38176




git-svn-id: https://develop.svn.wordpress.org/trunk@42663 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-07 20:58:21 +00:00
John Blackbourn 9b46512501 Options: Use more appropriate language in the test suite.
See #43207, #38176


git-svn-id: https://develop.svn.wordpress.org/trunk@42659 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-07 18:51:55 +00:00
Felix Arntz ea13c56d7f Options: Unhook default option filter when setting is unregistered.
Fixes #43207.


git-svn-id: https://develop.svn.wordpress.org/trunk@42655 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-06 14:48:46 +00:00
John Blackbourn d512973c84 Canonical: Add `$x_redirect_by` parameter to `wp_safe_redirect()`.
See [42633] and [42408].

Fixes #42313.


git-svn-id: https://develop.svn.wordpress.org/trunk@42647 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-04 16:04:10 +00:00
Drew Jaynes 311531a964 Tests: Simplify `@covers` annotations for `WP_Error` test coverage. Also fix a typo in a test method name.
See #42742.


git-svn-id: https://develop.svn.wordpress.org/trunk@42646 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-03 17:37:51 +00:00
Drew Jaynes 86d486d67d Tests: Fix two typos introduced for a get_term_field() test in [35270].
See #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@42645 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-03 17:10:51 +00:00
Sergey Biryukov 59e1b7318d Tests: Correct erroneous `@covers` and `@use` tags.
Props jipmoors.
Fixes #43203.

git-svn-id: https://develop.svn.wordpress.org/trunk@42636 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-01 16:08:04 +00:00
Sergey Biryukov 07bff5d8bd Tests: Improve tests for `wp_get_post_parent_id()` added in [42397].
Props frank-klein.
Fixes #42797.

git-svn-id: https://develop.svn.wordpress.org/trunk@42635 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-01 16:02:26 +00:00
Sergey Biryukov 40f76ae917 Canonical: Add `$x_redirect_by` parameter to `wp_redirect()` that allows applications doing the redirect to identify themselves.
This complements the `x_redirect_by` filter added in [42408].

Props NathanAtmoz, johnbillion.
Fixes #42313.

git-svn-id: https://develop.svn.wordpress.org/trunk@42633 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-01 15:05:50 +00:00
Adam Silverstein 1c4f57f425 Remove unit tests for deprecated ajax tag search function.
Fixes unit tests failing since r42614.

Ammends [42614].
See #38922.


git-svn-id: https://develop.svn.wordpress.org/trunk@42619 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-30 02:28:14 +00:00
Weston Ruter bba8d65216 Widgets: Fix Text widget unit test which broke due to global scope not being cleaned.
Amends [42613].
See #42495.


git-svn-id: https://develop.svn.wordpress.org/trunk@42617 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-30 00:33:03 +00:00
Weston Ruter 0e818c7aee Customize: Ensure `customize_autosaved` requests only use revision of logged-in user.
Props dlh, westonruter.
See #42433, #39896.
Fixes #42450.


git-svn-id: https://develop.svn.wordpress.org/trunk@42615 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-30 00:20:37 +00:00
Weston Ruter 07e4b7565e 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.
Fixes #42495.


git-svn-id: https://develop.svn.wordpress.org/trunk@42613 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-29 23:55:44 +00:00
Weston Ruter b31563e561 Customize: Include nav menu item for Home custom link in search results for "Home".
Props audrasjb, westonruter.
Fixes #42991.


git-svn-id: https://develop.svn.wordpress.org/trunk@42611 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-29 22:09:55 +00:00
Aaron Jorbin 47f6031fbd Query: Improve tests for set_found_posts dealing with non arrays
Use a data provider and include tests for `false` and `''`.

Previous: [42581] [42585]

See #42860



git-svn-id: https://develop.svn.wordpress.org/trunk@42594 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-24 20:51:06 +00:00
Sergey Biryukov dd9122b011 Tests: Update emoji base URL in `Tests_Formatting_Emoji` after [42590].
See #42862.

git-svn-id: https://develop.svn.wordpress.org/trunk@42592 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-24 17:25:03 +00:00
Gary Pendergast 33a3d61b22 Tests: Improve the old date redirect tests.
Props frank-klein.
See #15397.



git-svn-id: https://develop.svn.wordpress.org/trunk@42587 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-24 06:38:58 +00:00
Dion Hulse f35ed94605 Tests: Skip newly added tests from [42581] on PHP 5.2 as they require ReflectionMethod.
See #42860.


git-svn-id: https://develop.svn.wordpress.org/trunk@42585 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-24 04:20:26 +00:00
Aaron Jorbin 818a0f1ccf Query: Fix warning on counting non countable
Adds tests to continue the behavior for both null and strings.

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

Fixes #42860.
Props janak007 and ayeshrajans for initial patches.





git-svn-id: https://develop.svn.wordpress.org/trunk@42581 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-24 01:20:24 +00:00
Dion Hulse 2cb36cab72 General: Allow `wp_list_pluck()` to operate on arrays of references without overwriting the referenced items.
Fixes #16895.


git-svn-id: https://develop.svn.wordpress.org/trunk@42527 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-18 05:17:23 +00:00
Dion Hulse ade2dd5dfe Tests: Remove redundant `assertEquals()` calls in listFilter tests.
As these tests are already validating that two arrays match, checking that the counts also match before is redundant and makes it harder to debug when the test fails.

See #16895


git-svn-id: https://develop.svn.wordpress.org/trunk@42526 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-18 05:14:28 +00:00
Pascal Birchler 95ec25564b Posts, Post Types: Add tests for `get_post_type_labels()`.
These were accidentally omitted in [38157].

See #38157.


git-svn-id: https://develop.svn.wordpress.org/trunk@42490 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-16 08:32:55 +00:00
Sergey Biryukov 70dc1d9256 Media: Add `small-audio.flac` for a unit test added in [42451].
See #42225.

git-svn-id: https://develop.svn.wordpress.org/trunk@42453 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-15 22:32:47 +00:00
Sergey Biryukov 02ccaeed2c Media: Add `flac` to the list of allowed file types.
Props blobfolio.
Fixes #42225.

git-svn-id: https://develop.svn.wordpress.org/trunk@42451 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-15 22:16:33 +00:00
Peter Wilson 2b56623d89 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.
Fixes #42578.



git-svn-id: https://develop.svn.wordpress.org/trunk@42441 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-13 01:10:56 +00:00
Andrea Fercia 1258d1d9d2 Accessibility: use `aria-current` for the paginated post links output by `wp_link_pages()`.
Continues the introduction in core of the aria-current attribute after [41683], [41359], and [41371].

- changes the `wp_link_pages()` (see the `nextpage` quicktag) output to use an `aria-current` attribute on the current item
- adds `post-nav-links` and `post-page-numbers` CSS classes to help themes style these links
- updates the related tests

Props antonioeatgoat, alexstine.
Fixes #41859.


git-svn-id: https://develop.svn.wordpress.org/trunk@42440 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-12 20:16:56 +00:00
Mike Schroder 07d244a054 Media: Skip `test_remove_orientation_data_on_rotate` if missing deps.
The `test_remove_orientation_data_on_rotate()` test was failing on systems that did not have the `exif` extension available.

Skips test when the `exif_read_data()` function does not exist.

Props danielbachhuber, desrosj.
Fixes #42447.

git-svn-id: https://develop.svn.wordpress.org/trunk@42431 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-10 01:16:56 +00:00
Gary Pendergast 9cf7385eb3 Formatting: Fix capital_P_dangit() not capital P-ing, dangit.
Unfortunately, in my overzealous desire to fix all the un-capitalised Ps, [42343] capitalled some Ps that intentionally should not be capitals.

This commit fixes the incorrectly capitalling of Ps, as well as including unit tests and PHPCS instructions to ensure we never capitulate to capitalisationing them again.

Props superdav42.
Fixes #43040.
Fixes #43041.



git-svn-id: https://develop.svn.wordpress.org/trunk@42429 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-08 10:35:13 +00:00
Rachel Baker ab58308a41 REST API: Adjust unit testes to expect a 401 status code in error responses from permission callbacks when user is not authenticated.
Missed in [42421].

Fixes #42828.

git-svn-id: https://develop.svn.wordpress.org/trunk@42423 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-01 02:30:39 +00:00
Boone Gorges 617372e21e Improve performance of `wp_list_pages()` tests.
The changeset also removes the use of hardcoded post/author IDs.

Props frank-klein.
Fixes #42903.

git-svn-id: https://develop.svn.wordpress.org/trunk@42402 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-15 11:15:00 +00:00
Gary Pendergast c07972d774 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.

Props nickmomrik.
Fixes #15397 for trunk.



git-svn-id: https://develop.svn.wordpress.org/trunk@42401 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-15 08:30:50 +00:00
Sergey Biryukov 4fbe6e0801 Docs: Add missing parameter description in `wp_get_post_parent_id()` function DocBlock.
Rename `$post_ID` to `$post` for consistency with other functions.

Add unit tests for `wp_get_post_parent_id()`.

Props keesiemeijer.
Fixes #42797.

git-svn-id: https://develop.svn.wordpress.org/trunk@42397 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-15 01:01:01 +00:00
Dion Hulse da689558a5 Filesystem: Allow `wp_normalise_path()` to handle PHP stream wrappers such as `php://` correctly.
Props calin, dd32.
Fixes #42837.


git-svn-id: https://develop.svn.wordpress.org/trunk@42387 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-12 04:15:54 +00:00
John Blackbourn a7488c9441 Build/Test tools: Switch to PHPUnit's `expectOutputString()` method instead of manually using output buffers for output assertions.
Props birgire
Fixes #42098


git-svn-id: https://develop.svn.wordpress.org/trunk@42382 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-10 00:30:32 +00:00
John Blackbourn 07be59d34b Build/Test tools: Remove unnecessary PHP functionality tests from the test suite.
Props Frank Klein
Fixes #42277


git-svn-id: https://develop.svn.wordpress.org/trunk@42381 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-09 23:08:24 +00:00
John Blackbourn 61350144fb Role/Capability: When checking capabilities before setting a post slug, ensure the correct post type capabilities are used.
Previously, only the `publish_posts` capability was checked. Now, the correct meta or primitive capability for the post type is used where appropriate.

Props peterwilsoncc

Fixes #42464


git-svn-id: https://develop.svn.wordpress.org/trunk@42380 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-09 22:50:13 +00:00
John Blackbourn 3a7ff0e2e6 Build/Test tools: Add inline documentation to undocumented methods in the `WP_UnitTestCase` class.
Props Frank Klein

Fixes #42731


git-svn-id: https://develop.svn.wordpress.org/trunk@42379 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-08 21:00:08 +00:00
Boone Gorges 2e5bbe0667 `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.

Fixes #42605. See #42771.

git-svn-id: https://develop.svn.wordpress.org/trunk@42368 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-04 21:48:24 +00:00
Boone Gorges ffb86c0552 `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.

See #42771.

git-svn-id: https://develop.svn.wordpress.org/trunk@42367 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-04 21:02:10 +00:00
Boone Gorges 8951af66d4 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.

Props juiiee8487, markjaquith.
See #42771.

git-svn-id: https://develop.svn.wordpress.org/trunk@42366 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-04 20:51:27 +00:00
Boone Gorges 829d8bb179 Fix incorrect test names from [42364].
See #42771.

git-svn-id: https://develop.svn.wordpress.org/trunk@42365 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-04 20:46:56 +00:00
Boone Gorges e9d828ce41 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.

Fixes #42717. See #42771.

git-svn-id: https://develop.svn.wordpress.org/trunk@42364 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-04 20:38:57 +00:00
Konstantin Obenland 6cb2a02695 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.
Fixes #42603.



git-svn-id: https://develop.svn.wordpress.org/trunk@42362 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-04 20:11:11 +00:00
Joe Hoyle d989b8e402 REST API: Include permalink_structure in the settings route.
There are situations where the REST API client wants to be able to read and set the permalink_structure option. Though this doesn’t fix the use case of front-end rendered unauthenticated websites, it still has utility as a setting in it’s own right.

Props aduth.
See #41014.


git-svn-id: https://develop.svn.wordpress.org/trunk@42359 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-03 22:28:33 +00:00
Rachel Baker 59c31d2d74 REST API: Correct HTTP status code in error for requests to create a duplicate term.
The 409 error code is intended for situations where it is expected that the user will resolve the conflict and resubmit the same request. We use 400 error codes for other routes when a duplicate request is made. The 400 status code tells the user they need to modify their request for it to be successful.

Props shooper.
Fixes #42781. See #41370.

git-svn-id: https://develop.svn.wordpress.org/trunk@42354 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-03 19:08:23 +00:00
Rachel Baker 2b079e098a REST API: Add existing term_id to the error data object when attempting to create a duplicate term.
Props shooper, coleh.
Fixes #42597. See #41370.

git-svn-id: https://develop.svn.wordpress.org/trunk@42350 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-03 18:10:05 +00:00
Gary Pendergast 8f95800d52 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.



git-svn-id: https://develop.svn.wordpress.org/trunk@42343 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-30 23:09:33 +00:00
Gary Pendergast ec6a089f98 Tests: Fix a couple of weirdly formatted comments.
See #41057.



git-svn-id: https://develop.svn.wordpress.org/trunk@42342 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-30 16:22:15 +00:00
Drew Jaynes 81b4e9a3a4 General: Add complete test coverage for `WP_Error`.
See #42742.


git-svn-id: https://develop.svn.wordpress.org/trunk@42255 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-29 02:18:25 +00:00
Ryan McCue 49852ed54f REST API: Ensure rest_url() consistently has leading slash.
`rest_url()` inconsistent addes slashes to the passed path depending on whether the site has pretty permalinks enabled. Apart from being inconsistent, this also caused the unit tests to fail when pretty permalinks are enabled.

Props frank-klein.
Fixes #42452. See #41451.


git-svn-id: https://develop.svn.wordpress.org/trunk@42250 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-28 07:09:43 +00:00
Gary Pendergast 574821573a General: Fix some precision alignment formatting warnings.
The WPCS `WordPress.WhiteSpace.PrecisionAlignment` rule throws warnings for a bunch of code that will likely cause issues for `wpcbf`. Fixing these manually beforehand gives us better auto-fixed results later.

See #41057.



git-svn-id: https://develop.svn.wordpress.org/trunk@42228 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-26 23:56:25 +00:00
Dion Hulse b8c4faff72 WPDB: Fix the parsing of sockets which contain colons within the socket name (used on some cloud providers).
Props natacado.
Fixes #42634 for trunk.


git-svn-id: https://develop.svn.wordpress.org/trunk@42226 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-24 05:51:31 +00:00
Boone Gorges 4ec5d65dcc Introduce `meta_box_sanitize_cb` taxonomy argument.
The `meta_box_cb` argument was introduced in [25572] to allow plugin
authors to provide a custom callback for rendering their taxonomy's meta
box on the post edit screen. However, the routine used to handle the saving
of these custom taxonomy meta boxes was not customizable, but was instead
based simply on whether the taxonomy was hierarchicaly. See [13535].

The new `meta_box_sanitize_cb` argument defaults to the "tag" routine for
non-hierarchical taxonomies and the "category" routine for hierarchical ones,
thereby maintaining the current default behavior. Developers can override this
when the data passed from their `meta_box_cb` differs.

Props boonebgorges, ZaneMatthew, stephenharris.
Fixes #36514.

git-svn-id: https://develop.svn.wordpress.org/trunk@42211 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-21 03:14:52 +00:00
Boone Gorges 576f78ac49 Improve data types returned from empty hierarchical term queries.
When querying for 'count', ensure that 0 is returned. Otherwise,
ensure that it's an array.

Props xParham, birgire.
Fixes #42327.

git-svn-id: https://develop.svn.wordpress.org/trunk@42209 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-20 22:45:29 +00:00
Dion Hulse 21ad5a9e40 Remove the `svn:executable` property from files that don't need it.
See #42594


git-svn-id: https://develop.svn.wordpress.org/trunk@42200 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-17 02:57:27 +00:00
Weston Ruter 08a3691775 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 trunk.


git-svn-id: https://develop.svn.wordpress.org/trunk@42146 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-10 22:29:45 +00:00
Gary Pendergast 58fad5bf57 REST API: Add `permalink_structure` to the index endpoint.
This allows Gutenberg to implement permalink editing.

Props schlessera.
Fixes #42465.



git-svn-id: https://develop.svn.wordpress.org/trunk@42142 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-10 06:10:23 +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
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
Sergey Biryukov 1546ae8963 Tests: Fix typo in `test_do_action_with_multiple_callbacks_on_different_priorities()`.
Props withinboredom.
Fixes #42311.

git-svn-id: https://develop.svn.wordpress.org/trunk@41971 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-23 13:03:34 +00:00
Peter Wilson a77ccfad80 Build/Test tools: Move `wp_doing_ajax` defintion from class setup to test setup.
Moves defintion of ajax request in `WP_Ajax_UnitTestCase` to `setUp()` method to account for hooks being reset as part of `tearDown()`.

Props matthias.thiel for report.
Fixes #41561.



git-svn-id: https://develop.svn.wordpress.org/trunk@41970 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-23 05:10:25 +00:00
Dion Hulse eaa0c3ac04 Tests: Return an exit code of 1 in the event that the database server for tests is unavailable.
This allows for automated scripts & test suites to handle the failure of the test suite easier.

Props danielbachhuber
Fixes #41916


git-svn-id: https://develop.svn.wordpress.org/trunk@41966 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-21 14:13:37 +00:00
Gary Pendergast 4670c8f3af Media: Don't backdate media uploaded to pages.
When media is uploaded to a post, the upload directory is set according to the date of the post, so that the media URLs in the post match when the post was published.

A page is a slightly different beast, pages often live for years, and are regularly updated to stay relevant. This change causes media uploaded to pages to use the upload date to determine the upload directory.

Fixes #10752.



git-svn-id: https://develop.svn.wordpress.org/trunk@41964 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-21 13:26:24 +00:00
Weston Ruter f5534ec8d5 Code Editor: Improve ability to create Customizer `CodeEditorControl` instances in JS, lessening PHP dependencies.
Allow `CodeEditorControl` to be instantiated with a `editor_settings` param which is merged with `wp.codeEditor.defaultSettings`.

Also:

* Turn redundant "CSS Code" control label into screen reader text for Additional CSS.
* Remove `code-editor` as script dependency for `custom-html-widgets` since enqueueing is determined by `wp_enqueue_code_editor()`.
* Remove useless exporting of `code_type` param to JS in `WP_Customize_Code_Editor_Control`.
* Add `disabled` class to Custom HTML widget's Save button when linting errors are present.
* Remove redundant `span` inside CodeEditorControl's `label`.

See #41897, #12423, #41872.


git-svn-id: https://develop.svn.wordpress.org/trunk@41957 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-20 16:38:35 +00:00
Weston Ruter d204ba3c00 Widgets: Improve extensibility of the Gallery widget and of media widgets generally.
* Introduce a `widget_{$id_base}_instance_schema` filter for plugins to add new properties to a media widget's instance schema.
* Pass all of a gallery widget's instance props to the gallery media frame, not just the ones that core supports.

See #32417, #41914.
Fixes #42285.


git-svn-id: https://develop.svn.wordpress.org/trunk@41951 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-19 23:43:22 +00:00
John Blackbourn 2364d616b9 Build/Test tools: Document the return value of `WP_UnitTestCase::factory()`.
See #41017


git-svn-id: https://develop.svn.wordpress.org/trunk@41945 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-19 15:32:07 +00:00
Weston Ruter 1c04006909 Customize: Move control's fallback selection of default content template to `renderContent` method to align with sections and panels.
* Only use default control content template when a more specific template doesn't exist.
* Remove extraneous whitespace from being output in `WP_Customize_Control::render()` method.
* Move Custom Header template printing to `customize_controls_print_footer_scripts` action.

See #30738.


git-svn-id: https://develop.svn.wordpress.org/trunk@41935 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-19 03:03:19 +00:00
Sergey Biryukov 66f9609763 Build/Test Tools: Clean up `$_REQUEST` and `$GLOBALS` after modifying them in `_test_list_hierarchical_page()`.
Props birgire.
Fixes #42044.

git-svn-id: https://develop.svn.wordpress.org/trunk@41929 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-18 21:47:39 +00:00
Sergey Biryukov dcb6ef8aa4 Date/Time: Use delta comparison in `get_gmt_from_date()` tests to avoid race conditions.
Props keesiemeijer.
Fixes #38815.

git-svn-id: https://develop.svn.wordpress.org/trunk@41920 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-18 19:41:46 +00:00
Weston Ruter 92f9610907 Customize: Remove incorrect test assertions for the `post_date` of customization drafts.
Amends [41887].
See #42220.


git-svn-id: https://develop.svn.wordpress.org/trunk@41892 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-18 02:40:27 +00:00
Weston Ruter ce7a93c235 Customize: Allow post/page stubs to be edited in WP Admin as "customization drafts" when changeset is saved as draft or scheduled.
* Update stubs to have draft status when changeset is saved as draft, instead of preventing auto-draft garbage collection by giving them a far-future `post_date`.
* Show notice in publish metabox when editing a customization draft indicating that it will be published automatically with its changeset; a link to Customizer is included.
* Include a new "Customization Draft" display post state in the post list table.
* Disconnect stubs from their changesets when they are updated with a status other than "Draft".
* Trash customization drafts when their related changeset is trashed or deleted.
* Add a `_customize_changeset_uuid` postmeta to stubs to link them with their associated changeset.
* Include `customize_changeset_uuid` as context when requesting to insert a new auto-draft.

Props westonruter, melchoyce.
See #39896, #39752, #34923.
Fixes #42220.


git-svn-id: https://develop.svn.wordpress.org/trunk@41887 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-17 20:14:56 +00:00
Felix Arntz ad1d11f88d Multisite: Revert [41698] and [41743].
In order for `get_site_by()` to be truly beneficial, caching in `WP_Site_Query` needs to be improved to account for common use-cases and have them be invalidated less aggressively.

See #40180, #40228, #42091.


git-svn-id: https://develop.svn.wordpress.org/trunk@41884 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-16 22:34:07 +00:00
Felix Arntz 363445adcb Multisite: Revert [41719].
While `get_site_by()` makes sense as a more explicit and less complex replacement for `get_blog_details()`, it is not ready yet in terms of caching, where it currently falls short of the older function under specific circumstances.

See #40180, #40228.


git-svn-id: https://develop.svn.wordpress.org/trunk@41883 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-16 22:28:52 +00:00
Boone Gorges f9dc276353 Don't force distinct term queries when specifying `number` and `object_ids`.
This reverts [41377], which caused performance problems on sites with a large
number of terms.

See #41796.


git-svn-id: https://develop.svn.wordpress.org/trunk@41880 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-16 18:34:29 +00:00
Sergey Biryukov a722bac3ed Build/Test Tools: Pass correct `$message` argument to `WP_UnitTestCase::setExpectedException()` in `Tests_Ajax_CompressionTest::test_logged_out()` and `Tests_Ajax_TagSearch::test_no_results()`.
PHPUnit 6.4.1 and earlier versions ignored the `'0'` value, causing the issue to go unnoticed.

Fixes #42232.

git-svn-id: https://develop.svn.wordpress.org/trunk@41870 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-16 04:05:29 +00:00
Felix Arntz 4d6c257cf9 Multisite: Take `WP_Network::$blog_id` into account in `get_main_site_id()`.
When the `WP_Network::$blog_id` property is set manually, for example in the multisite bootstrap process, `get_main_site_id()` should use that value instead of running its own logic. The main logic for the function was therefore moved into the internal `WP_Network::get_main_site_id()` method, which is now being accessed by the function through the magic property handling for `WP_Network::$blog_id` (and its equivalent `WP_Network::$site_id`).

Props spacedmonkey, jeremyfelt.
Fixes #41936.


git-svn-id: https://develop.svn.wordpress.org/trunk@41861 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-14 22:41:15 +00:00
Weston Ruter b822b04f7e Code Editor: Fix syntax error in PHP 5.2 and PHP 5.3 after [41855].
See #41871.


git-svn-id: https://develop.svn.wordpress.org/trunk@41858 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-13 19:42:40 +00:00
Weston Ruter faeac43629 Code Editor: Add unit tests for `wp_enqueue_code_editor()` and `WP_Widget_Custom_HTML`.
Props ryotsun.
See #12423.
Fixes #41871.


git-svn-id: https://develop.svn.wordpress.org/trunk@41855 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-13 17:57:38 +00:00
Boone Gorges 5c8c480d22 Bump 'posts' query cache incrementor when modifying postmeta.
This ensures that the `get_pages()` query cache doesn't go stale when
postmeta is modified.

Props spacedmonkey.
Fixes #40669.

git-svn-id: https://develop.svn.wordpress.org/trunk@41849 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-12 15:19:30 +00:00
Boone Gorges 6ce4e413ce Invalidate comment query cache when modifying comment meta.
Comment queries are sensitive to comment meta due to the `meta_query`
parameter, so the cache must be invalidated when comment meta is changed,
added, or deleted.

Props spacedmonkey.
See #40669.

git-svn-id: https://develop.svn.wordpress.org/trunk@41848 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-12 14:58:58 +00:00