Commit Graph

367 Commits

Author SHA1 Message Date
Sergey Biryukov
b9353dbf70 Coding Standards: Use strict comparison and Yoda conditions in wp-includes/widgets.php.
Props jenilk.
Fixes #49104.
Built from https://develop.svn.wordpress.org/trunk@47027


git-svn-id: http://core.svn.wordpress.org/trunk@46827 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-02 11:37:05 +00:00
Sergey Biryukov
8d1e51e9c7 Docs: Add a @since note about new parameters with the spread operator added to function signatures.
Props jrf.
See #47678.
Built from https://develop.svn.wordpress.org/trunk@46451


git-svn-id: http://core.svn.wordpress.org/trunk@46249 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-09 04:28:02 +00:00
Sergey Biryukov
1060f7e167 Widgets: Introduce register_sidebar_defaults filter for default arguments in register_sidebar().
Props patilvikasj, powerbuoy.
Fixes #48033.
Built from https://develop.svn.wordpress.org/trunk@46147


git-svn-id: http://core.svn.wordpress.org/trunk@45959 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-16 09:13:54 +00:00
Sergey Biryukov
7322d3f35e Code Modernisation: Use the spread operator in wp_register_sidebar_widget().
Rather than relying `func_get_args()` to retrieve arbitrary function arguments, we can now use the spread operator to assign them directly to a variable.

Missed in [45629].

Props jrf.
See #47678.
Built from https://develop.svn.wordpress.org/trunk@46122


git-svn-id: http://core.svn.wordpress.org/trunk@45934 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-15 10:31:54 +00:00
Sergey Biryukov
e199663322 I18N: Capitalize translator comments consistently, add trailing punctuation.
Includes minor code layout fixes.

See #44360.
Built from https://develop.svn.wordpress.org/trunk@45932


git-svn-id: http://core.svn.wordpress.org/trunk@45743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-03 00:41:05 +00:00
Sergey Biryukov
16b8d91baa I18N: Improve translator comments.
* Add missing translator comments.
* Fix placement of some translator comments. Translator comments should be on the line directly above the line containing the translation function call for optimal compatibility with various `.pot` file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translator comments.

Includes minor code layout fixes.

Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!

Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.
Built from https://develop.svn.wordpress.org/trunk@45926


git-svn-id: http://core.svn.wordpress.org/trunk@45737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 17:13:59 +00:00
Sergey Biryukov
cc8e05df39 Widgets: Allow for short-circuiting widget output in the_widget() using the widget_display_callback filter, for consistency with output via a registered sidebar.
Props MarcGuay, donmhico.
Fixes #34226.
Built from https://develop.svn.wordpress.org/trunk@45798


git-svn-id: http://core.svn.wordpress.org/trunk@45609 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-14 23:03:55 +00:00
Sergey Biryukov
8e85299a00 General: First pass at replacing Codex URLs with a corresponding HelpHub or DevHub article.
Props ianbelanger, tobifjellner, SergeyBiryukov.
See #47771.
Built from https://develop.svn.wordpress.org/trunk@45674


git-svn-id: http://core.svn.wordpress.org/trunk@45485 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-25 22:45:57 +00:00
Gary Pendergast
2fe355cdd0 Code Modernisation: Introduce the spread operator in widgets.php.
Rather than relying `func_get_args()` to retrieve arbitrary function arguments, we can now use the spread operator to assign them directly to a variable.

Props jrf.
See #47678.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45440 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-12 00:14:58 +00:00
Gary Pendergast
abcbee954f Coding Standards: Fix instances of WordPress.PHP.NoSilencedErrors.Discouraged.
Noteable changes:
- The `magic_quotes_runtime` and `magic_quotes_sybase` settings were removed in PHP 5.4, so no longer need to be set.
- Some functions that use external libraries can generate errors that can't be tested for, so are globally allowed to silence errors.
- Quite a few functions would cause errors if `safe_mode` was set. This setting was removed in PHP 5.4.
- Only a handful of `header()` calls needed corresponding `headers_sent()` checks for unit tests to pass, but more may need to be added as the nightlies builds are tested.

See #46732.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-09 05:45:58 +00:00
Gary Pendergast
4803fc405e Coding Standards: Fix the Squiz.PHP.DisallowMultipleAssignments violations in wp-includes.
See #47632.


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


git-svn-id: http://core.svn.wordpress.org/trunk@45401 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-02 23:42:58 +00:00
John Blackbourn
557ef04409 Docs: Improve docs for variadic functions relating to widgets and their controls.
See #37402

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


git-svn-id: http://core.svn.wordpress.org/trunk@45260 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-05-26 22:05:51 +00:00
Gary Pendergast
767fb99e94 Docs: Improve documentation of the `$wp_registered_sidebars global.
Props mukesh27.
Fixes #43448.


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


git-svn-id: http://core.svn.wordpress.org/trunk@44416 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-14 23:01:49 +00:00
Gary Pendergast
56c162fbc9 Coding Standards: Upgrade WPCS to 1.0.0
WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues.

This change includes three notable additions:
- Multiline function calls must now put each parameter on a new line.
- Auto-formatting files is now part of the `grunt precommit` script. 
- Auto-fixable coding standards issues will now cause Travis failures.

Fixes #44600.


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


git-svn-id: http://core.svn.wordpress.org/trunk@43400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-08-17 01:51:36 +00:00
Felix Arntz
dac5651f23 Widgets: Allow basic inline tags in wp_sidebar_description().
The customizer has allowed HTML in sidebar descriptions since adding support for sidebars. This change ensures that basic HTML is also allowed for them in the widgets admin screen.

Fixes #42608.

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


git-svn-id: http://core.svn.wordpress.org/trunk@43104 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-05-15 16:55:21 +00:00
Dominik Schilling
5c291d49de Pinking shears.
See #41057.
Built from https://develop.svn.wordpress.org/trunk@42843


git-svn-id: http://core.svn.wordpress.org/trunk@42673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-18 14:23:33 +00:00
Drew Jaynes
6e665d1f15 Docs: Link to the "Conditional Tags" article in the Theme Developer Handbook from the descriptions for a variety of core conditional tag functions.
These notations largely serve to direct consumers (of both the source and the parsed code reference) to extended information on individual and related conditional tags throughout WordPress. The changeset also standardizes corresponding DocBlock summaries to use third-person singular verbs.

Notations been added for the following functions:

* comments_open()
* email exists()
* has_excerpt()
* has_post_thumbnail()
* has_tag()
* in_category()
* in_the_loop()
* is_404()
* is_active_sidebar()
* is_active_widget()
* is_admin()
* is_admin_bar_showing()
* is_archive()
* is_attachment()
* is_author()
* is_blog_installed()
* is_category()
* is_comments_popup()
* is_date()
* is_day()
* is_dynamic_sidebar()
* is_feed()
* is_front_page()
* is_home()
* is_local_attachment()
* is_main_query
* is_month()
* is_multi_author
* is_new_day()
* is_page()
* is_page_template()
* is_paged()
* is_plugin_active()
* is_plugin_active_for_network()
* is_plugin_inactive()
* is_plugin_page()
* is_post_type_archive()
* is_preview()
* is_rtl()
* is_search()
* is_single()
* is_singular()
* is_sticky()
* is_tag()
* is_tax()
* is_taxonomy_hierarchical()
* is_time()
* is_trackback()
* is_user_logged_in()
* is_year()
* pings_open()
* post_type_exists()
* taxonomy_exists()
* term_exists()
* username exists()
* wp_attachment_is_image()
* wp_script_is()

Props janalwin.
Fixes #43254.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-13 16:54:31 +00:00
Konstantin Obenland
856e7917e8 Widgets: Always try restoring widget assignments
For code-historic reasons, restoring widget assignments would not be attempted if there were no sidebars to map.
Restoring previous assignments is something unrelated to sidebar mappings however, so now it will be attempted on every theme switch.

See #42719.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42203 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-12-07 02:20:52 +00:00
Konstantin Obenland
ff25787995 Widgets: Don't try mapping empty sidebars.
Fixes a bug where the mapping logic would try mapping empty sidebars, resulting in PHP warnings.

Props ionvv, chetan200891 for initial patch.
Fixes #42603.


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


git-svn-id: http://core.svn.wordpress.org/trunk@42191 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-12-04 20:12:48 +00:00
Gary Pendergast
aaf99e6913 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.


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


git-svn-id: http://core.svn.wordpress.org/trunk@42172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-30 23:11:00 +00:00
Sergey Biryukov
3aa0c23274 Docs: After [37329], update the documentation for register_widget() and unregister_widget().
Both functions can accept a `WP_Widget` instance object instead of a `WP_Widget` subclass name, same as `WP_Widget_Factory::register()` and `::unregister()`.

Props behzod.
Fixes #42270.
Built from https://develop.svn.wordpress.org/trunk@41942


git-svn-id: http://core.svn.wordpress.org/trunk@41776 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-19 13:51:50 +00:00
Konstantin Obenland
8911893672 Widgets: Update globals documentation.
It doesn't look like `wp_register_sidebar_widget()` ever used a global named `$wp_register_widget_defaults`. It does however make use of `$wp_registered_widget_controls` now.

See [8960], [30776].

Props upadalavipul.
Fixes #41592.


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


git-svn-id: http://core.svn.wordpress.org/trunk@41632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-09 16:35:47 +00:00
Konstantin Obenland
1e6810e433 Widgets: Revert format of sidebars_widgets.
Restores the data format of the `sidebars_widgets` theme mod to its pre [41555]
format. It can trigger PHP warnings after switching themes if that mod has not
been removed previously.

Fixes #39693.


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


git-svn-id: http://core.svn.wordpress.org/trunk@41507 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-02 18:11:46 +00:00
Konstantin Obenland
eea0e5f6f5 Widgets: Merge orphaned widgets on theme switch
Merges orphaned widgets into the inactive sidebar when switching themes.

Props bpayton.
See #39693.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41427 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-25 16:19:46 +00:00
Weston Ruter
bb97df7b5f Widgets: Introduce Gallery widget for displaying image galleries.
* Galleries are managed in the widget in the same way they are managed in the post editor, both using the media manager.
* Gallery widget is merged from the Core Media Widgets v0.2.0 feature plugin and it extends `WP_Widget_Media` in the same way as is done for image, audio, and video widgets.
* Model syncing logic is updated to support booleans and arrays (of integers).
* Placeholder areas in media widgets are now clickable shortcuts for selecting media.
* Image widget placeholder is updated to match gallery widget where clicking preview is shortcut for editing media.

Props westonruter, joemcgill, timmydcrawford, m1tk00, obenland, melchoyce.
See #32417.
Fixes #41914.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41423 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-25 06:28:45 +00:00
Konstantin Obenland
27536e99c5 Widgets: Improved sidebar mapping on theme switch
Builds on efforts brought forward in #17979.

This will send sidebars through three levels of mapping:

1. If both themes have only one sidebar, that gets mapped.
2. If both themes have sidebars with the same slug, they get mapped.
3. Sidebars that (even partially) match slugs from a similar kind of sidebar will get mapped.

Finally, if the theme has previously been active and we have a record of its 
sidebar configuration then, any unmapped sidebar will be restored to its 
previous state.

Props westonruter, obenland, alexvorn2, timmydcrawford.
See #39693.


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


git-svn-id: http://core.svn.wordpress.org/trunk@41388 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-21 18:46:46 +00:00
Konstantin Obenland
a1688f0d2a Widgets: Improve _doing_it_wrong message.
Adds more context to help sending developers on the path to success.

Props ramiy.
Fixes 41743.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41173 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-06 21:32:43 +00:00
Konstantin Obenland
564e13cf30 Widgets: Add nudge for registered widgets
Informs developers that widgets need to be registered before they can be
displayed through `the_widget()`. Previously it would fail with an ambiguous
undefined index notice.

Props SeBsZ, mrasharirfan.
Fixes #41743.


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


git-svn-id: http://core.svn.wordpress.org/trunk@41158 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-01 08:50:47 +00:00
Weston Ruter
a46d94efeb Widgets: Rename "HTML Code" widget to "Custom HTML" widget.
Correspondingly renames files, ID base from `html_code` to `custom_html`, and the filter from `widget_html_code_content` to `widget_custom_html_content`.

See #40907.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40776 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-06-24 00:00:45 +00:00
Weston Ruter
38db73cff8 Widgets: Add widget dedicated for HTML Code, taking over this role of the Text widget.
Props westonruter, timmydcrawford.
See #40951, #35243.
Fixes #40907.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-06-09 23:54:42 +00:00
Weston Ruter
123158e7d8 Widgets: Revert [40251] pending more accessible solution for showing default widget titles rather than using placeholders.
See #39909.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-19 20:45:40 +00:00
Weston Ruter
31d4d81039 Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!

Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40501 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-11 21:11:44 +00:00
Weston Ruter
d7cb2f7706 Customize: Show title input placeholders for widgets that have default titles when rendered.
Fixes #39909.
Props bor0, dlh, westonruter.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40173 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-08 18:25:44 +00:00
Sergey Biryukov
a1319d63a0 Widgets: In unregister_sidebar(), rename the $name parameter to $sidebar_id for consistency with is_registered_sidebar().
Also correct the parameter type in `@param` entry.

Props Soean, tmatsuur.
Fixes #35147.
Built from https://develop.svn.wordpress.org/trunk@39892


git-svn-id: http://core.svn.wordpress.org/trunk@39829 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-12 06:38:54 +00:00
Sergey Biryukov
518fc0a05b I18N: Merge two 'RSS Error:' strings.
Props ramiy.
Fixes #38861.
Built from https://develop.svn.wordpress.org/trunk@39311


git-svn-id: http://core.svn.wordpress.org/trunk@39251 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-19 01:56:31 +00:00
Drew Jaynes
9193013158 Docs: Apply inline @see tags to hooks referenced in DocBlocks in a variety of wp-includes/* files.
Applying these specially-crafted `@see` tags allows the Code Reference parser to recognize and link these elements as actions and filters.

Fixes #36921.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-23 19:02:28 +00:00
Drew Jaynes
9cb5247392 Docs: Standardize filter docs in remaining wp-includes/* files to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37486 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:50:28 +00:00
Drew Jaynes
fe3b007fdd Docs: Remove inline @see tags from function, class, and method references in inline docs.
Known functions, classes, and methods are now auto-linked in Code Reference pages following #meta1483.

Note: Hook references are still linked via inline `@see` tags due to the unlikelihood of reliably matching for known hooks based on a RegEx pattern.

See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37308 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-02 04:00:28 +00:00
Dominik Schilling
e5ea82d81a Spelling: Standardize on "front end"/"back end" (noun) and "front-end"/"back-end" (adjective).
Props obrienlabs, thewanderingbrit.
Fixes #34887.
Built from https://develop.svn.wordpress.org/trunk@36709


git-svn-id: http://core.svn.wordpress.org/trunk@36676 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-25 12:53:27 +00:00
Sergey Biryukov
54b8932923 Widgets: Avoid a PHP notice in is_dynamic_sidebar() is a sidebar is registered but does not yet have an index in the sidebars_widgets option.
Props dlh.
Fixes #35928.
Built from https://develop.svn.wordpress.org/trunk@36667


git-svn-id: http://core.svn.wordpress.org/trunk@36634 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-24 01:37:26 +00:00
Sergey Biryukov
7b3b8f6fd4 Widgets: Revert [34465], as it introduced a regression, making the $index argument of dynamic_sidebar() case-sensitive.
Fixes #34995 for trunk. See #23423.
Built from https://develop.svn.wordpress.org/trunk@36130


git-svn-id: http://core.svn.wordpress.org/trunk@36096 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-31 03:13:26 +00:00
Drew Jaynes
76cc768e90 Docs: Add a better summary, missing @since version, parameter and return descriptions to the DocBlock for _get_widget_id_base().
Introduced in [11484].

See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35957 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-17 17:27:28 +00:00
Drew Jaynes
94575687b9 Docs: Add a missing summary, @since version, and parameter descriptions in the DocBlock for _register_widget_form_callback().
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-17 17:23:26 +00:00
Drew Jaynes
c13824b1c0 Docs: Fix syntax for marking parameters optional in the DocBlock for is_active_widget().
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35955 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-17 17:19:26 +00:00
Drew Jaynes
9de8a1466a Docs: Add a missing summary, @since version, and parameter descriptions to the DocBlock for _register_widget_update_callback().
Introduced in [10798].

See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35954 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-17 17:16:26 +00:00
Drew Jaynes
0fcf24a38e Docs: Document the optional $options parameter for wp_register_widget_control() as a hash notation.
Props stephanethomas.
Fixes #34855.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35828 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-11 15:24:28 +00:00
Sergey Biryukov
bc1e479fd0 After [35718], update the location of some files in This filter is documented in docs.
Partially reverts [33954].

Fixes #33413.
Built from https://develop.svn.wordpress.org/trunk@35725


git-svn-id: http://core.svn.wordpress.org/trunk@35689 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-22 03:51:28 +00:00
Andrew Nacin
1579e45d41 Simplify the include graph after work to split out classes.
see #33413. More details there.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35682 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-20 07:24:30 +00:00
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
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