Commit Graph

22 Commits

Author SHA1 Message Date
Sergey Biryukov
37662df05e Docs: In various @return tags, list the expected type first, instead of false or WP_Error.
Follow-up to [46696], [47060], [49926], [49927].

See #51800.
Built from https://develop.svn.wordpress.org/trunk@49929


git-svn-id: http://core.svn.wordpress.org/trunk@49628 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-04 17:18:04 +00:00
Sergey Biryukov
f4d610310c Docs: Synchronize and correct documentation for has_filter() and WP_Hook::has_filter().
`WP_Hook::has_filter()` returns true if `$function_to_check` is omitted and the hook being checked has one or more registered callbacks.

Follow-up to [49927].

See #51800.
Built from https://develop.svn.wordpress.org/trunk@49928


git-svn-id: http://core.svn.wordpress.org/trunk@49627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-04 16:58:08 +00:00
John Blackbourn
dfe1f9b322 Docs: Promote many bool types to true or false where only that value is used.
See #51800

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


git-svn-id: http://core.svn.wordpress.org/trunk@49626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-03 22:04:04 +00:00
John Blackbourn
53da9208dd Docs: Various docblock corrections particularly relating to boolean types.
See #51800

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


git-svn-id: http://core.svn.wordpress.org/trunk@49625 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-03 21:57:09 +00:00
John Blackbourn
3cee52b362 Docs: Add more information about how to use filters that run before WordPress initialises.
Fixes #50134

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


git-svn-id: http://core.svn.wordpress.org/trunk@49248 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-03 17:36:09 +00:00
John Blackbourn
905460bd5e Docs: Standardise the type name for booleans and integers.
This brings these docs inline with the documentation standards.

Props ravipatel, justinahinon

Fixes #51426

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


git-svn-id: http://core.svn.wordpress.org/trunk@48882 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-10 20:02:05 +00:00
Sergey Biryukov
641c632b0c Coding Standards: Use Yoda conditions where appropriate.
See #49222.
Built from https://develop.svn.wordpress.org/trunk@47219


git-svn-id: http://core.svn.wordpress.org/trunk@47019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-09 16:55:09 +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
2900bb8ea7 Docs: Update links to https://secure.php.net/, they now redirect to https://www.php.net/.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@47088


git-svn-id: http://core.svn.wordpress.org/trunk@46888 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-20 03:14:06 +00:00
Sergey Biryukov
49401759f3 Docs: Correct @param type for the function parameter in tests_add_filter() and _test_filter_build_unique_id().
Synchronize documentation for `add_filter()`, `tests_add_filter()`, `_wp_filter_build_unique_id()`, `_test_filter_build_unique_id()`.

Add a note that `$tag` and `$priority` are no longer used in `_wp_filter_build_unique_id()` since [46220], and the function always returns a string now.

Props donmhico, remcotolsma, SergeyBiryukov.
Fixes #47407. See #48303.
Built from https://develop.svn.wordpress.org/trunk@46801


git-svn-id: http://core.svn.wordpress.org/trunk@46601 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-29 21:42:01 +00:00
Sergey Biryukov
60f027a378 Code Modernisation: Replace call_user_func_array() in combination with an empty array in wp-includes/class-wp-hook.php with call_user_func().
Props jrf.
See #47678.
Built from https://develop.svn.wordpress.org/trunk@46139


git-svn-id: http://core.svn.wordpress.org/trunk@45951 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-15 11:45:56 +00:00
Sergey Biryukov
0393a78206 Docs: Fix typo in WP_Hook::resort_active_iterations() description.
Props itowhid06.
Fixes #47999.
Built from https://develop.svn.wordpress.org/trunk@46082


git-svn-id: http://core.svn.wordpress.org/trunk@45894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-08 13:16:55 +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
9abcf7881f Docs: Improve and correct documentation for hook-related variadic functions.
See #37402

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


git-svn-id: http://core.svn.wordpress.org/trunk@45231 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-05-25 22:52:54 +00:00
Sergey Biryukov
08227812a0 Docs: Remove @static notations from method DocBlocks in wp-includes/* classes.
This tag has been used in the past, but should no longer be used. Just using the `static` keyword in code is enough for PhpDocumentor on PHP5+ to recognize static variables and methods, and PhpDocumentor will mark them as static.

Props birgire.
See #42803.
Built from https://develop.svn.wordpress.org/trunk@42746


git-svn-id: http://core.svn.wordpress.org/trunk@42576 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-25 20:22:30 +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
da3e29eeba Docs: Use correct order of arguments in the DocBlock for WP_Hook::has_filter().
Props munyagu.
Fixes #41941.
Built from https://develop.svn.wordpress.org/trunk@41551


git-svn-id: http://core.svn.wordpress.org/trunk@41384 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-21 10:00:48 +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
07f01a2e10 Docs: Replace a variety of http links referenced in inline docs with their https counterparts (where possible).
Props johnpgreen.
Fixes #40732.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40798 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-06-25 22:06:41 +00:00
Gary Pendergast
d1b2a55b44 Plugins: Add a current_priority() method to WP_Hook.
This allows plugins to determine the currently running priority of a filter.

Fixes #39007.


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


git-svn-id: http://core.svn.wordpress.org/trunk@39370 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-02 07:10:43 +00:00
Drew Jaynes
f5db425059 Docs: Fix minor formatting for inline docs in WP_Hook following its introduction in [38571].
See #17817.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38516 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-08 04:17:30 +00:00
Gary Pendergast
5a632be944 Hooks: Add the new class WP_Hook, and modify hook handling to make use of it.
Filters and actions have been the basis of WordPress' plugin functionality since time immemorial, they've always been a reliable method for acting upon the current state of WordPress, and will continue to be so.

Over the years, however, edge cases have cropped up. Particularly when it comes to recursively executing hooks, or a hook adding and removing itself, the existing implementation struggled to keep up with more complex use cases.

And so, we introduce `WP_Hook`. By changing `$wp_filter` from an array of arrays, to an array of objects, we reduce the complexity of the hook handling code, as the processing code (see `::apply_filters()`) only needs to be aware of itself, rather than the state of all hooks. At the same time, we're able te handle more complex use cases, as the object can more easily keep track of its own state than an array ever could.

Props jbrinley for the original architecture and design of this patch.
Props SergeyBiryukov, cheeserolls, Denis-de-Bernardy, leewillis77, wonderboymusic, nacin, jorbin, DrewAPicture, ocean90, dougwollison, khag7, pento, noplanman and aaroncampbell for their testing, suggestions, contributions, patch maintenance, cajoling and patience as we got through this.
Fixes #17817.


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


git-svn-id: http://core.svn.wordpress.org/trunk@38514 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-08 03:55:31 +00:00