PluginProbe
My WP Customize Admin/Frontend / 1.14
My WP Customize Admin/Frontend v1.14
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 / modules / mywp.developer.module.dev.admin.php

mywp.developer.module.dev.admin.php in My WP Customize Admin/Frontend 1.14, at developer/modules/mywp.developer.module.dev.admin.php

277 lines 6.6 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( 'MywpDeveloperAbstractModule' ) ) {
8 return false;
9 }
10
11 if ( ! class_exists( 'MywpDeveloperModuleDevAdmin' ) ) :
12
13 final class MywpDeveloperModuleDevAdmin extends MywpDeveloperAbstractModule {
14
15 static protected $id = 'dev_admin';
16
17 static protected $priority = 20;
18
19 static private $post_updated_messages = array();
20
21 static private $bulk_post_updated_messages = array();
22
23 protected static function after_init() {
24
25 add_filter( 'post_updated_messages' , array( __CLASS__ , 'post_updated_messages' ) , 1000 );
26
27 add_filter( 'bulk_post_updated_messages' , array( __CLASS__ , 'bulk_post_updated_messages' ) , 1000 );
28
29 }
30
31 public static function post_updated_messages( $messages ) {
32
33 global $typenow;
34
35 if( empty( $typenow ) ) {
36
37 return $messages;
38
39 }
40
41 if( isset( $messages[ $typenow ] ) ) {
42
43 self::$post_updated_messages = $messages[ $typenow ];
44
45 } elseif( isset( $messages['post'] ) ) {
46
47 self::$post_updated_messages = $messages[ 'post' ];
48
49 }
50
51 return $messages;
52
53 }
54
55 public static function bulk_post_updated_messages( $bulk_messages ) {
56
57 global $typenow;
58
59 if( empty( $typenow ) ) {
60
61 return $bulk_messages;
62
63 }
64
65 if( isset( $bulk_messages[ $typenow ] ) ) {
66
67 self::$bulk_post_updated_messages = $bulk_messages[ $typenow ];
68
69 } elseif( isset( $bulk_messages['post'] ) ) {
70
71 self::$bulk_post_updated_messages = $bulk_messages[ 'post' ];
72
73 }
74
75 return $bulk_messages;
76
77 }
78
79 public static function mywp_debug_renders( $debug_renders ) {
80
81 if( ! is_admin() ) {
82
83 return $debug_renders;
84
85 }
86
87 $debug_renders[ self::$id ] = array(
88 'debug_type' => 'dev',
89 'title' => __( 'Current Admin Information' , 'my-wp' ),
90 );
91
92 return $debug_renders;
93
94 }
95
96 protected static function get_debug_lists() {
97
98 global $wpdb;
99 global $pagenow, $hook_suffix, $plugin_page, $page_hook, $typenow, $taxnow, $current_screen;
100 global $post;
101 global $user_id;
102
103 $debug_lists = array(
104 '$pagenow' => $pagenow,
105 '$hook_suffix' => $hook_suffix,
106 '$plugin_page' => $plugin_page,
107 '$page_hook' => $page_hook,
108 '$typenow' => $typenow,
109 '$taxnow' => $taxnow,
110 );
111
112 if( in_array( $pagenow , array( 'post.php' , 'post-new.php' ) ) ) {
113
114 $debug_lists['post_id'] = intval( $post->ID );
115 $debug_lists['post'] = $post;
116 $debug_lists['custom_fields'] = get_post_meta( $post->ID );
117
118 $debug_lists['taxonomies'] = array();
119 $debug_lists['terms'] = array();
120
121 $post_taxonomies = get_post_taxonomies( $post->ID );
122
123 if( ! empty( $post_taxonomies ) ) {
124
125 foreach( $post_taxonomies as $taxonomy_name ) {
126
127 $debug_lists['taxonomies'][ $taxonomy_name ] = false;
128 $debug_lists['terms'][ $taxonomy_name ] = false;
129
130 $taxonomy = get_taxonomy( $taxonomy_name );
131
132 $terms = wp_get_post_terms( $post->ID , $taxonomy_name );
133
134 if( empty( $taxonomy ) ) {
135
136 continue;
137
138 }
139
140 $debug_lists['taxonomies'][ $taxonomy_name ] = $taxonomy;
141
142 if( ! empty( $terms ) ) {
143
144 $debug_lists['terms'][ $taxonomy_name ] = $terms;
145
146 }
147
148 }
149
150 }
151
152 $debug_lists['post_updated_messages'] = self::$post_updated_messages;
153
154 $debug_lists['get_post( ' . $post->ID . ' )'] = get_post( $post->ID );
155 $debug_lists['MywpPostType::get_post( ' . $post->ID . ' )'] = MywpPostType::get_post( $post->ID );
156 $debug_lists['SELECT * FROM $wpdb->posts WHERE ID = ' . $post->ID] = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d", $post->ID ) );
157
158 } elseif( in_array( $pagenow , array( 'edit.php' ) ) ) {
159
160 $debug_lists['post_type'] = $typenow;
161 $debug_lists['counts'] = wp_count_posts( $typenow );
162
163 $debug_lists['taxonomies'] = array();
164
165 $post_type_taxonomies = get_object_taxonomies( $typenow );
166
167 if( ! empty( $post_type_taxonomies ) ) {
168
169 foreach( $post_type_taxonomies as $taxonomy_name ) {
170
171 $debug_lists['taxonomies'][ $taxonomy_name ] = false;
172
173 $taxonomy = get_taxonomy( $taxonomy_name );
174
175 if( empty( $taxonomy ) ) {
176
177 continue;
178
179 }
180
181 $debug_lists['taxonomies'][ $taxonomy_name ] = $taxonomy;
182
183 }
184
185 }
186
187 if( $typenow === 'page' ) {
188
189 $debug_lists['column_filters'][] = 'manage_pages_columns';
190
191 } else {
192
193 $debug_lists['column_filters'][] = 'manage_posts_columns';
194
195 }
196
197 $debug_lists['column_filters'][] = sprintf( 'manage_%s_posts_columns (manage_{$typenow}_posts_columns)' , $typenow );
198
199 $debug_lists['sortable_column_filter'] = sprintf( 'manage_%s_sortable_columns (manage_{$this->screen->id}_sortable_columns)' , $current_screen->id );
200
201 if( $typenow === 'page' ) {
202
203 $debug_lists['column_content_actions'][] = 'manage_pages_custom_column';
204
205 } else {
206
207 $debug_lists['column_content_actions'][] = 'manage_posts_custom_column';
208
209 }
210
211 $debug_lists['column_content_actions'][] = sprintf( 'manage_%s_posts_custom_column (manage_{$post->post_type}_posts_custom_column)' , $typenow );
212
213 $debug_lists['bulk_action_filter'] = sprintf( 'bulk_actions-%s (bulk_actions-{$this->screen->id})' , $current_screen->id );
214
215 $debug_lists['bulk_post_updated_messages'] = self::$bulk_post_updated_messages;
216
217 } elseif( in_array( $pagenow , array( 'edit-tags.php' ) ) ) {
218
219 $debug_lists['taxonomy'] = $taxnow;
220 $debug_lists['count'] = wp_count_terms( $taxnow );
221
222 } elseif( in_array( $pagenow , array( 'term.php' ) ) ) {
223
224 $debug_lists['taxonomy'] = $taxnow;
225 $debug_lists['post_type'] = $typenow;
226
227 $term_id = absint( $_REQUEST['tag_ID'] );
228 $deaub_lists['term_id'] = $term_id;
229 $debug_lists['term'] = get_term( $term_id );
230 $debug_lists['custom_meta'] = get_term_meta( $term_id );
231
232 } elseif( in_array( $pagenow , array( 'users.php' ) ) ) {
233
234 $debug_lists['count'] = count_users();
235
236 } elseif( in_array( $pagenow , array( 'user-edit.php' , 'profile.php' ) ) ) {
237
238 $debug_lists['user_id'] = $user_id;
239 $debug_lists['get_userdata()'] = get_userdata( $user_id );
240 $debug_lists['get_user_meta()'] = get_user_meta( $user_id );
241
242 }
243
244 return $debug_lists;
245
246 }
247
248 protected static function mywp_developer_debug() {
249
250 if( ! is_admin() ) {
251
252 return false;
253
254 }
255
256 parent::mywp_developer_debug();
257
258 }
259
260 protected static function mywp_debug_render() {
261
262 if( ! is_admin() ) {
263
264 return false;
265
266 }
267
268 parent::mywp_debug_render();
269
270 }
271
272 }
273
274 MywpDeveloperModuleDevAdmin::init();
275
276 endif;
277