Commit Graph

35527 Commits

Author SHA1 Message Date
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
Weston Ruter
87e7c0cd96 Customize: Fix logic inversion in determining whether a URL is previewable which prevented previewing anything but homepage.
Fixes regression introduced in [38890].

See #38409.
Fixes #38492.


git-svn-id: https://develop.svn.wordpress.org/trunk@38926 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 20:52:58 +00:00
Rachel Baker
ea3b41d8e3 Feeds: Always return a valid timestamp for the Last-Modified header of comment or post feeds.
Fixes bug where an invalid Last-Modified value would be returned in feed requests for sites that had 0 items to return. Comment or post feeds will now return the current timestamp as the Last-Modified header value.  Example: a request for the comments feed for a site without any comments.

Replaced use of the local static variable `$cache_lastcommentmodified` to store the modified date in `get_lastcommentmodified()` with the Object Cache API.  The `get_lastcommentmodified()` function returns early if there is a cached value and returns `false` if there where no comments found. Introduced `_clear_modified_cache_on_transition_comment_status()` to flush the `lastcommentmodified` cache key when a comment enters or leaves approval status. In `get_lastpostmodified()` return early if there is a cached value and return `false` if there are no posts found.

Props swissspidy, rachelbaker, dllh, leobaiano.
Fixes #38027.

git-svn-id: https://develop.svn.wordpress.org/trunk@38925 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 20:47:06 +00:00
John Blackbourn
2a4558a312 Feeds: Greatly reduce the number of dummy posts that are generated for the RSS2 tests. This speeds the tests up.
See #35160, #30210


git-svn-id: https://develop.svn.wordpress.org/trunk@38924 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 20:16:58 +00:00
Dominik Schilling (ocean90)
ade972bf86 Embeds: Realign the provider list after [38693].
See #38003.

git-svn-id: https://develop.svn.wordpress.org/trunk@38923 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 20:15:45 +00:00
Dominik Schilling (ocean90)
fe100549a7 Upgrade: Realign $_new_bundled_files after [38921].
git-svn-id: https://develop.svn.wordpress.org/trunk@38922 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 20:02:39 +00:00
Dominik Schilling (ocean90)
95fb8d8221 Upgrade: Add Twenty Seventeen to $_new_bundled_files.
This indicates that Twenty Seventeen should be installed with a WordPress upgrade.

See #38372.

git-svn-id: https://develop.svn.wordpress.org/trunk@38921 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 20:01:22 +00:00
Dominik Schilling (ocean90)
425589e77f Nav Menus: Update help text to include the two latest default themes, Twenty Sixteen and Twenty Seventeen.
See #38372.

git-svn-id: https://develop.svn.wordpress.org/trunk@38920 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 20:00:19 +00:00
Dominik Schilling (ocean90)
1f1a105820 Install: Update sidebars_widgets option for Twenty Seventeen to match its three sidebars.
See #38372.

git-svn-id: https://develop.svn.wordpress.org/trunk@38919 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 19:59:31 +00:00
David A. Kennedy
988e2d03b4 Twenty Seventeen: Refresh color patterns for changes in style.css
This brings the custom colors CSS in line with the stylesheet. Some selectors were missing since many changes occurred in `style.css` a few days before the original merge to Core.

Props celloexpressions, laurelfulford.

Fixes #38389.


git-svn-id: https://develop.svn.wordpress.org/trunk@38918 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 19:59:11 +00:00
Jeremy Felt
13e2780b59 REST API: Adjust test_get_items_invalid_status_param_is_discarded() after [38911].
Previously, if an invalid post status was assigned to a media object, the object would be returned with an unchanged status. After [38911], an error response is returned.

The assertion in test_get_items_invalid_status_param_is_discarded() needs to be updated to account for the expected error response. The test name has been changed to `test_get_items_invalid_status_param_is_error_response()`.

Fixes #38417.


git-svn-id: https://develop.svn.wordpress.org/trunk@38917 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 19:33:34 +00:00
Jeremy Felt
1c034393f0 Options: Make $passed_default available in remaining default_option_{$option} filter.
Pass `false` as the `$passed_default` value when the `default_option_{$option}` filter is applied in `update_option` as no default is ever passed.

This resolves an error in tests where the 3rd parameter is not available to `filter_default_option()`.

Fixes #38176.


git-svn-id: https://develop.svn.wordpress.org/trunk@38916 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 19:22:32 +00:00
Jeremy Felt
9543b9e259 Multisite: Replace get_blog_details() in wp-includes/ms-blogs.php with get_site().
Props flixos90.
See #37102.
Fixes #38351.


git-svn-id: https://develop.svn.wordpress.org/trunk@38915 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 18:49:03 +00:00
Jeremy Felt
148d7790d7 Multisite: Replace get_blog_details() in get_active_blog_for_user() with get_site().
Props flixos90.
Fixes #38355.


git-svn-id: https://develop.svn.wordpress.org/trunk@38914 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 18:05:20 +00:00
Jeremy Felt
764a31aaa9 Multisite: Introduce tests for get_active_blog_for_user().
Props flixos90.
See #38355.


git-svn-id: https://develop.svn.wordpress.org/trunk@38913 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 18:02:08 +00:00
Andrea Fercia
590a7de43b Menus: Improve the HTML semantics of the "Menu Settings" section.
- removes the previous markup based on a definition list
- groups checkboxes in `fieldset` elements with a `legend`
- simplifies the CSS lowering selectors specificity

Props xavortm.

Fixes #38023.


git-svn-id: https://develop.svn.wordpress.org/trunk@38912 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 17:28:40 +00:00
Joe Hoyle
6d8e277152 REST API: Validate posts status enum
Currently we are using a different validate callback, so the `enum` is not interpretted. We just have to fallback to the result of `rest_validate_request_arg` in our custom wrapper function.

Fixes #38417.


git-svn-id: https://develop.svn.wordpress.org/trunk@38911 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 17:12:18 +00:00
Joe Hoyle
57aec4798f Options: Add 'default' to register_setting
Add a `default` argument to `register_setting` that will be used an the default option value viet `get_option()` in the event of no other option being specified. This means (if chosen) developers can define their default once via `register_option` and not have to duplicate the value every time they make a call to `get_option()`.

Props rmccue, jorbin, jtsternberg.
Fixes #38176.


git-svn-id: https://develop.svn.wordpress.org/trunk@38910 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 17:07:20 +00:00
Tammie Lister
c388ff84ee Twenty Seventeen: Display scroll down arrow when no menu
This improves scrollability without a menu.

Props nnaimov, melchoyce, davidakennedy
Fixes #38392



git-svn-id: https://develop.svn.wordpress.org/trunk@38909 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 16:50:49 +00:00
Gary Pendergast
94201ff1f5 Tests: Fix a PHP notice introduced in [38907].
`WP_DEFAULT_THEME` was being defined in the wrong location.

Also, if WordPress has the original "default" theme installed, ensure that our test theme overrides it.

Props swissspidy for daring to dive into Themes of WordPress Past.
See #31550, #38457.



git-svn-id: https://develop.svn.wordpress.org/trunk@38908 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 11:05:17 +00:00
Gary Pendergast
ee65fc1f80 Tests: Use a minimal theme for tests.
This functionality was originally added in [38858], using `symlink()` to put a link to the theme in WordPress' `themes` directory. Unfortunately, not all installs have write access to the `themes` directory, causing unit tests to fail.

The new method is to add the test theme directory to `$wp_theme_directories`, and fix the handful of tests that don't expect `$wp_theme_directories` to have multiple entries.

The test install/bootstrap routines now also check that `WP_DEFAULT_THEME` is defined, in case the tests are being run on a system that hasn't upgraded its' `wp-tests-config.php`.

See #31550.
Fixes #38457.



git-svn-id: https://develop.svn.wordpress.org/trunk@38907 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 10:24:57 +00:00
Weston Ruter
4e8410a886 Customize: Allow page stubs to be created via dropdown-pages controls in the Static Front Page section.
This ability was previously added to nav menus via the available page items panel. The "Add New Page" button only appears when the `allow_addition` control param is supplied as `true`. Code is adapted from the Customize Posts feature plugin.

Props celloexpressions, westonruter.
See #38013, #34923.
Fixes #38164.


git-svn-id: https://develop.svn.wordpress.org/trunk@38906 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 06:30:27 +00:00
jeremyfelt
32fce2093c Multisite: Replace get_blog_details() with get_site() in is_user_member_of_blog().
Props flixos90.
Fixes #38358.


git-svn-id: https://develop.svn.wordpress.org/trunk@38905 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 06:01:03 +00:00
Jeremy Felt
0b0a009bfc Multisite: Replace get_blog_details() in ms_site_check() with get_site().
Props flixos90.
Fixes #38357.


git-svn-id: https://develop.svn.wordpress.org/trunk@38904 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 05:54:19 +00:00
Jeremy Felt
701dbe4271 Multisite: Replace get_blog_details() in add_user_to_blog() with get_site().
Adds tests for `add_user_to_blog()`.

Props flixos90.
Fixes #38356.


git-svn-id: https://develop.svn.wordpress.org/trunk@38903 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 05:48:22 +00:00
Jeremy Felt
9ae33a3be4 Multisite: Replace get_blog_details() with get_site() in get_dashboard_blog().
Props dipesh.kakadiya.
Fixes #38353.


git-svn-id: https://develop.svn.wordpress.org/trunk@38902 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 05:04:37 +00:00
Weston Ruter
e6425b0735 Customize: Prevent absent site icon link from outputting an empty string as href in customizer; use /favicon.ico as fallback.
An empty string causes some browsers to use the current URL as the `href`. When using `history.replaceState()` Chrome will re-fetch the favicon with each call, meaning that `customize.php` gets hit with wasted requests which tax the server.

Fixes #38377.


git-svn-id: https://develop.svn.wordpress.org/trunk@38901 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 04:46:36 +00:00
Weston Ruter
31156b0bfb Customize: Skip attaching expansion event handlers to section containers with the cannot-expand class.
Props kkoppenhaver, celloexpressions.
Fixes #37980.


git-svn-id: https://develop.svn.wordpress.org/trunk@38900 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 04:36:00 +00:00