Commit Graph

24 Commits

Author SHA1 Message Date
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
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
John Blackbourn
4a16295dc5 Docs: Standardise the format used for documenting parameters passed by reference.
See #35974, #41017

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


git-svn-id: http://core.svn.wordpress.org/trunk@41522 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-02 22:14:46 +00:00
Drew Jaynes
0860bb2771 Docs: Remove @access notations from method DocBlocks in wp-includes/* classes.
Prior to about 2013, many class methods lacked even access modifiers which made the `@access` notations that much more useful. Now that we've gotten to a point where the codebase is more mature from a maintenance perspective and we can finally remove these notations. Notable exceptions to this change include standalone functions notated as private as well as some classes still considered to represent "private" APIs.

See #41452.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-27 00:41:44 +00:00
Drew Jaynes
5f4497f0af Docs: Fix multiple trivial typos throughout a variety of core files.
Props ottok.
Fixes #38489.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38993 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-31 06:28:32 +00:00
Scott Taylor
1119536085 Widgets: $option_name and $alt_option_name have been used as members ever since WP_Widget became an object in 2.8, but never declared.
See #37771.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38259 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-22 21:51:28 +00:00
Dominik Schilling
cb02b1f1e0 Widgets: Revert [37425] and [37427].
The change can cause fatal errors under certain conditions, like when the subclass has a different function signature for `widget()` or doesn't even implement the method.

See #35981.
Built from https://develop.svn.wordpress.org/trunk@37648


git-svn-id: http://core.svn.wordpress.org/trunk@37614 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-06 21:51:28 +00:00
Drew Jaynes
602b51a209 Docs: Standardize filter docs in core classes in wp-includes/* to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:15:28 +00:00
Dominik Schilling
97fc82a879 Widgets: Make WP_Widget a real abstract class.
This removes the `die()` call from `WP_Widget::widget()` and converts it to an abstract method.
`WP_Widgets` (later renamed to `WP_Widget`) was introduced in [10764] where the minimum PHP requirement was 4.3, thus no `abstract` was available.

Props johnbillion.
Fixes #35981.
Built from https://develop.svn.wordpress.org/trunk@37425


git-svn-id: http://core.svn.wordpress.org/trunk@37391 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-12 20:23:28 +00:00
Drew Jaynes
6683100d2c Docs: Improve the class DocBlock for WP_Widget to clarify which methods "should" vs "must" be overridden by extending sub-classes.
Props Frank-Klein.
Fixes #36703.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37309 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-02 04:53:27 +00:00
Drew Jaynes
c5a5c7c9d1 Docs: Improve inline documentation syntax throughout WP_Widget.
Fixes #36298.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-23 05:32:27 +00:00
Drew Jaynes
893871a5d1 Docs: Add missing information to the WP_Widget PHP4 constructor DocBlock.
Also add several missing at `@access` tags to other method DocBlocks and clarify parameter docs for `WP_Widget::form_callback()`.

Props raimy.
See #36298.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37031 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-23 05:10:26 +00:00
Weston Ruter
f3f84d2f21 Customize: Require opt-in for selective refresh of widgets.
* Introduces `customize-selective-refresh-widgets` theme support feature and adds to themes.
* Introduces `customize_selective_refresh` arg for `WP_Widget::$widget_options` and adds to all core widgets.
* Remove `selective_refresh` from being a component that can be removed via `customize_loaded_components` filter.
* Add `WP_Customize_Widgets::get_selective_refreshable_widgets()` and `WP_Customize_Widgets::is_widget_selective_refreshable()`.
* Fix default `selector` for `Partial` instances.
* Implement and improve Masronry sidebar refresh logic in Twenty Thirteen and Twenty Fourteen, including preservation of initial widget position after refresh.
* Re-initialize ME.js when refreshing `Twenty_Fourteen_Ephemera_Widget`.

See #27355.
Fixes #35855.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-21 21:59:29 +00:00
Dominik Schilling
9e73dea03a Introduce a $parent_class parameter for _deprecated_constructor().
Use the parameter for the deprecated constructor warning in `WP_Widget` to provide an indication to which widget is using the PHP4 style constructor.

Props sebastian.pisula.
Fixes #33440.
Built from https://develop.svn.wordpress.org/trunk@36541


git-svn-id: http://core.svn.wordpress.org/trunk@36508 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-16 23:20:26 +00:00
Drew Jaynes
4ced4fce3a Docs: Add missing summaries and @since versions to DocBlocks for the _get_display_callback(), _get_update_callback(), and _get_form_callback() methods in WP_Widget.
Introduced in [10764].

See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35919 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-16 05:39:25 +00:00
Scott Taylor
e7c2544a89 Widgets: when getting settings, and none exist, set them to empty to avoid extraneous database queries on subsequent requests.
Adds unit tests.

Props kovshenin, MikeHansenMe, dlh.
Fixes #26876.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35065 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-13 01:13:24 +00:00
Drew Jaynes
6f7a298c18 Docs: Fix the placement and ordering of some @since tags following [34780].
See #12133. See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34747 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-02 20:50:25 +00:00
John Blackbourn
7707dbf862 Introduce support for array format field names in WP_Widget::get_field_name() and WP_Widget::get_field_id().
Fixes #12133
Props ch1902, welcher

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


git-svn-id: http://core.svn.wordpress.org/trunk@34745 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-02 20:24:24 +00:00
Drew Jaynes
66242cbc98 Docs: Improve the method docs for the widget(), update(), form(), and __construct() methods in the WP_Widget base class.
See #34013. See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34524 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-25 20:31:24 +00:00
Drew Jaynes
783876bd1a Docs: The Widget API is singular.
See #33701.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34356 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-22 12:28:27 +00:00
Drew Jaynes
a92dc6aeed Docs: Improve the file header for class-wp-widget.php to describe what the file contains.
Also rewrites the class DocBlock summary for `WP_Widget` to better describe the '''purpose''' of the class.

See #33413. See #33701.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33837 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-03 02:50:21 +00:00
Drew Jaynes
4d006fad9e Docs: Bring the file header and class DocBlock summaries for class-wp-widget.php in-line with the intention of the docs standard:
* File headers: _What_ the file is
* Class DocBlocks: What purpose the class serves. Mentioning the class name in the class DocBlock is redundant

See #33413

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


git-svn-id: http://core.svn.wordpress.org/trunk@33784 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-30 23:14:21 +00:00
Drew Jaynes
2aa0a42661 Docs: Add a file header to wp-includes/class-wp-widget.php, created when the WP_Widget class was moved to its own file in [33746].
It's important for every file in WordPress, regardless of makeup or architecture, to have its own file header, even if the file contains nothing but a class. When parsed, files and classes are mutually exclusive and should be documented with this in mind.

See [33746]. See #33413.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33723 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-26 07:45:21 +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