Commit Graph

9791 Commits

Author SHA1 Message Date
Pascal Birchler
c12fcf422a Twenty Seventeen: Use esc_attr_e() for translatable strings in HTML attributes.
Props bor0.
Fixes #40216.

Merges [40311] to the 4.7 branch.

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


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40281 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-04-05 02:19:51 +00:00
Pascal Birchler
cafbb22729 Twenty Seventeen: Declare jQuery as a dependency for navigation.js.
Props chesio.
Fixes #40224.

Merges [40315] to the 4.7 branch.

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


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40280 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-04-05 02:19:18 +00:00
Pascal Birchler
a394c05654 Customize: Use get_user_locale() in customizer body class.
Otherwise CSS specific to the site's locale would be applied, even though the customizer is displayed in the user's locale.

See #29783.
Fixes #40271.

Merges [40368] to the 4.7 branch.

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


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40276 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-04-05 02:16:34 +00:00
Pascal Birchler
5a10b5c879 Administration: Fix minor misalignments caused by the button-link CSS class.
After [40059] the CSS class `button-link` uses `text-align: left` by default.
This change now requires to limit as much as possible the use of `button-link`
to controls that should really look like links and to explicitly set
`text-align: center` in a few other cases.

Fixes #39983.

Merges [40358] to the 4.7 branch.

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


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-04-05 02:15:18 +00:00
Pascal Birchler
255819e18a Customize: Fix selective refresh when customizing the 404 template.
Overrides the 404 status during partial refresh requests to serve back 200 so that the request is not deemed a failure and invoke the fallback behavior (full refresh).

See #27355.
Fixes #40018.

Merges [40316] to the 4.7 branch.

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


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40273 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-04-05 02:14:45 +00:00
Pascal Birchler
1b7455c6d3 Quick/Bulk Edit: Fix the Tag suggestions position on the Bulk Edit textarea.
Always passes the complete `position` object to the jQuery autocomplete widget.
Also checks if an autocomplete instance already exists on the Bulk Edit textarea.

Props davidbenton.
Fixes #40242.

Merges [40357] to the 4.7 branch.

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


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40272 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-04-05 02:14:11 +00:00
Boone Gorges
c7782be54b Invalidate term query caches when setting or deleting term relationships.
Prior to 4.7, term relationships - as set by `wp_set_object_terms()` or
`wp_remove_object_terms()` - did not affect the term query cache. The
introduction of the 'object_ids' parameter in 4.7 means that the query
cache must be aware of object-term relationships. As such, the
'last_changed' incrementor is now invalidated when term relationships
are modified.

This bug only reared its head when delaying term counting, because term
counting performs its own term query cache invalidation.

Merges [40353] to the 4.7 branch.

Props mboynes.
Fixes #40306.

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


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-30 16:57:15 +00:00
Pascal Birchler
511b47afd9 Customize: Prevent client-side validation from being cleared when no corresponding server-side validation is present.
See #36944.
Fixes #39770.

Merges [40319] to the 4.7 branch.

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


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40252 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-28 07:22:37 +00:00
Pascal Birchler
6f7014a74d Customize: Trailingslash the home nav menu item URL in starter content.
This prevents an additional 301 redirect when clicking on the nav menu item, and it also prevents a scenario where the auth cookie may not be passed 
and cause an authentication error when navigating in the customizer.

Props dlh, swissspidy.
Fixes #40112.

Merges [40300] to the 4.7 branch.

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


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40245 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-27 09:29:35 +00:00
Pascal Birchler
7f659d9ea1 REST API: Confirm the parent post object of an attachment exists in WP_REST_Posts_Controller::check_read_permission().
Avoid a PHP Error when attempting to embed the parent post of an attachment, when the parent post ID is invalid. Instead check if the parent post 
object exists before checking the read permission for the parent post.

Props GhostToast.
Fixes #39881. 

Merges [40306] to the 4.7 branch.

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


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-27 09:24:41 +00:00
Pascal Birchler
a56cceb25f REST API: Add gmt_offset and timezone_string to the base /wp-json response.
The site's current timezone offset is an important piece of information for any REST API client that needs to manipulate dates.  It has not been 
previously available.

Expose both the `gmt_offset` (the site's current offset from UTC in hours) and `timezone_string` (which also provides information about daylight 
savings time) via the "site info" endpoint (the base `/wp-json` response).

Also update the `wp-api-generated.js` fixture file with the changes to the default API responses.

Props sagarkbhatt.
Fixes #39854.

Merges [40238] to the 4.7 branch.

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


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40243 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-27 07:09:41 +00:00
Pascal Birchler
0b6084b362 Customize: Fix navigation of site in preview on IE11.
Addresses issue in IE11 where the default port number of `:80` is unexpectedly included on `link.host` for links dynamically created by scripts.

Props westonruter, afercia for testing.
See #38409.
Fixes #40198.

Merges [40318] to the 4.7 branch.


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


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40242 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-27 06:21:38 +00:00
Pascal Birchler
4876c17ef5 Customize: Harden site_icon control template to account for when full image size is missing.
Props aussieguy123, westonruter.
See #36749.
Fixes #40010.

Merges [40314] to the 4.7 branch.


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


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40239 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-25 15:26:33 +00:00
Pascal Birchler
52f0c65fc5 Customize: Prevent links to customize.php from being generated which have query vars from wp_removable_query_args() present.
Props dlh.
See #23367, #32692.
Fixes #31850.

Merges [40313] to the 4.7 branch.


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


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40238 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-25 13:35:38 +00:00
Pascal Birchler
e1f9e1eaa0 Posts, Post Types: Add missing REST API properties to WP_Post_Type class.
Props danielbachhuber.
Fixes #39986.

Merges [40302] to the 4.7 branch.


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


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40236 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-24 19:05:34 +00:00
Pascal Birchler
a1b4295ba7 Taxonomy: Add missing REST API properties to WP_Taxonomy class.
Props danielbachhuber.
Fixes #39987.

Merges [40303] to the 4.7 branch.


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


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40235 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-24 19:04:38 +00:00
Pascal Birchler
ca47fafaa9 List Tables: After [38703], [38706], and [40118], adjust the jQuery selector to make the selection of a range of checkboxes work again.
Unprop afercia.
Fixes #40056.

Merges [40268] to the 4.7 branch.


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


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40234 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-24 18:50:35 +00:00
Pascal Birchler
2ea46dbe7f Themes: Add filter for excluding directories from being scanned for template files.
Exclude 'node_modules' directories from paths searched in `WP_Theme::scandir()`. Introduces the `theme_scandir_exclusions` filter to allow sites to 
exclude any other paths like `bower_components` or `vendor` from being searched for template files.

Props lukasbesch, dd32, swisspidy, rachelbaker. 
Fixes #38292.

Merges [40301] to the 4.7 branch.


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


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40233 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-24 18:44:37 +00:00
Pascal Birchler
05655c5d1a REST API: Use get_gmt_from_date() when preparing a draft post for response.
This prevents wrong dates when dealing with DST, see [40115] and [40284].

Props nerrad.
Fixes #40136.

Merges [40284] and [40324] to the 4.7 branch.
Built from https://develop.svn.wordpress.org/branches/4.7@40325


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40232 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-24 17:53:36 +00:00
John Blackbourn
bfa0cc8b91 Login and Registration: Avoid a potentially incorrect value for the cookie hash on multisite installations that don't have a value in the siteurl network option.
This reverts [38619].

See #34084, #39497

Merges [40320] to the 4.7 branch.

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


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40228 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-23 19:03:37 +00:00
Boone Gorges
913475ecdf Fix the formatting of $taxonomies parameter of 'wp_get_object_terms' filter.
[38667]  changed the way that the filter parameters are built. That
changeset didn't fully account for the pre-4.7 format of `$taxonomies`.

Merge of [40290] to the 4.7 branch.

Props ig_communitysites.
Fixes #40154.

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


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40198 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-14 18:43:37 +00:00
John Blackbourn
49dea066cc Build/Test tools: Get Travis builds working on HHVM again.
This change moves to specifying the PHPUnit version for all PHP versions, and fixes an issue where the Composer global bin directory is not at `~/.composer/vendor/bin` on the boxes that are used for HHVM builds.

See #40100

Merges [40269] and [40271] to the 4.7 branch.

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


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40191 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-11 00:06:35 +00:00
John Blackbourn
7bebbc7006 Build/Test tools: Don't override the wp_set_auth_cookie() and wp_clear_auth_cookie() functions.
Overriding pluggable functions in the test suite is asking for trouble in the future. In addition, it means the test suite can't be guaranteed to behave the same as core.

This instead introduces a `send_auth_cookies` filter which can be hooked in during the test suite to prevent these functions from attempting to send cookie headers to the client.

Fixes #39367

Merges [40263] and [40264]  to the 4.7 branch.

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


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40185 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-10 15:06:34 +00:00
Dominik Schilling
f0be016b5e Build/Test Tools: Update .travis.yml to include latest improvements from trunk.
* Explicitly use PHPUnit 5.7 for the PHP 7 builds on Travis.
* On Travis CI install and use the node version which is specified in package.json.
* Add some more debugging to Travis and bring the format of the Xdebug fix inline with branches.

Merge of [40255] and [40257-40259] to the 4.7 branch.

Props netweb, johnbillion.
See #35105, #39822, #40086.
Built from https://develop.svn.wordpress.org/branches/4.7@40260


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40182 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-09 22:02:39 +00:00
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
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