Commit Graph

35685 Commits

Author SHA1 Message Date
Joe McGill f2f3b3696b Media: Sanity check array value in `wp_prepare_attachment_for_js()`.
This adds a sanity check to the return value of the `image_downsize` filter
in `wp_prepare_attachment_for_js()` to avoid undefined offest notices.

Props justinbusa for initial patch.
Fixes 34437.

git-svn-id: https://develop.svn.wordpress.org/trunk@39107 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-03 02:22:43 +00:00
Joe Hoyle 7f67e60817 REST API: Switch to stable version of JSON Schema.
Props danielbachhuber.
Fixes #38635.


git-svn-id: https://develop.svn.wordpress.org/trunk@39106 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-03 02:21:48 +00:00
Rachel Baker baf52c815a REST API: Clean-up our validation callbacks and add missing array `items` properties in our endpoint schemas.
Props joehoyle, jnylen0.
Fixes #38617.

git-svn-id: https://develop.svn.wordpress.org/trunk@39105 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-03 02:17:39 +00:00
Joe Hoyle 25b892c1ca REST API: Support querying for multiple post statuses.
Multiple post statuses can be specified by the usual CSV or array-propper format.

Props jnylen0, kadamwhite, websupporter.
Fixes #38420.


git-svn-id: https://develop.svn.wordpress.org/trunk@39104 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-03 01:45:48 +00:00
Rachel Baker a0876e06cd REST API: Use the `items` attribute for the taxonomies `types` schema property for proper sanitization/validation.
Props danielbachhuber, joehoyle.
Fixes #38631.

git-svn-id: https://develop.svn.wordpress.org/trunk@39103 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-03 01:25:48 +00:00
Joe McGill 22bb12dd61 Themes: Remove jQuery dependency from wp-custom-header.js.
In [38985], we used jQuery to trigger a custom event once a video
handler has completed so themes, like Twenty Fourteen, can execute
their own adjustments after the header video has loaded.

This replaces the jQuery `trigger()` method with a native event and
updates Twenty Fourteen accordingly.

Props adamsilverstein, joemcgill.
Fixes #38550.

git-svn-id: https://develop.svn.wordpress.org/trunk@39102 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-03 01:20:14 +00:00
Rachel Baker c962a98980 REST API: Return an error when the length of a comment field is too long.
Introduces `wp_check_comment_data_max_lengths()` which allows both the REST API comments endpoints and `wp_handle_comment_submission()` to check the length of the comment content, author name, author url, and author email fields against their respective database columns.

Props rachelbaker, mangeshp, salcode, pento.
Fixes #38477.

git-svn-id: https://develop.svn.wordpress.org/trunk@39101 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-03 01:11:30 +00:00
Weston Ruter 73c595f3e4 Customize: Prevent PHP warning in applying widget starter content on fresh installs.
Fixes PHP warning triggered by calling `max()` on `$widget_numbers` when there are no widget instances of the type yet. Also makes sure that widget instances start at 2 instead of 1.

See #38114.


git-svn-id: https://develop.svn.wordpress.org/trunk@39100 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-02 23:59:28 +00:00
Pascal Birchler 21dc2530eb Plugins: Improve Ajax search of installed plugins.
Removes the highlight from the current filter when performing an Ajax search and adds it back when clearing the search input.

Fixes #37657.

git-svn-id: https://develop.svn.wordpress.org/trunk@39099 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-02 22:46:25 +00:00
Helen Hou-Sandi 9bb355dccd Menus: Use a label of "Display location" for individual nav menu settings.
While "Menu/Theme locations" was descriptive of what the choices listed were, in the context of editing an individual nav menu it is more descriptive to use a setting label that tells you what it is you are affecting for that nav menu, which is where it will be displayed. Technically multiple locations can be chosen, but in practice that appears to be rare enough that we can avoid an awkward "location(s)" type string.

props Fencer04 for the initial patch.
fixes #38525.


git-svn-id: https://develop.svn.wordpress.org/trunk@39098 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-02 22:10:30 +00:00
Joe Hoyle 082151025e REST API: Include `taxonomies` as an attribute of post types.
Add the taxonomies for a post type to the `/wp/v2/types` endpoint, so clients know which taxonomies are available for which post types.

Props danielbachhuber.
Fixes #38438, #38631.


git-svn-id: https://develop.svn.wordpress.org/trunk@39097 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-02 21:50:08 +00:00
Joe Hoyle e78230b39a REST API: Add en_US to the locales enum.
Props ocean90.
Fixes #38528. 


git-svn-id: https://develop.svn.wordpress.org/trunk@39096 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-02 21:20:12 +00:00
Dominik Schilling (ocean90) 4dfb71c3b5 Query: Add tests for `WP_Query::is_single()` and `get_body_class()` with attachments.
See [39052]
See #38225.

git-svn-id: https://develop.svn.wordpress.org/trunk@39095 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-02 19:22:17 +00:00
Tammie Lister 4ab3f9fc3a Twenty Seventeen: Unifies the labels for front page sections
Front page sesctions # Content were labelled in Customizer Theme Options but the preview called it Panel # placeholder. This unifies that.

Props Clorith, ahortin, celloexpressions, davidakennedy
Fixes #38567



git-svn-id: https://develop.svn.wordpress.org/trunk@39094 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-02 19:08:11 +00:00
Ryan McCue bbbf3a97fa REST API: Allow querying for multiple `slug` values.
Props jnylen0, rachelbaker.
Fixes #38579.


git-svn-id: https://develop.svn.wordpress.org/trunk@39093 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-02 07:13:24 +00:00
Ryan McCue 1f9c6904bc REST API: Add update and delete endpoints to /users/me
Now that /users/me is a standalone resource, it should have all the standard endpoints for a resource.

Props pento.
Fixes #38521 (hopefully).


git-svn-id: https://develop.svn.wordpress.org/trunk@39092 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-02 06:52:30 +00:00
Ryan McCue 603d38f02e REST API: Set default sanitize callback if type is set.
Props joehoyle, ChopinBach, jnylen0.
Fixes #38593.


git-svn-id: https://develop.svn.wordpress.org/trunk@39091 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-02 06:27:29 +00:00
Ryan McCue f9230a1c4d REST API: Add locale to user resource.
Props ocean90, joehoyle.
Fixes #38528.


git-svn-id: https://develop.svn.wordpress.org/trunk@39090 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-02 06:23:12 +00:00
Ryan McCue df13f01ad0 REST API: Avoid default sanitization for polymorphic params.
Some parameters (`title`, `content`, etc) are objects in the output, but allow objects or strings to be sent in updates for a more ergonomic interface. This is pretty weird behaviour, so the default sanitisation doesn't handle this. We instead handle this ourselves in the preparation.

Props joehoyle, rachelbaker.
Fixes #38529.


git-svn-id: https://develop.svn.wordpress.org/trunk@39089 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-02 06:01:49 +00:00
Gary Pendergast d4de97ad6f Roles: Fix a PHP error introduced in [39082].
The now deprecated `WP_Roles::reinit()` method was trying to call `__deprecated_function()`, instead of `_deprecated_function()`.

See 23016.



git-svn-id: https://develop.svn.wordpress.org/trunk@39088 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-02 05:54:27 +00:00
Ryan McCue 5d924daeb3 REST API: Change method of merging parameters.
`array_merge()` incorrectly reindexes numeric parameters, causing things like `{"123": true}` to be "dropped".

Props sswells, joehoyle.
Fixes #38306.


git-svn-id: https://develop.svn.wordpress.org/trunk@39087 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-02 05:52:12 +00:00
Helen Hou-Sandi 5af14c3e07 Mail: Set a better error code when triggering `wp_mail_failed`.
This error code is now... wait for it... `wp_mail_failed`. Previously, this would have been the originating PHPMailer error code, which could be `0`, which would then fail (pass?) the `empty()` check in the `WP_Error` constructor, thereby rendering the error object fairly useless. The PHPMailer error code is now located within the `WP_Error` data.

props Kau-Boy, stephenharris.
fixes #35598.


git-svn-id: https://develop.svn.wordpress.org/trunk@39086 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-02 04:26:18 +00:00
Ryan McCue 4ff5c83255 REST API: Remove the Location redirect for the /users/me endpoint.
This is a re-commit of [38980], which was reverted in [38990].

Props youknowriad, jnylen0, pento.
Fixes #38521.


git-svn-id: https://develop.svn.wordpress.org/trunk@39085 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-02 03:44:00 +00:00
Ryan McCue 011e0b99a1 REST API: Only expose formats supported by the current theme.
While it's valid to save any format to the database, and WordPress is totally fine with that, we should only include the formats specified by the theme in the schema.

Props danielbachhuber.
Fixes #38610.


git-svn-id: https://develop.svn.wordpress.org/trunk@39084 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-02 03:36:40 +00:00
Gary Pendergast c91b3de690 Docs: Add the parameter name for the `wp_roles_init` action.
[39082] missed adding the name of the parameter to the docs of the `wp_roles_init` action.

Props johnbillion for the catch.
See #23016.



git-svn-id: https://develop.svn.wordpress.org/trunk@39083 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-02 00:56:20 +00:00
Gary Pendergast b665b5c7d8 Roles/Capabilities: Add a new `wp_roles_init` filter.
Historically, it's been difficult to extend user roles, but reasonable to work around by waiting until after `init` has fired, to add custom roles and capabilities. With the addition of Locale Switching, Core now potentially loads roles before `init` has fired, leaving a window where custom roles and capabilities are not handled.

The new filter allows plugins to add their own custom roles whenever they're initialised (on page load, or when switching sites, for example), so that they can always be obeyed.

`WP_Roles` has also been tidied up a little bit, to remove duplicate code.

Props johnjamesjacoby, pento.
Fixes #23016.



git-svn-id: https://develop.svn.wordpress.org/trunk@39082 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-02 00:30:29 +00:00
David A. Kennedy 8c1185eeda Twenty Seventeen: Fix `supportsInlineSVG()` being unnecessarily called twice
* Also, fix spacing inconsistency in comment.

Props tywayne.

Fixes #38556.


git-svn-id: https://develop.svn.wordpress.org/trunk@39081 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-01 21:23:42 +00:00
Tammie Lister 419dfa52b7 Twenty Seventeen: Sticky icon fix to stop appearing in regular post flow
The sticky icon was appearing in posts it shouldn't have, not just when stuck. This fixes that.

Props laurelfulford, mageshp, davidakennedy
Fixes #38534



git-svn-id: https://develop.svn.wordpress.org/trunk@39080 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-01 20:55:15 +00:00
Tammie Lister 75677ccb20 Twenty Seventeen: Fixes ul inside ol being wrongly ordered.
Now the listing displays correctly.

Props tg29359, Soean, laurelfulford, davidakennedy
Fixes #38515



git-svn-id: https://develop.svn.wordpress.org/trunk@39079 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-01 20:52:22 +00:00
David A. Kennedy 4e5f7fce43 Twenty Seventeen: Update page layout setting for all use cases
* Makes sure the page layout setting also applies to pages, and is not completely hidden from them when a sidebar widget is present. Pages do not have a sidebar, so that was incorrect.
* Updates description in Customizer for brevity and accuracy.
* Applies setting to archive pages as well.
* Updates CSS to reflect changes.

Props celloexpressions, laurelfulford.

Fixes #38538.


git-svn-id: https://develop.svn.wordpress.org/trunk@39078 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-01 20:39:54 +00:00
Ella van Dorpe a3db15bb26 TinyMCE: wptextpattern: Fix undo shortcut for inline patterns
Fixes #37092.



git-svn-id: https://develop.svn.wordpress.org/trunk@39077 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-01 20:33:21 +00:00
Helen Hou-Sandi bbfed835a3 Only set `fresh_site` during an actual fresh install.
props westonruter.
fixes #38533.


git-svn-id: https://develop.svn.wordpress.org/trunk@39076 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-01 20:15:08 +00:00
Ella van Dorpe 0f00396bb6 TinyMCE: wptextpattern: Handle unconverted inline patterns
Make sure the right text is matched when it already contains characters of the pattern.
Adds two more unit tests.

Fixes #37693.



git-svn-id: https://develop.svn.wordpress.org/trunk@39075 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-01 20:05:48 +00:00
John Blackbourn 9cac5048b4 Editor: Correct the description of the parameter passed to the `wp_default_editor` filter.
Props goto10
Fixes #38327


git-svn-id: https://develop.svn.wordpress.org/trunk@39074 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-01 19:55:46 +00:00
David A. Kennedy d13b9b284a Twenty Seventeen: Remove unnecessary l10n variables
* Relies on header skip link instead of l10n variables in JavaScript.
* Fixes issue where scroll down arrow appeared next to the navigation on the front page with no header image or video. It now only appears with a big header.

Props enodekciw, laurelfulford.

Fixes #38502.


git-svn-id: https://develop.svn.wordpress.org/trunk@39073 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-01 18:59:06 +00:00
David A. Kennedy b37b90b6f4 Twenty Seventeen: Replace remaining Genericons with Font Awesome icons
* Replaces: icon-pinned with icon-thumb-tack
* Replaces: icon-next with icon-arrow-right
* Replaces: icon-previous with icon-arrow-left
* Replaces: icon-expand with icon-angle-down
* Removes: Path, Polldaddy

Props sami.keijonen, melchoyce, laurelfulford.

Fixes #38488.


git-svn-id: https://develop.svn.wordpress.org/trunk@39072 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-01 17:25:58 +00:00
Jeremy Felt 459fe129a5 Multisite: Use `get_network()` in `WP_UnitTest_Factory_For_Network`.
`wp_get_network()` was deprecated in 4.6.

Props johnjamesjacoby.
Fixes #38602.


git-svn-id: https://develop.svn.wordpress.org/trunk@39071 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-01 16:51:26 +00:00
John Blackbourn ee31735401 I18N: Revert [39069] as it needs some more work.
See #38485


git-svn-id: https://develop.svn.wordpress.org/trunk@39070 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-01 16:06:21 +00:00
Pascal Birchler e9546b8c45 I18N: Use the user's locale when loading text domains in the admin.
Leverages `get_user_locale()` in `load_*_textdomain()` and `_load_textdomain_just_in_time()` to always load translations in the user's language when in the admin.

Fixes #38485.

git-svn-id: https://develop.svn.wordpress.org/trunk@39069 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-01 09:23:23 +00:00
Pascal Birchler b0aad156bb I18N: Show available timezones in the user's locale on the settings screen.
Adds a `$locale` parameter to `wp_timezone_choice()` to only reload translations when necessary.

Props yale01.
See #38485.

git-svn-id: https://develop.svn.wordpress.org/trunk@39068 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-01 09:15:42 +00:00
Pascal Birchler 9f18722721 I18N: Remove unused `$wpdb` global from `get_locale()` after [39005].
Originally added in [38976], but reverted soon after.

Props johnjamesjacoby.
Fixes #38601.

git-svn-id: https://develop.svn.wordpress.org/trunk@39067 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-01 07:37:29 +00:00
Aaron Jorbin 61b50ae964 Update link in register_meta about 4.6 changes
The blog post, while originally canonical, was later updated to include additional changes. The ticket includes all the changes and alot of rational for why things changed.

Props Mista-Flo, DrewAPicture, morganestes.
Fixes #38254.



git-svn-id: https://develop.svn.wordpress.org/trunk@39066 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-01 06:53:17 +00:00
Dion Hulse cacd16cf5d Themes: Update the unit tests to handle [39064] and #31550.
`test_default_theme_in_default_theme_list()` was always being skipped after #31550, this causes it to once again check that the unit tests are up to date and include the latest default theme.
`test_default_themes_have_textdomain()` didn't play happy when a default theme wasn't installed on a site.

See #31550, #29925, #38551.


git-svn-id: https://develop.svn.wordpress.org/trunk@39065 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-01 03:13:27 +00:00
Dion Hulse b92ebd9e2d Upgrade: Install new themes upon upgrade again.
This partially reverts [35738], which has shown to provide a bad user experience for users seeking to experiment with TwentySeventeen.

This will result in TwentySixteen being installed in addition to TwentySeventeen.

See #38551.


git-svn-id: https://develop.svn.wordpress.org/trunk@39064 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-01 01:23:17 +00:00
John Blackbourn 99267c4e1d Plugins: Correct the `since` docs for the various `plugin_action_links` filters.
Props tfrommen, SergeyBiryukov


git-svn-id: https://develop.svn.wordpress.org/trunk@39063 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-31 19:37:39 +00:00
John Blackbourn d1707d6542 Posts, Post Types: Prevent users from being able to delete a protected meta field from a post.
Previously a user could remove a protected meta field by using their browser developer tools to alter the form field properties in the Custom Fields meta box, given that they know the ID of the protected meta field. This change prevents this by preventing any change to a protected meta field, including changing its key.

Props ajoah, johnbillion, peterwilsoncc
Fixes #38293


git-svn-id: https://develop.svn.wordpress.org/trunk@39062 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-31 19:29:07 +00:00
Joe Hoyle 0e609fa717 REST API: Sanitize arrays being sent as CSVs.
In #38586 the ability to parse arrays as csv was introduced, however it didn't add any support for validating csv arrays. This adds such sanitization, and also a good amount of unit tests for all sanitization baed off schema.

See #38586.


git-svn-id: https://develop.svn.wordpress.org/trunk@39061 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-31 17:07:14 +00:00
Weston Ruter abc7c676a4 Customize: Ensure state query params persist in preview through calls to `history.pushState()` & `history.replaceState()`.
Allow history to be manipulated before DOM ready by sourcing state params from the current URL instead of from the `wp.customize.settings` object, since they will be the same anyway. This fixes a JS error since `wp.customize.settings` is not defined before DOM ready.

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


git-svn-id: https://develop.svn.wordpress.org/trunk@39060 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-31 16:41:06 +00:00
Andrea Fercia f34e252334 Administration: remove a leftover check from get_submit_button.
Props sstoqnov.
Fixes #34891.


git-svn-id: https://develop.svn.wordpress.org/trunk@39059 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-31 16:38:21 +00:00
Joe Hoyle 89ce913169 REST API: Add support for "integer" type for meta and options
Previously Settings only supported "number" which meant it was possible to push floats to things like posts_per_page. This means now developers can also specify `type => ineger` in meta nad settings resgration.

Props flixos90.
Fixes #38393.


git-svn-id: https://develop.svn.wordpress.org/trunk@39058 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-31 16:06:54 +00:00