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