|
Server IP : 10.106.20.8 / Your IP : 216.73.216.148 Web Server : Apache System : Linux webm008.cluster106.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 User : sixiemesrc ( 611999) PHP Version : 8.0.30 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/sixiemesrc/new/wp-content/languages/../plugins/query-monitor/classes/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php declare(strict_types = 1);
/**
* Hook processor.
*
* @package query-monitor
*/
class QM_Hook {
/**
* @param string $name
* @param string $type
* @param array<string, WP_Hook> $wp_filter
* @param bool $hide_qm
* @param bool $hide_core
* @return array<int, array<string, mixed>>
* @phpstan-param 'action'|'filter' $type
* @phpstan-return array{
* name: string,
* type: 'action'|'filter',
* actions: list<array{
* priority: int,
* callback: array<string, mixed>,
* }>,
* parts: list<string>,
* components: array<string, QM_Component>,
* }
*/
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 ] ) ) {
# https://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']->get_id() ] = $callback['component'];
}
$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,
);
}
}