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

146 lines 2.7 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
49 }
50
51 public static function mywp_is_debug( $is_debug ) {
52
53 if( ! self::is_do_function( __FUNCTION__ ) ) {
54
55 return false;
56
57 }
58
59 $setting_data = self::get_setting_data();
60
61 if( empty( $setting_data['users'] ) ) {
62
63 return false;
64
65 }
66
67 $user_id = get_current_user_id();
68
69 if( empty( $user_id ) ) {
70
71 return false;
72
73 }
74
75 if( in_array( $user_id , $setting_data['users'] ) ) {
76
77 return true;
78
79 }
80
81 self::after_do_function( __FUNCTION__ );
82
83 return false;
84
85 }
86
87 public static function after_setup_theme() {
88
89 if( ! MywpDeveloper::is_debug() ) {
90
91 return false;
92
93 }
94
95 add_filter( 'mywp_post_types' , array( __CLASS__ , 'mywp_post_types' ) , 49 );
96
97 }
98
99 public static function mywp_post_types( $post_types ) {
100
101 foreach( $post_types as $post_type_name => $post_type_setting ) {
102
103 $post_types[ $post_type_name ]['show_ui'] = true;
104 $post_types[ $post_type_name ]['delete_with_user'] = true;
105
106 }
107
108 return $post_types;
109
110 }
111
112 public static function mywp_request_admin() {
113
114 if( ! MywpDeveloper::is_debug() ) {
115
116 return false;
117
118 }
119
120 add_filter( 'current_edit_per_page' , array( __CLASS__ , 'current_edit_per_page' ) );
121 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 );
122
123 }
124
125 public static function current_edit_per_page( $per_page ) {
126
127 $per_page = 200;
128
129 return $per_page;
130
131 }
132
133 public static function mywp_setting_admin_sidebar_print_item_header_pre_add_title( $pre_add_title , $item ) {
134
135 $pre_add_title .= sprintf( '[%d]' , $item->ID );
136
137 return $pre_add_title;
138
139 }
140
141 }
142
143 MywpControllerModuleDebugGeneral::init();
144
145 endif;
146