Commit Graph

355 Commits

Author SHA1 Message Date
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
Sergey Biryukov
7d2ec003da Customizer: Replicate behavior from options-reading.php and hide front page options if there are no pages.
props Clorith.
fixes #27630.
Built from https://develop.svn.wordpress.org/trunk@31234


git-svn-id: http://core.svn.wordpress.org/trunk@31215 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-18 06:01:24 +00:00
Scott Taylor
cde4c83091 [31210] broke Supportflow on dotorg, which declares these methods as protected. Switch to protected for the noop methods. The subclasses can make them more visible using public.
See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31192 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 18:37:24 +00:00
Scott Taylor
fe6b5983df In PHP 5.0.0, is_a() became deprecated in favour of the instanceof operator. Calling is_a() would result in an E_STRICT warning.
In PHP 5.3.0, `is_a()` is no longer deprecated, and will therefore no longer throw `E_STRICT` warnings.

To avoid warnings in PHP < 5.3.0, convert all `is_a()` calls to `$var instanceof WP_Class` calls.

`instanceof` does not throw any error if the variable being tested is not an object, it simply returns `false`.

Props markoheijnen, wonderboymusic.
Fixes #25672.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31169 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 01:06:24 +00:00
Scott Taylor
55fdfb529a There is no need to use the final modifier inside a final class. Everything in it is final by default.
See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31066 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-08 06:10:46 +00:00
Scott Taylor
ff98cfcf45 Pinking Shears.
See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31058 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-08 05:03:23 +00:00
Sergey Biryukov
23a5deba53 Customizer: Correctly display "Select" option in Navigation section dropdowns.
props kucrut.
fixes #30929.
Built from https://develop.svn.wordpress.org/trunk@31069


git-svn-id: http://core.svn.wordpress.org/trunk@31050 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-07 19:50:23 +00:00
Drew Jaynes
727999d6fb Add a description for the $data parameter in the DocBlock for the customize_save_response hook introduced in [31062].
Props westonruter.
Fixes #29098.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31044 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-07 01:48:24 +00:00
Dominik Schilling
56981c7143 Customizer: Send JSON success for customize_save and allow response to be filtered.
props westonruter.
fixes #29098.
Built from https://develop.svn.wordpress.org/trunk@31062


git-svn-id: http://core.svn.wordpress.org/trunk@31043 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-06 21:47:23 +00:00
Dominik Schilling
fcb00b75e2 Customizer: Add _wp_attachment_is_custom_background meta to uploaded background images.
Adds `$type` property to `WP_Customize_Background_Image_Control` (PHP) and introduces `wp.customize.BackgroundControl` (JS).

see #30707.
Built from https://develop.svn.wordpress.org/trunk@30885


git-svn-id: http://core.svn.wordpress.org/trunk@30873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-15 23:28:23 +00:00
Drew Jaynes
ad297dab6d Correctly capitalize JavaScript throughout core docs.
Fixes #30569.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30685 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-02 00:31:22 +00:00
Scott Taylor
a215b8801d Improve various @param docs for src/wp-includes/class-wp-customize*.php.
See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 23:33:23 +00:00
Drew Jaynes
478f5f1f5d 4.1 Docs Audit: Improve inline documentation for various properties and methods in the WP_Customize_Manager class.
See #30469.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30596 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-28 10:52:22 +00:00
Dominik Schilling
41197a7c31 Customizer: Improve ability to filter active state for widget area Customizer sections.
* Mark panels, sections, controls as active if preview explicitly indicates.
* Introduce `WP_Customize_Sidebar_Section` PHP class, and `SidebarSection` JS class.
* Move logic for determining whether a sidebar section is active from the `SidebarControl` to `SidebarSection`.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30328 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-13 12:19:23 +00:00
Dominik Schilling
6d83c8c29e Customizer: Add support for the media library in Background Image controls.
`WP_Customize_Upload_Control` (PHP) and `api.UploadControl` (JS) can now open the media modal.

props celloexpressions, and ericlewis for docs.
see #21483.
Built from https://develop.svn.wordpress.org/trunk@30309


git-svn-id: http://core.svn.wordpress.org/trunk@30308 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-11 23:52:22 +00:00
Dominik Schilling
73b4f6f449 Customizer: Add stable sorting for panels, sections and controls in JS. Improve sorting in PHP.
props westonruter.
fixes #30225.
Built from https://develop.svn.wordpress.org/trunk@30214


git-svn-id: http://core.svn.wordpress.org/trunk@30214 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-03 21:35:23 +00:00
Drew Jaynes
f8657d5890 Remove redundant and erroneous @uses tag from most core inline documentation.
Per our inline documentation standards, no further use of the `@uses` tag is recommended as used and used-by relationships can be derived through other means. This removes most uses of the tag in core documentation, with remaining tags to be converted to `@global` or `@see` as they apply.

Fixes #30191.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-30 01:05:24 +00:00
Dominik Schilling
3c962ee5d8 Improve/introduce Customizer JavaScript models for Controls, Sections, and Panels.
* Introduce models for panels and sections.
* Introduce API to expand and focus a control, section or panel.
* Allow deep-linking to panels, sections, and controls inside of the Customizer.
* Clean up `accordion.js`, removing all Customizer-specific logic.
* Add initial unit tests for `wp.customize.Class` in `customize-base.js`.

https://make.wordpress.org/core/2014/10/27/toward-a-complete-javascript-api-for-the-customizer/ provides an overview of how to use the JavaScript API.

props westonruter, celloexpressions, ryankienstra.
see #28032, #28579, #28580, #28650, #28709, #29758.
fixes #29529.


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


git-svn-id: http://core.svn.wordpress.org/trunk@30102 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-29 22:51:22 +00:00
Gary Pendergast
007ec52958 Add wp_json_encode(), a wrapper for json_encode() that ensures everything is converted to UTF-8.
Change all core calls from `json_encode()` to `wp_json_encode()`.

Fixes #28786.


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


git-svn-id: http://core.svn.wordpress.org/trunk@30055 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-28 18:35:19 +00:00
John Blackbourn
905b6a9d67 Add the ability for a customizer control to render its controls via a JavaScript template. Switches the default color picker control to a JavaScript template. See #29572. Props celloexpressions
Built from https://develop.svn.wordpress.org/trunk@30014


git-svn-id: http://core.svn.wordpress.org/trunk@30014 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-24 16:32:18 +00:00
Dominik Schilling
61819a36ea Customizer: Change instances of "Theme Customizer" to just "Customizer", as the Customizer isn't necessarily theme-specific.
Also capitalize "Customizer".
See also https://make.wordpress.org/core/2014/07/08/customizer-improvements-in-4-0/.

props studionashvegas, tareq1988.
fixes #29947.
Built from https://develop.svn.wordpress.org/trunk@29903


git-svn-id: http://core.svn.wordpress.org/trunk@29658 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-15 17:21:19 +00:00
Mark Jaquith
0d3b83551f Use HTTPS URLs for core.trac.wordpress.org
see #27115
Built from https://develop.svn.wordpress.org/trunk@29788


git-svn-id: http://core.svn.wordpress.org/trunk@29560 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-29 13:28:16 +00:00
Andrew Nacin
de569d83a1 Customizer: Mixed priority sorting for panels and top-level sections.
props celloexpressions.
fixes #28979.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29266 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-14 04:43:16 +00:00
Andrew Nacin
ba9ee74028 Separate WP_Customize_Panel from WP_Customize_Section.
props celloexpressions.
fixes #29197.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29265 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-14 04:40:17 +00:00
Drew Jaynes
a8583d5f19 Fix some words that aren't words.
See #28885.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29232 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-09 19:30:17 +00:00
Scott Taylor
5cab03ab29 Add some docs to Customizer JS.
Props ericlewis.
See #29157.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29229 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-08 23:31:15 +00:00
Dominik Schilling
57c914f75a Customizer: Add meta capability customize which is mapped to edit_theme_options.
You can now allow users to access the Customizer, say for any user who can `edit_posts`, via `map_meta_cap` or `user_has_cap` filter. See ticket for examples.

props westonruter, nacin.
fixes #28605.
Built from https://develop.svn.wordpress.org/trunk@29170


git-svn-id: http://core.svn.wordpress.org/trunk@28954 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-14 19:01:16 +00:00
Drew Jaynes
3af2efdac6 Inline documentation cleanup for 4.0 audit.
phpDoc tweaks for methods added in [28861]:
* `WP_Customize_Manager::panels()` method
* `WP_Customize_Manager::add_panel()` method
* `WP_Customize_Manager::get_panel()` method
* `WP_Customize_Manager::remove_panel()` method

Added in [28970]:
* `WP_Customize_Manager::customize_preview_override_404_status()` method

See #27406 and #28885.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28941 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-14 00:36:15 +00:00
Dominik Schilling
118977aacf Customizer: Use theme support defaults for background images.
props philipjohn.
fixes #28586.
Built from https://develop.svn.wordpress.org/trunk@29103


git-svn-id: http://core.svn.wordpress.org/trunk@28889 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-11 20:27:14 +00:00
Sergey Biryukov
ad7bc20cb1 Customizer: Introduce WP_Customize_Control::active() method to determine whether the control is relevant to the current context (i.e. to the current URL being previewed).
Control can indicate its active state by a subclass overriding the 'active_callback' method, by supplying a callable 'active_callback' argument into the control's constructor, or by filtering 'customize_control_active'.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28839 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-09 23:58:16 +00:00
Sergey Biryukov
2f344b9d3c Prevent sending a 404 status when returning the response for the customize preview, since it causes the jQuery Ajax to fail. Send 200 instead.
props westonruter.
fixes #27992.
Built from https://develop.svn.wordpress.org/trunk@28970


git-svn-id: http://core.svn.wordpress.org/trunk@28759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-03 16:10:15 +00:00
Dominik Schilling
b7c93eb3d0 Customizer: Introduce a "panel" API to organize multiple sections into a one section.
Create a panel via `$GLOBALS['wp_customize']->add_panel( $panel_id, $args )` and use `$panel_id` for the `panel` argument in `$GLOBALS['wp_customize']->add_section( $section_id, $args )`. That's it.
As an example all widget area sections are now summarized into one panel. Feedback appreciated.

props celloexpressions.
see #27406.
Built from https://develop.svn.wordpress.org/trunk@28861


git-svn-id: http://core.svn.wordpress.org/trunk@28662 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-26 20:17:15 +00:00
Scott Taylor
6177a39971 In WP_Customize_Manager::register_controls(), $menu_locations is set and never used.
Built from https://develop.svn.wordpress.org/trunk@28546


git-svn-id: http://core.svn.wordpress.org/trunk@28372 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-22 19:01:15 +00:00
Scott Taylor
3c209b6f56 Add missing access modifiers to methods/members in WP_Customize_*.
See #27881, #22234.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28335 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-19 05:45:16 +00:00
Andrew Nacin
6b579e0d59 Customizer: Properly handle widget settings when activating a previewed theme.
props westonruter, ocean90, gcorne.
fixes #27767.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27955 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-14 22:46:16 +00:00
Dominik Schilling
c707faa639 Widget Customizer: Convert static WP_Customize_Widgets class into instantiated class and merge Options_Transaction into WP_Customize_Widgets.
see #27504.
props westonruter.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27650 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-28 14:07:14 +00:00
Drew Jaynes
c5279336c7 Inline documentation for hooks in wp-includes/class-wp-customize-manager.php.
Props kpdesign for the typo fix.
Fixes #27296.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27280 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-06 14:11:15 +00:00
Andrew Nacin
e853a9cc57 Add widget management to the customizer.
This brings in the Widget Customizer plugin: https://wordpress.org/plugins/widget-customizer/.

props westonruter, shaunandrews, michael-arestad, johnregan3, akeda, topher1kenobe, topquarky, bobbravo2, ricardocorreia. And for good measure, props westonruter.
see #27112.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27266 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-05 20:41:14 +00:00
Andrew Nacin
f31ac162f5 Update the Customizer API inline docs.
props ericlewis.
fixes #27065.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27246 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-04 20:21:14 +00:00
Andrew Nacin
2bd27eae7c Avoid empty header color after enabling header text via Customizer. props obenland, fixes #23761.
git-svn-id: http://core.svn.wordpress.org/trunk@24687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-12 20:41:46 +00:00
Ryan Boren
e4cb7d70bd Introduce customize_save_after action.
Props dovyp, JustinSainton
fixes #24401


git-svn-id: http://core.svn.wordpress.org/trunk@24344 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-24 10:33:30 +00:00
Sergey Biryukov
415a5c60da * Pass ellipsis as a parameter to wp_html_excerpt() instead of appending it manually.
* Consolidate the logic to avoid appending ellipsis if the entire string is shown.
* Show ellipsis after truncated filenames and post titles.

props solarissmoke, bpetty, SergeyBiryukov. fixes #11446.

git-svn-id: http://core.svn.wordpress.org/trunk@24214 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-09 00:22:02 +00:00
Ryan Boren
15a06a35ab Use wp_unslash() instead of stripslashes() and stripslashes_deep(). Use wp_slash() instead of add_magic_quotes().
see #WP21767


git-svn-id: http://core.svn.wordpress.org/trunk@23591 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-03 16:30:38 +00:00
Ryan Boren
43a7e695e9 Revert 23416, 23419, 23445 except for wp_reset_vars() changes. We are going a different direction with the slashing cleanup, so resetting to a clean slate. see #21767
git-svn-id: http://core.svn.wordpress.org/trunk@23554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-01 16:28:40 +00:00
Ryan Boren
cc5ed3a485 Change all core API to expect unslashed rather than slashed arguments.
The exceptions to this are update_post_meta() and add_post_meta() which are often used by plugins in POST handlers and will continue accepting slashed data for now.

Introduce wp_upate_post_meta() and wp_add_post_meta() as unslashed alternatives to update_post_meta() and add_post_meta(). These functions could become methods in WP_Post so don't use them too heavily yet.

Remove all escape() calls from wp_xmlrpc_server. Now that core expects unslashed data this is no longer needed.

Remove addslashes(), addslashes_gpc(), add_magic_quotes() calls on data being prepared for handoff to core functions that until now expected slashed data. Adding slashes in no longer necessary.

Introduce wp_unslash() and use to it remove slashes from GPCS data before using it in core API. Almost every instance of stripslashes() in core should now be wp_unslash(). In the future (a release or three) when GPCS is no longer slashed, wp_unslash() will stop stripping slashes and simply return what is passed. At this point wp_unslash() calls can be removed from core.

Introduce wp_slash() for slashing GPCS data. This will also turn into a noop once GPCS is no longer slashed. wp_slash() should almost never be used. It is mainly of use in unit tests.

Plugins should use wp_unslash() on data being passed to core API.

Plugins should no longer slash data being passed to core. So when you get_post() and then wp_insert_post() the post data from get_post() no longer needs addslashes(). Most plugins were not bothering with this. They will magically start doing the right thing. Unfortunately, those few souls who did it properly will now have to avoid calling addslashes() for 3.6 and newer.

Use wp_kses_post() and wp_kses_data(), which expect unslashed data, instead of wp_filter_post_kses() and wp_filter_kses(), which expect slashed data. Filters are no longer passed slashed data.

Remove many no longer necessary calls to $wpdb->escape() and esc_sql().

In wp_get_referer() and wp_get_original_referer(), return unslashed data.

Remove old stripslashes() calls from WP_Widget::update() handlers. These haven't been necessary since WP_Widget.

Switch several queries over to prepare().

Expect something to break.

Props alexkingorg
see #21767


git-svn-id: http://core.svn.wordpress.org/trunk@23416 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-14 22:51:06 +00:00
Ryan Boren
06ee370814 Pinking shears
git-svn-id: http://core.svn.wordpress.org/trunk@22634 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-17 15:11:29 +00:00
ryan
564a7db2cb phpdoc for Customizer classes and methods. Props bananastalktome. see #21303
git-svn-id: http://core.svn.wordpress.org/trunk@21354 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-26 21:45:33 +00:00
nacin
69112517ed Refresh nonces in the customizer. props koopersmith. see #20876.
git-svn-id: http://core.svn.wordpress.org/trunk@21135 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-26 18:48:18 +00:00
nacin
3a215028ea Allow switch_theme() to take a single $stylesheet argument.
It now effectively has two function definitions:
function switch_theme( $stylesheet )
function switch_theme( $template, $stylesheet )

fixes #21075.



git-svn-id: http://core.svn.wordpress.org/trunk@21131 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-26 05:21:04 +00:00
ryan
2f3839da9c Pinking shears
git-svn-id: http://core.svn.wordpress.org/trunk@21070 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-12 19:27:41 +00:00
nacin
2abd3ad571 Theme Customizer: Validate themes with more than just an existence check.
* The current theme goes through validate_current_theme().
 * If doing a preview of a different theme, we check theme->errors().

Also:
 * Don't attach previewing hooks when previewing the current theme.
Aside from being unnecessary, this prevents issues with a theme with
the error of theme_parent_invalid.
 * Call send_origin_headers() earlier, to allow wp_die( '0' ) to properly
be returned in a domain mapping situation.
 * Fix the 'Save & Activate' message on themes.php.

fixes #20921.



git-svn-id: http://core.svn.wordpress.org/trunk@21069 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-12 18:39:16 +00:00
nacin
64b9b4f940 Do not specify background-image: none when a user removes a custom background
on a theme that has a default background image.

The onus is on the theme to omit the default background-image from style.css,
to allow the user to remove the default background image. Or, the theme can
specify a background-image for the body selector, as long as they then zero
it out for body.custom-background, like so:

{{{
body {
	background-image: url( ... );
}
body.custom-background {
	background-image: none;
}
}}}

This allows the theme to be compatible with the custom background feature
but also gracefully degrade if the background feature is disabled.

This is the same behavior as 3.3; setting a default image has simply been
made more prominent in 3.4. Reverts [21013], also parts of [21001].
see #20448 for change and discussion history.

see #20132, which will now be marked as invalid.

Also, per previous changes in #20448, the custom-background class should not
be shown when only a default color is in use.

fixes #20448.



git-svn-id: http://core.svn.wordpress.org/trunk@21054 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-11 21:25:05 +00:00
nacin
2d07cd3fc5 Theme Customizer: Remove background_image_thumb when saving settings. fixes #20871.
This prevents the background_image and background_image_thumb settings from getting out of sync.
In 3.5 we can consider using background-size on Appearance > Background, eliminating _thumb.



git-svn-id: http://core.svn.wordpress.org/trunk@21053 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-11 20:49:45 +00:00
ryan
808ce796ae * Introduce remove_header_image(), reset_header_image(), set_header_image(), and get_header_image_data() for Custom_Image_Header.
* Handle all set/get of header theme mod through these methods.
* Use these methods in the customizer.

Props kovshenin, nacin, SergeyBiryukov, koopersmith.
fixes #20871


git-svn-id: http://core.svn.wordpress.org/trunk@21037 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-10 00:32:19 +00:00
ryan
9115435213 Customizer: Gravefully handle cookie expipration. Prompt for log in in the preview. Props ocean90, koopersmith, nacin. fixes #20876
git-svn-id: http://core.svn.wordpress.org/trunk@21031 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-08 19:22:11 +00:00
nacin
c819e450a1 Remove the set_theme_mods() method from customize manager. We ended up not using it. see #20871.
git-svn-id: http://core.svn.wordpress.org/trunk@21027 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-07 23:33:00 +00:00
nacin
761273807a Call auth_redirect() for customize.php. props ocean90. fixes #20872.
git-svn-id: http://core.svn.wordpress.org/trunk@21019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-07 15:25:45 +00:00
ryan
d7a9a9a231 Don't resurrect a removed default image when changing colors in the Customizer. Props koopersmith, nacin. fixes #20448
git-svn-id: http://core.svn.wordpress.org/trunk@21013 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-06 21:24:22 +00:00
nacin
98b61d9a17 Theme Customizer: Block non-existent or non-allowed themes, unless the non-allowed theme is the active theme. Support a user having edit_theme_options xor switch_themes. fixes #20852.
git-svn-id: http://core.svn.wordpress.org/trunk@21010 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-06 20:34:24 +00:00
koopersmith
1bfc2ee613 Theme Customizer: Add an inline html5 shiv to the preview to ensure html5 elements render properly. props SergeyBiryukov, fixes #20755.
git-svn-id: http://core.svn.wordpress.org/trunk@20995 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-05 12:26:57 +00:00
ryan
e69299af51 Theme Customizer: Fix race condition in previewer and use message channels. Props koopersmith. fixes #20811
git-svn-id: http://core.svn.wordpress.org/trunk@20988 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-04 15:51:46 +00:00
koopersmith
0df3218cc2 Theme Customizer: Ensure that JS color controls always use real color values, even if the server-side value is a hex value without a hash. fixes #20448, see #19910.
Adds WP_Customize_Setting->sanitize_js_callback and 'customize_sanitize_js_$settingID' filter, to filter values before they're passed to JS using WP_Customize_Setting->js_value().

Adds support for regular hex colors to the color picker.

Changes color methods:
* sanitize_hex_color() accepts 3 and 6 digit hex colors (with hashes) and the empty string.
* sanitize_hex_color_no_hash() accepts 3 and 6 digit hex colors (without hashes) and the empty string.
* maybe_hash_hex_color() ensures that a hex color has a hash, and otherwise leaves the value untouched.


git-svn-id: http://core.svn.wordpress.org/trunk@20936 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-26 18:44:31 +00:00
nacin
de39d08e9f Theme Customizer: 'Header Text Color', not 'Text Color', when referring to the header text in the Colors section. props ocean90. see #19910.
git-svn-id: http://core.svn.wordpress.org/trunk@20933 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-26 15:24:42 +00:00
nacin
db5af1d1f6 Theme Customizer: Introduce a remove_preview_signature() method that we can employ to ensure we do not think a wp_die() is a customizer-generated preview. see #20507.
git-svn-id: http://core.svn.wordpress.org/trunk@20926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-26 04:34:45 +00:00
koopersmith
e178acf108 Theme Customizer: Add a signature to preview requests to be super-double-ultra-sure that the customizer generated the preview. Redirects can be sneaky. fixes #20507, see #19910.
git-svn-id: http://core.svn.wordpress.org/trunk@20925 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-26 04:08:44 +00:00
nacin
ea95fd213b Do not spawn cron or trigger update checks when running the customizer.
Both can slow down the experience.

The alternate cron will issue a redirect which creates more work for the
customizer, but not exit immediately, which means shutdown will be delayed
(see future changeset from koopersmith in #20507 where we check for a token
printed on shutdown to ensure the response came from the customizer).

The update checks could also cause bad data to be sent. In particular, the
currently active theme would be incorrect.

see #20507.



git-svn-id: http://core.svn.wordpress.org/trunk@20924 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-26 03:52:14 +00:00
koopersmith
ae0212699a Theme Customizer: Allow sanitize_hexcolor to accept the empty string. Fixes default assignment on save and bug where header textcolor would remain hidden if loaded hidden. see #19910.
git-svn-id: http://core.svn.wordpress.org/trunk@20915 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-25 20:58:49 +00:00
koopersmith
beb401b533 Theme Customizer: Improve background image control, add correct meta key to custom headers and backgrounds uploaded using the customizer. see #19910.
git-svn-id: http://core.svn.wordpress.org/trunk@20913 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-25 20:26:25 +00:00
koopersmith
9a3b25de9d Theme Customizer: Section reorganization. see #19910.
Now that sections are organized in accordions, group items by size and usage.
Move header/background controls into colors, header image, background image, and title/tagline sections.


git-svn-id: http://core.svn.wordpress.org/trunk@20912 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-25 19:52:54 +00:00
koopersmith
0e67a9a8c4 Theme Customizer: Improve hex color sanitization functions. fixes #20600, see #19910.
Instead of fetching default header_textcolor manually, return null to do so automatically.
Improve hex regex.


git-svn-id: http://core.svn.wordpress.org/trunk@20910 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-25 18:54:57 +00:00