Commit Graph

324 Commits

Author SHA1 Message Date
Sergey Biryukov
e8c4b8c8e7 Docs: Add an entry for $pagenow global in WP_Customize_Manager::setup_theme().
Props mt8.biz.
Fixes #40297.
Built from https://develop.svn.wordpress.org/trunk@40349


git-svn-id: http://core.svn.wordpress.org/trunk@40256 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-29 11:41:46 +00:00
Weston Ruter
85b4cddebf Customize: Extend auto-draft life of a customize_changeset post whenever modified.
Keep bumping the date for the auto-draft to preserve it from garbage-collection via `wp_delete_auto_drafts()` after 7 days.

See #30937.
Fixes #39713.

Built from https://develop.svn.wordpress.org/trunk@40041


git-svn-id: http://core.svn.wordpress.org/trunk@39978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-05 06:39:41 +00:00
Weston Ruter
a44f8db73d Customize: Always enqueue customize-preview stylesheet in the customizer preview to style selective refresh and visual edit shortcuts.
Enqueues the style along with the `customize-preview` script in the manager instead of via the `widgets` and `nav_menus` components, ensuring that the stylesheet is loaded for users who cannot manage widgets or nav menus.

Props dlh.
See #27403.
Fixes #39498.

Built from https://develop.svn.wordpress.org/trunk@39951


git-svn-id: http://core.svn.wordpress.org/trunk@39888 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-26 03:47:41 +00:00
Weston Ruter
3e6c892f89 Customize: Allow custom post types to be used in starter content.
Changes `WP_Customize_Nav_Menus::insert_auto_draft_post()` so it can be invoked for a `post_type` that is not registered (yet).

See #38615, #38114.
Fixes #39610.

Built from https://develop.svn.wordpress.org/trunk@39924


git-svn-id: http://core.svn.wordpress.org/trunk@39861 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-19 00:01:46 +00:00
Dion Hulse
9f381dbea6 Customizer: Don't query for postmeta for Custom CSS (for not-current-themes) and Customizer Changeset posts.
Props dlh.
Fixes #39194.

Built from https://develop.svn.wordpress.org/trunk@39692


git-svn-id: http://core.svn.wordpress.org/trunk@39632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-05 08:12:42 +00:00
Weston Ruter
a366e58135 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.

Built from https://develop.svn.wordpress.org/trunk@39560


git-svn-id: http://core.svn.wordpress.org/trunk@39500 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-10 07:00:45 +00:00
Weston Ruter
c68f1de5f8 Customize: Use selected user language for edit shortcuts in preview instead of site language.
Props ocean90.
Fixes #39009.

Built from https://develop.svn.wordpress.org/trunk@39545


git-svn-id: http://core.svn.wordpress.org/trunk@39485 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-08 19:32:59 +00:00
Weston Ruter
3b37903106 Customize: Defer populating post_name for auto-draft posts in customized state until posts are published.
The ultimate `post_name` is stored in postmeta until the post is published. The `get_page_by_path()` function does not exclude `auto-draft` posts. Revert changes to `wp_unique_post_slug()` from [39411] which excluded `auto-draft` posts.

Props westonruter, dlh for testing, helen for testing.
See #38114, #38928.
Fixes #39078.

Built from https://develop.svn.wordpress.org/trunk@39506


git-svn-id: http://core.svn.wordpress.org/trunk@39446 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-05 19:33:42 +00:00
Weston Ruter
c9b8a5dbbb Customize: Ensure textarea for Custom CSS displays as code (in LTR) when an RTL language is active.
See #35395.
Fixes #39085.

Built from https://develop.svn.wordpress.org/trunk@39499


git-svn-id: http://core.svn.wordpress.org/trunk@39439 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-05 13:55:42 +00:00
Helen Hou-Sandí
a5e9954f1d Custom CSS: Change the help link to something better for users.
fixes #39015.

Built from https://develop.svn.wordpress.org/trunk@39466


git-svn-id: http://core.svn.wordpress.org/trunk@39406 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-03 05:11:42 +00:00
Weston Ruter
01fe6a2fac Customize: Fix posts limit query arg for WP_Query from incorrect number to posts_per_page.
Props dlh.
Fixes #39022.

Built from https://develop.svn.wordpress.org/trunk@39434


git-svn-id: http://core.svn.wordpress.org/trunk@39374 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-02 16:18:43 +00:00
Weston Ruter
71d5ba249b Customize: Reuse existing non-auto-draft posts and existing auto-draft posts in the customized state with matching slugs when applying starter content.
* Updates `wp_unique_post_slug()` to ignore `auto-draft` posts. Prevents publishing multiple posts that have the same slugs from starter content.
* Fixes fatal error when attempting to save an header_image setting from a non-admin context.
* Fixes substituting attachment symbols in options and theme mods.
* Fixes applying starter content for header images and background images.

See #38114.
Fixes #38928.

Built from https://develop.svn.wordpress.org/trunk@39411


git-svn-id: http://core.svn.wordpress.org/trunk@39351 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-02 00:25:41 +00:00
Weston Ruter
5e7d9a49fd Customize: Reject a changeset update when a non-future date is provided and also ensure that a published changeset always gets set to the current date/time.
* Also moves checks from `customize_save` Ajax handler to the underlying `WP_Customize_Manager::save_changeset_post()` call which plugins may invoke directly.
* Ensures that `customize_save_response` filter is always passed an array, with error code available as `code`.

Props utkarshpatel, westonruter, sayedwp.
See #30937.
Fixes #38943.

Built from https://develop.svn.wordpress.org/trunk@39409


git-svn-id: http://core.svn.wordpress.org/trunk@39349 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-02 00:02:44 +00:00
Helen Hou-Sandí
70fc99e323 Theme starter content: Add support for featured images and page templates.
Featured image support means that attachments can now be imported. Media can be sideloaded from within theme or plugin directories. Like other posts, attachments are auto-drafts until customizer changes are published, and are not duplicated when they already exist in the customized state. Attachment IDs can be used for any number of purposes, much like post IDs. Twenty Seventeen now includes 3 images used as featured images to best showcase the multi-section homepage setup.

As featured image IDs are stored in post meta, it also made sense to add support for page templates. Twenty Seventeen does not include any such templates, but the functionality can be quite important for displaying themes to their best effect.

props westonruter, helen, flixos90.
fixes #38615.

Built from https://develop.svn.wordpress.org/trunk@39346


git-svn-id: http://core.svn.wordpress.org/trunk@39286 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-23 09:53:33 +00:00
Weston Ruter
6b5d960453 Customize: Clean up docs and code style for customize changes in 4.7.
* Adds missing `resolve`/`fail` for promise returned by `loadThemePreview`.
* Adds missing jsdoc blocks and tags.
* Adds missing phpdoc and makes corrections.

See #37770.
Fixes #38908.

Built from https://develop.svn.wordpress.org/trunk@39345


git-svn-id: http://core.svn.wordpress.org/trunk@39285 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-23 06:05:32 +00:00
Weston Ruter
3284f9a989 Customize: Remove iframe-specific behaviors from customize preview when previewing on frontend and not contained inside iframe.
* Strip out `customize_messenger_channel` from preview window URL when not contained in iframe.
* Allow interacting with unpreviewable links and forms when previewing customized state on frontend.

See #30937.
Fixes #38867.

Built from https://develop.svn.wordpress.org/trunk@39332


git-svn-id: http://core.svn.wordpress.org/trunk@39272 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-21 16:56:30 +00:00
Weston Ruter
3c7e23297e Customize: Ensure that WP_Customize_Manager::save_changeset_post() returns setting_validities even for supplied values that are unchanged from values in changeset.
Check setting existence and authorization via `WP_Customize_Manager::validate_setting_values()` even for `null` values to account for custom params being added to settings, preventing failures from being silently ignored.

See #38705, #30937.
Fixes #38865.

Built from https://develop.svn.wordpress.org/trunk@39320


git-svn-id: http://core.svn.wordpress.org/trunk@39260 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-19 22:39:33 +00:00
Weston Ruter
2cabe7aef1 Customize: Add unit tests for importing theme starter content.
Props welcher, westonruter.
See #38114, #38533, #38615.
Fixes #38540.

Built from https://develop.svn.wordpress.org/trunk@39276


git-svn-id: http://core.svn.wordpress.org/trunk@39216 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-17 08:18:32 +00:00
Joe McGill
5ef714db18 Themes: Improve a11y and extendability of custom video headers.
This adds play/pause controls to video headers, along with voice
assistance, using `wp.a11y.speak`, to make custom video headers more
accessible. To make styling the play/pause button easier for themes,
CSS has been omitted from the default implementation.

This also includes a refactor of the `wp.customHeader` code to introduce
a `BaseHandler` class, which can be extended by plugins and themes to modify
or enhance the default video handlers.

Props davidakennedy, afercia, bradyvercher, joemcgill, adamsilverstein, rianrietveld.
Fixes #38678.
Built from https://develop.svn.wordpress.org/trunk@39272


git-svn-id: http://core.svn.wordpress.org/trunk@39212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-16 23:26:31 +00:00
Weston Ruter
7db38b916a Customize: Allow URL for Codex link in Additional CSS section to be translated.
Props odysseygate, ocean90, westonruter.
See #35395.
Fixes #38823.

Built from https://develop.svn.wordpress.org/trunk@39268


git-svn-id: http://core.svn.wordpress.org/trunk@39208 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-16 18:42:32 +00:00
Sergey Biryukov
ec0043c279 I18N: Remove <code> tags from translatable strings in wp-includes/class-wp-customize-manager.php.
Props ramiy.
Fixes #38802.
Built from https://develop.svn.wordpress.org/trunk@39254


git-svn-id: http://core.svn.wordpress.org/trunk@39194 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-15 20:54:30 +00:00
Weston Ruter
8efc416f64 Customize: Allow starter content to apply in a new theme when switching from another theme containing changes.
* Ensure that starter content can apply from theme B after previewing starter content in theme A.
* Introduce new `starter_content` flag in changeset setting params which is used to capture whether a value is starter content and thus can be overridden.
* Create changeset up-front with `starter_content` flags instead of waiting for `AUTOSAVE_INTERVAL`.
* Eliminate instantiation of settings for widget instances in favor of directly calling `sanitize_widget_js_instance`. This eliminates issues with looking for widgets before they are registered.
* Ensure that non-placeholders (inline arrays instead of string references) can be supplied in starter content.
* Re-use auto-draft posts as starter content across theme switches.
* Introduce `starter_content` param for `WP_Customize_Manager::save_changeset_post()` which is `false` except when starter content is being loaded on a `fresh_site`.

See #38114.
Fixes #38541.

Built from https://develop.svn.wordpress.org/trunk@39241


git-svn-id: http://core.svn.wordpress.org/trunk@39181 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-15 09:03:32 +00:00
Peter Wilson
11998b4169 Themes: Remove front page restriction from video header functions.
Adds a callback for determining when video headers should be displayed in themes supporting custom headers. By default, video headers are only displayed on the front page of a site.

Theme authors may set a custom callback by passing `'video-active-callback' => 'mytheme_video_active_callback'` as an argument. The default callback is `is_front_page()`.

This introduces the new function `is_header_video_active()` - returns `true` on pages that should display video headers. The return value can be filtered using the new filter of the same name.

Props flixos90, bradyvercher, peterwilsoncc, joemcgill.
Fixes #38738.

Built from https://develop.svn.wordpress.org/trunk@39240


git-svn-id: http://core.svn.wordpress.org/trunk@39180 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-15 07:16:33 +00:00
Weston Ruter
de0835dead Customize: Only show video header controls if previewing front page; show explanatory notice when controls are hidden.
Also include todo for the `header_video` control's `button_labels`. See #38796.

Props westonruter, joemcgill, celloexpressions.
Fixes #38778.

Built from https://develop.svn.wordpress.org/trunk@39237


git-svn-id: http://core.svn.wordpress.org/trunk@39177 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-15 03:47:30 +00:00
Weston Ruter
8e6753cead Customize: Use video-specific labels for buttons in Header Video media control.
See #38172.

Built from https://develop.svn.wordpress.org/trunk@39234


git-svn-id: http://core.svn.wordpress.org/trunk@39174 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-15 00:22:30 +00:00
Weston Ruter
dfbcdae985 Customize: Use selective refresh for custom header changes when possible.
* Use `postMessage` transport for header image settings by default when video headers are supported, and thus `the_custom_header_markup()` will necessarily be used (and thus a selective refresh partial will be available).
* Ensure that `the_custom_header_markup()` always outputs a container element in the customizer preview even if the header is empty.
* Ensure that edit shortcut appearing for custom header does not get positioned off-screen.

Props bradyvercher, westonruter.
See #38639.
Fixes #38737.

Built from https://develop.svn.wordpress.org/trunk@39227


git-svn-id: http://core.svn.wordpress.org/trunk@39167 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-14 18:41:32 +00:00
Joe McGill
956818f5eb Customize: Rename "Header Visuals" to "Header Media".
"Header Visuals" is a bit vague since the title/tagline are arguably
also “header visuals”. "Header Media" is more descriptive and is
consistent with how we refer to images/videos throughout core.

Props bradyvercher.
Fixes #38756.
Built from https://develop.svn.wordpress.org/trunk@39205


git-svn-id: http://core.svn.wordpress.org/trunk@39145 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-11 23:24:30 +00:00
Weston Ruter
5b676af8ff Customize: Store modifying user ID with setting change written into changeset and restore current user when setting is being saved.
Restoring the current user context when saving a setting ensures filters apply as expected, such as Kses. When a user is not associated with a given setting change, continue to override `capability` to be `exist` when saving. Skip overwriting setting values in a changeset that have not changed, facilitating concurrent editing and amending a changeset by a user with fewer privileges.

See #30937.
Fixes #38705.

Built from https://develop.svn.wordpress.org/trunk@39181


git-svn-id: http://core.svn.wordpress.org/trunk@39121 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-09 07:03:30 +00:00
Weston Ruter
08712b4baa Customize: Rename unfiltered_css meta capability to edit_css; add revisions support to custom_css post type.
Props lukecavanagh, georgestephanis, westonruter.
See #38672, #35395.

Built from https://develop.svn.wordpress.org/trunk@39175


git-svn-id: http://core.svn.wordpress.org/trunk@39115 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-09 01:12:30 +00:00
Joe McGill
5704743a78 Themes: Remove Vimeo logic from header_video_settings().
Following [39148] and [39128], this removes the mime type logic for
Vimeo URLs from `get_header_video_settings()` and removes remaining
Vimeo reference from `_validate_external_header_video()` docs.

Fixes #38544.
Built from https://develop.svn.wordpress.org/trunk@39165


git-svn-id: http://core.svn.wordpress.org/trunk@39105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-08 19:20:32 +00:00
Weston Ruter
1363813c6b Customize: Move Custom CSS control placeholder help text to setting default value.
The `WP_Customize_Custom_CSS_Setting::value()` method now returns the `default` if `wp_get_custom_css()` returns empty.

Props westonruter, afercia, helen.
See #35395.
Fixes #38685.

Built from https://develop.svn.wordpress.org/trunk@39151


git-svn-id: http://core.svn.wordpress.org/trunk@39091 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-07 18:13:34 +00:00
Weston Ruter
5ea1e6fd80 Customize: Allow tab characters in custom CSS input.
Pressing `Esc` followed by `Tab` allows for tabbing to the next element.

Props afercia, coffee2code, westonruter.
See #35395.
Fixes #38667.

Built from https://develop.svn.wordpress.org/trunk@39149


git-svn-id: http://core.svn.wordpress.org/trunk@39089 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-06 19:09:33 +00:00
Joe McGill
68b4181985 Customize: Remove Vimeo validation for external videos.
Following [39128], this removes the validation logic for Vimeo URLs from
`_validate_external_header_video()` since WP does not support the
display of videos from Vimeo by default.

This also includes a change to using `esc_url_raw()` instead of `esc_url()`
on the URL value to avoid unexpected behavior from the inclusion of HTML
entities.

Props peterwilsoncc, westonruter.
Fixes #38544.
Built from https://develop.svn.wordpress.org/trunk@39148


git-svn-id: http://core.svn.wordpress.org/trunk@39088 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-05 18:32:35 +00:00
Helen Hou-Sandí
1281a28382 Customize: Revert theme install feature.
This is a great goal for core, and is close, but it is not in shape to be shipped for 4.7 and there is not enough time left in the development cycle to alter and polish sufficiently. There are bugs, but more than that, there are more fundamental questions around the use of existing UI, general UX, and how findable themes are (not) on the .org side.

see #37661.

Built from https://develop.svn.wordpress.org/trunk@39140


git-svn-id: http://core.svn.wordpress.org/trunk@39080 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-04 17:18:26 +00:00
Weston Ruter
6ccb29bee0 Customize: No-op edit_post_link() when in customizer preview.
Edit links can be restored in plugins by removing the `__return_empty_string` function from the `get_edit_post_link` filter at the `customize_preview_init` action.

Fixes #38648.

Built from https://develop.svn.wordpress.org/trunk@39133


git-svn-id: http://core.svn.wordpress.org/trunk@39073 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-04 17:14:56 +00:00
Joe McGill
50b2c6cf2c Customize: Remove Vimeo reference from description for external header videos.
Vimeo's API requires a Pro account to display videos as background videos
(i.e., without player controls), thus we shouldn't support Vimeo
URLs by default in custom header videos. This removes the reference of Vimeo
from the control description in the customizer.

Fixes #38544.
Built from https://develop.svn.wordpress.org/trunk@39128


git-svn-id: http://core.svn.wordpress.org/trunk@39068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-04 17:12:28 +00:00
Joe McGill
8fa49e77bd Themes: Improve support for placeholders in default headers.
When themes register default headers, they can use sprintf style placeholder
strings in place of the template directory URI, which WordPress transforms
in several places by running the value of
`get_theme_support( 'custom-header', 'default-image' )` through `sprintf()`.

This fixes a few places where WordPress skipped the `sprintf()` step and
referenced the `get_theme_support()` value directly.

Props bradyvercher for initial patch.
See #38557.
Built from https://develop.svn.wordpress.org/trunk@39123


git-svn-id: http://core.svn.wordpress.org/trunk@39063 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-04 17:10:01 +00:00
Weston Ruter
c0b41d8fee 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.

Built from https://develop.svn.wordpress.org/trunk@39100


git-svn-id: http://core.svn.wordpress.org/trunk@39042 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-03 00:00:32 +00:00
Weston Ruter
015cb27b87 Customize: Prevent auto-draft post/page stubs from being saved with empty slugs or published with non-unique slugs.
* Allow `WP_Customize_Nav_Menus::insert_auto_draft_post()` to take full post array to pass to `wp_insert_post()`, except for `post_status`. Require `post_title`. 
* Ensure empty `post_name` gets explicitly set to slugified `post_title`.
* Explicitly allow only `post_type` and `post_title` params in `WP_Customize_Nav_Menus::ajax_insert_auto_draft_post()`.
* Use `wp_update_post()` instead of `wp_publish_post()` to ensure unique slugs are assigned to published auto-draft posts.
* Re-use `WP_Customize_Nav_Menus::insert_auto_draft_post()` when inserting stubs from starter content.
 
See #38114, #38013, #34923.
Fixes #38539.

Built from https://develop.svn.wordpress.org/trunk@39038


git-svn-id: http://core.svn.wordpress.org/trunk@38980 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-30 20:21:33 +00:00
Weston Ruter
9da43bc2c8 Customize: Move Additional CSS section toward end of list by assigning priority higher than default.
Props Mista-Flo.
Fixes #38524.

Built from https://develop.svn.wordpress.org/trunk@39003


git-svn-id: http://core.svn.wordpress.org/trunk@38945 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-29 05:11:29 +00:00
Weston Ruter
75535c596b Customize: Introduce starter content and site freshness state.
A theme can opt-in for tailored starter content to apply to the customizer when previewing the theme on a fresh install, when `fresh_site` is at its initial `1` value. Starter content is staged in the customizer and does not go live unless the changes are published. Initial starter content is added to Twenty Seventeen.

* The `fresh_site` flag is cleared when a published post or page is saved, when widgets are modified, or when the customizer state is saved.
* Starter content is registered via `starter-content` theme support, where the argument is an array containing `widgets`, `posts`, `nav_menus`, `options`, and `theme_mods`. Posts/pages in starter content are created with the `auto-draft` status, re-using the page/post stubs feature added to nav menus and the static front page controls.
* A `get_theme_starter_content` filter allows for plugins to extend a theme's starter content.
* Starter content in themes can/should re-use existing starter content items in core by using named placeholders.
* Import theme starter content into customized state when fresh site.
* Prevent original_title differences from causing refreshes if title is present.
* Ensure nav menu item url is set according to object when previewing.
* Make sure initial saved state is false if there are dirty settings without an existing changeset.
* Ensure dirty settings are cleaned upon changeset publishing.

Props helen, westonruter, ocean90.
Fixes #38114, #38533.

Built from https://develop.svn.wordpress.org/trunk@38991


git-svn-id: http://core.svn.wordpress.org/trunk@38934 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-28 02:57:35 +00:00
Joe McGill
f9f6dd7958 Customizer: Fix name of a partial in export_header_video_settings()
Following [38985], this updates a check for partials being set in
`export_header_video_settings()` to use the correct name.

Props bradyvercher.
See #38172.
Built from https://develop.svn.wordpress.org/trunk@38989


git-svn-id: http://core.svn.wordpress.org/trunk@38932 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-28 01:51:31 +00:00
Joe McGill
030bc377dd Themes: Enable video in custom headers.
This adds the ability for themes to add support for videos in custom headers
by passing `'video' => true` as an argument when adding theme support for
custom headers.

Custom video headers are managed through the “Header Visuals” (i.e. “Header Image”)
panel in the Customizer where you can select a video from the media library or set a
URL to an external video (YouTube for now) for use in custom headers.

This introduces several new functions:

`has_header_video()` – Check whether a header video is set or not.
`get_header_video_url()` – Retrieve header video URL for custom header.
`the_header_video_url()` – Display header video URL.
`get_header_video_settings()` – Retrieve header video settings.
`has_custom_header()` – Check whether a custom header is set or not.
`get_custom_header_markup()` – Retrieve the markup for a custom header.
`the_custom_header_markup()` – Print the markup for a custom header.

And a new file, `wp-includes/js/wp-custom-header.js` that handles loading videos
in custom headers.

This also enables video headers in the Twenty Seventeen and Twenty Fourteen themes.

Props davidakennedy, celloexpressions, bradyvercher, laurelfulford, joemcgill.
Fixes #38172.
Built from https://develop.svn.wordpress.org/trunk@38985


git-svn-id: http://core.svn.wordpress.org/trunk@38928 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-27 21:51:31 +00:00
Weston Ruter
a86496aea4 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.

Built from https://develop.svn.wordpress.org/trunk@38948


git-svn-id: http://core.svn.wordpress.org/trunk@38891 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-26 06:52:29 +00:00
Weston Ruter
02ce8db6de 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.

Built from https://develop.svn.wordpress.org/trunk@38933


git-svn-id: http://core.svn.wordpress.org/trunk@38876 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-25 22:52:10 +00:00
Dominik Schilling
7cce73a634 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.
Built from https://develop.svn.wordpress.org/trunk@38928


git-svn-id: http://core.svn.wordpress.org/trunk@38871 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-25 21:26:32 +00:00
Weston Ruter
30a71555cb 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.

Built from https://develop.svn.wordpress.org/trunk@38906


git-svn-id: http://core.svn.wordpress.org/trunk@38849 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-25 06:31:31 +00:00
Weston Ruter
d93636bd11 Customize: Disable theme installation in multisite.
Props celloexpressions, iamfriendly.
Fixes #38370.

Built from https://develop.svn.wordpress.org/trunk@38887


git-svn-id: http://core.svn.wordpress.org/trunk@38830 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-24 18:17:39 +00:00
Weston Ruter
2e173f9e44 Customize: Revert part of [38859] which caused sections to get deactivated in the customizer.
See #37128.

Built from https://develop.svn.wordpress.org/trunk@38862


git-svn-id: http://core.svn.wordpress.org/trunk@38805 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-21 16:17:41 +00:00
Pascal Birchler
f54558e75b General: Introduce a wp_list_sort() helper function.
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.

Props flixos90, DrewAPicture, jorbin.
Fixes #37128.
Built from https://develop.svn.wordpress.org/trunk@38859


git-svn-id: http://core.svn.wordpress.org/trunk@38802 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-21 11:12:51 +00:00
Weston Ruter
1ccd9e7a6c Customize: Introduce custom CSS for extending theme styles.
* Custom CSS is associated with a given theme and is displayed in an inline `style` element at the `wp_head` hook after the `wp_print_styles` is called so that it overrides any enqueued stylesheets.
* A `wp_get_custom_css()` function is used for accessing the CSS associated with the current theme (or another theme) and a `wp_get_custom_css` filter for manipulating it.
* CSS is managed in customizer via a new "Additional CSS" section with a single `textarea` control. 
* `WP_Customize_Section::$description_hidden` is introduced for hiding extended descriptions in customizer sections behind a help toggle as done with panels.
* CSS is stored in a `custom_css` post type with the theme (stylesheet) slug as the `post_name`.
* `WP_Customize_Custom_CSS_Setting` is introduced to handle validation of CSS, previewing, and persisting the CSS to the `custom_css` post type.
* The `custom_css` setting is tied to a new `unfiltered_css` capability which maps to `unfiltered_html` by default.
* Escaping the message in the notification template is removed to allow markup (`code` tags) to be rendered.

See https://make.wordpress.org/core/2016/10/11/feature-proposal-better-theme-customizations-via-custom-css-with-live-previews/

Props johnregan3, celloexpressions, folletto, westonruter.
Fixes #35395.

Built from https://develop.svn.wordpress.org/trunk@38829


git-svn-id: http://core.svn.wordpress.org/trunk@38772 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-19 18:15:31 +00:00
Weston Ruter
1c3b96537f Customize: Introduce a new experience for discovering, installing, and previewing themes within the customizer.
Unify the theme-browsing and theme-customization experiences by introducing a comprehensive theme browser and installer directly accessible in the customizer. Replaces the customizer theme switcher with a full-screen panel for discovering/browsing and installing themes available on WordPress.org. Themes can now be installed and previewed directly in the customizer without entering the wp-admin context.

For details, see https://make.wordpress.org/core/2016/10/03/feature-proposal-a-new-experience-for-discovering-installing-and-previewing-themes-in-the-customizer/

Fixes #37661, #34843.
Props celloexpressions, folletto, westonruter, karmatosed, afercia.

Built from https://develop.svn.wordpress.org/trunk@38813


git-svn-id: http://core.svn.wordpress.org/trunk@38756 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-19 03:20:29 +00:00
Weston Ruter
f1ba1918c9 Customize: Implement customized state persistence with changesets.
Includes infrastructure developed in the Customize Snapshots feature plugin.

See https://make.wordpress.org/core/2016/10/12/customize-changesets-technical-design-decisions/

Props westonruter, valendesigns, utkarshpatel, stubgo, lgedeon, ocean90, ryankienstra, mihai2u, dlh, aaroncampbell, jonathanbardo, jorbin.
See #28721.
See #31089.
Fixes #30937.
Fixes #31517.
Fixes #30028.
Fixes #23225.
Fixes #34142.
Fixes #36485.

Built from https://develop.svn.wordpress.org/trunk@38810


git-svn-id: http://core.svn.wordpress.org/trunk@38753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-18 20:05:31 +00:00
Weston Ruter
28795e8dc2 Customize: Ensure customize_validate_{$setting->id} filters apply on input post values for WP_Customize_Setting subclasses that neglect to apply the filter themselves.
Fixes #37638.

Built from https://develop.svn.wordpress.org/trunk@38765


git-svn-id: http://core.svn.wordpress.org/trunk@38708 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-09 20:08:32 +00:00
Weston Ruter
76681c40e3 Customize: Opt to disable IE8 support via conditional comments instead of using unreliable Array.prototype.indexOf feature detection.
Deprecate/remove `WP_Customize_Manager::customize_preview_html5()` and remove `document.head` polyfill, both of which were only in place for IE8 support.

Props ryankienstra, westonruter.
Fixes #38021.

Built from https://develop.svn.wordpress.org/trunk@38649


git-svn-id: http://core.svn.wordpress.org/trunk@38592 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-25 04:35:32 +00:00
Weston Ruter
d84c343cc6 Customize: Let static_front_page section be contextually active based on whether there are any published pages.
If there are no pages when the customizer is opened, the `static_front_page` section will be hidden. As soon as a page is created in the customizer session, the `static_front_page` section will be revealed. Previously the section would not be registered if there were no pages. Page stubs created via nav menus will appear in the `dropdown-pages` controls for `page_for_posts` and `page_on_front`, and such page stubs will thus cause the `static_front_page` section to appear. Plugins that facilitate page creation in the customizer by filtering `get_pages` will also cause the section to appear.

See #34923.
Fixes #38013.

Built from https://develop.svn.wordpress.org/trunk@38624


git-svn-id: http://core.svn.wordpress.org/trunk@38567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-20 00:47:30 +00:00
Weston Ruter
91f583c9af Customize: Fix php warning due to WP_Customize_Manager::prepare_setting_validity_for_js() incorrectly assuming that WP_Error will only ever have arrays in its $error_data.
* Eliminates the server mutating the a `WP_Error`'s `$error_data` to merge-in a `$from_server` flag (since it may not be an array to begin with). Instead it defers to the client to add a `fromServer` param on any `Notification` instances created from server-sent errors.
* Ensures that notifications will be re-rendered if a notification's `message` changes but the `data` and `type` remain the same.
* Adds explicit support for the `Notification` class to have a `setting` property, ensuring that the property is set whereas previously it was dropped.

Fixes #37890.
Props westonruter, dlh.

Built from https://develop.svn.wordpress.org/trunk@38513


git-svn-id: http://core.svn.wordpress.org/trunk@38454 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-02 22:35:44 +00:00
Scott Taylor
a3ffebce30 Bootstrap: do not go gentle into that good night r38411, r38412, and parts of r38389.
See #36335.

Built from https://develop.svn.wordpress.org/trunk@38470


git-svn-id: http://core.svn.wordpress.org/trunk@38411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-31 16:31:29 +00:00
Scott Taylor
390ceba6c7 Bootstrap: after r38409 and r38410, revert r38402 which reverted r38399.
This fixes the paths in `wp-vendor/` that were including `src`. I want to drop this in so we can find out what else will break.

See #36335.

Built from https://develop.svn.wordpress.org/trunk@38411


git-svn-id: http://core.svn.wordpress.org/trunk@38352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 22:32:37 +00:00
Dion Hulse
0e31a46161 Bootstrap: Revert [38399] as it's broken /build/ and subsequently core.svn.wordpress.org.
The generated classmaps reference `/src/` files and operates in the assumption that the base directory is one level above `wp-settings.php`, which it isn't after our build processes are run.

See #36335

Built from https://develop.svn.wordpress.org/trunk@38402


git-svn-id: http://core.svn.wordpress.org/trunk@38343 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 14:37:32 +00:00
Scott Taylor
6a529648cf Bootstrap: Autoload classes using a Composer-generated PHP 5.2-compatible Autoloader.
* `wp-admin` and `wp-includes` are scanned for classes to autoload
* Several 3rd-party and Ryan McCue-shaped libraries are excluded when the classmap is generated, see `composer.json`: `autoload.exclude-from-classmap`
* `wp-vendor/autoload_52.php` is included at the top of `wp-settings.php` - no changes need to be made to unit tests to include the autoloader
* An avalanche of `require()` and `require_once()` calls that loaded class files have been removed from the codebase.

The following files have been added to `svn:ignore` - they are not 5.2-compatible and fail during pre-commit:
* src/wp-vendor/autoload.php
* src/wp-vendor/composer/autoload_real.php
* src/wp-vendor/composer/autoload_static.php
* src/wp-vendor/composer/ClassLoader.php

We favor these files instead:
* src/wp-vendor/autoload_52.php
* src/wp-vendor/composer/autoload_real_52.php
* src/wp-vendor/composer/ClassLoader52.php

When new PHP classes are added to the codebase, simply run `composer install` or `composer update` from the project root to update the autoloader.

The future is now.

See #36335.

Built from https://develop.svn.wordpress.org/trunk@38399


git-svn-id: http://core.svn.wordpress.org/trunk@38340 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 09:15:29 +00:00
Scott Taylor
b7812bd416 AJAX: add a new function, wp_doing_ajax(), which can replace... (wait for it...) DOING_AJAX checks via the constant.
Props Mte90, sebastian.pisula, swissspidy.
Fixes #25669.

Built from https://develop.svn.wordpress.org/trunk@38334


git-svn-id: http://core.svn.wordpress.org/trunk@38275 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-23 14:33:30 +00:00
Weston Ruter
44c499329a Docs: Update outdated phpdoc for WP_Customize_Manager::validate_setting_values() to reflect changes in [37942].
Props dlh.
See #37247.
Fixes #37759.

Built from https://develop.svn.wordpress.org/trunk@38299


git-svn-id: http://core.svn.wordpress.org/trunk@38240 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-22 00:41:31 +00:00
Dominik Schilling
c61d62675a Docs: Fix typo in hook description for customize_save_validation_before.
See #37318.
Built from https://develop.svn.wordpress.org/trunk@38140


git-svn-id: http://core.svn.wordpress.org/trunk@38081 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-22 13:51:28 +00:00
Drew Jaynes
6cc13f0c54 Docs: Fix formatting, tense, verb conjugation, and other syntax for wp-includes/* elements introduced or changed in 4.6.
Part 1/2.

See #37318.

Built from https://develop.svn.wordpress.org/trunk@38121


git-svn-id: http://core.svn.wordpress.org/trunk@38062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-20 16:57:32 +00:00
Drew Jaynes
6c7148943b Docs: Standardize capitalization of Ajax throughout core documentation per the core spelling guide.
Ajax, while considered an acronym for Asynchronous JavaScript and XML, is most commonly capitalized only in the first character.

Part props ocean90.
See #32246.

Built from https://develop.svn.wordpress.org/trunk@38028


git-svn-id: http://core.svn.wordpress.org/trunk@37969 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-10 00:51:30 +00:00
Sergey Biryukov
139387b7e5 Docs: Use 3-digit, x.x.x-style semantic versioning for _doing_it_wrong(), _deprecated_function(), _deprecated_argument(), and _deprecated_file() throughout core.
Props metodiew.
Fixes #36495.
Built from https://develop.svn.wordpress.org/trunk@37985


git-svn-id: http://core.svn.wordpress.org/trunk@37926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-06 12:40:29 +00:00
Weston Ruter
318fec4dcd Customize: Reverse order of setting sanitization/validation, validating prior to sanitizing.
Reverses order where sanitization was being applied before validation originally in accordance with REST API logic.

Props westonruter, schlessera.
See #34893.
See #37192.
Fixes #37247.

Built from https://develop.svn.wordpress.org/trunk@37942


git-svn-id: http://core.svn.wordpress.org/trunk@37883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-02 18:39:30 +00:00
Dominik Schilling
25e66e4f1e Text Changes: Unify permission error messages.
The new format looks like "Sorry, you are not allowed to <action>.". This provides a consistent experience for all error messages related to missing permissions. It also reduces the number of similar strings and allows translators to provide a consistent style in their language.

Props ramiy, Presskopp.
Fixes #34521.
Built from https://develop.svn.wordpress.org/trunk@37914


git-svn-id: http://core.svn.wordpress.org/trunk@37855 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-29 15:16:29 +00:00
Weston Ruter
1c2324f834 Customize: Update server-sent setting validation notifications as changes are entered.
Send back setting validities with full refreshes and selective refreshes so that invalid settings can have notifications displayed immediately before attempting save, and so that these notifications can be cleared as soon as the input is corrected.

* Splits out JS logic for listing controls into separate methods  `wp.customize.Setting.prototype.findControls()` and `wp.customize.findControlsForSettings()`.
* Adds a `setting` property to the `data` on notifications added to controls that are synced from their settings.
* Adds `selective-refresh-setting-validities` message sent from preview to pane.
* Changes `WP_Customize_Manager::validate_setting_values()` to return when settings are valid as well as invalid.
* Adds `WP_Customize_Manager::prepare_setting_validity_for_js()`.
* Add setting validities to data exported to JS in Customizer Preview and in selective refresh responses.

Fixes #36944.

Built from https://develop.svn.wordpress.org/trunk@37700


git-svn-id: http://core.svn.wordpress.org/trunk@37666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-14 19:17:28 +00:00
Drew Jaynes
fb6d8bae49 Docs: Apply inline @see tags to hooks referenced in DocBlocks for core classes.
Applying these specially-crafted `@see` tags allows the Code Reference parser to recognize and link these elements as actions and filters.

See #36921.

Built from https://develop.svn.wordpress.org/trunk@37539


git-svn-id: http://core.svn.wordpress.org/trunk@37507 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-23 18:54:27 +00:00
Dominik Schilling
af76442848 Customize: Make sure that preview and return URLs are URLs.
Built from https://develop.svn.wordpress.org/trunk@37527


git-svn-id: http://core.svn.wordpress.org/trunk@37495 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-23 09:33:28 +00:00
Weston Ruter
116102089f Customize: Replace invalid reference to $_SERVER['customized'] with $_POST['customized'].
Introduced in r31421.
Fixes #36852.

Built from https://develop.svn.wordpress.org/trunk@37520


git-svn-id: http://core.svn.wordpress.org/trunk@37488 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-23 05:10:27 +00:00
Drew Jaynes
e2c18aaf64 Docs: Standardize filter docs in the Customizer classes to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

Built from https://develop.svn.wordpress.org/trunk@37491


git-svn-id: http://core.svn.wordpress.org/trunk@37459 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:10:29 +00:00
Weston Ruter
87b0a1b989 Customize: Add setting validation model and control notifications to augment setting sanitization.
When a setting is invalid, not only will it be blocked from being saved but all other settings will be blocked as well. This ensures that Customizer saves aren't partial but are more transactional. User will be displayed the error in a notification so that they can fix and re-attempt saving.

PHP changes:

* Introduces `WP_Customize_Setting::validate()`, `WP_Customize_Setting::$validate_callback`, and the `customize_validate_{$setting_id}` filter.
* Introduces `WP_Customize_Manager::validate_setting_values()` to do validation (and sanitization) for the setting values supplied, returning a list of `WP_Error` instances for invalid settings.
* Attempting to save settings that are invalid will result in the save being blocked entirely, with the errors being sent in the `customize_save_response`. Modifies `WP_Customize_Manager::save()` to check all settings for validity issues prior to calling their `save` methods.
* Introduces `WP_Customize_Setting::json()` for parity with the other Customizer classes. This includes exporting of the `type`.
* Modifies `WP_Customize_Manager::post_value()` to apply `validate` after `sanitize`, and if validation fails, to return the `$default`.
* Introduces `customize_save_validation_before` action which fires right before the validation checks are made prior to saving.

JS changes:

* Introduces `wp.customize.Notification` in JS which to represent `WP_Error` instances returned from the server when setting validation fails.
* Introduces `wp.customize.Setting.prototype.notifications`.
* Introduces `wp.customize.Control.prototype.notifications`, which are synced with a control's settings' notifications.
* Introduces `wp.customize.Control.prototype.renderNotifications()` to re-render a control's notifications in its notification area. This is called automatically when the notifications collection changes.
* Introduces `wp.customize.settingConstructor`, allowing custom setting types to be used in the same way that custom controls, panels, and sections can be made.
* Injects a notification area into existing controls which is populated in response to the control's `notifications` collection changing. A custom control can customize the placement of the notification area by overriding the new `getNotificationsContainerElement` method.
* When a save fails due to setting invalidity, the invalidity errors will be added to the settings to then populate in the controls' notification areas, and the first such invalid control will be focused.

Props westonruter, celloexpressions, mrahmadawais.
See #35210.
See #30937.
Fixes #34893.

Built from https://develop.svn.wordpress.org/trunk@37476


git-svn-id: http://core.svn.wordpress.org/trunk@37444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-20 21:10:27 +00:00
Drew Jaynes
fe3b007fdd Docs: Remove inline @see tags from function, class, and method references in inline docs.
Known functions, classes, and methods are now auto-linked in Code Reference pages following #meta1483.

Note: Hook references are still linked via inline `@see` tags due to the unlikelihood of reliably matching for known hooks based on a RegEx pattern.

See #32246.

Built from https://develop.svn.wordpress.org/trunk@37342


git-svn-id: http://core.svn.wordpress.org/trunk@37308 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-02 04:00:28 +00:00
Weston Ruter
959f1a07a6 Customize/Formatting: Move sanitize_hex_color(), sanitize_hex_color_no_hash(), and maybe_hash_hex_color() from class-wp-customize-manager.php into formatting.php.
Adds missing braces.

See #33413.
Props downstairsdev, tollmanz.
Fixes #27583.

Built from https://develop.svn.wordpress.org/trunk@37283


git-svn-id: http://core.svn.wordpress.org/trunk@37249 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-21 19:22:27 +00:00
Sergey Biryukov
77e2737d89 Customizer: Remove the 'appearance' reference from permission error messages added in [33857], [33889], and [33902].
Props Frozzare.
Fixes #36466.
Built from https://develop.svn.wordpress.org/trunk@37197


git-svn-id: http://core.svn.wordpress.org/trunk@37163 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-14 01:58:28 +00:00
Konstantin Obenland
cbbf361c03 Customize: Bring custom-logo args closer to custom-header.
Allows themes to specify the desired width and height of logos, and whether
that is flexible or not. Has the benefit of not having to generate a logo-sized
file for every image uploaded.

Props westonruter, celloexpressions.
Fixes #36255.


Built from https://develop.svn.wordpress.org/trunk@37077


git-svn-id: http://core.svn.wordpress.org/trunk@37044 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-24 02:02:27 +00:00
Weston Ruter
44f38aae77 Customize: Replace site logo with custom logo terminology, fixing failure to preview logo changes.
Fixes regression introduced in [37040] which was from a patch that did not include the terminology change. 

See #36255.
Fixes #35855.

Built from https://develop.svn.wordpress.org/trunk@37066


git-svn-id: http://core.svn.wordpress.org/trunk@37033 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-23 06:26:26 +00:00
Weston Ruter
f3f84d2f21 Customize: Require opt-in for selective refresh of widgets.
* Introduces `customize-selective-refresh-widgets` theme support feature and adds to themes.
* Introduces `customize_selective_refresh` arg for `WP_Widget::$widget_options` and adds to all core widgets.
* Remove `selective_refresh` from being a component that can be removed via `customize_loaded_components` filter.
* Add `WP_Customize_Widgets::get_selective_refreshable_widgets()` and `WP_Customize_Widgets::is_widget_selective_refreshable()`.
* Fix default `selector` for `Partial` instances.
* Implement and improve Masronry sidebar refresh logic in Twenty Thirteen and Twenty Fourteen, including preservation of initial widget position after refresh.
* Re-initialize ME.js when refreshing `Twenty_Fourteen_Ephemera_Widget`.

See #27355.
Fixes #35855.

Built from https://develop.svn.wordpress.org/trunk@37040


git-svn-id: http://core.svn.wordpress.org/trunk@37007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-21 21:59:29 +00:00
Aaron Jorbin
1972aa2a2a Add grunt prerelease task
An unintended consequence of improving the precommit task is that when it's time to run a release, more tasks need to get run to verify things. This adds a prerelease task to help fix that situation. grunt prerelease should include tasks that verify the code base is ready to be released to the wild and find all the tears on the mausoleum floor and help Blood stain the Colosseum doors.

See #35557

Built from https://develop.svn.wordpress.org/trunk@36930


git-svn-id: http://core.svn.wordpress.org/trunk@36898 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-10 05:37:27 +00:00
Konstantin Obenland
9dda05f857 Customize: Bump down the priority custom logo's control.
Keeps the control in the same place but allows for plugins and themes to place
other controls above it.

Props celloexpressions.
Fixes #35942.

Built from https://develop.svn.wordpress.org/trunk@36912


git-svn-id: http://core.svn.wordpress.org/trunk@36880 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-09 22:03:27 +00:00
Weston Ruter
a8ca958d43 Customize: Eliminate unnecessary WP_Customize_Site_Logo_Control in favor of re-using WP_Customize_Image_Control.
* Removes double `margin-bottom` from all the media controls.
* All media controls now send `{settingId}-attachment-data` messages to the preview when a media setting is updated so that the preview has access to the attachment data.
* Fixes receiving of `attachment-data` message for `custom_logo` which resulted in instant JS-applied preview not working. See #36096.

See #33755.
Fixes #35941.

Built from https://develop.svn.wordpress.org/trunk@36851


git-svn-id: http://core.svn.wordpress.org/trunk@36818 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-04 23:47:26 +00:00
Konstantin Obenland
1ef0d464d7 Customize: Rename custom logo classes after [36837].
Fixes #35945.

Built from https://develop.svn.wordpress.org/trunk@36838


git-svn-id: http://core.svn.wordpress.org/trunk@36805 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-03 19:59:27 +00:00
Konstantin Obenland
147d6d7d6c Customize: Site logos are custom logos.
Brings the nomenclature closer to custom headers and backgrounds.

See https://wordpress.slack.com/archives/core/p1456955151003150
See #35945. 

Built from https://develop.svn.wordpress.org/trunk@36837


git-svn-id: http://core.svn.wordpress.org/trunk@36804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-03 19:56:26 +00:00
Weston Ruter
94b59e7f0d Customize: Ensure autofocus deep-linking applies for dynamically-created panels, sections, and controls.
Removes overly-zealous filtering of autofocus panels, sections, and controls which are unrecognized or for which the user doesn't have the capability to focus (in which case it would no-op anyway). Also defers autofocus logic until instances are created, even after initial `ready` event. This ensures that autofocus can apply for any panels, sections, or controls that get created via the loaded preview.

See #28650.
Fixes #36018.

Built from https://develop.svn.wordpress.org/trunk@36796


git-svn-id: http://core.svn.wordpress.org/trunk@36763 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-01 22:04:27 +00:00
Weston Ruter
53493af312 Customize: Fix PHP notice when calling WP_Customize_Control::json() inside content_template() method.
A `temp` control is instantiated when `WP_Customize_Manager:: render_control_templates()` is called. This control needs to explicitly specify an empty settings array to avoid trying to use a `temp` setting which won't exist.

See #35926.
See #29572.

Built from https://develop.svn.wordpress.org/trunk@36776


git-svn-id: http://core.svn.wordpress.org/trunk@36743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-29 07:03:27 +00:00
Sergey Biryukov
376f723485 I18N: Remove <a> tag from translatable string in wp-includes/class-wp-customize-manager.php.
Props ramiy.
Fixes #35992.
Built from https://develop.svn.wordpress.org/trunk@36772


git-svn-id: http://core.svn.wordpress.org/trunk@36739 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-29 03:14:26 +00:00
Dominik Schilling
e5ea82d81a Spelling: Standardize on "front end"/"back end" (noun) and "front-end"/"back-end" (adjective).
Props obrienlabs, thewanderingbrit.
Fixes #34887.
Built from https://develop.svn.wordpress.org/trunk@36709


git-svn-id: http://core.svn.wordpress.org/trunk@36676 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-25 12:53:27 +00:00
Konstantin Obenland
237f6a0e58 Customize: Introduce Logo support for themes.
Allows a common theme feature to have a common implementation provided by core and available in a consistent location for users.
See https://make.wordpress.org/core/2016/02/24/theme-logo-support/

Props kwight, enejb, jeherve, bhubbard, samhotchkiss, zinigor, eliorivero, adamsilverstein, melchoyce, ryan, mikeschroder, westonruter, pento, karmatosed, celloexpressions, obenland. 
See #33755.


Built from https://develop.svn.wordpress.org/trunk@36698


git-svn-id: http://core.svn.wordpress.org/trunk@36665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-24 22:10:26 +00:00
Drew Jaynes
15482d5d80 Docs: Add an inline @see tag to link up the plugins_loaded hook in the description for the customize_loaded_components filter.
See #32246.

Built from https://develop.svn.wordpress.org/trunk@36687


git-svn-id: http://core.svn.wordpress.org/trunk@36654 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-24 16:44:26 +00:00
Weston Ruter
87a9bf2b37 Docs: Use markdown instead of HTML for code formatting.
Fixes phpdoc usage in [36622], [36608], [35724], [35307].

See #35898.
See #35869.
See #34738.
See #33552.

Built from https://develop.svn.wordpress.org/trunk@36645


git-svn-id: http://core.svn.wordpress.org/trunk@36612 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-23 19:18:27 +00:00
Weston Ruter
6b775d4afe Customize: Add selective refresh framework with implementation for widgets and re-implementation for nav menus.
See https://make.wordpress.org/core/2016/02/16/selective-refresh-in-the-customizer/.

Props westonruter, valendesigns, DrewAPicture, ocean90.
Fixes #27355.

Built from https://develop.svn.wordpress.org/trunk@36586


git-svn-id: http://core.svn.wordpress.org/trunk@36553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-19 18:41:28 +00:00
Weston Ruter
b5e18056e5 Customize: Add a user-friendly way to preview site responsiveness for desktop, tablet, and mobile.
Introduces `WP_Customize_Manager::get_previewable_devices()` with a `customize_previewable_devices` filter to change the default device and which devices are available for previewing. This is a feature that was first pioneered on WordPress.com.

Props celloexpressions, folletto, valendesigns, westonruter, welcher, adamsilverstein, michaelarestad, Fab1en.
Fixes #31195.

Built from https://develop.svn.wordpress.org/trunk@36532


git-svn-id: http://core.svn.wordpress.org/trunk@36499 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-16 01:57:26 +00:00
Weston Ruter
c376477265 Customizer: Export nonce, theme, and url app settings in preview as exported in pane.
* Introduce `WP_Customize_Manager::get_nonces()` to consolidate logic for retrieving nonces.
* Export nonces centrally in `wp.customize.settings.nonce` with each request and update nav menus preview to utilize.
* Send updated nonces to preview upon `nonce-refresh`.
* Request full preview refresh if Nav Menu selective refresh request fails (e.g. due to bad nonce).
* Update nav menus and widgets in Customizer to utilize `customize_refresh_nonces` for exporting nonces and keeping them up to date.

See #27355.
Fixes #35617.

Built from https://develop.svn.wordpress.org/trunk@36414


git-svn-id: http://core.svn.wordpress.org/trunk@36381 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-27 17:55:26 +00:00
Weston Ruter
c7923b2c9d Customizer: Improve parity between JS Setting models in preview with JS Setting models in pane.
* Ensure that Setting `Value` objects in preview get initial `_dirty` flag set if values among POST data.
* Upon `saved` event, send `saved` message to preview with the `response` to trigger `saved` event there.
* Reset `_dirty` flag for all setting `Value` objects in preview upon `saved`.
* Continue to create settings synced from pane even after initial bootstrap, and create them as dirty.
* Ensure that `id` property is set for setting `Value` objects in preview.

See #27355.
Fixes #35616.

Built from https://develop.svn.wordpress.org/trunk@36407


git-svn-id: http://core.svn.wordpress.org/trunk@36374 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-26 23:52:25 +00:00
Weston Ruter
dd123ab2c0 Customizer: Re-use list of components to eliminate code duplication.
Introduces protected `WP_Customize_Manager::$components` to store list of loaded core components filtered by `customize_loaded_components`.

Props DrewAPicture.
See #35242
See #33552.
Fixes #35354.

Built from https://develop.svn.wordpress.org/trunk@36262


git-svn-id: http://core.svn.wordpress.org/trunk@36229 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-11 20:28:28 +00:00
Weston Ruter
3e35a7157f Customizer: Prevent erroneously directing user to login screen when closing.
Fixes issue where user gets stuck at login screen after trying to close the app if previously they had to first login to access the Customizer. Prevents `WP_Customize_Manager::get_return_url()` from using `wp-login.php` as a referer.

Props chandrapatel.
See #32637.
Fixes #35355.

Built from https://develop.svn.wordpress.org/trunk@36261


git-svn-id: http://core.svn.wordpress.org/trunk@36228 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-11 18:51:28 +00:00
Weston Ruter
0b8c6eed83 Customizer: Improve _doing_it_wrong() message when widgets or nav_menus are manually removed via WP_Customize_Manager::remove_panel().
* Link to code reference page for `customize_loaded_components` instead of linking to a Trac comment.
* Remove HTML code from being included in translated string.
* Add missing translator comment for the specifiers in the translated string.

Amends [36216].
Props DrewAPicture.
Fixes #35242.

Built from https://develop.svn.wordpress.org/trunk@36219


git-svn-id: http://core.svn.wordpress.org/trunk@36186 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-07 18:44:28 +00:00
Weston Ruter
668818e93d Customizer: Call _doing_it_wrong() if widgets or nav_menus are manually removed via WP_Customize_Manager::remove_panel().
Advise that the `customize_loaded_components` filter should be used instead.

Props voldemortensen.
See #33552.
Fixes #35242.

Built from https://develop.svn.wordpress.org/trunk@36216


git-svn-id: http://core.svn.wordpress.org/trunk@36183 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-07 06:06:28 +00:00
Sergey Biryukov
d0b7dd489e I18N: Remove <strong> tags from translatable strings in WP_Customize_Manager::register_controls() and WP_Customize_Header_Image_Control::render_content().
Add translator comments.

See #35039.
Built from https://develop.svn.wordpress.org/trunk@35923


git-svn-id: http://core.svn.wordpress.org/trunk@35887 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-14 12:54:27 +00:00
Sergey Biryukov
346cce3c48 Customizer: Change "Display Header Text" checkbox label to "Display Site Title and Tagline", to make it clearer that it affects both settings.
Props juanfra, vlad.olaru.
Fixes #31829.
Built from https://develop.svn.wordpress.org/trunk@35899


git-svn-id: http://core.svn.wordpress.org/trunk@35863 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-13 17:50:28 +00:00
Mel Choyce
09b5c2b3d0 Customizer: Bold pixel value under Site Icon to match the Custom Header instructions.
Props karmatosed.
Fixes #35039.

Built from https://develop.svn.wordpress.org/trunk@35892


git-svn-id: http://core.svn.wordpress.org/trunk@35856 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-13 00:14:27 +00:00
Weston Ruter
07339e61c0 Customizer: Apply customize_dynamic_setting_class and customize_dynamic_setting_args filters in calls to WP_Customize_Manager::add_setting( $id, $args ).
Ensure that plugin filters apply as expected for any settings registered statically without passing in an explicit class instance to `WP_Customize_Manager::add_setting()`.

Fixes #34597.

Built from https://develop.svn.wordpress.org/trunk@35810


git-svn-id: http://core.svn.wordpress.org/trunk@35774 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-06 23:22:25 +00:00
Weston Ruter
0c311ef2d6 Customizer: Return added instances for panels, sections, controls, and settings when calling WP_Customize_Manager::add_*() methods.
Add missing phpDoc.

Props fusillicode, jubstuff.
Fixes #34596.

Built from https://develop.svn.wordpress.org/trunk@35781


git-svn-id: http://core.svn.wordpress.org/trunk@35745 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-06 18:10:25 +00:00
Weston Ruter
5dae1386aa Customize: Ensure that a setting (especially a multidimensional one) can still be previewed when the post value to preview is set after preview() is invoked.
* Introduce `customize_post_value_set_{$setting_id}` and `customize_post_value_set` actions which are done when `WP_Customize_Manager::set_post_value()` is called.
* Clear the `preview_applied` flag for aggregated multidimensional settings when a post value is set. This ensures the new value is used instead of a previously-cached previewed value.
* Move `$is_preview` property from subclasses to `WP_Customize_Setting` parent class.
* Deferred preview: Ensure that when `preview()` short-circuits due to not being applicable that it will be called again later when the post value is set.
* Populate post value for updated-widget with the (unsanitized) JS-value in `WP_Customize_Widgets::call_widget_update()` so that value will be properly sanitized when accessed in `WP_Customize_Manager::post_value()`.

Includes unit tests with assertions to check the reported issues and validate the fixes.

Fixes defect introduced in [35007].
See #32103.
Fixes #34738.

Built from https://develop.svn.wordpress.org/trunk@35724


git-svn-id: http://core.svn.wordpress.org/trunk@35688 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-21 02:52:27 +00:00
Andrew Nacin
1579e45d41 Simplify the include graph after work to split out classes.
see #33413. More details there.

Built from https://develop.svn.wordpress.org/trunk@35718


git-svn-id: http://core.svn.wordpress.org/trunk@35682 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-20 07:24:30 +00:00
Weston Ruter
268626d061 Customize: Exclude referer URL from being used for Close link if it is customize.php.
This fixes an edge case where the Close button could never link the user out of the Customizer, if the user initially accessed it without a `url` param and then clicked a link (provided by a plugin) that took them to another `customize.php` URL.

See #32637.

Built from https://develop.svn.wordpress.org/trunk@35635


git-svn-id: http://core.svn.wordpress.org/trunk@35599 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-13 05:25:28 +00:00
Weston Ruter
b9d9c6d3c9 Customize: Fix typo in WP_Customize_Manager::_cmp_priority() which caused unstable sorting for same-priority constructs in PHP.
The issue, however, does not manifest in the UI because the UI is now built via JS and the `wp.customize.utils.prioritySort()` algorithm did not have the same typo.

Props bordoni, westonruter.
Fixes #34594.

Built from https://develop.svn.wordpress.org/trunk@35553


git-svn-id: http://core.svn.wordpress.org/trunk@35517 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-06 06:58:25 +00:00
Weston Ruter
e0ac4e4d05 Customize: Correct phpdoc @return type for WP_Customize_Manager::add_dynamic_settings().
Fixes regression in [32032], where `WP_Customize_Setting[]` should have been changed to `array` instead of `WP_Customize_Setting`.

See #31888.

Built from https://develop.svn.wordpress.org/trunk@35534


git-svn-id: http://core.svn.wordpress.org/trunk@35498 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-05 00:43:24 +00:00
Weston Ruter
8fed77574c Customize: Return user to referring URL when leaving Customizer in absence of return query param.
When referring URL is not available, default returning user to frontend URL instead of admin URL. Themes page is updated to include the `return` path in Customizer links.

Props McGuive7, westonruter.
Fixes #32637.

Built from https://develop.svn.wordpress.org/trunk@35483


git-svn-id: http://core.svn.wordpress.org/trunk@35447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-01 06:40:28 +00:00
Andrea Fercia
930a688e17 Customizer: remove the title attribute from the Preview html element while loading.
Props mehulkaklotar.

Fixes #33250.
Built from https://develop.svn.wordpress.org/trunk@35391


git-svn-id: http://core.svn.wordpress.org/trunk@35355 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-25 15:14:26 +00:00
Weston Ruter
bee05e0cdc Customizer: Introduce customize_loaded_components filter to allow core components to be disabled.
Also move style rule from `customize-nav-menus.css` to `customize-controls.css` so that widgets button is properly styled when `nav_menus` component is excluded from loading. See [35304]. See #33327.

Props westonruter, DrewAPicture.
Fixes #33552.

Built from https://develop.svn.wordpress.org/trunk@35307


git-svn-id: http://core.svn.wordpress.org/trunk@35273 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-20 22:16:25 +00:00
Sergey Biryukov
047501800d Customizer: Replace context for two strings added in [30306] with a translator comment.
Fixes #34203.
Built from https://develop.svn.wordpress.org/trunk@34921


git-svn-id: http://core.svn.wordpress.org/trunk@34886 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-07 23:54:24 +00:00
Weston Ruter
4ff29f822e Customize: Flesh out phpdoc for WP_Customize_Manager.
* Add missing phpdoc for class member variables.
* Supply missing `@return` descriptions from [34269].
* Add missing `@since` tags.
* Remove unused `$customized` protected class member variable.

Fixes #33898.

Built from https://develop.svn.wordpress.org/trunk@34320


git-svn-id: http://core.svn.wordpress.org/trunk@34284 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-19 06:40:26 +00:00
Weston Ruter
93bcd86b2a Customize: Reduce peak memory usage by JSON-encoding settings and controls individually.
When there are hundreds of settings and controls (e.g. nav menu items and widget instances) the resulting object that is JSON-encoded can become very large, and `wp_json_encode()` can consume a lot of memory to serialize it. By breaking down the serialization into multiple calls the peak memory usage can be kept in line.

Moves logic out of `wp-admin/customize.php` into the `WP_Customize_Manager` class with new methods:

 * `is_ios()`
 * `get_document_title_template()`
 * `get_preview_url()`/`set_preview_url()`
 * `get_return_url()`/`set_return_url()`
 * `get_autofocus()`/`set_autofocus()`
 * `customize_pane_settings()`

Includes unit tests for these methods, for which the logic was formerly untestable in `customize.php`.

Fixes #33898.

Built from https://develop.svn.wordpress.org/trunk@34269


git-svn-id: http://core.svn.wordpress.org/trunk@34233 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-17 19:42:26 +00:00
Sergey Biryukov
53ac914bd5 Add a comment to strings where the ellipsis cannot be used due to json_encode(), placeholders, or external dependencies.
Fixes #32875.
Built from https://develop.svn.wordpress.org/trunk@34233


git-svn-id: http://core.svn.wordpress.org/trunk@34197 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-16 11:59:26 +00:00
Dominik Schilling
4d5cd90b46 Revert [34013] and parts of [33970].
* `_WP_Editors::wp_mce_translation()` can't be changed without changing strings in TinyMCE and plugins.
* `\u2026` is escaped by `json_encode()` to `\\u2026`, makes `\u2026` visible in our UI.

See #32875.
Built from https://develop.svn.wordpress.org/trunk@34087


git-svn-id: http://core.svn.wordpress.org/trunk@34055 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-12 20:03:24 +00:00
Scott Taylor
6ea147d51c After [33970], swap UTF-8 characters for their \u2026 escape sequence.
See #32875.

Built from https://develop.svn.wordpress.org/trunk@34013


git-svn-id: http://core.svn.wordpress.org/trunk@33982 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-10 20:30:24 +00:00
Scott Taylor
02ae926dfd Round 2 of: We should use ellipses &hellip; / … instead of three dots/periods ... e.g Loading… not Loading...
Props yoavf.
Fixes #32875.

Built from https://develop.svn.wordpress.org/trunk@33970


git-svn-id: http://core.svn.wordpress.org/trunk@33939 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-09 04:39:25 +00:00
Sergey Biryukov
9ffab31d8f Add missing translation functions to the error messages added in [33889].
props kraftbj, GaryJ.
fixes #33684.
Built from https://develop.svn.wordpress.org/trunk@33892


git-svn-id: http://core.svn.wordpress.org/trunk@33861 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-03 18:37:23 +00:00
Sergey Biryukov
ba056692a6 Provide more helpful feedback than just "Cheatin' uh?" for permission errors in wp-includes/class-wp-customize-manager.php.
props kraftbj.
fixes #33684. see #14530.
Built from https://develop.svn.wordpress.org/trunk@33889


git-svn-id: http://core.svn.wordpress.org/trunk@33858 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-03 09:21:23 +00:00
Konstantin Obenland
3248497cf3 Site Icon: Add crop preview to the media modal.
* Monkey patches imgAreaSelect library to support touch events.
* Removes Settings version of Site Icon since it would have been the same flow.
* Removes default value for Customizer setting - there is no default favicon.

Fixes #16434.



Built from https://develop.svn.wordpress.org/trunk@33329


git-svn-id: http://core.svn.wordpress.org/trunk@33301 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-20 15:57:25 +00:00
Drew Jaynes
442f8fa753 Fix parameter descriptions for two methods added to WP_Customize_Manager in 4.3.
See [32658]. See #32891.

Built from https://develop.svn.wordpress.org/trunk@33217


git-svn-id: http://core.svn.wordpress.org/trunk@33189 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-13 20:32:24 +00:00
Konstantin Obenland
f29e5044cd Site Icon: Add Customizer UI.
Second part of the Site Icon feature after [32994] introduced it for Settings.

Props celloexpressions.
See #16434.


Built from https://develop.svn.wordpress.org/trunk@33154


git-svn-id: http://core.svn.wordpress.org/trunk@33126 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-10 21:33:24 +00:00
Scott Taylor
a0e373ef80 For doc block types, favor bool over the few remaining booleans
See #32444.

Built from https://develop.svn.wordpress.org/trunk@32964


git-svn-id: http://core.svn.wordpress.org/trunk@32935 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-27 01:03:25 +00:00
Dominik Schilling
62e3a0c15c Add menu management to the Customizer.
This brings in the Menu Customizer plugin: https://wordpress.org/plugins/menu-customizer/.

props celloexpressions, westonruter, valendesigns, voldemortensen, ocean90, adamsilverstein, kucrut, jorbin, designsimply, afercia, davidakennedy, obenland.
see #32576.
Built from https://develop.svn.wordpress.org/trunk@32806


git-svn-id: http://core.svn.wordpress.org/trunk@32777 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-16 22:08:26 +00:00
Weston Ruter
489db97ea3 Customizer: Allow sections and panels to be exported to JS.
Also fix param docs for `customize_dynamic_setting_class` filter, and use `require_once` for `class-wp-customize-manager.php` in bootstrap function `_wp_customize_include()`.

See #30737, #32576.

Built from https://develop.svn.wordpress.org/trunk@32744


git-svn-id: http://core.svn.wordpress.org/trunk@32715 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-12 22:54:25 +00:00
Weston Ruter
98b03d376e Add JS templates for Customizer Panels and Sections.
This extends the approach taken for Customizer Controls in #29572.

Props celloexpressions, westonruter, ocean90.
See #30737.

Built from https://develop.svn.wordpress.org/trunk@32658


git-svn-id: http://core.svn.wordpress.org/trunk@32628 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-30 00:03:30 +00:00
Scott Taylor
bd8fafea54 Use void instead of null where appropriate when pipe-delimiting @return types. If a @return only contains void, remove it.
See #32444.

Built from https://develop.svn.wordpress.org/trunk@32568


git-svn-id: http://core.svn.wordpress.org/trunk@32538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-24 05:40:25 +00:00
Scott Taylor
b2bbbf9759 In class-wp-customize-*, clarify/add some @param/@return blocks. Disambiguate some functions that are trying to return the void response of another function they call internally.
See #32444.

Built from https://develop.svn.wordpress.org/trunk@32535


git-svn-id: http://core.svn.wordpress.org/trunk@32505 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-21 22:05:24 +00:00
Dominik Schilling
b29c8c503b Theme Switcher: Provide an easier way to reset back to the current active theme.
* Add control for the active theme when doing a theme preview
* Highlight an active theme and move it to the top

props valendesigns, ocean90.
fixes #32002.
Built from https://develop.svn.wordpress.org/trunk@32265


git-svn-id: http://core.svn.wordpress.org/trunk@32236 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-22 16:15:27 +00:00
Dominik Schilling
6d2c70aa0d Customizer: Refresh nonces when a session expires and the user logs in again.
This was broken since 4.0 and the introduction of user session tokens. The nonces are now tied to session tokens as opposed to user IDs, and thus they change with each re-login.
Custom nonces can be added through the `customize_refresh_nonces` filter. On a successful refresh request the JavaScript API will trigger a `nonce-refresh` event. See widget's update nonce as an example.

props westonruter for initial patch.
fixes #31294.
Built from https://develop.svn.wordpress.org/trunk@32054


git-svn-id: http://core.svn.wordpress.org/trunk@32033 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-06 15:10:27 +00:00
Drew Jaynes
831d7ea1e4 Fix inline documentation syntax in a variety of DocBlocks and hook docs in WP_Customize_Manager.
See [31370]. See #31888.

Built from https://develop.svn.wordpress.org/trunk@32032


git-svn-id: http://core.svn.wordpress.org/trunk@32011 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-05 15:07:27 +00:00
Drew Jaynes
4b36885bbd Cleanup DocBlock syntax, add a missing parameter description for WP_Customize_Manager->set_post_value().
See [31370]. See #31888.

Built from https://develop.svn.wordpress.org/trunk@32031


git-svn-id: http://core.svn.wordpress.org/trunk@32010 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-05 15:03:29 +00:00
Drew Jaynes
a91a919d13 Add inline doc syntax fixes for WP_Customize_Manager->doing_ajax().
Also adds a return description.

See [31370]. See #31888.

Built from https://develop.svn.wordpress.org/trunk@32030


git-svn-id: http://core.svn.wordpress.org/trunk@32009 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-05 15:00:27 +00:00
Dominik Schilling
254b9e3264 Customizer Theme Switcher: Navigation streamlining.
* Detach Themes section from other controls
* Move to buttons to navigate back and forth
* Change titles based on current theme status, active/previewing
* Hide the active/previewing theme from the list of available themes

props folletto for the design concepts.
props designsimply, celloexpressions for initial patches.
props Team Gandalf.
see #31289.
Built from https://develop.svn.wordpress.org/trunk@31975


git-svn-id: http://core.svn.wordpress.org/trunk@31954 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-01 22:51:27 +00:00
Dominik Schilling
57fce2e593 Customizer Theme Switcher: Remove "Add New" references.
The current iteration takes you out of the customizer context, which isn't great UX and doesn't really fit into the flows targeted by this particular UI.

fixes #31837.
Built from https://develop.svn.wordpress.org/trunk@31968


git-svn-id: http://core.svn.wordpress.org/trunk@31947 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-01 19:50:29 +00:00
Dominik Schilling
b95a8227d8 Customizer Theme Switcher: Fix invalid HTML markup when New Theme control is added.
see #31203.
Built from https://develop.svn.wordpress.org/trunk@31950


git-svn-id: http://core.svn.wordpress.org/trunk@31929 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-01 11:35:26 +00:00
Sergey Biryukov
36643388ef Decouple strings where the singular and plural form are not just the same string with different numbers, but essentially two different strings.
This allows for using proper plural forms in languages with more than two forms, and also resolves string conflicts when the same string is present in both singular and plural form.

fixes #28502.
Built from https://develop.svn.wordpress.org/trunk@31941


git-svn-id: http://core.svn.wordpress.org/trunk@31920 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-31 18:45:28 +00:00
Dominik Schilling
f9180e1b4b Customizer: Introduce WP_Customize_Media_Control.
`WP_Customize_Media_Control` is a new base class for all Customizer media controls. If used directly it supports the ID of an attachment instead of an URL like `WP_Customize_Upload_Control`.

props celloexpressions.
fixes #29215.
Built from https://develop.svn.wordpress.org/trunk@31698


git-svn-id: http://core.svn.wordpress.org/trunk@31679 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-10 18:02:28 +00:00
Dominik Schilling
3349b7d25b Customizer: Add loading indicators for the Customizer preview.
props Fab1en, westonruter.
fixes #31196.
Built from https://develop.svn.wordpress.org/trunk@31697


git-svn-id: http://core.svn.wordpress.org/trunk@31678 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-10 15:56:26 +00:00
Drew Jaynes
5c2c3a961d Add a missing file header to wp-includes/class-wp-customize-manager.php, separate out the class DocBlock for WP_Customize_Manager.
See #31446.

Built from https://develop.svn.wordpress.org/trunk@31540


git-svn-id: http://core.svn.wordpress.org/trunk@31521 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 08:07:24 +00:00
Mark Jaquith
bd2c067245 Make sure WP_Customize_Manager::theme() never returns null.
* Fixes issue in [31533] that caused unit test fatal error

fixes #31445
Built from https://develop.svn.wordpress.org/trunk@31536


git-svn-id: http://core.svn.wordpress.org/trunk@31517 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 03:54:25 +00:00
Mark Jaquith
8b180b9a46 Add theme browsing and theme switching to the Customizer
* Brings into core the Customizer Theme Switcher feature plugin
* You can now browse, preview, and activate themes right from the Customizer

fixes #31303.
props celloexpressions, afercia, westonruter, folletto, designsimply
Built from https://develop.svn.wordpress.org/trunk@31533


git-svn-id: http://core.svn.wordpress.org/trunk@31514 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-24 20:31:24 +00:00
Dominik Schilling
1884ec383c Customizer: Restore showing a login form inside the previewer if an user is logged out.
Broken since [31370].

props westonruter.
see #31294.
Built from https://develop.svn.wordpress.org/trunk@31421


git-svn-id: http://core.svn.wordpress.org/trunk@31402 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-11 22:13:25 +00:00
Dominik Schilling
3aea5f144b Customizer: Introduce an API to create WP_Customize_Settings for dynamically-created settings.
* Introduce WP_Customize_Manager::add_dynamic_settings() to register dynamically-created settings.
* Introduce `customize_dynamic_setting_args` filter to pass an array of args to a dynamic setting's constructor.
* Add unit tests for WP_Customize_Manager and WP_Customize_Widgets.
* See WP_Customize_Widgets as an example.

props westonruter.
fixes #30936.
Built from https://develop.svn.wordpress.org/trunk@31370


git-svn-id: http://core.svn.wordpress.org/trunk@31351 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-08 23:11:25 +00:00
Dominik Schilling
8fe95c9e65 Customizer: Add changelog entry for the 'default' parameter added in [31329].
props westonruter.
see #30988.
Built from https://develop.svn.wordpress.org/trunk@31360


git-svn-id: http://core.svn.wordpress.org/trunk@31341 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-06 21:14:24 +00:00
Dominik Schilling
9d162f0945 Ensure that WP_Customize_Setting::value() returns default value for setting if not dirty.
There was regression introduced by #28580 where only changed (dirty) settings now are POST'ed to the Customizer preview.

* Allow WP_Customize_Manager::post_value() to accept a second $default argument.
* Introduce WP_Customize_Manager::unsanitized_post_values() for accessing previously-private member variable _post_values.
* Do require_once instead of require for Customizer classes.
* Add unit tests for WP_Customize_Manager and WP_Customize_Setting.

props westonruter.
fixes #30988.
Built from https://develop.svn.wordpress.org/trunk@31329


git-svn-id: http://core.svn.wordpress.org/trunk@31310 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-03 10:15:21 +00:00