Commit Graph

237 Commits

Author SHA1 Message Date
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
Drew Jaynes
cc82d1bea4 Fix a typo in the PHPDoc for wp_register_sidebar_widget().
Props Jonnyauk.
Fixes #29007.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29058 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-23 17:21:18 +00:00
Sergey Biryukov
f281e72922 is_active_widget() should skip orphaned widgets.
props Ninos Ego.
fixes #28810.
Built from https://develop.svn.wordpress.org/trunk@29064


git-svn-id: http://core.svn.wordpress.org/trunk@28850 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-10 15:49:14 +00:00
Scott Taylor
146810ed8f Add public access modifier to methods/members of WP_Widget and WP_Widget_Factory.
See #27881, #22234.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28353 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-19 15:42:13 +00:00
Scott Taylor
06373a6f32 In WP_Widget::update_callback(), $sidebars_widgets is unused.
See #27882.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28166 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-07 03:52:15 +00:00
Andrew Nacin
f81deab036 Fix logic inversion in [28124] to ensure widgets stay with themes during a theme switch.
fixes #27897.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-19 18:12:15 +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
1ce1882a8a Fix whitespace around $GLOBALS['_wp_deprecated_widgets_callbacks'] .
Built from https://develop.svn.wordpress.org/trunk@27967


git-svn-id: http://core.svn.wordpress.org/trunk@27797 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-06 18:50:14 +00:00
Dominik Schilling
598907559c WP_Widget: Introduce is_preview() method.
With the Widget Customizer it's possible that previewed widgets can leak data outside of Customizer, when the widget uses the cache API.
The Customizer calls the regular update callback which should already refresh the cache. Since cache additions aren't blocked yet the cache can be filled with preview data.
To prevent this issue `WP_Widget::is_preview()` will return true, when `$wp_customize->is_preview()` returns true. If `is_preview()` is true, cache additions are suspended via `wp_suspend_cache_addition()`. Make sure your object cache drop-in has implemented `wp_suspend_cache_addition()`.

`is_preview()` can/should also be used inside `WP_Widget::widget()`, see WP_Widget_Recent_Posts or WP_Widget_Recent_Comments for examples.

For more info see IRC logs: http://irclogs.wordpress.org/chanlog.php?channel=wordpress-dev&day=2014-04-02&sort=asc#m824279

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


git-svn-id: http://core.svn.wordpress.org/trunk@27796 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-06 18:48:16 +00:00
Drew Jaynes
7efc48c365 Inline documentation for hooks in wp-includes/widgets.php.
Props eliorivero and Nessworthy for the initial patches. Props kpdesign.
Fixes #27129.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27701 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-31 07:30:16 +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
Sergey Biryukov
45838c805c Remove unused code from WP_Widget::update_callback().
props OriginalEXE.
fixes #24733.
Built from https://develop.svn.wordpress.org/trunk@27224


git-svn-id: http://core.svn.wordpress.org/trunk@27081 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-21 18:51:13 +00:00
Drew Jaynes
cd8cedc40d First there were two, and now there are three -- in the @since versions that came before and that shall be. And so it will be, says nacin.
Props JustinSainton, SergeyBiryukov, DrewAPicture.
Fixes #26713.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26754 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-24 18:57:12 +00:00
Andrew Nacin
50e88d2cfb Temporary hooks for the widgets feature team in dynamic_sidebar() and is_active_sidebar().
props westonruter.
fixes #25368.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25497 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-23 20:14:10 +00:00
Dominik Schilling
b7c13e27c2 Remove reference to unused variable. fixes #24965.
git-svn-id: http://core.svn.wordpress.org/trunk@24988 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-06 09:38:24 +00:00
Andrew Nacin
33f018ec0c Clean up the documentation for dynamic_sidebar(). props johnbillion, fixes #24720.
git-svn-id: http://core.svn.wordpress.org/trunk@24982 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-05 22:03:49 +00:00
Andrew Nacin
6a01479ba1 Remove reference to unused global. props jdgrimes. fixes #24807.
git-svn-id: http://core.svn.wordpress.org/trunk@24978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-05 21:42:48 +00:00
Sergey Biryukov
90aca60345 Move the PHP4 constructor below the PHP5 one to avoid E_STRICT message. props uuf6429, iandunn. fixes #20801.
git-svn-id: http://core.svn.wordpress.org/trunk@24296 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-19 12:32:20 +00:00
Andrew Nacin
92b4636e17 Required arguments can't follow optional arguments.
Make required arguments optional in confirm_blog_signup().

Mark arguments as required in _future_post_hook(), the walker method display_element(), get_author_link() (deprecated), and the WP_Widget constructor.

props rlerdorf.
see #24210.



git-svn-id: http://core.svn.wordpress.org/trunk@24126 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-29 13:26:31 +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
Helen Hou-Sandí
42c9c61003 Minor phpdoc fixes for register_sidebar(). props SergeyBiryukov. fixes #22905.
git-svn-id: http://core.svn.wordpress.org/trunk@23199 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-23 22:11:37 +00:00
Helen Hou-Sandí
a3b736bdd2 Refresh phpdoc for register_sidebar(). props jeremyfelt, SergeyBiryukov. fixes #22905.
git-svn-id: http://core.svn.wordpress.org/trunk@23196 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-23 16:18:16 +00:00
Ryan Boren
77518e9c71 Objects no longer need to be explicitly passed by ref to call_user_func*() to be callable. Props wonderboymusic. fixes #21865
git-svn-id: http://core.svn.wordpress.org/trunk@22118 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-04 20:00:16 +00:00
ryan
616c35e71c One newline is enough.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19684 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-05 20:10:39 +00:00
ryan
d1ba11c7d1 Update some @since. Props dgwyer. fixes #19638
git-svn-id: http://svn.automattic.com/wordpress/trunk@19673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-04 19:03:33 +00:00
azaozz
a55d901b12 Check the sidebar class for orphaned sidebars, match sidebars by id while retrieving orphans and the theme has not changed, props SergeyBiryukov, fixes #19350
git-svn-id: http://svn.automattic.com/wordpress/trunk@19455 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-26 06:16:43 +00:00
azaozz
2c9244965a Prioritize the saved data over the current data when restoring widget positions, props SergeyBiryukov, see #19092
git-svn-id: http://svn.automattic.com/wordpress/trunk@19340 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-18 19:50:17 +00:00
azaozz
83e2ae14d4 Don't try to convert empty widget settings from old format, props SergeyBiryukov, fixes #19091
git-svn-id: http://svn.automattic.com/wordpress/trunk@19333 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-18 06:11:38 +00:00
azaozz
84c1617da2 When restoring sidebars after switching back to an old theme, make sure the saved data matches the theme's current sidebars, fixes #19092
git-svn-id: http://svn.automattic.com/wordpress/trunk@19332 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-18 06:00:29 +00:00
ryan
62afab8db3 Pinking shears
git-svn-id: http://svn.automattic.com/wordpress/trunk@19054 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-24 19:13:23 +00:00
nacin
89c0895887 new does not require by reference.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18995 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-18 20:20:59 +00:00
ryan
2edc82cd61 * Move the old sidebars_widgets array upgrade code to wp-admin/includes/upgrade.php
* Avoid infinite loop with wp_get_sidebars_widgets()
* Remove two unneeded wp_get_sidebars_widgets() calls
* Remove unused $wp_registered_sidebars variable from wp_get_sidebars_widgets().
* Combine  a couple of !empty( $sidebars_widgets ) checks in retrieve_widgets()
Props SergeyBiryukov, lancewillett. fixes #17979 #18598


git-svn-id: http://svn.automattic.com/wordpress/trunk@18821 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-29 21:41:22 +00:00
westi
1b6398d64b A little bit of whitespace keeps the code readable.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18678 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-15 10:09:45 +00:00
azaozz
c00346820f Make check_theme_switched() run an action so this enhancement is available to plugins and themes too, see #17979
git-svn-id: http://svn.automattic.com/wordpress/trunk@18655 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-08 20:07:15 +00:00
azaozz
b79223097c Use theme mods instead of transients for storing the previous theme's widgets config, props aaroncampbell, see #17979
git-svn-id: http://svn.automattic.com/wordpress/trunk@18654 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-08 19:25:20 +00:00
duck_
2f51b9be0d Fix typos in documentation (wp-includes/[i-z]). See #18560.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18639 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-05 19:08:15 +00:00
azaozz
4852c5887f Avoid losing widgets when switching themes - take one, props aaroncampbell, see #17979
git-svn-id: http://svn.automattic.com/wordpress/trunk@18630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-02 22:13:55 +00:00
nbachiyski
abe8b47351 Explicitly globalize some variables, so that unit tests can run WordPress inside a function. Fixes #17749
git-svn-id: http://svn.automattic.com/wordpress/trunk@18532 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-08-11 04:45:14 +00:00
nacin
0fc43cf648 s/displayied/displayed/. props kawauso, fixes #17633.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18096 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-06-01 16:44:13 +00:00
ryan
6827de6cd9 Remove PHP4 constructors. Props scribu. fixes #16768
git-svn-id: http://svn.automattic.com/wordpress/trunk@17655 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-18 21:46:57 +00:00
nacin
d9abef8ea3 Bail early in dynamic_sidebar() if there are no sidebars. fixes #14816.
git-svn-id: http://svn.automattic.com/wordpress/trunk@17545 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-03-23 18:59:52 +00:00
nacin
d30ef21e80 Revert [15994] for now, as the default widgets then go through an identity crisis. see #14876, #15493.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16521 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-21 13:48:35 +00:00
nacin
8f1f98fa02 Return empty array in wp_get_sidebars_widgets() if no sidebars are defined. fixes #14876.
git-svn-id: http://svn.automattic.com/wordpress/trunk@15994 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-10-27 01:56:54 +00:00
nacin
5a20c05d27 Phpdoc argument/@param cleanups. props duck_, see #14783.
git-svn-id: http://svn.automattic.com/wordpress/trunk@15590 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-09-07 11:21:11 +00:00
ryan
7b7243d94a Strip trailing whites.
git-svn-id: http://svn.automattic.com/wordpress/trunk@14404 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-05-03 20:26:11 +00:00
ryan
18513489e2 Hooks for the widgets api. Props ptahdunbar. fixes #12546
git-svn-id: http://svn.automattic.com/wordpress/trunk@14382 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-05-03 19:01:43 +00:00
markjaquith
4a1e7550a3 Make sure sidebars_widgets is an array. If it is a string (no idea how, but it happens), we get a fatal error
git-svn-id: http://svn.automattic.com/wordpress/trunk@14320 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-04-30 17:37:42 +00:00
nacin
a6d816df0b Use wp_parse_args in register_sidebar. fixes #11836, props scribu.
git-svn-id: http://svn.automattic.com/wordpress/trunk@14154 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-04-18 15:32:39 +00:00
ryan
c2a6f28bf5 Enable nav menu admin if theme supports widgets. Show notice if theme supports widgets but not nav-menus. see #11817
git-svn-id: http://svn.automattic.com/wordpress/trunk@13810 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-03-24 18:35:31 +00:00