Commit Graph

36094 Commits

Author SHA1 Message Date
James Nylen 8bbfc6ef28 REST API: Fix PHP warnings when `get_theme_support( 'post-formats' )` is not an array.
If `add_theme_support( 'post-formats' )` is called with no additional
arguments, then `get_theme_support( 'post-formats' )` returns `true` rather
than an array of supported formats.  Avoid generating PHP warnings in this
situation.

Props dreamon11, ChopinBach.
Fixes #39293.


git-svn-id: https://develop.svn.wordpress.org/trunk@39620 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-20 00:55:04 +00:00
Ella van Dorpe 9705ad5510 Editor: Let the Add New link disappear in DFW mode.
The link was moved outside the heading in [38983].

Fixes #39313 for trunk.



git-svn-id: https://develop.svn.wordpress.org/trunk@39619 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-17 10:22:49 +00:00
David A. Kennedy 665d60d680 Twenty Seventeen: Improves code readability and code standards in files
Adds better DocBlock comments and fixes some spacing issues based on PHP_CodeSniffer WordPress coding standards.

Props sstoqnov.

Fixes #39152.


git-svn-id: https://develop.svn.wordpress.org/trunk@39618 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-16 22:07:41 +00:00
Joe McGill 1f48d453d8 Media: Allow PDF fallbacks filter to process custom sizes.
This fixes an oversight in [39246], which added a hook for filtering
the array of sizes used for PDF thumbnails, but failed to provide a way
for sizes added through `add_image_size()` to be processed.

Props gitlost.
Fixes #39231. See #38594.

git-svn-id: https://develop.svn.wordpress.org/trunk@39617 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-16 20:29:26 +00:00
Weston Ruter bad6ddc45d Customize: Bump `wp_custom_css_cb` from running at `wp_head` priority 11 to 101 to ensure Custom CSS overrides other CSS.
Aligns `wp_head` action priority with Jetpack's Custom CSS.

Amends [38829].
See #35395, #38672.
Fixes #39270.


git-svn-id: https://develop.svn.wordpress.org/trunk@39616 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-16 07:28:14 +00:00
Dion Hulse a5bb301d0b Feeds: Replace the RSS2 `lastBuildDate` date field with the `r` date specifier.
See #39141.


git-svn-id: https://develop.svn.wordpress.org/trunk@39614 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-16 06:41:45 +00:00
Dion Hulse 939e806ef1 Feeds: Do not translate the `lastBuildDate` field in RSS feeds.
Props stevenkword, dd32.
Fixes #39141


git-svn-id: https://develop.svn.wordpress.org/trunk@39613 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-16 06:38:10 +00:00
Dion Hulse 0abe687fe8 Media: Move a variable definition outside of conditionals to ensure it's always available.
This fixes cases where the URL to a PDF preview may be incorrectly calculated when no thumbnails were generated for the PDF (and avoids a PHP Notice at the same time).

Fixes #39250.


git-svn-id: https://develop.svn.wordpress.org/trunk@39612 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-16 06:20:40 +00:00
Adam Silverstein 7503daedd1 WP-API: JavaScript client - fix setup of models used by wp.api.collections objects.
Correct setup for the `model` attribute of `wp.api.collections` objects. Set the collection model as a function that returns a new model of the underlying type, instead of setting it as the model prototype. Fixes an issue where models for fetched collections weren't set up properly and didn't have the expected mixin methods such as `getCategories` available.

Props jesseenterprises.
Fixes #39070.


git-svn-id: https://develop.svn.wordpress.org/trunk@39603 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-15 12:53:26 +00:00
Ella van Dorpe 79ded07a1a Editor: Remove target=_blank when unchecked in the link modal.
Fixes #39276 for trunk.



git-svn-id: https://develop.svn.wordpress.org/trunk@39601 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-14 20:30:00 +00:00
John Blackbourn ca92da24da General: Use interpolation instead of concatenation for all dynamic hook names.
This fixes the rendering of the hook names on developer.wordpress.org.

Props keesiemeijer
Fixes #39148


git-svn-id: https://develop.svn.wordpress.org/trunk@39600 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-14 04:17:38 +00:00
John Blackbourn c0bb5e4972 Posts, Post Types: Ensure `is_page_template()` can only return true when viewing a singular post query.
Props natereist, dlh
Fixes #39211


git-svn-id: https://develop.svn.wordpress.org/trunk@39599 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-14 03:42:58 +00:00
James Nylen 2642833293 REST API: Add support for filename search in media endpoint.
In [38625], the functionality to search for attachments by filename was added
via the `posts_clauses` filter and the `_filter_query_attachment_filenames()`
function.  This moves `_filter_query_attachment_filenames()` from
`wp-admin/includes/post.php` to `wp-includes/post.php` so that it can be
applied in the same manner in the REST API media endpoint.

Props jblz, tyxla.
Fixes #39092.


git-svn-id: https://develop.svn.wordpress.org/trunk@39598 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-13 14:08:24 +00:00
James Nylen 03c947c7fd REST API: Allow sending an empty or no-op comment update.
In general, updates that don't actually change anything should succeed.
[39371] added tests for other object types, and this commit fixes empty updates
for comments and adds the missing test.

Fixes #38700.


git-svn-id: https://develop.svn.wordpress.org/trunk@39597 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-13 13:52:49 +00:00
Gary Pendergast 25330a0220 Libraries: Update zxcvbn from version 1.0 to 4.4.1
This includes masses of bug fixes, as well as tweaks to how passwords are scored.

QUnit tests have been updated to reflect tha scoring changes.

Full changelog: https://github.com/dropbox/zxcvbn/compare/v1.0...v4.4.1

Fixes #31647.



git-svn-id: https://develop.svn.wordpress.org/trunk@39596 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-13 11:22:28 +00:00
James Nylen 9bf4440213 REST API: Do not include the `password` argument when getting media items
Currently, `attachment` is the only post type exposed via the REST API that
does not support password protection, but it's possible for other post types to
remove password support.

Fixes #38977.


git-svn-id: https://develop.svn.wordpress.org/trunk@39595 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-13 03:51:01 +00:00
James Nylen 68b6a6197b REST API: Do not error on empty JSON body
It's fairly common for clients to send `Content-Type: application/json` with an
empty body.  While technically not valid JSON, we've historically supported
this behaviour, so it shouldn't cause an error.

Props JPry.
Fixes #39150.


git-svn-id: https://develop.svn.wordpress.org/trunk@39594 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-13 03:33:14 +00:00
Boone Gorges 012d1977e2 Taxonomy: Use `get_term_link()` instead of `get_category_link()` in `get_term_parents_list()`.
`get_category_link()` is a wrapper for `get_term_link()`. Using the
unwrapped function makes more sense semantically (it's taxonomy-
agnostic) and it's also more parsimonious (the `WP_Error` check in
`get_category_link()` is redundant with similar checks just before
in `get_term_link()`).

Props keesiemeijer.
Fixes #17069.

git-svn-id: https://develop.svn.wordpress.org/trunk@39593 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-13 02:56:32 +00:00
Ryan McCue bc2d2858f9 General: Correctly detect trailing newline when prepending.
We need to check that the final line is actually an artifact of explode(), not just an empty input string.

See #37082.


git-svn-id: https://develop.svn.wordpress.org/trunk@39592 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-13 02:47:07 +00:00
Ryan McCue 32ed2a1ffa General: Remove most uses of create_function()
create_function() is equivalent to eval(), and most of our uses can be refactored. This is simpler, more secure, and slightly more performant.

Props sgolemon.
Fixes #37082.


git-svn-id: https://develop.svn.wordpress.org/trunk@39591 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-13 01:48:41 +00:00
Felix Arntz b171b64d3c Tests: Use `wp_delete_user()` during teardown to delete a single site's user.
Fixes failing tests for `get_dashboard_url()`.

Fixes #39065.


git-svn-id: https://develop.svn.wordpress.org/trunk@39590 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-12 23:17:35 +00:00
Felix Arntz b4317ea053 Multisite: Replace `is_super_admin()` with `manage_network` in `get_dashboard_url()`.
Unit tests for `get_dashboard_url()` have been added.

Props iaaxpage.
Fixes #39065. See #37616.


git-svn-id: https://develop.svn.wordpress.org/trunk@39589 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-12 22:40:03 +00:00
Felix Arntz 539b85406d Multisite: Handle capability check for removing oneself via `map_meta_cap()`.
Site administrators should not be able to remove themselves from a site. This moves the enforcement of this rule from `wp-admin/users.php` to `remove_user_from_blog()` via the `remove_user` capability, which furthermore allows us to get rid of two additional clauses and their `is_super_admin()` checks in `wp-admin/users.php`. A unit test for the new behavior has been added.

Fixes #39063. See #37616.


git-svn-id: https://develop.svn.wordpress.org/trunk@39588 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-12 21:41:44 +00:00
Konstantin Obenland 87e6390895 Themes: Add missing square bracket in jQuery selector.
Fixes a bug in Safari where the UI wasn't updated after deleting a theme due to
the incomplete selector.

Props Hristo Sg.
Fixes #39246.


git-svn-id: https://develop.svn.wordpress.org/trunk@39586 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-12 09:31:38 +00:00
Weston Ruter 050eb4da17 Customize: Prevent navigation in preview when clicking on child elements of preview links that have non-previewable URLs.
Fixes #39098.


git-svn-id: https://develop.svn.wordpress.org/trunk@39584 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-12 08:08:08 +00:00
Dion Hulse 9e70bab188 Remove the WordPress version number from `readme.html`.
See #35554 


git-svn-id: https://develop.svn.wordpress.org/trunk@39583 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-12 08:00:24 +00:00
Weston Ruter ae9854e338 Customize: Prevent edit shortcut from losing event handler after selective refresh.
Props sirbrillig.
See #27403.
Fixes #39100.


git-svn-id: https://develop.svn.wordpress.org/trunk@39581 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-12 07:52:00 +00:00
Dion Hulse 24228daabf PDF Images: Avoid a PHP Warning when attempting to process a file without an extension.
Props chandrapatel for initial patch.
Fixes #39195.


git-svn-id: https://develop.svn.wordpress.org/trunk@39580 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-12 06:18:30 +00:00
Dion Hulse caa1f1f88d Taxonomy: Restore the ability to use string-based `$args` in `wp_get_object_terms()`.
Props tyxla.
Fixes #39215


git-svn-id: https://develop.svn.wordpress.org/trunk@39578 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-12 05:46:37 +00:00
Weston Ruter 1c84857edf Build/Test Tools: Facilitate SVN and Git being co-located in the same directory.
Ignore .svn in .gitignore, and ignore .git in svn:ignore.

Fixes #39245.


git-svn-id: https://develop.svn.wordpress.org/trunk@39577 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-12 05:11:27 +00:00
Dion Hulse de13e89608 Bootstrap: Re-initialize any hooks added manually by `object-cache.php`.
Prior to 3.1 if a object cache dropin wanted to add actions, they needed to use `$wp_filter` directly.

Props jorbin.
Fixes #39132.


git-svn-id: https://develop.svn.wordpress.org/trunk@39565 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-12 01:28:34 +00:00
Peter Wilson 7950b0e306 Options: Prevent unnecessary SQL updates by `update_option`.
Previously an option containing an object would trigger an SQL `UPDATE` on all calls to `update_option`, even if the old and new values were identical. This was due to the old and new values having differing resource IDs.

This change compares the old and new values as serialized data to remove the resource ID from the comparison.

Props salcode, bradyvercher, peterwilsoncc.
Fixes #38903.


git-svn-id: https://develop.svn.wordpress.org/trunk@39564 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-11 21:42:12 +00:00
Rachel Baker 260a88d009 REST API: Allow schema sanitization_callback to be set to null to bypass fallback sanitization functions.
The logic in WP_REST_Request->sanitize_params() added in [39091] did not account for `null` or `false` being the sanitization_callback preventing overriding `rest_parse_request_arg()`. This fixes that oversight, allowing the built in sanitization function to be bypassed. See #38593.

Props kkoppenhaver, rachelbaker, jnylen0.
Fixes #39042.


git-svn-id: https://develop.svn.wordpress.org/trunk@39563 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-11 21:25:40 +00:00
Weston Ruter 3a3ebc76a3 Customize: Fix ability to shift-click on placeholder/pre-saved nav menu items in preview to focus on corresponding control.
Fixes #39102.


git-svn-id: https://develop.svn.wordpress.org/trunk@39562 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-10 23:46:33 +00:00
Weston Ruter 1681d96a6d Customize: Deprecate `page_home` nav menu item starter content in favor of `home_link`; replace usage in Twenty Seventeen.
Props celloexpressions, westonruter.
Amends [38991].
See #38615, #38114.
Fixes #39104.


git-svn-id: https://develop.svn.wordpress.org/trunk@39561 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-10 23:38:04 +00:00
Weston Ruter e27098f5bd Customize: Trim whitespace for URLs supplied for `external_header_video` to prevent `esc_url_raw()` from making them invalid.
Props tyxla.
See #38172.
Fixes #39125.


git-svn-id: https://develop.svn.wordpress.org/trunk@39560 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-10 06:59:24 +00:00
Weston Ruter 0369dea1e4 Customize: Prevent single quotes (apostrophes) in `custom_css` values from unexpectedly causing false positives for unbalanced character validation errors.
See #39218, #35395.
Fixes #39198.


git-svn-id: https://develop.svn.wordpress.org/trunk@39559 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-10 06:45:00 +00:00
Weston Ruter be8caefd82 Customize: Fix inability to delete nav menus by preventing `preview` filters from being added during `customize_save` admin ajax request.
Also prevent setting `nav_menu_locations[...]` values to `NaN` which gets sent as `null`.

Amends [38810].
See #30937.
Fixes #39103.


git-svn-id: https://develop.svn.wordpress.org/trunk@39558 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-10 06:29:12 +00:00
Weston Ruter 09df948303 Customize: Prevent scrolling `custom_css` textarea to top when pressing tab.
Props tyxla, sstoqnov for testing, celloexpressions for testing.
See #38667.
Fixes #39134.


git-svn-id: https://develop.svn.wordpress.org/trunk@39557 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-10 00:43:34 +00:00
John Blackbourn d9ac66c910 Build/Test Tools: Remove some more randomness.
See #37371


git-svn-id: https://develop.svn.wordpress.org/trunk@39556 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-10 00:01:30 +00:00
John Blackbourn 6db50cd8b2 Build/Test Tools: Reuse another fixture in the user capability tests.
See #38716


git-svn-id: https://develop.svn.wordpress.org/trunk@39555 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-09 23:35:55 +00:00
John Blackbourn d06bd0172e Build/Test Tools: Remove commented out tests that have existed in an unimplemented state since the dawn of the test infrastructure.
See #38716


git-svn-id: https://develop.svn.wordpress.org/trunk@39554 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-09 23:11:28 +00:00
Andrea Fercia 7b7914a99f Accessibility: Remove inappropriate content from the Edit Categories and Edit Tags screens headings.
See #26601.


git-svn-id: https://develop.svn.wordpress.org/trunk@39553 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-09 20:49:49 +00:00
Andrea Fercia 25f40667d0 Accessibility: Remove inappropriate content from the Edit Comments screen heading.
See #26601.


git-svn-id: https://develop.svn.wordpress.org/trunk@39552 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-09 18:58:51 +00:00
Andrea Fercia c7b8c49bfc Accessibility: Remove inappropriate content from the Network screens headings.
See #26601.


git-svn-id: https://develop.svn.wordpress.org/trunk@39551 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-09 18:56:46 +00:00
boonebgorges 479a743307 Docs: Correct param definition for `WP_Query::query()`.
Props Shelob9.
Fixes #38963.

git-svn-id: https://develop.svn.wordpress.org/trunk@39550 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-09 16:22:02 +00:00
Boone Gorges 77484a0f4a Taxonomy: Introduce `get_term_parents_list()`.
This new function is a taxonomy-agnostic version of `get_category_parents()`.

Props keesiemeijer, SergeyBiryukov, rafaehlers.
Fixes #17069.

git-svn-id: https://develop.svn.wordpress.org/trunk@39549 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-09 16:09:31 +00:00
Weston Ruter 3caac42ac0 Customize: Collapse available nav menu items panel when clicking outside over preview or over existing items.
Props rockwell15.
Fixes #38953.


git-svn-id: https://develop.svn.wordpress.org/trunk@39548 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-09 06:15:15 +00:00
Weston Ruter 3669b47260 Customize: Allow (optional) `url` parameter to be omitted in intercepted calls to `history.pushState()` and `history.replaceState()` in customize preview.
Fixes issue where calls without the `url` parameter erroneously end up rewriting the location path to `/undefined`.

Props Christian1012, westonruter.
Fixes #39175.


git-svn-id: https://develop.svn.wordpress.org/trunk@39547 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-09 01:58:18 +00:00
Weston Ruter c8eafed944 Customize: Use `esc_url_raw()` instead of `wp_json_encode()` to eliminate extraneous slashes when outputting background image URL in CSS `url()`.
Props tyxla, westonruter.
See #22058.
Fixes #39145.


git-svn-id: https://develop.svn.wordpress.org/trunk@39546 602fd350-edb4-49c9-b593-d223f7449a82
2016-12-09 01:42:23 +00:00