/home/vianto5/ceibaresidencial.mx/wp-content/plugins/query-monitor/dispatchers
Edit: /home/vianto5/ceibaresidencial.mx/wp-content/plugins/query-monitor/dispatchers/AJAX.php (2928B)
should_dispatch() ) {
return;
}
$this->before_output();
foreach ( $this->get_outputters( 'headers' ) as $id => $output ) {
$output->output();
}
$this->after_output();
}
/**
* @return void
*/
protected function before_output() {
foreach ( (array) glob( $this->qm->plugin_path( 'output/headers/*.php' ) ) as $file ) {
require_once $file;
}
}
/**
* @return void
*/
protected function after_output() {
# flush once, because we're nice
if ( ob_get_length() ) {
ob_flush();
}
}
/**
* @return bool
*/
public function is_active() {
if ( ! QM_Util::is_ajax() ) {
return false;
}
if ( ! self::user_can_view() ) {
return false;
}
# If the headers have already been sent then we can't do anything about it
if ( headers_sent() ) {
return false;
}
# Don't process if the minimum required actions haven't fired:
if ( is_admin() ) {
if ( ! did_action( 'admin_init' ) ) {
return false;
}
} else {
if ( ! did_action( 'wp' ) ) {
return false;
}
}
return true;
}
/**
* @param string $message
* @param mixed[] $e
* @phpstan-param array{
* message: string,
* file: string,
* line: int,
* type?: int,
* trace?: mixed|null,
* } $e
*/
public function output_fatal( $message, array $e ): void {
if ( ! headers_sent() ) {
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
}
echo wp_json_encode(
array(
'code' => 'qm_fatal',
'message' => $message,
'data' => $e,
),
JSON_UNESCAPED_SLASHES
);
}
}
/**
* @param array
$dispatchers
* @param QM_Plugin $qm
* @return array
*/
function register_qm_dispatcher_ajax( array $dispatchers, QM_Plugin $qm ) {
$dispatchers['ajax'] = new QM_Dispatcher_AJAX( $qm );
return $dispatchers;
}
add_filter( 'qm/dispatchers', 'register_qm_dispatcher_ajax', 10, 2 );