diff --git a/src/_index.php b/src/_index.php
index cc2a532abe..7d9014d4a2 100644
|
a
|
b
|
define( 'WP_USE_THEMES', true ); |
| 15 | 15 | |
| 16 | 16 | /** Loads the WordPress Environment and Template */ |
| 17 | 17 | require __DIR__ . '/wp-blog-header.php'; |
| | 18 | |
| | 19 | $f = function () { |
| | 20 | global $filter_types; |
| | 21 | file_put_contents( ABSPATH . '/filter-types.json', json_encode( $filter_types ) ); |
| | 22 | if ( isset( $filter_types ) ) { |
| | 23 | $out = fopen( ABSPATH . '/filter-types.txt', 'a' ); |
| | 24 | foreach ( $filter_types as $name => $val_types ) { |
| | 25 | $c = 0; |
| | 26 | foreach ( $val_types as $val_type => $ftypes ) { |
| | 27 | $c += count( $ftypes ); |
| | 28 | } |
| | 29 | if ( $c < 1 ) { |
| | 30 | continue; |
| | 31 | } |
| | 32 | |
| | 33 | fwrite( $out, "\e[90mFilter \e[36m{$name}\e[90m:\e[m\n" ); |
| | 34 | $val_type_count = count( $val_types ); |
| | 35 | foreach ( $val_types as $val_type => $filtered_types ) { |
| | 36 | $box = --$val_type_count === 0 ? '└' : '├'; |
| | 37 | fwrite( $out, "\e[90m {$box}─ \e[34m{$val_type}\e[90m:\e[m\n" ); |
| | 38 | |
| | 39 | $ftype_count = count( $filtered_types ); |
| | 40 | foreach ( $filtered_types as $ftype => $count ) { |
| | 41 | $box = --$ftype_count === 0 ? '└' : '├'; |
| | 42 | fwrite( $out, "\e[90m {$box}─ \e[34m{$ftype}\e[90m: \e[33m{$count}\e[m\n" ); |
| | 43 | } |
| | 44 | } |
| | 45 | fwrite( $out, "\n" ); |
| | 46 | } |
| | 47 | fclose( $out ); |
| | 48 | } |
| | 49 | }; |
| | 50 | |
| | 51 | $f(); |
diff --git a/src/wp-includes/plugin.php b/src/wp-includes/plugin.php
index 77c1eb4ef6..5b343ab006 100644
|
a
|
b
|
function add_filter( $hook_name, $callback, $priority = 10, $accepted_args = 1 ) |
| 172 | 172 | */ |
| 173 | 173 | function apply_filters( $hook_name, $value, ...$args ) { |
| 174 | 174 | global $wp_filter, $wp_filters, $wp_current_filter; |
| | 175 | global $filter_types; |
| | 176 | |
| | 177 | if ( ! isset( $filter_types ) ) { |
| | 178 | $filter_types = file_exists( ABSPATH . '/filter-types.json' ) |
| | 179 | ? file_get_contents( ABSPATH . '/filter-types.json' ) |
| | 180 | : ''; |
| | 181 | $filter_types = '' !== $filter_types ? json_decode( $filter_types, true ) : array(); |
| | 182 | } |
| | 183 | |
| | 184 | $val_type = gettype( $value ); |
| | 185 | if ( ! isset( $filter_types[ $hook_name ] ) ) { |
| | 186 | $filter_types[ $hook_name ] = array( $val_type => array() ); |
| | 187 | } |
| 175 | 188 | |
| 176 | 189 | if ( ! isset( $wp_filters[ $hook_name ] ) ) { |
| 177 | 190 | $wp_filters[ $hook_name ] = 1; |
| … |
… |
function apply_filters( $hook_name, $value, ...$args ) { |
| 202 | 215 | // Pass the value to WP_Hook. |
| 203 | 216 | array_unshift( $args, $value ); |
| 204 | 217 | |
| 205 | | $filtered = $wp_filter[ $hook_name ]->apply_filters( $value, $args ); |
| | 218 | $filtered = $wp_filter[ $hook_name ]->apply_filters( $value, $args ); |
| | 219 | $filtered_type = gettype( $filtered ); |
| | 220 | if ( ! isset( $filter_types[ $hook_name ][ $val_type ][ $filtered_type ] ) ) { |
| | 221 | $filter_types[ $hook_name ][ $val_type ][ $filtered_type ] = 0; |
| | 222 | } |
| | 223 | ++$filter_types[ $hook_name ][ $val_type ][ $filtered_type ]; |
| 206 | 224 | |
| 207 | 225 | array_pop( $wp_current_filter ); |
| 208 | 226 | |
| … |
… |
function apply_filters( $hook_name, $value, ...$args ) { |
| 227 | 245 | */ |
| 228 | 246 | function apply_filters_ref_array( $hook_name, $args ) { |
| 229 | 247 | global $wp_filter, $wp_filters, $wp_current_filter; |
| | 248 | global $filter_types; |
| | 249 | |
| | 250 | if ( ! isset( $filter_types ) ) { |
| | 251 | $filter_types = array(); |
| | 252 | } |
| | 253 | |
| | 254 | $val_type = gettype( $args[0] ); |
| | 255 | if ( ! isset( $filter_types[ $hook_name ] ) ) { |
| | 256 | $filter_types[ $hook_name ] = array( $val_type => array() ); |
| | 257 | } |
| | 258 | |
| | 259 | if ( ! isset( $wp_filters[ $hook_name ] ) ) { |
| | 260 | $wp_filters[ $hook_name ] = 1; |
| | 261 | } else { |
| | 262 | ++$wp_filters[ $hook_name ]; |
| | 263 | } |
| | 264 | |
| 230 | 265 | |
| 231 | 266 | if ( ! isset( $wp_filters[ $hook_name ] ) ) { |
| 232 | 267 | $wp_filters[ $hook_name ] = 1; |
| … |
… |
function apply_filters_ref_array( $hook_name, $args ) { |
| 254 | 289 | } |
| 255 | 290 | |
| 256 | 291 | $filtered = $wp_filter[ $hook_name ]->apply_filters( $args[0], $args ); |
| | 292 | $filtered_type = gettype( $filtered ); |
| | 293 | if ( ! isset( $filter_types[ $hook_name ][ $val_type ][ $filtered_type ] ) ) { |
| | 294 | $filter_types[ $hook_name ][ $val_type ][ $filtered_type ] = 0; |
| | 295 | } |
| | 296 | ++$filter_types[ $hook_name ][ $val_type ][ $filtered_type ]; |
| 257 | 297 | |
| 258 | 298 | array_pop( $wp_current_filter ); |
| 259 | 299 | |