Commit Graph

34 Commits

Author SHA1 Message Date
koopersmith
d5a6d19f22 Theme Customizer: Simplify logic when preparing menu controls. Include instructions to edit menu content in section description. Add string for default state. see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20572 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-23 23:03:09 +00:00
koopersmith
a20bfcd6b1 Theme Customizer: Improve image picker control. see #19910.
Overhauled image pickers:
* Add support for drag and drop uploads to image controls.
* Improve the 'uploaded' tab in image controls: automatically add images uploaded during the current session, hide the tab when no uploaded images exist.
* Move the header image control to the WP_Customize_Header_Image_Control class. Remove wp_customize_print_uploaded_headers() and wp_customize_print_uploaded_headers() functions.
* Abstract the dropdown functionality from the color picker to the .dropdown class.
* In wp.Uploader, unset element keys if passed an empty jQuery collection.



git-svn-id: http://svn.automattic.com/wordpress/trunk@20545 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-20 02:39:55 +00:00
koopersmith
1d73aae054 Remove 'visibility' parameter from WP_Customize_Control. Handle control visibility in JS instead. see #19910.
* Have the header text color picker display only when header_textcolor != 'blank'



git-svn-id: http://svn.automattic.com/wordpress/trunk@20506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-18 17:13:31 +00:00
nacin
9df0620d89 Move to admin.php?customize=on&theme=$stylesheet, rather than juggling both template and stylesheet values. see #19910.
Combine the setup_theme() and customize_previewing() methods. Remove the set_template() and set_stylesheet() methods. Add set_theme() method to WP_Customize to store the working WP_Theme object. We will use this for the stylesheet and template.

Use the WP_Theme display() method when preparing headers for display, not get() or the deprecate properties.



git-svn-id: http://svn.automattic.com/wordpress/trunk@20496 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-17 21:43:47 +00:00
koopersmith
565300e1cd Theme Customizer: Display 'Save and Activate' when switching themes. Add and properties to the WP_Customize class. see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20495 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-17 20:49:39 +00:00
koopersmith
c2fb0c425b Replace all instances of thickbox theme preview with the theme customizer. fixes #20404.
* Use theme customizer in theme install/update screens.
* Separate the customize loader from the customizer. Use wp_customize_loader() to include the loader script and markup.
* Deprecated: wp-admin/js/theme-preview.js is now no longer used by core.

git-svn-id: http://svn.automattic.com/wordpress/trunk@20419 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-10 02:25:03 +00:00
koopersmith
c07ea0e757 Theme Customizer: String change to clarify choosing a static page (remove 'select below'). see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20392 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-07 00:18:02 +00:00
koopersmith
3230ba3987 Theme Customizer: Move 'collapse' button to footer and add a visible text label. see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20391 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-07 00:10:22 +00:00
koopersmith
79f8b89fbc Theme Customizer: Move upload and image controls to subclasses. see #19910.
Instead of grouping together every control parameter into a single  array and passing them all to the JS, use subclasses with custom parameters to implement additional PHP functionality and the  parameter to send only the necessary variables to the JavaScript control.

Replaces WP_Customize_Control->control_params with WP_Customize_Control->json and WP_Customize_Control->to_json(). The to_json() method refreshes the json array passed to the JavaScript control (set to control.param by default).

Creates WP_Customize_Upload_Control and WP_Customize_Image_Control.

git-svn-id: http://svn.automattic.com/wordpress/trunk@20319 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-29 06:35:54 +00:00
koopersmith
bffbb455b1 Theme Customizer: Fire WP_Customize->customize_preview_init on wp_loaded instead of template_redirect. props nacin, see #19910.
Certain customize settings (such as show_on_front and other static front page features) need to be overridden before template_redirect.

git-svn-id: http://svn.automattic.com/wordpress/trunk@20306 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-28 15:04:11 +00:00
koopersmith
1cc5fea4bb Theme Customizer: Move 'Site Title/Tagline' section to the top of the list. Add specific priorities to all sections. see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20303 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-28 09:57:55 +00:00
koopersmith
30d798ec8d Create WP_Customize_Control to separate the process of rendering a control from fetching, previewing, and saving its values. see #19910.
Many-to-many mapping between settings and controls.
* Settings and controls have been separated in both the PHP (WP_Customize_Setting, WP_Customize_Control) and the JS (wp.customize.Setting, wp.customize.Control).
* While most settings are tied to a single control, some require multiple controls. The 'header_textcolor' control is a good example: to hide the header text, header_textcolor is set to 'blank'.

Add 'Display Header Text' control.

A handful of miscellaneous bugfixes along the way.

Notes:
* Controls should be separated out a bit more; juggling type-specific arguments in the switch statement is rather inelegant.
* Page dropdowns are currently inactive and need to be re-linked.

git-svn-id: http://svn.automattic.com/wordpress/trunk@20295 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-28 04:14:09 +00:00
koopersmith
4e2cbd6a4d Theme Customizer: Add 'choose image' functionality to image controls. Rough first pass, using header images as an example. see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20290 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-25 21:18:32 +00:00
koopersmith
6213bdfa52 Theme Customizer: First pass at image controls. Use header_image as the initial case. Add a 'removed' control param for upload/image controls to map 'removed' to a value other than the empty string. see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20278 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-24 04:35:13 +00:00
koopersmith
cca689308c Theme Customizer: Add WP_Customizer_Setting->control_params, and wp.customize.Control.params to allow settings to pass arbitrary parameters to controls. Add the 'context' parameter to wp.customize.UploadControl. see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20276 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-24 01:02:29 +00:00
koopersmith
9c0fc2fa0a Theme Customizer: Change 'Random Image' control to be a proper 'Header Image' control. First step to integrating header images. see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-23 22:43:00 +00:00
koopersmith
7ce012ef87 Theme Customizer: Use a more complex name for the save parameter to prevent the customizer from clashing with plugins. see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20266 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-23 00:16:46 +00:00
koopersmith
b6e48e5d81 Theme Customizer: Add background repeat, position, and attachment settings. Change visibility parameter to accept a string or array( , ). see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20263 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-22 08:07:44 +00:00
koopersmith
5443bec597 Theme Customizer: Add a WP_Customize_Setting->visibility parameter to show/hide a control based upon the value of another control. Also shifts rendering the setting wrapper element into WP_Customize_Setting->render() and adds WP_Customize_Setting->render_content(). see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20260 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-22 07:17:26 +00:00
koopersmith
1d19466272 Theme Customizer: Make dropdown-pages a native customize control. see #19910.
While the customize_render_control- action has been removed, we could still accomplish this with the customize_render_setting action. That said, in this case, avoiding native integration was a matter of minor semantics that ended in the same result.

git-svn-id: http://svn.automattic.com/wordpress/trunk@20254 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-22 04:14:26 +00:00
koopersmith
dee0600251 Theme Customizer: If a section has no settings, prevent it from being rendered. see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20251 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-22 02:58:07 +00:00
koopersmith
dbd50b0972 Theme Customizer: Numerous API refinements and bugfixes. Add a theme_supports check for header_textcolor. see #19910.
* prepare_controls() now removes any settings and sections that return false for check_capabilities().
* Added maybe_render() methods to both settings and sections that call the protected render() methods.
* Stop firing front-end preview functionality when rendering the controls.
* Merged the WP_Customize_Setting->_render_type() method into WP_Customize_Setting->render().
* Removed the 'customize_render_control-' hook; use 'customize_render_setting' instead.
* Added a  property to sections and settings so they no longer rely on the  global. Hooray for dependency injection.
* Shifted calls to WP_Customize_Setting->enqueue() to the 'customize_controls_enqueue_scripts' action.
* Added a theme_supports check for the header_textcolor setting.

git-svn-id: http://svn.automattic.com/wordpress/trunk@20248 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-21 22:55:43 +00:00
nacin
6593186cb7 Introduce new registration methods for custom headers and custom backgrounds. Backwards compatible, but old methods will be deprecated. see #20249. see #17242.
Custom header: Use add_theme_support('custom-header', $args) instead of add_custom_image_header(). Deprecates all use of constants.
 * HEADER_TEXTCOLOR is now (string) 'default-text-color'.
 * NO_HEADER_TEXT is nowi ! (bool) 'header-text'.
 * HEADER_IMAGE_WIDTH (and _HEIGHT) are now (int) 'width' and 'height'.
 * HEADER_IMAGE is now (string) 'default-image'.
 * The 3.4 arguments 'suggested-width' and 'suggested-height' are now just 'width' and 'height' (they are "suggested" when flex-width and flex-height are set).
 * Callback arguments for add_custom_image_header() can now be passed to add_theme_support().

Custom background: Use add_theme_support('custom-background, $args) instead of add_custom_background(). Deprecates all use of constants.
 * BACKGROUND_COLOR is now (string) 'default-color'.
 * BACKGROUND_IMAGE is now (string) 'default-image'.
 * Callback arguments for add_custom_background() can now be passed to add_theme_support().

Inheritance: add_theme_support() arguments for custom headers and custom backgrounds is a first-one-wins situation. This is not an unusual paradigm for theming as a child theme (which is included first) overrides a parent theme.
 * Once an argument is explicitly set, it cannot be overridden. You must hook in earlier and set it first.
 * Any argument that is not explicitly set before WP is loaded will inherit the default value for that argument.
 * It is therefore possible for a child theme to pass minimal arguments as long as the parent theme specifies others that may be necessary.
 * Allows for a child theme to alter callbacks for <head> and preview (previously, calling add_custom_image_header more than once broke things).
 * The just-in-time bits ensure that arguments fall back to default values, that the values of all constants are considered (such as one defined after an old add_custom_image_header call), and that all constants are defined (so as to be backwards compatible).

get_theme_support(): Introduce new second argument, which headers and backgrounds leverage to return an argument. current_theme_supports() already supported checking the truthiness of the argument.
 * For example, get_theme_support( 'custom-header', 'width' ) will return the width specified during registration.
 * If you had wanted the default image, use get_theme_support( 'custom-header', 'default-image' ) instead of HEADER_IMAGE. 

Deprecate remove_custom_image_header(), remove_custom_background(). Use remove_theme_support('custom-header'), 'custom-background'.

Deprecate short-lived custom-header-uploads internal support; this is now (bool) 'uploads' for add_theme_support().

New 3.4 functions renamed or removed: Rename get_current_header_data() to get_custom_header(). Remove get_header_image_width() and _height() in favor of get_custom_header()->width and height.



git-svn-id: http://svn.automattic.com/wordpress/trunk@20212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-19 17:12:44 +00:00
nacin
4bfef892c7 Theme Customizer: In customize_control_dropdown_pages(), remove bad translation. Replace with proper customize-control- markup. see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20210 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-19 13:38:43 +00:00
koopersmith
1ee1b90e05 Theme Customizer: Move section descriptions to the title attribute of the section name. see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20182 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-15 05:32:40 +00:00
koopersmith
6bda61536e Theme Customizer: Improve sidebar CSS. Display most elements inline, refine padding/line-heights. see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20181 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-15 05:30:11 +00:00
koopersmith
c06576d410 Theme Customizer: First pass for upload controls, using background image as an example. Add a wrapper for Plupload that allows for custom upload UIs. see #19910.
wp.Uploader is a wrapper that provides a simple way to upload an attachment (using the wp_ajax_upload_attachment handler). It is intentionally decoupled from the UI. When an upload succeeds, it will receive the attachment information (id, url, meta, etc) as a JSON response. If the upload fails, the wrapper handles both WordPress and plupload errors through a single handler.

As todos, we should add drag classes for the uploader dropzone and account for the rough 100mb filesize limit in most browsers. The UI for the customizer upload controls could be improved as well.

git-svn-id: http://svn.automattic.com/wordpress/trunk@20179 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-15 04:14:05 +00:00
koopersmith
d4f20e47b7 Theme Customizer: Move contents of customize.loader.css to wp-admin.css. Make markup/CSS for the full-screen overlay modular. see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-07 03:19:35 +00:00
koopersmith
306433c25b Theme Customizer: First pass at using postMessage for background color. Fix instance where preview.targetWindow would become inaccurate. Initialize setting values in customize-preview.js. see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20123 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-06 02:49:02 +00:00
koopersmith
efafcf2fc9 Theme Customizer: Improve markup and CSS for the return/collapse actions and the action bars within the customize controls form. see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20110 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-04 04:57:24 +00:00
koopersmith
db721d86c7 Theme Customizer: Use wp_loaded for customize setting registration. see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20058 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-01 00:14:51 +00:00
koopersmith
2f229d3b7c Theme Customizer: Use a late priority when registering customize settings to ensure we catch any theme settings added earlier on init (such as nav menus). see #19910.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20055 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-29 23:09:38 +00:00
nacin
d130a63e25 Introduce WP_Theme, wp_get_themes(), and wp_get_theme() to replace get_themes(), get_theme(), get_theme_data(), current_theme_info(), and others.
* Getters and Helpers: Introduces a series of methods to allow for easy generation of headers for display, and other theme metadata, including page templates.
 * Screenshots: Handles support for multiple screenshots. (see # Additional screenshots must be PNG and start with screenshot-2.png, and be sequential to be counted. see #19816.
 * Error Handling: Broken themes have a WP_Error object attached to them.
 * Caching: Introduces a wp_cache_themes_persistently filter (also in [20020]) to enable persistent caching of all filesystem and sanitization operations normally handled by WP_Theme (and formerly get_file_data() and get_themes()). Themes are cached individually and across five different cache keys for different data pieces.
 * Compatibility: A WP_Theme object is backwards compatible with a theme's array formerly returned by get_themes() and get_theme(), and an stdClass object formerly returned by current_theme_info().
 * i18n/L10n: Theme headers are now localizable with proper Text Domain and Domain Path headers, like plugins. (Language packs may remove the requirement for headers.) For page templates, see #6007 (not fixed yet, but will be easy now). For headers, fixes #15858.
 * PHP and CSS files: New methods that fetch a list of theme files (for the theme editor) only on demand, rather than only loading them into memory. fixes #11214.

Functions deprecated:
 * get_themes(), get_allowed_themes() and get_broken_themes() -- use wp_get_themes()
 * get_theme() and current_theme_info() -- use wp_get_theme()
 * get_site_allowed_themes() -- use WP_Theme::get_allowed_on_network()
 * wpmu_get_blog_allowedthemes() -- use WP_theme::get_allowed_on_site()

see also [20016], [20018], [20019], [20020], [20021], [20022], [20025], [20026], [20027]. also fixes #19244.

see #20103.



git-svn-id: http://svn.automattic.com/wordpress/trunk@20029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 21:24:44 +00:00
koopersmith
c832f904ae Introduce new theme customizer to replace theme preview. Rough first pass. props koopersmith, ocean90. see #19910.
Merges in http://plugins.svn.wordpress.org/gandalf/branches/dev/ rev 510148.

git-svn-id: http://svn.automattic.com/wordpress/trunk@19995 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-25 04:12:43 +00:00