SILENT KILLERPanel

Current Path: > home > transcarter > > www > wp-content > plugins > query-monitor > > output > html >


Operation   : Linux host59.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
Software     : Apache
Server IP    : 198.54.126.42 | Your IP: 216.73.216.135
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: /home/transcarter//www/wp-content/plugins/query-monitor//output/html/

NameTypeSizeLast ModifiedActions
admin.php File 3489 bytes July 17 2025 21:05:45.
assets.php File 8350 bytes July 17 2025 21:05:45.
assets_scripts.php File 1408 bytes July 17 2025 21:05:45.
assets_styles.php File 1386 bytes July 17 2025 21:05:45.
block_editor.php File 10533 bytes July 17 2025 21:05:45.
caps.php File 5922 bytes July 17 2025 21:05:45.
conditionals.php File 3071 bytes July 17 2025 21:05:45.
db_callers.php File 3930 bytes July 17 2025 21:05:45.
db_components.php File 3841 bytes July 17 2025 21:05:45.
db_dupes.php File 5302 bytes July 17 2025 21:05:45.
db_queries.php File 17886 bytes July 17 2025 21:05:45.
debug_bar.php File 2167 bytes July 17 2025 21:05:45.
doing_it_wrong.php File 4684 bytes July 17 2025 21:05:45.
environment.php File 8470 bytes July 17 2025 21:05:45.
headers.php File 3422 bytes July 17 2025 21:05:45.
hooks.php File 7284 bytes July 17 2025 21:05:45.
http.php File 11621 bytes July 17 2025 21:05:45.
languages.php File 5745 bytes July 17 2025 21:05:45.
logger.php File 5926 bytes July 17 2025 21:05:45.
multisite.php File 3876 bytes July 17 2025 21:05:45.
overview.php File 12846 bytes July 17 2025 21:05:45.
php_errors.php File 9418 bytes July 17 2025 21:05:45.
request.php File 6567 bytes July 17 2025 21:05:45.
theme.php File 8352 bytes July 17 2025 21:05:45.
timing.php File 6259 bytes July 17 2025 21:05:45.
transients.php File 4292 bytes July 17 2025 21:05:45.

Reading File: /home/transcarter//www/wp-content/plugins/query-monitor//output/html//db_dupes.php

<?php declare(strict_types = 1);
/**
 * Duplicate database query output for HTML pages.
 *
 * @package query-monitor
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

class QM_Output_Html_DB_Dupes extends QM_Output_Html {

	/**
	 * Collector instance.
	 *
	 * @var QM_Collector_DB_Dupes Collector.
	 */
	protected $collector;

	public function __construct( QM_Collector $collector ) {
		parent::__construct( $collector );
		add_filter( 'qm/output/menus', array( $this, 'admin_menu' ), 45 );
		add_filter( 'qm/output/panel_menus', array( $this, 'panel_menu' ), 25 );
	}

	/**
	 * @return string
	 */
	public function name() {
		return __( 'Duplicate Queries', 'query-monitor' );
	}

	/**
	 * @return void
	 */
	public function output() {
		/** @var QM_Data_DB_Dupes $data */
		$data = $this->collector->get_data();

		if ( empty( $data->dupes ) ) {
			return;
		}

		$this->before_tabular_output();

		echo '<thead>';

		echo '<tr>';
		echo '<th scope="col">' . esc_html__( 'Query', 'query-monitor' ) . '</th>';
		echo '<th scope="col" class="qm-num">' . esc_html__( 'Count', 'query-monitor' ) . '</th>';
		echo '<th scope="col" class="qm-num">' . esc_html__( 'Time', 'query-monitor' ) . '</th>';
		echo '<th scope="col">' . esc_html__( 'Callers', 'query-monitor' ) . '</th>';
		if ( ! empty( $data->dupe_components ) ) {
			echo '<th scope="col">' . esc_html__( 'Components', 'query-monitor' ) . '</th>';
		}
		echo '<th scope="col">' . esc_html__( 'Potential Troublemakers', 'query-monitor' ) . '</th>';
		echo '</tr>';

		echo '</thead>';

		echo '<tbody>';

		/* translators: %s: Number of calls to a PHP function */
		$call_text = _n_noop( '%s call', '%s calls', 'query-monitor' );

		foreach ( $data->dupes as $sql => $queries ) {

			// This should probably happen in the collector's processor
			$type = QM_Util::get_query_type( $sql );
			$sql_out = self::format_sql( $sql );
			$time = $data->dupe_times[ $sql ];

			if ( 'SELECT' !== $type ) {
				$sql_out = "<span class='qm-nonselectsql'>{$sql_out}</span>";
			}

			echo '<tr>';
			echo '<td class="qm-row-sql qm-ltr qm-wrap">';
			echo $sql_out; // WPCS: XSS ok;
			echo '</td>';
			echo '<td class="qm-num">';
			echo esc_html( number_format_i18n( count( $queries ), 0 ) );
			echo '</td>';
			echo '<td class="qm-num">';
			echo esc_html( number_format_i18n( $time, 4 ) );
			echo '</td>';
			echo '<td class="qm-row-caller qm-nowrap qm-ltr">';
			foreach ( $data->dupe_callers[ $sql ] as $caller => $calls ) {
				echo self::build_filter_trigger( 'db_queries', 'caller', $caller, '<code>' . esc_html( $caller ) . '</code>' ); // WPCS: XSS ok;
				printf(
					'<br><span class="qm-info qm-supplemental">%s</span><br>',
					esc_html( sprintf(
						translate_nooped_plural( $call_text, $calls, 'query-monitor' ),
						number_format_i18n( $calls )
					) )
				);
			}
			echo '</td>';
			if ( isset( $data->dupe_components[ $sql ] ) ) {
				echo '<td class="qm-row-component qm-nowrap">';
				foreach ( $data->dupe_components[ $sql ] as $component => $calls ) {
					printf(
						'%s<br><span class="qm-info qm-supplemental">%s</span><br>',
						esc_html( $component ),
						esc_html( sprintf(
							translate_nooped_plural( $call_text, $calls, 'query-monitor' ),
							number_format_i18n( $calls )
						) )
					);
				}
				echo '</td>';
			}
			echo '<td class="qm-row-caller qm-nowrap qm-ltr">';
			foreach ( $data->dupe_sources[ $sql ] as $source => $calls ) {
				printf(
					'<code>%s</code><br><span class="qm-info qm-supplemental">%s</span><br>',
					esc_html( $source ),
					esc_html( sprintf(
						translate_nooped_plural( $call_text, $calls, 'query-monitor' ),
						number_format_i18n( $calls )
					) )
				);
			}
			echo '</td>';
			echo '</tr>';
		}
		echo '</tbody>';

		$this->after_tabular_output();
	}

	/**
	 * @param array<string, mixed[]> $menu
	 * @return array<string, mixed[]>
	 */
	public function admin_menu( array $menu ) {
		/** @var QM_Collector_DB_Dupes|null $dbq */
		$dbq = QM_Collectors::get( 'db_dupes' );

		if ( $dbq ) {
			/** @var QM_Data_DB_Queries $dbq_data */
			$dbq_data = $dbq->get_data();
			if ( ! empty( $dbq_data->dupes ) ) {
				$count = 0;

				foreach ( $dbq_data->dupes as $dupe ) {
					$count += count( $dupe );
				}

				$menu[ $this->collector->id() ] = $this->menu( array(
					'title' => esc_html( sprintf(
						/* translators: %s: Number of duplicate database queries */
						__( 'Duplicate Queries (%s)', 'query-monitor' ),
						number_format_i18n( $count )
					) ),
				) );
			}
		}
		return $menu;

	}

	/**
	 * @param array<string, mixed[]> $menu
	 * @return array<string, mixed[]>
	 */
	public function panel_menu( array $menu ) {
		$id = $this->collector->id();
		if ( isset( $menu[ $id ] ) ) {
			$menu['qm-db_queries']['children'][] = $menu[ $id ];
			unset( $menu[ $id ] );
		}

		return $menu;
	}

}

/**
 * @param array<string, QM_Output> $output
 * @param QM_Collectors $collectors
 * @return array<string, QM_Output>
 */
function register_qm_output_html_db_dupes( array $output, QM_Collectors $collectors ) {
	$collector = QM_Collectors::get( 'db_dupes' );
	if ( $collector ) {
		$output['db_dupes'] = new QM_Output_Html_DB_Dupes( $collector );
	}
	return $output;
}

add_filter( 'qm/outputter/html', 'register_qm_output_html_db_dupes', 45, 2 );

SILENT KILLER Tool