Commit Graph

36062 Commits

Author SHA1 Message Date
John Blackbourn c498f12182 Build/Test tools: Remove the unnecessary clone of the twentysixteen repo.
This is no longer needed since #31550.

Fixes #40066

Merges [40252] to the 4.7 branch.

Built from https://develop.svn.wordpress.org/branches/4.7@40253


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40175 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-09 01:36:36 +00:00
John Blackbourn 92357b6a80 Build/Test tools: In Travis, skip some tests when not on trunk.
This skips time sensitive tests (copyright year and PHP/MySQL version requirements) when tests are run on branches on Travis.

Props netweb, jorbin

Fixes #39486

Merges [40241] to the 4.7 branch.

Built from https://develop.svn.wordpress.org/branches/4.7@40250


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-08 00:52:36 +00:00
John Blackbourn d2c4cb36db Build/Test Tools: Call `wp_head()` and `wp_footer()` in the theme used during tests.
See #31550
Fixes #39988

Merges [40235] to the 4.7 branch.

Built from https://develop.svn.wordpress.org/branches/4.7@40236


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40166 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-07 01:35:33 +00:00
John Blackbourn 7b45ddd449 Build/Test Tools: Disable Xdebug when testing on Travis to increase performance.
See #39978

Built from https://develop.svn.wordpress.org/branches/4.7@40225


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40164 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-07 00:21:32 +00:00
Sergey Biryukov 5ef79ffc04 Post-4.7.3 version bump for 4.7 branch.
Built from https://develop.svn.wordpress.org/branches/4.7@40224


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40163 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-06 18:52:35 +00:00
James Nylen 8622d105f5 Bump 4.7 branch to version 4.7.3.
Built from https://develop.svn.wordpress.org/branches/4.7@40202


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40141 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-06 15:56:33 +00:00
John Blackbourn 882ac7830f Press This: Verify intent before fetching in-page resources using Press This.
Props vortfu

Merges [40195] to the 4.7 branch.

Built from https://develop.svn.wordpress.org/branches/4.7@40196


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40135 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-06 13:56:35 +00:00
Aaron Campbell dfb508f59d Strip control characters before validating redirect.
Merges [40183] to 4.7 branch.


Built from https://develop.svn.wordpress.org/branches/4.7@40184


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40123 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-06 13:40:35 +00:00
John Blackbourn 0066640479 Taxonomy: Correct the formatting of HTML entities when generating the screen reader text for tag removal.
Props adamsilverstein

Merges [40181] to the 4.7 branch.

Built from https://develop.svn.wordpress.org/branches/4.7@40182


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40121 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-06 13:16:35 +00:00
Aaron Campbell 177b19d9ec Plugins: Add file check to plugin deletions.
Merges [40169] to 4.7 branch.


Built from https://develop.svn.wordpress.org/branches/4.7@40170


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40109 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-06 12:58:35 +00:00
Dominik Schilling 25e3338dbc Embeds: URL encode YouTube video IDs for broader compatibility.
Merge of [40160] to the 4.7 branch.

Built from https://develop.svn.wordpress.org/branches/4.7@40161


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40100 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-06 12:04:34 +00:00
Jeremy Felt a80351f7ed Validate video and audio metadata.
merge of [40148] to the 4.7 branch

Built from https://develop.svn.wordpress.org/branches/4.7@40149


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40088 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-06 08:03:35 +00:00
Dion Hulse a649dd59b7 Bump Akismet External to 3.3.
git-svn-id: http://core.svn.wordpress.org/branches/4.7@40082 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-02 03:15:15 +00:00
Dion Hulse 58acc1c53f Bump the version after the 4.7.3-RC1 packaging.
Built from https://develop.svn.wordpress.org/branches/4.7@40141


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40078 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-28 00:16:33 +00:00
Dion Hulse 931b5a10ac Version bump for WordPress 4.7.3-RC1
Built from https://develop.svn.wordpress.org/branches/4.7@40140


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40077 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-28 00:10:36 +00:00
Dominik Schilling 6485764f43 REST API: Allow setting post formats even if they are not supported by the theme.
A `post_format` not used by the current theme, but supported by core is not a wrong/broken piece of information. It's just not used at this point in time. Therefore we should allow setting and retrieving any of the standard post formats supported in core, even if the current theme doesn't use them.

After this commit, a post's `format` value can survive a round trip through the API, which is a good general design principle for an API.

Merge of [40120] and [40121] to the 4.7 branch.

Props JPry, iseulde, davidakennedy, Drivingralle.
Fixes #39232.
Built from https://develop.svn.wordpress.org/branches/4.7@40137


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40074 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-27 20:03:37 +00:00
Dominik Schilling e7b04993a6 REST API: Fix behavior of `sticky` posts filter when no posts are sticky.
Previously, when getting posts from the API with `sticky=true`, if there were no sticky posts set, the query would return all posts  as if the `sticky` argument was not set.  In this situation, the query should return an empty array instead.

A `sticky=true` query that should return an empty array (in the previous situation, or with `include` and no intersecting post IDs) was also broken in that it would query the post with ID 1.

Finally, this commit significantly improves test coverage for the `sticky` filter argument, including direct testing of the `WHERE` clauses generated by `WP_Query`.

Merge of [40037] and [40122] to the 4.7 branch.

Props ryelle, jnylen0.
See #39079.
Fixes #39947.
Built from https://develop.svn.wordpress.org/branches/4.7@40136


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40073 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-27 19:54:39 +00:00
Joe McGill d9ce7b2739 Media: Reset Exif orientation after rotate in WP_Image_Editor_Imagick.
Due to inconsistencies in the way browsers handle Exif orientation data,
if a user manually rotates an image within WordPress, set the Exif orientation to
the default (1) so that the image displays with the same rotation/flip in every browser.

Props sanchothefat, triplejumper12, joemcgill, azaozz, markoheijnen, mikeschroder.
Merges [40123] and [40129] to the 4.7 branch.
Fixes #37140. See #14459.

Built from https://develop.svn.wordpress.org/branches/4.7@40135


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40072 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-27 19:33:35 +00:00
Joe McGill 4771761186 Media: Reduce failing uploads following 4.7.1.
[39831] introduced more strict MIME type checking for uploads, which
resulted in unintetionally blocking several filetypes that were
previously valid. This change uses a more targeted approach to MIME
validation to restore previous behavior for most types.

Props blobfolio, iandunn, ipstenu, markoheijnen, xknown, joemcgill.
Merges [40124] and [40125] to the 4.7 branch.
Fixes #39550, #39552.

Built from https://develop.svn.wordpress.org/branches/4.7@40134


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-27 19:28:34 +00:00
Joe McGill 498f71615f Media: Keep PDF previews from overwriting files.
Since support for PDF previews were added in [38949], it's possible
that the generated image file could overwrite an existing image file
with the same name. This uses wp_unique_filename() to avoid this
issue and adds a '-pdf' identifier on the end of filenames.

Props gitlost, desrosj, mikeschroder, joemcgill.
Merges [40130] and [40131] to the 4.7 branch.
Fixes #39875. See #31050.

Built from https://develop.svn.wordpress.org/branches/4.7@40133


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40070 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-27 19:25:34 +00:00
Joe McGill c2a90ea28d Media: Restore correct upload errors displaying after [37610].
Props codegeass, MatheusGimenez, joemcgill.
Merges [40126] to the 4.7 branch.
Fixes #39516.

Built from https://develop.svn.wordpress.org/branches/4.7@40132


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40069 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-27 19:21:36 +00:00
Sergey Biryukov ecf9c19e04 Plugins: After [38703], adjust the selector for checkbox selection to account for nested tables.
Props afercia, swissspidy, reldev.
Merges [40118] to the 4.7 branch.
Fixes #39739.
Built from https://develop.svn.wordpress.org/branches/4.7@40119


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40056 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-24 23:13:34 +00:00
Sergey Biryukov d66cefb840 REST API: JavaScript client - improve route discovery for custom namespaces.
Fix parsing of custom namespace routes. Transform class names, removing dashes and capitalizing each word/route part so a route path of `widgets/recent-posts` becomes a collection with the name `WidgetsRecentPosts`. Correct parent route part when routes are longer than expected, reversing parse direction.

Props westonruter, jazbek, adamsilverstein, jnylen0.
Merges [40074] and [40109] to the 4.7 branch.
Fixes #39561.
Built from https://develop.svn.wordpress.org/branches/4.7@40117


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40054 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-24 22:48:37 +00:00
Sergey Biryukov b25d41d205 REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.

The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.

Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.

Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.

Props jnylen0, welcher, adamsilverstein, netweb, ocean90, rachelbaker.
Merges [40058], [40061], [40065], [40066], [40077], and [40104] to the 4.7 branch.
Fixes #39264.
Built from https://develop.svn.wordpress.org/branches/4.7@40116


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40053 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-24 22:34:34 +00:00
Sergey Biryukov 9dac8e173f REST API: Shim `post_date_gmt` for drafts / empty dates in the REST API.
Internally, WordPress uses a special `post_date_gmt` value of `0000-00-00 00:00:00` to indicate that a draft's date is "floating" and should be updated whenever the post is saved. This makes it much more difficult for API clients to know the correct date of a draft post.

This commit provides a best guess at a `date_gmt` value for draft posts in this situation using the `date` field and the site's current timezone offset.

Props joehoyle, jnylen0.
Merges [40108] to the 4.7 branch.
Fixes #38883.
Built from https://develop.svn.wordpress.org/branches/4.7@40115


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40052 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-24 22:03:34 +00:00
Sergey Biryukov 68740ca5a1 REST API: Fix multiple issues with setting dates of posts and comments.
This commit modifies the `rest_get_date_with_gmt` function to correctly parse local and UTC timestamps with or without timezone information.

It also ensures that the REST API can edit the dates of draft posts by setting the `edit_date` flag to `wp_update_post`.

Overall this commit ensures that post and comment dates can be set and updated as expected.

Props jnylen0.
Merges [40101] to the 4.7 branch.
Fixes #39256.
Built from https://develop.svn.wordpress.org/branches/4.7@40114


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40051 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-24 21:59:35 +00:00
Sergey Biryukov f980f4ca90 REST API: Correctly parse body parameters for DELETE requests.
DELETE was inadvertently omitted from the list of non-POST HTTP methods that should be able to accept body parameters. Parameters passed to DELETE requests as JSON are already parsed correctly; this commit fixes application/x-www-form-urlencoded parameters as well.

Props mnelson4.
Merges [40105] to the 4.7 branch.
Fixes #39933.
Built from https://develop.svn.wordpress.org/branches/4.7@40113


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40050 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-24 20:56:34 +00:00
Andrew Ozz d95e0f8116 TinyMCE: preserve empty image alt attributes.
Props afercia.
Merges [40110] to the 4.7 branch.
Fixes #39912.
Built from https://develop.svn.wordpress.org/branches/4.7@40112


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40049 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-24 20:52:35 +00:00
Sergey Biryukov 3ded99cef7 REST API: Do not allow access to users from a different site in multisite.
It has been unintendedly possible to both view and edit users from a different site than the current site in multisite environments. Moreover, when passing roles to a user in an update request, that user would implicitly be added to the current site.

This changeset removes the incorrect behavior for now in order to be able to provide a proper REST API workflow for managing multisite users in the near future. Related unit tests have been adjusted as well.

Props jnylen0, jeremyfelt, johnjamesjacoby.
Merges [40106] to the 4.7 branch.
Fixes #39701.
Built from https://develop.svn.wordpress.org/branches/4.7@40111


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-24 20:46:35 +00:00
Dion Hulse f609be0542 Customize: Prevent vertical clipping of thumbnail in header image customizer control.
Removes some method overrides on `wp.customize.HeaderTool.ChoiceView` introduced in [27497].

See #21785.
Props bradyvercher, westonruter.
Merges [40082] to the 4.7 branch.
Fixes #38559.

Built from https://develop.svn.wordpress.org/branches/4.7@40100


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40037 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-21 07:05:36 +00:00
Dion Hulse 876e894635 Customize: Extend auto-draft life of a `customize_changeset` post whenever modified.
Keep bumping the date for the auto-draft to preserve it from garbage-collection via `wp_delete_auto_drafts()` after 7 days.

Props westonruter.
Merges [40041] to the 4.7 branch.
See #30937.
Fixes #39713.

Built from https://develop.svn.wordpress.org/branches/4.7@40099


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40036 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-21 07:03:34 +00:00
Dion Hulse 02789248ca Customize: Allow custom post types to be used in starter content.
Changes `WP_Customize_Nav_Menus::insert_auto_draft_post()` so it can be invoked for a `post_type` that is not registered (yet).

Props westonruter.
Merges [39924] to the 4.7 branch.
See #38615, #38114.
Fixes #39610.

Built from https://develop.svn.wordpress.org/branches/4.7@40098


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40035 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-21 07:02:34 +00:00
Dion Hulse f5b00a1534 Customize: Ensure edit shortcuts get re-created for nested partials when a parent partial is refreshed.
Fixes issue where the edit shortcut for a nav menu gets dropped when the containing Custom Menu widget is updated.

Props westonruter.
Merges [40055] to the 4.7 branch.
See #39101.
Fixes #39353.

Built from https://develop.svn.wordpress.org/branches/4.7@40097


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40034 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-21 06:59:31 +00:00
Dion Hulse bade579fc3 Customize: Skip intercepting non-HTTP(S) links in customizer preview just as jump links are ignored.
Ensures that links with `javascript:`, `mailto:` and other protocols work as expected in the customizer preview.

Props westonruter.
Merges [40064] to the 4.7 branch.
Fixes #39797.

Built from https://develop.svn.wordpress.org/branches/4.7@40096


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40033 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-21 06:56:34 +00:00
Dion Hulse de7de0a0d6 Customize: Always enqueue `customize-preview` stylesheet in the customizer preview to style selective refresh and visual edit shortcuts.
Enqueues the style along with the `customize-preview` script in the manager instead of via the `widgets` and `nav_menus` components, ensuring that the stylesheet is loaded for users who cannot manage widgets or nav menus.

Props dlh, westonruter.
Merges [39951] to the 4.7 branch.
See #27403.
Fixes #39498.

Built from https://develop.svn.wordpress.org/branches/4.7@40095


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-21 06:54:35 +00:00
Dion Hulse a0edd9b006 Customize: Trim whitespace from nav menu item titles so that the underlying object's original title appears as input placeholder and in the control's title.
Whitespace is trimmed from titles in PHP when saved in any case, so this aligns the client-side behavior with what happens on the server.

Amends [38618].
Merges [39994] to the 4.7 branch.
See #38015.
Fixes #39600.

Built from https://develop.svn.wordpress.org/branches/4.7@40094


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40031 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-21 06:52:35 +00:00
Dion Hulse 2a891e4456 Customize: Update `customize.php` URL with `changeset_uuid` param the instant a change is made instead of deferring until the changeset update request responds.
Props asalce, westonruter.
Merges [39686] to the 4.7 branch.
Fixes #39227.

Built from https://develop.svn.wordpress.org/branches/4.7@40093


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40030 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-21 06:50:41 +00:00
Dion Hulse d1b2273838 Menus: Prevent notice thrown in class-walker-page.php.
Calling `Walker_Page::walk()` directly was causing an `Undefined index: item_spacing` notice to be thrown, this adds an `isset()` check to prevent it.

Props bhargavbhandari90, peterwilsoncc.
Merges [39949] to the 4.7 branch.
Fixes #39564.

Built from https://develop.svn.wordpress.org/branches/4.7@40092


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-21 03:51:35 +00:00
Dion Hulse e18e5acce8 Formatting: fix `wpautop()` to stop adding paragraph tags around `<figcaption>`.
Props azaozz, pbearne for tests.
Merges [39912], [39914] to the 4.7 branch.
Fixes #39307 for 4.7.


Built from https://develop.svn.wordpress.org/branches/4.7@40091


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40028 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-21 03:42:38 +00:00
Sergey Biryukov f65de13e9f About page: Remove `autoplay` and `loop` attributes on "Theme Starter Content", "Edit Shortcuts", and "Video Headers" videos, originally added as a part of [39512].
For UX and accessibility reasons, it's better to always avoid playing videos automatically.

Props bor0.
Merges [40089] to the 4.7 branch.
Fixes #39560.
Built from https://develop.svn.wordpress.org/branches/4.7@40090


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40027 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-20 13:09:34 +00:00
Dion Hulse 6e1fe24284 Customize: Ensure root values are accessible in multidimensional custom setting types.
Fixes bad conditions in `WP_Customize_Setting::get_root_value()` and `WP_Customize_Setting::set_root_value()`.

Props dlh, westonruter.
Amends [35007].
Merges [40036] to the 4.7 branch.
See #32103.
Fixes #36952.

Built from https://develop.svn.wordpress.org/branches/4.7@40088


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40025 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-20 06:50:50 +00:00
Dion Hulse bc0cb365a3 Customize: Introduce `get_header_video_url` filter for the return value of `get_header_video_url()`.
Props sanket.parmar, celloexpressions, SergeyBiryukov.
Merges [40045], [40086] to the 4.7 branch.
Fixes #39512.

Built from https://develop.svn.wordpress.org/branches/4.7@40087


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40024 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-20 06:49:53 +00:00
Dion Hulse 6f0ebaba78 Feeds: Prevent empty feeds from returning 404 errors.
Partial revert of [38929].

This reverts the source code from the commit for #30210 to prevent valid but empty feeds from returning 404 file not found errors for the home and custom feeds.

The tests in the commit that remain applicable are retained.

Props pavelevap for reporting, stevenkword for initial patch, peterwilsoncc.
See #30210.
Merges [40030] to the 4.7 branch.
Fixes #39157.

Built from https://develop.svn.wordpress.org/branches/4.7@40085


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40022 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-20 06:38:48 +00:00
Dion Hulse cb22496f4c REST API: JavaScript client should use `_.extend` when merging objects.
Correct an issue during the client's dynamic route discovery in `wp.api.utils.decorateFromRoute` where `_.union` potentially failed if used on objects.

Props ketuchetan, adamsilverstein.
Merges [40040] to the 4.7 branch.
Fixes #39341.

Built from https://develop.svn.wordpress.org/branches/4.7@40084


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40021 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-20 06:35:48 +00:00
Dion Hulse 5789e5f074 Taxonomy: Disallow overriding the `name` property when registering a taxonomy.
Props wpfo for initial patch, swissspidy.
Merges [40049] to the 4.7 branch.
Fixes #39308.

Built from https://develop.svn.wordpress.org/branches/4.7@40083


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40020 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-20 06:16:53 +00:00
Rachel Baker 2dda813ae2 REST API: Include the `status` property in `view` context responses from the Posts endpoints.
Previously the status for a Post (or other post_types) was only exposed under the `edit` context, which doesn't really make much sense considering we support querying by post status without authentication. Originally introduced in v2.0 beta 1: 69f617d749 without any explanation in the commit message.

Props dhanendran, jnylen0, rachelbaker.
Merges [40080] to the 4.7 branch.
Fixes #39466.

Built from https://develop.svn.wordpress.org/branches/4.7@40081


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40018 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-19 04:36:32 +00:00
Rachel Baker 4bd52ccd1d REST API: Correctly serve the index with PATH_INFO
When hitting the index, `untrailingslashit()` would make the REST route empty, which would then use the fallback inside WP_REST_Server. This isn't a problem most of the time, but WP_REST_Server contains a fallback to PATH_INFO. Combined with PATH_INFO permalinks, this would give a 404 on the API index, as it attempts to look up a route for "/wp-json/".

Props ccprog.
Merges [39923] to the 4.7 branch.
Fixes #39432.

Built from https://develop.svn.wordpress.org/branches/4.7@40079


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40016 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-19 03:28:34 +00:00
Rachel Baker a51de29064 REST API: Cast revision author ID to int.
The `post_author` field is a string internally, but we need to cast it to an integer in the REST API. This was already done for posts, but not for revisions. The field is already declared as an integer in both controllers.

Props jnylen0.
Merges [40063] to the 4.7 branch.
Fixes #39871.

Built from https://develop.svn.wordpress.org/branches/4.7@40078


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40015 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-19 03:19:37 +00:00
Sergey Biryukov c884f781e1 Media: In `wp_unique_filename()`, use explicit type casting when incrementing `$number`.
This prevents the "non-numeric value encountered" warning in PHP 7.1, caused by trying to increment an empty string on the first loop iteration.

Props drrobotnik for initial patch.
Merges [40039] to the 4.7 branch.
Fixes #39774.
Built from https://develop.svn.wordpress.org/branches/4.7@40075


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40012 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-17 21:24:35 +00:00
Dion Hulse 297220b740 Media: Avoid PHP Warnings in `get_post_galleries()` when processing empty `[gallery]` shortcodes and avoid returning the incorrect results when the global `$post` does not match the provided post ID.
Props dd32, joemcgill, seanchayes.
Merges [40070] to the 4.7 branch.
Fixes #39277, #39304.

Built from https://develop.svn.wordpress.org/branches/4.7@40071


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40008 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-17 06:47:34 +00:00