/var/www/leolaart.com/www/wp-includes
NameSizeModeActions
abilities-api/-0777rm
ai-client/-0777rm
assets/-0777rm
block-bindings/-0777rm
block-patterns/-0777rm
block-supports/-0777rm
blocks/-0777rm
build/-0777rm
certificates/-0777rm
css/-0777rm
customize/-0777rm
fonts/-0777rm
html-api/-0777rm
ID3/-0777rm
images/-0777rm
interactivity-api/-0777rm
IXR/-0777rm
js/-0777rm
l10n/-0777rm
php-ai-client/-0777rm
php-compat/-0777rm
PHPMailer/-0777rm
pomo/-0777rm
Requests/-0777rm
rest-api/-0777rm
SimplePie/-0777rm
sitemaps/-0777rm
sodium_compat/-0777rm
style-engine/-0777rm
Text/-0777rm
theme-compat/-0777rm
widgets/-0777rm
abilities-api.php328000666editdlrm
abilities.php117970666editdlrm
admin-bar.php400670666editdlrm
ai-client.php25490666editdlrm
atomlib.php121810666editdlrm
author-template.php198440666editdlrm
block-bindings.php76320666editdlrm
block-editor.php287240666editdlrm
block-i18n.json3160666editdlrm
block-patterns.php156060666editdlrm
block-template-utils.php631680666editdlrm
block-template.php182570666editdlrm
blocks.php1242050666editdlrm
bookmark-template.php127680666editdlrm
bookmark.php154270666editdlrm
cache-compat.php110210666editdlrm
cache.php134860666editdlrm
canonical.php347860666editdlrm
capabilities.php435840666editdlrm
category-template.php569900666editdlrm
category.php128340666editdlrm
class-avif-info.php300080666editdlrm
class-feed.php5390666editdlrm
class-http.php3670666editdlrm
class-IXR.php26090666editdlrm
class-json.php436760666editdlrm
class-oembed.php4010666editdlrm
class-phpass.php67710666editdlrm
class-phpmailer.php6640666editdlrm
class-pop3.php211000666editdlrm
class-requests.php22370666editdlrm
class-simplepie.php4530666editdlrm
class-smtp.php4570666editdlrm
class-snoopy.php377150666editdlrm
class-walker-category-dropdown.php24690666editdlrm
class-walker-category.php84770666editdlrm
class-walker-comment.php142210666editdlrm
class-walker-nav-menu.php120440666editdlrm
class-walker-page-dropdown.php27100666editdlrm
class-walker-page.php76120666editdlrm
class-wp-admin-bar.php180020666editdlrm
class-wp-ajax-response.php52880666editdlrm
class-wp-application-passwords.php170990666editdlrm
class-wp-block-bindings-registry.php82630666editdlrm
class-wp-block-bindings-source.php29920666editdlrm
class-wp-block-editor-context.php13500666editdlrm
class-wp-block-list.php47130666editdlrm
class-wp-block-metadata-registry.php118460666editdlrm
class-wp-block-parser-block.php25550666editdlrm
class-wp-block-parser-frame.php19940666editdlrm
class-wp-block-parser.php115250666editdlrm
class-wp-block-pattern-categories-registry.php43830666editdlrm
class-wp-block-patterns-registry.php102650666editdlrm
class-wp-block-processor.php699140666editdlrm
class-wp-block-styles-registry.php64190666editdlrm
class-wp-block-supports.php75780666editdlrm
class-wp-block-template.php21110666editdlrm
class-wp-block-templates-registry.php70800666editdlrm
class-wp-block-type-registry.php53050666editdlrm
class-wp-block-type.php172220666editdlrm
class-wp-block.php282360666editdlrm
class-wp-classic-to-block-menu-converter.php40260666editdlrm
class-wp-comment-query.php490400666editdlrm
class-wp-comment.php172490666editdlrm
class-wp-connector-registry.php151810666editdlrm
class-wp-customize-control.php261120666editdlrm
class-wp-customize-manager.php2029080666editdlrm
class-wp-customize-nav-menus.php580340666editdlrm
class-wp-customize-panel.php107030666editdlrm
class-wp-customize-section.php112090666editdlrm
class-wp-customize-setting.php299560666editdlrm
class-wp-customize-widgets.php725960666editdlrm
class-wp-date-query.php359700666editdlrm
class-wp-dependencies.php170890666editdlrm
class-wp-dependency.php26530666editdlrm
class-wp-duotone.php408360666editdlrm
class-wp-editor.php722280666editdlrm
class-wp-embed.php159080666editdlrm
class-wp-error.php75140666editdlrm
class-wp-exception.php2530666editdlrm
class-wp-fatal-error-handler.php81500666editdlrm
class-wp-feed-cache-transient.php33040666editdlrm
class-wp-feed-cache.php9690666editdlrm
class-wp-filter-sentinel.php7600666editdlrm
class-wp-hook.php174720666editdlrm
class-wp-http-cookie.php72690666editdlrm
class-wp-http-curl.php132610666editdlrm
class-wp-http-encoding.php66890666editdlrm
class-wp-http-ixr-client.php35160666editdlrm
class-wp-http-proxy.php59800666editdlrm
class-wp-http-requests-hooks.php20220666editdlrm
class-wp-http-requests-response.php42430666editdlrm
class-wp-http-response.php29770666editdlrm
class-wp-http-streams.php167640666editdlrm
class-wp-http.php416410666editdlrm
class-wp-icon-collections-registry.php58050666editdlrm
class-wp-icons-registry.php99030666editdlrm
class-wp-image-editor-gd.php207410666editdlrm
class-wp-image-editor-imagick.php434540666editdlrm
class-wp-image-editor.php174560666editdlrm
class-wp-list-util.php74430666editdlrm
class-wp-locale-switcher.php67760666editdlrm
class-wp-locale.php168480666editdlrm
class-wp-matchesmapregex.php18280666editdlrm
class-wp-meta-query.php305070666editdlrm
class-wp-metadata-lazyloader.php68330666editdlrm
class-wp-navigation-fallback.php91930666editdlrm
class-wp-network-query.php199890666editdlrm
class-wp-network.php124110666editdlrm
class-wp-object-cache.php175240666editdlrm
class-wp-oembed-controller.php69050666editdlrm
class-wp-oembed.php343720666editdlrm
class-wp-paused-extensions-storage.php50670666editdlrm
class-wp-phpmailer.php43480666editdlrm
class-wp-plugin-dependencies.php252090666editdlrm
class-wp-post-type.php306720666editdlrm
class-wp-post.php88060666editdlrm
class-wp-query.php1641480666editdlrm
class-wp-recovery-mode-cookie-service.php68770666editdlrm
class-wp-recovery-mode-email-service.php111620666editdlrm
class-wp-recovery-mode-key-service.php49140666editdlrm
class-wp-recovery-mode-link-service.php35230666editdlrm
class-wp-recovery-mode.php114600666editdlrm
class-wp-rewrite.php636930666editdlrm
class-wp-role.php25230666editdlrm
class-wp-roles.php93260666editdlrm
class-wp-script-modules.php407430666editdlrm
class-wp-scripts.php367540666editdlrm
class-wp-session-tokens.php73190666editdlrm
class-wp-simplepie-file.php35520666editdlrm
class-wp-simplepie-sanitize-kses.php19030666editdlrm
class-wp-site-query.php314820666editdlrm
class-wp-site.php78360666editdlrm
class-wp-speculation-rules.php78840666editdlrm
class-wp-styles.php133160666editdlrm
class-wp-tax-query.php195770666editdlrm
class-wp-taxonomy.php185590666editdlrm
class-wp-term-query.php407510666editdlrm
class-wp-term.php52630666editdlrm
class-wp-text-diff-renderer-inline.php9790666editdlrm
class-wp-text-diff-renderer-table.php189250666editdlrm
class-wp-textdomain-registry.php104810666editdlrm
class-wp-theme-json-data.php18050666editdlrm
class-wp-theme-json-resolver.php356920666editdlrm
class-wp-theme-json-schema.php73670666editdlrm
class-wp-theme-json.php2215060666editdlrm
class-wp-theme.php658110666editdlrm
class-wp-token-map.php290320666editdlrm
class-wp-url-pattern-prefixer.php48020666editdlrm
class-wp-user-meta-session-tokens.php29540666editdlrm
class-wp-user-query.php441020666editdlrm
class-wp-user-request.php23420666editdlrm
class-wp-user.php231890666editdlrm
class-wp-view-config-data.php294270666editdlrm
class-wp-walker.php132920666editdlrm
class-wp-widget-factory.php33430666editdlrm
class-wp-widget.php184520666editdlrm
class-wp-xmlrpc-server.php2162720666editdlrm
class-wp.php263710666editdlrm
class-wpdb.php1214370666editdlrm
class.wp-dependencies.php3730666editdlrm
class.wp-scripts.php3430666editdlrm
class.wp-styles.php3380666editdlrm
comment-template.php1032110666editdlrm
comment.php1506300666editdlrm
compat-utf8.php193860666editdlrm
compat.php224790666editdlrm
connectors.php329220666editdlrm
cron.php462660666editdlrm
date.php4000666editdlrm
default-constants.php113650666editdlrm
default-filters.php395000666editdlrm
default-widgets.php22880666editdlrm
deprecated.php1939770666editdlrm
embed-template.php3380666editdlrm
embed.php392150666editdlrm
error-protection.php40920666editdlrm
feed-atom-comments.php55040666editdlrm
feed-atom.php31140666editdlrm
feed-rdf.php26680666editdlrm
feed-rss.php11890666editdlrm
feed-rss2-comments.php41360666editdlrm
feed-rss2.php37990666editdlrm
feed.php251890666editdlrm
fonts.php97890666editdlrm
formatting.php3576520666editdlrm
functions.php2954810666editdlrm
functions.wp-scripts.php204920666editdlrm
functions.wp-styles.php86540666editdlrm
general-template.php1834720666editdlrm
global-styles-and-settings.php207800666editdlrm
http.php289610666editdlrm
https-detection.php58570666editdlrm
https-migration.php47410666editdlrm
icons.php63340666editdlrm
json-schema.php78020666editdlrm
kses.php884970666editdlrm
l10n.php714150666editdlrm
link-template.php1601430666editdlrm
load.php564750666editdlrm
locale.php1620666editdlrm
media-template.php657590666editdlrm
media.php2368040666editdlrm
meta.php667390666editdlrm
ms-blogs.php263240666editdlrm
ms-default-constants.php49210666editdlrm
ms-default-filters.php66360666editdlrm
ms-deprecated.php217870666editdlrm
ms-files.php28570666editdlrm
ms-functions.php925300666editdlrm
ms-load.php200550666editdlrm
ms-network.php37820666editdlrm
ms-settings.php41970666editdlrm
ms-site.php417290666editdlrm
nav-menu-template.php259830666editdlrm
nav-menu.php442690666editdlrm
option.php1052460666editdlrm
pluggable-deprecated.php63240666editdlrm
pluggable.php1279190666editdlrm
plugin.php366690666editdlrm
post-formats.php70700666editdlrm
post-template.php691290666editdlrm
post-thumbnail-template.php108790666editdlrm
post.php3052150666editdlrm
query.php375540666editdlrm
registration-functions.php2000666editdlrm
registration.php2000666editdlrm
rest-api.php1029510666editdlrm
revision.php312410666editdlrm
rewrite.php195670666editdlrm
robots-template.php51850666editdlrm
rss-functions.php2770666editdlrm
rss.php232030666editdlrm
script-loader.php1635500666editdlrm
script-modules.php123110666editdlrm
session.php2580666editdlrm
shortcodes.php240340666editdlrm
sitemaps.php32380666editdlrm
speculative-loading.php118800666editdlrm
spl-autoload-compat.php4410666editdlrm
style-engine.php80450666editdlrm
taxonomy.php1783070666editdlrm
template-canvas.php5440666editdlrm
template-loader.php42670666editdlrm
template.php368240666editdlrm
theme-i18n.json18920666editdlrm
theme-previews.php28870666editdlrm
theme-templates.php40600666editdlrm
theme.json94800666editdlrm
theme.php1346410666editdlrm
update.php382690666editdlrm
user.php1803010666editdlrm
utf8.php69770666editdlrm
vars.php66000666editdlrm
version.php11010666editdlrm
view-config.php190870666editdlrm
view-transitions.php6020666editdlrm
widgets.php708660666editdlrm
wp-db.php4450666editdlrm
wp-diff.php7920666editdlrm
Edit: /var/www/leolaart.com/www/wp-includes/plugin.php (36669B)
add_filter( $hook_name, $callback, $priority, $accepted_args ); return true; } /** * Calls the callback functions that have been added to a filter hook. * * This function invokes all functions attached to filter hook `$hook_name`. * It is possible to create new filter hooks by simply calling this function, * specifying the name of the new hook using the `$hook_name` parameter. * * The function also allows for multiple additional arguments to be passed to hooks. * * Example usage: * * // The filter callback function. * function example_callback( $string, $arg1, $arg2 ) { * // (maybe) modify $string. * return $string; * } * add_filter( 'example_filter', 'example_callback', 10, 3 ); * * /* * * Apply the filters by calling the 'example_callback()' function * * that's hooked onto `example_filter` above. * * * * - 'example_filter' is the filter hook. * * - 'filter me' is the value being filtered. * * - $arg1 and $arg2 are the additional arguments passed to the callback. * $value = apply_filters( 'example_filter', 'filter me', $arg1, $arg2 ); * * @since 0.71 * @since 6.0.0 Formalized the existing and already documented `...$args` parameter * by adding it to the function signature. * * @global WP_Hook[] $wp_filter Stores all of the filters and actions. * @global int[] $wp_filters Stores the number of times each filter was triggered. * @global string[] $wp_current_filter Stores the list of current filters with the current one last. * * @param string $hook_name The name of the filter hook. * @param mixed $value The value to filter. * @param mixed ...$args Optional. Additional parameters to pass to the callback functions. * @return mixed The filtered value after all hooked functions are applied to it. */ function apply_filters( $hook_name, $value, ...$args ) { global $wp_filter, $wp_filters, $wp_current_filter; if ( ! isset( $wp_filters[ $hook_name ] ) ) { $wp_filters[ $hook_name ] = 1; } else { ++$wp_filters[ $hook_name ]; } // Do 'all' actions first. if ( isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; $all_args = func_get_args(); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection _wp_call_all_hook( $all_args ); } if ( ! isset( $wp_filter[ $hook_name ] ) ) { if ( isset( $wp_filter['all'] ) ) { array_pop( $wp_current_filter ); } return $value; } if ( ! isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; } // Pass the value to WP_Hook. array_unshift( $args, $value ); $filtered = $wp_filter[ $hook_name ]->apply_filters( $value, $args ); array_pop( $wp_current_filter ); return $filtered; } /** * Calls the callback functions that have been added to a filter hook, specifying arguments in an array. * * @since 3.0.0 * * @see apply_filters() This function is identical, but the arguments passed to the * functions hooked to `$hook_name` are supplied using an array. * * @global WP_Hook[] $wp_filter Stores all of the filters and actions. * @global int[] $wp_filters Stores the number of times each filter was triggered. * @global string[] $wp_current_filter Stores the list of current filters with the current one last. * * @param string $hook_name The name of the filter hook. * @param array $args The arguments supplied to the functions hooked to `$hook_name`. * @return mixed The filtered value after all hooked functions are applied to it. */ function apply_filters_ref_array( $hook_name, $args ) { global $wp_filter, $wp_filters, $wp_current_filter; if ( ! isset( $wp_filters[ $hook_name ] ) ) { $wp_filters[ $hook_name ] = 1; } else { ++$wp_filters[ $hook_name ]; } // Do 'all' actions first. if ( isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; $all_args = func_get_args(); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection _wp_call_all_hook( $all_args ); } if ( ! isset( $wp_filter[ $hook_name ] ) ) { if ( isset( $wp_filter['all'] ) ) { array_pop( $wp_current_filter ); } return $args[0]; } if ( ! isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; } $filtered = $wp_filter[ $hook_name ]->apply_filters( $args[0], $args ); array_pop( $wp_current_filter ); return $filtered; } /** * Checks if any filter has been registered for a hook. * * When using the `$callback` argument, this function may return a non-boolean value * that evaluates to false (e.g. 0), so use the `===` operator for testing the return value. * * @since 2.5.0 * @since 6.9.0 Added the `$priority` parameter. * * @global WP_Hook[] $wp_filter Stores all of the filters and actions. * * @param string $hook_name The name of the filter hook. * @param callable|string|array|false $callback Optional. The callback to check for. * This function can be called unconditionally to speculatively check * a callback that may or may not exist. Default false. * @param int|false $priority Optional. The specific priority at which to check for the callback. * Default false. * @return bool|int If `$callback` is omitted, returns boolean for whether the hook has * anything registered. When checking a specific function, the priority * of that hook is returned, or false if the function is not attached. * If `$callback` and `$priority` are both provided, a boolean is returned * for whether the specific function is registered at that priority. */ function has_filter( $hook_name, $callback = false, $priority = false ) { global $wp_filter; if ( ! isset( $wp_filter[ $hook_name ] ) ) { return false; } return $wp_filter[ $hook_name ]->has_filter( $hook_name, $callback, $priority ); } /** * Removes a callback function from a filter hook. * * This can be used to remove default functions attached to a specific filter * hook and possibly replace them with a substitute. * * To remove a hook, the `$callback` and `$priority` arguments must match * when the hook was added. This goes for both filters and actions. No warning * will be given on removal failure. * * @since 1.2.0 * * @global WP_Hook[] $wp_filter Stores all of the filters and actions. * * @param string $hook_name The filter hook to which the function to be removed is hooked. * @param callable|string|array $callback The callback to be removed from running when the filter is applied. * This function can be called unconditionally to speculatively remove * a callback that may or may not exist. * @param int $priority Optional. The exact priority used when adding the original * filter callback. Default 10. * @return bool Whether the function existed before it was removed. */ function remove_filter( $hook_name, $callback, $priority = 10 ) { global $wp_filter; $r = false; if ( isset( $wp_filter[ $hook_name ] ) ) { $r = $wp_filter[ $hook_name ]->remove_filter( $hook_name, $callback, $priority ); if ( ! $wp_filter[ $hook_name ]->callbacks ) { unset( $wp_filter[ $hook_name ] ); } } return $r; } /** * Removes all of the callback functions from a filter hook. * * @since 2.7.0 * * @global WP_Hook[] $wp_filter Stores all of the filters and actions. * * @param string $hook_name The filter to remove callbacks from. * @param int|false $priority Optional. The priority number to remove them from. * Default false. * @return true Always returns true. */ function remove_all_filters( $hook_name, $priority = false ) { global $wp_filter; if ( isset( $wp_filter[ $hook_name ] ) ) { $wp_filter[ $hook_name ]->remove_all_filters( $priority ); if ( ! $wp_filter[ $hook_name ]->has_filters() ) { unset( $wp_filter[ $hook_name ] ); } } return true; } /** * Retrieves the name of the current filter hook. * * @since 2.5.0 * * @global string[] $wp_current_filter Stores the list of current filters with the current one last * * @return string|false Hook name of the current filter, false if no filter is running. */ function current_filter() { global $wp_current_filter; return end( $wp_current_filter ); } /** * Returns whether or not a filter hook is currently being processed. * * The function current_filter() only returns the most recent filter being executed. * did_filter() returns the number of times a filter has been applied during * the current request. * * This function allows detection for any filter currently being executed * (regardless of whether it's the most recent filter to fire, in the case of * hooks called from hook callbacks) to be verified. * * @since 3.9.0 * * @see current_filter() * @see did_filter() * @global string[] $wp_current_filter Current filter. * * @param string|null $hook_name Optional. Filter hook to check. Defaults to null, * which checks if any filter is currently being run. * @return bool Whether the filter is currently in the stack. */ function doing_filter( $hook_name = null ) { global $wp_current_filter; if ( null === $hook_name ) { return ! empty( $wp_current_filter ); } return in_array( $hook_name, $wp_current_filter, true ); } /** * Retrieves the number of times a filter has been applied during the current request. * * @since 6.1.0 * * @global int[] $wp_filters Stores the number of times each filter was triggered. * * @param string $hook_name The name of the filter hook. * @return int The number of times the filter hook has been applied. */ function did_filter( $hook_name ) { global $wp_filters; if ( ! isset( $wp_filters[ $hook_name ] ) ) { return 0; } return $wp_filters[ $hook_name ]; } /** * Adds a callback function to an action hook. * * Actions are the hooks that the WordPress core launches at specific points * during execution, or when specific events occur. Plugins can specify that * one or more of its PHP functions are executed at these points, using the * Action API. * * @since 1.2.0 * * @param string $hook_name The name of the action to add the callback to. * @param callable $callback The callback to be run when the action is called. * @param int $priority Optional. Used to specify the order in which the functions * associated with a particular action are executed. * Lower numbers correspond with earlier execution, * and functions with the same priority are executed * in the order in which they were added to the action. Default 10. * @param int $accepted_args Optional. The number of arguments the function accepts. Default 1. * @return true Always returns true. */ function add_action( $hook_name, $callback, $priority = 10, $accepted_args = 1 ) { return add_filter( $hook_name, $callback, $priority, $accepted_args ); } /** * Calls the callback functions that have been added to an action hook. * * This function invokes all functions attached to action hook `$hook_name`. * It is possible to create new action hooks by simply calling this function, * specifying the name of the new hook using the `$hook_name` parameter. * * You can pass extra arguments to the hooks, much like you can with `apply_filters()`. * * Example usage: * * // The action callback function. * function example_callback( $arg1, $arg2 ) { * // (maybe) do something with the args. * } * add_action( 'example_action', 'example_callback', 10, 2 ); * * /* * * Trigger the actions by calling the 'example_callback()' function * * that's hooked onto `example_action` above. * * * * - 'example_action' is the action hook. * * - $arg1 and $arg2 are the additional arguments passed to the callback. * do_action( 'example_action', $arg1, $arg2 ); * * @since 1.2.0 * @since 5.3.0 Formalized the existing and already documented `...$arg` parameter * by adding it to the function signature. * * @global WP_Hook[] $wp_filter Stores all of the filters and actions. * @global int[] $wp_actions Stores the number of times each action was triggered. * @global string[] $wp_current_filter Stores the list of current filters with the current one last. * * @param string $hook_name The name of the action to be executed. * @param mixed ...$arg Optional. Additional arguments which are passed on to the * functions hooked to the action. Default empty. */ function do_action( $hook_name, ...$arg ) { global $wp_filter, $wp_actions, $wp_current_filter; if ( ! isset( $wp_actions[ $hook_name ] ) ) { $wp_actions[ $hook_name ] = 1; } else { ++$wp_actions[ $hook_name ]; } // Do 'all' actions first. if ( isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; $all_args = func_get_args(); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection _wp_call_all_hook( $all_args ); } if ( ! isset( $wp_filter[ $hook_name ] ) ) { if ( isset( $wp_filter['all'] ) ) { array_pop( $wp_current_filter ); } return; } if ( ! isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; } if ( empty( $arg ) ) { $arg[] = ''; } elseif ( is_array( $arg[0] ) && 1 === count( $arg[0] ) && isset( $arg[0][0] ) && is_object( $arg[0][0] ) ) { // Backward compatibility for PHP4-style passing of `array( &$this )` as action `$arg`. $arg[0] = $arg[0][0]; } $wp_filter[ $hook_name ]->do_action( $arg ); array_pop( $wp_current_filter ); } /** * Calls the callback functions that have been added to an action hook, specifying arguments in an array. * * @since 2.1.0 * * @see do_action() This function is identical, but the arguments passed to the * functions hooked to `$hook_name` are supplied using an array. * * @global WP_Hook[] $wp_filter Stores all of the filters and actions. * @global int[] $wp_actions Stores the number of times each action was triggered. * @global string[] $wp_current_filter Stores the list of current filters with the current one last. * * @param string $hook_name The name of the action to be executed. * @param array $args The arguments supplied to the functions hooked to `$hook_name`. */ function do_action_ref_array( $hook_name, $args ) { global $wp_filter, $wp_actions, $wp_current_filter; if ( ! isset( $wp_actions[ $hook_name ] ) ) { $wp_actions[ $hook_name ] = 1; } else { ++$wp_actions[ $hook_name ]; } // Do 'all' actions first. if ( isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; $all_args = func_get_args(); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection _wp_call_all_hook( $all_args ); } if ( ! isset( $wp_filter[ $hook_name ] ) ) { if ( isset( $wp_filter['all'] ) ) { array_pop( $wp_current_filter ); } return; } if ( ! isset( $wp_filter['all'] ) ) { $wp_current_filter[] = $hook_name; } $wp_filter[ $hook_name ]->do_action( $args ); array_pop( $wp_current_filter ); } /** * Checks if any action has been registered for a hook. * * When using the `$callback` argument, this function may return a non-boolean value * that evaluates to false (e.g. 0), so use the `===` operator for testing the return value. * * @since 2.5.0 * @since 6.9.0 Added the `$priority` parameter. * * @see has_filter() This function is an alias of has_filter(). * * @param string $hook_name The name of the action hook. * @param callable|string|array|false $callback Optional. The callback to check for. * This function can be called unconditionally to speculatively check * a callback that may or may not exist. Default false. * @param int|false $priority Optional. The specific priority at which to check for the callback. * Default false. * @return bool|int If `$callback` is omitted, returns boolean for whether the hook has * anything registered. When checking a specific function, the priority * of that hook is returned, or false if the function is not attached. * If `$callback` and `$priority` are both provided, a boolean is returned * for whether the specific function is registered at that priority. */ function has_action( $hook_name, $callback = false, $priority = false ) { return has_filter( $hook_name, $callback, $priority ); } /** * Removes a callback function from an action hook. * * This can be used to remove default functions attached to a specific action * hook and possibly replace them with a substitute. * * To remove a hook, the `$callback` and `$priority` arguments must match * when the hook was added. This goes for both filters and actions. No warning * will be given on removal failure. * * @since 1.2.0 * * @param string $hook_name The action hook to which the function to be removed is hooked. * @param callable|string|array $callback The name of the function which should be removed. * This function can be called unconditionally to speculatively remove * a callback that may or may not exist. * @param int $priority Optional. The exact priority used when adding the original * action callback. Default 10. * @return bool Whether the function is removed. */ function remove_action( $hook_name, $callback, $priority = 10 ) { return remove_filter( $hook_name, $callback, $priority ); } /** * Removes all of the callback functions from an action hook. * * @since 2.7.0 * * @param string $hook_name The action to remove callbacks from. * @param int|false $priority Optional. The priority number to remove them from. * Default false. * @return true Always returns true. */ function remove_all_actions( $hook_name, $priority = false ) { return remove_all_filters( $hook_name, $priority ); } /** * Retrieves the name of the current action hook. * * @since 3.9.0 * * @return string|false Hook name of the current action, false if no action is running. */ function current_action() { return current_filter(); } /** * Returns whether or not an action hook is currently being processed. * * The function current_action() only returns the most recent action being executed. * did_action() returns the number of times an action has been fired during * the current request. * * This function allows detection for any action currently being executed * (regardless of whether it's the most recent action to fire, in the case of * hooks called from hook callbacks) to be verified. * * @since 3.9.0 * * @see current_action() * @see did_action() * * @param string|null $hook_name Optional. Action hook to check. Defaults to null, * which checks if any action is currently being run. * @return bool Whether the action is currently in the stack. */ function doing_action( $hook_name = null ) { return doing_filter( $hook_name ); } /** * Retrieves the number of times an action has been fired during the current request. * * @since 2.1.0 * * @global int[] $wp_actions Stores the number of times each action was triggered. * * @param string $hook_name The name of the action hook. * @return int The number of times the action hook has been fired. */ function did_action( $hook_name ) { global $wp_actions; if ( ! isset( $wp_actions[ $hook_name ] ) ) { return 0; } return $wp_actions[ $hook_name ]; } /** * Fires functions attached to a deprecated filter hook. * * When a filter hook is deprecated, the apply_filters() call is replaced with * apply_filters_deprecated(), which triggers a deprecation notice and then fires * the original filter hook. * * Note: the value and extra arguments passed to the original apply_filters() call * must be passed here to `$args` as an array. For example: * * // Old filter. * return apply_filters( 'wpdocs_filter', $value, $extra_arg ); * * // Deprecated. * return apply_filters_deprecated( 'wpdocs_filter', array( $value, $extra_arg ), '4.9.0', 'wpdocs_new_filter' ); * * @since 4.6.0 * * @see _deprecated_hook() * * @param string $hook_name The name of the filter hook. * @param array $args Array of additional function arguments to be passed to apply_filters(). * @param string $version The version of WordPress that deprecated the hook. * @param string $replacement Optional. The hook that should have been used. Default empty. * @param string $message Optional. A message regarding the change. Default empty. * @return mixed The filtered value after all hooked functions are applied to it. */ function apply_filters_deprecated( $hook_name, $args, $version, $replacement = '', $message = '' ) { if ( ! has_filter( $hook_name ) ) { return $args[0]; } _deprecated_hook( $hook_name, $version, $replacement, $message ); return apply_filters_ref_array( $hook_name, $args ); } /** * Fires functions attached to a deprecated action hook. * * When an action hook is deprecated, the do_action() call is replaced with * do_action_deprecated(), which triggers a deprecation notice and then fires * the original hook. * * @since 4.6.0 * * @see _deprecated_hook() * * @param string $hook_name The name of the action hook. * @param array $args Array of additional function arguments to be passed to do_action(). * @param string $version The version of WordPress that deprecated the hook. * @param string $replacement Optional. The hook that should have been used. Default empty. * @param string $message Optional. A message regarding the change. Default empty. */ function do_action_deprecated( $hook_name, $args, $version, $replacement = '', $message = '' ) { if ( ! has_action( $hook_name ) ) { return; } _deprecated_hook( $hook_name, $version, $replacement, $message ); do_action_ref_array( $hook_name, $args ); } // // Functions for handling plugins. // /** * Gets the basename of a plugin. * * This method extracts the name of a plugin from its filename. * * @since 1.5.0 * * @global array $wp_plugin_paths * * @param string $file The filename of plugin. * @return string The name of a plugin. */ function plugin_basename( $file ) { global $wp_plugin_paths; // $wp_plugin_paths contains normalized paths. $file = wp_normalize_path( $file ); arsort( $wp_plugin_paths ); foreach ( $wp_plugin_paths as $dir => $realdir ) { if ( str_starts_with( $file, $realdir ) ) { $file = $dir . substr( $file, strlen( $realdir ) ); } } $plugin_dir = wp_normalize_path( WP_PLUGIN_DIR ); $mu_plugin_dir = wp_normalize_path( WPMU_PLUGIN_DIR ); // Get relative path from plugins directory. $file = preg_replace( '#^' . preg_quote( $plugin_dir, '#' ) . '/|^' . preg_quote( $mu_plugin_dir, '#' ) . '/#', '', $file ); $file = trim( $file, '/' ); return $file; } /** * Register a plugin's real path. * * This is used in plugin_basename() to resolve symlinked paths. * * @since 3.9.0 * * @see wp_normalize_path() * * @global array $wp_plugin_paths * * @param string $file Known path to the file. * @return bool Whether the path was able to be registered. */ function wp_register_plugin_realpath( $file ) { global $wp_plugin_paths; // Normalize, but store as static to avoid recalculation of a constant value. static $wp_plugin_path = null, $wpmu_plugin_path = null; if ( ! isset( $wp_plugin_path ) ) { $wp_plugin_path = wp_normalize_path( WP_PLUGIN_DIR ); $wpmu_plugin_path = wp_normalize_path( WPMU_PLUGIN_DIR ); } $plugin_path = wp_normalize_path( dirname( $file ) ); $plugin_realpath = wp_normalize_path( dirname( realpath( $file ) ) ); if ( $plugin_path === $wp_plugin_path || $plugin_path === $wpmu_plugin_path ) { return false; } if ( $plugin_path !== $plugin_realpath ) { $wp_plugin_paths[ $plugin_path ] = $plugin_realpath; } return true; } /** * Get the filesystem directory path (with trailing slash) for the plugin __FILE__ passed in. * * @since 2.8.0 * * @param string $file The filename of the plugin (__FILE__). * @return string the filesystem path of the directory that contains the plugin. */ function plugin_dir_path( $file ) { return trailingslashit( dirname( $file ) ); } /** * Get the URL directory path (with trailing slash) for the plugin __FILE__ passed in. * * @since 2.8.0 * * @param string $file The filename of the plugin (__FILE__). * @return string the URL path of the directory that contains the plugin. */ function plugin_dir_url( $file ) { return trailingslashit( plugins_url( '', $file ) ); } /** * Set the activation hook for a plugin. * * When a plugin is activated, the action 'activate_PLUGINNAME' hook is * called. In the name of this hook, PLUGINNAME is replaced with the name * of the plugin, including the optional subdirectory. For example, when the * plugin is located in wp-content/plugins/sampleplugin/sample.php, then * the name of this hook will become 'activate_sampleplugin/sample.php'. * * When the plugin consists of only one file and is (as by default) located at * wp-content/plugins/sample.php the name of this hook will be * 'activate_sample.php'. * * @since 2.0.0 * * @param string $file The filename of the plugin including the path. * @param callable $callback The function hooked to the 'activate_PLUGIN' action. */ function register_activation_hook( $file, $callback ) { $file = plugin_basename( $file ); add_action( 'activate_' . $file, $callback ); } /** * Sets the deactivation hook for a plugin. * * When a plugin is deactivated, the action 'deactivate_PLUGINNAME' hook is * called. In the name of this hook, PLUGINNAME is replaced with the name * of the plugin, including the optional subdirectory. For example, when the * plugin is located in wp-content/plugins/sampleplugin/sample.php, then * the name of this hook will become 'deactivate_sampleplugin/sample.php'. * * When the plugin consists of only one file and is (as by default) located at * wp-content/plugins/sample.php the name of this hook will be * 'deactivate_sample.php'. * * @since 2.0.0 * * @param string $file The filename of the plugin including the path. * @param callable $callback The function hooked to the 'deactivate_PLUGIN' action. */ function register_deactivation_hook( $file, $callback ) { $file = plugin_basename( $file ); add_action( 'deactivate_' . $file, $callback ); } /** * Sets the uninstallation hook for a plugin. * * Registers the uninstall hook that will be called when the user clicks on the * uninstall link that calls for the plugin to uninstall itself. The link won't * be active unless the plugin hooks into the action. * * The plugin should not run arbitrary code outside of functions, when * registering the uninstall hook. In order to run using the hook, the plugin * will have to be included, which means that any code laying outside of a * function will be run during the uninstallation process. The plugin should not * hinder the uninstallation process. * * If the plugin can not be written without running code within the plugin, then * the plugin should create a file named 'uninstall.php' in the base plugin * folder. This file will be called, if it exists, during the uninstallation process * bypassing the uninstall hook. The plugin, when using the 'uninstall.php' * should always check for the 'WP_UNINSTALL_PLUGIN' constant, before * executing. * * @since 2.7.0 * * @param string $file Plugin file. * @param callable $callback The callback to run when the hook is called. Must be * a static method or function. */ function register_uninstall_hook( $file, $callback ) { if ( is_array( $callback ) && is_object( $callback[0] ) ) { _doing_it_wrong( __FUNCTION__, __( 'Only a static class method or function can be used in an uninstall hook.' ), '3.1.0' ); return; } /* * The option should not be autoloaded, because it is not needed in most * cases. Emphasis should be put on using the 'uninstall.php' way of * uninstalling the plugin. */ $uninstallable_plugins = (array) get_option( 'uninstall_plugins' ); $plugin_basename = plugin_basename( $file ); if ( ! isset( $uninstallable_plugins[ $plugin_basename ] ) || $uninstallable_plugins[ $plugin_basename ] !== $callback ) { $uninstallable_plugins[ $plugin_basename ] = $callback; update_option( 'uninstall_plugins', $uninstallable_plugins ); } } /** * Calls the 'all' hook, which will process the functions hooked into it. * * The 'all' hook passes all of the arguments or parameters that were used for * the hook, which this function was called for. * * This function is used internally for apply_filters(), do_action(), and * do_action_ref_array() and is not meant to be used from outside those * functions. This function does not check for the existence of the all hook, so * it will fail unless the all hook exists prior to this function call. * * @since 2.5.0 * @access private * * @global WP_Hook[] $wp_filter Stores all of the filters and actions. * * @param array $args The collected parameters from the hook that was called. */ function _wp_call_all_hook( $args ) { global $wp_filter; $wp_filter['all']->do_all_hook( $args ); } /** * Builds a unique string ID for a hook callback function. * * Functions and static method callbacks are just returned as strings and * shouldn't have any speed penalty. * * @link https://core.trac.wordpress.org/ticket/3875 * * @since 2.2.3 * @since 5.3.0 Removed workarounds for spl_object_hash(). * `$hook_name` and `$priority` are no longer used, * and no longer returns false, but can still return void for invalid callbacks. * @since 6.9.0 Returns explicit null if an invalid callback is supplied. * @since 7.1.0 Uses spl_object_id() instead of spl_object_hash() for performance. * * @access private * * @param string $hook_name Unused. The name of the filter to build ID for. * @param callable $callback The callback to generate ID for. The callback may * or may not exist. * @param int $priority Unused. The order in which the functions * associated with a particular action are executed. * @return string|null Unique function ID for usage as array key, or null if it couldn't be determined. */ function _wp_filter_build_unique_id( $hook_name, $callback, $priority ): ?string { if ( is_string( $callback ) ) { return $callback; } if ( is_object( $callback ) ) { return (string) spl_object_id( $callback ); } if ( ! isset( $callback[1] ) || ! is_string( $callback[1] ) ) { return null; } if ( is_object( $callback[0] ) ) { // Object class calling. return ( (string) spl_object_id( $callback[0] ) ) . $callback[1]; } elseif ( is_string( $callback[0] ) ) { // Static calling. return $callback[0] . '::' . $callback[1]; } return null; }