$wp_filter * @param bool $hide_qm * @param bool $hide_core * @return array> * @phpstan-param 'action'|'filter' $type * @phpstan-return array{ * name: string, * type: 'action'|'filter', * actions: list, * }>, * parts: list, * components: array, * } */ public static function process( $name, string $type, array $wp_filter, $hide_qm = false, $hide_core = false ) { $actions = array(); $components = array(); if ( isset( $wp_filter[ $name ] ) ) { # http://core.trac.wordpress.org/ticket/17817 $action = $wp_filter[ $name ]; foreach ( $action as $priority => $callbacks ) { foreach ( $callbacks as $cb ) { $callback = QM_Util::populate_callback( $cb ); if ( isset( $callback['component'] ) ) { if ( ( $hide_qm && 'query-monitor' === $callback['component']->context ) || ( $hide_core && 'core' === $callback['component']->context ) ) { continue; } $components[ $callback['component']->name ] = $callback['component']->name; } $actions[] = array( 'priority' => $priority, 'callback' => $callback, ); } } } $parts = array_values( array_filter( (array) preg_split( '#[_/.-]#', $name ) ) ); return array( 'name' => $name, 'type' => $type, 'actions' => $actions, 'parts' => $parts, 'components' => $components, ); } }