Commit Graph

137 Commits

Author SHA1 Message Date
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 0b921efe38 Use wp_hash() instead of AUTH_KEY in WP_Customize_Widgets::get_instance_hash_key().
props juliobox.
fixes #28783.
Built from https://develop.svn.wordpress.org/trunk@29028


git-svn-id: http://core.svn.wordpress.org/trunk@28816 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-08 17:17:14 +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
Andrew Nacin dbca0c5e15 Widgets: Remove create_function() from the customizer class.
props westonruter.
fixes #27805.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27974 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-16 00:11:35 +00:00
Andrew Nacin efe36dbd5f Add missing string translation in widgets.
see #27453, #27112.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27971 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-16 00:01:14 +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
Drew Jaynes fe6761ccf3 Inline documentation for hooks in wp-includes/class-wp-customize-widgets.php
Fixes #27531.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27948 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-14 18:41:17 +00:00
Dominik Schilling 3f3a1380d2 Widget Customizer: Fix widget filtering.
props westonruter.
fixes #27451.
Built from https://develop.svn.wordpress.org/trunk@28044


git-svn-id: http://core.svn.wordpress.org/trunk@27874 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-08 08:12:15 +00:00
Dominik Schilling fabc65b787 Widget Customizer: Move `WidgetCustomizer` to `wp.customize.Widgets`. First pass.
see #27690.
Built from https://develop.svn.wordpress.org/trunk@27985


git-svn-id: http://core.svn.wordpress.org/trunk@27815 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-07 09:04:14 +00:00
Dominik Schilling 29b1f9a0de Widget Customizer: Remove leading/trailing whitespace to prevent jQuery migrate warning.
props gcorne.
fixes #27689.
Built from https://develop.svn.wordpress.org/trunk@27973


git-svn-id: http://core.svn.wordpress.org/trunk@27803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-06 20:40:15 +00:00
Dominik Schilling 90e62bf6ac Widget Customizer: Minor code cleanup.
* Remove type hinting from `WP_Customize_Widgets`
* Rename `inject_preview_css` to `print_preview_css`
* Remove stray `@todo`

fixes #27534.
Built from https://develop.svn.wordpress.org/trunk@27968


git-svn-id: http://core.svn.wordpress.org/trunk@27798 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-06 18:54:14 +00:00
Dominik Schilling ecee3bcb67 Widget Customizer: Remove leading underscores from public methods.
Fix also an incorrect hook name in `stop_capturing_option_updates()`.

props DrewAPicture.
see #27534.
Built from https://develop.svn.wordpress.org/trunk@27910


git-svn-id: http://core.svn.wordpress.org/trunk@27741 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-02 18:31:15 +00:00
Dominik Schilling cde6d602ea Widget Customizer: Improve plugin compatibility.
Some plugins are using custom scripts and styles for there widgets. These are available on the Widgets screens, but not in the Customizer yet.
Scripts and styles can be enqueued via: 
* `admin_enqueue_scripts`
* `admin_print_scripts` and `admin_print_scripts-widgets.php`
* `admin_print_styles` and `admin_print_styles-widgets.php`
* `admin_print_footer_scripts` and `admin_footer-widgets.php`
All this hooks are now called in the Customizer too.

Previously we have add the `#widgets-right` ID to a container div via jQuery. Remember: `#widgets-right` exists on the Widgets screen and is used by many plugins to do event delegation from that element.
But since our script files are loaded in the footer, the JavaScript way is a bit late for some plugins.
We have decided to add a `div#widgets-right` container element to customizer. "Less hacky hack."

props westonruter, ocean90. Thanks dpe415 for testing.
fixes #27619.
Built from https://develop.svn.wordpress.org/trunk@27907


git-svn-id: http://core.svn.wordpress.org/trunk@27738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-02 17:04:14 +00:00
Drew Jaynes 12e182d929 Coding standards and readability spacing for WP_Customize_Widgets.
Also explicitly re-mark `_capture_filter_pre_update_option()` and `_capture_filter_pre_get_option()` as public.

See #27534.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27735 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-02 06:12:16 +00:00
Drew Jaynes 44c886045f Second-pass inline documentation improvements for WP_Customize_Widgets.
See #27534.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27734 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-02 05:45:16 +00:00
Dominik Schilling da5339da30 Widget Customizer: Add a label to widget search.
props SergeyBiryukov.
fixes #27590.
Built from https://develop.svn.wordpress.org/trunk@27860


git-svn-id: http://core.svn.wordpress.org/trunk@27691 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-30 15:47:16 +00:00
Dominik Schilling 016e1f53ba Widget Customizer: Remove strings from WP_Error returns and go with just IDs.
fixes #27419.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27685 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-29 21:44:14 +00:00
Drew Jaynes 5613b40981 The `sidebar_admin_setup` hook should only be documented once in wp-admin/widgets.php. All others are duplicates.
See #25374, #25501, #27531.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27657 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-28 19:47:15 +00:00
Sergey Biryukov 3a4d9c5953 Widget Customizer: Simplify conditions in setup_widget_addition_previews().
see #27534.
Built from https://develop.svn.wordpress.org/trunk@27820


git-svn-id: http://core.svn.wordpress.org/trunk@27654 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-28 17:09:15 +00:00
Dominik Schilling c2f839b7b6 Widget Customizer: Simplify nonces.
see #27534.
Built from https://develop.svn.wordpress.org/trunk@27819


git-svn-id: http://core.svn.wordpress.org/trunk@27653 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-28 15:35:15 +00:00
Dominik Schilling ffa6562965 Widget Customizer: Remove `UPDATE_WIDGET_AJAX_ACTION` and `UPDATE_WIDGET_NONCE_POST_KEY` constants.
see #27534.
Built from https://develop.svn.wordpress.org/trunk@27818


git-svn-id: http://core.svn.wordpress.org/trunk@27652 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-28 15:02:13 +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
Dominik Schilling ebdd64f6ad Widget Customizer: Set hightlight color to blue. Same color as in [27741].
fixes #27358.
Built from https://develop.svn.wordpress.org/trunk@27814


git-svn-id: http://core.svn.wordpress.org/trunk@27648 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-28 13:33:14 +00:00
Dominik Schilling a2eb248e0b Widget Customizer: First pass for inline docs.
props DrewAPicture.
see #27534.
Built from https://develop.svn.wordpress.org/trunk@27753


git-svn-id: http://core.svn.wordpress.org/trunk@27590 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-26 22:29:15 +00:00
Dominik Schilling ea6c9a5515 Widget Customizer: Improve widget highlighting.
* Prefix box-shadow in inject_preview_css()
* Remove border-radius in inject_preview_css()
* Prevent hidden box-shadows in Customizer

see #27358.
Built from https://develop.svn.wordpress.org/trunk@27702


git-svn-id: http://core.svn.wordpress.org/trunk@27541 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-25 11:48:14 +00:00
Dominik Schilling 21158f33f7 Widget Customizer: Fix 'WidgetCustomizerPreview' is undefined error in IE8/9.
* Move `WidgetCustomizerPreview` to `wp.customize.WidgetCustomizerPreview`
* Move `WidgetCustomizerPreview_exports` to export_preview_data()
* Use `_wpWidgetCustomizerPreviewSettings` to transfer settings to `wp.customize.WidgetCustomizerPreview`

see #27485.
Built from https://develop.svn.wordpress.org/trunk@27653


git-svn-id: http://core.svn.wordpress.org/trunk@27496 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-22 21:04:15 +00:00
Dominik Schilling 9b0ec406d1 Widget Customizer: Improve error handling. First pass.
* Replace Widget_Customizer_Exception with WP_Error
* Call Previewer.cheatin() to show the cheating message if a user can't change widgets
* Call Previewer.login() to show the login form if a user is logged out
* Show a generic error message on failures

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


git-svn-id: http://core.svn.wordpress.org/trunk@27495 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-22 20:55:18 +00:00
Andrew Nacin deb8779af5 More translation cleanups.
Affects widgets (see #27112), custom headers (see #21785), theme installer (see #27055, reverts [27614]), and some media stuff. Untranslates some complicated strings that need additional study.

see #27453.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27463 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-19 08:18:14 +00:00
Dominik Schilling a96b9c80b5 Widget Customizer: Remove unused vars.
see #27112.
Built from https://develop.svn.wordpress.org/trunk@27588


git-svn-id: http://core.svn.wordpress.org/trunk@27431 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-18 18:35:16 +00:00
Dominik Schilling f056bd6f04 Widget Customizer: Remove special filter for Settings Revisions plugin.
see #27112.
Built from https://develop.svn.wordpress.org/trunk@27586


git-svn-id: http://core.svn.wordpress.org/trunk@27429 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-18 16:48:14 +00:00
Dominik Schilling aaf723a8a8 Widget Customizer: Move preview script to wp_default_scripts().
Built from https://develop.svn.wordpress.org/trunk@27585


git-svn-id: http://core.svn.wordpress.org/trunk@27428 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-18 15:31:16 +00:00
Dominik Schilling 64af78ca43 Widget Customizer: Restore highlighting of widgets in preview.
props westonruter.
see #27358.
Built from https://develop.svn.wordpress.org/trunk@27584


git-svn-id: http://core.svn.wordpress.org/trunk@27427 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-18 15:21:15 +00:00
Dominik Schilling 6b27155163 Widget Customizer: Make temp hooks final and add inline docs.
New hooks are `dynamic_sidebar_before`, `dynamic_sidebar_after`, `dynamic_sidebar_has_widgets ` and `is_active_sidebar`.
Remove obsolete use of hacky dynamic_sidebar hook.

props westonruter, DrewAPicture.
fixes #25368.
Built from https://develop.svn.wordpress.org/trunk@27543


git-svn-id: http://core.svn.wordpress.org/trunk@27386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-14 20:31:14 +00:00
Dominik Schilling ca892563a6 Widget Customizer: Move widget area sections to bottom.
Since a theme can have a lot of widget areas and we don't want to bury third-party sections, bump the widget sections to the bottom with a priority of 1000+. Fixes also the ordering.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27384 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-14 20:01:14 +00:00
Dominik Schilling f48e3f5719 Widget Customizer: Move style/script registration to script loader. Update Gruntfile.js.
fixes #27356.
Built from https://develop.svn.wordpress.org/trunk@27525


git-svn-id: http://core.svn.wordpress.org/trunk@27368 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-13 19:41:14 +00:00
Dominik Schilling f46a085f7c Widget Customizer: Use ?wp_customize=on.
Let _wp_customize_include() handle customizer initialisation.
Sets also the priority for the Add Widget and Reorder buttons and removes debug cruft.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27367 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-13 18:38:14 +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