Ticket #5232: wp-current-filter-revised-r6278.patch
| File wp-current-filter-revised-r6278.patch, 1.8 KB (added by , 18 years ago) |
|---|
-
wordpress/wp-includes/plugin.php
107 107 * @return string The text in <tt>$string</tt> after all hooked functions are applied to it. 108 108 */ 109 109 function apply_filters($tag, $value) { 110 global $wp_filter, $merged_filters ;110 global $wp_filter, $merged_filters, $wp_current_filter; 111 111 112 112 if ( !isset( $merged_filters[ $tag ] ) ) 113 113 merge_filters($tag); 114 114 115 115 if ( !isset($wp_filter[$tag]) ) 116 116 return $value; 117 118 @$wp_current_filter[] = $tag; 117 119 118 120 reset( $wp_filter[ $tag ] ); 119 121 … … 127 129 } 128 130 129 131 } while ( next($wp_filter[$tag]) !== false ); 132 133 array_pop( $wp_current_filter ); 130 134 131 135 return $value; 132 136 } … … 196 200 } 197 201 198 202 /** 203 * Return the name of the current filter or action. 204 */ 205 function current_filter() { 206 global $wp_current_filter; 207 return end( $wp_current_filter ); 208 } 209 210 211 /** 199 212 * Hooks a function on to a specific action. 200 213 * 201 214 * Actions are the hooks that the WordPress core launches at specific points … … 241 254 * @return null Will return null if $tag does not exist in $wp_filter array 242 255 */ 243 256 function do_action($tag, $arg = '') { 244 global $wp_filter, $wp_actions ;257 global $wp_filter, $wp_actions, $wp_current_filter; 245 258 246 259 if ( is_array($wp_actions) ) 247 260 $wp_actions[] = $tag; … … 260 273 261 274 if ( !isset($wp_filter[$tag]) ) 262 275 return; 276 277 @$wp_current_filter[] = $tag; 263 278 264 279 do{ 265 280 foreach( (array) current($wp_filter[$tag]) as $the_ ) … … 267 282 call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args'])); 268 283 269 284 } while ( next($wp_filter[$tag]) !== false ); 285 286 array_pop( $wp_current_filter ); 270 287 271 288 } 272 289