Commit Graph

21 Commits

Author SHA1 Message Date
noisysocks 0bf96b88d3 Widgets: Fix widget preview not working if widget registered via a instance
The register_widget function can be called with a class name or a class
instance. Once called with a class instance, the class instance is converted to
hash as used key in array.

Props spacedmonkey, zieladam.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-23 01:34:58 +00:00
noisysocks 1314542c50 REST API: Add widget endpoints
Adds the sidebars, widgets and widget-types REST API endpoints from the
Gutenberg plugin.

Fixes #41683.
Props TimothyBlynJacobs, spacedmonkey, zieladam, jorgefilipecosta, youknowriad, kevin940726.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-25 08:27:57 +00:00
noisysocks ed195fbd89 REST API: Revert widget endpoints
Reverts [50993] as it has missing props.

Reverts [50993].
See #41683.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50603 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-25 08:22:56 +00:00
noisysocks 2a4e1e0c04 REST API: Add widget endpoints
Adds the sidebars, widgets and widget-types REST API endpoints from the
Gutenberg plugin.

Fixes #41683.
Props TimothyBlynJacobs.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50602 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-25 07:52:55 +00:00
Sergey Biryukov 001ffe81fb Docs: Improve inline comments per the documentation standards.
Includes minor code layout fixes for better readability.

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47122


git-svn-id: http://core.svn.wordpress.org/trunk@46922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-29 00:45:18 +00:00
Sergey Biryukov 221287f626 Widgets: Remove `WP_Widget_Factory::$hashed_class_counts` property, unused since [46220].
The `spl_object_hash()` function was introduced in PHP 5.2.0. As of PHP 5.3, the PHP SPL extension can no longer be disabled, so the `WP_Widget_Factory::hash_object()` workaround was removed in [46220].

See #48074.
Built from https://develop.svn.wordpress.org/trunk@46808


git-svn-id: http://core.svn.wordpress.org/trunk@46608 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-01 12:13:01 +00:00
Sergey Biryukov 6be425959a Docs: Add missing `@deprecated` tags to PHP 4 constructors in `WP_Widget` and `WP_Widget_Factory()`.
Correct version number in `_deprecated_constructor()` call in `WP_Widget_Factory()`, see [32990].

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


git-svn-id: http://core.svn.wordpress.org/trunk@46427 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-02 20:06:03 +00:00
Sergey Biryukov fe82a615a9 Code Modernization: Remove workarounds for `spl_object_hash()`.
The `spl_object_hash()` function was introduced in PHP 5.2.0. As of PHP 5.3, the PHP SPL extension can no longer be disabled, so these workarounds are no longer needed.

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


git-svn-id: http://core.svn.wordpress.org/trunk@46032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-20 22:34:57 +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
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 6cc13f0c54 Docs: Fix formatting, tense, verb conjugation, and other syntax for wp-includes/* elements introduced or changed in 4.6.
Part 1/2.

See #37318.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-20 16:57:32 +00:00
Weston Ruter 6693acdb24 Widgets: Provide PHP 5.2 fallback for `spl_object_hash()` if disabled in logic for registering and unregistering pre-instantiated widgets.
Fixes #28216.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37299 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-30 22:36:28 +00:00
Weston Ruter 96104fdd30 Widgets: Allow `WP_Widget` subclass instances (objects) to be registered/unregistered in addition to `WP_Widget` subclass names (strings).
Allows widgets to be registered which rely on dependency injection. Also will allow for new widget types to be created dynamically (e.g. a Recent Posts widget for each registered post type).

See #35990.
Props mdwheele, PeterRKnight, westonruter.
Fixes #28216.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37295 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-29 18:49:26 +00:00
Drew Jaynes e6d9d95f6d Docs: Use third-person singular verbs for method summaries in `WP_Widget_Factory`.
Fixes #36299.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37030 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-23 04:51:26 +00:00
Drew Jaynes c5ff4f3b47 Docs: Add missing information to constructors DocBlocks for `WP_Widget_Factory`.
See #36299.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-23 04:19:27 +00:00
Drew Jaynes bbebd0f74d Docs: Add a missing DocBlock for the `WP_Widget_Factory::$widgets` property.
Props raimy.
See #36299.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37028 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-23 04:11:28 +00:00
Drew Jaynes 58376954c2 Docs: The Widgets subpackage is plural.
See #33701.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34377 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-22 13:48:25 +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 95dc9825a7 Docs: Clarify the file header summary for class-wp-widget-factory.php, introduced in [33746].
See #33413. See #33701.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33838 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-03 02:54:22 +00:00
Drew Jaynes 5a77c96ea6 Docs: Add a file header to wp-includes/class-wp-widget-factory.php, created when the `WP_Widget_Factory` 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@33756


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