PluginProbe
My WP Customize Admin/Frontend / trunk
My WP Customize Admin/Frontend vtrunk
1.27.4 1.27.3 trunk 1.0 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.10 1.10.1 1.10.2 1.11 1.12 1.12.1 1.12.2 1.13 1.13.1 1.13.2 1.14 1.15.0 1.16 1.17.0 All 76 releases
my-wp / developer / developer.init.php

developer.init.php in My WP Customize Admin/Frontend trunk, at developer/developer.init.php

166 lines 5.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 if ( ! class_exists( 'MywpDeveloperInit' ) ) :
8
9 final class MywpDeveloperInit {
10
11 public static function init() {
12
13 add_action( 'mywp_plugins_loaded' , array( __CLASS__ , 'plugins_loaded_include_modules' ) , 20 );
14 add_action( 'mywp_after_setup_theme' , array( __CLASS__ , 'after_setup_theme_include_modules' ) , 20 );
15
16 add_filter( 'mywp_debug_types' , array( __CLASS__ , 'add_debug_type_core' ) , 20 );
17 add_filter( 'mywp_debug_types' , array( __CLASS__ , 'add_debug_type_mywp' ) , 30 );
18 add_filter( 'mywp_debug_types' , array( __CLASS__ , 'add_debug_type_dev' ) , 40 );
19 add_filter( 'mywp_debug_types' , array( __CLASS__ , 'add_debug_type_custom' ) , 100 );
20
21 add_filter( 'mywp_debug_renders' , array( __CLASS__ , 'add_debug_renders_custom_example' ) );
22
23 add_action( 'mywp_debug_render_custom_example' , array( __CLASS__ , 'mywp_debug_render_custom_example' ) );
24
25 add_action( 'admin_enqueue_scripts' , array( __CLASS__ , 'enqueue_scripts' ) );
26 add_action( 'wp_enqueue_scripts' , array( __CLASS__ , 'enqueue_scripts' ) );
27 add_action( 'login_enqueue_scripts' , array( __CLASS__ , 'enqueue_scripts' ) );
28
29 add_action( 'admin_footer' , array( __CLASS__ , 'debug_footer_print' ) , 1000 );
30 add_action( 'wp_footer' , array( __CLASS__ , 'debug_footer_print' ) , 1000 );
31 add_action( 'login_footer' , array( __CLASS__ , 'debug_footer_print' ) , 1000 );
32
33 /*
34 add_action( 'shutdown' , array( __CLASS__ , 'debug_footer_print' ) , 1000 );
35 */
36
37 }
38
39 public static function plugins_loaded_include_modules() {
40
41 $dir = MYWP_PLUGIN_PATH . 'developer/modules/';
42
43 $includes = array(
44
45 'core_environment' => $dir . 'mywp.developer.module.core.environment.php',
46 'core_multisite' => $dir . 'mywp.developer.module.core.multisite.php',
47 'core_site' => $dir . 'mywp.developer.module.core.site.php',
48 'core_theme' => $dir . 'mywp.developer.module.core.theme.php',
49 'core_user' => $dir . 'mywp.developer.module.core.user.php',
50
51 'dev_actions' => $dir . 'mywp.developer.module.dev.actions.php',
52 'dev_admin' => $dir . 'mywp.developer.module.dev.admin.php',
53 'dev_debugtrace' => $dir . 'mywp.developer.module.dev.debugtrace.php',
54 'dev_frontend' => $dir . 'mywp.developer.module.dev.frontend.php',
55 'dev_request' => $dir . 'mywp.developer.module.dev.request.php',
56 'dev_times' => $dir . 'mywp.developer.module.dev.times.php',
57
58 'mywp_cache' => $dir . 'mywp.developer.module.mywp.cache.php',
59 'mywp_error' => $dir . 'mywp.developer.module.mywp.error.php',
60 'mywp_info' => $dir . 'mywp.developer.module.mywp.info.php',
61
62 );
63
64 $includes = apply_filters( 'mywp_developer_plugins_loaded_include_modules' , $includes );
65
66 MywpApi::require_files( $includes );
67
68 }
69
70 public static function after_setup_theme_include_modules() {
71
72 $includes = array();
73
74 $includes = apply_filters( 'mywp_developer_after_setup_theme_include_modules' , $includes );
75
76 MywpApi::require_files( $includes );
77
78 }
79
80 public static function add_debug_type_core( $debug_types ) {
81
82 $debug_types['core'] = __( 'Core' , 'my-wp' );
83
84 return $debug_types;
85
86 }
87
88 public static function add_debug_type_mywp( $debug_types ) {
89
90 $debug_types['mywp'] = __( 'My WP' , 'my-wp' );
91
92 return $debug_types;
93
94 }
95
96 public static function add_debug_type_dev( $debug_types ) {
97
98 $debug_types['dev'] = __( 'Dev' , 'my-wp' );
99
100 return $debug_types;
101
102 }
103
104 public static function add_debug_type_custom( $debug_types ) {
105
106 $debug_types['custom'] = __( 'Custom' , 'my-wp' );
107
108 return $debug_types;
109
110 }
111
112 public static function add_debug_renders_custom_example( $debug_renders ) {
113
114 $debug_renders['custom_example'] = array(
115 'debug_type' => 'custom',
116 'title' => __( 'You can add custom debug panel :-)' , 'my-wp' ),
117 );
118
119 return $debug_renders;
120
121 }
122
123 public static function mywp_debug_render_custom_example() {
124
125 printf( '<a href="%s" target="_blank">%s</a>' , esc_url( 'https://mywpcustomize.com/document/mywp-debug-panel-extends/' ) , __( 'Document for Debug panel' , 'my-wp' ) );
126
127 }
128
129 public static function enqueue_scripts() {
130
131 if( ! MywpDeveloper::is_debug() ) {
132
133 return false;
134
135 }
136
137 wp_register_style( 'mywp_developer' , MywpApi::get_plugin_url( 'css' ) . 'developer.css' , array() , MYWP_VERSION );
138 wp_register_script( 'mywp_developer' , MywpApi::get_plugin_url( 'js' ) . 'developer.js' , array( 'jquery' ) , MYWP_VERSION );
139
140 wp_enqueue_style( 'mywp_developer' );
141 wp_enqueue_script( 'mywp_developer' );
142
143 }
144
145 public static function debug_footer_print() {
146
147 if( ! MywpDeveloper::is_debug() ) {
148
149 return false;
150
151 }
152
153 if( MywpHelper::is_doing( 'cron' ) or MywpHelper::is_doing( 'xmlrpc' ) or MywpHelper::is_doing( 'ajax' ) or MywpHelper::is_doing( 'rest' ) ) {
154
155 return false;
156
157 }
158
159 MywpApi::include_file( MYWP_PLUGIN_PATH . 'views/debug-footer.php' );
160
161 }
162
163 }
164
165 endif;
166