Aaron Jorbin
a138374ec8
Bootstrap/Load: Include Plugin API via `require_once`
...
Currently, auto-prepended files need to directly modify the globals in order to add filters and actions. This is a bad idea. Globals are bad. You should never directly interact with the Plugin globals.
Fixes #37707 .
Built from https://develop.svn.wordpress.org/trunk@38282
git-svn-id: http://core.svn.wordpress.org/trunk@38223 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-19 04:10:30 +00:00
Aaron Jorbin
7e14c27bb9
Bootstrap/Load: Revert Plugin Global restoration around `advance-cache.php`.
...
First added in [37588] and later modified in [38224], the idea was to ensure that filters/actions added before `advance-cache.php` would not disappear if `advance-cache.php` overloaded the filters/actions with code such as `$wp_filter = array()`. This is an edge case and one that there is no documented case of existing.
This restores the behavior from WordPress 4.5 and before. It is strongly encouraged that developers using `advance-cache.php` to use the Plugins API that is available before the loading of `advance-cache.php` rather than directly interacting with any of the globals.
Props azaozz, jorbin, dd32 for review, pento for review, westi for investigation, ipstenu for research.
See #36819 .
Built from https://develop.svn.wordpress.org/trunk@38251
git-svn-id: http://core.svn.wordpress.org/trunk@38192 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-13 16:00:33 +00:00
Gary Pendergast
4ac3feaa64
Boostrap/Load: Improve forward compatiblity of plugin global backup methods.
...
[37588] added methods to backup the plugin globals, for ensuring that advanced cache drop-ins don't overwrite hooks that've been added earlier in the load process.
The method for restoring the plugin globals wasn't compatible with the implementation of `WP_Hook` in #17817 . `WP_Hook` implements `ArrayAccess`, so `_restore_plugin_globals()` was treating it as an array, and inadvertantly overwriting the `WP_Hook` object with a plain array.
To avoid having to re-write this code as part of #17817 , we now use `add_filter()` to restore any hooks that were added by cache drop-ins, which `WP_Hook` correctly supports.
Props pento, jorbin.
See #36819 .
Built from https://develop.svn.wordpress.org/trunk@38223
git-svn-id: http://core.svn.wordpress.org/trunk@38164 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-09 01:45:29 +00:00
Drew Jaynes
e6267dcf19
Docs: Fix formatting, tense, verb conjugation, and other syntax for wp-includes/* elements introduced or changed in 4.6.
...
Part 2/2.
Fixes #37318 .
Built from https://develop.svn.wordpress.org/trunk@38125
git-svn-id: http://core.svn.wordpress.org/trunk@38066 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-20 19:33:30 +00:00
Drew Jaynes
d8a6dee52c
Docs: Update a cross-reference in the DocBlock for `wp_register_plugin_realpath()` from `plugin_basename()` to `wp_normalize_path()`.
...
Props zuige.
Fixes #37357 .
Built from https://develop.svn.wordpress.org/trunk@38061
git-svn-id: http://core.svn.wordpress.org/trunk@38002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-13 19:22:28 +00:00
Sergey Biryukov
139387b7e5
Docs: Use 3-digit, x.x.x-style semantic versioning for `_doing_it_wrong()`, `_deprecated_function()`, `_deprecated_argument()`, and `_deprecated_file()` throughout core.
...
Props metodiew.
Fixes #36495 .
Built from https://develop.svn.wordpress.org/trunk@37985
git-svn-id: http://core.svn.wordpress.org/trunk@37926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-06 12:40:29 +00:00
Dominik Schilling
dc994f5db5
Plugins: In `plugin_basename()` sort plugin paths before resolving symlinks.
...
`arsort()` sorts the paths reverse-alphabetically while preserving the keys. It results in a longer path being listed before a shorter one with the same base directory(ies).
Props jdgrimes, ocean90.
Fixes #28441 .
Built from https://develop.svn.wordpress.org/trunk@37983
git-svn-id: http://core.svn.wordpress.org/trunk@37924 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-06 09:45:27 +00:00
Dominik Schilling
e210ea830b
Plugins: Return the original value in `apply_filters_deprecated()` if no filter is registered for the tag.
...
Props flixos90.
Fixes #10441 .
Built from https://develop.svn.wordpress.org/trunk@37911
git-svn-id: http://core.svn.wordpress.org/trunk@37852 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-29 13:22:27 +00:00
Jeremy Felt
6f3f00ea97
Multisite: Change `WP_Network` `id` property to an integer.
...
For consistency and developer sanity.
Props flixos90.
Fixes #37050 .
Built from https://develop.svn.wordpress.org/trunk@37870
git-svn-id: http://core.svn.wordpress.org/trunk@37811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-26 14:26:29 +00:00
Peter Wilson
47d26cd9fb
DOCS: Replace HTTP links with HTTPS.
...
Replaces unsecure links in documentation and translator comments with their secure versions.
Props johnpgreen, netweb
Fixes #36993
Built from https://develop.svn.wordpress.org/trunk@37674
git-svn-id: http://core.svn.wordpress.org/trunk@37640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-10 04:50:33 +00:00
Aaron Jorbin
95cbf8922b
Bootstrap/Load: Load plugin.php earlier in wp-settings.php
...
In order to allow non-web initializations of WordPress (such as through wp-cli) to modify things like the check for maintenance mode, plugins.php and the associated functions must be available much earlier. The use of these functions earlier than the loading of plugins is not recommended in most use cases.
Fixes #36819 . See #34936 .
Props jorbin, danielbachhuber for documentation.
Built from https://develop.svn.wordpress.org/trunk@37588
git-svn-id: http://core.svn.wordpress.org/trunk@37556 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-27 19:20:29 +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
4b51bc18cc
Plugins: In `plugin_basename()` normalize the file path before unresolving symlinks.
...
`$wp_plugin_paths` contains normalized paths, see `wp_register_plugin_realpath()`.
Props jdgrimes, voldemortensen, flyingdr, ocean90.
Fixes #29154 .
Built from https://develop.svn.wordpress.org/trunk@37332
git-svn-id: http://core.svn.wordpress.org/trunk@37298 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-30 15:09:27 +00:00
Dominik Schilling
f3c20d5011
Docs: Fix indentation in `add_filter()` example.
...
See #32246 .
Built from https://develop.svn.wordpress.org/trunk@36392
git-svn-id: http://core.svn.wordpress.org/trunk@36359 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-25 18:58:27 +00:00
John Blackbourn
7e43e20436
Docs: `@see != @since`.
...
See #32246
Built from https://develop.svn.wordpress.org/trunk@36073
git-svn-id: http://core.svn.wordpress.org/trunk@36038 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-23 07:13:26 +00:00
John Blackbourn
c2248060fe
Add missing variadic markers to the optional parameters of `do_action()` and `apply_filters()`.
...
See #32246
Built from https://develop.svn.wordpress.org/trunk@35912
git-svn-id: http://core.svn.wordpress.org/trunk@35876 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-14 02:36:25 +00:00
John Blackbourn
2984cdf457
Revert [35910].
...
Built from https://develop.svn.wordpress.org/trunk@35911
git-svn-id: http://core.svn.wordpress.org/trunk@35875 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-14 02:35:26 +00:00
John Blackbourn
de7ccd262a
Built from https://develop.svn.wordpress.org/trunk@35910
...
git-svn-id: http://core.svn.wordpress.org/trunk@35874 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-14 02:33:25 +00:00
John Blackbourn
aa35e473f7
`callback` is not a valid type in PHP, PSR-5, or phpDocumentor. `callable` should be used instead.
...
Fixes #34032
Built from https://develop.svn.wordpress.org/trunk@34566
git-svn-id: http://core.svn.wordpress.org/trunk@34530 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-25 23:58:25 +00:00
Drew Jaynes
33a1c0fc16
Docs: Clarify the significance of the `$accepted_args` parameter value in the documentation for `add_filter()`.
...
Adds a couple of examples to illustrate callbacks accepting a variable number of arguments.
Fixes #33862 .
Built from https://develop.svn.wordpress.org/trunk@34288
git-svn-id: http://core.svn.wordpress.org/trunk@34252 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-18 14:53:28 +00:00
Scott Taylor
ef87172270
`foreach` is a statement, not a function.
...
See #33491 .
Built from https://develop.svn.wordpress.org/trunk@33734
git-svn-id: http://core.svn.wordpress.org/trunk@33702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-25 20:28:22 +00:00
Scott Taylor
a0e373ef80
For doc block types, favor `bool` over the few remaining `boolean`s
...
See #32444 .
Built from https://develop.svn.wordpress.org/trunk@32964
git-svn-id: http://core.svn.wordpress.org/trunk@32935 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-27 01:03:25 +00:00
John Blackbourn
768d8507e5
Correct a typo in the inline docs for `add_action()`.
...
Props nabil_kadimi, swissspidy
Fixes #32697
Built from https://develop.svn.wordpress.org/trunk@32829
git-svn-id: http://core.svn.wordpress.org/trunk@32800 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-18 08:37:25 +00:00
Scott Taylor
19a3aacc94
Add `@static*` annotations where they are missing.
...
Initialize all static vars that are not, most to `null`.
See #32444 .
Built from https://develop.svn.wordpress.org/trunk@32650
git-svn-id: http://core.svn.wordpress.org/trunk@32620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-29 15:43:29 +00:00
Scott Taylor
fd04235a04
Add missing doc blocks to `plugin.php`.
...
`has_filter()` can use strict comparison when checking `$has` internally.
See #32444 .
Built from https://develop.svn.wordpress.org/trunk@32615
git-svn-id: http://core.svn.wordpress.org/trunk@32585 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-27 15:56:26 +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
Drew Jaynes
31d731cfe4
Fix a typo in the description for the `_wp_filter_build_unique_id()` DocBlock.
...
Props lamosty.
Fixes #31732 .
Built from https://develop.svn.wordpress.org/trunk@31859
git-svn-id: http://core.svn.wordpress.org/trunk@31838 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-22 22:56:27 +00:00
Scott Taylor
b4869ed42f
Avoid function calls on each iteration of a `for` loop.
...
See #30799 .
Built from https://develop.svn.wordpress.org/trunk@31678
git-svn-id: http://core.svn.wordpress.org/trunk@31659 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-08 23:01:26 +00:00
Scott Taylor
60b0cd7943
The keyword `elseif` should be used instead of `else if` so that all control keywords look like single words.
...
This was a mess, is now standardized across the codebase, except for a few 3rd-party libs.
See #30799 .
Built from https://develop.svn.wordpress.org/trunk@31090
git-svn-id: http://core.svn.wordpress.org/trunk@31071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-08 07:05:25 +00:00
Boone Gorges
36f36dca77
In `remove_all_filters()`, only remove callbacks that match the `$priority` parameter.
...
Props GeertDD, valendesigns.
Fixes #20920 .
Built from https://develop.svn.wordpress.org/trunk@31014
git-svn-id: http://core.svn.wordpress.org/trunk@30995 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-31 19:07:24 +00:00
Drew Jaynes
188e47869f
Ensure inline code is markdown-escaped as such, HTML tags are removed from summaries, and that code snippets in descriptions are properly indented.
...
Affects DocBlocks for the following core elements:
* Markdown-indent a code snippet in the description for `wp_salt()`
* Backtick-escape inline code in the return description for `get_avatar()`
* Various markdown formatting in the description for `add_filter()`
* Markdown-indent a code snippet in the description for `apply_filters()`
* Backtick-escape inline code in the `@see` description for `apply_filters_ref_array()`
* Backtick-escape inline code in the description for `do_action()`
* Backtick-escape variables in the parameter and return descriptions for `do_action_ref_array()`
* Various markdown formatting in the description for `get_plugin_data()`
Props rarst.
See #30473 .
Built from https://develop.svn.wordpress.org/trunk@30544
git-svn-id: http://core.svn.wordpress.org/trunk@30533 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-24 06:05:23 +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
Mark Jaquith
e1f2b3b9e2
Use HTTPS URLs for trac.wordpress.org (and use core.trac.wordpress.org)
...
see #27115
Built from https://develop.svn.wordpress.org/trunk@29789
git-svn-id: http://core.svn.wordpress.org/trunk@29561 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-29 13:37:16 +00:00
Andrew Nacin
b5f0a32baa
Unit tests for has_filter() not resetting the array pointer.
...
props pento.
fixes #29070 . see [29472].
Built from https://develop.svn.wordpress.org/trunk@29665
git-svn-id: http://core.svn.wordpress.org/trunk@29439 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-02 06:50:15 +00:00
Scott Taylor
d45cde548e
After [29422], make sure the internal array counter is not reset for the `$wp_filter` global.
...
Props kovshenin.
See #29070 .
Built from https://develop.svn.wordpress.org/trunk@29472
git-svn-id: http://core.svn.wordpress.org/trunk@29250 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-12 14:47:17 +00:00
Scott Taylor
8f73ec76d1
After [28883], ensure that priorities have callbacks before returning `true` in `has_filter()`.
...
Adds unit tests.
Props boonebgorges.
Fixes #29070 .
Built from https://develop.svn.wordpress.org/trunk@29422
git-svn-id: http://core.svn.wordpress.org/trunk@29200 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-07 02:30:20 +00:00
Drew Jaynes
e7f7fcbab8
General phpDoc fixes in wp-includes/plugin.php.
...
See #28516 .
Built from https://develop.svn.wordpress.org/trunk@28891
git-svn-id: http://core.svn.wordpress.org/trunk@28690 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-29 09:19:15 +00:00
Sergey Biryukov
341eca6024
List the expected @param type first.
...
see #28516 .
Built from https://develop.svn.wordpress.org/trunk@28889
git-svn-id: http://core.svn.wordpress.org/trunk@28688 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-29 08:47:14 +00:00
Sergey Biryukov
7bb7693dd1
More tweaks to @param docs in wp-includes/plugin.php.
...
see #28516 .
Built from https://develop.svn.wordpress.org/trunk@28888
git-svn-id: http://core.svn.wordpress.org/trunk@28687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-29 08:42:16 +00:00
Scott Taylor
62075239b8
Update `@param` docs in `plugin.php`
...
Props dkotter.
Fixes #28516 .
Built from https://develop.svn.wordpress.org/trunk@28886
git-svn-id: http://core.svn.wordpress.org/trunk@28685 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-28 04:50:15 +00:00
Scott Taylor
0289b98648
After [28883], `remove_filter()` should set `$GLOBALS['wp_filter'][ $tag ]` to `array()` when empty.
...
Props wonderboymusic, sphoid.
Fixes #28142 .
Built from https://develop.svn.wordpress.org/trunk@28884
git-svn-id: http://core.svn.wordpress.org/trunk@28683 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-28 04:38:15 +00:00
Scott Taylor
9275c87190
`remove_all_filters()` should set to `array()`, not call `unset()`.
...
Props nacin, c3mdigital.
Fixes #19306 .
Built from https://develop.svn.wordpress.org/trunk@28883
git-svn-id: http://core.svn.wordpress.org/trunk@28682 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-28 04:27:15 +00:00
Drew Jaynes
320b3751a3
Add a missing `@since 3.9.0` to the PHPDoc for `wp_register_plugin_realpath()`.
...
See #16953 , #27700 .
Built from https://develop.svn.wordpress.org/trunk@28011
git-svn-id: http://core.svn.wordpress.org/trunk@27841 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-07 21:34:14 +00:00
Drew Jaynes
4ed628a7c6
Improve inline documentation for functionality in wp-includes/plugin.php added in 3.9.
...
See #14994 , #27700 .
Built from https://develop.svn.wordpress.org/trunk@28010
git-svn-id: http://core.svn.wordpress.org/trunk@27840 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-07 21:30:14 +00:00
Andrew Nacin
0b5729216d
Don't try to resolve symlinks for single-file plugins. plugins_url() should not be used in this context anyway.
...
props rmccue.
fixes #16953 .
Built from https://develop.svn.wordpress.org/trunk@27999
git-svn-id: http://core.svn.wordpress.org/trunk@27829 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-07 20:15:15 +00:00
Andrew Nacin
076077383d
Introduce doing_filter() and doing_action() to identify hooks in progress.
...
did_action() returns true the moment a hook is initially run, leaving you no way to tell if the hook is still in progress. Hooks can be nested and this checks the entire stack, versus current_filter() which only identifies the final hook in the stack. This commit also introduces current_action() for parity.
To tell if a hook has completed, one can use did_action() and ! doing_action() together.
The functions do not require an argument. In that situation, they indicate whether the stack is empty.
props ericmann for the initial unit tests.
fixes #14994 .
Built from https://develop.svn.wordpress.org/trunk@27294
git-svn-id: http://core.svn.wordpress.org/trunk@27150 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-26 18:44:14 +00:00
Drew Jaynes
cb8951b0b3
Remove all `@package` and `@subpackage` PHPDoc tags not at the file- or class-levels in core.
...
See #27200 .
Built from https://develop.svn.wordpress.org/trunk@27262
git-svn-id: http://core.svn.wordpress.org/trunk@27119 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-25 17:14:14 +00:00
Andrew Nacin
5f0981788d
Detect and handle symlinking of plugins in plugin_basename().
...
props rmccue, MikeSchinkel, jdgrimes.
see #16953 .
Built from https://develop.svn.wordpress.org/trunk@27158
git-svn-id: http://core.svn.wordpress.org/trunk@27024 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-10 23:00:15 +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