trace = new QM_Backtrace( array( 'ignore_hook' => array( current_filter() => true, ), ) ); return $handler; } /** * @return void */ public function dispatch() { if ( ! $this->should_dispatch() ) { return; } $switched_locale = self::switch_to_locale( get_user_locale() ); $stack = array(); $filtered_trace = $this->trace->get_filtered_trace(); $component = $this->trace->get_component(); foreach ( $filtered_trace as $i => $item ) { $stack[] = QM_Output_Html::output_filename( $item['display'], $item['file'], $item['line'] ); } ?> '; echo '

'; if ( 'unknown' !== $component->type ) { $name = ( 'plugin' === $component->type ) ? $component->context : $component->name; printf( /* translators: %s: Plugin or theme name */ esc_html__( 'This message was triggered by %s.', 'query-monitor' ), '' . esc_html( $name ) . '' ); } echo '

'; echo '

' . esc_html__( 'Call stack:', 'query-monitor' ) . '

'; echo '
    '; echo '
  1. ' . implode( '
  2. ', $stack ) . '
  3. '; // WPCS: XSS ok. echo '
'; echo '

' . esc_html__( 'Query Monitor', 'query-monitor' ) . '

'; echo ''; if ( $switched_locale ) { self::restore_previous_locale(); } } /** * @return bool */ public function is_active() { if ( ! $this->trace ) { return false; } if ( ! self::user_can_view() ) { return false; } return true; } } /** * @param array $dispatchers * @param QM_Plugin $qm * @return array */ function register_qm_dispatcher_wp_die( array $dispatchers, QM_Plugin $qm ) { $dispatchers['wp_die'] = new QM_Dispatcher_WP_Die( $qm ); return $dispatchers; } add_filter( 'qm/dispatchers', 'register_qm_dispatcher_wp_die', 10, 2 );