Changeset 4394 for trunk/wp-includes/plugin.php
- Timestamp:
- 10/13/2006 02:01:53 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/plugin.php
r4289 r4394 13 13 // uncomment if we want to match function AND accepted_args 14 14 // if ( $filter == array($function, $accepted_args) ) { 15 if ( $filter['function'] == $function_to_add ) {15 if ( $filter['function'] == $function_to_add ) 16 16 return true; 17 }18 17 } 19 18 } … … 33 32 merge_filters($tag); 34 33 35 if ( !isset($wp_filter[$tag]) ) {34 if ( !isset($wp_filter[$tag]) ) 36 35 return $string; 37 } 38 foreach ( $wp_filter[$tag] as $priority => $functions) {36 37 foreach ( (array) $wp_filter[$tag] as $priority => $functions ) { 39 38 if ( !is_null($functions) ) { 40 foreach($functions as $function) { 41 39 foreach ( (array) $functions as $function ) { 42 40 $function_name = $function['function']; 43 41 $accepted_args = $function['accepted_args']; 44 45 42 $the_args = $args; 46 43 array_unshift($the_args, $string); 47 44 if ( $accepted_args > 0 ) 48 45 $the_args = array_slice($the_args, 0, $accepted_args); 49 elseif ( $accepted_args == 0)46 elseif ( 0 == $accepted_args ) 50 47 $the_args = NULL; 51 52 48 $string = call_user_func_array($function_name, $the_args); 53 49 } … … 57 53 } 58 54 59 60 55 function merge_filters($tag) { 61 56 global $wp_filter; 62 57 if ( isset($wp_filter['all']) ) { 63 foreach ( $wp_filter['all'] as $priority => $functions) {58 foreach ( (array) $wp_filter['all'] as $priority => $functions ) { 64 59 if ( isset($wp_filter[$tag][$priority]) ) 65 60 $wp_filter[$tag][$priority] = array_merge($wp_filter['all'][$priority], $wp_filter[$tag][$priority]); … … 74 69 } 75 70 76 77 78 71 function remove_filter($tag, $function_to_remove, $priority = 10, $accepted_args = 1) { 79 72 global $wp_filter; … … 82 75 if ( isset($wp_filter[$tag]["$priority"]) ) { 83 76 $new_function_list = array(); 84 foreach ($wp_filter[$tag]["$priority"] as $filter) {85 if ( $filter['function'] != $function_to_remove ) {77 foreach ( (array) $wp_filter[$tag]["$priority"] as $filter ) { 78 if ( $filter['function'] != $function_to_remove ) 86 79 $new_function_list[] = $filter; 87 }88 80 } 89 81 $wp_filter[$tag]["$priority"] = $new_function_list; … … 115 107 return; 116 108 117 foreach ( $wp_filter[$tag] as $priority => $functions) {109 foreach ( (array) $wp_filter[$tag] as $priority => $functions ) { 118 110 if ( !is_null($functions) ) { 119 foreach($functions as $function) { 120 111 foreach ( (array) $functions as $function ) { 121 112 $function_name = $function['function']; 122 113 $accepted_args = $function['accepted_args']; … … 143 134 return; 144 135 145 foreach ( $wp_filter[$tag] as $priority => $functions) {136 foreach ( (array) $wp_filter[$tag] as $priority => $functions ) { 146 137 if ( !is_null($functions) ) { 147 foreach($functions as $function) { 148 138 foreach( (array) $functions as $function ) { 149 139 $function_name = $function['function']; 150 140 $accepted_args = $function['accepted_args']; 151 152 141 if ( $accepted_args > 0 ) 153 142 $the_args = array_slice($args, 0, $accepted_args); 154 elseif ( $accepted_args == 0)143 elseif ( 0 == $accepted_args ) 155 144 $the_args = NULL; 156 145 else … … 179 168 function register_activation_hook($file, $function) { 180 169 $file = plugin_basename($file); 181 182 170 add_action('activate_' . $file, $function); 183 171 } … … 185 173 function register_deactivation_hook($file, $function) { 186 174 $file = plugin_basename($file); 187 188 175 add_action('deactivate_' . $file, $function); 189 176 }
Note: See TracChangeset
for help on using the changeset viewer.