PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.3.9.2
Pods – Custom Content Types and Fields v3.3.9.2
2.7.31.4 2.8.23.5 2.9.19.5 3.0.10.5 3.1.4.3 3.2.8.4 3.3.9.2 2.8.23.4 2.9.19.4 3.0.10.4 3.1.4.2 3.2.8.3 3.3.9.1 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 3 days ago WPGraphQL 3 days ago Enfold.php 3 days ago Genesis.php 3 days ago Jetpack.php 3 days ago Polylang.php 3 days ago Query_Monitor.php 3 days ago Service_Provider.php 3 days ago WPML.php 3 days ago YARPP.php 3 days ago
Query_Monitor.php
112 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 if ( ! wp_style_is( 'query-monitor', 'registered' ) ) {
58 return;
59 }
60
61 wp_register_style( 'pods-query-monitor', PODS_URL . 'ui/styles/dist/pods-query-monitor.css', [ 'query-monitor' ], PODS_VERSION );
62 wp_enqueue_style( 'pods-query-monitor' );
63 }
64
65 public static function is_active(): bool {
66 return (
67 class_exists( 'QM_Activation' )
68 && ( ! defined( 'QM_DISABLED' ) || ! QM_DISABLED )
69 && ( ! defined( 'QMX_DISABLED' ) || ! QMX_DISABLED )
70 );
71 }
72
73 /**
74 * Register the custom Pods outputters.
75 *
76 * @since 3.2.7
77 *
78 * @param array $outputters The array of outputter instances.
79 *
80 * @return array The updated array of outputters.
81 */
82 public static function register_outputters( array $outputters ): array {
83 $outputters['pods-constants'] = new Outputters\Constants( QM_Collectors::get( 'pods-constants' ) );
84 $outputters['pods-debug'] = new Outputters\Debug( QM_Collectors::get( 'pods-debug' ) );
85
86 return $outputters;
87 }
88
89 /**
90 * Add Pods conditional functions to Query Monitor.
91 *
92 * @since 3.2.7
93 *
94 * @param array $conditionals The conditional functions for Query Monitor.
95 *
96 * @return array The updated conditional functions.
97 */
98 public static function filter_query_monitor_conditionals( array $conditionals ): array {
99 $conditionals[] = 'pods_developer';
100 $conditionals[] = 'pods_tableless';
101 $conditionals[] = 'pods_light';
102 $conditionals[] = 'pods_strict';
103 $conditionals[] = 'pods_allow_deprecated';
104 $conditionals[] = 'pods_api_cache';
105 $conditionals[] = 'pods_shortcode_allow_evaluate_tags';
106 $conditionals[] = 'pods_session_auto_start';
107
108 return $conditionals;
109 }
110
111 }
112