summaryrefslogtreecommitdiffstats
path: root/wp-includes/plugin.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-09-10 18:26:30 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-09-10 18:26:30 +0000
commitb658e546840b8f23e2a1e413f6510104d73ea91f (patch)
tree1cd6bbbda247b5ae6cfff42f2cea731b4d8b667f /wp-includes/plugin.php
parent305d7e7228e097a26a98abdb45eb8283df7d5603 (diff)
downloadwordpress-mu-b658e546840b8f23e2a1e413f6510104d73ea91f.tar.gz
wordpress-mu-b658e546840b8f23e2a1e413f6510104d73ea91f.tar.xz
wordpress-mu-b658e546840b8f23e2a1e413f6510104d73ea91f.zip
Sync with WP 2.2.3
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1051 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/plugin.php')
-rw-r--r--wp-includes/plugin.php36
1 files changed, 31 insertions, 5 deletions
diff --git a/wp-includes/plugin.php b/wp-includes/plugin.php
index c573ec1..050c544 100644
--- a/wp-includes/plugin.php
+++ b/wp-includes/plugin.php
@@ -19,7 +19,7 @@ function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1)
global $wp_filter, $merged_filters;
// So the format is wp_filter['tag']['array of priorities']['array of functions serialized']['array of ['array (functions, accepted_args)]']
- $wp_filter[$tag][$priority][serialize($function_to_add)] = array('function' => $function_to_add, 'accepted_args' => $accepted_args);
+ $wp_filter[$tag][$priority][_wp_filter_build_unique_id($tag, $function_to_add, $priority)] = array('function' => $function_to_add, 'accepted_args' => $accepted_args);
unset( $merged_filters[ $tag ] );
return true;
}
@@ -98,8 +98,8 @@ function merge_filters($tag) {
*/
function remove_filter($tag, $function_to_remove, $priority = 10, $accepted_args = 1) {
global $wp_filter, $merged_filters;
-
- unset($GLOBALS['wp_filter'][$tag][$priority][serialize($function_to_remove)]);
+
+ unset($GLOBALS['wp_filter'][$tag][$priority][_wp_filter_build_unique_id($tag, $function_to_remove, $priority)]);
unset( $merged_filters[ $tag ] );
return true;
@@ -235,8 +235,9 @@ function remove_action($tag, $function_to_remove, $priority = 10, $accepted_args
* @return string The name of a plugin.
*/
function plugin_basename($file) {
- $file = preg_replace('|\\\\+|', '\\\\', $file);
- $file = preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', $file);
+ $file = str_replace('\\','/',$file); // sanitize for Win32 installs
+ $file = preg_replace('|/+|','/', $file); // remove any duplicate slash
+ $file = preg_replace('|^.*/wp-content/plugins/|','',$file); // get relative path from plugins dir
return $file;
}
@@ -278,4 +279,29 @@ function register_deactivation_hook($file, $function) {
add_action('deactivate_' . $file, $function);
}
+function _wp_filter_build_unique_id($tag, $function, $priority = 10)
+{
+ global $wp_filter;
+
+ // If function then just skip all of the tests and not overwrite the following.
+ if( is_string($function) )
+ return $function;
+ // Object Class Calling
+ else if(is_object($function[0]) )
+ {
+ $obj_idx = get_class($function[0]).$function[1];
+ if( is_null($function[0]->wp_filter_id) ) {
+ $count = count((array)$wp_filter[$tag][$priority]);
+ $function[0]->wp_filter_id = $count;
+ $obj_idx .= $count;
+ unset($count);
+ } else
+ $obj_idx .= $function[0]->wp_filter_id;
+ return $obj_idx;
+ }
+ // Static Calling
+ else if( is_string($function[0]) )
+ return $function[0].$function[1];
+}
+
?>