PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / trunk
Pods – Custom Content Types and Fields vtrunk
trunk 1.14.8 2.7.31.3 2.8.23.3 2.9.19.3 3.0.10.3 3.1.4.1 3.2.0 3.2.1 3.2.1.1 3.2.2 3.2.4 3.2.5 3.2.6 3.2.7 3.2.7.1 3.2.8 3.2.8.1 3.2.8.2 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9
pods / src / Pods / Integrations / Query_Monitor.php
pods / src / Pods / Integrations Last commit date
Query_Monitor 4 months ago WPGraphQL 4 months ago Enfold.php 4 months ago Genesis.php 4 months ago Jetpack.php 4 months ago Polylang.php 4 months ago Query_Monitor.php 4 months ago Service_Provider.php 4 months ago WPML.php 4 months ago YARPP.php 4 months ago
Query_Monitor.php
108 lines
1 <?php
2
3 namespace Pods\Integrations;
4
5 // Don't load directly.
6 if ( ! defined( 'ABSPATH' ) ) {
7 die( '-1' );
8 }
9
10 use Pods\Integration;
11 use Pods\Integrations\Query_Monitor\Collectors;
12 use Pods\Integrations\Query_Monitor\Outputters;
13 use QM_Collectors;
14
15 /**
16 * Class Query_Monitor
17 *
18 * @since 3.2.7
19 */
20 class Query_Monitor extends Integration {
21
22 protected $hooks = [
23 'action' => [
24 'pods_debug_log_data' => [
25 [ Collectors\Debug::class, 'track_debug_data' ],
26 10,
27 4,
28 ],
29 'wp_enqueue_scripts' => [
30 [ __CLASS__, 'enqueue_assets' ],
31 ],
32 ],
33 'filter' => [
34 'pods_is_debug_logging_enabled' => [
35 '__return_true',
36 ],
37 'qm/outputter/html' => [
38 [ __CLASS__, 'register_outputters' ],
39 ],
40 'query_monitor_conditionals' => [
41 [ __CLASS__, 'filter_query_monitor_conditionals' ],
42 ],
43 ],
44 ];
45
46 public function post_hook() {
47 QM_Collectors::add( new Collectors\Constants() );
48 QM_Collectors::add( new Collectors\Debug() );
49 }
50
51 /**
52 * Handle enqueuing assets.
53 *
54 * @since 3.2.7
55 */
56 public static function enqueue_assets(): void {
57 wp_register_style( 'pods-query-monitor', PODS_URL . 'ui/styles/dist/pods-query-monitor.css', [ 'query-monitor' ], PODS_VERSION );
58 wp_enqueue_style( 'pods-query-monitor' );
59 }
60
61 public static function is_active(): bool {
62 return (
63 class_exists( 'QM_Activation' )
64 && ( ! defined( 'QM_DISABLED' ) || ! QM_DISABLED )
65 && ( ! defined( 'QMX_DISABLED' ) || ! QMX_DISABLED )
66 );
67 }
68
69 /**
70 * Register the custom Pods outputters.
71 *
72 * @since 3.2.7
73 *
74 * @param array $outputters The array of outputter instances.
75 *
76 * @return array The updated array of outputters.
77 */
78 public static function register_outputters( array $outputters ): array {
79 $outputters['pods-constants'] = new Outputters\Constants( QM_Collectors::get( 'pods-constants' ) );
80 $outputters['pods-debug'] = new Outputters\Debug( QM_Collectors::get( 'pods-debug' ) );
81
82 return $outputters;
83 }
84
85 /**
86 * Add Pods conditional functions to Query Monitor.
87 *
88 * @since 3.2.7
89 *
90 * @param array $conditionals The conditional functions for Query Monitor.
91 *
92 * @return array The updated conditional functions.
93 */
94 public static function filter_query_monitor_conditionals( array $conditionals ): array {
95 $conditionals[] = 'pods_developer';
96 $conditionals[] = 'pods_tableless';
97 $conditionals[] = 'pods_light';
98 $conditionals[] = 'pods_strict';
99 $conditionals[] = 'pods_allow_deprecated';
100 $conditionals[] = 'pods_api_cache';
101 $conditionals[] = 'pods_shortcode_allow_evaluate_tags';
102 $conditionals[] = 'pods_session_auto_start';
103
104 return $conditionals;
105 }
106
107 }
108