Drew Jaynes
31f52091ec
Docs: Clarify the file header summary for wp-includes/widgets.php, the top-level file for the core Widgets API.
...
Also fixes some minor grammar issues in the file description.
See #33413 . See #33701 .
Built from https://develop.svn.wordpress.org/trunk@33872
git-svn-id: http://core.svn.wordpress.org/trunk@33840 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-03 03:14:20 +00:00
Drew Jaynes
fb75e4b938
Docs: Add inline-docblocks for the require_once()
calls that now bring in the WP_Widget
and WP_Widget_Factory
classes, as well as general core widgets functionality, as of [33746].
...
See [33746]. See #33413 .
Built from https://develop.svn.wordpress.org/trunk@33758
git-svn-id: http://core.svn.wordpress.org/trunk@33726 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-26 08:01:20 +00:00
Scott Taylor
c3565b2cba
Widgets: move classes into their own files, widgets.php
loads the new files, so this is 100% BC if someone is loading widgets.php
directly. New files created using svn cp
.
...
Creates:
`class-wp-widget.php`
`class-wp-widget-factory.php`
`widget-functions.php`
`widgets.php` contains only top-level code. Class files only contain classes. Functions file only contains functions.
See #33413 .
Built from https://develop.svn.wordpress.org/trunk@33746
git-svn-id: http://core.svn.wordpress.org/trunk@33714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-26 02:40:23 +00:00
Weston Ruter
cb2879b9d4
Widgets: Switch back to using array_key_exists()
instead of isset()
for widget instance existence check.
...
Reverts unnecessary change in [32602] since `array_key_exists()` does actually work with `ArrayIterator` objects.
See #32474 .
Fixes #33442 .
Built from https://develop.svn.wordpress.org/trunk@33696
git-svn-id: http://core.svn.wordpress.org/trunk@33663 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-21 18:09:25 +00:00
Aaron Jorbin
1525010f74
Deprecate php4 style constructors
...
PHP7 is deprecating PHP4 style constructors, so we need to modify our code to have _construct methods that fire before the named PHP4 style constructors. The PHP4 style constructors will call the PHP5 style constructor in case it is being called directly (usually via parent::METHOD).
This modifies external libraries to add PHP5 style constructors, but doesn't add a notice for when they are used. In WordPress core code, PHP4 style constructors are being given a call to _deprecated_constructor. To the PHP4 style constructor I say "I know that I can't take no more | It ain't no lie | I wanna see you out that door | Baby, bye, bye, bye..."
Upstream: https://wiki.php.net/rfc/remove_php4_constructors
Props jdgrimes, netweb, jorbin
See #31982
Built from https://develop.svn.wordpress.org/trunk@32990
git-svn-id: http://core.svn.wordpress.org/trunk@32961 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-28 15:27:24 +00:00
Scott Taylor
bece996d45
Add missing doc blocks to widgets.php
.
...
Cleanup `@return` values.
See #32444 .
Built from https://develop.svn.wordpress.org/trunk@32639
git-svn-id: http://core.svn.wordpress.org/trunk@32609 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-28 16:20:25 +00:00
Weston Ruter
7792b5c942
Add support for WP_Widget::get_settings()
returning ArrayIterator
/ArrayObject
instances.
...
Plugins can use `pre_option_widget_{$id_base}` filters to return `ArrayIterator`/`ArrayObject` instances instead of primitive arrays. This makes possible for widget instance data to be drawn from somewhere else than `wp_options`, such as a custom post type.
Add unit tests for widgets.
Fixes #32474 .
Built from https://develop.svn.wordpress.org/trunk@32602
git-svn-id: http://core.svn.wordpress.org/trunk@32572 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-26 16:51:27 +00:00
Scott Taylor
af7a017f46
When calling unset()
, it is unnecessary to immediately precede it with a call to isset()
.
...
See #32444 .
Built from https://develop.svn.wordpress.org/trunk@32545
git-svn-id: http://core.svn.wordpress.org/trunk@32515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-22 05:47:25 +00:00
Dominik Schilling
64fc7294b6
Use HTTPS URLs for codex.wordpress.org.
...
see #27115 .
Built from https://develop.svn.wordpress.org/trunk@32116
git-svn-id: http://core.svn.wordpress.org/trunk@32095 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-12 21:29:32 +00:00
Sergey Biryukov
9df7b6ecf6
Translator comment should just reference placeholder numbers, not the actual placeholders.
...
see #31675 .
Built from https://develop.svn.wordpress.org/trunk@32112
git-svn-id: http://core.svn.wordpress.org/trunk@32091 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-11 21:46:27 +00:00
Sergey Biryukov
3566ac11fb
Explain all placeholders in translator comment, not just the first one.
...
see [32110], #31675 .
Built from https://develop.svn.wordpress.org/trunk@32111
git-svn-id: http://core.svn.wordpress.org/trunk@32090 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-11 21:40:26 +00:00
Mark Jaquith
c69315f5d7
Tell developers how to correctly silence register_sidebar()
notices.
...
* If we just tell them they they should set an `id` parameter, they might set an arbitrary one on an existing (i.e. not in-development) theme, causing widgets to be lost.
* This way, we tell them to set it to the auto-generated `id` that the sidebar already has.
* Widget content is not lost, and now their sidebar has a concrete handle.
fixes #31675
Built from https://develop.svn.wordpress.org/trunk@32110
git-svn-id: http://core.svn.wordpress.org/trunk@32089 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-11 21:34:29 +00:00
Dominik Schilling
55519962cc
Improve newly added strings for i18n:
...
* Use a placeholder for the theme name to be able to reorder words.
* Uppercase D for "Theme Details" to match existing strings.
* Merge two revision date formats.
* Add translator comment to strings with placeholders.
props obenland.
see #31776 .
Built from https://develop.svn.wordpress.org/trunk@31905
git-svn-id: http://core.svn.wordpress.org/trunk@31884 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-26 20:56:26 +00:00
Mark Jaquith
e2c7f8d96e
Trigger _doing_it_wrong()
if register_sidebar()
is not passed an id
...
* If you don't pass an `id`, WP sets an auto-increment one for you.
* But this depends on order of sidebar definition.
* Change the order or remove a sidebar? They jumble.
fixes #31675
props tschutter, valendesigns
Built from https://develop.svn.wordpress.org/trunk@31850
git-svn-id: http://core.svn.wordpress.org/trunk@31829 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-20 18:30:27 +00:00
Dominik Schilling
883b587f1d
Revert [31729] since <aside>
seems not to be the appropriate HTML5 tag.
...
see #30556 .
Built from https://develop.svn.wordpress.org/trunk@31826
git-svn-id: http://core.svn.wordpress.org/trunk@31808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-18 22:26:26 +00:00
Dominik Schilling
b5a06f7695
Introduce HTML5 widgets support.
...
When a theme supports HTML5 widgets via `add_theme_support( 'html5', 'widgets' )`, aside will be used instead of list markup.
props LeoPeo, valendesigns.
fixes #30556 .
Built from https://develop.svn.wordpress.org/trunk@31729
git-svn-id: http://core.svn.wordpress.org/trunk@31710 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-11 20:44:25 +00:00
Scott Taylor
a685aa6670
[31684] has BC issues, revert it.
...
Props nacin.
See #30799 .
Built from https://develop.svn.wordpress.org/trunk@31685
git-svn-id: http://core.svn.wordpress.org/trunk@31666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-09 02:36:26 +00:00
Scott Taylor
11ccf8f625
Remove the PHP4 constructor from WP_Widget
.
...
See #30799 .
Built from https://develop.svn.wordpress.org/trunk@31684
git-svn-id: http://core.svn.wordpress.org/trunk@31665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-09 02:25:27 +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
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
Drew Jaynes
24090d065a
Fix formatting in the DocBlock for wp_get_sidebars_widgets()
.
...
See #30315 .
Built from https://develop.svn.wordpress.org/trunk@30779
git-svn-id: http://core.svn.wordpress.org/trunk@30769 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-07 20:15:26 +00:00
Drew Jaynes
16e46b2a1e
Flesh out and fix formatting in the DocBlock for wp_register_widget_control()
.
...
Includes:
* Added todos for documenting `$options` in the hash notation style
* Backtick-escaping and general formatting
See #30315 .
Built from https://develop.svn.wordpress.org/trunk@30778
git-svn-id: http://core.svn.wordpress.org/trunk@30768 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-07 20:13:23 +00:00
Drew Jaynes
cc4d102260
Flesh out information in the DocBlock for wp_register_sidebar_widget()
.
...
Includes:
* Documenting the `$options` parameter in hash notation style
* Converting `@uses` tags to `@global`
* Various backtick-escaping.
See #30315 .
Built from https://develop.svn.wordpress.org/trunk@30776
git-svn-id: http://core.svn.wordpress.org/trunk@30766 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-07 20:11:22 +00:00
Drew Jaynes
1f8f2e5ba1
Introduce documentation for three methods in WP_Widget_Factory
: register()
, unregister()
, _register_widgets()
.
...
See #30315 .
Built from https://develop.svn.wordpress.org/trunk@30774
git-svn-id: http://core.svn.wordpress.org/trunk@30764 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-07 20:08:21 +00:00
Drew Jaynes
25a65d856b
Introduce documentation for the $id_base
, $name
, $widget_options
, $control_options
, $number
, $id
, and $updated
properties in `WP_Widget'.
...
See #30315 .
Built from https://develop.svn.wordpress.org/trunk@30773
git-svn-id: http://core.svn.wordpress.org/trunk@30763 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-07 20:05:22 +00:00
Drew Jaynes
8b83a73511
Document the default arguments for the_widget()
in the hash notation style.
...
Props coffee2code.
See #28298 .
Built from https://develop.svn.wordpress.org/trunk@30770
git-svn-id: http://core.svn.wordpress.org/trunk@30760 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-07 11:04:23 +00:00
Drew Jaynes
2a9c5910c6
Document the default arguments for register_sidebars()
in the hash notation style.
...
Props coffee2code.
See #28298 .
Built from https://develop.svn.wordpress.org/trunk@30769
git-svn-id: http://core.svn.wordpress.org/trunk@30759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-07 11:01:25 +00:00
Drew Jaynes
0c7e70604d
Document the default arguments for register_sidebar()
in the hash notation style.
...
Props coffee2code.
See #28298 .
Built from https://develop.svn.wordpress.org/trunk@30745
git-svn-id: http://core.svn.wordpress.org/trunk@30735 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-05 03:38:22 +00:00
Drew Jaynes
4bdf9961d4
Improve inline documentation for four methods in WP_Widget
: get_field_id()
, display_callback()
, update_callback()
, and form_callback()
.
...
Props jazzs3quence for the initial patch.
See #30315 .
Built from https://develop.svn.wordpress.org/trunk@30691
git-svn-id: http://core.svn.wordpress.org/trunk@30681 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-01 19:35:25 +00:00
Scott Taylor
5d75282328
Improve the @param
docs for src/wp-includes/widgets.php
.
...
See #30224 .
Built from https://develop.svn.wordpress.org/trunk@30665
git-svn-id: http://core.svn.wordpress.org/trunk@30655 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 22:05:21 +00:00
Drew Jaynes
e34a587ea6
Add some missing inline documentation for methods in the WP_Widget
class in wp-includes/widgets.php.
...
Props ericlewis, jazzs3quence.
See #30315 .
Built from https://develop.svn.wordpress.org/trunk@30382
git-svn-id: http://core.svn.wordpress.org/trunk@30379 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-18 22:58:22 +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
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