Edit File by line
/home/zeestwma/richards.../wp-inclu...
File: plugin.php
}
[500] Fix | Delete
[501] Fix | Delete
return;
[502] Fix | Delete
}
[503] Fix | Delete
[504] Fix | Delete
if ( ! isset( $wp_filter['all'] ) ) {
[505] Fix | Delete
$wp_current_filter[] = $hook_name;
[506] Fix | Delete
}
[507] Fix | Delete
[508] Fix | Delete
if ( empty( $arg ) ) {
[509] Fix | Delete
$arg[] = '';
[510] Fix | Delete
} elseif ( is_array( $arg[0] ) && 1 === count( $arg[0] ) && isset( $arg[0][0] ) && is_object( $arg[0][0] ) ) {
[511] Fix | Delete
// Backward compatibility for PHP4-style passing of `array( &$this )` as action `$arg`.
[512] Fix | Delete
$arg[0] = $arg[0][0];
[513] Fix | Delete
}
[514] Fix | Delete
[515] Fix | Delete
$wp_filter[ $hook_name ]->do_action( $arg );
[516] Fix | Delete
[517] Fix | Delete
array_pop( $wp_current_filter );
[518] Fix | Delete
}
[519] Fix | Delete
[520] Fix | Delete
/**
[521] Fix | Delete
* Calls the callback functions that have been added to an action hook, specifying arguments in an array.
[522] Fix | Delete
*
[523] Fix | Delete
* @since 2.1.0
[524] Fix | Delete
*
[525] Fix | Delete
* @see do_action() This function is identical, but the arguments passed to the
[526] Fix | Delete
* functions hooked to `$hook_name` are supplied using an array.
[527] Fix | Delete
*
[528] Fix | Delete
* @global WP_Hook[] $wp_filter Stores all of the filters and actions.
[529] Fix | Delete
* @global int[] $wp_actions Stores the number of times each action was triggered.
[530] Fix | Delete
* @global string[] $wp_current_filter Stores the list of current filters with the current one last.
[531] Fix | Delete
*
[532] Fix | Delete
* @param string $hook_name The name of the action to be executed.
[533] Fix | Delete
* @param array $args The arguments supplied to the functions hooked to `$hook_name`.
[534] Fix | Delete
*/
[535] Fix | Delete
function do_action_ref_array( $hook_name, $args ) {
[536] Fix | Delete
global $wp_filter, $wp_actions, $wp_current_filter;
[537] Fix | Delete
[538] Fix | Delete
if ( ! isset( $wp_actions[ $hook_name ] ) ) {
[539] Fix | Delete
$wp_actions[ $hook_name ] = 1;
[540] Fix | Delete
} else {
[541] Fix | Delete
++$wp_actions[ $hook_name ];
[542] Fix | Delete
}
[543] Fix | Delete
[544] Fix | Delete
// Do 'all' actions first.
[545] Fix | Delete
if ( isset( $wp_filter['all'] ) ) {
[546] Fix | Delete
$wp_current_filter[] = $hook_name;
[547] Fix | Delete
$all_args = func_get_args(); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection
[548] Fix | Delete
_wp_call_all_hook( $all_args );
[549] Fix | Delete
}
[550] Fix | Delete
[551] Fix | Delete
if ( ! isset( $wp_filter[ $hook_name ] ) ) {
[552] Fix | Delete
if ( isset( $wp_filter['all'] ) ) {
[553] Fix | Delete
array_pop( $wp_current_filter );
[554] Fix | Delete
}
[555] Fix | Delete
[556] Fix | Delete
return;
[557] Fix | Delete
}
[558] Fix | Delete
[559] Fix | Delete
if ( ! isset( $wp_filter['all'] ) ) {
[560] Fix | Delete
$wp_current_filter[] = $hook_name;
[561] Fix | Delete
}
[562] Fix | Delete
[563] Fix | Delete
$wp_filter[ $hook_name ]->do_action( $args );
[564] Fix | Delete
[565] Fix | Delete
array_pop( $wp_current_filter );
[566] Fix | Delete
}
[567] Fix | Delete
[568] Fix | Delete
/**
[569] Fix | Delete
* Checks if any action has been registered for a hook.
[570] Fix | Delete
*
[571] Fix | Delete
* When using the `$callback` argument, this function may return a non-boolean value
[572] Fix | Delete
* that evaluates to false (e.g. 0), so use the `===` operator for testing the return value.
[573] Fix | Delete
*
[574] Fix | Delete
* @since 2.5.0
[575] Fix | Delete
*
[576] Fix | Delete
* @see has_filter() This function is an alias of has_filter().
[577] Fix | Delete
*
[578] Fix | Delete
* @param string $hook_name The name of the action hook.
[579] Fix | Delete
* @param callable|string|array|false $callback Optional. The callback to check for.
[580] Fix | Delete
* This function can be called unconditionally to speculatively check
[581] Fix | Delete
* a callback that may or may not exist. Default false.
[582] Fix | Delete
* @return bool|int If `$callback` is omitted, returns boolean for whether the hook has
[583] Fix | Delete
* anything registered. When checking a specific function, the priority
[584] Fix | Delete
* of that hook is returned, or false if the function is not attached.
[585] Fix | Delete
*/
[586] Fix | Delete
function has_action( $hook_name, $callback = false ) {
[587] Fix | Delete
return has_filter( $hook_name, $callback );
[588] Fix | Delete
}
[589] Fix | Delete
[590] Fix | Delete
/**
[591] Fix | Delete
* Removes a callback function from an action hook.
[592] Fix | Delete
*
[593] Fix | Delete
* This can be used to remove default functions attached to a specific action
[594] Fix | Delete
* hook and possibly replace them with a substitute.
[595] Fix | Delete
*
[596] Fix | Delete
* To remove a hook, the `$callback` and `$priority` arguments must match
[597] Fix | Delete
* when the hook was added. This goes for both filters and actions. No warning
[598] Fix | Delete
* will be given on removal failure.
[599] Fix | Delete
*
[600] Fix | Delete
* @since 1.2.0
[601] Fix | Delete
*
[602] Fix | Delete
* @param string $hook_name The action hook to which the function to be removed is hooked.
[603] Fix | Delete
* @param callable|string|array $callback The name of the function which should be removed.
[604] Fix | Delete
* This function can be called unconditionally to speculatively remove
[605] Fix | Delete
* a callback that may or may not exist.
[606] Fix | Delete
* @param int $priority Optional. The exact priority used when adding the original
[607] Fix | Delete
* action callback. Default 10.
[608] Fix | Delete
* @return bool Whether the function is removed.
[609] Fix | Delete
*/
[610] Fix | Delete
function remove_action( $hook_name, $callback, $priority = 10 ) {
[611] Fix | Delete
return remove_filter( $hook_name, $callback, $priority );
[612] Fix | Delete
}
[613] Fix | Delete
[614] Fix | Delete
/**
[615] Fix | Delete
* Removes all of the callback functions from an action hook.
[616] Fix | Delete
*
[617] Fix | Delete
* @since 2.7.0
[618] Fix | Delete
*
[619] Fix | Delete
* @param string $hook_name The action to remove callbacks from.
[620] Fix | Delete
* @param int|false $priority Optional. The priority number to remove them from.
[621] Fix | Delete
* Default false.
[622] Fix | Delete
* @return true Always returns true.
[623] Fix | Delete
*/
[624] Fix | Delete
function remove_all_actions( $hook_name, $priority = false ) {
[625] Fix | Delete
return remove_all_filters( $hook_name, $priority );
[626] Fix | Delete
}
[627] Fix | Delete
[628] Fix | Delete
/**
[629] Fix | Delete
* Retrieves the name of the current action hook.
[630] Fix | Delete
*
[631] Fix | Delete
* @since 3.9.0
[632] Fix | Delete
*
[633] Fix | Delete
* @return string Hook name of the current action.
[634] Fix | Delete
*/
[635] Fix | Delete
function current_action() {
[636] Fix | Delete
return current_filter();
[637] Fix | Delete
}
[638] Fix | Delete
[639] Fix | Delete
/**
[640] Fix | Delete
* Returns whether or not an action hook is currently being processed.
[641] Fix | Delete
*
[642] Fix | Delete
* The function current_action() only returns the most recent action being executed.
[643] Fix | Delete
* did_action() returns the number of times an action has been fired during
[644] Fix | Delete
* the current request.
[645] Fix | Delete
*
[646] Fix | Delete
* This function allows detection for any action currently being executed
[647] Fix | Delete
* (regardless of whether it's the most recent action to fire, in the case of
[648] Fix | Delete
* hooks called from hook callbacks) to be verified.
[649] Fix | Delete
*
[650] Fix | Delete
* @since 3.9.0
[651] Fix | Delete
*
[652] Fix | Delete
* @see current_action()
[653] Fix | Delete
* @see did_action()
[654] Fix | Delete
*
[655] Fix | Delete
* @param string|null $hook_name Optional. Action hook to check. Defaults to null,
[656] Fix | Delete
* which checks if any action is currently being run.
[657] Fix | Delete
* @return bool Whether the action is currently in the stack.
[658] Fix | Delete
*/
[659] Fix | Delete
function doing_action( $hook_name = null ) {
[660] Fix | Delete
return doing_filter( $hook_name );
[661] Fix | Delete
}
[662] Fix | Delete
[663] Fix | Delete
/**
[664] Fix | Delete
* Retrieves the number of times an action has been fired during the current request.
[665] Fix | Delete
*
[666] Fix | Delete
* @since 2.1.0
[667] Fix | Delete
*
[668] Fix | Delete
* @global int[] $wp_actions Stores the number of times each action was triggered.
[669] Fix | Delete
*
[670] Fix | Delete
* @param string $hook_name The name of the action hook.
[671] Fix | Delete
* @return int The number of times the action hook has been fired.
[672] Fix | Delete
*/
[673] Fix | Delete
function did_action( $hook_name ) {
[674] Fix | Delete
global $wp_actions;
[675] Fix | Delete
[676] Fix | Delete
if ( ! isset( $wp_actions[ $hook_name ] ) ) {
[677] Fix | Delete
return 0;
[678] Fix | Delete
}
[679] Fix | Delete
[680] Fix | Delete
return $wp_actions[ $hook_name ];
[681] Fix | Delete
}
[682] Fix | Delete
[683] Fix | Delete
/**
[684] Fix | Delete
* Fires functions attached to a deprecated filter hook.
[685] Fix | Delete
*
[686] Fix | Delete
* When a filter hook is deprecated, the apply_filters() call is replaced with
[687] Fix | Delete
* apply_filters_deprecated(), which triggers a deprecation notice and then fires
[688] Fix | Delete
* the original filter hook.
[689] Fix | Delete
*
[690] Fix | Delete
* Note: the value and extra arguments passed to the original apply_filters() call
[691] Fix | Delete
* must be passed here to `$args` as an array. For example:
[692] Fix | Delete
*
[693] Fix | Delete
* // Old filter.
[694] Fix | Delete
* return apply_filters( 'wpdocs_filter', $value, $extra_arg );
[695] Fix | Delete
*
[696] Fix | Delete
* // Deprecated.
[697] Fix | Delete
* return apply_filters_deprecated( 'wpdocs_filter', array( $value, $extra_arg ), '4.9.0', 'wpdocs_new_filter' );
[698] Fix | Delete
*
[699] Fix | Delete
* @since 4.6.0
[700] Fix | Delete
*
[701] Fix | Delete
* @see _deprecated_hook()
[702] Fix | Delete
*
[703] Fix | Delete
* @param string $hook_name The name of the filter hook.
[704] Fix | Delete
* @param array $args Array of additional function arguments to be passed to apply_filters().
[705] Fix | Delete
* @param string $version The version of WordPress that deprecated the hook.
[706] Fix | Delete
* @param string $replacement Optional. The hook that should have been used. Default empty.
[707] Fix | Delete
* @param string $message Optional. A message regarding the change. Default empty.
[708] Fix | Delete
* @return mixed The filtered value after all hooked functions are applied to it.
[709] Fix | Delete
*/
[710] Fix | Delete
function apply_filters_deprecated( $hook_name, $args, $version, $replacement = '', $message = '' ) {
[711] Fix | Delete
if ( ! has_filter( $hook_name ) ) {
[712] Fix | Delete
return $args[0];
[713] Fix | Delete
}
[714] Fix | Delete
[715] Fix | Delete
_deprecated_hook( $hook_name, $version, $replacement, $message );
[716] Fix | Delete
[717] Fix | Delete
return apply_filters_ref_array( $hook_name, $args );
[718] Fix | Delete
}
[719] Fix | Delete
[720] Fix | Delete
/**
[721] Fix | Delete
* Fires functions attached to a deprecated action hook.
[722] Fix | Delete
*
[723] Fix | Delete
* When an action hook is deprecated, the do_action() call is replaced with
[724] Fix | Delete
* do_action_deprecated(), which triggers a deprecation notice and then fires
[725] Fix | Delete
* the original hook.
[726] Fix | Delete
*
[727] Fix | Delete
* @since 4.6.0
[728] Fix | Delete
*
[729] Fix | Delete
* @see _deprecated_hook()
[730] Fix | Delete
*
[731] Fix | Delete
* @param string $hook_name The name of the action hook.
[732] Fix | Delete
* @param array $args Array of additional function arguments to be passed to do_action().
[733] Fix | Delete
* @param string $version The version of WordPress that deprecated the hook.
[734] Fix | Delete
* @param string $replacement Optional. The hook that should have been used. Default empty.
[735] Fix | Delete
* @param string $message Optional. A message regarding the change. Default empty.
[736] Fix | Delete
*/
[737] Fix | Delete
function do_action_deprecated( $hook_name, $args, $version, $replacement = '', $message = '' ) {
[738] Fix | Delete
if ( ! has_action( $hook_name ) ) {
[739] Fix | Delete
return;
[740] Fix | Delete
}
[741] Fix | Delete
[742] Fix | Delete
_deprecated_hook( $hook_name, $version, $replacement, $message );
[743] Fix | Delete
[744] Fix | Delete
do_action_ref_array( $hook_name, $args );
[745] Fix | Delete
}
[746] Fix | Delete
[747] Fix | Delete
//
[748] Fix | Delete
// Functions for handling plugins.
[749] Fix | Delete
//
[750] Fix | Delete
[751] Fix | Delete
/**
[752] Fix | Delete
* Gets the basename of a plugin.
[753] Fix | Delete
*
[754] Fix | Delete
* This method extracts the name of a plugin from its filename.
[755] Fix | Delete
*
[756] Fix | Delete
* @since 1.5.0
[757] Fix | Delete
*
[758] Fix | Delete
* @global array $wp_plugin_paths
[759] Fix | Delete
*
[760] Fix | Delete
* @param string $file The filename of plugin.
[761] Fix | Delete
* @return string The name of a plugin.
[762] Fix | Delete
*/
[763] Fix | Delete
function plugin_basename( $file ) {
[764] Fix | Delete
global $wp_plugin_paths;
[765] Fix | Delete
[766] Fix | Delete
// $wp_plugin_paths contains normalized paths.
[767] Fix | Delete
$file = wp_normalize_path( $file );
[768] Fix | Delete
[769] Fix | Delete
arsort( $wp_plugin_paths );
[770] Fix | Delete
[771] Fix | Delete
foreach ( $wp_plugin_paths as $dir => $realdir ) {
[772] Fix | Delete
if ( str_starts_with( $file, $realdir ) ) {
[773] Fix | Delete
$file = $dir . substr( $file, strlen( $realdir ) );
[774] Fix | Delete
}
[775] Fix | Delete
}
[776] Fix | Delete
[777] Fix | Delete
$plugin_dir = wp_normalize_path( WP_PLUGIN_DIR );
[778] Fix | Delete
$mu_plugin_dir = wp_normalize_path( WPMU_PLUGIN_DIR );
[779] Fix | Delete
[780] Fix | Delete
// Get relative path from plugins directory.
[781] Fix | Delete
$file = preg_replace( '#^' . preg_quote( $plugin_dir, '#' ) . '/|^' . preg_quote( $mu_plugin_dir, '#' ) . '/#', '', $file );
[782] Fix | Delete
$file = trim( $file, '/' );
[783] Fix | Delete
return $file;
[784] Fix | Delete
}
[785] Fix | Delete
[786] Fix | Delete
/**
[787] Fix | Delete
* Register a plugin's real path.
[788] Fix | Delete
*
[789] Fix | Delete
* This is used in plugin_basename() to resolve symlinked paths.
[790] Fix | Delete
*
[791] Fix | Delete
* @since 3.9.0
[792] Fix | Delete
*
[793] Fix | Delete
* @see wp_normalize_path()
[794] Fix | Delete
*
[795] Fix | Delete
* @global array $wp_plugin_paths
[796] Fix | Delete
*
[797] Fix | Delete
* @param string $file Known path to the file.
[798] Fix | Delete
* @return bool Whether the path was able to be registered.
[799] Fix | Delete
*/
[800] Fix | Delete
function wp_register_plugin_realpath( $file ) {
[801] Fix | Delete
global $wp_plugin_paths;
[802] Fix | Delete
[803] Fix | Delete
// Normalize, but store as static to avoid recalculation of a constant value.
[804] Fix | Delete
static $wp_plugin_path = null, $wpmu_plugin_path = null;
[805] Fix | Delete
[806] Fix | Delete
if ( ! isset( $wp_plugin_path ) ) {
[807] Fix | Delete
$wp_plugin_path = wp_normalize_path( WP_PLUGIN_DIR );
[808] Fix | Delete
$wpmu_plugin_path = wp_normalize_path( WPMU_PLUGIN_DIR );
[809] Fix | Delete
}
[810] Fix | Delete
[811] Fix | Delete
$plugin_path = wp_normalize_path( dirname( $file ) );
[812] Fix | Delete
$plugin_realpath = wp_normalize_path( dirname( realpath( $file ) ) );
[813] Fix | Delete
[814] Fix | Delete
if ( $plugin_path === $wp_plugin_path || $plugin_path === $wpmu_plugin_path ) {
[815] Fix | Delete
return false;
[816] Fix | Delete
}
[817] Fix | Delete
[818] Fix | Delete
if ( $plugin_path !== $plugin_realpath ) {
[819] Fix | Delete
$wp_plugin_paths[ $plugin_path ] = $plugin_realpath;
[820] Fix | Delete
}
[821] Fix | Delete
[822] Fix | Delete
return true;
[823] Fix | Delete
}
[824] Fix | Delete
[825] Fix | Delete
/**
[826] Fix | Delete
* Get the filesystem directory path (with trailing slash) for the plugin __FILE__ passed in.
[827] Fix | Delete
*
[828] Fix | Delete
* @since 2.8.0
[829] Fix | Delete
*
[830] Fix | Delete
* @param string $file The filename of the plugin (__FILE__).
[831] Fix | Delete
* @return string the filesystem path of the directory that contains the plugin.
[832] Fix | Delete
*/
[833] Fix | Delete
function plugin_dir_path( $file ) {
[834] Fix | Delete
return trailingslashit( dirname( $file ) );
[835] Fix | Delete
}
[836] Fix | Delete
[837] Fix | Delete
/**
[838] Fix | Delete
* Get the URL directory path (with trailing slash) for the plugin __FILE__ passed in.
[839] Fix | Delete
*
[840] Fix | Delete
* @since 2.8.0
[841] Fix | Delete
*
[842] Fix | Delete
* @param string $file The filename of the plugin (__FILE__).
[843] Fix | Delete
* @return string the URL path of the directory that contains the plugin.
[844] Fix | Delete
*/
[845] Fix | Delete
function plugin_dir_url( $file ) {
[846] Fix | Delete
return trailingslashit( plugins_url( '', $file ) );
[847] Fix | Delete
}
[848] Fix | Delete
[849] Fix | Delete
/**
[850] Fix | Delete
* Set the activation hook for a plugin.
[851] Fix | Delete
*
[852] Fix | Delete
* When a plugin is activated, the action 'activate_PLUGINNAME' hook is
[853] Fix | Delete
* called. In the name of this hook, PLUGINNAME is replaced with the name
[854] Fix | Delete
* of the plugin, including the optional subdirectory. For example, when the
[855] Fix | Delete
* plugin is located in wp-content/plugins/sampleplugin/sample.php, then
[856] Fix | Delete
* the name of this hook will become 'activate_sampleplugin/sample.php'.
[857] Fix | Delete
*
[858] Fix | Delete
* When the plugin consists of only one file and is (as by default) located at
[859] Fix | Delete
* wp-content/plugins/sample.php the name of this hook will be
[860] Fix | Delete
* 'activate_sample.php'.
[861] Fix | Delete
*
[862] Fix | Delete
* @since 2.0.0
[863] Fix | Delete
*
[864] Fix | Delete
* @param string $file The filename of the plugin including the path.
[865] Fix | Delete
* @param callable $callback The function hooked to the 'activate_PLUGIN' action.
[866] Fix | Delete
*/
[867] Fix | Delete
function register_activation_hook( $file, $callback ) {
[868] Fix | Delete
$file = plugin_basename( $file );
[869] Fix | Delete
add_action( 'activate_' . $file, $callback );
[870] Fix | Delete
}
[871] Fix | Delete
[872] Fix | Delete
/**
[873] Fix | Delete
* Sets the deactivation hook for a plugin.
[874] Fix | Delete
*
[875] Fix | Delete
* When a plugin is deactivated, the action 'deactivate_PLUGINNAME' hook is
[876] Fix | Delete
* called. In the name of this hook, PLUGINNAME is replaced with the name
[877] Fix | Delete
* of the plugin, including the optional subdirectory. For example, when the
[878] Fix | Delete
* plugin is located in wp-content/plugins/sampleplugin/sample.php, then
[879] Fix | Delete
* the name of this hook will become 'deactivate_sampleplugin/sample.php'.
[880] Fix | Delete
*
[881] Fix | Delete
* When the plugin consists of only one file and is (as by default) located at
[882] Fix | Delete
* wp-content/plugins/sample.php the name of this hook will be
[883] Fix | Delete
* 'deactivate_sample.php'.
[884] Fix | Delete
*
[885] Fix | Delete
* @since 2.0.0
[886] Fix | Delete
*
[887] Fix | Delete
* @param string $file The filename of the plugin including the path.
[888] Fix | Delete
* @param callable $callback The function hooked to the 'deactivate_PLUGIN' action.
[889] Fix | Delete
*/
[890] Fix | Delete
function register_deactivation_hook( $file, $callback ) {
[891] Fix | Delete
$file = plugin_basename( $file );
[892] Fix | Delete
add_action( 'deactivate_' . $file, $callback );
[893] Fix | Delete
}
[894] Fix | Delete
[895] Fix | Delete
/**
[896] Fix | Delete
* Sets the uninstallation hook for a plugin.
[897] Fix | Delete
*
[898] Fix | Delete
* Registers the uninstall hook that will be called when the user clicks on the
[899] Fix | Delete
* uninstall link that calls for the plugin to uninstall itself. The link won't
[900] Fix | Delete
* be active unless the plugin hooks into the action.
[901] Fix | Delete
*
[902] Fix | Delete
* The plugin should not run arbitrary code outside of functions, when
[903] Fix | Delete
* registering the uninstall hook. In order to run using the hook, the plugin
[904] Fix | Delete
* will have to be included, which means that any code laying outside of a
[905] Fix | Delete
* function will be run during the uninstallation process. The plugin should not
[906] Fix | Delete
* hinder the uninstallation process.
[907] Fix | Delete
*
[908] Fix | Delete
* If the plugin can not be written without running code within the plugin, then
[909] Fix | Delete
* the plugin should create a file named 'uninstall.php' in the base plugin
[910] Fix | Delete
* folder. This file will be called, if it exists, during the uninstallation process
[911] Fix | Delete
* bypassing the uninstall hook. The plugin, when using the 'uninstall.php'
[912] Fix | Delete
* should always check for the 'WP_UNINSTALL_PLUGIN' constant, before
[913] Fix | Delete
* executing.
[914] Fix | Delete
*
[915] Fix | Delete
* @since 2.7.0
[916] Fix | Delete
*
[917] Fix | Delete
* @param string $file Plugin file.
[918] Fix | Delete
* @param callable $callback The callback to run when the hook is called. Must be
[919] Fix | Delete
* a static method or function.
[920] Fix | Delete
*/
[921] Fix | Delete
function register_uninstall_hook( $file, $callback ) {
[922] Fix | Delete
if ( is_array( $callback ) && is_object( $callback[0] ) ) {
[923] Fix | Delete
_doing_it_wrong( __FUNCTION__, __( 'Only a static class method or function can be used in an uninstall hook.' ), '3.1.0' );
[924] Fix | Delete
return;
[925] Fix | Delete
}
[926] Fix | Delete
[927] Fix | Delete
/*
[928] Fix | Delete
* The option should not be autoloaded, because it is not needed in most
[929] Fix | Delete
* cases. Emphasis should be put on using the 'uninstall.php' way of
[930] Fix | Delete
* uninstalling the plugin.
[931] Fix | Delete
*/
[932] Fix | Delete
$uninstallable_plugins = (array) get_option( 'uninstall_plugins' );
[933] Fix | Delete
$plugin_basename = plugin_basename( $file );
[934] Fix | Delete
[935] Fix | Delete
if ( ! isset( $uninstallable_plugins[ $plugin_basename ] ) || $uninstallable_plugins[ $plugin_basename ] !== $callback ) {
[936] Fix | Delete
$uninstallable_plugins[ $plugin_basename ] = $callback;
[937] Fix | Delete
update_option( 'uninstall_plugins', $uninstallable_plugins );
[938] Fix | Delete
}
[939] Fix | Delete
}
[940] Fix | Delete
[941] Fix | Delete
/**
[942] Fix | Delete
* Calls the 'all' hook, which will process the functions hooked into it.
[943] Fix | Delete
*
[944] Fix | Delete
* The 'all' hook passes all of the arguments or parameters that were used for
[945] Fix | Delete
* the hook, which this function was called for.
[946] Fix | Delete
*
[947] Fix | Delete
* This function is used internally for apply_filters(), do_action(), and
[948] Fix | Delete
* do_action_ref_array() and is not meant to be used from outside those
[949] Fix | Delete
* functions. This function does not check for the existence of the all hook, so
[950] Fix | Delete
* it will fail unless the all hook exists prior to this function call.
[951] Fix | Delete
*
[952] Fix | Delete
* @since 2.5.0
[953] Fix | Delete
* @access private
[954] Fix | Delete
*
[955] Fix | Delete
* @global WP_Hook[] $wp_filter Stores all of the filters and actions.
[956] Fix | Delete
*
[957] Fix | Delete
* @param array $args The collected parameters from the hook that was called.
[958] Fix | Delete
*/
[959] Fix | Delete
function _wp_call_all_hook( $args ) {
[960] Fix | Delete
global $wp_filter;
[961] Fix | Delete
[962] Fix | Delete
$wp_filter['all']->do_all_hook( $args );
[963] Fix | Delete
}
[964] Fix | Delete
[965] Fix | Delete
/**
[966] Fix | Delete
* Builds a unique string ID for a hook callback function.
[967] Fix | Delete
*
[968] Fix | Delete
* Functions and static method callbacks are just returned as strings and
[969] Fix | Delete
* shouldn't have any speed penalty.
[970] Fix | Delete
*
[971] Fix | Delete
* @link https://core.trac.wordpress.org/ticket/3875
[972] Fix | Delete
*
[973] Fix | Delete
* @since 2.2.3
[974] Fix | Delete
* @since 5.3.0 Removed workarounds for spl_object_hash().
[975] Fix | Delete
* `$hook_name` and `$priority` are no longer used,
[976] Fix | Delete
* and the function always returns a string.
[977] Fix | Delete
*
[978] Fix | Delete
* @access private
[979] Fix | Delete
*
[980] Fix | Delete
* @param string $hook_name Unused. The name of the filter to build ID for.
[981] Fix | Delete
* @param callable|string|array $callback The callback to generate ID for. The callback may
[982] Fix | Delete
* or may not exist.
[983] Fix | Delete
* @param int $priority Unused. The order in which the functions
[984] Fix | Delete
* associated with a particular action are executed.
[985] Fix | Delete
* @return string Unique function ID for usage as array key.
[986] Fix | Delete
*/
[987] Fix | Delete
function _wp_filter_build_unique_id( $hook_name, $callback, $priority ) {
[988] Fix | Delete
if ( is_string( $callback ) ) {
[989] Fix | Delete
return $callback;
[990] Fix | Delete
}
[991] Fix | Delete
[992] Fix | Delete
if ( is_object( $callback ) ) {
[993] Fix | Delete
// Closures are currently implemented as objects.
[994] Fix | Delete
$callback = array( $callback, '' );
[995] Fix | Delete
} else {
[996] Fix | Delete
$callback = (array) $callback;
[997] Fix | Delete
}
[998] Fix | Delete
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function