collector->get_data(); if ( empty( $data['switches'] ) ) { $this->before_non_tabular_output(); $notice = __( 'No data logged.', 'query-monitor' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $this->build_notice( $notice ); $this->after_non_tabular_output(); return; } $this->before_tabular_output(); echo ''; echo ''; echo '#'; echo '' . esc_html__( 'Function', 'query-monitor' ) . ''; echo '' . esc_html__( 'Site Switch', 'query-monitor' ) . ''; echo '' . esc_html__( 'Caller', 'query-monitor' ) . ''; echo ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $this->build_filter( 'component', array(), __( 'Component', 'query-monitor' ) ); echo ''; echo ''; echo ''; echo ''; $i = 0; foreach ( $data['switches'] as $row ) { $component = $row['trace']->get_component(); $row_attr = array(); $row_attr['data-qm-component'] = $component->name; $attr = ''; foreach ( $row_attr as $a => $v ) { $attr .= ' ' . $a . '="' . esc_attr( $v ) . '"'; } // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo ''; echo ''; if ( $row['to'] ) { echo intval( ++$i ); } echo ''; echo ''; if ( $row['to'] ) { printf( 'switch_to_blog(%d)', intval($row['new'] ) ); } else { echo 'restore_current_blog()'; } echo ''; echo ''; if ( $row['to'] ) { echo esc_html( sprintf( '%1$s → %2$s', $row['prev'], $row['new'] ) ); } else { echo esc_html( sprintf( '%1$s ← %2$s', $row['new'], $row['prev'] ) ); } echo ''; $stack = array(); $filtered_trace = $row['trace']->get_display_trace(); foreach ( $filtered_trace as $item ) { $stack[] = self::output_filename( $item['display'], $item['calling_file'], $item['calling_line'] ); } $caller = array_shift( $stack ); echo ''; if ( ! empty( $stack ) ) { echo self::build_toggler(); // WPCS: XSS ok; } echo '
    '; echo "
  1. {$caller}
  2. "; // WPCS: XSS ok. if ( ! empty( $stack ) ) { echo '
  3. ' . implode( '
  4. ', $stack ) . '
  5. '; // WPCS: XSS ok. } echo '
'; printf( '%s', esc_html( $component->name ) ); echo ''; } echo ''; $this->after_tabular_output(); } } /** * @param array $output * @param QM_Collectors $collectors * @return array */ function register_qm_output_html_multisite( array $output, QM_Collectors $collectors ) { $collector = is_multisite() ? QM_Collectors::get( 'multisite' ) : null; if ( $collector ) { $output['multisite'] = new QM_Output_Html_Multisite( $collector ); } return $output; } add_filter( 'qm/outputter/html', 'register_qm_output_html_multisite', 65, 2 );