Commit Graph

35554 Commits

Author SHA1 Message Date
Gary Pendergast dcc71eddcd I18N: Fix a PHP fatal when `get_locale()` is called before `$wpdb` is ready.
If WPDB needs to bail early, it loads the translations, which need to load the locale. Without WPDB, we can't get any database options, so can only rely on what's been loaded so far.

Fixes #29783.



git-svn-id: https://develop.svn.wordpress.org/trunk@38976 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-27 03:42:09 +00:00
Boone Gorges eb9e2b9207 Share fixtures in REST API endpoint tests.
As sparrows' tears shed steadily
Make widest rivers filled,

`setUp()` routines run prodig'ly
Add minutes to a build.

So cull ye fixtures profligate!
Direct thine frugal gaze!

Our savings here - a half-minute -
When multiplied: Amaze!

See #30017.

git-svn-id: https://develop.svn.wordpress.org/trunk@38975 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-27 02:56:28 +00:00
Boone Gorges 5da7a1dccf REST API: Use `wp_get_object_terms()` when fetching terms for a post object.
The WP-API plugin originally used a custom method for fetching object
terms in a way that supported the object cache and also accepted all
parameters for `get_terms()`. In [38667], the internals of
`wp_get_object_terms()` were modified to use `WP_Term_Query`, thus
delivering in a native fashion the features that the API had
previously achieved bespokely.

Fixes #38504.

git-svn-id: https://develop.svn.wordpress.org/trunk@38974 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-27 01:41:08 +00:00
Gary Pendergast 3e77cef88a Customize: Remove an unused variable.
The cleanup in [38972] missed a variable that is no longer being used.

Fixes #27403.



git-svn-id: https://develop.svn.wordpress.org/trunk@38973 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-27 00:30:11 +00:00
Weston Ruter d039c9b4b2 Customize: Remove unnecessary code for edit shortcuts which is no longer required due to moving buttons inside of partial placement containers.
Props sirbrillig.
Amends [38967].
See #27403.


git-svn-id: https://develop.svn.wordpress.org/trunk@38972 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 22:37:35 +00:00
Rachel Baker 8c0d5292a2 REST API: Add the `default_comment_status` and `default_ping_status` options to the setting endpoint.
Props joehoyle.
See #38490.

git-svn-id: https://develop.svn.wordpress.org/trunk@38971 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 22:19:08 +00:00
Andrew Ozz 0888864e29 TinyMCE: after chats in #core-editor and #desing on Slack, the decision is to not remove Heading 1 for beta1.
See #38049.

git-svn-id: https://develop.svn.wordpress.org/trunk@38970 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 22:00:07 +00:00
Tammie Lister 0beb2ef213 Twenty Seventeen: Placeholder styling
These were designed but never implemented.

Props melchoyce, davidakennedy
Fixes #38519



git-svn-id: https://develop.svn.wordpress.org/trunk@38969 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 21:55:09 +00:00
Rachel Baker 6e47838053 REST API: Remove experimental `filter` wrapper parameter from the Posts Controller class.
Hiding WP_Query params under the filter key (instead of allowing them to be top-level params) was one of our biggest complaints from users of v1 of our REST API. This walks back the re-introduction of the `filter` param during Beta 15, which introduced an "inconsistent mess" and "exposing WP_Query through filter has and will continue to be difficult to support." See https://github.com/WP-API/WP-API/issues/2799.

Props websupporter, rachelbaker.
Fixes #38378.

git-svn-id: https://develop.svn.wordpress.org/trunk@38968 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 21:36:29 +00:00
Weston Ruter fda4409f40 Customize: Add edit shortcuts in customizer preview to visually expose editable elements and focus on the corresponding controls when clicked.
* Edit shortcuts show initially for a moment and then fade away so as to not get in the way of the preview. 
* Visibility of edit shortcuts is toggled by clicking/touching anywhere inert in the document.
* Implements UI for mobile and touch devices which do not support shift-click.
* Adds `editShortcutVisibility` state.
* Adds new methods to `wp.customize.selectiveRefresh.Partial` for managing edit shortcuts.

Incorporates aspects of the Customize Direct Manipulation feature plugin.

Props sirbrillig, mattwiebe, celloexpressions, melchoyce, westonruter, afercia.
Fixes #27403.


git-svn-id: https://develop.svn.wordpress.org/trunk@38967 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 20:02:51 +00:00
David A. Kennedy 67420e4986 Twenty Seventeen: Implement selective refresh for site title and tagline
Adding the `opacity` property to the site title prevents opacity from changing during selective refreshes in the Customizer preview.

Props celloexpressions.

Fixes #38513.


git-svn-id: https://develop.svn.wordpress.org/trunk@38966 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 18:42:44 +00:00
Andrea Fercia 29e75c5d77 Administration: Better accessibility for the "Post locked" indicator.
- hides the locked icon from assistive technologies
- adds hidden text to indicate the post is locked
- moves the info about who's currently editing to the top of the title table cell

Props mariovalney.
Fixes #38185.


git-svn-id: https://develop.svn.wordpress.org/trunk@38965 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 17:58:34 +00:00
David A. Kennedy 16768b39cf Twenty Seventeen: Fix header height on sub-pages.
Moves `setNavProps` so it's no longer only fired on load when the scroll down arrow is present.

Props laurelfulford.

Fixes #38496.


git-svn-id: https://develop.svn.wordpress.org/trunk@38964 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 17:38:59 +00:00
David A. Kennedy cd910cffdc Twenty Seventeen: Make table styles more consistent
* Removes the left padding on the first cell in a row, and the right padding on the last cell in each row - the padding is still there between cells, so the contents don't meet.
* Does the opposite for RTL, and fixes some spacing issues.
* Updates the editor styles to match.

Props laurelfulford, snacking.

Fixes #38447.


git-svn-id: https://develop.svn.wordpress.org/trunk@38963 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 17:24:06 +00:00
David A. Kennedy 64117bbc6e Twenty Seventeen: Improve front end display in Internet Explorer 8
* Fixes the display issues with the header. The header doesn't look exactly like it does in newer browsers, but it's closer.
* Gets the font sizes a bit more consistent with how it looks like other browsers.
* IE8 doesn't support SVGs, so it's using the fallback styles for some of the icons. The fallbacks are limited to the absolutely necessary icons - so there is one for the submenu dropdown toggle icon, but not for the little 'hamburger' and X that sit in front of the 'menu' button.

Props laurelfulford.

Fixes #38472.


git-svn-id: https://develop.svn.wordpress.org/trunk@38962 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 16:42:10 +00:00
Dominik Schilling (ocean90) 9e3f6d338b I18N: Introduce a locale-switching function.
With the introduction of user-specific languages in [38705] it's necessary to be able to switch translations on the fly. For example emails should be sent in the language of the recipient and not the one of the current user.

This introduces a new `WP_Locale_Switcher` class which is used for switching locales and translations. It holds the stack of locales whenever `switch_to_locale( $locale )` is called. With `restore_previous_locale()` you can restore the previous locale. `restore_current_locale()` empties the stack and sets the locale back to the initial value.

`switch_to_locale()` is added to most of core's email functions, either with the value of `get_locale()` (site language) or `get_user_locale()` (user language with fallback to site language).

Props yoavf, tfrommen, swissspidy, pbearne, ocean90.
See #29783.
Fixes #26511.

git-svn-id: https://develop.svn.wordpress.org/trunk@38961 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 15:35:58 +00:00
Boone Gorges a6a15b1819 REST API: Use term-specific caps for permission checks in term update and delete endpoints.
See #38505.

git-svn-id: https://develop.svn.wordpress.org/trunk@38960 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 14:51:54 +00:00
Sergey Biryukov 509a314de8 Comments: In `comment_form()`, bail early if comments for the post are closed.
Props jipmoors.
Fixes #38514.

git-svn-id: https://develop.svn.wordpress.org/trunk@38959 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 14:47:09 +00:00
John Blackbourn 573912fcfd Administration: Standardise the docblocks for the `handle_bulk_actions-*` filters.
Props ericlewis, Veraxus
Fixes #16031


git-svn-id: https://develop.svn.wordpress.org/trunk@38958 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 14:44:57 +00:00
John Blackbourn df8b6cf282 Administration: Switch to `handle_network_bulk_actions-{$screen}` for the bulk listing screen actions in the network admin area.
Props ericlewis, Veraxus
See #16031


git-svn-id: https://develop.svn.wordpress.org/trunk@38957 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 14:36:06 +00:00
John Blackbourn 0dff84ad23 Formatting: Don't overwrite the status header for Ajax responses that use output buffering or otherwise set their headers early.
Fixes #35666


git-svn-id: https://develop.svn.wordpress.org/trunk@38956 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 14:31:33 +00:00
Dominik Schilling (ocean90) 368d6ba190 I18N: Add `$user_id` argument to `get_user_locale()`.
This allows to retrieve the locale of any user with the additional fallback to the site locale.

Fixes #38512.
See #29783, #26511.

git-svn-id: https://develop.svn.wordpress.org/trunk@38955 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 14:14:44 +00:00
Rachel Baker 3e3ac4d727 REST API: Add constructor to the `WP_REST_Settings_Controller` class.
Provides consistency with the other API endpoint controller classes.

Props Soean.
Fixes #38429.

git-svn-id: https://develop.svn.wordpress.org/trunk@38954 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 13:44:37 +00:00
Sergey Biryukov 4f033e5487 I18N: Allow for WordPress Plugin Directory URL in plugin details modal to be localized.
Props Soean.
Fixes #38495. See #37501.

git-svn-id: https://develop.svn.wordpress.org/trunk@38953 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 12:16:14 +00:00
Dominik Schilling (ocean90) 36e260f1b5 About Page: Use `get_user_language()` for the video subtitles.
Rename `$locale` to `$lang_code` to avoid stomping of the global `$locale`.

See #38485.

git-svn-id: https://develop.svn.wordpress.org/trunk@38952 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 12:10:35 +00:00
Pascal Birchler a9516abb54 Posts, Post Types: Add support for post type templates.
WordPress has supported custom page templates for over 12 years, allowing developers to create various layouts for specific pages.
While this feature is very helpful, it has always been limited to the 'page' post type and not was not available to other post types.

By opening up the page template functionality to all post types, we continue to improve the template hierarchy's flexibility.

In addition to the `Template Name` file header, the post types supported by a template can be specified using `Template Post Type: post, foo, bar`.
When at least one template exists for a post type, the 'Post Attributes' meta box will be displayed in the back end, without the need to add post type support for `'page-attributes'`. 'Post Attributes' can be customized per post type using the `'attributes'` label when registering a post type.

Props johnbillion, Mte90, dipesh.kakadiya, swissspidy.
Fixes #18375.

git-svn-id: https://develop.svn.wordpress.org/trunk@38951 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 08:06:43 +00:00
Konstantin Kovshenin ee14487043 Tests: Use correct arguments for `wp_newComment` XML-RPC method.
Fixes #38454
Props markoheijnen


git-svn-id: https://develop.svn.wordpress.org/trunk@38950 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 07:51:41 +00:00
Mike Schroder 35e6dbe14f Media: Add support for rendering PDF thumbnails.
When support for PDFs is available, on upload,
render 'Thumbnail', 'Medium', 'Large', and 'Full' sizes of
the first page, and save them in attachment meta.

Use these renders within Add Media, Media Gallery and List views,
Attachment Details, Post/Attachment Edit screens, and Attachment pages.

Support available by default via Imagick -> ImageMagick -> Ghostscript,
but can be provided by any `WP_Image_Editor` that supports PDFs.

Props adamsilverstein, azaozz, celloexpressions, desrosj, dglingren, ericlewis, ipstenu, joemcgill, joyously, markoheijnen, melchoyce, mikeschroder, tomauger.
Fixes #31050.

git-svn-id: https://develop.svn.wordpress.org/trunk@38949 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 07:27:51 +00:00
Weston Ruter 16bfeb6608 Customize: Improve custom background properties UI.
Introduces new control for managing the background position. Adds control for setting the `background-size`.

Props cdog, celloexpressions, grapplerulrich, MikeHansenMe, FolioVision, afercia, helen, melchoyce, karmatosed, westonruter, Kelderic, sebastian.pisula.
Fixes #22058.


git-svn-id: https://develop.svn.wordpress.org/trunk@38948 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 06:51:11 +00:00
Gary Pendergast 84d9dcb1e6 REST API: Deprecate the `rest_enabled` filter.
As the REST API becomes more integral to WordPress Core, turning it off will cause a... suboptimal experience. If we don't want it to be turned off, the off switch needs to be removed.

Props jorbin, pento.
Fixes #38446.



git-svn-id: https://develop.svn.wordpress.org/trunk@38947 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 06:27:04 +00:00
Andrew Ozz 9b8697aea3 TinyMCE: revert removing the numbers (2-6) after the headings in the drop-down. Seems it causes more confusion.
See #27159.

git-svn-id: https://develop.svn.wordpress.org/trunk@38946 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 06:15:54 +00:00
Gary Pendergast 17477665c1 Tests: Fix some query typos introduced in [38940].
Props piewp for the catch.
See #35272.



git-svn-id: https://develop.svn.wordpress.org/trunk@38945 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 05:48:58 +00:00
Gary Pendergast 85eb52669d General: Add a `sanitize_textarea_field()` function.
Like its predecessor (`sanitize_text_field()`), `sanitize_textarea_field()` is a helper function to sanitise user input. As the name suggests, this function is for sanitising input from `textarea` fields - it strips tags and invalid UTF-8 characters, like `sanitize_text_field()`, but retains newlines and extra inline whitespace.

Props ottok, nbachiyski, chriscct7, pento.
Fixes #32257.



git-svn-id: https://develop.svn.wordpress.org/trunk@38944 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 05:16:09 +00:00
Jeremy Felt e06b7111e5 Multisite: Replace `get_blog_details()` in inline documentation.
Some documentation is now out of date and some can be replaced with a mention of `get_site()`.

Fixes #37102.


git-svn-id: https://develop.svn.wordpress.org/trunk@38943 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 03:38:48 +00:00
Rachel Baker 2b12294a0a REST API: Add missing sanitization callback for the `hide_empty` parameter of the Terms Controller.
Fixes a bug where the boolean parameter `hide_empty` was not being properly sanitized in the Terms controller.

Props websupporter.
Fixes #38465.

git-svn-id: https://develop.svn.wordpress.org/trunk@38942 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 02:28:13 +00:00
Boone Gorges 8a883144b6 Tests: Share fixtures in term endpoint tests.
See #30017.

git-svn-id: https://develop.svn.wordpress.org/trunk@38941 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 01:59:00 +00:00
Gary Pendergast bfce3fda86 Menus: Add the `menu-item-home` class to the static front page item.
When a site is using a static front page, and that page is in a menu, it isn't given the CSS class `menu-item-home`, contrary to the developer documentation.

An incorrect solution was originally added in [35272], and is now gone. Let us never speak of it again.

Props mdgl, adamsilverstein, welcher, pento.
Fixes #35272.



git-svn-id: https://develop.svn.wordpress.org/trunk@38940 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 01:57:57 +00:00
Andrew Ozz 3af74dfcbb TinyMCE: remove the numbers (2-6) after the headings in the drop-down. These are previews for the actual styling of headings in the editor.
See #27159.

git-svn-id: https://develop.svn.wordpress.org/trunk@38939 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 01:41:46 +00:00
John Blackbourn 307ba51640 Build/Test Tools: Continue eliminating randomness in tests.
See #37371


git-svn-id: https://develop.svn.wordpress.org/trunk@38938 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 01:23:24 +00:00
Andrew Ozz 1f49a4c0cf TinyMCE: adjust the shortcuts position and font size in the Formats drop-down to better match the shortcuts in the buttons tooltips.
See #38063.

git-svn-id: https://develop.svn.wordpress.org/trunk@38937 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-26 00:36:05 +00:00
Jeremy Felt 1515813dd4 Multisite: Deprecate the `blog_details` filter.
`get_site()` has replaced `get_blog_details()` throughout core and is the recommended way to retrieve a current or single site object.

The `blog_details` filter is applied when full details are requested from `get_blog_details()`.

To ensure backwards compatibility in the switch to `get_site()`, this `blog_details` filter is now applied in `WP_Site::get_details()` and marked as deprecated with a note to rely instead on the `site_details` filter introduced in 4.6.

Props flixos90.
See #37102.
Fixes #38491.


git-svn-id: https://develop.svn.wordpress.org/trunk@38936 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 23:43:01 +00:00
Jeremy Felt b6969df877 Multisite: Use `get_site()` in tests where `get_blog_details()` is not tested.
Remaining tests either rely on the `blog-details` cache key or test `get_blog_details()` itself.

Props flixos90.
Fixes #38497.


git-svn-id: https://develop.svn.wordpress.org/trunk@38935 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 23:03:15 +00:00
Jeremy Felt 6f1ed31931 Multisite: Replace `get_blog_details()` in `wp_xmlrpc_server::_multisite_getUsersBlogs()`.
Use `get_site()` instead.

Props flixos90.
Fixes #38350.


git-svn-id: https://develop.svn.wordpress.org/trunk@38934 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 22:53:44 +00:00
Weston Ruter c6d8d79f15 Customize: Add explanatory note for `custom_css` control via `textarea[placeholder]` and expose any defined `input_attrs` on such `textarea` controls.
Props melchoyce, westonruter, celloexpressions.
See #37439.
Fixes #38493.


git-svn-id: https://develop.svn.wordpress.org/trunk@38933 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 22:50:39 +00:00
Andrew Ozz 7f8003e6ea TinyMCE: remove and rearrange some of the editor buttons to improve user experience.
Props hugobaeta, melchoyce, celloexpressions, mor10, iseulde, mrwweb.
See #27159.

git-svn-id: https://develop.svn.wordpress.org/trunk@38932 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 22:50:21 +00:00
Weston Ruter 5de6c7927d Customize: Add hue-only mode to color picker.
The color control in the customizer can use the new mode by supplying the `mode` param with `hue` (as opposed to the new default `full` value). New control replaces the `range` control in Twenty Seventeen for `colorscheme_hue`. The `wpColorPicker` can opt for hue-only mode via supplying `hue` as the `type` option. Iris Color Picker is updated from v1.0.7 to v1.1.0-beta.

Props mattwiebe, celloexpressions.
Fixes #38263.


git-svn-id: https://develop.svn.wordpress.org/trunk@38931 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 22:32:55 +00:00
Dominik Schilling (ocean90) 4cfb962850 Tests: Update language files to include a `Language` header.
See #26511.

git-svn-id: https://develop.svn.wordpress.org/trunk@38930 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 22:25:08 +00:00
John Blackbourn 895203b3e4 Feeds: Don't attempt to generate RSS feeds for invalid feed URLs such as `wp-content/feed`.
Props stevenkword, JRGould, lyubomir_popov, johnbillion
Fixes #30210


git-svn-id: https://develop.svn.wordpress.org/trunk@38929 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 21:53:22 +00:00
Dominik Schilling (ocean90) ad25902a65 General: Introduce a `wp_list_sort()` helper function, v2.
In addition to `wp_list_filter()` for filtering a list of objects, and `wp_list_pluck()` for plucking a certain field out of each object in a list, this new function can be used for sorting a list of objects by specific fields. These functions are now all contained within the new `WP_List_Util()` class and `wp_list_sort()` is used in various parts of core for sorting lists.

This was previously committed in [38859] but got reverted in [38862] and [38863]. To fix the previous issues, `wp_list_sort()` supports now an additional argument to preserve array keys via `uasort()`.

Props flixos90, DrewAPicture, jorbin.
Fixes #37128.

git-svn-id: https://develop.svn.wordpress.org/trunk@38928 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 21:25:25 +00:00
John Blackbourn 0c14ff0574 Feeds: Greatly reduce the number of dummy posts that are generated for the Atom tests, following on from [38924].
See #35160


git-svn-id: https://develop.svn.wordpress.org/trunk@38927 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 20:58:13 +00:00