Commit Graph

36361 Commits

Author SHA1 Message Date
Sergey Biryukov 8060823ff3 Canonical: Strip trailing punctuation from permalinks.
Props joostdevalk, lancewillett, SergeyBiryukov.
Fixes #20383.

git-svn-id: https://develop.svn.wordpress.org/trunk@40256 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-09 20:04:17 +00:00
John Blackbourn 15ae03f4ab Build/Test tools: Explicitly use PHPUnit 5.7 for the PHP 7 builds on Travis.
This avoids fatal errors while the tests remain incompatible with PHPUnit 6, which was recently introduced on Travis.

See #39822, #40086


git-svn-id: https://develop.svn.wordpress.org/trunk@40255 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-09 19:13:25 +00:00
Sergey Biryukov 754dd5c11e Docs: Correct `@return` type for `calendar_week_mod()`.
Props dingo_bastard.
Fixes #40077.

git-svn-id: https://develop.svn.wordpress.org/trunk@40254 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-09 14:00:09 +00:00
John Blackbourn 91e1ae2a70 Build/Test tools: Remove the unnecessary clone of the twentysixteen repo.
This is no longer needed since #31550.

Fixes #40066


git-svn-id: https://develop.svn.wordpress.org/trunk@40252 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-09 01:10:54 +00:00
Weston Ruter 34759c5d65 Customize: Show title input placeholders for widgets that have default titles when rendered.
Fixes #39909.
Props bor0, dlh, westonruter.


git-svn-id: https://develop.svn.wordpress.org/trunk@40251 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-08 18:24:16 +00:00
John Blackbourn 74e02a21b8 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


git-svn-id: https://develop.svn.wordpress.org/trunk@40241 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-08 00:06:12 +00:00
John Blackbourn 0060ffaa8c Build/Test tools: Revert [40239] due to unrelated changes.
See #39486


git-svn-id: https://develop.svn.wordpress.org/trunk@40240 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-08 00:04:05 +00:00
John Blackbourn 868eba6850 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


git-svn-id: https://develop.svn.wordpress.org/trunk@40239 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-08 00:00:47 +00:00
James Nylen 8bbe6a0d50 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.


git-svn-id: https://develop.svn.wordpress.org/trunk@40238 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-07 05:47:32 +00:00
James Nylen e79e137c32 WP_Query: Add missing tests for combinations of `orderby` and include parameters.
This commit adds some missing test cases for combinations of `orderby` and other parameters (`post_parent__in` and `post_name__in`).

Followup to [40056] for `orderby` and `post__in`.

The interaction of these parameters is perhaps counterintuitive because `orderby` does not affect the returned results.  This is overall probably the best design, and it's now better tested and documented.

Props fibonaccina.
See #39055.


git-svn-id: https://develop.svn.wordpress.org/trunk@40237 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-07 05:26:51 +00:00
John Blackbourn 154d0d15b7 Build/Test Tools: Call `wp_head()` and `wp_footer()` in the theme used during tests.
See #31550
Fixes #39988


git-svn-id: https://develop.svn.wordpress.org/trunk@40235 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-07 01:33:04 +00:00
John Blackbourn d5b9305fa3 Press This: Verify intent before fetching in-page resources using Press This.
Props vortfu


git-svn-id: https://develop.svn.wordpress.org/trunk@40195 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-06 13:54:58 +00:00
Aaron D. Campbell ec30770c50 Strip control characters before validating redirect.
git-svn-id: https://develop.svn.wordpress.org/trunk@40183 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-06 13:37:43 +00:00
John Blackbourn 47c966dffc Taxonomy: Correct the formatting of HTML entities when generating the screen reader text for tag removal.
Props adamsilverstein


git-svn-id: https://develop.svn.wordpress.org/trunk@40181 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-06 13:13:57 +00:00
Aaron D. Campbell 4e13bc0bea Plugins: Add file check to plugin deletions.
git-svn-id: https://develop.svn.wordpress.org/trunk@40169 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-06 12:54:07 +00:00
Dominik Schilling (ocean90) ccfe51c3b9 Embeds: URL encode YouTube video IDs for broader compatibility.
git-svn-id: https://develop.svn.wordpress.org/trunk@40160 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-06 11:41:47 +00:00
jeremyfelt e24a96c734 Validate video and audio metadata.
git-svn-id: https://develop.svn.wordpress.org/trunk@40148 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-06 08:00:06 +00:00
Boone Gorges e3996719d3 Taxonomy: When querying terms, ensure `$taxonomies` is an array.
This avoids PHP notices that otherwise arise when no `taxonomy`
parameter is passed to `get_terms()` or `WP_Term_Query`.

Props dlh.
Fixes #39932.

git-svn-id: https://develop.svn.wordpress.org/trunk@40147 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-03 03:01:39 +00:00
Boone Gorges 5983e88ab1 Taxonomy: Improve 'Parent' label when editing taxonomy terms.
Instead of the hardcoded 'Parent', use the `parent_item` label.

Props abrain, dlh.
Fixes #34545.

git-svn-id: https://develop.svn.wordpress.org/trunk@40146 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-03 02:53:34 +00:00
Boone Gorges d3e463cb84 Taxonomy: Take 'parent' into account when checking for terms with duplicate names.
Terms with duplicate names are not allowed at the same level of a
taxonomy hierarchy. The name lookup introduced in [34809] did not
properly account for the 'parent' parameter, with the result that
the duplicate-name restriction was tighter than intended (terms
with duplicate names could not be created at different levels of
a single hierarchy).

Props mikejolley.
Fixes #39984.

git-svn-id: https://develop.svn.wordpress.org/trunk@40145 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-03 02:49:13 +00:00
Boone Gorges 8a2341335b Taxonomy: Improve precision of duplicate name checks when inserting terms.
`wp_insert_term()` does not allow for terms with the same name to exist
at the same hierarchy level, unless the second term has a unique slug.
When this logic was refactored in [31792] and [34809], a bug was
introduced whereby it was possible to bypass the no-same-named-sibling
check in cases where the first term had a non-auto-generated slug
(ie, where the name was 'Foo' but the slug something other than 'foo',
such that the second term would get the non-matching slug 'foo').

This changeset fixes this issue by ensuring that the duplicate name
check runs both in cases where there's an actual slug clash *and* in
cases where no explicit `slug` has been provided to `wp_insert_term()`.
The result is a more reliable error condition:
`wp_insert_term( 'Foo' ... )` will always fail if there's a sibling
'Foo', regardless of the sibling's slug.

Props mikejolley.
See #39984.

git-svn-id: https://develop.svn.wordpress.org/trunk@40144 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-03 02:39:09 +00:00
Boone Gorges 242f4e5201 Improve formatting in `wp_term_is_shared()` docblock.
Props netweb.
Fixes #40004.

git-svn-id: https://develop.svn.wordpress.org/trunk@40143 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-02 02:27:10 +00:00
Boone Gorges 735424428c Tests: Starter content tests should use copies of images stored in /tmp.
This ensures that generated thumbnails are kept out of the version-
controlled `DIR_TESTDATA` directory.

Props bor0.
Fixes #40008.

git-svn-id: https://develop.svn.wordpress.org/trunk@40142 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-02 02:25:05 +00:00
John Blackbourn e799a8f4ca Build/Test Tools: Only attempt to disable Xdebug on stable builds of PHP.
Unstable builds of PHP (nightly and hhvm) don't have the Xdebug extension enabled. Attempting to disable it results in a build error.

See #39978


git-svn-id: https://develop.svn.wordpress.org/trunk@40139 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-28 00:03:18 +00:00
John Blackbourn ca8ab8ae32 Build/Test Tools: Disable Xdebug when testing on Travis.
This should have some performance benefits, but I guess we'll need to wait and see.

See #39978


git-svn-id: https://develop.svn.wordpress.org/trunk@40138 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-27 22:53:46 +00:00
Joe McGill 5349b0a08c Media: Skip PDF preview tests when image editor doens't support.
Following [40130] tests fail on environments that don't support PDF
previews because the expected meta data doesn't get written.

See #39875.

git-svn-id: https://develop.svn.wordpress.org/trunk@40131 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-27 17:50:21 +00:00
Joe McGill 9848a4a466 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, derosj, mikeschroder, joemcgill.
Fixes #39875. See #31050.

git-svn-id: https://develop.svn.wordpress.org/trunk@40130 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-27 15:38:30 +00:00
Mike Schroder 8e39edfdf6 Media: After [40123], Feature check `setImageOrientation`.
In [40123], `WP_Image_Editor_Imagick` started using
`Imagick::setImageOrientation` and `Imagick::ORIENTATION_TOPLEFT`,
but had no equivalent feature check.

While they were introduced more than 9 years ago, it's important
to double-check everything is available before using with Imagick.

Fixes #37140.

git-svn-id: https://develop.svn.wordpress.org/trunk@40129 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-27 04:21:41 +00:00
John Blackbourn 5ab0154647 Comments: When commenting on a draft post, display a friendly error message if the user can view the post.
This prevents the unhelpful white screen of death when a user who can view the post (eg. preview it) leaves a comment while the post is in draft.

Props sagarprajapati, milindmore22, mayurk, swissspidy
Fixes #39650


git-svn-id: https://develop.svn.wordpress.org/trunk@40128 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-27 00:22:02 +00:00
John Blackbourn b33b5d1a28 Mail: Ensure entities in the site title are decoded when used in the body of the new user email.
Props ajoah
Fixes #39446


git-svn-id: https://develop.svn.wordpress.org/trunk@40127 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-26 22:19:48 +00:00
Andrea Fercia cc8b551d69 Media: Restore correct upload errors displaying after [37610].
Props codegeass, MatheusGimenez, joemcgill.
Fixes #39516.


git-svn-id: https://develop.svn.wordpress.org/trunk@40126 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-26 18:14:07 +00:00
Joe McGill 5c99d4ae9c Media: Fix unit tests for MIME checks on multisite.
A few of the multisite tests were failing after [40124] because
multisite filters `upload_mimes` with the `check_upload_mimes()`
function to reduce the set of allowed MIME types. This fixes those
errors by skipping the tests for adding additional MIME types and
only tests file types assumed to be allowed.

See #39550.

git-svn-id: https://develop.svn.wordpress.org/trunk@40125 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-26 16:05:25 +00:00
Joe McGill 7684a241b3 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.
Fixes #39550, #39552.

git-svn-id: https://develop.svn.wordpress.org/trunk@40124 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-25 16:07:25 +00:00
Mike Schroder cfe271d254 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.
See #14459.
Fixes #37140.

git-svn-id: https://develop.svn.wordpress.org/trunk@40123 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-25 05:25:40 +00:00
James Nylen e5d5f1058e 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`.

Props ryelle.
Fixes #39947.


git-svn-id: https://develop.svn.wordpress.org/trunk@40122 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-25 05:02:17 +00:00
James Nylen c0ad5e4a50 REST API: Update the client test fixtures after changes to post formats.
This commit updates the `wp-api-generated.js` fixture file after recent changes to the way post formats work in the API.

See #39232.


git-svn-id: https://develop.svn.wordpress.org/trunk@40121 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-25 04:45:52 +00:00
James Nylen 162e1a6f2a 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.

Props JPry, iseulde, davidakennedy, Drivingralle.
Fixes #39232.


git-svn-id: https://develop.svn.wordpress.org/trunk@40120 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-24 23:29:04 +00:00
Sergey Biryukov 7d4cabb131 Plugins: After [38703], adjust the selector for checkbox selection to account for nested tables.
Props afercia, swissspidy, reldev.
Fixes #39739.

git-svn-id: https://develop.svn.wordpress.org/trunk@40118 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-24 23:09:51 +00:00
Andrew Ozz e5ce2174fc TinyMCE: preserve empty image alt attributes.
Props afercia.
Fixes #39912 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@40110 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-24 20:40:45 +00:00
Adam Silverstein ddc4850a04 REST API: JS client - QUnit tests for custom namespace route discovery.
Add QUnit tests for the parsing of custom namespace routes. Add a custom schema fixture based on the `wp-js-widgets` plugin. Test that the client can parse the widget namespace in the schema and correctly construct the expected group of models and collections. Also includes a small unrelated QUnit fix to ensure nav-menu test passes when it is loaded without its tests executing as well as a small jshint fix, adding a missing semicolon since [40107].

Props jnylen0.
Fixes #39561.


git-svn-id: https://develop.svn.wordpress.org/trunk@40109 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-24 18:39:39 +00:00
James Nylen 4414e3c20a 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.
Fixes #38883.


git-svn-id: https://develop.svn.wordpress.org/trunk@40108 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-24 18:14:21 +00:00
Adam Silverstein dbfd852fc2 Themes: enable browser history support in add new theme screen.
Enable history support for the new theme screen, including navigating theme details and closing the details modal. Theme selection is now also bookmark-able, so linking to a URL like `/wp-admin/theme-install.php?theme=twentyseventeen` correctly opens the theme preview.

Props dd32.
Fixes #36613.


git-svn-id: https://develop.svn.wordpress.org/trunk@40107 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-24 17:47:30 +00:00
Felix Arntz 0f9dd5f88f 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.
Fixes #39701.


git-svn-id: https://develop.svn.wordpress.org/trunk@40106 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-23 22:36:54 +00:00
James Nylen f366757b55 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.
Fixes #39933.


git-svn-id: https://develop.svn.wordpress.org/trunk@40105 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-23 20:09:11 +00:00
James Nylen 6a23c57ad5 REST API: Ensure that tests pass if extra endpoints are registered.
Many plugins and themes use the WP core test suite to run their unit tests, so the API tests shouldn't fail if there are extra endpoints registered in non-core namespaces.

Props rachelbaker.
Fixes #39264.


git-svn-id: https://develop.svn.wordpress.org/trunk@40104 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-23 15:49:44 +00:00
Sergey Biryukov 109f63fb6b Docs: Update the description of `is_singular()` and `WP_Query::is_singular()` to be parsed correctly by developer.wordpress.org.
Props grapplerulrich.
Fixes #39948.

git-svn-id: https://develop.svn.wordpress.org/trunk@40103 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-23 10:29:27 +00:00
Felix Arntz cf93e7996d Multisite: Use `WP_Network_Query` in `WP_Network::get_by_path()`.
An additional unit test has been introduced to verify the method works properly when using an external object cache.

Props spacedmonkey, jeremyfelt.
Fixes #37217.


git-svn-id: https://develop.svn.wordpress.org/trunk@40102 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-22 10:41:20 +00:00
James Nylen 83d27ba447 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.

Fixes #39256.


git-svn-id: https://develop.svn.wordpress.org/trunk@40101 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-21 18:17:32 +00:00
SergeyBiryukov c31acbfe7e 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.
Fixes #39560.

git-svn-id: https://develop.svn.wordpress.org/trunk@40089 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-20 13:00:19 +00:00
dd32 22a410e1c5 Customize: Update the introduced version in the docs for the `get_header_video_url` filter to 4.7.3.
See #39512.


git-svn-id: https://develop.svn.wordpress.org/trunk@40086 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-20 06:46:34 +00:00