Commit Graph

36432 Commits

Author SHA1 Message Date
Pascal Birchler
e14051c031 Multisite: Ensure first page/post/comment content is not empty when setting up a new site.
This prevents creating page without any content when the options are populated with an empty string.

Props shadyvb.
Fixes #40036.

git-svn-id: https://develop.svn.wordpress.org/trunk@40296 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-17 15:48:35 +00:00
Felix Arntz
eb7a3d1a2f Multisite: Remove restriction of minimum site name length in wpmu_validate_blog_signup().
It is sometimes desirable to support shorter site names than 4 characters, therefore that restriction should be removed. It is still possible to manually enforce it by using the `wpmu_validate_blog_signup` filter.

As a result of this change, another `is_super_admin()` call gets removed which affects the ongoing efforts of working on a network-wide role system.

Props milindmore22.
Fixes #39676. See #37616.


git-svn-id: https://develop.svn.wordpress.org/trunk@40295 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-17 14:35:08 +00:00
Felix Arntz
169c32723f Multisite: Provide unit tests for wpmu_validate_blog_signup().
See #39676.


git-svn-id: https://develop.svn.wordpress.org/trunk@40294 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-17 14:14:14 +00:00
Boone Gorges
79cfdbd84c Improve querying for terms with falsey names and slugs.
Prior to [38677], `get_term_by()` would always return false if
an empty string were passed as the queried 'name' or 'slug'. The
refactor to use `get_terms()` broke this behavior; inappropriately
imprecise `empty()` checks caused the 'name' or 'slug' clause to be
discarded altogether when fetching terms, resulting in an incorrect
term being returned from the function.

We fix the regression by special-casing truly empty values passed
to `get_term_by()`, and ensuring that `WP_Term_Query` is properly
able to handle `0` and `'0'` term queries.

Props sstoqnov.
Fixes #21760.

git-svn-id: https://develop.svn.wordpress.org/trunk@40293 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-16 02:03:53 +00:00
Boone Gorges
24b221bd34 Streamline get_terms() parameter documentation.
Since 4.6, `get_terms()` has been a wrapper for `WP_Term_Query`.
Full parameter documentation lives with the class, and
`get_terms()` should reference rather than duplicate it.

Props shashwatmittal.
Fixes #37075.

git-svn-id: https://develop.svn.wordpress.org/trunk@40292 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-16 01:34:52 +00:00
Boone Gorges
3025ba4c8f 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`.

Props ig_communitysites.
Fixes #40154.

git-svn-id: https://develop.svn.wordpress.org/trunk@40290 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-14 18:41:26 +00:00
James Nylen
b9dd2c01f3 REST API: Fix DST handling in a test.
The time chosen for `test_empty_post_date_gmt_shimmed_using_post_date` falls within US daylight savings time.  This may cause the test to fail depending on whether the current locale has DST.

The fix is to specify a numeric `gmt_offset` rather than a `timezone_string`.

Unprops jnylen0.
Fixes #40136.


git-svn-id: https://develop.svn.wordpress.org/trunk@40284 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-13 15:06:10 +00:00
azaozz
69399f4463 Improve wording of the AYS warning when permanently deleting uploads, tags, posts.
Props dllh, gma992.
Fixes #39712 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@40283 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-11 19:32:08 +00:00
Sergey Biryukov
2d52993e4f Docs: Correct the description for wp.updates.deleteTheme.
Props MattyRob.
Fixes #40110.

git-svn-id: https://develop.svn.wordpress.org/trunk@40279 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-11 16:12:49 +00:00
Boone Gorges
5e74056898 Tests: Use assertSame() for WP_Query 'orderby' tests.
`assertEqualSets()` ignores order, so isn't much good for testing 'orderby'.

See #38034.

git-svn-id: https://develop.svn.wordpress.org/trunk@40278 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-11 03:07:27 +00:00
Boone Gorges
824c50f8ae Don't run 'get_terms' filter when querying for terms within get_term_by().
Historically, it has been possible to call `get_term_by()` within
a 'get_terms' filter callback. Since `get_term_by()` was refactored
to use `get_terms()` internally [38677], callbacks of this nature
have resulted in infinite loops.

As a workaround, we introduce a 'suppress_filter' option to `get_terms()`,
and use it when calling the function from within `get_term_by()`.

Props ocean90.
See #21760.

git-svn-id: https://develop.svn.wordpress.org/trunk@40275 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-11 02:26:11 +00:00
John Blackbourn
5d65051985 Build/Test tools: Don't install PHPUnit on the travis:js builds. Saves a couple of minutes of build time.
See #40100


git-svn-id: https://develop.svn.wordpress.org/trunk@40271 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-10 23:56:07 +00:00
Sergey Biryukov
0a1782bb45 Twenty Seventeen: Correct grammar in 'Page Layout' control description.
Props zoonini, laurelfulford.
Fixes #40107.

git-svn-id: https://develop.svn.wordpress.org/trunk@40270 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-10 23:34:39 +00:00
John Blackbourn
0df4906f9a 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


git-svn-id: https://develop.svn.wordpress.org/trunk@40269 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-10 22:57:31 +00:00
Andrea Fercia
44b84f75e4 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.


git-svn-id: https://develop.svn.wordpress.org/trunk@40268 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-10 19:14:00 +00:00
John Blackbourn
f5fddde456 Build/Test tools: Don't attempt to report PHP's extensions when running HHVM jobs on Travis. It doesn't work.
git-svn-id: https://develop.svn.wordpress.org/trunk@40267 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-10 15:30:33 +00:00
John Blackbourn
44a5ef78d7 Docs: Remove the duplicate hook documentation for the newly introduced send_auth_cookies filter.
See #39367


git-svn-id: https://develop.svn.wordpress.org/trunk@40264 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-10 15:02:43 +00:00
John Blackbourn
f5f7736177 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


git-svn-id: https://develop.svn.wordpress.org/trunk@40263 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-10 14:32:31 +00:00
John Blackbourn
509b17b6c9 Build/test tools: Add some more debugging to Travis and bring the format of the Xdebug fix inline with branches.
git-svn-id: https://develop.svn.wordpress.org/trunk@40259 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-09 21:47:20 +00:00
Dominik Schilling (ocean90)
7ba64e2288 Build/Test Tools: On Travis CI install and use the node version which is specified in package.json.
Props netweb.
See #35105.

git-svn-id: https://develop.svn.wordpress.org/trunk@40258 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-09 21:08:09 +00:00
John Blackbourn
38f5797e3c Build/Test tools: Account for PHP 5.2 when using Composer to install PHPUnit.
See #39822, #40086


git-svn-id: https://develop.svn.wordpress.org/trunk@40257 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-09 20:53:37 +00:00
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