Commit Graph

79 Commits

Author SHA1 Message Date
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