Commit Graph

41 Commits

Author SHA1 Message Date
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
koopersmith
a5ee470df7 Theme Customizer: Improve default background property handling. see #20600, #19910.
If the custom background default wp-head-callback (_custom_background_cb) is used, we use postMessage for all custom background properties. Otherwise, we use full refreshes.

When using postMessage, the preview recalculates the custom background CSS block, allowing it to omit CSS values when they are not present and fall back on the original CSS.


git-svn-id: http://core.svn.wordpress.org/trunk@20908 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-25 18:41:22 +00:00
koopersmith
f6882e94ef Theme Customizer: Add a base element to the preview's head element to allow relative links (root, hash, and query strings). see #20507, #19910.
git-svn-id: http://core.svn.wordpress.org/trunk@20863 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-24 02:07:16 +00:00
koopersmith
46f03144b0 Theme Customizer: Properly handle redirects in the preview by setting wp_redirect_status to 200. props nacin, see #20507, #19910.
git-svn-id: http://core.svn.wordpress.org/trunk@20861 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-24 01:48:32 +00:00
nacin
0f259eaae1 Remove temporary magic call method in favor of theme(), settings(), controls(), and sections() methods for WP_Customize_Manager. fixes #20736.
git-svn-id: http://core.svn.wordpress.org/trunk@20860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-23 21:21:29 +00:00
nacin
95e1c32720 Customize API shuffling.
* Rename WP_Customize to WP_Customize_Manager.
 * Move customize-controls.php to wp-admin/customize.php.
 * Make customize.php the formal entry point, rather than admin.php?customize=on.
 * Rename is_current_theme_active() to is_theme_active().
 * Add getters for the theme, settings, controls, and sections properties.
 * Allow customize.php (no ?theme=) to load the active theme. Not used yet.
see #20736.



git-svn-id: http://core.svn.wordpress.org/trunk@20852 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-23 17:56:42 +00:00