Ticket #3875: wp2_2.plugins.php.diff
| File wp2_2.plugins.php.diff, 1.9 KB (added by , 18 years ago) |
|---|
-
plugin.php
19 19 global $wp_filter, $merged_filters; 20 20 21 21 // So the format is wp_filter['tag']['array of priorities']['array of functions serialized']['array of ['array (functions, accepted_args)]'] 22 $wp_filter[$tag][$priority][ serialize($function_to_add)] = array('function' => $function_to_add, 'accepted_args' => $accepted_args);22 $wp_filter[$tag][$priority][_wp_filter_build_unique_id($tag, $function_to_add, $priority)] = array('function' => $function_to_add, 'accepted_args' => $accepted_args); 23 23 unset( $merged_filters[ $tag ] ); 24 24 return true; 25 25 } … … 98 98 */ 99 99 function remove_filter($tag, $function_to_remove, $priority = 10, $accepted_args = 1) { 100 100 global $wp_filter, $merged_filters; 101 102 unset($GLOBALS['wp_filter'][$tag][$priority][ serialize($function_to_remove)]);101 102 unset($GLOBALS['wp_filter'][$tag][$priority][_wp_filter_build_unique_id($tag, $function_to_remove, $priority)]); 103 103 unset( $merged_filters[ $tag ] ); 104 104 105 105 return true; … … 279 279 add_action('deactivate_' . $file, $function); 280 280 } 281 281 282 function _wp_filter_build_unique_id($tag, $function, $priority = 10) 283 { 284 global $wp_filter; 285 286 // If function then just skip all of the tests and not overwrite the following. 287 if( is_string($function) ) 288 return $function; 289 // Object Class Calling 290 else if(is_object($function[0]) ) 291 { 292 $obj_idx = get_class($function[0]).$function[1]; 293 if( is_null($function[0]->wp_filter_id) ) { 294 $count = count((array)$wp_filter[$tag][$priority]); 295 $function[0]->wp_filter_id = $count; 296 $obj_idx .= $count; 297 unset($count); 298 } else 299 $obj_idx .= $function[0]->wp_filter_id; 300 return $obj_idx; 301 } 302 // Static Calling 303 else if( is_string($function[0]) ) 304 return $function[0].$function[1]; 305 } 306 282 307 ?> 308 No newline at end of file