PluginProbe
My WP Customize Admin/Frontend / 1.5
My WP Customize Admin/Frontend v1.5
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 / controller / modules / mywp.controller.module.debug.general.php

mywp.controller.module.debug.general.php in My WP Customize Admin/Frontend 1.5, at controller/modules/mywp.controller.module.debug.general.php

483 lines 11.3 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( 'MywpControllerAbstractModule' ) ) {
8 return false;
9 }
10
11 if ( ! class_exists( 'MywpControllerModuleDebugGeneral' ) ) :
12
13 final class MywpControllerModuleDebugGeneral extends MywpControllerAbstractModule {
14
15 static protected $id = 'debug_general';
16
17 static protected $model_use_filter = false;
18
19 static protected $is_do_controller = true;
20
21 public static function mywp_controller_initial_data( $initial_data ) {
22
23 $initial_data['users'] = array();
24
25 return $initial_data;
26
27 }
28
29 public static function mywp_controller_default_data( $default_data ) {
30
31 $default_data['users'] = array();
32
33 return $default_data;
34
35 }
36
37 protected static function after_init() {
38
39 add_filter( 'mywp_is_debug' , array( __CLASS__ , 'mywp_is_debug' ) , 9 );
40
41 add_action( 'after_setup_theme' , array( __CLASS__ , 'after_setup_theme' ) , 49 );
42
43 }
44
45 public static function mywp_wp_loaded() {
46
47 add_action( 'mywp_request_admin' , array( __CLASS__ , 'mywp_request_admin' ) , 49 );
48 add_action( 'mywp_request_frontend' , array( __CLASS__ , 'mywp_request_frontend' ) , 49 );
49 add_action( 'mywp_ajax' , array( __CLASS__ , 'mywp_ajax' ) , 49 );
50
51 }
52
53 public static function mywp_is_debug( $is_debug ) {
54
55 if( ! self::is_do_function( __FUNCTION__ ) ) {
56
57 return false;
58
59 }
60
61 $setting_data = self::get_setting_data();
62
63 if( empty( $setting_data['users'] ) ) {
64
65 return false;
66
67 }
68
69 $user_id = get_current_user_id();
70
71 if( empty( $user_id ) ) {
72
73 return false;
74
75 }
76
77 if( in_array( $user_id , $setting_data['users'] ) ) {
78
79 return true;
80
81 }
82
83 self::after_do_function( __FUNCTION__ );
84
85 return false;
86
87 }
88
89 public static function after_setup_theme() {
90
91 if( ! MywpDeveloper::is_debug() ) {
92
93 return false;
94
95 }
96
97 add_filter( 'mywp_post_types' , array( __CLASS__ , 'mywp_post_types' ) , 49 );
98 add_filter( 'mywp_taxonomy_types' , array( __CLASS__ , 'mywp_taxonomy_types' ) , 49 );
99
100 add_filter( 'mywp_debug_renders' , array( __CLASS__ , 'mywp_debug_renders' ) , 11 );
101 add_action( 'mywp_debug_render_shortcode' , array( __CLASS__ , 'mywp_debug_render_shortcode' ) , 11 );
102 add_action( 'mywp_debug_render_post_type' , array( __CLASS__ , 'mywp_debug_render_post_type' ) , 11 );
103 add_action( 'mywp_debug_render_taxonomy' , array( __CLASS__ , 'mywp_debug_render_taxonomy' ) , 11 );
104 add_action( 'mywp_debug_render_controller' , array( __CLASS__ , 'mywp_debug_render_controller' ) , 11 );
105 add_action( 'mywp_debug_render_current_setting' , array( __CLASS__ , 'mywp_debug_render_current_setting' ) , 11 );
106 add_action( 'mywp_debug_render_settings' , array( __CLASS__ , 'mywp_debug_render_settings' ) , 11 );
107 add_action( 'mywp_debug_render_thirdparty' , array( __CLASS__ , 'mywp_debug_render_thirdparty' ) , 11 );
108
109 }
110
111 public static function mywp_post_types( $post_types ) {
112
113 foreach( $post_types as $post_type_name => $post_type_setting ) {
114
115 $post_types[ $post_type_name ]['show_ui'] = true;
116 $post_types[ $post_type_name ]['delete_with_user'] = true;
117
118 }
119
120 return $post_types;
121
122 }
123
124 public static function mywp_taxonomy_types( $taxonomy_types ) {
125
126 foreach( $taxonomy_types as $taxonomy_name => $taxonomy_setting ) {
127
128 $taxonomy_types[ $taxonomy_name ]['show_ui'] = true;
129
130 }
131
132 return $taxonomy_types;
133
134 }
135
136 public static function mywp_debug_renders( $debug_renders ) {
137
138 $debug_renders['shortcode'] = array(
139 'debug_type' => 'mywp',
140 'title' => __( 'My WP Shortcode' , 'mywp' ),
141 );
142
143 $debug_renders['post_type'] = array(
144 'debug_type' => 'mywp',
145 'title' => __( 'My WP Post_Type' , 'mywp' ),
146 );
147
148 $debug_renders['taxonomy'] = array(
149 'debug_type' => 'mywp',
150 'title' => __( 'My WP Taxonomy' , 'mywp' ),
151 );
152
153 $debug_renders['current_setting'] = array(
154 'debug_type' => 'mywp',
155 'title' => __( 'Current Setting' , 'mywp' ),
156 );
157
158 $debug_renders['settings'] = array(
159 'debug_type' => 'mywp',
160 'title' => __( 'Settings' , 'mywp' ),
161 );
162
163 $debug_renders['controller'] = array(
164 'debug_type' => 'mywp',
165 'title' => __( 'Controller' , 'mywp' ),
166 );
167
168 $debug_renders['thirdparty'] = array(
169 'debug_type' => 'dev',
170 'title' => __( 'Thirdparty' , 'mywp' ),
171 );
172
173 return $debug_renders;
174
175 }
176
177 public static function mywp_debug_render_shortcode() {
178
179 echo '<ul>';
180
181 $shortcodes = MywpShortcode::get_shortcodes();
182
183 if( ! empty( $shortcodes ) ) {
184
185 foreach( $shortcodes as $shortcode => $function ) {
186
187 printf( '<li>%s</li>' , $shortcode );
188
189 }
190
191 }
192
193 echo '</ul>';
194
195 }
196
197 public static function mywp_debug_render_post_type() {
198
199 echo '<ul>';
200
201 $post_types = MywpPostType::get_post_types();
202
203 if( ! empty( $post_types ) ) {
204
205 foreach( $post_types as $post_type_name => $args ) {
206
207 printf( '<li>%s <textarea readonly="readonly">%s</textarea>' , $post_type_name , print_r( $args , true ) );
208
209 }
210
211 }
212
213 echo '</ul>';
214
215 }
216
217 public static function mywp_debug_render_taxonomy() {
218
219 echo '<ul>';
220
221 $taxonomy_types = MywpTaxonomy::get_taxonomy_types();
222
223 if( ! empty( $taxonomy_types ) ) {
224
225 foreach( $taxonomy_types as $taxonomy_name => $args ) {
226
227 printf( '<li>%s <textarea readonly="readonly">%s</textarea>' , $taxonomy_name , print_r( $args , true ) );
228
229 }
230
231 }
232
233 echo '</ul>';
234
235 }
236
237 public static function mywp_debug_render_controller() {
238
239 echo '<ul>';
240
241 $controllers = MywpController::get_controllers();
242
243 if( ! empty( $controllers ) ) {
244
245 foreach( $controllers as $controller_id => $controller ) {
246
247 if( ! empty( $controller['model'] ) && is_object( $controller['model'] ) ) {
248
249 $controller['model']->get_data();
250
251 }
252
253 printf( '<li>%s <textarea readonly="readonly">%s</textarea></li>' , $controller_id , print_r( $controller , true ) );
254
255 }
256
257 }
258
259 echo '</ul>';
260
261 }
262
263 public static function mywp_debug_render_current_setting() {
264
265 $current_setting_menu = MywpSettingMenu::get_current_menu();
266
267 if( ! empty( $current_setting_menu ) ) {
268
269 printf( '<p>Current Setting Menu = <textarea readonly="readonly">%s</textarea></p>' , print_r( $current_setting_menu , true ) );
270
271 }
272
273 $current_setting_screen = MywpSettingScreen::get_current_screen();
274
275 if( ! empty( $current_setting_screen ) ) {
276
277 printf( '<p>Current Setting Screen = <textarea readonly="readonly">%s</textarea></p>' , print_r( $current_setting_screen , true ) );
278
279 }
280
281 $current_setting_post_type = MywpSettingPostType::get_current_post_type();
282
283 if( ! empty( $current_setting_post_type ) ) {
284
285 printf( '<p>Current Setting Post Type = <textarea readonly="readonly">%s</textarea></p>' , print_r( $current_setting_post_type , true ) );
286
287 }
288
289 $current_setting_taxonomy = MywpSettingTaxonomy::get_current_taxonomy();
290
291 if( ! empty( $current_setting_taxonomy ) ) {
292
293 printf( '<p>Current Setting Taxonomy = <textarea readonly="readonly">%s</textarea></p>' , print_r( $current_setting_taxonomy , true ) );
294
295 }
296
297 if( ! empty( MywpSettingMenu::get_current_menu_id() ) ) {
298
299 $current_setting_screens = MywpSettingScreen::get_setting_screens_by_menu_id( MywpSettingMenu::get_current_menu_id() );
300
301 if( ! empty( $current_setting_screens ) ) {
302
303 printf( '<p>Current Setting Screens = <textarea readonly="readonly">%s</textarea></p>' , print_r( $current_setting_screens , true ) );
304
305 }
306
307 }
308
309 }
310
311 public static function mywp_debug_render_settings() {
312
313 $setting_menus = MywpSettingMenu::get_setting_menus();
314
315 echo 'Setting Menus';
316
317 if( ! empty( $setting_menus ) ) {
318
319 printf( '<textarea readonly="readonly">%s</textarea>' , print_r( $setting_menus , true ) );
320
321 }
322
323 $menu_hook_names = MywpSettingMenu::get_menu_hook_names();
324
325 echo 'Menu Hook Names';
326
327 if( ! empty( $menu_hook_names ) ) {
328
329 printf( '<textarea readonly="readonly">%s</textarea>' , print_r( $menu_hook_names , true ) );
330
331 }
332
333 $setting_screens = MywpSettingScreen::get_setting_screens();
334
335 echo 'Setting Screens';
336
337 if( ! empty( $setting_screens ) ) {
338
339 printf( '<textarea readonly="readonly">%s</textarea>' , print_r( $setting_screens , true ) );
340
341 }
342
343 $setting_post_types = MywpSettingPostType::get_setting_post_types();
344
345 echo 'Setting Post Types';
346
347 if( ! empty( $setting_post_types ) ) {
348
349 printf( '<textarea readonly="readonly">%s</textarea>' , print_r( $setting_post_types , true ) );
350
351 }
352
353 $setting_taxonomies = MywpSettingTaxonomy::get_setting_taxonomies();
354
355 echo 'Setting Taxonomies';
356
357 if( ! empty( $setting_taxonomies ) ) {
358
359 printf( '<textarea readonly="readonly">%s</textarea>' , print_r( $setting_taxonomies , true ) );
360
361 }
362
363 }
364
365 public static function mywp_debug_render_thirdparty() {
366
367 $thirdparties = MywpThirdparty::get_plugins();
368
369 if( ! empty( $thirdparties ) ) {
370
371 echo '<table class="debug-table">';
372
373 foreach( $thirdparties as $plugin_base_name => $plugin ) {
374
375 $plugin_data = MywpThirdparty::get_plugin_data_by_name( $plugin['plugin_name'] );
376
377 echo '<tr>';
378
379 if( $plugin['activate'] ) {
380
381 printf( '<th>%s (%s)</th>' , $plugin_data['Name'] , $plugin_data['Version'] );
382
383 } else {
384
385 printf( '<th>%s</th>' , $plugin['plugin_name'] );
386
387 }
388
389 echo '<td>';
390
391 if( $plugin['activate'] ) {
392
393 printf( '<strong>%s</strong>' , __( 'Activated' , 'mywp' ) );
394
395 } else {
396
397 _e( 'Not Activated' , 'mywp' );
398
399 }
400
401 echo '<br />';
402
403 printf( __( 'plugin base name: %s' , 'mywp' ) . '<br />' , $plugin['plugin_base_name'] );
404
405 echo '</td>';
406
407 echo '</tr>';
408
409 }
410
411 echo '</table>';
412
413 }
414
415 }
416
417 public static function mywp_request_admin() {
418
419 if( ! MywpDeveloper::is_debug() ) {
420
421 return false;
422
423 }
424
425 add_filter( 'current_edit_per_page' , array( __CLASS__ , 'current_edit_per_page' ) );
426 add_filter( 'mywp_setting_admin_sidebar_print_item_header_pre_add_title' , array( __CLASS__ , 'mywp_setting_admin_sidebar_print_item_header_pre_add_title' ) , 10 , 2 );
427 add_filter( 'mywp_setting_admin_toolbar_print_item_header_pre_add_title' , array( __CLASS__ , 'mywp_setting_admin_toolbar_print_item_header_pre_add_title' ) , 10 , 2 );
428
429 }
430
431 public static function mywp_request_frontend() {
432
433 if( ! MywpDeveloper::is_debug() ) {
434
435 return false;
436
437 }
438
439 }
440
441 public static function mywp_ajax() {
442
443 if( ! MywpDeveloper::is_debug() ) {
444
445 return false;
446
447 }
448
449 add_filter( 'mywp_setting_admin_sidebar_print_item_header_pre_add_title' , array( __CLASS__ , 'mywp_setting_admin_sidebar_print_item_header_pre_add_title' ) , 10 , 2 );
450 add_filter( 'mywp_setting_admin_toolbar_print_item_header_pre_add_title' , array( __CLASS__ , 'mywp_setting_admin_toolbar_print_item_header_pre_add_title' ) , 10 , 2 );
451
452 }
453
454 public static function current_edit_per_page( $per_page ) {
455
456 $per_page = 200;
457
458 return $per_page;
459
460 }
461
462 public static function mywp_setting_admin_sidebar_print_item_header_pre_add_title( $pre_add_title , $item ) {
463
464 $pre_add_title .= sprintf( '[%d]' , $item->ID );
465
466 return $pre_add_title;
467
468 }
469
470 public static function mywp_setting_admin_toolbar_print_item_header_pre_add_title( $pre_add_title , $item ) {
471
472 $pre_add_title .= sprintf( '[%d]' , $item->ID );
473
474 return $pre_add_title;
475
476 }
477
478 }
479
480 MywpControllerModuleDebugGeneral::init();
481
482 endif;
483