mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-22 04:23:01 +00:00
Add has_action method
This commit is contained in:
parent
3ec7722453
commit
1d09c22f3a
3 changed files with 23 additions and 0 deletions
|
@ -14,6 +14,7 @@
|
|||
- An identicon is rendered if a user hasn't specified an email address or uploaded a gravatar yet either
|
||||
- Added `avatars_show` and `avatars_size` settings to control the displaying & size of rendered avatars.
|
||||
- Added the `avatar` action, which 307 redirects to the appropriate avatar image
|
||||
- Added `has_action` to make detecting enabled features easier (even if they move modules)
|
||||
|
||||
### Changed
|
||||
- Updated MathJax CDN link, as cdn.mathjax.org is being retired ([source](https://www.mathjax.org/cdn-shutting-down/)).
|
||||
|
|
|
@ -1720,6 +1720,17 @@ function add_action($action_name, $func)
|
|||
global $actions;
|
||||
$actions->$action_name = $func;
|
||||
}
|
||||
/**
|
||||
* Figures out whether a given action is currently registered.
|
||||
* Only guaranteed to be accurate in inside an existing action function
|
||||
* @param string $action_name The name of the action to search for
|
||||
* @return boolean Whether an action with the specified name exists.
|
||||
*/
|
||||
function has_action($action_name)
|
||||
{
|
||||
global $actions;
|
||||
return !empty($actions->action_name);
|
||||
}
|
||||
|
||||
$parsers = [
|
||||
"none" => function() {
|
||||
|
|
11
core.php
11
core.php
|
@ -1371,6 +1371,17 @@ function add_action($action_name, $func)
|
|||
global $actions;
|
||||
$actions->$action_name = $func;
|
||||
}
|
||||
/**
|
||||
* Figures out whether a given action is currently registered.
|
||||
* Only guaranteed to be accurate in inside an existing action function
|
||||
* @param string $action_name The name of the action to search for
|
||||
* @return boolean Whether an action with the specified name exists.
|
||||
*/
|
||||
function has_action($action_name)
|
||||
{
|
||||
global $actions;
|
||||
return !empty($actions->action_name);
|
||||
}
|
||||
|
||||
$parsers = [
|
||||
"none" => function() {
|
||||
|
|
Loading…
Reference in a new issue