WP Admin UI Customize - Version 1.5.9

Version Description

  • Fixed: Items panel expand on Sidemenus and Admin bar menus.
Download this release

Release Info

Developer gqevu6bsiz
Plugin Icon wp plugin WP Admin UI Customize
Version 1.5.9
Comparing to
See all releases

Code changes from version 1.5.8 to 1.5.9

inc/setting_admin_bar_menu.php CHANGED
@@ -1,354 +1,354 @@
1
- <?php
2
-
3
- $Data = $this->get_data( 'admin_bar_menu' );
4
- $AllDefaultNodes = $this->admin_bar_filter_load();
5
- $Place_types = $this->admin_bar_places();
6
-
7
- // include js css
8
- $ReadedJs = array( 'jquery' , 'jquery-ui-draggable' , 'jquery-ui-droppable' , 'jquery-ui-sortable' , 'thickbox' );
9
- wp_enqueue_script( $this->PageSlug , $this->Url . $this->PluginSlug . '.js', $ReadedJs , $this->Ver );
10
- wp_enqueue_style('thickbox');
11
- wp_enqueue_style( $this->PageSlug , $this->Url . $this->PluginSlug . '.css', array() , $this->Ver );
12
-
13
- ?>
14
-
15
- <div class="wrap">
16
-
17
- <?php echo $this->Msg; ?>
18
- <h2><?php _e( 'Admin Bar Menu' , 'wp-admin-ui-customize' ); ?></h2>
19
- <p><?php _e( 'Please change the menu by drag and drop.' , 'wp-admin-ui-customize' ); ?></p>
20
- <p><strong><?php _e( 'Notice: Please do not place the same multiple menu slug.' , 'wp-admin-ui-customize' ); ?></strong></p>
21
- <p class="description"><?php _e( 'Can be more than one custom menu.' , 'wp-admin-ui-customize' ); ?></p>
22
-
23
- <h3 id="wauc-apply-user-roles"><?php echo $this->get_apply_roles(); ?></h3>
24
-
25
- <p><a href="#TB_inline?height=300&width=600&inlineId=list_variables&modal=false" title="<?php _e( 'Shortcodes' , 'wp-admin-ui-customize' ); ?>" class="thickbox"><?php _e( 'Available Shortcodes' , 'wp-admin-ui-customize' ); ?></a></p>
26
-
27
- <form id="wauc_setting_admin_bar_menu" class="wauc_form" method="post" action="<?php echo esc_url( remove_query_arg( 'wauc_msg' , add_query_arg( array( 'page' => $this->PageSlug ) ) ) ); ?>">
28
- <input type="hidden" name="<?php echo $this->UPFN; ?>" value="Y" />
29
- <?php wp_nonce_field( $this->Nonces["value"] , $this->Nonces["field"] ); ?>
30
- <input type="hidden" name="record_field" value="admin_bar_menu" />
31
-
32
- <p></p>
33
- <p><?php _e( 'Sub-menu settings apply to maximum of four levels deep.' , 'wp-admin-ui-customize' ); ?></p>
34
- <p><a href="<?php $this->get_document_link( 'admin_bar' ); ?>" target="_blank" class="button-secondary"><?php _e( 'Admin bar settings documentation page' , 'wp-admin-ui-customize' ); ?></a></p>
35
-
36
- <div id="poststuff">
37
-
38
- <div id="post-body" class="metabox-holder columns-2">
39
-
40
- <?php foreach( $Place_types as $place => $place_label ) : ?>
41
- <?php if( $place != 'front' ) : ?>
42
-
43
- <?php if( $place == 'left' ) : $box_id = 2; else: $box_id = 1; endif; ?>
44
- <div id="postbox-container-<?php echo $box_id; ?>" class="postbox-container">
45
- <div id="<?php echo $place; ?>_menus">
46
- <div class="postbox">
47
- <div class="handlediv" title="Click to toggle"><br></div>
48
- <h3 class="hndle"><span><?php echo $place_label; ?><?php _e( 'Menus' ); ?></span></h3>
49
- <div class="inside widgets-holder-wrap">
50
-
51
- <?php if( empty( $Data ) ) : ?>
52
- <?php $Nodes = $AllDefaultNodes; ?>
53
- <?php else: ?>
54
- <?php $Nodes = $Data; ?>
55
- <?php endif; ?>
56
-
57
- <?php if( !empty( $Nodes[$place]["main"] ) ) : ?>
58
- <?php foreach( $Nodes[$place]["main"] as $main_node ) : ?>
59
-
60
- <?php if ( is_object( $main_node ) ) $main_node = (array) $main_node; ?>
61
- <?php if ( !isset( $main_node["group"] ) ) $main_node["group"] = ""; ?>
62
- <?php $menu_widget = array( 'id' => $main_node["id"] , 'title' => stripslashes( $main_node["title"] ) , 'parent' => '' , 'href' => $main_node["href"] , 'group' => $main_node["group"] , 'meta' => $main_node["meta"] , 'new' => false ); ?>
63
- <?php $this->admin_bar_menu_widget( $Nodes[$place] , $menu_widget , 'main' ); ?>
64
-
65
- <?php endforeach; ?>
66
- <?php endif; ?>
67
-
68
- </div>
69
- </div>
70
- </div>
71
- </div>
72
-
73
- <?php endif; ?>
74
- <?php endforeach; ?>
75
-
76
- <br class="clear">
77
-
78
- </div>
79
-
80
- </div>
81
-
82
- <p class="submit">
83
- <input type="submit" class="button-primary" name="update" value="<?php _e( 'Save' ); ?>" />
84
- </p>
85
-
86
- <p class="submit reset">
87
- <span class="description"><?php printf( __( 'Reset the %s?' , 'wp-admin-ui-customize' ) , __( 'Admin Bar Menu' , 'wp-admin-ui-customize' ) . __( 'Settings' ) ); ?></span>
88
- <input type="submit" class="button-secondary" name="reset" value="<?php _e( 'Reset settings' , 'wp-admin-ui-customize' ); ?>" />
89
- </p>
90
-
91
- </form>
92
-
93
- <h3><?php _e ( 'Menu items that can be added' , 'wp-admin-ui-customize' ); ?></h3>
94
-
95
- <div id="can_menus" class="metabox-holder columns-1">
96
-
97
- <div class="postbox">
98
- <div class="inside">
99
-
100
- <div class="postbox">
101
- <div class="handlediv" title="Click to toggle"><br></div>
102
- <h3 class="hndle"><span><?php _e( 'Custom' ); ?> <?php _e( 'Menus' ); ?></span></h3>
103
- <div class="inside">
104
-
105
- <?php $menu_widget = array( 'id' => "custom_node" , 'title' => "" , 'parent' => '' , 'href' => "" , 'group' => "" , 'meta' => array() , 'new' => true ); ?>
106
- <?php $this->admin_bar_menu_widget( $AllDefaultNodes["front"] , $menu_widget , 'custom' ); ?>
107
- <?php $menu_widget = array( 'id' => "custom_node" , 'title' => "" , 'parent' => '' , 'href' => "" , 'group' => 1 , 'meta' => array() , 'new' => true ); ?>
108
- <?php $this->admin_bar_menu_widget( $AllDefaultNodes["front"] , $menu_widget , 'custom' ); ?>
109
- <div class="clear"></div>
110
-
111
- </div>
112
- </div>
113
-
114
- <?php foreach( $Place_types as $place => $place_label ) : ?>
115
-
116
- <div class="postbox">
117
- <div class="handlediv" title="Click to toggle"><br></div>
118
- <h3 class="hndle"><span><?php echo $place_label; ?> <?php _e( 'Menus' ); ?></span></h3>
119
- <div class="inside">
120
-
121
- <?php if( !empty( $AllDefaultNodes[$place] ) ) : ?>
122
- <?php foreach( $AllDefaultNodes[$place]["main"] as $main_node_id => $main_node ) : ?>
123
-
124
- <p class="description"><?php echo $main_node_id; ?></p>
125
- <?php $menu_widget = array( 'id' => $main_node_id , 'title' => stripslashes( $main_node->title ) , 'parent' => '' , 'href' => $main_node->href , 'group' => $main_node->group , 'meta' => $main_node->meta , 'new' => true ); ?>
126
- <?php $this->admin_bar_menu_widget( $AllDefaultNodes[$place] , $menu_widget , 'main' ); ?>
127
-
128
- <?php foreach( $AllDefaultNodes[$place]["sub"] as $sub_node_id => $sub_node ) : ?>
129
- <?php if( $sub_node->parent == $main_node_id ) : ?>
130
-
131
- <?php $menu_widget = array( 'id' => $sub_node_id , 'title' => stripslashes( $sub_node->title ) , 'parent' => '' , 'href' => $sub_node->href , 'group' => $sub_node->group , 'meta' => $sub_node->meta , 'new' => true ); ?>
132
- <?php $this->admin_bar_menu_widget( $AllDefaultNodes[$place] , $menu_widget , 'sub' ); ?>
133
-
134
- <?php if( !empty( $AllDefaultNodes[$place]["sub2"] ) ) : ?>
135
- <?php foreach( $AllDefaultNodes[$place]["sub2"] as $sub_node_id2 => $sub_node2 ) : ?>
136
- <?php if( $sub_node2->parent == $sub_node_id ) : ?>
137
-
138
- <?php $menu_widget = array( 'id' => $sub_node_id2 , 'title' => stripslashes( $sub_node2->title ) , 'parent' => '' , 'href' => $sub_node2->href , 'group' => $sub_node2->group , 'meta' => $sub_node2->meta , 'new' => true ); ?>
139
- <?php $this->admin_bar_menu_widget( $AllDefaultNodes[$place] , $menu_widget , 'sub2' ); ?>
140
-
141
- <?php if( !empty( $AllDefaultNodes[$place]["sub3"] ) ) : ?>
142
- <?php foreach( $AllDefaultNodes[$place]["sub3"] as $sub_node_id3 => $sub_node3 ) : ?>
143
- <?php if( $sub_node3->parent == $sub_node_id2 ) : ?>
144
-
145
- <?php $menu_widget = array( 'id' => $sub_node_id3 , 'title' => stripslashes( $sub_node3->title ) , 'parent' => '' , 'href' => $sub_node3->href , 'group' => $sub_node3->group , 'meta' => $sub_node3->meta , 'new' => true ); ?>
146
- <?php $this->admin_bar_menu_widget( $AllDefaultNodes[$place] , $menu_widget , 'sub3' ); ?>
147
-
148
- <?php if( !empty( $AllDefaultNodes[$place]["sub4"] ) ) : ?>
149
- <?php foreach( $AllDefaultNodes[$place]["sub4"] as $sub_node_id4 => $sub_node4 ) : ?>
150
- <?php if( $sub_node4->parent == $sub_node_id3 ) : ?>
151
-
152
- <?php $menu_widget = array( 'id' => $sub_node_id4 , 'title' => stripslashes( $sub_node4->title ) , 'parent' => '' , 'href' => $sub_node4->href , 'group' => $sub_node4->group , 'meta' => $sub_node4->meta , 'new' => true ); ?>
153
- <?php $this->admin_bar_menu_widget( $AllDefaultNodes[$place] , $menu_widget , 'sub4' ); ?>
154
-
155
- <?php endif; ?>
156
- <?php endforeach; ?>
157
- <?php endif; ?>
158
-
159
- <?php endif; ?>
160
- <?php endforeach; ?>
161
- <?php endif; ?>
162
-
163
- <?php endif; ?>
164
- <?php endforeach; ?>
165
- <?php endif; ?>
166
-
167
- <?php endif; ?>
168
- <?php endforeach; ?>
169
-
170
- <div class="clear"></div>
171
-
172
- <?php endforeach; ?>
173
- <?php endif; ?>
174
-
175
- </div>
176
- </div>
177
- <?php endforeach; ?>
178
-
179
- </div>
180
- </div>
181
-
182
- </div>
183
-
184
- </div>
185
-
186
- <?php require_once( dirname( __FILE__ ) . '/list_variables.php' ); ?>
187
-
188
- <style>
189
- body.wp-admin-ui-customize_page_wp_admin_ui_customize_admin_bar .postbox .inside .widget.wp-logo .widget-top .widget-title h4 .ab-icon,
190
- body.wp-admin-ui-customize_page_wp_admin_ui_customize_admin_bar .postbox .inside .widget.updates .widget-top .widget-title h4 .ab-icon,
191
- body.wp-admin-ui-customize_page_wp_admin_ui_customize_admin_bar .postbox .inside .widget.comments .widget-top .widget-title h4 .ab-icon,
192
- body.wp-admin-ui-customize_page_wp_admin_ui_customize_admin_bar .postbox .inside .widget.new-content .widget-top .widget-title h4 .ab-icon
193
- { background-image: url(../wp-includes/images/admin-bar-sprite.png); }
194
- .widget h4 {
195
- padding: 10px 15px;
196
- }
197
- .widget-top a.widget-action {
198
- cursor: pointer;
199
- }
200
- .widget.ui-draggable-dragging {
201
- min-width: 170px;
202
- }
203
- </style>
204
-
205
- <script type="text/javascript">
206
-
207
- var wauc_widget_each, wauc_menu_sortable;
208
-
209
- jQuery(document).ready(function($) {
210
-
211
- var $Form = $("#wauc_setting_admin_bar_menu");
212
- var $AddInside = $('#can_menus .postbox .inside');
213
- var $SettingInside = $('#poststuff #post-body .postbox-container .postbox .inside', $Form);
214
-
215
- $AddInside.children('.widget').draggable({
216
- connectToSortable: '#poststuff #post-body .postbox-container .postbox .inside',
217
- handle: '> .widget-top > .widget-title',
218
- distance: 2,
219
- helper: 'clone',
220
- zIndex: 5,
221
- stop: function(e,ui) {
222
- wauc_widget_each();
223
- wauc_menu_sortable();
224
- }
225
- });
226
-
227
- $('#can_menus').droppable({
228
- tolerance: 'pointer',
229
- accept: function(o){
230
- return $(o).parent().parent().parent().parent().parent().parent().parent().attr('class') != 'columns-1';
231
- },
232
- drop: function(e,ui) {
233
- ui.draggable.addClass('deleting');
234
- },
235
- over: function(e,ui) {
236
- ui.draggable.addClass('deleting');
237
- $('div.widget-placeholder').hide();
238
- },
239
- out: function(e,ui) {
240
- ui.draggable.removeClass('deleting');
241
- $('div.widget-placeholder').show();
242
- }
243
- });
244
-
245
- $(document).on('click', '.widget .widget-top .widget-title-action', function() {
246
-
247
- $(this).parent().parent().children('.widget-inside').slideToggle( 300 );
248
- return false;
249
-
250
- });
251
-
252
- $(document).on('click', '.widget .widget-inside .widget-control-actions .alignleft a[href=#remove]', function() {
253
-
254
- $(this).parent().parent().parent().parent().slideUp('normal', function() { $(this).remove(); } );
255
- return false;
256
-
257
- });
258
-
259
- wauc_menu_sortable = function menu_sortable() {
260
-
261
- $('#wauc_setting_admin_bar_menu #poststuff #post-body .postbox-container .postbox .inside, #wauc_setting_admin_bar_menu #poststuff #post-body .postbox-container .postbox .inside .widget .widget-inside .submenu').sortable({
262
- placeholder: "widget-placeholder",
263
- items: '> .widget',
264
- connectWith: "#wauc_setting_admin_bar_menu #poststuff #post-body .postbox-container .postbox .inside, #wauc_setting_admin_bar_menu #poststuff #post-body .postbox-container .postbox .inside .widget .widget-inside .submenu",
265
- handle: '> .widget-top > .widget-title',
266
- cursor: 'move',
267
- distance: 2,
268
- change: function(e,ui) {
269
- var $height = ui.helper.height();
270
- $('#wauc_setting_admin_bar_menu #poststuff #post-body .postbox-container .postbox .inside .widget-placeholder').height($height);
271
- },
272
- stop: function(e,ui) {
273
- if ( ui.item.hasClass('deleting') ) {
274
- ui.item.remove();
275
- }
276
- ui.item.attr( 'style', '' ).removeClass('ui-draggable');
277
- wauc_widget_each();
278
- },
279
- });
280
-
281
- }
282
- wauc_menu_sortable();
283
-
284
- wauc_widget_each = function widget_each() {
285
- var $Count = 0;
286
- $('.widget', '#wauc_setting_admin_bar_menu #poststuff').each(function() {
287
- var $InputId = $(this).children(".widget-inside").children(".settings").children(".field-url").children(".idtext");
288
- var $InputLink = $(this).children(".widget-inside").children(".settings").children(".field-url").children(".linktext");
289
- var $InputTitle = $(this).children(".widget-inside").children(".settings").children(".field-title").children("label").children(".titletext");
290
- var $InputGourp = $(this).children(".widget-inside").children(".settings").children(".group");
291
- var $InputMetaClass = $(this).children(".widget-inside").children(".settings").children(".field-meta").children(".meta_class");
292
- var $InputMetaTarget = $(this).children(".widget-inside").children(".settings").children(".field-meta").children("label").children(".meta_target");
293
- var $InputParentName = $(this).children(".widget-inside").children(".settings").children(".parent");
294
- var $InputNodeType = $(this).children(".widget-inside").children(".settings").children(".node_type");
295
-
296
- var $BoxName = "";
297
- var $NodeType = "";
298
- if( $(this).parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().hasClass("submenu") ) {
299
- $BoxName = $(this).parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().attr("id");
300
- $NodeType = "sub4";
301
- } else if( $(this).parent().parent().parent().parent().parent().parent().parent().hasClass("submenu") ) {
302
- $BoxName = $(this).parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().attr("id");
303
- $NodeType = "sub3";
304
- } else if( $(this).parent().parent().parent().parent().hasClass("submenu") ) {
305
- $BoxName = $(this).parent().parent().parent().parent().parent().parent().parent().parent().parent().attr("id");
306
- $NodeType = "sub2";
307
- } else if( $(this).parent().hasClass("submenu") ) {
308
- $BoxName = $(this).parent().parent().parent().parent().parent().parent().attr("id");
309
- $NodeType = "sub";
310
- } else {
311
- $BoxName = $(this).parent().parent().parent().attr("id");
312
- $NodeType = "main";
313
- }
314
-
315
- if( $BoxName ) {
316
- var $BarType = $BoxName.replace( '_menus' , '');
317
- }
318
-
319
- if( $(this).hasClass("custom_node") ) {
320
- var $CustomVal = $InputId.val();
321
- $InputId.val( $CustomVal + Math.ceil( Math.random() * 1000 ) );
322
- } else if( $(this).hasClass("newcustom_node") ) {
323
- var $CustomVal = $InputId.val();
324
- var $CustomClassName = $CustomVal + Math.ceil( Math.random() * 1000 );
325
- $InputId.val( $CustomClassName );
326
- $(this).removeClass("newcustom_node");
327
- $(this).addClass( $CustomClassName );
328
- }
329
-
330
- var $Name = 'data' + '[' + $BarType + ']['+$Count+']';
331
- $InputId.attr("name", $Name+'[id]');
332
- $InputLink.attr("name", $Name+'[href]');
333
- $InputTitle.attr("name", $Name+'[title]');
334
- $InputGourp.attr("name", $Name+'[group]');
335
- $InputMetaClass.attr("name", $Name+'[meta][class]');
336
- $InputMetaTarget.attr("name", $Name+'[meta][target]');
337
- $InputParentName.attr("name", $Name+'[parent]');
338
- $InputNodeType.attr("name", $Name+'[node_type]');
339
- $InputNodeType.val( $NodeType );
340
-
341
- if ( $(this).parent().hasClass("submenu") ) {
342
- var $ParentId = $(this).parent().parent().children(".settings").children(".description").children(".idtext").val();
343
- $InputParentName.val($ParentId);
344
- } else {
345
- $InputParentName.val('');
346
- }
347
-
348
- $Count++;
349
- });
350
- }
351
- wauc_widget_each();
352
-
353
- });
354
  </script>
1
+ <?php
2
+
3
+ $Data = $this->get_data( 'admin_bar_menu' );
4
+ $AllDefaultNodes = $this->admin_bar_filter_load();
5
+ $Place_types = $this->admin_bar_places();
6
+
7
+ // include js css
8
+ $ReadedJs = array( 'jquery' , 'jquery-ui-draggable' , 'jquery-ui-droppable' , 'jquery-ui-sortable' , 'thickbox' );
9
+ wp_enqueue_script( $this->PageSlug , $this->Url . $this->PluginSlug . '.js', $ReadedJs , $this->Ver );
10
+ wp_enqueue_style('thickbox');
11
+ wp_enqueue_style( $this->PageSlug , $this->Url . $this->PluginSlug . '.css', array() , $this->Ver );
12
+
13
+ ?>
14
+
15
+ <div class="wrap">
16
+
17
+ <?php echo $this->Msg; ?>
18
+ <h2><?php _e( 'Admin Bar Menu' , 'wp-admin-ui-customize' ); ?></h2>
19
+ <p><?php _e( 'Please change the menu by drag and drop.' , 'wp-admin-ui-customize' ); ?></p>
20
+ <p><strong><?php _e( 'Notice: Please do not place the same multiple menu slug.' , 'wp-admin-ui-customize' ); ?></strong></p>
21
+ <p class="description"><?php _e( 'Can be more than one custom menu.' , 'wp-admin-ui-customize' ); ?></p>
22
+
23
+ <h3 id="wauc-apply-user-roles"><?php echo $this->get_apply_roles(); ?></h3>
24
+
25
+ <p><a href="#TB_inline?height=300&width=600&inlineId=list_variables&modal=false" title="<?php _e( 'Shortcodes' , 'wp-admin-ui-customize' ); ?>" class="thickbox"><?php _e( 'Available Shortcodes' , 'wp-admin-ui-customize' ); ?></a></p>
26
+
27
+ <form id="wauc_setting_admin_bar_menu" class="wauc_form" method="post" action="<?php echo esc_url( remove_query_arg( 'wauc_msg' , add_query_arg( array( 'page' => $this->PageSlug ) ) ) ); ?>">
28
+ <input type="hidden" name="<?php echo $this->UPFN; ?>" value="Y" />
29
+ <?php wp_nonce_field( $this->Nonces["value"] , $this->Nonces["field"] ); ?>
30
+ <input type="hidden" name="record_field" value="admin_bar_menu" />
31
+
32
+ <p></p>
33
+ <p><?php _e( 'Sub-menu settings apply to maximum of four levels deep.' , 'wp-admin-ui-customize' ); ?></p>
34
+ <p><a href="<?php $this->get_document_link( 'admin_bar' ); ?>" target="_blank" class="button-secondary"><?php _e( 'Admin bar settings documentation page' , 'wp-admin-ui-customize' ); ?></a></p>
35
+
36
+ <div id="poststuff">
37
+
38
+ <div id="post-body" class="metabox-holder columns-2">
39
+
40
+ <?php foreach( $Place_types as $place => $place_label ) : ?>
41
+ <?php if( $place != 'front' ) : ?>
42
+
43
+ <?php if( $place == 'left' ) : $box_id = 2; else: $box_id = 1; endif; ?>
44
+ <div id="postbox-container-<?php echo $box_id; ?>" class="postbox-container">
45
+ <div id="<?php echo $place; ?>_menus">
46
+ <div class="postbox">
47
+ <div class="handlediv" title="Click to toggle"><br></div>
48
+ <h3 class="hndle"><span><?php echo $place_label; ?><?php _e( 'Menus' ); ?></span></h3>
49
+ <div class="inside widgets-holder-wrap">
50
+
51
+ <?php if( empty( $Data ) ) : ?>
52
+ <?php $Nodes = $AllDefaultNodes; ?>
53
+ <?php else: ?>
54
+ <?php $Nodes = $Data; ?>
55
+ <?php endif; ?>
56
+
57
+ <?php if( !empty( $Nodes[$place]["main"] ) ) : ?>
58
+ <?php foreach( $Nodes[$place]["main"] as $main_node ) : ?>
59
+
60
+ <?php if ( is_object( $main_node ) ) $main_node = (array) $main_node; ?>
61
+ <?php if ( !isset( $main_node["group"] ) ) $main_node["group"] = ""; ?>
62
+ <?php $menu_widget = array( 'id' => $main_node["id"] , 'title' => stripslashes( $main_node["title"] ) , 'parent' => '' , 'href' => $main_node["href"] , 'group' => $main_node["group"] , 'meta' => $main_node["meta"] , 'new' => false ); ?>
63
+ <?php $this->admin_bar_menu_widget( $Nodes[$place] , $menu_widget , 'main' ); ?>
64
+
65
+ <?php endforeach; ?>
66
+ <?php endif; ?>
67
+
68
+ </div>
69
+ </div>
70
+ </div>
71
+ </div>
72
+
73
+ <?php endif; ?>
74
+ <?php endforeach; ?>
75
+
76
+ <br class="clear">
77
+
78
+ </div>
79
+
80
+ </div>
81
+
82
+ <p class="submit">
83
+ <input type="submit" class="button-primary" name="update" value="<?php _e( 'Save' ); ?>" />
84
+ </p>
85
+
86
+ <p class="submit reset">
87
+ <span class="description"><?php printf( __( 'Reset the %s?' , 'wp-admin-ui-customize' ) , __( 'Admin Bar Menu' , 'wp-admin-ui-customize' ) . __( 'Settings' ) ); ?></span>
88
+ <input type="submit" class="button-secondary" name="reset" value="<?php _e( 'Reset settings' , 'wp-admin-ui-customize' ); ?>" />
89
+ </p>
90
+
91
+ </form>
92
+
93
+ <h3><?php _e ( 'Menu items that can be added' , 'wp-admin-ui-customize' ); ?></h3>
94
+
95
+ <div id="can_menus" class="metabox-holder columns-1">
96
+
97
+ <div class="postbox">
98
+ <div class="inside">
99
+
100
+ <div class="postbox">
101
+ <div class="handlediv" title="Click to toggle"><br></div>
102
+ <h3 class="hndle"><span><?php _e( 'Custom' ); ?> <?php _e( 'Menus' ); ?></span></h3>
103
+ <div class="inside">
104
+
105
+ <?php $menu_widget = array( 'id' => "custom_node" , 'title' => "" , 'parent' => '' , 'href' => "" , 'group' => "" , 'meta' => array() , 'new' => true ); ?>
106
+ <?php $this->admin_bar_menu_widget( $AllDefaultNodes["front"] , $menu_widget , 'custom' ); ?>
107
+ <?php $menu_widget = array( 'id' => "custom_node" , 'title' => "" , 'parent' => '' , 'href' => "" , 'group' => 1 , 'meta' => array() , 'new' => true ); ?>
108
+ <?php $this->admin_bar_menu_widget( $AllDefaultNodes["front"] , $menu_widget , 'custom' ); ?>
109
+ <div class="clear"></div>
110
+
111
+ </div>
112
+ </div>
113
+
114
+ <?php foreach( $Place_types as $place => $place_label ) : ?>
115
+
116
+ <div class="postbox">
117
+ <div class="handlediv" title="Click to toggle"><br></div>
118
+ <h3 class="hndle"><span><?php echo $place_label; ?> <?php _e( 'Menus' ); ?></span></h3>
119
+ <div class="inside">
120
+
121
+ <?php if( !empty( $AllDefaultNodes[$place] ) ) : ?>
122
+ <?php foreach( $AllDefaultNodes[$place]["main"] as $main_node_id => $main_node ) : ?>
123
+
124
+ <p class="description"><?php echo $main_node_id; ?></p>
125
+ <?php $menu_widget = array( 'id' => $main_node_id , 'title' => stripslashes( $main_node->title ) , 'parent' => '' , 'href' => $main_node->href , 'group' => $main_node->group , 'meta' => $main_node->meta , 'new' => true ); ?>
126
+ <?php $this->admin_bar_menu_widget( $AllDefaultNodes[$place] , $menu_widget , 'main' ); ?>
127
+
128
+ <?php foreach( $AllDefaultNodes[$place]["sub"] as $sub_node_id => $sub_node ) : ?>
129
+ <?php if( $sub_node->parent == $main_node_id ) : ?>
130
+
131
+ <?php $menu_widget = array( 'id' => $sub_node_id , 'title' => stripslashes( $sub_node->title ) , 'parent' => '' , 'href' => $sub_node->href , 'group' => $sub_node->group , 'meta' => $sub_node->meta , 'new' => true ); ?>
132
+ <?php $this->admin_bar_menu_widget( $AllDefaultNodes[$place] , $menu_widget , 'sub' ); ?>
133
+
134
+ <?php if( !empty( $AllDefaultNodes[$place]["sub2"] ) ) : ?>
135
+ <?php foreach( $AllDefaultNodes[$place]["sub2"] as $sub_node_id2 => $sub_node2 ) : ?>
136
+ <?php if( $sub_node2->parent == $sub_node_id ) : ?>
137
+
138
+ <?php $menu_widget = array( 'id' => $sub_node_id2 , 'title' => stripslashes( $sub_node2->title ) , 'parent' => '' , 'href' => $sub_node2->href , 'group' => $sub_node2->group , 'meta' => $sub_node2->meta , 'new' => true ); ?>
139
+ <?php $this->admin_bar_menu_widget( $AllDefaultNodes[$place] , $menu_widget , 'sub2' ); ?>
140
+
141
+ <?php if( !empty( $AllDefaultNodes[$place]["sub3"] ) ) : ?>
142
+ <?php foreach( $AllDefaultNodes[$place]["sub3"] as $sub_node_id3 => $sub_node3 ) : ?>
143
+ <?php if( $sub_node3->parent == $sub_node_id2 ) : ?>
144
+
145
+ <?php $menu_widget = array( 'id' => $sub_node_id3 , 'title' => stripslashes( $sub_node3->title ) , 'parent' => '' , 'href' => $sub_node3->href , 'group' => $sub_node3->group , 'meta' => $sub_node3->meta , 'new' => true ); ?>
146
+ <?php $this->admin_bar_menu_widget( $AllDefaultNodes[$place] , $menu_widget , 'sub3' ); ?>
147
+
148
+ <?php if( !empty( $AllDefaultNodes[$place]["sub4"] ) ) : ?>
149
+ <?php foreach( $AllDefaultNodes[$place]["sub4"] as $sub_node_id4 => $sub_node4 ) : ?>
150
+ <?php if( $sub_node4->parent == $sub_node_id3 ) : ?>
151
+
152
+ <?php $menu_widget = array( 'id' => $sub_node_id4 , 'title' => stripslashes( $sub_node4->title ) , 'parent' => '' , 'href' => $sub_node4->href , 'group' => $sub_node4->group , 'meta' => $sub_node4->meta , 'new' => true ); ?>
153
+ <?php $this->admin_bar_menu_widget( $AllDefaultNodes[$place] , $menu_widget , 'sub4' ); ?>
154
+
155
+ <?php endif; ?>
156
+ <?php endforeach; ?>
157
+ <?php endif; ?>
158
+
159
+ <?php endif; ?>
160
+ <?php endforeach; ?>
161
+ <?php endif; ?>
162
+
163
+ <?php endif; ?>
164
+ <?php endforeach; ?>
165
+ <?php endif; ?>
166
+
167
+ <?php endif; ?>
168
+ <?php endforeach; ?>
169
+
170
+ <div class="clear"></div>
171
+
172
+ <?php endforeach; ?>
173
+ <?php endif; ?>
174
+
175
+ </div>
176
+ </div>
177
+ <?php endforeach; ?>
178
+
179
+ </div>
180
+ </div>
181
+
182
+ </div>
183
+
184
+ </div>
185
+
186
+ <?php require_once( dirname( __FILE__ ) . '/list_variables.php' ); ?>
187
+
188
+ <style>
189
+ body.wp-admin-ui-customize_page_wp_admin_ui_customize_admin_bar .postbox .inside .widget.wp-logo .widget-top .widget-title h4 .ab-icon,
190
+ body.wp-admin-ui-customize_page_wp_admin_ui_customize_admin_bar .postbox .inside .widget.updates .widget-top .widget-title h4 .ab-icon,
191
+ body.wp-admin-ui-customize_page_wp_admin_ui_customize_admin_bar .postbox .inside .widget.comments .widget-top .widget-title h4 .ab-icon,
192
+ body.wp-admin-ui-customize_page_wp_admin_ui_customize_admin_bar .postbox .inside .widget.new-content .widget-top .widget-title h4 .ab-icon
193
+ { background-image: url(../wp-includes/images/admin-bar-sprite.png); }
194
+ .widget h4 {
195
+ padding: 10px 15px;
196
+ }
197
+ .widget-top a.widget-action {
198
+ cursor: pointer;
199
+ }
200
+ .widget.ui-draggable-dragging {
201
+ min-width: 170px;
202
+ }
203
+ </style>
204
+
205
+ <script type="text/javascript">
206
+
207
+ var wauc_widget_each, wauc_menu_sortable;
208
+
209
+ jQuery(document).ready(function($) {
210
+
211
+ var $Form = $("#wauc_setting_admin_bar_menu");
212
+ var $AddInside = $('#can_menus .postbox .inside');
213
+ var $SettingInside = $('#poststuff #post-body .postbox-container .postbox .inside', $Form);
214
+
215
+ $AddInside.children('.widget').draggable({
216
+ connectToSortable: '#poststuff #post-body .postbox-container .postbox .inside',
217
+ handle: '> .widget-top > .widget-title',
218
+ distance: 2,
219
+ helper: 'clone',
220
+ zIndex: 5,
221
+ stop: function(e,ui) {
222
+ wauc_widget_each();
223
+ wauc_menu_sortable();
224
+ }
225
+ });
226
+
227
+ $('#can_menus').droppable({
228
+ tolerance: 'pointer',
229
+ accept: function(o){
230
+ return $(o).parent().parent().parent().parent().parent().parent().parent().attr('class') != 'columns-1';
231
+ },
232
+ drop: function(e,ui) {
233
+ ui.draggable.addClass('deleting');
234
+ },
235
+ over: function(e,ui) {
236
+ ui.draggable.addClass('deleting');
237
+ $('div.widget-placeholder').hide();
238
+ },
239
+ out: function(e,ui) {
240
+ ui.draggable.removeClass('deleting');
241
+ $('div.widget-placeholder').show();
242
+ }
243
+ });
244
+
245
+ $(document).on('click', '.widget .widget-top .widget-title-action', function() {
246
+
247
+ $(this).parent().parent().children('.widget-inside').slideToggle( 300 );
248
+ return false;
249
+
250
+ });
251
+
252
+ $(document).on('click', '.widget .widget-inside .widget-control-actions .alignleft a[href="#remove"]', function() {
253
+
254
+ $(this).parent().parent().parent().parent().slideUp('normal', function() { $(this).remove(); } );
255
+ return false;
256
+
257
+ });
258
+
259
+ wauc_menu_sortable = function menu_sortable() {
260
+
261
+ $('#wauc_setting_admin_bar_menu #poststuff #post-body .postbox-container .postbox .inside, #wauc_setting_admin_bar_menu #poststuff #post-body .postbox-container .postbox .inside .widget .widget-inside .submenu').sortable({
262
+ placeholder: "widget-placeholder",
263
+ items: '> .widget',
264
+ connectWith: "#wauc_setting_admin_bar_menu #poststuff #post-body .postbox-container .postbox .inside, #wauc_setting_admin_bar_menu #poststuff #post-body .postbox-container .postbox .inside .widget .widget-inside .submenu",
265
+ handle: '> .widget-top > .widget-title',
266
+ cursor: 'move',
267
+ distance: 2,
268
+ change: function(e,ui) {
269
+ var $height = ui.helper.height();
270
+ $('#wauc_setting_admin_bar_menu #poststuff #post-body .postbox-container .postbox .inside .widget-placeholder').height($height);
271
+ },
272
+ stop: function(e,ui) {
273
+ if ( ui.item.hasClass('deleting') ) {
274
+ ui.item.remove();
275
+ }
276
+ ui.item.attr( 'style', '' ).removeClass('ui-draggable');
277
+ wauc_widget_each();
278
+ },
279
+ });
280
+
281
+ }
282
+ wauc_menu_sortable();
283
+
284
+ wauc_widget_each = function widget_each() {
285
+ var $Count = 0;
286
+ $('.widget', '#wauc_setting_admin_bar_menu #poststuff').each(function() {
287
+ var $InputId = $(this).children(".widget-inside").children(".settings").children(".field-url").children(".idtext");
288
+ var $InputLink = $(this).children(".widget-inside").children(".settings").children(".field-url").children(".linktext");
289
+ var $InputTitle = $(this).children(".widget-inside").children(".settings").children(".field-title").children("label").children(".titletext");
290
+ var $InputGourp = $(this).children(".widget-inside").children(".settings").children(".group");
291
+ var $InputMetaClass = $(this).children(".widget-inside").children(".settings").children(".field-meta").children(".meta_class");
292
+ var $InputMetaTarget = $(this).children(".widget-inside").children(".settings").children(".field-meta").children("label").children(".meta_target");
293
+ var $InputParentName = $(this).children(".widget-inside").children(".settings").children(".parent");
294
+ var $InputNodeType = $(this).children(".widget-inside").children(".settings").children(".node_type");
295
+
296
+ var $BoxName = "";
297
+ var $NodeType = "";
298
+ if( $(this).parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().hasClass("submenu") ) {
299
+ $BoxName = $(this).parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().attr("id");
300
+ $NodeType = "sub4";
301
+ } else if( $(this).parent().parent().parent().parent().parent().parent().parent().hasClass("submenu") ) {
302
+ $BoxName = $(this).parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().attr("id");
303
+ $NodeType = "sub3";
304
+ } else if( $(this).parent().parent().parent().parent().hasClass("submenu") ) {
305
+ $BoxName = $(this).parent().parent().parent().parent().parent().parent().parent().parent().parent().attr("id");
306
+ $NodeType = "sub2";
307
+ } else if( $(this).parent().hasClass("submenu") ) {
308
+ $BoxName = $(this).parent().parent().parent().parent().parent().parent().attr("id");
309
+ $NodeType = "sub";
310
+ } else {
311
+ $BoxName = $(this).parent().parent().parent().attr("id");
312
+ $NodeType = "main";
313
+ }
314
+
315
+ if( $BoxName ) {
316
+ var $BarType = $BoxName.replace( '_menus' , '');
317
+ }
318
+
319
+ if( $(this).hasClass("custom_node") ) {
320
+ var $CustomVal = $InputId.val();
321
+ $InputId.val( $CustomVal + Math.ceil( Math.random() * 1000 ) );
322
+ } else if( $(this).hasClass("newcustom_node") ) {
323
+ var $CustomVal = $InputId.val();
324
+ var $CustomClassName = $CustomVal + Math.ceil( Math.random() * 1000 );
325
+ $InputId.val( $CustomClassName );
326
+ $(this).removeClass("newcustom_node");
327
+ $(this).addClass( $CustomClassName );
328
+ }
329
+
330
+ var $Name = 'data' + '[' + $BarType + ']['+$Count+']';
331
+ $InputId.attr("name", $Name+'[id]');
332
+ $InputLink.attr("name", $Name+'[href]');
333
+ $InputTitle.attr("name", $Name+'[title]');
334
+ $InputGourp.attr("name", $Name+'[group]');
335
+ $InputMetaClass.attr("name", $Name+'[meta][class]');
336
+ $InputMetaTarget.attr("name", $Name+'[meta][target]');
337
+ $InputParentName.attr("name", $Name+'[parent]');
338
+ $InputNodeType.attr("name", $Name+'[node_type]');
339
+ $InputNodeType.val( $NodeType );
340
+
341
+ if ( $(this).parent().hasClass("submenu") ) {
342
+ var $ParentId = $(this).parent().parent().children(".settings").children(".description").children(".idtext").val();
343
+ $InputParentName.val($ParentId);
344
+ } else {
345
+ $InputParentName.val('');
346
+ }
347
+
348
+ $Count++;
349
+ });
350
+ }
351
+ wauc_widget_each();
352
+
353
+ });
354
  </script>
inc/setting_default.php CHANGED
@@ -1,200 +1,200 @@
1
- <?php
2
-
3
- $Data = $this->get_data( 'user_role' );
4
- $UserRoles = $this->get_user_role();
5
-
6
- // include js css
7
- $ReadedJs = array( 'jquery' , 'jquery-ui-sortable' );
8
- wp_enqueue_script( $this->PageSlug , $this->Url . $this->PluginSlug . '.js', $ReadedJs , $this->Ver );
9
- wp_enqueue_style( $this->PageSlug , $this->Url . $this->PluginSlug . '.css', array() , $this->Ver );
10
-
11
- ?>
12
- <div class="wrap">
13
-
14
- <?php echo $this->Msg; ?>
15
- <h2><?php echo $this->Name; ?></h2>
16
- <p><?php _e( 'Customize the UI of the management screen for all users.' , 'wp-admin-ui-customize' ); ?></p>
17
- <p><?php _e ( 'Please select the user roles that all settings will apply to.' , 'wp-admin-ui-customize' ); ?></p>
18
- <p>
19
- <span class="description"><?php _e( 'Please use the Multiple Add-on if you want per role customization.' , 'wp-admin-ui-customize' ); ?></span>
20
- <strong><a href="<?php echo $this->Site; ?>multiple_about/?utm_source=use_plugin&utm_medium=side&utm_content=<?php echo $this->ltd; ?>&utm_campaign=<?php echo str_replace( '.' , '_' , $this->Ver ); ?>" target="_blank">WP Admin UI Customize Multiple Add-on</a></strong>
21
- </p>
22
-
23
- <div id="poststuff">
24
- <div id="post-body" class="metabox-holder columns-2">
25
-
26
- <div id="postbox-container-1" class="postbox-container">
27
-
28
- <div id="about_plugin">
29
-
30
- <div class="stuffbox" id="donationbox">
31
- <div class="inside">
32
- <p style="color: #FFFFFF; font-size: 20px;"><?php _e( 'Donate' , 'wp-admin-ui-customize' ); ?></p>
33
- <p style="color: #FFFFFF;"><?php _e( 'Are you happy with this plugin?<br />Japanese law prohibits PayPal donations. <br />Please consider purchasing the Line Break First and End plugin in lieu of a donation.' , 'wp-admin-ui-customize' ); ?></p>
34
- <p>&nbsp;</p>
35
- <p style="text-align: center;">
36
- <a href="<?php echo $this->AuthorUrl; ?>line-break-first-and-end/?utm_source=use_plugin&utm_medium=donate&utm_content=<?php echo $this->ltd; ?>&utm_campaign=<?php echo str_replace( '.' , '_' , $this->Ver ); ?>" class="button-primary" target="_blank">Line Break First and End</a>
37
- </p>
38
- <p>&nbsp;</p>
39
- <div class="donation_memo">
40
- <p><strong><?php _e( 'Features' , 'wp-admin-ui-customize' ); ?></strong></p>
41
- <p><?php _e( 'Line Break First and End plugin allows for line breaks when using the visual editor TinyMCE.' , 'wp-admin-ui-customize' ); ?></p>
42
- </div>
43
- <div class="donation_memo">
44
- <p><strong><?php _e( 'The primary use of donations' , 'wp-admin-ui-customize' ); ?></strong></p>
45
- <ul>
46
- <li>- <?php _e( 'Liquidation of time and value' , 'wp-admin-ui-customize' ); ?></li>
47
- <li>- <?php _e( 'Additional suggestions feature' , 'wp-admin-ui-customize' ); ?></li>
48
- <li>- <?php _e( 'Maintain motivation' , 'wp-admin-ui-customize' ); ?></li>
49
- <li>- <?php _e( 'Ensure time as the father of Sunday' , 'wp-admin-ui-customize' ); ?></li>
50
- </ul>
51
- </div>
52
- </div>
53
- </div>
54
-
55
- <div class="stuffbox" id="aboutbox">
56
- <h3><span class="hndle"><?php _e( 'About plugin' , 'wp-admin-ui-customize' ); ?></span></h3>
57
- <div class="inside">
58
- <p><?php _e( 'Version checked' , 'wp-admin-ui-customize' ); ?> : 3.8 - 4.4</p>
59
- <ul>
60
- <li><a href="<?php echo $this->Site; ?>?utm_source=use_plugin&utm_medium=side&utm_content=<?php echo $this->ltd; ?>&utm_campaign=<?php echo str_replace( '.' , '_' , $this->Ver ); ?>" target="_blank"><?php _e( 'Plugin\'s site' , 'wp-admin-ui-customize' ); ?></a></li>
61
- <li><a href="<?php echo $this->AuthorUrl; ?>?utm_source=use_plugin&utm_medium=side&utm_content=<?php echo $this->ltd; ?>&utm_campaign=<?php echo str_replace( '.' , '_' , $this->Ver ); ?>" target="_blank"><?php _e( 'Developer\'s site' , 'wp-admin-ui-customize' ); ?></a></li>
62
- <li><a href="http://wordpress.org/support/plugin/<?php echo $this->PluginSlug; ?>" target="_blank"><?php _e( 'Support Forums' ); ?></a></li>
63
- <li><a href="http://wordpress.org/support/view/plugin-reviews/<?php echo $this->PluginSlug; ?>" target="_blank"><?php _e( 'Reviews' , 'wp-admin-ui-customize' ); ?></a></li>
64
- <li><a href="https://twitter.com/gqevu6bsiz" target="_blank">twitter</a></li>
65
- <li><a href="http://www.facebook.com/pages/Gqevu6bsiz/499584376749601" target="_blank">facebook</a></li>
66
- </ul>
67
- </div>
68
- </div>
69
-
70
- <div class="stuffbox" id="usefulbox">
71
- <h3><span class="hndle"><?php _e( 'Useful plugins' , 'wp-admin-ui-customize' ); ?></span></h3>
72
- <div class="inside">
73
- <p><strong><span style="color: orange;">new</span> <a href="<?php echo $this->Site; ?>multiple_about/?utm_source=use_plugin&utm_medium=side&utm_content=<?php echo $this->ltd; ?>&utm_campaign=<?php echo str_replace( '.' , '_' , $this->Ver ); ?>" target="_blank">WP Admin UI Customize Multiple Add-on</a></strong></p>
74
- <p class="description"><?php _e( 'Apply setting on a per-role basis.' , 'wp-admin-ui-customize' ); ?></p>
75
- <p><strong><a href="<?php echo $this->Site; ?>import_export_about/?utm_source=use_plugin&utm_medium=side&utm_content=<?php echo $this->ltd; ?>&utm_campaign=<?php echo str_replace( '.' , '_' , $this->Ver ); ?>" target="_blank">WP Admin UI Customize Import &amp; Export Add-on</a></strong></p>
76
- <p class="description"><?php _e( 'Easily import/export setting between installations.' , 'wp-admin-ui-customize' ); ?></p>
77
- <p><strong><a href="<?php echo $this->Site; ?>multisite_about/?utm_source=use_plugin&utm_medium=side&utm_content=<?php echo $this->ltd; ?>&utm_campaign=<?php echo str_replace( '.' , '_' , $this->Ver ); ?>" target="_blank">WP Admin UI Customize for Multisite</a></strong></p>
78
- <p class="description"><?php _e( 'Unified custom management screens for Multisite.' , 'wp-admin-ui-customize' ); ?></p>
79
- <p><strong><a href="http://wordpress.org/extend/plugins/post-lists-view-custom/" target="_blank">Post Lists View Custom</a></strong></p>
80
- <p class="description"><?php _e( 'Customize list view columns for posts, pages, custom post types, media library, and other management screens.' , 'wp-admin-ui-customize' ); ?></p>
81
- <p><strong><a href="http://wordpress.org/extend/plugins/announce-from-the-dashboard/" target="_blank">Announce from the Dashboard</a></strong></p>
82
- <p class="description"><?php _e( 'Create dashboard messages to be displayed for selected user roles.' , 'wp-admin-ui-customize' ); ?></p>
83
- <p><strong><a href="http://wordpress.org/extend/plugins/custom-options-plus-post-in/" target="_blank">Custom Options Plus Post in</a></strong></p>
84
- <p class="description"><?php _e( 'Create custom global variables that can be used with generated template tags or shortcodes.' , 'wp-admin-ui-customize' ); ?></p>
85
- <p>&nbsp;</p>
86
- </div>
87
- </div>
88
-
89
- </div>
90
-
91
- </div>
92
-
93
- <div id="postbox-container-2" class="postbox-container">
94
-
95
- <div id="user_role">
96
-
97
- <form id="wauc_setting_default" class="wauc_form" method="post" action="<?php echo esc_url( remove_query_arg( 'wauc_msg' , add_query_arg( array( 'page' => $this->PageSlug ) ) ) ); ?>">
98
- <input type="hidden" name="<?php echo $this->UPFN; ?>" value="Y" />
99
- <?php wp_nonce_field( $this->Nonces["value"] , $this->Nonces["field"] ); ?>
100
- <input type="hidden" name="record_field" value="user_role" />
101
-
102
- <div class="postbox">
103
- <h3 class="hndle"><span><?php _e( 'User Roles' ); ?></span></h3>
104
- <div class="inside">
105
- <?php $field = 'user_role'; ?>
106
- <?php foreach($UserRoles as $role_name => $val) : ?>
107
- <?php $Checked = ''; ?>
108
- <?php if( !empty( $Data[$role_name] ) ) : $Checked = 'checked="checked"'; endif; ?>
109
- <p>
110
- <label>
111
- <input type="checkbox" name="data[<?php echo $field; ?>][<?php echo $role_name; ?>]" value="1" <?php echo $Checked; ?> />
112
- <?php echo $val["label"]; ?>
113
- </label>
114
- </p>
115
- <?php endforeach; ?>
116
- </div>
117
- </div>
118
-
119
- <p class="submit">
120
- <input type="submit" class="button-primary" name="update" value="<?php _e( 'Save' ); ?>" />
121
- </p>
122
-
123
- <p class="submit reset">
124
- <span class="description"><?php printf( __( 'Reset the %s?' , 'wp-admin-ui-customize' ) , __( 'User Roles Settings' , 'wp-admin-ui-customize' ) ); ?></span>
125
- <input type="submit" class="button-secondary" name="reset" value="<?php _e( 'Reset settings' , 'wp-admin-ui-customize' ); ?>" />
126
- </p>
127
-
128
- <p>&nbsp;</p>
129
-
130
- </form>
131
-
132
- <form id="donation_form" class="wauc_form" method="post" action="<?php echo esc_url( remove_query_arg( 'wauc_msg' , add_query_arg( array( 'page' => $this->PageSlug ) ) ) ); ?>">
133
- <h3><?php _e( 'If you have already donated to.' , 'wp-admin-ui-customize' ); ?></h3>
134
- <p><?php _e( 'Please enter the \'Donation Delete Key\' that was provided on the Line Break First and End download page.' , 'wp-admin-ui-customize' ); ?></p>
135
- <input type="hidden" name="<?php echo $this->UPFN; ?>" value="Y" />
136
- <?php wp_nonce_field( $this->Nonces["value"] , $this->Nonces["field"] ); ?>
137
- <label for="donate_key"><?php _e( 'Donation Delete Key:' , 'wp-admin-ui-customize' ); ?></label>
138
- <input type="text" name="donate_key" id="donate_key" value="" class="regular-text" />
139
- <input type="submit" class="button-primary" name="update" value="<?php _e( 'Submit' ); ?>" />
140
- </form>
141
-
142
- <p>&nbsp;</p>
143
-
144
- <div class="stuffbox" style="border-color: #FFC426; border-width: 3px;">
145
- <h3 style="background: #FFF2D0; border-color: #FFC426;"><span class="hndle"><?php _e( 'Do you need professional setup and customization?' , 'wp-admin-ui-customize' ); ?></span></h3>
146
- <div class="inside">
147
- <p style="float: right;">
148
- <img src="<?php echo $this->Schema; ?>www.gravatar.com/avatar/7e05137c5a859aa987a809190b979ed4?s=46" width="46" /><br />
149
- <a href="<?php echo $this->AuthorUrl; ?>contact-us/?utm_source=use_plugin&utm_medium=side&utm_content=<?php echo $this->ltd; ?>&utm_campaign=<?php echo str_replace( '.' , '_' , $this->Ver ); ?>" target="_blank">gqevu6bsiz</a>
150
- </p>
151
- <p><?php _e( 'I provide full service customization for WP Admin UI Customize.' , 'wp-admin-ui-customize' ); ?></p>
152
- <p><?php _e( 'Please contact me if you are interested.' , 'wp-admin-ui-customize' ); ?></p>
153
- <p>
154
- <a href="<?php echo $this->Site; ?>blog/category/example/?utm_source=use_plugin&utm_medium=side&utm_content=<?php echo $this->ltd; ?>&utm_campaign=<?php echo str_replace( '.' , '_' , $this->Ver ); ?>" target="_blank"><?php _e ( 'Example Customize' , 'wp-admin-ui-customize' ); ?></a> :
155
- <a href="<?php echo $this->Site; ?>contact/?utm_source=use_plugin&utm_medium=side&utm_content=<?php echo $this->ltd; ?>&utm_campaign=<?php echo str_replace( '.' , '_' , $this->Ver ); ?>" target="_blank"><?php _e( 'Contact me' , 'wp-admin-ui-customize' ); ?></a></p>
156
- </div>
157
- </div>
158
-
159
- </div>
160
-
161
- </div>
162
-
163
- <br class="clear">
164
-
165
- </div>
166
-
167
- </div>
168
-
169
- </div>
170
-
171
- <style>
172
- #donationbox {
173
- background: #87BCE4;
174
- border: 3px solid #227499;
175
- }
176
- #donationbox .inside {
177
- padding: 6px 10px 10px 10px;
178
- }
179
- #donationbox .inside .donation_memo {
180
- background: #FFF8D9;
181
- padding: 2px 10px;
182
- }
183
- </style>
184
- <script type="text/javascript">
185
- jQuery(document).ready(function($) {
186
-
187
- var $RDonated = '<?php echo get_option( $this->Record["donate"] ); ?>';
188
- var $TDonated = '<?php echo $this->DonateKey; ?>';
189
-
190
- if( $RDonated == $TDonated ) {
191
- $("#donationbox").hide();
192
- if( $TDonated != "" ) {
193
- $("#donation_form").html( '<p>&nbsp;</p><p>&nbsp;</p><span class="description"><?php _e( 'Thank you for your donation.' , 'wp-admin-ui-customize' ); ?></span>' );
194
- } else {
195
- $("#donation_form").html( '' );
196
- }
197
- }
198
-
199
- });
200
- </script>
1
+ <?php
2
+
3
+ $Data = $this->get_data( 'user_role' );
4
+ $UserRoles = $this->get_user_role();
5
+
6
+ // include js css
7
+ $ReadedJs = array( 'jquery' , 'jquery-ui-sortable' );
8
+ wp_enqueue_script( $this->PageSlug , $this->Url . $this->PluginSlug . '.js', $ReadedJs , $this->Ver );
9
+ wp_enqueue_style( $this->PageSlug , $this->Url . $this->PluginSlug . '.css', array() , $this->Ver );
10
+
11
+ ?>
12
+ <div class="wrap">
13
+
14
+ <?php echo $this->Msg; ?>
15
+ <h2><?php echo $this->Name; ?></h2>
16
+ <p><?php _e( 'Customize the UI of the management screen for all users.' , 'wp-admin-ui-customize' ); ?></p>
17
+ <p><?php _e ( 'Please select the user roles that all settings will apply to.' , 'wp-admin-ui-customize' ); ?></p>
18
+ <p>
19
+ <span class="description"><?php _e( 'Please use the Multiple Add-on if you want per role customization.' , 'wp-admin-ui-customize' ); ?></span>
20
+ <strong><a href="<?php echo $this->Site; ?>multiple_about/?utm_source=use_plugin&utm_medium=side&utm_content=<?php echo $this->ltd; ?>&utm_campaign=<?php echo str_replace( '.' , '_' , $this->Ver ); ?>" target="_blank">WP Admin UI Customize Multiple Add-on</a></strong>
21
+ </p>
22
+
23
+ <div id="poststuff">
24
+ <div id="post-body" class="metabox-holder columns-2">
25
+
26
+ <div id="postbox-container-1" class="postbox-container">
27
+
28
+ <div id="about_plugin">
29
+
30
+ <div class="stuffbox" id="donationbox">
31
+ <div class="inside">
32
+ <p style="color: #FFFFFF; font-size: 20px;"><?php _e( 'Donate' , 'wp-admin-ui-customize' ); ?></p>
33
+ <p style="color: #FFFFFF;"><?php _e( 'Are you happy with this plugin?<br />Japanese law prohibits PayPal donations. <br />Please consider purchasing the Line Break First and End plugin in lieu of a donation.' , 'wp-admin-ui-customize' ); ?></p>
34
+ <p>&nbsp;</p>
35
+ <p style="text-align: center;">
36
+ <a href="<?php echo $this->AuthorUrl; ?>line-break-first-and-end/?utm_source=use_plugin&utm_medium=donate&utm_content=<?php echo $this->ltd; ?>&utm_campaign=<?php echo str_replace( '.' , '_' , $this->Ver ); ?>" class="button-primary" target="_blank">Line Break First and End</a>
37
+ </p>
38
+ <p>&nbsp;</p>
39
+ <div class="donation_memo">
40
+ <p><strong><?php _e( 'Features' , 'wp-admin-ui-customize' ); ?></strong></p>
41
+ <p><?php _e( 'Line Break First and End plugin allows for line breaks when using the visual editor TinyMCE.' , 'wp-admin-ui-customize' ); ?></p>
42
+ </div>
43
+ <div class="donation_memo">
44
+ <p><strong><?php _e( 'The primary use of donations' , 'wp-admin-ui-customize' ); ?></strong></p>
45
+ <ul>
46
+ <li>- <?php _e( 'Liquidation of time and value' , 'wp-admin-ui-customize' ); ?></li>
47
+ <li>- <?php _e( 'Additional suggestions feature' , 'wp-admin-ui-customize' ); ?></li>
48
+ <li>- <?php _e( 'Maintain motivation' , 'wp-admin-ui-customize' ); ?></li>
49
+ <li>- <?php _e( 'Ensure time as the father of Sunday' , 'wp-admin-ui-customize' ); ?></li>
50
+ </ul>
51
+ </div>
52
+ </div>
53
+ </div>
54
+
55
+ <div class="stuffbox" id="aboutbox">
56
+ <h3><span class="hndle"><?php _e( 'About plugin' , 'wp-admin-ui-customize' ); ?></span></h3>
57
+ <div class="inside">
58
+ <p><?php _e( 'Version checked' , 'wp-admin-ui-customize' ); ?> : 3.8 - 4.5</p>
59
+ <ul>
60
+ <li><a href="<?php echo $this->Site; ?>?utm_source=use_plugin&utm_medium=side&utm_content=<?php echo $this->ltd; ?>&utm_campaign=<?php echo str_replace( '.' , '_' , $this->Ver ); ?>" target="_blank"><?php _e( 'Plugin\'s site' , 'wp-admin-ui-customize' ); ?></a></li>
61
+ <li><a href="<?php echo $this->AuthorUrl; ?>?utm_source=use_plugin&utm_medium=side&utm_content=<?php echo $this->ltd; ?>&utm_campaign=<?php echo str_replace( '.' , '_' , $this->Ver ); ?>" target="_blank"><?php _e( 'Developer\'s site' , 'wp-admin-ui-customize' ); ?></a></li>
62
+ <li><a href="http://wordpress.org/support/plugin/<?php echo $this->PluginSlug; ?>" target="_blank"><?php _e( 'Support Forums' ); ?></a></li>
63
+ <li><a href="http://wordpress.org/support/view/plugin-reviews/<?php echo $this->PluginSlug; ?>" target="_blank"><?php _e( 'Reviews' , 'wp-admin-ui-customize' ); ?></a></li>
64
+ <li><a href="https://twitter.com/gqevu6bsiz" target="_blank">twitter</a></li>
65
+ <li><a href="http://www.facebook.com/pages/Gqevu6bsiz/499584376749601" target="_blank">facebook</a></li>
66
+ </ul>
67
+ </div>
68
+ </div>
69
+
70
+ <div class="stuffbox" id="usefulbox">
71
+ <h3><span class="hndle"><?php _e( 'Useful plugins' , 'wp-admin-ui-customize' ); ?></span></h3>
72
+ <div class="inside">
73
+ <p><strong><span style="color: orange;">new</span> <a href="<?php echo $this->Site; ?>multiple_about/?utm_source=use_plugin&utm_medium=side&utm_content=<?php echo $this->ltd; ?>&utm_campaign=<?php echo str_replace( '.' , '_' , $this->Ver ); ?>" target="_blank">WP Admin UI Customize Multiple Add-on</a></strong></p>
74
+ <p class="description"><?php _e( 'Apply setting on a per-role basis.' , 'wp-admin-ui-customize' ); ?></p>
75
+ <p><strong><a href="<?php echo $this->Site; ?>import_export_about/?utm_source=use_plugin&utm_medium=side&utm_content=<?php echo $this->ltd; ?>&utm_campaign=<?php echo str_replace( '.' , '_' , $this->Ver ); ?>" target="_blank">WP Admin UI Customize Import &amp; Export Add-on</a></strong></p>
76
+ <p class="description"><?php _e( 'Easily import/export setting between installations.' , 'wp-admin-ui-customize' ); ?></p>
77
+ <p><strong><a href="<?php echo $this->Site; ?>multisite_about/?utm_source=use_plugin&utm_medium=side&utm_content=<?php echo $this->ltd; ?>&utm_campaign=<?php echo str_replace( '.' , '_' , $this->Ver ); ?>" target="_blank">WP Admin UI Customize for Multisite</a></strong></p>
78
+ <p class="description"><?php _e( 'Unified custom management screens for Multisite.' , 'wp-admin-ui-customize' ); ?></p>
79
+ <p><strong><a href="http://wordpress.org/extend/plugins/post-lists-view-custom/" target="_blank">Post Lists View Custom</a></strong></p>
80
+ <p class="description"><?php _e( 'Customize list view columns for posts, pages, custom post types, media library, and other management screens.' , 'wp-admin-ui-customize' ); ?></p>
81
+ <p><strong><a href="http://wordpress.org/extend/plugins/announce-from-the-dashboard/" target="_blank">Announce from the Dashboard</a></strong></p>
82
+ <p class="description"><?php _e( 'Create dashboard messages to be displayed for selected user roles.' , 'wp-admin-ui-customize' ); ?></p>
83
+ <p><strong><a href="http://wordpress.org/extend/plugins/custom-options-plus-post-in/" target="_blank">Custom Options Plus Post in</a></strong></p>
84
+ <p class="description"><?php _e( 'Create custom global variables that can be used with generated template tags or shortcodes.' , 'wp-admin-ui-customize' ); ?></p>
85
+ <p>&nbsp;</p>
86
+ </div>
87
+ </div>
88
+
89
+ </div>
90
+
91
+ </div>
92
+
93
+ <div id="postbox-container-2" class="postbox-container">
94
+
95
+ <div id="user_role">
96
+
97
+ <form id="wauc_setting_default" class="wauc_form" method="post" action="<?php echo esc_url( remove_query_arg( 'wauc_msg' , add_query_arg( array( 'page' => $this->PageSlug ) ) ) ); ?>">
98
+ <input type="hidden" name="<?php echo $this->UPFN; ?>" value="Y" />
99
+ <?php wp_nonce_field( $this->Nonces["value"] , $this->Nonces["field"] ); ?>
100
+ <input type="hidden" name="record_field" value="user_role" />
101
+
102
+ <div class="postbox">
103
+ <h3 class="hndle"><span><?php _e( 'User Roles' ); ?></span></h3>
104
+ <div class="inside">
105
+ <?php $field = 'user_role'; ?>
106
+ <?php foreach($UserRoles as $role_name => $val) : ?>
107
+ <?php $Checked = ''; ?>
108
+ <?php if( !empty( $Data[$role_name] ) ) : $Checked = 'checked="checked"'; endif; ?>
109
+ <p>
110
+ <label>
111
+ <input type="checkbox" name="data[<?php echo $field; ?>][<?php echo $role_name; ?>]" value="1" <?php echo $Checked; ?> />
112
+ <?php echo $val["label"]; ?>
113
+ </label>
114
+ </p>
115
+ <?php endforeach; ?>
116
+ </div>
117
+ </div>
118
+
119
+ <p class="submit">
120
+ <input type="submit" class="button-primary" name="update" value="<?php _e( 'Save' ); ?>" />
121
+ </p>
122
+
123
+ <p class="submit reset">
124
+ <span class="description"><?php printf( __( 'Reset the %s?' , 'wp-admin-ui-customize' ) , __( 'User Roles Settings' , 'wp-admin-ui-customize' ) ); ?></span>
125
+ <input type="submit" class="button-secondary" name="reset" value="<?php _e( 'Reset settings' , 'wp-admin-ui-customize' ); ?>" />
126
+ </p>
127
+
128
+ <p>&nbsp;</p>
129
+
130
+ </form>
131
+
132
+ <form id="donation_form" class="wauc_form" method="post" action="<?php echo esc_url( remove_query_arg( 'wauc_msg' , add_query_arg( array( 'page' => $this->PageSlug ) ) ) ); ?>">
133
+ <h3><?php _e( 'If you have already donated to.' , 'wp-admin-ui-customize' ); ?></h3>
134
+ <p><?php _e( 'Please enter the \'Donation Delete Key\' that was provided on the Line Break First and End download page.' , 'wp-admin-ui-customize' ); ?></p>
135
+ <input type="hidden" name="<?php echo $this->UPFN; ?>" value="Y" />
136
+ <?php wp_nonce_field( $this->Nonces["value"] , $this->Nonces["field"] ); ?>
137
+ <label for="donate_key"><?php _e( 'Donation Delete Key:' , 'wp-admin-ui-customize' ); ?></label>
138
+ <input type="text" name="donate_key" id="donate_key" value="" class="regular-text" />
139
+ <input type="submit" class="button-primary" name="update" value="<?php _e( 'Submit' ); ?>" />
140
+ </form>
141
+
142
+ <p>&nbsp;</p>
143
+
144
+ <div class="stuffbox" style="border-color: #FFC426; border-width: 3px;">
145
+ <h3 style="background: #FFF2D0; border-color: #FFC426;"><span class="hndle"><?php _e( 'Do you need professional setup and customization?' , 'wp-admin-ui-customize' ); ?></span></h3>
146
+ <div class="inside">
147
+ <p style="float: right;">
148
+ <img src="<?php echo $this->Schema; ?>www.gravatar.com/avatar/7e05137c5a859aa987a809190b979ed4?s=46" width="46" /><br />
149
+ <a href="<?php echo $this->AuthorUrl; ?>contact-us/?utm_source=use_plugin&utm_medium=side&utm_content=<?php echo $this->ltd; ?>&utm_campaign=<?php echo str_replace( '.' , '_' , $this->Ver ); ?>" target="_blank">gqevu6bsiz</a>
150
+ </p>
151
+ <p><?php _e( 'I provide full service customization for WP Admin UI Customize.' , 'wp-admin-ui-customize' ); ?></p>
152
+ <p><?php _e( 'Please contact me if you are interested.' , 'wp-admin-ui-customize' ); ?></p>
153
+ <p>
154
+ <a href="<?php echo $this->Site; ?>blog/category/example/?utm_source=use_plugin&utm_medium=side&utm_content=<?php echo $this->ltd; ?>&utm_campaign=<?php echo str_replace( '.' , '_' , $this->Ver ); ?>" target="_blank"><?php _e ( 'Example Customize' , 'wp-admin-ui-customize' ); ?></a> :
155
+ <a href="<?php echo $this->Site; ?>contact/?utm_source=use_plugin&utm_medium=side&utm_content=<?php echo $this->ltd; ?>&utm_campaign=<?php echo str_replace( '.' , '_' , $this->Ver ); ?>" target="_blank"><?php _e( 'Contact me' , 'wp-admin-ui-customize' ); ?></a></p>
156
+ </div>
157
+ </div>
158
+
159
+ </div>
160
+
161
+ </div>
162
+
163
+ <br class="clear">
164
+
165
+ </div>
166
+
167
+ </div>
168
+
169
+ </div>
170
+
171
+ <style>
172
+ #donationbox {
173
+ background: #87BCE4;
174
+ border: 3px solid #227499;
175
+ }
176
+ #donationbox .inside {
177
+ padding: 6px 10px 10px 10px;
178
+ }
179
+ #donationbox .inside .donation_memo {
180
+ background: #FFF8D9;
181
+ padding: 2px 10px;
182
+ }
183
+ </style>
184
+ <script type="text/javascript">
185
+ jQuery(document).ready(function($) {
186
+
187
+ var $RDonated = '<?php echo get_option( $this->Record["donate"] ); ?>';
188
+ var $TDonated = '<?php echo $this->DonateKey; ?>';
189
+
190
+ if( $RDonated == $TDonated ) {
191
+ $("#donationbox").hide();
192
+ if( $TDonated != "" ) {
193
+ $("#donation_form").html( '<p>&nbsp;</p><p>&nbsp;</p><span class="description"><?php _e( 'Thank you for your donation.' , 'wp-admin-ui-customize' ); ?></span>' );
194
+ } else {
195
+ $("#donation_form").html( '' );
196
+ }
197
+ }
198
+
199
+ });
200
+ </script>
inc/setting_sidemenu.php CHANGED
@@ -1,375 +1,375 @@
1
- <?php
2
-
3
- $this->get_user_role();
4
- $Data = $this->get_data( 'sidemenu' );
5
-
6
- // include js css
7
- $ReadedJs = array( 'jquery' , 'jquery-ui-draggable' , 'jquery-ui-droppable' , 'jquery-ui-sortable' , 'thickbox' );
8
- wp_enqueue_script( $this->PageSlug , $this->Url . $this->PluginSlug . '.js', $ReadedJs , $this->Ver );
9
- wp_enqueue_style('thickbox');
10
- wp_enqueue_style( $this->PageSlug , $this->Url . $this->PluginSlug . '.css', array() , $this->Ver );
11
-
12
- ?>
13
-
14
- <div class="wrap">
15
-
16
- <?php echo $this->Msg; ?>
17
- <h2><?php _e( 'Side Menu' , 'wp-admin-ui-customize' ); ?></h2>
18
- <p><?php _e( 'Please change the menu by drag and drop.' , 'wp-admin-ui-customize' ); ?></p>
19
- <p class="description"><?php echo sprintf( __( 'New plugin menus will be added to the <strong>%s</strong>.' , 'wp-admin-ui-customize' ) , __( 'Menu items that can be added' , 'wp-admin-ui-customize' ) ); ?>
20
- <p><strong><?php _e( 'Notice: Please do not place the same multiple menu slug.' , 'wp-admin-ui-customize' ); ?></strong></p>
21
-
22
- <h3 id="wauc-apply-user-roles"><?php echo $this->get_apply_roles(); ?></h3>
23
-
24
- <p><a href="#TB_inline?height=300&width=600&inlineId=list_variables&modal=false" title="<?php _e( 'Shortcodes' , 'wp-admin-ui-customize' ); ?>" class="thickbox"><?php _e( 'Available Shortcodes' , 'wp-admin-ui-customize' ); ?></a></p>
25
-
26
- <form id="wauc_setting_sidemenu" class="wauc_form" method="post" action="<?php echo esc_url( remove_query_arg( 'wauc_msg' , add_query_arg( array( 'page' => $this->PageSlug ) ) ) ); ?>">
27
- <input type="hidden" name="<?php echo $this->UPFN; ?>" value="Y" />
28
- <?php wp_nonce_field( $this->Nonces["value"] , $this->Nonces["field"] ); ?>
29
- <input type="hidden" name="record_field" value="sidemenu" />
30
-
31
- <div id="poststuff">
32
-
33
- <div id="post-body" class="metabox-holder columns-2">
34
-
35
- <div id="postbox-container-1" class="postbox-container">
36
-
37
- <div id="can_menus">
38
-
39
- <div class="postbox">
40
- <h3 class="hndle"><span><?php _e( 'Menu items that can be added' , 'wp-admin-ui-customize' ); ?></span></h3>
41
- <div class="inside">
42
-
43
- <p class="description"><?php _e( 'Sepalator' , 'wp-admin-ui-customize' ); ?></p>
44
- <?php $menu_widget = array( 'title' => '-' , 'slug' => 'separator' , 'parent_slug' => '' , 'new' => true , 'cap' => 'read' ); ?>
45
- <?php $this->sidebar_menu_widget( $menu_widget ); ?>
46
- <div class="clear"></div>
47
-
48
- <?php foreach($this->Menu as $mm) : ?>
49
-
50
- <?php if( !empty( $mm[0] ) ) : ?>
51
-
52
- <?php $menu_title = $mm[0]; ?>
53
- <?php if( $mm[5] == 'menu-comments' ) : ?>
54
- <?php $menu_title = __( 'Comments' ); ?>
55
- <?php elseif( $mm[5] == 'menu-appearance' ) : ?>
56
- <?php $menu_title = __( 'Appearance' ); ?>
57
- <?php elseif( $mm[5] == 'menu-plugins' ) : ?>
58
- <?php $menu_title = __( 'Plugins' ); ?>
59
- <?php endif; ?>
60
- <p class="description"><?php echo $menu_title; ?></p>
61
-
62
- <?php if( empty( $this->SubMenu[$mm[2]] ) ) : ?>
63
-
64
- <?php $menu_widget = array( 'title' => $menu_title , 'slug' => $mm[2] , 'parent_slug' => '' , 'new' => true , 'cap' => $mm[1] , 'submenu' => '' ); ?>
65
- <?php $this->sidebar_menu_widget( $menu_widget ); ?>
66
-
67
- <?php else: ?>
68
-
69
- <?php foreach($this->SubMenu as $parent_slug => $sub) : ?>
70
-
71
- <?php foreach($sub as $sm) : ?>
72
-
73
- <?php if( $mm[2] == $parent_slug ) : ?>
74
- <?php $menu_title = $sm[0]; ?>
75
- <?php if( $sm[1] == 'update_core' ) : ?>
76
- <?php $menu_title = __( 'Update' ) . ' [update_total]'; ?>
77
- <?php elseif( $sm[2] == 'edit-comments.php' ) : ?>
78
- <?php $menu_title .= ' [comment_count]'; ?>
79
- <?php elseif( $sm[2] == 'themes.php' ) : ?>
80
- <?php $menu_title .= ' [update_themes]'; ?>
81
- <?php elseif( $sm[2] == 'plugins.php' ) : ?>
82
- <?php $menu_title .= ' [update_plugins]'; ?>
83
- <?php endif; ?>
84
- <?php $menu_widget = array( 'title' => $menu_title , 'slug' => $sm[2] , 'parent_slug' => '' , 'new' => true , 'cap' => $sm[1] , 'submenu' => '' ); ?>
85
- <?php $this->sidebar_menu_widget( $menu_widget ); ?>
86
- <?php endif; ?>
87
-
88
- <?php endforeach; ?>
89
-
90
- <?php endforeach; ?>
91
-
92
- <?php endif; ?>
93
-
94
- <div class="clear"></div>
95
-
96
- <?php endif; ?>
97
-
98
- <?php endforeach; ?>
99
-
100
- </div>
101
-
102
- </div>
103
-
104
- </div>
105
-
106
- </div>
107
-
108
- <div id="postbox-container-2" class="postbox-container">
109
-
110
- <div id="setting_menus">
111
-
112
- <div class="postbox">
113
- <h3 class="hndle">
114
- <span><?php _e( 'Current menu' , 'wp-admin-ui-customize' ); ?></span>
115
- </h3>
116
- <div class="inside widgets-holder-wrap">
117
-
118
- <?php if( empty( $Data ) ) : ?>
119
-
120
- <?php foreach($this->Menu as $mm) : ?>
121
-
122
- <?php if( isset( $mm[2] ) && strstr( $mm[2] , 'separator' ) ) : ?>
123
-
124
- <?php $menu_title = '-'; ?>
125
- <?php $mm[2] = 'separator'; ?>
126
- <?php $mwsm = array(); ?>
127
-
128
- <?php elseif( !empty( $mm[0] ) ) : ?>
129
-
130
- <?php $menu_title = $mm[0]; ?>
131
- <?php if( !empty( $mm[5] ) ) : ?>
132
- <?php if( $mm[5] == 'menu-comments' ) : ?>
133
- <?php $menu_title = __( 'Comments' ) . ' [comment_count]'; ?>
134
- <?php elseif( $mm[5] == 'menu-appearance' ) : ?>
135
- <?php $menu_title = __( 'Appearance' ) . ' [update_themes]'; ?>
136
- <?php elseif( $mm[5] == 'menu-plugins' ) : ?>
137
- <?php $menu_title = __( 'Plugins' ) . ' [update_plugins]'; ?>
138
- <?php endif; ?>
139
- <?php endif; ?>
140
-
141
- <?php $mwsm = array(); ?>
142
- <?php foreach($this->SubMenu as $parent_slug => $sub) : ?>
143
- <?php foreach($sub as $sm) : ?>
144
- <?php if( $mm[2] == $parent_slug ) : ?>
145
- <?php $submenu_title = $sm[0]; ?>
146
-
147
- <?php if( $sm[1] == 'update_core' ) : ?>
148
- <?php $submenu_title = __( 'Update' ) . ' [update_total]'; ?>
149
- <?php endif; ?>
150
- <?php $mwsm[] = array( 'title' => $submenu_title , 'slug' => $sm[2] , 'parent_slug' => $parent_slug , 'cap' => $sm[1] ); ?>
151
- <?php endif; ?>
152
- <?php endforeach; ?>
153
- <?php endforeach; ?>
154
-
155
- <?php endif; ?>
156
-
157
- <?php $menu_widget = array( 'title' => $menu_title , 'slug' => $mm[2] , 'parent_slug' => '' , 'new' => false , 'cap' => $mm[1] , 'submenu' => $mwsm ); ?>
158
- <?php $this->sidebar_menu_widget( $menu_widget ); ?>
159
-
160
- <?php endforeach; ?>
161
-
162
- <?php else: ?>
163
-
164
- <?php if( !empty( $Data["main"] ) ) : ?>
165
-
166
- <?php foreach($Data["main"] as $mm) : ?>
167
-
168
- <?php if( !empty( $mm["title"] ) ) : ?>
169
-
170
- <?php $mm_slug = htmlspecialchars_decode( $mm["slug"] ); ?>
171
-
172
- <?php $mwsm = array(); ?>
173
- <?php if( !empty( $Data["sub"] ) ) : ?>
174
- <?php foreach($Data["sub"] as $sm) : ?>
175
-
176
- <?php $sm_slug = htmlspecialchars_decode( $sm["slug"] ); ?>
177
- <?php $sm_parent_slug = htmlspecialchars_decode( $sm["parent_slug"] ); ?>
178
-
179
- <?php if( $mm_slug == $sm_parent_slug ) : ?>
180
-
181
- <?php $cap = ""; ?>
182
- <?php if( !empty( $this->SubMenu[$mm_slug] ) ) : ?>
183
- <?php foreach( $this->SubMenu[$mm_slug] as $k => $tmp_sm ) : ?>
184
- <?php if( $tmp_sm[2] == $sm_slug ) : ?>
185
- <?php $cap = $tmp_sm[1]; ?>
186
- <?php break; ?>
187
- <?php endif; ?>
188
- <?php endforeach; ?>
189
- <?php endif; ?>
190
-
191
- <?php $mwsm[] = array( 'title' => $sm["title"] , 'slug' => $sm["slug"] , 'parent_slug' => $sm["parent_slug"] , 'cap' => $cap ); ?>
192
-
193
- <?php endif; ?>
194
-
195
- <?php endforeach; ?>
196
- <?php endif; ?>
197
-
198
- <?php $cap = ""; ?>
199
- <?php foreach( $this->Menu as $tmp_m ) : ?>
200
- <?php if( $tmp_m[2] == $mm_slug ) : ?>
201
- <?php $cap = $tmp_m[1]; ?>
202
- <?php break; ?>
203
- <?php endif; ?>
204
- <?php endforeach; ?>
205
-
206
- <?php $menu_widget = array( 'title' => $mm["title"] , 'slug' => $mm["slug"] , 'parent_slug' => '' , 'new' => false , 'cap' =>$cap , 'submenu' => $mwsm ); ?>
207
- <?php $this->sidebar_menu_widget( $menu_widget ); ?>
208
-
209
- <?php endif; ?>
210
-
211
- <?php endforeach; ?>
212
-
213
- <?php endif; ?>
214
-
215
- <?php endif; ?>
216
-
217
- </div>
218
-
219
- </div>
220
-
221
- <p class="sidebar_setting_delete"><a href="#"><?php _e( 'Delete all the Current menu' , 'wp-admin-ui-customize' ); ?></a></p>
222
-
223
- </div>
224
- </div>
225
-
226
- <br class="clear">
227
-
228
- </div>
229
-
230
- </div>
231
-
232
- <p class="submit">
233
- <input type="submit" class="button-primary" name="update" value="<?php _e( 'Save' ); ?>" />
234
- </p>
235
-
236
- <p class="submit reset">
237
- <span class="description"><?php printf( __( 'Reset the %s?' , 'wp-admin-ui-customize' ) , __( 'Side Menu' , 'wp-admin-ui-customize' ) . __( 'Settings' ) ); ?></span>
238
- <input type="submit" class="button-secondary" name="reset" value="<?php _e( 'Reset settings' , 'wp-admin-ui-customize' ); ?>" />
239
- </p>
240
-
241
- </form>
242
-
243
- </div>
244
-
245
- <?php require_once( dirname( __FILE__ ) . '/list_variables.php' ); ?>
246
-
247
- <style>
248
- .widget h4 {
249
- padding: 12px 15px;
250
- }
251
- .widget-top a.widget-action {
252
- cursor: pointer;
253
- }
254
- </style>
255
- <script type="text/javascript">
256
-
257
- var wauc_widget_each, wauc_menu_sortable;
258
-
259
- jQuery(document).ready(function($) {
260
-
261
- var $Form = $("#wauc_setting_sidemenu");
262
- var $AddInside = $('#can_menus .postbox .inside', $Form);
263
- var $SettingInside = $('#setting_menus .postbox .inside', $Form);
264
-
265
- $AddInside.children('.widget').draggable({
266
- connectToSortable: '#setting_menus .postbox .inside',
267
- handle: '> .widget-top > .widget-title',
268
- distance: 2,
269
- helper: 'clone',
270
- zIndex: 5,
271
- stop: function(e,ui) {
272
- wauc_widget_each();
273
- wauc_menu_sortable();
274
- }
275
- });
276
-
277
- $('#postbox-container-1', $Form).droppable({
278
- tolerance: 'pointer',
279
- accept: function(o){
280
- return $(o).parent().parent().parent().attr('id') != 'postbox-container-1';
281
- },
282
- drop: function(e,ui) {
283
- ui.draggable.addClass('deleting');
284
- },
285
- over: function(e,ui) {
286
- ui.draggable.addClass('deleting');
287
- $('div.widget-placeholder').hide();
288
- },
289
- out: function(e,ui) {
290
- ui.draggable.removeClass('deleting');
291
- $('div.widget-placeholder').show();
292
- }
293
- });
294
-
295
- $(document).on('click', '.widget .widget-top .widget-title-action', function() {
296
-
297
- $(this).parent().parent().children(".widget-inside").slideToggle();
298
- return false;
299
-
300
- });
301
-
302
- $(document).on('click', '.widget .widget-inside .widget-control-actions .alignleft a[href=#remove]', function() {
303
-
304
- $(this).parent().parent().parent().parent().slideUp('normal', function() { $(this).remove(); } );
305
- return false;
306
-
307
- });
308
-
309
- wauc_menu_sortable = function menu_sortable() {
310
-
311
- $('#wauc_setting_sidemenu #poststuff #post-body #postbox-container-2 #setting_menus .postbox .inside, #wauc_setting_sidemenu #poststuff #post-body #postbox-container-2 #setting_menus .postbox .inside .widget .widget-inside .submenu').sortable({
312
- placeholder: "widget-placeholder",
313
- items: '> .widget',
314
- connectWith: "#wauc_setting_sidemenu #poststuff #post-body #postbox-container-2 #setting_menus .postbox .inside, #wauc_setting_sidemenu #poststuff #post-body #postbox-container-2 #setting_menus .postbox .inside .widget .widget-inside .submenu",
315
- handle: '> .widget-top > .widget-title',
316
- cursor: 'move',
317
- distance: 2,
318
- change: function(e,ui) {
319
- var $height = ui.helper.height();
320
- $('#wauc_setting_sidemenu #poststuff #post-body #postbox-container-2 #setting_menus .postbox .inside .widget-placeholder').height($height);
321
- },
322
- stop: function(e,ui) {
323
- if ( ui.item.hasClass('deleting') ) {
324
- ui.item.remove();
325
- }
326
- ui.item.attr( 'style', '' ).removeClass('ui-draggable');
327
- wauc_widget_each();
328
- },
329
- });
330
-
331
- }
332
- wauc_menu_sortable();
333
-
334
- wauc_widget_each = function widget_each() {
335
- var $Count = 0;
336
- $('#wauc_setting_sidemenu #setting_menus .postbox .inside .widget').each(function() {
337
- var $InputSlug = $(this).children(".widget-inside").children(".settings").children(".description").children(".slugtext");
338
- var $InputTitle = $(this).children(".widget-inside").children(".settings").children("label").children(".titletext");
339
- var $InputParentSlug = $(this).children(".widget-inside").children(".settings").children(".parent_slugtext");
340
-
341
- var $Name = 'data' + '['+$Count+']';
342
- $InputSlug.attr("name", $Name+'[slug]');
343
- $InputTitle.attr("name", $Name+'[title]');
344
- $InputParentSlug.attr("name", $Name+'[parent_slug]');
345
-
346
- if ( $(this).parent().parent().parent().parent().hasClass("submenu") ) {
347
- // None three
348
- $(this).remove();
349
- } else if ( $(this).parent().hasClass("submenu") ) {
350
- var $ParentSlug = $(this).parent().parent().children(".settings").children(".description").children(".slugtext").val();
351
- $InputParentSlug.val($ParentSlug);
352
- } else {
353
- $InputParentSlug.val('');
354
- }
355
- $Count++;
356
- });
357
- }
358
- wauc_widget_each();
359
-
360
- $('#setting_menus .sidebar_setting_delete a').on('click', function() {
361
-
362
- $('#setting_menus .postbox .inside').html('');
363
- return false;
364
-
365
- });
366
-
367
- $('#wauc_setting_sidemenu').on('submit', function() {
368
-
369
- $('#can_menus').remove();
370
- return true;
371
-
372
- });
373
-
374
- });
375
  </script>
1
+ <?php
2
+
3
+ $this->get_user_role();
4
+ $Data = $this->get_data( 'sidemenu' );
5
+
6
+ // include js css
7
+ $ReadedJs = array( 'jquery' , 'jquery-ui-draggable' , 'jquery-ui-droppable' , 'jquery-ui-sortable' , 'thickbox' );
8
+ wp_enqueue_script( $this->PageSlug , $this->Url . $this->PluginSlug . '.js', $ReadedJs , $this->Ver );
9
+ wp_enqueue_style('thickbox');
10
+ wp_enqueue_style( $this->PageSlug , $this->Url . $this->PluginSlug . '.css', array() , $this->Ver );
11
+
12
+ ?>
13
+
14
+ <div class="wrap">
15
+
16
+ <?php echo $this->Msg; ?>
17
+ <h2><?php _e( 'Side Menu' , 'wp-admin-ui-customize' ); ?></h2>
18
+ <p><?php _e( 'Please change the menu by drag and drop.' , 'wp-admin-ui-customize' ); ?></p>
19
+ <p class="description"><?php echo sprintf( __( 'New plugin menus will be added to the <strong>%s</strong>.' , 'wp-admin-ui-customize' ) , __( 'Menu items that can be added' , 'wp-admin-ui-customize' ) ); ?>
20
+ <p><strong><?php _e( 'Notice: Please do not place the same multiple menu slug.' , 'wp-admin-ui-customize' ); ?></strong></p>
21
+
22
+ <h3 id="wauc-apply-user-roles"><?php echo $this->get_apply_roles(); ?></h3>
23
+
24
+ <p><a href="#TB_inline?height=300&width=600&inlineId=list_variables&modal=false" title="<?php _e( 'Shortcodes' , 'wp-admin-ui-customize' ); ?>" class="thickbox"><?php _e( 'Available Shortcodes' , 'wp-admin-ui-customize' ); ?></a></p>
25
+
26
+ <form id="wauc_setting_sidemenu" class="wauc_form" method="post" action="<?php echo esc_url( remove_query_arg( 'wauc_msg' , add_query_arg( array( 'page' => $this->PageSlug ) ) ) ); ?>">
27
+ <input type="hidden" name="<?php echo $this->UPFN; ?>" value="Y" />
28
+ <?php wp_nonce_field( $this->Nonces["value"] , $this->Nonces["field"] ); ?>
29
+ <input type="hidden" name="record_field" value="sidemenu" />
30
+
31
+ <div id="poststuff">
32
+
33
+ <div id="post-body" class="metabox-holder columns-2">
34
+
35
+ <div id="postbox-container-1" class="postbox-container">
36
+
37
+ <div id="can_menus">
38
+
39
+ <div class="postbox">
40
+ <h3 class="hndle"><span><?php _e( 'Menu items that can be added' , 'wp-admin-ui-customize' ); ?></span></h3>
41
+ <div class="inside">
42
+
43
+ <p class="description"><?php _e( 'Sepalator' , 'wp-admin-ui-customize' ); ?></p>
44
+ <?php $menu_widget = array( 'title' => '-' , 'slug' => 'separator' , 'parent_slug' => '' , 'new' => true , 'cap' => 'read' ); ?>
45
+ <?php $this->sidebar_menu_widget( $menu_widget ); ?>
46
+ <div class="clear"></div>
47
+
48
+ <?php foreach($this->Menu as $mm) : ?>
49
+
50
+ <?php if( !empty( $mm[0] ) ) : ?>
51
+
52
+ <?php $menu_title = $mm[0]; ?>
53
+ <?php if( $mm[5] == 'menu-comments' ) : ?>
54
+ <?php $menu_title = __( 'Comments' ); ?>
55
+ <?php elseif( $mm[5] == 'menu-appearance' ) : ?>
56
+ <?php $menu_title = __( 'Appearance' ); ?>
57
+ <?php elseif( $mm[5] == 'menu-plugins' ) : ?>
58
+ <?php $menu_title = __( 'Plugins' ); ?>
59
+ <?php endif; ?>
60
+ <p class="description"><?php echo $menu_title; ?></p>
61
+
62
+ <?php if( empty( $this->SubMenu[$mm[2]] ) ) : ?>
63
+
64
+ <?php $menu_widget = array( 'title' => $menu_title , 'slug' => $mm[2] , 'parent_slug' => '' , 'new' => true , 'cap' => $mm[1] , 'submenu' => '' ); ?>
65
+ <?php $this->sidebar_menu_widget( $menu_widget ); ?>
66
+
67
+ <?php else: ?>
68
+
69
+ <?php foreach($this->SubMenu as $parent_slug => $sub) : ?>
70
+
71
+ <?php foreach($sub as $sm) : ?>
72
+
73
+ <?php if( $mm[2] == $parent_slug ) : ?>
74
+ <?php $menu_title = $sm[0]; ?>
75
+ <?php if( $sm[1] == 'update_core' ) : ?>
76
+ <?php $menu_title = __( 'Update' ) . ' [update_total]'; ?>
77
+ <?php elseif( $sm[2] == 'edit-comments.php' ) : ?>
78
+ <?php $menu_title .= ' [comment_count]'; ?>
79
+ <?php elseif( $sm[2] == 'themes.php' ) : ?>
80
+ <?php $menu_title .= ' [update_themes]'; ?>
81
+ <?php elseif( $sm[2] == 'plugins.php' ) : ?>
82
+ <?php $menu_title .= ' [update_plugins]'; ?>
83
+ <?php endif; ?>
84
+ <?php $menu_widget = array( 'title' => $menu_title , 'slug' => $sm[2] , 'parent_slug' => '' , 'new' => true , 'cap' => $sm[1] , 'submenu' => '' ); ?>
85
+ <?php $this->sidebar_menu_widget( $menu_widget ); ?>
86
+ <?php endif; ?>
87
+
88
+ <?php endforeach; ?>
89
+
90
+ <?php endforeach; ?>
91
+
92
+ <?php endif; ?>
93
+
94
+ <div class="clear"></div>
95
+
96
+ <?php endif; ?>
97
+
98
+ <?php endforeach; ?>
99
+
100
+ </div>
101
+
102
+ </div>
103
+
104
+ </div>
105
+
106
+ </div>
107
+
108
+ <div id="postbox-container-2" class="postbox-container">
109
+
110
+ <div id="setting_menus">
111
+
112
+ <div class="postbox">
113
+ <h3 class="hndle">
114
+ <span><?php _e( 'Current menu' , 'wp-admin-ui-customize' ); ?></span>
115
+ </h3>
116
+ <div class="inside widgets-holder-wrap">
117
+
118
+ <?php if( empty( $Data ) ) : ?>
119
+
120
+ <?php foreach($this->Menu as $mm) : ?>
121
+
122
+ <?php if( isset( $mm[2] ) && strstr( $mm[2] , 'separator' ) ) : ?>
123
+
124
+ <?php $menu_title = '-'; ?>
125
+ <?php $mm[2] = 'separator'; ?>
126
+ <?php $mwsm = array(); ?>
127
+
128
+ <?php elseif( !empty( $mm[0] ) ) : ?>
129
+
130
+ <?php $menu_title = $mm[0]; ?>
131
+ <?php if( !empty( $mm[5] ) ) : ?>
132
+ <?php if( $mm[5] == 'menu-comments' ) : ?>
133
+ <?php $menu_title = __( 'Comments' ) . ' [comment_count]'; ?>
134
+ <?php elseif( $mm[5] == 'menu-appearance' ) : ?>
135
+ <?php $menu_title = __( 'Appearance' ) . ' [update_themes]'; ?>
136
+ <?php elseif( $mm[5] == 'menu-plugins' ) : ?>
137
+ <?php $menu_title = __( 'Plugins' ) . ' [update_plugins]'; ?>
138
+ <?php endif; ?>
139
+ <?php endif; ?>
140
+
141
+ <?php $mwsm = array(); ?>
142
+ <?php foreach($this->SubMenu as $parent_slug => $sub) : ?>
143
+ <?php foreach($sub as $sm) : ?>
144
+ <?php if( $mm[2] == $parent_slug ) : ?>
145
+ <?php $submenu_title = $sm[0]; ?>
146
+
147
+ <?php if( $sm[1] == 'update_core' ) : ?>
148
+ <?php $submenu_title = __( 'Update' ) . ' [update_total]'; ?>
149
+ <?php endif; ?>
150
+ <?php $mwsm[] = array( 'title' => $submenu_title , 'slug' => $sm[2] , 'parent_slug' => $parent_slug , 'cap' => $sm[1] ); ?>
151
+ <?php endif; ?>
152
+ <?php endforeach; ?>
153
+ <?php endforeach; ?>
154
+
155
+ <?php endif; ?>
156
+
157
+ <?php $menu_widget = array( 'title' => $menu_title , 'slug' => $mm[2] , 'parent_slug' => '' , 'new' => false , 'cap' => $mm[1] , 'submenu' => $mwsm ); ?>
158
+ <?php $this->sidebar_menu_widget( $menu_widget ); ?>
159
+
160
+ <?php endforeach; ?>
161
+
162
+ <?php else: ?>
163
+
164
+ <?php if( !empty( $Data["main"] ) ) : ?>
165
+
166
+ <?php foreach($Data["main"] as $mm) : ?>
167
+
168
+ <?php if( !empty( $mm["title"] ) ) : ?>
169
+
170
+ <?php $mm_slug = htmlspecialchars_decode( $mm["slug"] ); ?>
171
+
172
+ <?php $mwsm = array(); ?>
173
+ <?php if( !empty( $Data["sub"] ) ) : ?>
174
+ <?php foreach($Data["sub"] as $sm) : ?>
175
+
176
+ <?php $sm_slug = htmlspecialchars_decode( $sm["slug"] ); ?>
177
+ <?php $sm_parent_slug = htmlspecialchars_decode( $sm["parent_slug"] ); ?>
178
+
179
+ <?php if( $mm_slug == $sm_parent_slug ) : ?>
180
+
181
+ <?php $cap = ""; ?>
182
+ <?php if( !empty( $this->SubMenu[$mm_slug] ) ) : ?>
183
+ <?php foreach( $this->SubMenu[$mm_slug] as $k => $tmp_sm ) : ?>
184
+ <?php if( $tmp_sm[2] == $sm_slug ) : ?>
185
+ <?php $cap = $tmp_sm[1]; ?>
186
+ <?php break; ?>
187
+ <?php endif; ?>
188
+ <?php endforeach; ?>
189
+ <?php endif; ?>
190
+
191
+ <?php $mwsm[] = array( 'title' => $sm["title"] , 'slug' => $sm["slug"] , 'parent_slug' => $sm["parent_slug"] , 'cap' => $cap ); ?>
192
+
193
+ <?php endif; ?>
194
+
195
+ <?php endforeach; ?>
196
+ <?php endif; ?>
197
+
198
+ <?php $cap = ""; ?>
199
+ <?php foreach( $this->Menu as $tmp_m ) : ?>
200
+ <?php if( $tmp_m[2] == $mm_slug ) : ?>
201
+ <?php $cap = $tmp_m[1]; ?>
202
+ <?php break; ?>
203
+ <?php endif; ?>
204
+ <?php endforeach; ?>
205
+
206
+ <?php $menu_widget = array( 'title' => $mm["title"] , 'slug' => $mm["slug"] , 'parent_slug' => '' , 'new' => false , 'cap' =>$cap , 'submenu' => $mwsm ); ?>
207
+ <?php $this->sidebar_menu_widget( $menu_widget ); ?>
208
+
209
+ <?php endif; ?>
210
+
211
+ <?php endforeach; ?>
212
+
213
+ <?php endif; ?>
214
+
215
+ <?php endif; ?>
216
+
217
+ </div>
218
+
219
+ </div>
220
+
221
+ <p class="sidebar_setting_delete"><a href="#"><?php _e( 'Delete all the Current menu' , 'wp-admin-ui-customize' ); ?></a></p>
222
+
223
+ </div>
224
+ </div>
225
+
226
+ <br class="clear">
227
+
228
+ </div>
229
+
230
+ </div>
231
+
232
+ <p class="submit">
233
+ <input type="submit" class="button-primary" name="update" value="<?php _e( 'Save' ); ?>" />
234
+ </p>
235
+
236
+ <p class="submit reset">
237
+ <span class="description"><?php printf( __( 'Reset the %s?' , 'wp-admin-ui-customize' ) , __( 'Side Menu' , 'wp-admin-ui-customize' ) . __( 'Settings' ) ); ?></span>
238
+ <input type="submit" class="button-secondary" name="reset" value="<?php _e( 'Reset settings' , 'wp-admin-ui-customize' ); ?>" />
239
+ </p>
240
+
241
+ </form>
242
+
243
+ </div>
244
+
245
+ <?php require_once( dirname( __FILE__ ) . '/list_variables.php' ); ?>
246
+
247
+ <style>
248
+ .widget h4 {
249
+ padding: 12px 15px;
250
+ }
251
+ .widget-top a.widget-action {
252
+ cursor: pointer;
253
+ }
254
+ </style>
255
+ <script type="text/javascript">
256
+
257
+ var wauc_widget_each, wauc_menu_sortable;
258
+
259
+ jQuery(document).ready(function($) {
260
+
261
+ var $Form = $("#wauc_setting_sidemenu");
262
+ var $AddInside = $('#can_menus .postbox .inside', $Form);
263
+ var $SettingInside = $('#setting_menus .postbox .inside', $Form);
264
+
265
+ $AddInside.children('.widget').draggable({
266
+ connectToSortable: '#setting_menus .postbox .inside',
267
+ handle: '> .widget-top > .widget-title',
268
+ distance: 2,
269
+ helper: 'clone',
270
+ zIndex: 5,
271
+ stop: function(e,ui) {
272
+ wauc_widget_each();
273
+ wauc_menu_sortable();
274
+ }
275
+ });
276
+
277
+ $('#postbox-container-1', $Form).droppable({
278
+ tolerance: 'pointer',
279
+ accept: function(o){
280
+ return $(o).parent().parent().parent().attr('id') != 'postbox-container-1';
281
+ },
282
+ drop: function(e,ui) {
283
+ ui.draggable.addClass('deleting');
284
+ },
285
+ over: function(e,ui) {
286
+ ui.draggable.addClass('deleting');
287
+ $('div.widget-placeholder').hide();
288
+ },
289
+ out: function(e,ui) {
290
+ ui.draggable.removeClass('deleting');
291
+ $('div.widget-placeholder').show();
292
+ }
293
+ });
294
+
295
+ $(document).on('click', '.widget .widget-top .widget-title-action', function() {
296
+
297
+ $(this).parent().parent().children(".widget-inside").slideToggle();
298
+ return false;
299
+
300
+ });
301
+
302
+ $(document).on('click', '.widget .widget-inside .widget-control-actions .alignleft a[href="#remove"]', function() {
303
+
304
+ $(this).parent().parent().parent().parent().slideUp('normal', function() { $(this).remove(); } );
305
+ return false;
306
+
307
+ });
308
+
309
+ wauc_menu_sortable = function menu_sortable() {
310
+
311
+ $('#wauc_setting_sidemenu #poststuff #post-body #postbox-container-2 #setting_menus .postbox .inside, #wauc_setting_sidemenu #poststuff #post-body #postbox-container-2 #setting_menus .postbox .inside .widget .widget-inside .submenu').sortable({
312
+ placeholder: "widget-placeholder",
313
+ items: '> .widget',
314
+ connectWith: "#wauc_setting_sidemenu #poststuff #post-body #postbox-container-2 #setting_menus .postbox .inside, #wauc_setting_sidemenu #poststuff #post-body #postbox-container-2 #setting_menus .postbox .inside .widget .widget-inside .submenu",
315
+ handle: '> .widget-top > .widget-title',
316
+ cursor: 'move',
317
+ distance: 2,
318
+ change: function(e,ui) {
319
+ var $height = ui.helper.height();
320
+ $('#wauc_setting_sidemenu #poststuff #post-body #postbox-container-2 #setting_menus .postbox .inside .widget-placeholder').height($height);
321
+ },
322
+ stop: function(e,ui) {
323
+ if ( ui.item.hasClass('deleting') ) {
324
+ ui.item.remove();
325
+ }
326
+ ui.item.attr( 'style', '' ).removeClass('ui-draggable');
327
+ wauc_widget_each();
328
+ },
329
+ });
330
+
331
+ }
332
+ wauc_menu_sortable();
333
+
334
+ wauc_widget_each = function widget_each() {
335
+ var $Count = 0;
336
+ $('#wauc_setting_sidemenu #setting_menus .postbox .inside .widget').each(function() {
337
+ var $InputSlug = $(this).children(".widget-inside").children(".settings").children(".description").children(".slugtext");
338
+ var $InputTitle = $(this).children(".widget-inside").children(".settings").children("label").children(".titletext");
339
+ var $InputParentSlug = $(this).children(".widget-inside").children(".settings").children(".parent_slugtext");
340
+
341
+ var $Name = 'data' + '['+$Count+']';
342
+ $InputSlug.attr("name", $Name+'[slug]');
343
+ $InputTitle.attr("name", $Name+'[title]');
344
+ $InputParentSlug.attr("name", $Name+'[parent_slug]');
345
+
346
+ if ( $(this).parent().parent().parent().parent().hasClass("submenu") ) {
347
+ // None three
348
+ $(this).remove();
349
+ } else if ( $(this).parent().hasClass("submenu") ) {
350
+ var $ParentSlug = $(this).parent().parent().children(".settings").children(".description").children(".slugtext").val();
351
+ $InputParentSlug.val($ParentSlug);
352
+ } else {
353
+ $InputParentSlug.val('');
354
+ }
355
+ $Count++;
356
+ });
357
+ }
358
+ wauc_widget_each();
359
+
360
+ $('#setting_menus .sidebar_setting_delete a').on('click', function() {
361
+
362
+ $('#setting_menus .postbox .inside').html('');
363
+ return false;
364
+
365
+ });
366
+
367
+ $('#wauc_setting_sidemenu').on('submit', function() {
368
+
369
+ $('#can_menus').remove();
370
+ return true;
371
+
372
+ });
373
+
374
+ });
375
  </script>
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === WP Admin UI Customize ===
2
  Contributors: gqevu6bsiz
3
- Donate link: http://gqevu6bsiz.chicappa.jp/please-donation/?utm_source=wporg&utm_medium=donate&utm_content=wauc&utm_campaign=1_5_8
4
  Tags: admin, post, posts, page, option, sitemenu, menu, custom, customize, dashboard, admin_bar, multisite, network, metabox
5
- Requires at least: 3.8
6
- Tested up to: 4.4
7
- Stable tag: 1.5.8
8
  License: GPL2
9
 
10
  Customize the management screen UI.
@@ -50,6 +50,9 @@ These to Customization is possible.
50
 
51
  == Changelog ==
52
 
 
 
 
53
  = 1.5.8 =
54
  * Fixed: Tweak CSS.
55
 
1
  === WP Admin UI Customize ===
2
  Contributors: gqevu6bsiz
3
+ Donate link: http://gqevu6bsiz.chicappa.jp/please-donation/?utm_source=wporg&utm_medium=donate&utm_content=wauc&utm_campaign=1_5_9
4
  Tags: admin, post, posts, page, option, sitemenu, menu, custom, customize, dashboard, admin_bar, multisite, network, metabox
5
+ Requires at least: 4.2
6
+ Tested up to: 4.5
7
+ Stable tag: 1.5.9
8
  License: GPL2
9
 
10
  Customize the management screen UI.
50
 
51
  == Changelog ==
52
 
53
+ = 1.5.9 =
54
+ * Fixed: Items panel expand on Sidemenus and Admin bar menus.
55
+
56
  = 1.5.8 =
57
  * Fixed: Tweak CSS.
58
 
wp-admin-ui-customize.php CHANGED
@@ -1,2652 +1,2652 @@
1
- <?php
2
- /*
3
- Plugin Name: WP Admin UI Customize
4
- Description: An excellent plugin to customize the management screens.
5
- Plugin URI: http://wpadminuicustomize.com/?utm_source=use_plugin&utm_medium=list&utm_content=wauc&utm_campaign=1_5_8
6
- Version: 1.5.8
7
- Author: gqevu6bsiz
8
- Author URI: http://gqevu6bsiz.chicappa.jp/?utm_source=use_plugin&utm_medium=list&utm_content=wauc&utm_campaign=1_5_8
9
- Text Domain: wp-admin-ui-customize
10
- Domain Path: /languages
11
- */
12
-
13
- /* Copyright 2012 gqevu6bsiz (email : gqevu6bsiz@gmail.com)
14
-
15
- This program is free software; you can redistribute it and/or modify
16
- it under the terms of the GNU General Public License, version 2, as
17
- published by the Free Software Foundation.
18
-
19
- This program is distributed in the hope that it will be useful,
20
- but WITHOUT ANY WARRANTY; without even the implied warranty of
21
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
- GNU General Public License for more details.
23
-
24
- You should have received a copy of the GNU General Public License
25
- along with this program; if not, write to the Free Software
26
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
- */
28
-
29
-
30
-
31
-
32
- if ( !class_exists( 'WP_Admin_UI_Customize' ) ) :
33
-
34
- class WP_Admin_UI_Customize
35
- {
36
-
37
- var $Ver,
38
- $Name,
39
- $Dir,
40
- $Url,
41
- $Site,
42
- $AuthorUrl,
43
- $ltd,
44
- $Record,
45
- $PageSlug,
46
- $PluginSlug,
47
- $Nonces,
48
- $Schema,
49
- $UPFN,
50
- $DonateKey,
51
- $Menu,
52
- $SubMenu,
53
- $Admin_bar,
54
- $ActivatedPlugin,
55
- $OtherPluginMenu,
56
- $MsgQ,
57
- $Msg;
58
-
59
-
60
- function __construct() {
61
- $this->Ver = '1.5.8';
62
- $this->Name = 'WP Admin UI Customize';
63
- $this->Dir = plugin_dir_path( __FILE__ );
64
- $this->Url = plugin_dir_url( __FILE__ );
65
- $this->Site = 'http://wpadminuicustomize.com/';
66
- $this->AuthorUrl = 'http://gqevu6bsiz.chicappa.jp/';
67
- $this->ltd = 'wauc';
68
- $this->Record = array(
69
- "user_role" => $this->ltd . '_user_role_setting',
70
- "site" => $this->ltd . '_site_setting',
71
- "admin_general" => $this->ltd . '_admin_general_setting',
72
- "dashboard" => $this->ltd . '_dashboard_setting',
73
- "regist_dashboard_metabox" => $this->ltd . '_regist_dashboard_metabox',
74
- "admin_bar_menu" => $this->ltd . '_admin_bar_menu_setting',
75
- "sidemenu" => $this->ltd . '_sidemenu_setting',
76
- "manage_metabox" => $this->ltd . '_manage_metabox_setting',
77
- "regist_metabox" => $this->ltd . '_regist_metabox',
78
- "post_add_edit" => $this->ltd . '_post_add_edit_setting',
79
- "appearance_menus" => $this->ltd . '_appearance_menus_setting',
80
- "loginscreen" => $this->ltd . '_loginscreen_setting',
81
- "plugin_cap" => $this->ltd . '_plugin_cap',
82
- "donate" => $this->ltd . '_donated',
83
- );
84
- $this->PageSlug = 'wp_admin_ui_customize';
85
- $this->PluginSlug = dirname( plugin_basename( __FILE__ ) );
86
- $this->Nonces = array( "field" => $this->ltd . '_field' , "value" => $this->ltd . '_value' );
87
- $this->Schema = is_ssl() ? 'https://' : 'http://';
88
- $this->ActivatedPlugin = array();
89
- $this->OtherPluginMenu = array();
90
- $this->UPFN = 'Y';
91
- $this->DonateKey = 'd77aec9bc89d445fd54b4c988d090f03';
92
- $this->MsgQ = $this->ltd . '_msg';
93
-
94
- $this->PluginSetup();
95
- $this->FilterStart();
96
- }
97
-
98
-
99
-
100
-
101
-
102
- // PluginSetup
103
- function PluginSetup() {
104
- // load text domain
105
- load_plugin_textdomain( 'wp-admin-ui-customize' , false , $this->PluginSlug . '/languages' );
106
-
107
- add_action( 'plugins_loaded' , array( $this , 'plugins_loaded' ) );
108
-
109
- // plugin links
110
- add_filter( 'plugin_action_links' , array( $this , 'plugin_action_links' ) , 10 , 2 );
111
-
112
- // plugin links
113
- add_filter( 'network_admin_plugin_action_links' , array( $this , 'network_admin_plugin_action_links' ) , 10 , 2 );
114
-
115
- // add menu
116
- add_action( 'admin_menu' , array( $this , 'admin_menu' ) , 2 );
117
-
118
- // setting check user role
119
- add_action( 'admin_notices' , array( $this , 'settingCheck' ) );
120
-
121
- // compatible other plugin check
122
- add_action( 'wp_loaded' , array( $this , 'activated_plugin' ) );
123
-
124
- // data update
125
- add_action( 'admin_init' , array( $this , 'dataUpdate') );
126
-
127
- // default admin bar menu load.
128
- add_action( 'wp_before_admin_bar_render' , array( $this , 'admin_bar_default_load' ) , 1 );
129
-
130
- // default side menu load.
131
- add_action( 'admin_menu' , array( $this , 'sidemenu_default_load' ) , 10000 );
132
-
133
- // default post metabox load.
134
- add_action( 'admin_head' , array( $this , 'post_meta_boxes_load' ) , 10000 );
135
-
136
- // default post metabox dashbaord load.
137
- add_action( 'wp_dashboard_setup' , array( $this , 'post_meta_boxes_dashboard_load' ) , 10000 );
138
-
139
- }
140
-
141
- function plugins_loaded() {
142
-
143
- do_action( $this->ltd . '_plugins_loaded' );
144
-
145
- }
146
-
147
- // PluginSetup
148
- function plugin_action_links( $links , $file ) {
149
- if( plugin_basename(__FILE__) == $file ) {
150
- $link = '<a href="' . self_admin_url( 'admin.php?page=' . $this->PageSlug ) . '">' . __( 'Settings' ) . '</a>';
151
- $support_link = '<a href="http://wordpress.org/support/plugin/' . $this->PluginSlug . '" target="_blank">' . __( 'Support Forums' ) . '</a>';
152
- $delete_userrole_link = '<a href="' . self_admin_url( 'admin.php?page=' . $this->PageSlug . '_reset_userrole' ) . '">' . __( 'Reset User Roles' , 'wp-admin-ui-customize' ) . '</a>';
153
- array_unshift( $links, $link , $delete_userrole_link , $support_link );
154
- }
155
- return $links;
156
- }
157
-
158
- // PluginSetup
159
- function network_admin_plugin_action_links( $links , $file ) {
160
- if( plugin_basename(__FILE__) == $file ) {
161
- $support_link = '<a href="' . $this->Site . 'multisite_about/?utm_source=use_plugin&utm_medium=list&utm_content=' . $this->ltd . '&utm_campaign=' . str_replace( '.' , '_' , $this->Ver ) . '" target="_blank">Multisite Add-on</a>';
162
- array_unshift( $links, $support_link );
163
- }
164
-
165
- return $links;
166
- }
167
-
168
- // PluginSetup
169
- function admin_menu() {
170
-
171
- if( !empty( $_GET["page"] ) ) {
172
- $page = strip_tags( $_GET["page"] );
173
- if( $page == $this->PageSlug . '_admin_bar' ) {
174
- @header("X-XSS-Protection: 0");
175
- }
176
- }
177
-
178
- $capability = $this->get_plugin_cap();
179
-
180
- add_menu_page( $this->Name , $this->Name , $capability, $this->PageSlug , array( $this , 'setting_default') );
181
- add_submenu_page( $this->PageSlug , __( 'Site Settings' , 'wp-admin-ui-customize' ) , __( 'Site Settings' , 'wp-admin-ui-customize' ) , $capability , $this->PageSlug . '_setting_site' , array( $this , 'setting_site' ) );
182
- add_submenu_page( $this->PageSlug , sprintf( __( '%1$s %2$s' , 'wp-admin-ui-customize' ) , __( 'General' ) , __( 'Settings' ) ) , sprintf( __( '%1$s %2$s' , 'wp-admin-ui-customize' ) , __( 'General' ) , __( 'Settings' ) ) , $capability , $this->PageSlug . '_admin_general_setting' , array( $this , 'setting_admin_general' ) );
183
- add_submenu_page( $this->PageSlug , __( 'Dashboard' ) , __( 'Dashboard' ) , $capability , $this->PageSlug . '_dashboard' , array( $this , 'setting_dashboard' ) );
184
- add_submenu_page( $this->PageSlug , __( 'Admin Bar Menu' , 'wp-admin-ui-customize' ) , __( 'Admin Bar Menu' , 'wp-admin-ui-customize' ) , $capability , $this->PageSlug . '_admin_bar' , array( $this , 'setting_admin_bar_menu' ) );
185
- add_submenu_page( $this->PageSlug , __( 'Side Menu' , 'wp-admin-ui-customize' ) , __( 'Side Menu' , 'wp-admin-ui-customize' ) , $capability , $this->PageSlug . '_sidemenu' , array( $this , 'setting_sidemenu' ) );
186
- add_submenu_page( $this->PageSlug , __( 'Manage meta box' , 'wp-admin-ui-customize' ) , __( 'Manage meta box' , 'wp-admin-ui-customize' ) , $capability , $this->PageSlug . '_manage_metabox' , array( $this , 'setting_manage_metabox' ) );
187
- add_submenu_page( $this->PageSlug , __( 'Add New Post and Edit Post Screen Setting' , 'wp-admin-ui-customize' ) , __( 'Add New Post and Edit Post Screen Setting' , 'wp-admin-ui-customize' ) , $capability , $this->PageSlug . '_post_add_edit_screen' , array( $this , 'setting_post_add_edit' ) );
188
- add_submenu_page( $this->PageSlug , __( 'Appearance Menus Screen Setting' , 'wp-admin-ui-customize' ) , __( 'Appearance Menus Screen Setting' , 'wp-admin-ui-customize' ) , $capability , $this->PageSlug . '_appearance_menus' , array( $this , 'setting_appearance_menus' ) );
189
- add_submenu_page( $this->PageSlug , __( 'Login Screen' , 'wp-admin-ui-customize' ) , __( 'Login Screen' , 'wp-admin-ui-customize' ) , $capability , $this->PageSlug . '_loginscreen' , array( $this , 'setting_loginscreen' ) );
190
- add_submenu_page( $this->PageSlug , sprintf( __( '%1$s of %2$s %3$s' , 'wp-admin-ui-customize' ) , __( 'Change' ) , __( 'Plugin' ) , __( 'Capabilities' ) ) , sprintf( __( '%1$s of %2$s %3$s' , 'wp-admin-ui-customize' ) , __( 'Change' ) , __( 'Plugin' ) , __( 'Capabilities' ) ) , $capability , $this->PageSlug . '_plugin_cap' , array( $this , 'setting_plugin_cap' ) );
191
- add_submenu_page( $this->PageSlug , __( 'Reset User Roles' , 'wp-admin-ui-customize' ) , __( 'Reset User Roles' , 'wp-admin-ui-customize' ) , $capability , $this->PageSlug . '_reset_userrole' , array( $this , 'reset_userrole' ) );
192
- }
193
-
194
- // PluginSetup
195
- function activated_plugin() {
196
- include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
197
-
198
- if( is_plugin_active( 'buddypress/bp-loader.php' ) ) {
199
- $this->ActivatedPlugin["buddypress"] = true;
200
- }
201
-
202
- if( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
203
- $this->ActivatedPlugin["woocommerce"] = true;
204
- }
205
-
206
- if( is_plugin_active( 'post-edit-toolbar/post-edit-toolbar.php' ) ) {
207
- $this->ActivatedPlugin["post_edit_toolbar"] = true;
208
- }
209
-
210
- if( is_plugin_active( 'polylang/polylang.php' ) ) {
211
- $this->ActivatedPlugin["polylang"] = true;
212
- }
213
-
214
- }
215
-
216
-
217
-
218
-
219
- // SettingPage
220
- function setting_default() {
221
- $this->display_msg();
222
- add_filter( 'admin_footer_text' , array( $this , 'layout_footer' ) );
223
- include_once 'inc/setting_default.php';
224
- }
225
-
226
- // SettingPage
227
- function setting_site() {
228
- $this->display_msg();
229
- add_filter( 'admin_footer_text' , array( $this , 'layout_footer' ) );
230
- $this->DisplayDonation();
231
- include_once 'inc/setting_site.php';
232
- }
233
-
234
- // SettingPage
235
- function setting_admin_general() {
236
- $this->display_msg();
237
- add_filter( 'admin_footer_text' , array( $this , 'layout_footer' ) );
238
- $this->DisplayDonation();
239
- include_once 'inc/setting_admin_general.php';
240
- }
241
-
242
- // SettingPage
243
- function setting_dashboard() {
244
- $this->display_msg();
245
- add_filter( 'admin_footer_text' , array( $this , 'layout_footer' ) );
246
- $this->DisplayDonation();
247
- include_once 'inc/setting_dashboard.php';
248
- }
249
-
250
- // SettingPage
251
- function setting_admin_bar_menu() {
252
- $this->display_msg();
253
- add_filter( 'admin_footer_text' , array( $this , 'layout_footer' ) );
254
- $this->DisplayDonation();
255
- include_once 'inc/setting_admin_bar_menu.php';
256
- }
257
-
258
- // SettingPage
259
- function setting_sidemenu() {
260
- $this->display_msg();
261
- add_filter( 'admin_footer_text' , array( $this , 'layout_footer' ) );
262
- $this->DisplayDonation();
263
- include_once 'inc/setting_sidemenu.php';
264
- }
265
-
266
- // SettingPage
267
- function setting_manage_metabox() {
268
- $this->display_msg();
269
- add_filter( 'admin_footer_text' , array( $this , 'layout_footer' ) );
270
- $this->DisplayDonation();
271
- include_once 'inc/setting_manage_metabox.php';
272
- }
273
-
274
- // SettingPage
275
- function setting_post_add_edit() {
276
- $this->display_msg();
277
- add_filter( 'admin_footer_text' , array( $this , 'layout_footer' ) );
278
- $this->DisplayDonation();
279
- include_once 'inc/setting_post_add_edit.php';
280
- }
281
-
282
- // SettingPage
283
- function setting_appearance_menus() {
284
- $this->display_msg();
285
- add_filter( 'admin_footer_text' , array( $this , 'layout_footer' ) );
286
- $this->DisplayDonation();
287
- include_once 'inc/setting_appearance_menus.php';
288
- }
289
-
290
- // SettingPage
291
- function setting_loginscreen() {
292
- $this->display_msg();
293
- add_filter( 'admin_footer_text' , array( $this , 'layout_footer' ) );
294
- $this->DisplayDonation();
295
- include_once 'inc/setting_loginscreen.php';
296
- }
297
-
298
- // SettingPage
299
- function reset_userrole() {
300
- $this->display_msg();
301
- add_filter( 'admin_footer_text' , array( $this , 'layout_footer' ) );
302
- include_once 'inc/reset_userrole.php';
303
- }
304
-
305
- // SettingPage
306
- function setting_plugin_cap() {
307
- $this->display_msg();
308
- add_filter( 'admin_footer_text' , array( $this , 'layout_footer' ) );
309
- include_once 'inc/setting_plugin_cap.php';
310
- }
311
-
312
-
313
-
314
-
315
-
316
- // GetData
317
- function get_data( $record ) {
318
- $GetData = get_option( $this->Record[$record] );
319
- $GetData = apply_filters( 'wauc_pre_get_data' , $GetData , $record );
320
-
321
- $Data = array();
322
- if( !empty( $GetData ) && !empty( $GetData["UPFN"] ) && $GetData["UPFN"] == $this->UPFN ) {
323
- $Data = $GetData;
324
- }
325
-
326
- return $Data;
327
- }
328
-
329
- // GetData
330
- function get_flit_data( $record ) {
331
- $GetData = get_option( $this->Record[$record] );
332
- $GetData = apply_filters( 'wauc_pre_get_filt_data' , $GetData , $record );
333
-
334
- $Data = array();
335
- if( !empty( $GetData ) && !empty( $GetData["UPFN"] ) && $GetData["UPFN"] == $this->UPFN ) {
336
- $Data = $GetData;
337
- }
338
-
339
- return $Data;
340
- }
341
-
342
-
343
-
344
- // Settingcheck
345
- function settingCheck() {
346
- global $current_screen;
347
-
348
- $Data = $this->get_data( 'user_role' );
349
- if( !empty( $Data["UPFN"] ) ) {
350
- unset( $Data["UPFN"] );
351
- }
352
- if( empty( $Data ) ) {
353
- if( $current_screen->parent_base == $this->PageSlug && $current_screen->id != 'toplevel_page_' . $this->PageSlug ) {
354
- echo '<div class="error"><p><strong>' . sprintf( __( 'Authority to apply the setting is not selected. <a href="%s">From here</a>, please select the permissions you want to set.' , 'wp-admin-ui-customize' ) , admin_url( 'admin.php?page=' . $this->PageSlug ) ) . '</strong></p></div>';
355
- }
356
- }
357
- }
358
-
359
-
360
-
361
-
362
-
363
- // SetList
364
- function get_user_role() {
365
- $editable_roles = get_editable_roles();
366
- foreach ( $editable_roles as $role => $details ) {
367
- $editable_roles[$role]["label"] = translate_user_role( $details['name'] );
368
- }
369
-
370
- return $editable_roles;
371
- }
372
-
373
- // SetList
374
- function get_apply_roles() {
375
-
376
- $apply_user_roles = $this->get_data( 'user_role' );
377
- unset( $apply_user_roles["UPFN"] );
378
-
379
- $Contents = __( 'Apply user roles' , 'wp-admin-ui-customize' ) . ' : ';
380
-
381
- if( !empty( $apply_user_roles ) ) {
382
- $UserRoles = $this->get_user_role();
383
- foreach( $apply_user_roles as $role => $v ) {
384
- if( !empty( $UserRoles[$role] ) ) {
385
- $Contents .= '[ ' . $UserRoles[$role]["label"] . ' ]';
386
- }
387
- }
388
- } else {
389
- $Contents .= __( 'None' );
390
- }
391
-
392
- $Contents = apply_filters( 'wauc_get_apply_roles' , $Contents );
393
-
394
- return $Contents;
395
-
396
- }
397
-
398
- // SetList
399
- function sidemenu_default_load() {
400
- global $menu , $submenu;
401
-
402
- if ( !get_option( 'link_manager_enabled' ) ) {
403
- foreach( $menu as $key => $val ) {
404
- if( !empty( $val[1] ) && $val[1] == 'manage_links' ) {
405
- unset( $menu[$key] );
406
- }
407
- }
408
- }
409
-
410
- $this->Menu = $menu;
411
- $this->SubMenu = $submenu;
412
-
413
- if( !empty( $submenu ) ) {
414
-
415
- foreach( $submenu as $submenu_key => $sm ) {
416
-
417
- if( !empty( $sm ) ) {
418
-
419
- foreach( $sm as $sm_key => $sm_set ) {
420
-
421
- if( preg_match("/^customize.php/", $sm_set[2] ) )
422
- $this->SubMenu[$submenu_key][$sm_key][2] = esc_url( remove_query_arg( array( 'return' ) , $sm_set[2] ) );
423
-
424
- }
425
-
426
- }
427
-
428
- }
429
-
430
- }
431
-
432
- }
433
-
434
- // SetList
435
- function admin_bar_default_load() {
436
- global $wp_admin_bar;
437
-
438
- $this->Admin_bar = $wp_admin_bar->get_nodes();
439
-
440
- // Other plugin
441
- if( !empty( $this->ActivatedPlugin ) ) {
442
-
443
- if( !empty( $this->ActivatedPlugin["buddypress"] ) ) {
444
- $plugin_slug = 'buddypress';
445
- foreach( $this->Admin_bar as $node_id => $node ) {
446
- if( strstr( $node_id , $plugin_slug ) or strstr( $node_id , 'bp-' ) ) {
447
- $this->OtherPluginMenu["admin_bar"][$plugin_slug][$node_id] = 1;
448
- }
449
- }
450
- }
451
-
452
- if( !empty( $this->ActivatedPlugin["post_edit_toolbar"] ) ) {
453
- $plugin_slug = 'post_item_';
454
- foreach( $this->Admin_bar as $node_id => $node ) {
455
- if( strstr( $node_id , $plugin_slug ) ) {
456
- $this->OtherPluginMenu["admin_bar"][$plugin_slug][$node_id] = 1;
457
- }
458
- }
459
- $plugin_slug = 'page_item_';
460
- foreach( $this->Admin_bar as $node_id => $node ) {
461
- if( strstr( $node_id , $plugin_slug ) ) {
462
- $this->OtherPluginMenu["admin_bar"][$plugin_slug][$node_id] = 1;
463
- }
464
- }
465
- }
466
-
467
- if( !empty( $this->ActivatedPlugin["polylang"] ) ) {
468
- $plugin_slug = 'languages';
469
- foreach( $this->Admin_bar as $node_id => $node ) {
470
- if( strstr( $node_id , $plugin_slug ) or strstr( $node->id , $plugin_slug ) ) {
471
- $this->OtherPluginMenu["admin_bar"]['polylang'][$node_id] = 1;
472
- }
473
- }
474
- }
475
-
476
- if( !empty( $this->OtherPluginMenu["admin_bar"] ) ) {
477
- for($i = 0; $i < 4; $i++) {
478
- foreach( $this->OtherPluginMenu["admin_bar"] as $plugin_slug => $plugin_menu ) {
479
- foreach( $this->Admin_bar as $node_id => $node ) {
480
- if( !empty( $node->parent ) && array_key_exists( $node->parent , $plugin_menu ) ) {
481
- $this->OtherPluginMenu["admin_bar"][$plugin_slug][$node_id] = 1;
482
- }
483
- }
484
- }
485
- }
486
- }
487
-
488
- }
489
- }
490
-
491
- // SetList
492
- function admin_bar_filter_load() {
493
- $Default_bar = $this->Admin_bar;
494
-
495
- $Delete_bar = array( "top-secondary" );
496
- foreach( $Delete_bar as $del_name ) {
497
- if( !empty( $Default_bar[$del_name] ) ) {
498
- unset( $Default_bar[$del_name] );
499
- }
500
- }
501
-
502
- // front
503
- $Default_bar["dashboard"] = (object) array( "id" => "dashboard" , "title" => __( 'Dashboard' ) , "parent" => "site-name" , "href" => admin_url() , "group" => false );
504
-
505
- foreach( $Default_bar as $node_id => $node ) {
506
- if( $node->id == 'my-account' ) {
507
- $Default_bar[$node_id]->title = sprintf( __( 'Howdy, %1$s' ) , '[user_name]' ) . '[user_avatar]';
508
- } elseif( $node->id == 'user-info' ) {
509
- $Default_bar[$node_id]->title = '[user_avatar_64]<span class="display-name">[user_name]</span><span class="username">[user_login_name]</span>';
510
- } elseif( $node->id == 'logout' ) {
511
- $Default_bar[$node_id]->href = preg_replace( '/&amp(.*)/' , '' , $node->href );
512
- } elseif( $node->id == 'site-name' ) {
513
- $Default_bar[$node_id]->title = '[blog_name]';
514
- } elseif( $node->id == 'updates' ) {
515
- $Default_bar[$node_id]->title = '[update_total]';
516
- } elseif( $node->id == 'comments' ) {
517
- $Default_bar[$node_id]->title = '[comment_count]';
518
- }
519
- }
520
-
521
- $Filter_bar = array();
522
- $MainMenuIDs = array();
523
-
524
- foreach( $Default_bar as $node_id => $node ) {
525
- if( empty( $node->parent ) ) {
526
- $Filter_bar["left"]["main"][$node_id] = $node;
527
- $MainMenuIDs[$node_id] = "left";
528
- unset( $Default_bar[$node_id] );
529
- } elseif( $node->parent == 'top-secondary' ) {
530
- $Filter_bar["right"]["main"][$node_id] = $node;
531
- $MainMenuIDs[$node_id] = "right";
532
- unset( $Default_bar[$node_id] );
533
- }
534
- }
535
-
536
- // meta field add
537
- foreach( $Default_bar as $node_id => $node ) {
538
- if( !isset( $node->meta ) ) {
539
- $Default_bar[$node_id]->meta = array();
540
- }
541
- }
542
-
543
- // sub node
544
- foreach( $MainMenuIDs as $parent_id => $menu_type ) {
545
- foreach( $Default_bar as $node_id => $node ) {
546
- if( $node->parent == $parent_id ) {
547
- $Filter_bar[$menu_type]["sub"][$node_id] = $node;
548
- unset( $Default_bar[$node_id] );
549
- }
550
- }
551
- }
552
-
553
- $Place_types = $this->admin_bar_places();
554
-
555
- // sub2 node
556
- if( !empty( $Default_bar ) ) {
557
- foreach( $Place_types as $place => $place_label ) {
558
- if( !empty( $Filter_bar[$place]["sub"] ) && $place != 'front' ) {
559
- foreach( $Filter_bar[$place]["sub"] as $parent_id => $parent_node ) {
560
- foreach( $Default_bar as $node_id => $node ) {
561
- if( $node->parent == $parent_id ) {
562
- $Filter_bar[$place]["sub2"][$node_id] = $node;
563
- unset( $Default_bar[$node_id] );
564
- }
565
- }
566
- }
567
- }
568
- }
569
- }
570
-
571
- // sub3 node
572
- if( !empty( $Default_bar ) ) {
573
- foreach( $Place_types as $place => $place_label ) {
574
- if( !empty( $Filter_bar[$place]["sub2"] ) && $place != 'front' ) {
575
- foreach( $Filter_bar[$place]["sub2"] as $parent_id => $parent_node ) {
576
- foreach( $Default_bar as $node_id => $node ) {
577
- if( $node->parent == $parent_id ) {
578
- $Filter_bar[$place]["sub3"][$node_id] = $node;
579
- unset( $Default_bar[$node_id] );
580
- }
581
- }
582
- }
583
- }
584
- }
585
- }
586
-
587
- // sub4 node
588
- if( !empty( $Default_bar ) ) {
589
- foreach( $Place_types as $place => $place_label ) {
590
- if( !empty( $Filter_bar[$place]["sub3"] ) && $place != 'front' ) {
591
- foreach( $Filter_bar[$place]["sub3"] as $parent_id => $parent_node ) {
592
- foreach( $Default_bar as $node_id => $node ) {
593
- if( $node->parent == $parent_id ) {
594
- $Filter_bar[$place]["sub4"][$node_id] = $node;
595
- unset( $Default_bar[$node_id] );
596
- }
597
- }
598
- }
599
- }
600
- }
601
- }
602
-
603
- // front field
604
- $Filter_bar["front"] = array( "main" => array() , "sub" => array() );
605
- $Filter_bar["front"]["main"]["edit-post_type"] = new stdClass;
606
- $Filter_bar["front"]["main"]["edit-post_type"] = (object) array( 'id' => 'edit-post_type' , 'title' => '' , 'href' => '' , 'group' => '' , 'meta' => array() );
607
- $Filter_bar["front"]["main"]["edit-post_type"]->title = sprintf( '%1$s [post_type]' , __( 'Edit' ) );
608
-
609
- $Filter_bar["front"]["main"]["search"] = new stdClass;
610
- $Filter_bar["front"]["main"]["search"] = (object) array( 'id' => 'search' , 'title' => '' , 'href' => '' , 'group' => '' , 'meta' => array() );
611
- $Filter_bar["front"]["main"]["search"]->title = __( 'Search' );
612
- $Filter_bar["front"]["main"]["search"]->href = get_search_link();
613
-
614
- // admin field
615
- $Filter_bar['left']['main']['view-post_type'] = new stdClass;
616
- $Filter_bar['left']['main']['view-post_type'] = (object) array( 'id' => 'view-post_type' , 'title' => '' , 'href' => '' , 'group' => '' , 'meta' => array() );
617
- $Filter_bar['left']['main']['view-post_type']->title = sprintf( '%1$s [post_type]' , __( 'View' ) );
618
-
619
- if( !empty( $this->ActivatedPlugin ) ) {
620
-
621
- if( !empty( $this->ActivatedPlugin["post_edit_toolbar"] ) ) {
622
- $plugin_slug = 'post_item_';
623
- foreach( $Filter_bar['left']['sub'] as $node_id => $node ) {
624
- if( strstr( $node_id , $plugin_slug ) ) {
625
- unset( $Filter_bar['left']['sub'][$node_id] );
626
- }
627
- }
628
- $plugin_slug = 'page_item_';
629
- foreach( $Filter_bar['left']['sub'] as $node_id => $node ) {
630
- if( strstr( $node_id , $plugin_slug ) ) {
631
- unset( $Filter_bar['left']['sub'][$node_id] );
632
- }
633
- }
634
- }
635
-
636
- if( !empty( $this->ActivatedPlugin["polylang"] ) ) {
637
- $plugin_slug = 'languages';
638
- foreach( $Filter_bar['left']['sub'] as $node_id => $node ) {
639
- if( strstr( $node->parent , $plugin_slug ) ) {
640
- unset( $Filter_bar['left']['sub'][$node_id] );
641
- }
642
- }
643
- }
644
-
645
- }
646
-
647
- return $Filter_bar;
648
- }
649
-
650
- // SetList
651
- function post_meta_boxes_dashboard_load() {
652
- global $current_screen;
653
-
654
- $capability = $this->get_plugin_cap();
655
-
656
- if( !empty( $current_screen ) && $current_screen->id == 'dashboard' && current_user_can( $capability ) ) {
657
- global $wp_meta_boxes;
658
-
659
- $post_type = 'dashboard';
660
- $Metaboxes = $wp_meta_boxes[$post_type];
661
-
662
- $Update = array();
663
- $Update["UPFN"] = $this->UPFN;
664
-
665
- if( !empty( $Metaboxes ) ) {
666
- foreach( $Metaboxes as $context => $meta_box ) {
667
- foreach( $meta_box as $priority => $box ) {
668
- if( is_array( $box ) ) {
669
- foreach( $box as $metabox_id => $b ) {
670
- $Update["metaboxes"][$post_type][$context][$priority][$b["id"]] = strip_tags( $b["title"] );
671
- }
672
- }
673
- }
674
- }
675
- }
676
-
677
- if( !empty( $Update ) ) {
678
- update_option( $this->Record["regist_dashboard_metabox"] , $Update );
679
- }
680
-
681
- }
682
-
683
- }
684
-
685
- // SetList
686
- function post_meta_boxes_load() {
687
- global $current_screen;
688
-
689
- $capability = $this->get_plugin_cap();
690
-
691
- if( !empty( $current_screen ) && $current_screen->base == 'post' && current_user_can( $capability ) ) {
692
- global $wp_meta_boxes;
693
-
694
- $regist_meta_boxes = $this->get_data( "regist_metabox" );
695
-
696
- $post_type = $current_screen->post_type;
697
- $Metaboxes = $wp_meta_boxes[$post_type];
698
-
699
- $regist_meta_boxes['UPFN'] = $this->UPFN;
700
-
701
- if( empty( $regist_meta_boxes['metaboxes'][$post_type] ) or !empty( $_GET[$this->ltd . '_metabox_load'] ) ) {
702
-
703
- $regist_meta_boxes['metaboxes'][$post_type] = array();
704
-
705
- }
706
-
707
- if( !empty( $Metaboxes ) ) {
708
-
709
- foreach( $Metaboxes as $context => $meta_box ) {
710
-
711
- foreach( $meta_box as $priority => $box ) {
712
-
713
- if( is_array( $box ) ) {
714
-
715
- foreach( $box as $metabox_id => $metabox_detail ) {
716
-
717
- if( !empty( $metabox_detail ) ) {
718
-
719
- $regist_meta_boxes['metaboxes'][$post_type][$context][$priority][$metabox_id] = strip_tags( $metabox_detail['title'] );
720
-
721
- }
722
-
723
- }
724
-
725
- }
726
-
727
- }
728
-
729
- }
730
-
731
- }
732
-
733
- if( !empty( $regist_meta_boxes ) ) {
734
- update_option( $this->Record["regist_metabox"] , $regist_meta_boxes );
735
- }
736
-
737
- }
738
-
739
- }
740
-
741
- // SetList
742
- function sidebar_menu_widget( $menu_widget ) {
743
- $UserRoles = $this->get_user_role();
744
- $new_widget = '';
745
- if( !empty( $menu_widget["new"] ) ) {
746
- $new_widget = 'new';
747
- }
748
- ?>
749
- <div class="widget <?php echo $menu_widget["slug"]; ?> <?php echo $new_widget; ?>">
750
-
751
- <div class="widget-top">
752
- <div class="widget-title-action">
753
- <a class="widget-action" href="#available"></a>
754
- </div>
755
- <div class="widget-title">
756
- <h4>
757
- <?php echo strip_tags( $menu_widget["title"] ); ?>
758
- : <span class="in-widget-title"><?php echo $menu_widget["slug"]; ?></span>
759
- </h4>
760
- </div>
761
- </div>
762
-
763
- <div class="widget-inside">
764
- <div class="settings">
765
- <p class="description">
766
- <?php if( $menu_widget["slug"] == 'custom_menu' ) : ?>
767
- <?php _e( 'Url' ); ?>:
768
- <input type="text" class="slugtext" value="" name="data[][slug]">
769
- <?php else : ?>
770
- <?php _e( 'Slug' ); ?>: <?php echo $menu_widget["slug"]; ?>
771
- <input type="hidden" class="slugtext" value="<?php echo $menu_widget["slug"]; ?>" name="data[][slug]">
772
- <?php endif; ?>
773
- </p>
774
- <?php _e( 'User Roles' ); ?> :
775
- <ul class="display_roles">
776
- <?php foreach( $UserRoles as $role_name => $val ) : ?>
777
- <?php $has_cap = false; ?>
778
- <?php if( !empty( $val["capabilities"][$menu_widget["cap"]] ) or $role_name == $menu_widget["cap"] ) : ?>
779
- <?php $has_cap = 'has_cap'; ?>
780
- <?php endif; ?>
781
- <li class="<?php echo $role_name; ?> <?php echo $has_cap; ?>"><?php echo $val["label"]; ?></li>
782
- <?php endforeach ;?>
783
- </ul>
784
- <label>
785
- <?php _e( 'Title' ); ?> : <input type="text" class="regular-text titletext" value="<?php echo esc_attr( $menu_widget["title"] ); ?>" name="data[][title]">
786
- </label>
787
- <input type="hidden" class="parent_slugtext" value="<?php echo $menu_widget["parent_slug"]; ?>" name="data[][parent_slug]">
788
- </div>
789
-
790
- <?php if( $menu_widget["slug"] != 'separator' ) : ?>
791
- <div class="submenu">
792
- <p class="description"><?php _e( 'Sub Menus' , 'wp-admin-ui-customize' ); ?></p>
793
- <?php if( empty( $menu_widget["new"] ) && !empty( $menu_widget["submenu"] ) ) : ?>
794
- <?php foreach( $menu_widget["submenu"] as $sm ) : ?>
795
- <?php $sepalator_widget = ''; ?>
796
- <?php if( $sm["slug"] == 'separator' ) : $sepalator_widget = $sm["slug"]; endif; ?>
797
-
798
- <div class="widget <?php echo $sepalator_widget; ?>">
799
-
800
- <div class="widget-top">
801
- <div class="widget-title-action">
802
- <a class="widget-action" href="#available"></a>
803
- </div>
804
- <div class="widget-title">
805
- <h4>
806
- <?php echo strip_tags( $sm["title"] ); ?>
807
- : <span class="in-widget-title"><?php echo $sm["slug"]; ?></span>
808
- </h4>
809
- </div>
810
- </div>
811
-
812
- <div class="widget-inside">
813
- <div class="settings">
814
- <p class="description">
815
- <?php _e( 'Slug' ); ?>: <?php echo $sm["slug"]; ?>
816
- <input type="hidden" class="slugtext" value="<?php echo $sm["slug"]; ?>" name="data[][slug]">
817
- </p>
818
- <?php _e( 'User Roles' ); ?> :
819
- <ul class="display_roles">
820
- <?php foreach( $UserRoles as $role_name => $val ) : ?>
821
- <?php $has_cap = false; ?>
822
- <?php if( !empty( $val["capabilities"][$sm["cap"]] ) or $role_name == $sm["cap"] ) : ?>
823
- <?php $has_cap = 'has_cap'; ?>
824
- <?php endif; ?>
825
- <li class="<?php echo $role_name; ?> <?php echo $has_cap; ?>"><?php echo $val["label"]; ?></li>
826
- <?php endforeach ;?>
827
- </ul>
828
- <label>
829
- <?php _e( 'Title' ); ?> : <input type="text" class="regular-text titletext" value="<?php echo esc_attr( $sm["title"] ); ?>" name="data[][title]">
830
- </label>
831
- <input type="hidden" class="parent_slugtext" value="<?php echo $sm["parent_slug"]; ?>" name="data[][parent_slug]">
832
- </div>
833
- <div class="widget-control-actions">
834
- <div class="alignleft">
835
- <a href="#remove"><?php _e( 'Remove' ); ?></a>
836
- </div>
837
- <div class="clear"></div>
838
- </div>
839
- </div>
840
- </div>
841
-
842
- <?php endforeach; ?>
843
- <?php endif; ?>
844
- </div>
845
- <div class="widget-control-actions">
846
- <div class="alignleft">
847
- <a href="#remove"><?php _e( 'Remove' ); ?></a>
848
- </div>
849
- <div class="clear"></div>
850
- </div>
851
-
852
- <?php endif; ?>
853
- </div>
854
-
855
- </div>
856
- <?php
857
- }
858
-
859
- // SetList
860
- function admin_bar_menu_widget( $Nodes , $menu_widget , $node_type ) {
861
- if ( is_object( $menu_widget ) ) $menu_widget = (array) $menu_widget;
862
- if( !isset( $menu_widget["group"] ) ) $menu_widget["group"] = 0;
863
- if( !isset( $menu_widget["meta"]["class"] ) ) $menu_widget["meta"]["class"] = "";
864
- $no_submenu = array( 'search' , 'bp-notifications' , 'languages' , 'menu-toggle' , 'post_list' , 'page_list' );
865
- $activated_plugin = $this->ActivatedPlugin;
866
- $other_plugin = $this->OtherPluginMenu;
867
-
868
- $widget_class = $menu_widget["id"];
869
- $new_widget = '';
870
- if( !empty( $menu_widget["new"] ) ) {
871
- $new_widget = 'new';
872
- $widget_class .= ' new';
873
- }
874
- if( !empty( $menu_widget["group"] ) ) {
875
- $widget_class .= ' widget-group';
876
- }
877
- ?>
878
- <div class="widget <?php echo $widget_class; ?>">
879
-
880
- <div class="widget-top">
881
- <div class="widget-title-action">
882
- <a class="widget-action" href="#available"></a>
883
- </div>
884
- <div class="widget-title">
885
- <h4>
886
- <?php if( !empty( $menu_widget["group"] ) ) : ?>
887
- <?php _e( 'Menu Group' , 'wp-admin-ui-customize' ); ?>
888
- : <span class="in-widget-title"><?php echo $menu_widget["id"]; ?></span>
889
- <?php elseif( preg_match( '/\<form/' , $menu_widget["title"] ) ) : ?>
890
- <?php echo $menu_widget["id"]; ?>
891
- <?php else: ?>
892
- <?php echo $menu_widget["title"]; ?>
893
- : <span class="in-widget-title"><?php echo $menu_widget["id"]; ?></span>
894
- <?php endif; ?>
895
- </h4>
896
- </div>
897
- </div>
898
-
899
- <div class="widget-inside">
900
- <div class="settings">
901
- <p class="field-url description">
902
- <input type="hidden" class="idtext" value="<?php echo $menu_widget["id"]; ?>" name="data[][id]" />
903
- <?php if( strstr( $menu_widget["id"] , 'custom_node' ) && empty( $menu_widget["group"] ) ) : ?>
904
- URL: <input type="text" class="regular-text linktext" value="<?php echo $menu_widget["href"]; ?>" name="data[][href]" placeholder="http://" />
905
- <?php else: ?>
906
- <?php if( $menu_widget["id"] == 'edit-post_type' ) : ?>
907
- <strong><?php _e( 'Show only on front end.' , 'wp-admin-ui-customize' ); ?></strong>
908
- <?php elseif( !empty( $menu_widget["group"] ) ) : ?>
909
- <strong><?php _e( 'Menu Group' , 'wp-admin-ui-customize' ); ?></strong>
910
- <?php elseif( $menu_widget["id"] == 'menu-toggle' ) : ?>
911
- <strong><?php echo $menu_widget["id"]; ?></strong>
912
- <?php else: ?>
913
- <a href="<?php echo $menu_widget["href"]; ?>" target="_blank"><?php echo $menu_widget["id"]; ?></a>
914
- <?php endif; ?>
915
- <input type="hidden" class="linktext" value="<?php echo $menu_widget["href"]; ?>" name="data[][href]" />
916
- <?php endif; ?>
917
- </p>
918
- <p class="field-title description">
919
- <label>
920
- <?php if( !empty( $menu_widget["group"] ) ) : ?>
921
- <input type="hidden" class="regular-text titletext" value="" name="data[][title]" />
922
- <?php else : ?>
923
- <?php _e( 'Title' ); ?> :
924
-
925
- <?php $readonly_field = false; ?>
926
- <?php if( in_array( $menu_widget["id"] , $no_submenu ) ) : ?>
927
- <?php $readonly_field = true; ?>
928
- <?php elseif( !empty( $activated_plugin ) ) : ?>
929
- <?php foreach( $activated_plugin as $plugin_slug => $v ) : ?>
930
- <?php if( !empty( $other_plugin["admin_bar"][$plugin_slug] ) && array_key_exists( $menu_widget["id"] , $other_plugin["admin_bar"][$plugin_slug] ) ) : ?>
931
- <?php $readonly_field = true; ?>
932
- <?php break; ?>
933
- <?php endif; ?>
934
- <?php endforeach; ?>
935
- <?php endif; ?>
936
- <?php if( $readonly_field ) : ?>
937
- <input type="text" class="regular-text titletext" value="<?php echo esc_html( $menu_widget["title"] ); ?>" name="data[][title]" readonly="readonly" /><br />
938
- <?php else : ?>
939
- <input type="text" class="regular-text titletext" value="<?php echo esc_html( $menu_widget["title"] ); ?>" name="data[][title]" />
940
- <?php endif; ?>
941
- <?php endif; ?>
942
- </label>
943
- </p>
944
- <p class="field-meta description">
945
- <label class="description">
946
- <?php if( !empty( $menu_widget["group"] ) or $menu_widget["id"] == 'menu-toggle' ) : ?>
947
- <input type="hidden" class="meta_target" value="_blank" name="data[][meta][target]" />
948
- <?php else: ?>
949
- <?php $checked = ""; ?>
950
- <?php if( !empty( $menu_widget["meta"]["target"] ) ) : ?>
951
- <?php $checked = checked( $menu_widget["meta"]["target"] , '_blank' , 0 ); ?>
952
- <?php endif; ?>
953
- <input type="checkbox" class="meta_target" value="_blank" name="data[][meta][target]" <?php echo $checked; ?> />
954
- <?php _e( 'Open link in a new window/tab' ); ?>
955
- <?php endif; ?>
956
- </label>
957
- <input type="hidden" class="meta_class" value="<?php echo $menu_widget["meta"]["class"]; ?>" name="data[][meta][class]" />
958
- </p>
959
- <input type="hidden" class="parent" value="<?php echo $menu_widget["parent"]; ?>" name="data[][parent]" />
960
- <input type="hidden" class="group" value="<?php echo $menu_widget["group"]; ?>" name="data[][group]" />
961
- <input type="hidden" class="node_type" value="" name="data[][node_type]" />
962
- </div>
963
-
964
- <?php if( !in_array( $menu_widget["id"] , $no_submenu ) ) : ?>
965
- <div class="submenu">
966
- <p class="description"><?php _e( 'Sub Menus' , 'wp-admin-ui-customize' ); ?></p>
967
-
968
- <?php if( empty( $new_widget ) && !empty( $node_type ) ) : ?>
969
-
970
- <?php $subnode_type = ''; ?>
971
- <?php if( $node_type == 'main' ) : ?>
972
- <?php $subnode_type = 'sub'; ?>
973
- <?php elseif( $node_type == 'sub' ) : ?>
974
- <?php $subnode_type = 'sub2'; ?>
975
- <?php elseif( $node_type == 'sub2' ) : ?>
976
- <?php $subnode_type = 'sub3'; ?>
977
- <?php elseif( $node_type == 'sub3' ) : ?>
978
- <?php $subnode_type = 'sub4'; ?>
979
- <?php endif; ?>
980
-
981
- <?php if( !empty( $subnode_type ) && !empty( $Nodes[$subnode_type] ) ) : ?>
982
- <?php foreach( $Nodes[$subnode_type] as $subnode_id => $subnode ) : ?>
983
- <?php if( is_object( $subnode ) ) $subnode = get_object_vars( $subnode ); ?>
984
- <?php if( $menu_widget["id"] == $subnode["parent"] ) : ?>
985
- <?php array_map( array( $this , 'admin_bar_menu_widget' ) , array( $Nodes ) , array( $subnode ) , array( $subnode_type ) ); ?>
986
- <?php endif; ?>
987
- <?php endforeach; ?>
988
- <?php endif; ?>
989
-
990
- <?php endif; ?>
991
-
992
- </div>
993
- <?php endif; ?>
994
-
995
- <div class="widget-control-actions">
996
- <div class="alignleft">
997
- <a href="#remove"><?php _e( 'Remove' ); ?></a>
998
- </div>
999
- <div class="clear"></div>
1000
- </div>
1001
- </div>
1002
-
1003
- </div>
1004
- <?php
1005
- }
1006
-
1007
- // SetList
1008
- function get_custom_posts() {
1009
- $args = array( );
1010
- $all_custom_posts = get_post_types( $args , 'objects' );
1011
-
1012
- $exclusion = array( "post" , "page" , "attachment" , "revision" , "nav_menu_item");
1013
- $custom_posts = array();
1014
- foreach($all_custom_posts as $post_type => $cpt) {
1015
- if( !in_array( $post_type , $exclusion ) ) {
1016
- if( !empty( $cpt->show_ui ) ) {
1017
- $custom_posts[$post_type] = $cpt;
1018
- }
1019
- }
1020
- }
1021
-
1022
- return $custom_posts;
1023
- }
1024
-
1025
- // SetList
1026
- function val_replace( $str ) {
1027
-
1028
- if( !empty( $str ) ) {
1029
-
1030
- $update_data = wp_get_update_data();
1031
- $awaiting_mod = wp_count_comments();
1032
- $awaiting_mod = $awaiting_mod->moderated;
1033
- $current_user = wp_get_current_user();
1034
- if( is_multisite() ) {
1035
- $current_site = get_current_site();
1036
- }
1037
-
1038
- if( strstr( $str , '[blog_url]') ) {
1039
- $str = str_replace( '[blog_url]' , get_bloginfo( 'url' ) , $str );
1040
- }
1041
- if( strstr( $str , '[template_directory_uri]') ) {
1042
- $str = str_replace( '[template_directory_uri]' , get_bloginfo( 'template_directory' ) , $str );
1043
- }
1044
- if( strstr( $str , '[stylesheet_directory_uri]') ) {
1045
- $str = str_replace( '[stylesheet_directory_uri]' , get_stylesheet_directory_uri() , $str );
1046
- }
1047
- if( strstr( $str , '[blog_name]') ) {
1048
- $str = str_replace( '[blog_name]' , get_bloginfo( 'name' ) , $str );
1049
- }
1050
- if( strstr( $str , '[update_total]') ) {
1051
- $str = str_replace( '[update_total]' , $update_data["counts"]["total"] , $str );
1052
- }
1053
- if( strstr( $str , '[update_total_format]') ) {
1054
- $str = str_replace( '[update_total_format]' , number_format_i18n( $update_data["counts"]["total"] ) , $str );
1055
- }
1056
- if( strstr( $str , '[update_plugins]') ) {
1057
- $str = str_replace( '[update_plugins]' , $update_data["counts"]["plugins"] , $str );
1058
- }
1059
- if( strstr( $str , '[update_plugins_format]') ) {
1060
- $str = str_replace( '[update_plugins_format]' , number_format_i18n( $update_data["counts"]["plugins"] ) , $str );
1061
- }
1062
- if( strstr( $str , '[update_themes]') ) {
1063
- $str = str_replace( '[update_themes]' , $update_data["counts"]["themes"] , $str );
1064
- }
1065
- if( strstr( $str , '[update_themes_format]') ) {
1066
- $str = str_replace( '[update_themes_format]' , number_format_i18n( $update_data["counts"]["themes"] ) , $str );
1067
- }
1068
- if( strstr( $str , '[comment_count]') ) {
1069
- $str = str_replace( '[comment_count]' , $awaiting_mod , $str );
1070
- }
1071
- if( strstr( $str , '[comment_count_format]') ) {
1072
- $str = str_replace( '[comment_count_format]' , number_format_i18n( $awaiting_mod ) , $str );
1073
- }
1074
- if( strstr( $str , '[user_name]') ) {
1075
- $str = str_replace( '[user_name]' , $current_user->display_name , $str );
1076
- }
1077
- if( strstr( $str , '[user_login_name]') ) {
1078
- $str = str_replace( '[user_login_name]' , $current_user->user_login , $str );
1079
- }
1080
- if( strstr( $str , '[user_avatar]') ) {
1081
- $str = str_replace( '[user_avatar]' , get_avatar( $current_user->ID , 16 ) , $str );
1082
- }
1083
- if( strstr( $str , '[user_avatar_64]') ) {
1084
- $str = str_replace( '[user_avatar_64]' , get_avatar( $current_user->ID , 64 ) , $str );
1085
- }
1086
- if( strstr( $str , '[post_type]') ) {
1087
-
1088
- $post_name = '';
1089
-
1090
- if( is_admin() ) {
1091
-
1092
- global $current_screen;
1093
- global $typenow;
1094
- global $tax;
1095
-
1096
- if( $current_screen->base == 'edit' or $current_screen->base == 'post' && !empty( $typenow ) ) {
1097
-
1098
- $post_type_object = get_post_type_object( $typenow );
1099
-
1100
- if( !empty( $post_type_object->public ) ) {
1101
-
1102
- $post_name = $post_type_object->labels->singular_name;
1103
-
1104
- }
1105
-
1106
- } elseif( $current_screen->base == 'edit-tags' && !empty( $tax ) ) {
1107
-
1108
- if( !empty( $tax->public ) ) {
1109
-
1110
- $post_name = $tax->labels->singular_name;
1111
-
1112
- }
1113
-
1114
- }
1115
-
1116
-
1117
- } else {
1118
-
1119
- $queried_object = get_queried_object();
1120
-
1121
- if( !empty( $queried_object->post_type ) ) {
1122
-
1123
- $post_type_object = get_post_type_object( $queried_object->post_type );
1124
-
1125
- if( !empty( $post_type_object->public ) ) {
1126
-
1127
- $post_name = $post_type_object->labels->singular_name;
1128
-
1129
- }
1130
-
1131
- } elseif( !empty( $queried_object->taxonomy ) ) {
1132
-
1133
- $tax = get_taxonomy( $queried_object->taxonomy );
1134
-
1135
- if( !empty( $tax->public ) ) {
1136
-
1137
- $post_name = $tax->labels->singular_name;
1138
-
1139
- }
1140
-
1141
- }
1142
-
1143
- }
1144
-
1145
- $str = str_replace( '[post_type]' , $post_name , $str );
1146
-
1147
- }
1148
-
1149
- if( is_multisite() ) {
1150
- if( strstr( $str , '[site_name]') ) {
1151
- $str = str_replace( '[site_name]' , esc_attr( $current_site->site_name ) , $str );
1152
- }
1153
- if( strstr( $str , '[site_url]') ) {
1154
- $str = str_replace( '[site_url]' , $this->Schema . esc_attr( $current_site->domain . $current_site->path ) , $str );
1155
- }
1156
- }
1157
-
1158
- if( !empty( $this->ActivatedPlugin ) ) {
1159
-
1160
- $activated_plugins = $this->ActivatedPlugin;
1161
-
1162
- if( !empty( $activated_plugins['woocommerce'] ) ) {
1163
-
1164
- if( strstr( $str , '[woocommerce_order_process_count]') ) {
1165
-
1166
- $woocommerce_order_process_count = '';
1167
- if( function_exists( 'wc_processing_order_count' ) ) {
1168
-
1169
- $order_count = intval( wc_processing_order_count() );
1170
- if ( !empty( $order_count ) ) {
1171
- $woocommerce_order_process_count = ' <span class="awaiting-mod update-plugins count-' . $order_count . '"><span class="processing-count">' . number_format_i18n( $order_count ) . '</span></span>';
1172
- }
1173
- }
1174
-
1175
- $str = str_replace( '[woocommerce_order_process_count]' , $woocommerce_order_process_count , $str );
1176
- }
1177
-
1178
- }
1179
-
1180
- }
1181
-
1182
- }
1183
-
1184
- return $str;
1185
- }
1186
-
1187
- // SetList
1188
- function current_user_role_group() {
1189
- $UserRole = '';
1190
- $User = wp_get_current_user();
1191
- if( !empty( $User->roles ) ) {
1192
- $current_roles = $User->roles;
1193
- foreach( $current_roles as $role ) {
1194
- $UserRole = $role;
1195
- break;
1196
- }
1197
- }
1198
- if( empty( $UserRole ) && is_multisite() ) {
1199
- $current_site = get_current_site();
1200
- switch_to_blog( $current_site->blog_id );
1201
- $User = wp_get_current_user();
1202
- if( !empty( $User->roles ) ) {
1203
- $current_roles = $User->roles;
1204
- foreach( $current_roles as $role ) {
1205
- $UserRole = $role;
1206
- break;
1207
- }
1208
- }
1209
- restore_current_blog();
1210
- }
1211
- return $UserRole;
1212
- }
1213
-
1214
- // SetList
1215
- function admin_bar_places() {
1216
- return $Place_types = array( "left" => __( 'Left' ) , "right" => __( 'Right' ) , "front" => __( 'Front' , 'wp-admin-ui-customize' ) );
1217
- }
1218
-
1219
- // SetList
1220
- function get_plugin_cap() {
1221
- $capability = 'manage_options';
1222
-
1223
- $Data = $this->get_data( 'plugin_cap' );
1224
- if( !empty( $Data["edit_cap"] ) ) {
1225
- $capability = $Data["edit_cap"];
1226
- }
1227
-
1228
- return $capability;
1229
- }
1230
-
1231
- // SetList
1232
- function get_document_link( $document_type ) {
1233
-
1234
- $link = $this->Site;
1235
- $locale = get_locale();
1236
-
1237
- if( !empty( $document_type ) ) {
1238
-
1239
- if( $locale == 'ja' ) {
1240
- $link .= 'ja/';
1241
- } else {
1242
- $link .= 'blog/';
1243
- }
1244
-
1245
- if( $document_type == 'admin_bar' ) {
1246
- $link .= 'admin-bar-toolbar-settings/';
1247
- }
1248
-
1249
- }
1250
-
1251
- echo $link;
1252
-
1253
- }
1254
-
1255
-
1256
-
1257
-
1258
- // DataUpdate
1259
- function dataUpdate() {
1260
-
1261
- $RecordField = false;
1262
-
1263
- if( !empty( $_POST[$this->Nonces["field"]] ) ) {
1264
-
1265
- if( !empty( $_POST["record_field"] ) ) {
1266
- $RecordField = strip_tags( $_POST["record_field"] );
1267
- }
1268
-
1269
- if( !empty( $RecordField ) && !empty( $_POST["update"] ) ) {
1270
-
1271
- if( $RecordField == 'user_role' ) {
1272
- $this->update_userrole();
1273
- } elseif( $RecordField == 'site' ) {
1274
- $this->update_site();
1275
- } elseif( $RecordField == 'admin_general' ) {
1276
- $this->update_admin_general();
1277
- } elseif( $RecordField == 'dashboard' ) {
1278
- $this->update_dashboard();
1279
- } elseif( $RecordField == 'admin_bar_menu' ) {
1280
- $this->update_admin_bar_menu();
1281
- } elseif( $RecordField == 'sidemenu' ) {
1282
- $this->update_sidemenu();
1283
- } elseif( $RecordField == 'manage_metabox' ) {
1284
- $this->update_manage_metabox();
1285
- } elseif( $RecordField == 'post_add_edit' ) {
1286
- $this->update_post_add_edit();
1287
- } elseif( $RecordField == 'appearance_menus' ) {
1288
- $this->update_appearance_menus();
1289
- } elseif( $RecordField == 'loginscreen' ) {
1290
- $this->update_loginscreen();
1291
- } elseif( $RecordField == 'plugin_cap' ) {
1292
- $this->update_plugincap();
1293
- }
1294
-
1295
- }
1296
-
1297
-
1298
- if( !empty( $RecordField ) && !empty( $_POST["reset"] ) ) {
1299
-
1300
- if( $RecordField == 'manage_metabox' ) {
1301
- delete_option( $this->Record["regist_metabox"] );
1302
- } elseif( $RecordField == 'dashboard' ) {
1303
- delete_option( $this->Record["regist_dashboard_metabox"] );
1304
- }
1305
-
1306
- if( $RecordField == 'all_settings' ) {
1307
- $this->update_reset_all();
1308
- } else {
1309
- $this->update_reset( $RecordField );
1310
- }
1311
- }
1312
-
1313
- if( !empty( $_POST["donate_key"] ) && !empty( $_POST["update"] ) ) {
1314
- $this->DonatingCheck();
1315
- }
1316
- }
1317
-
1318
- }
1319
-
1320
- // DataUpdate
1321
- function update_validate() {
1322
- $Update = array();
1323
-
1324
- if( !empty( $_POST[$this->UPFN] ) ) {
1325
- $UPFN = strip_tags( $_POST[$this->UPFN] );
1326
- if( $UPFN == $this->UPFN ) {
1327
- $Update["UPFN"] = strip_tags( $_POST[$this->UPFN] );
1328
- }
1329
- }
1330
-
1331
- return $Update;
1332
- }
1333
-
1334
- // DataUpdate
1335
- function update_reset( $record ) {
1336
- $Update = $this->update_validate();
1337
- if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1338
- $record = apply_filters( 'wauc_pre_delete' , $this->Record[$record] );
1339
- delete_option( $record );
1340
- wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'delete' , stripslashes( $_POST["_wp_http_referer"] ) ) ) );
1341
- exit;
1342
- }
1343
- }
1344
-
1345
- // DataUpdate
1346
- function update_reset_all() {
1347
- $Update = $this->update_validate();
1348
- if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1349
-
1350
- foreach( $this->Record as $key => $record ) {
1351
- if( $key != 'donate' ) {
1352
- delete_option( $record );
1353
- }
1354
- }
1355
- wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'delete' , stripslashes( $_POST["_wp_http_referer"] ) ) ) );
1356
- exit;
1357
- }
1358
- }
1359
-
1360
- // DataUpdate
1361
- function DonatingCheck() {
1362
- $Update = $this->update_validate();
1363
-
1364
- if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1365
- if( !empty( $_POST["donate_key"] ) ) {
1366
- $SubmitKey = md5( strip_tags( $_POST["donate_key"] ) );
1367
- if( $this->DonateKey == $SubmitKey ) {
1368
- update_option( $this->Record["donate"] , $SubmitKey );
1369
- wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'donated' ) ) );
1370
- exit;
1371
- }
1372
- }
1373
- }
1374
-
1375
- }
1376
-
1377
- // DataUpdate
1378
- function update_userrole() {
1379
- $Update = $this->update_validate();
1380
- if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1381
-
1382
- if( !empty( $_POST["data"]["user_role"] ) ) {
1383
- foreach($_POST["data"]["user_role"] as $key => $val) {
1384
- $tmpK = strip_tags( $key );
1385
- $tmpV = strip_tags ( $val );
1386
- $Update[$tmpK] = $tmpV;
1387
- }
1388
- }
1389
-
1390
- update_option( $this->Record["user_role"] , $Update );
1391
- wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'update' , stripslashes( $_POST["_wp_http_referer"] ) ) ) );
1392
- exit;
1393
- }
1394
- }
1395
-
1396
- // DataUpdate
1397
- function update_site() {
1398
- $Update = $this->update_validate();
1399
- if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1400
-
1401
- if( !empty( $_POST["data"] ) ) {
1402
- foreach($_POST["data"] as $key => $val) {
1403
- $tmpK = strip_tags( $key );
1404
- $tmpV = strip_tags ( $val );
1405
- $Update[$tmpK] = $tmpV;
1406
- }
1407
- }
1408
-
1409
- $Record = apply_filters( 'wauc_pre_update' , $this->Record["site"] );
1410
- update_option( $Record , $Update );
1411
- wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'update' , stripslashes( $_POST["_wp_http_referer"] ) ) ) );
1412
- exit;
1413
- }
1414
- }
1415
-
1416
- // DataUpdate
1417
- function update_admin_general() {
1418
- $Update = $this->update_validate();
1419
- if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1420
-
1421
- if( !empty( $_POST["data"] ) ) {
1422
- foreach($_POST["data"] as $key => $val) {
1423
- $tmpK = strip_tags( $key );
1424
- $tmpV = $val;
1425
- $Update[$tmpK] = $tmpV;
1426
- }
1427
- }
1428
-
1429
- $Record = apply_filters( 'wauc_pre_update' , $this->Record["admin_general"] );
1430
- update_option( $Record , $Update );
1431
- wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'update' , stripslashes( $_POST["_wp_http_referer"] ) ) ) );
1432
- exit;
1433
- }
1434
- }
1435
-
1436
- // DataUpdate
1437
- function update_dashboard() {
1438
- $Update = $this->update_validate();
1439
- if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1440
-
1441
- if( !empty( $_POST["data"] ) ) {
1442
- foreach($_POST["data"] as $key => $val) {
1443
- $tmpK = strip_tags( $key );
1444
- $tmpV = $val;
1445
- $Update[$tmpK] = $tmpV;
1446
- }
1447
- }
1448
-
1449
- $Record = apply_filters( 'wauc_pre_update' , $this->Record["dashboard"] );
1450
- update_option( $Record , $Update );
1451
- wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'update' , stripslashes( $_POST["_wp_http_referer"] ) ) ) );
1452
- exit;
1453
- }
1454
- }
1455
-
1456
- // DataUpdate
1457
- function update_admin_bar_menu() {
1458
- $Update = $this->update_validate();
1459
- if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1460
-
1461
- if( !empty( $_POST["data"] ) ) {
1462
- foreach($_POST["data"] as $boxtype => $nodes) {
1463
- if( $boxtype === 'left' or $boxtype === 'right' ) {
1464
- foreach($nodes as $key => $node) {
1465
- $id = "";
1466
- if( !empty( $node["id"] ) ) {
1467
- $id = strip_tags( $node["id"] );
1468
- }
1469
- $title = "";
1470
- if( !empty( $node["title"] ) ) {
1471
- $title = stripslashes( $node["title"] );
1472
- }
1473
- $href = "";
1474
- if( !empty( $node["href"] ) ) {
1475
- $href = strip_tags( $node["href"] );
1476
- }
1477
- $group = "";
1478
- if( !empty( $node["group"] ) ) {
1479
- $group = intval( $node["group"] );
1480
- }
1481
- $parent = "";
1482
- if( !empty( $node["parent"] ) ) {
1483
- $parent = strip_tags( $node["parent"] );
1484
- }
1485
- $node_type = "";
1486
- if( !empty( $node["node_type"] ) ) {
1487
- $node_type = strip_tags( $node["node_type"] );
1488
- }
1489
- $meta = array();
1490
- if( !empty( $node["meta"] ) ) {
1491
- foreach( $node["meta"] as $mk => $mv ) {
1492
- if( !empty( $mv ) ) {
1493
- $meta[strip_tags($mk)] = strip_tags($mv);
1494
- }
1495
- }
1496
- }
1497
-
1498
- $Update[$boxtype][$node_type][] = array( "id" => $id , "title" => $title , "href" => $href , "parent" => $parent , "group" => $group , "meta" => $meta );
1499
- }
1500
- }
1501
- }
1502
- }
1503
-
1504
- $Record = apply_filters( 'wauc_pre_update' , $this->Record["admin_bar_menu"] );
1505
- update_option( $Record , $Update );
1506
- wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'update' , stripslashes( $_POST["_wp_http_referer"] ) ) ) );
1507
- exit;
1508
- }
1509
- }
1510
-
1511
- // DataUpdate
1512
- function update_sidemenu() {
1513
- $Update = $this->update_validate();
1514
- if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1515
-
1516
- if( !empty( $_POST["data"] ) ) {
1517
- foreach($_POST["data"] as $menu) {
1518
- if( !empty( $menu["title"] ) && !empty( $menu["slug"] ) ) {
1519
- $slug = htmlspecialchars( $menu["slug"] );
1520
- $title = stripslashes( $menu["title"] );
1521
- $parent_slug = '';
1522
- $depth = 'main';
1523
-
1524
- if( !empty( $menu["parent_slug"] ) ) {
1525
- $parent_slug = strip_tags( $menu["parent_slug"] );
1526
- $depth = 'sub';
1527
- }
1528
-
1529
- $Update[$depth][] = array( "slug" => $slug , "title" => $title , "parent_slug" => $parent_slug );
1530
- }
1531
- }
1532
- }
1533
-
1534
- $Record = apply_filters( 'wauc_pre_update' , $this->Record["sidemenu"] );
1535
- update_option( $Record , $Update );
1536
- wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'update' , stripslashes( $_POST["_wp_http_referer"] ) ) ) );
1537
- exit;
1538
- }
1539
- }
1540
-
1541
- // DataUpdate
1542
- function update_manage_metabox() {
1543
- $Update = $this->update_validate();
1544
- if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1545
-
1546
- if( !empty( $_POST["data"] ) ) {
1547
- foreach($_POST["data"] as $post_type => $val) {
1548
- $post_type = strip_tags( $post_type );
1549
- if( is_array( $val ) ) {
1550
- foreach($val as $id => $v) {
1551
- $tmpK = strip_tags( $id );
1552
- $tmpV = $v;
1553
- $Update[$post_type][$tmpK] = $tmpV;
1554
- }
1555
- }
1556
- }
1557
- }
1558
-
1559
- $Record = apply_filters( 'wauc_pre_update' , $this->Record["manage_metabox"] );
1560
- update_option( $Record , $Update );
1561
- wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'update' , stripslashes( $_POST["_wp_http_referer"] ) ) ) );
1562
- exit;
1563
- }
1564
- }
1565
-
1566
- // DataUpdate
1567
- function update_post_add_edit() {
1568
- $Update = $this->update_validate();
1569
- if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1570
-
1571
- if( !empty( $_POST["data"] ) ) {
1572
- foreach($_POST["data"] as $edited => $val) {
1573
- $tmpK = strip_tags( $edited );
1574
- $tmpV = strip_tags ( $val );
1575
- $Update[$tmpK] = $tmpV;
1576
- }
1577
- }
1578
-
1579
- $Record = apply_filters( 'wauc_pre_update' , $this->Record["post_add_edit"] );
1580
- update_option( $Record , $Update );
1581
- wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'update' , stripslashes( $_POST["_wp_http_referer"] ) ) ) );
1582
- exit;
1583
- }
1584
- }
1585
-
1586
- // DataUpdate
1587
- function update_appearance_menus() {
1588
- $Update = $this->update_validate();
1589
- if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1590
-
1591
- if( !empty( $_POST["data"] ) ) {
1592
- foreach($_POST["data"] as $edited => $val) {
1593
- $tmpK = strip_tags( $edited );
1594
- $tmpV = strip_tags ( $val );
1595
- $Update[$tmpK] = $tmpV;
1596
- }
1597
- }
1598
-
1599
- $Record = apply_filters( 'wauc_pre_update' , $this->Record["appearance_menus"] );
1600
- update_option( $Record , $Update );
1601
- wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'update' , stripslashes( $_POST["_wp_http_referer"] ) ) ) );
1602
- exit;
1603
- }
1604
- }
1605
-
1606
- // DataUpdate
1607
- function update_loginscreen() {
1608
- $Update = $this->update_validate();
1609
- if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1610
-
1611
- if( !empty( $_POST["data"] ) ) {
1612
- foreach($_POST["data"] as $key => $val) {
1613
- $tmpK = strip_tags( $key );
1614
- $tmpV = $val;
1615
- $Update[$tmpK] = $tmpV;
1616
- }
1617
- }
1618
-
1619
- $Record = apply_filters( 'wauc_pre_update' , $this->Record["loginscreen"] );
1620
- update_option( $Record , $Update );
1621
- wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'update' , stripslashes( $_POST["_wp_http_referer"] ) ) ) );
1622
- exit;
1623
-
1624
- }
1625
- }
1626
-
1627
- // DataUpdate
1628
- function update_plugincap() {
1629
- $Update = $this->update_validate();
1630
- if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1631
-
1632
- if( !empty( $_POST["data"]["edit_cap"] ) ) {
1633
- $Update["edit_cap"] = strip_tags( $_POST["data"]["edit_cap"] );
1634
- }
1635
-
1636
- $Record = apply_filters( 'wauc_pre_update' , $this->Record["plugin_cap"] );
1637
- update_option( $Record , $Update );
1638
- wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'update' , stripslashes( $_POST["_wp_http_referer"] ) ) ) );
1639
- exit;
1640
-
1641
- }
1642
- }
1643
-
1644
-
1645
-
1646
-
1647
-
1648
- // FilterStart
1649
- function FilterStart() {
1650
-
1651
- // site
1652
- if( !is_admin() ) {
1653
- add_action( 'wp_loaded' , array( $this , 'remove_action_front' ) ) ;
1654
- add_filter( 'login_headerurl' , array( $this , 'login_headerurl' ) );
1655
- add_filter( 'login_headertitle' , array( $this , 'login_headertitle' ) );
1656
- add_action( 'login_head' , array( $this , 'login_head' ) );
1657
- add_action( 'login_footer' , array( $this , 'login_footer' ) );
1658
-
1659
- // front init
1660
- add_action( 'wp_loaded' , array( $this , 'front_init' ) );
1661
- }
1662
-
1663
- // admin UI
1664
- if( is_admin() && !is_network_admin () ) {
1665
- // admin init
1666
- add_action( 'wp_loaded' , array( $this , 'admin_init' ) );
1667
- }
1668
-
1669
- }
1670
-
1671
- // FilterStart
1672
- function admin_init() {
1673
-
1674
- $SettingRole = $this->get_data( 'user_role' );
1675
- $SettingRole = apply_filters( 'wauc_pre_setting_roles' , $SettingRole );
1676
-
1677
- if( !empty( $SettingRole ) ) {
1678
- unset($SettingRole["UPFN"]);
1679
-
1680
- $UserRole = $this->current_user_role_group();
1681
-
1682
- if( !is_network_admin() && !empty( $UserRole ) ) {
1683
- if( array_key_exists( $UserRole , $SettingRole ) ) {
1684
- add_action( 'wp_before_admin_bar_render' , array( $this , 'admin_bar_menu') , 25 );
1685
- add_action( 'wp_loaded' , array( $this , 'notice_dismiss' ) , 2 );
1686
- add_action( 'admin_head' , array( $this , 'remove_tab' ) );
1687
- add_filter( 'admin_footer_text' , array( $this , 'admin_footer_text' ) );
1688
- add_action( 'admin_print_styles' , array( $this , 'load_css' ) );
1689
- add_action( 'wp_dashboard_setup' , array( $this , 'wp_dashboard_setup' ) , 10001 );
1690
- add_action( 'admin_head' , array( $this , 'manage_metabox' ) , 10001 );
1691
- add_filter( 'admin_head', array( $this , 'sidemenu' ) );
1692
- add_filter( 'get_sample_permalink_html' , array( $this , 'add_edit_post_change_permalink' ) );
1693
- add_filter( 'edit_form_after_title' , array( $this , 'allow_comments' ) );
1694
- add_action( 'admin_print_styles-nav-menus.php', array( $this , 'nav_menus' ) );
1695
- add_filter( 'admin_title', array( $this, 'admin_title' ) );
1696
- add_action( 'admin_footer' , array( $this , 'admin_bar_resizing' ) );
1697
- }
1698
- }
1699
- }
1700
- }
1701
-
1702
- // FilterStart
1703
- function front_init() {
1704
-
1705
- $SettingRole = $this->get_flit_data( 'user_role' );
1706
- $SettingRole = apply_filters( 'wauc_pre_setting_roles' , $SettingRole );
1707
-
1708
- if( !empty( $SettingRole ) ) {
1709
- unset($SettingRole["UPFN"]);
1710
-
1711
- $UserRole = $this->current_user_role_group();
1712
-
1713
- if( !is_network_admin() && !empty( $UserRole ) ) {
1714
- if( array_key_exists( $UserRole , $SettingRole ) ) {
1715
-
1716
- add_action( 'wp_footer' , array( $this , 'admin_bar_resizing' ) );
1717
- add_action( 'wp_loaded' , array( $this , 'notice_dismiss' ) , 2 );
1718
-
1719
- $GetData = $this->get_flit_data( 'site' );
1720
-
1721
- if( !empty( $GetData["admin_bar"] ) ) {
1722
- if( $GetData["admin_bar"] == "hide" ) {
1723
- add_filter( 'show_admin_bar' , '__return_false' );
1724
- } elseif( $GetData["admin_bar"] == "front" ) {
1725
- add_action( 'wp_before_admin_bar_render' , array( $this , 'admin_bar_menu') , 25 );
1726
- }
1727
- }
1728
- }
1729
- }
1730
- }
1731
- }
1732
-
1733
- // FilterStart
1734
- function remove_action_front() {
1735
- $GetData = get_option( $this->Record['site'] );
1736
-
1737
- if( !empty( $GetData["UPFN"] ) ) {
1738
- unset( $GetData["UPFN"] );
1739
- foreach($GetData as $key => $val) {
1740
- if( $key == 'feed_links' ) {
1741
- remove_action( 'wp_head', $key , 2 );
1742
- } elseif( $key == 'feed_links_extra' ) {
1743
- remove_action( 'wp_head', $key , 3 );
1744
- } else {
1745
- remove_action( 'wp_head', $key );
1746
- }
1747
- }
1748
- }
1749
- }
1750
-
1751
- // FilterStart
1752
- function login_headerurl() {
1753
- $GetData = get_option( $this->Record["loginscreen"] );
1754
-
1755
- $url = __( 'http://wordpress.org/' );
1756
- if( !empty( $GetData["UPFN"] ) ) {
1757
- unset( $GetData["UPFN"] );
1758
-
1759
- if( !empty( $GetData["login_headerurl"] ) ) {
1760
- $url = strip_tags( $GetData["login_headerurl"] );
1761
- $url = $this->val_replace( $url );
1762
- }
1763
- }
1764
-
1765
- return $url;
1766
- }
1767
-
1768
- // FilterStart
1769
- function login_headertitle() {
1770
- $GetData = get_option( $this->Record["loginscreen"] );
1771
-
1772
- $title = __( 'Powered by WordPress' );
1773
- if( !empty( $GetData["UPFN"] ) ) {
1774
- unset( $GetData["UPFN"] );
1775
-
1776
- if( !empty( $GetData["login_headertitle"] ) ) {
1777
- $title = strip_tags( $GetData["login_headertitle"] );
1778
- $title = $this->val_replace( $title );
1779
- }
1780
- }
1781
-
1782
- return $title;
1783
- }
1784
-
1785
- // FilterStart
1786
- function login_head() {
1787
- $GetData = get_option( $this->Record["loginscreen"] );
1788
-
1789
- if( !empty( $GetData["UPFN"] ) ) {
1790
- unset( $GetData["UPFN"] );
1791
-
1792
- if( !empty( $GetData["login_headerlogo"] ) ) {
1793
- $logo = strip_tags( $GetData["login_headerlogo"] );
1794
- $logo = $this->val_replace( $logo );
1795
-
1796
- echo '<style type="text/css">.login h1 a { background-image: url(' . $logo . '); }</style>';
1797
- }
1798
-
1799
- if( !empty( $GetData["login_css"] ) ) {
1800
- $css = strip_tags( $GetData["login_css"] );
1801
- $css = $this->val_replace( $css );
1802
-
1803
- wp_enqueue_style( $this->PageSlug , $css , array() , $this->Ver );
1804
- }
1805
-
1806
- }
1807
-
1808
- }
1809
-
1810
- // FilterStart
1811
- function login_footer() {
1812
- $GetData = get_option( $this->Record["loginscreen"] );
1813
-
1814
- if( !empty( $GetData["UPFN"] ) ) {
1815
- unset( $GetData["UPFN"] );
1816
-
1817
- if( !empty( $GetData["login_footer"] ) ) {
1818
- $text = $this->val_replace( stripslashes( $GetData["login_footer"] ) );
1819
-
1820
- echo $text;
1821
- }
1822
-
1823
- }
1824
- }
1825
-
1826
- // FilterStart
1827
- function admin_bar_menu() {
1828
- global $wp_admin_bar;
1829
-
1830
- if( empty( $wp_admin_bar ) ) {
1831
-
1832
- return false;
1833
-
1834
- }
1835
-
1836
- $GetData = $this->get_flit_data( 'admin_bar_menu' );
1837
-
1838
- if( !empty( $GetData["UPFN"] ) ) {
1839
- unset( $GetData["UPFN"] );
1840
- if( is_array( $GetData ) ) {
1841
-
1842
- // admin bar initialize nodes
1843
- $All_Nodes = $wp_admin_bar->get_nodes();
1844
- foreach( $All_Nodes as $node ) {
1845
- if( $node->id != 'top-secondary' ) {
1846
- $wp_admin_bar->remove_node( $node->id );
1847
- }
1848
- }
1849
-
1850
- $SettingNodes = $GetData;
1851
- $user_id = get_current_user_id();
1852
- $current_user = wp_get_current_user();
1853
- $profile_url = get_edit_profile_url( $user_id );
1854
- $update_data = wp_get_update_data();
1855
- $activated_plugin = $this->ActivatedPlugin;
1856
- $other_plugin = $this->OtherPluginMenu;
1857
-
1858
- // all nodes adjustment
1859
- foreach($SettingNodes as $Boxtype => $allnodes) {
1860
- foreach($allnodes as $node_type => $nodes) {
1861
- foreach($nodes as $key => $node) {
1862
-
1863
- if( strstr( $node["id"] , 'custom_node' ) ) {
1864
- if( !empty( $node["group"] ) ) {
1865
- $node["meta"]["class"] = 'ab-sub-secondary';
1866
- } else {
1867
- $node["href"] = $this->val_replace( $node["href"] );
1868
- }
1869
- } elseif( $node["id"] == 'view-post_type' ) {
1870
-
1871
- if( is_admin() ) {
1872
-
1873
- if( !empty( $All_Nodes['preview'] ) ) {
1874
-
1875
- $node["href"] = $All_Nodes['preview']->href;
1876
- $node["meta"] = $All_Nodes['preview']->meta;
1877
-
1878
- } elseif( !empty( $All_Nodes['view'] ) ) {
1879
-
1880
- $node["href"] = $All_Nodes['view']->href;
1881
- $node["meta"] = $All_Nodes['view']->meta;
1882
-
1883
- } else {
1884
-
1885
- unset( $SettingNodes[$Boxtype][$node_type][$key] );
1886
- continue;
1887
-
1888
- }
1889
-
1890
- } else {
1891
-
1892
- unset( $SettingNodes[$Boxtype][$node_type][$key] );
1893
- continue;
1894
-
1895
- }
1896
-
1897
- } elseif( $node["id"] == 'edit-post_type' ) {
1898
-
1899
- if( !empty( $All_Nodes["edit"] ) ) {
1900
-
1901
- //$node["title"] = $All_Nodes["edit"]->title;
1902
- $node["href"] = $All_Nodes["edit"]->href;
1903
- $node["id"] = $All_Nodes["edit"]->id;
1904
-
1905
- } else {
1906
-
1907
- unset( $SettingNodes[$Boxtype][$node_type][$key] );
1908
- continue;
1909
-
1910
- }
1911
-
1912
- } elseif( $node["id"] == 'search' ) {
1913
- if( !empty( $All_Nodes["search"] ) ) {
1914
- $node["title"] = $All_Nodes["search"]->title;
1915
- $node["id"] = $All_Nodes["search"]->id;
1916
- $node["href"] = "";
1917
- $node["meta"]["class"] = $All_Nodes["search"]->meta["class"];
1918
- } else {
1919
- unset( $SettingNodes[$Boxtype][$node_type][$key] );
1920
- continue;
1921
- }
1922
- } elseif( !empty( $All_Nodes[$node["id"]] ) ) {
1923
- if( $node["id"] == 'search' ) {
1924
- $node["href"] = $All_Nodes[$node["id"]]->href;
1925
- $node["title"] = $All_Nodes[$node["id"]]->title;
1926
- } else {
1927
- $node["href"] = $All_Nodes[$node["id"]]->href;
1928
- }
1929
- } else {
1930
- unset( $SettingNodes[$Boxtype][$node_type][$key] );
1931
- continue;
1932
- }
1933
- if( !empty( $All_Nodes[$node["id"]]->meta["title"] ) ) {
1934
- $node["meta"]["title"] = $All_Nodes[$node["id"]]->meta["title"];
1935
- }
1936
- if( $Boxtype == 'right' && $node_type == 'main' ) {
1937
- $node["parent"] = "top-secondary";
1938
- }
1939
- if( strstr( $node["title"] , '[comment_count]') ) {
1940
- if ( !current_user_can('edit_posts') ) {
1941
- unset( $SettingNodes[$Boxtype][$node_type][$key] );
1942
- continue;
1943
- } else {
1944
- $node["title"] = str_replace( '[comment_count]' , '<span class="ab-icon"></span><span id="ab-awaiting-mod" class="ab-label awaiting-mod pending-count count-[comment_count]">[comment_count_format]</span>' , $node["title"] );
1945
- }
1946
- }
1947
- if( strstr( $node["title"] , '[update_total]') ) {
1948
- if ( !$update_data['counts']['total'] ) {
1949
- unset( $SettingNodes[$Boxtype][$node_type][$key] );
1950
- continue;
1951
- } else {
1952
- $node["title"] = str_replace( '[update_total]' , '<span class="ab-icon"></span><span class="ab-label">[update_total_format]</span>' , $node["title"] );
1953
- }
1954
- }
1955
- if( strstr( $node["title"] , '[update_plugins]') ) {
1956
- if ( !$update_data['counts']['plugins'] ) {
1957
- unset( $SettingNodes[$Boxtype][$node_type][$key] );
1958
- continue;
1959
- } else {
1960
- $node["title"] = str_replace( '[update_plugins]' , '[update_plugins_format]' , $node["title"] );
1961
- }
1962
- }
1963
- if( strstr( $node["title"] , '[update_themes]') ) {
1964
- if ( !$update_data['counts']['themes'] ) {
1965
- unset( $SettingNodes[$Boxtype][$node_type][$key] );
1966
- continue;
1967
- } else {
1968
- $node["title"] = str_replace( '[update_themes]' , '[update_themes_format]' , $node["title"] );
1969
- }
1970
- }
1971
- if( $node["id"] == 'logout' ) {
1972
- $node["href"] = wp_logout_url();
1973
- }
1974
- if( $node["id"] == 'my-account' ) {
1975
- $avatar = get_avatar( $user_id , 16 );
1976
- $class = empty( $avatar ) ? '' : 'with-avatar';
1977
- $node["meta"]["class"] = $class;
1978
- }
1979
- if( !isset( $node["group"] ) ) {
1980
- $node["group"] = "";
1981
- }
1982
-
1983
- $node["title"] = $this->val_replace( $node["title"] );
1984
-
1985
- $SettingNodes[$Boxtype][$node_type][$key] = $node;
1986
-
1987
- }
1988
- }
1989
- }
1990
-
1991
- // other plugin nodes
1992
- foreach($SettingNodes as $Boxtype => $allnodes) {
1993
- foreach($allnodes as $node_type => $nodes) {
1994
- foreach($nodes as $key => $node) {
1995
- if( !empty( $activated_plugin ) ) {
1996
- if( $node["id"] == 'bp-notifications' ) {
1997
- foreach($All_Nodes as $default_node_id => $default_node) {
1998
- if( $default_node->parent == $node["id"] ) {
1999
- $subnode_type = '';
2000
- if( $node_type == 'main' ) {
2001
- $subnode_type = 'sub';
2002
- } elseif( $node_type == 'sub' ) {
2003
- $subnode_type = 'sub2';
2004
- } elseif( $node_type == 'sub2' ) {
2005
- $subnode_type = 'sub3';
2006
- } elseif( $node_type == 'sub3' ) {
2007
- $subnode_type = 'sub4';
2008
- }
2009
- if( !empty( $subnode_type ) ) {
2010
- $SettingNodes[$Boxtype][$subnode_type][] = (array) $default_node;
2011
- }
2012
- }
2013
- }
2014
- } elseif( $node["id"] == 'page_list' ) {
2015
- foreach($All_Nodes as $default_node_id => $default_node) {
2016
- if( $default_node->parent == $node["id"] ) {
2017
- $subnode_type = '';
2018
- if( $node_type == 'main' ) {
2019
- $subnode_type = 'sub';
2020
- } elseif( $node_type == 'sub' ) {
2021
- $subnode_type = 'sub2';
2022
- } elseif( $node_type == 'sub2' ) {
2023
- $subnode_type = 'sub3';
2024
- } elseif( $node_type == 'sub3' ) {
2025
- $subnode_type = 'sub4';
2026
- }
2027
- if( !empty( $subnode_type ) ) {
2028
- $SettingNodes[$Boxtype][$subnode_type][] = (array) $default_node;
2029
- }
2030
- }
2031
- }
2032
- } elseif( $node["id"] == 'post_list' ) {
2033
- foreach($All_Nodes as $default_node_id => $default_node) {
2034
- if( $default_node->parent == $node["id"] ) {
2035
- $subnode_type = '';
2036
- if( $node_type == 'main' ) {
2037
- $subnode_type = 'sub';
2038
- } elseif( $node_type == 'sub' ) {
2039
- $subnode_type = 'sub2';
2040
- } elseif( $node_type == 'sub2' ) {
2041
- $subnode_type = 'sub3';
2042
- } elseif( $node_type == 'sub3' ) {
2043
- $subnode_type = 'sub4';
2044
- }
2045
- if( !empty( $subnode_type ) ) {
2046
- $SettingNodes[$Boxtype][$subnode_type][] = (array) $default_node;
2047
- }
2048
- }
2049
- }
2050
- } elseif( $node["id"] == 'languages' ) {
2051
- foreach($All_Nodes as $default_node_id => $default_node) {
2052
- if( $default_node->parent == $node["id"] ) {
2053
- $subnode_type = '';
2054
- if( $node_type == 'main' ) {
2055
- $subnode_type = 'sub';
2056
- } elseif( $node_type == 'sub' ) {
2057
- $subnode_type = 'sub2';
2058
- } elseif( $node_type == 'sub2' ) {
2059
- $subnode_type = 'sub3';
2060
- } elseif( $node_type == 'sub3' ) {
2061
- $subnode_type = 'sub4';
2062
- }
2063
- if( !empty( $subnode_type ) ) {
2064
- $SettingNodes[$Boxtype][$subnode_type][] = (array) $default_node;
2065
- }
2066
- }
2067
- }
2068
- }
2069
- foreach( $activated_plugin as $plugin_slug => $v ) {
2070
- if( !empty( $other_plugin["admin_bar"][$plugin_slug] ) && array_key_exists( $node["id"] , $other_plugin["admin_bar"][$plugin_slug] ) ) {
2071
- $SettingNodes[$Boxtype][$node_type][$key]["title"] = $All_Nodes[$node["id"]]->title;
2072
- $SettingNodes[$Boxtype][$node_type][$key]["href"] = $All_Nodes[$node["id"]]->href;
2073
- }
2074
- }
2075
- }
2076
- }
2077
- }
2078
- }
2079
-
2080
- // add main nodes
2081
- foreach($SettingNodes as $Boxtype => $allnodes) {
2082
- foreach($allnodes as $node_type => $nodes) {
2083
- if( $node_type == 'main' ) {
2084
- foreach($nodes as $node_id => $node) {
2085
- $args = array( "id" => $node["id"] , "title" => stripslashes( $node["title"] ) , "href" => $node["href"] , "parent" => $node["parent"] , "group" => $node["group"] , "meta" => $node["meta"] );
2086
- $wp_admin_bar->add_menu( $args );
2087
- unset( $SettingNodes[$Boxtype][$node_type][$node_id] );
2088
- }
2089
- }
2090
- }
2091
- }
2092
-
2093
- // add all nodes
2094
- foreach($SettingNodes as $Boxtype => $allnodes) {
2095
- foreach($allnodes as $node_type => $nodes) {
2096
- if( $node_type != 'main' ) {
2097
- foreach($nodes as $node_id => $node) {
2098
- if( empty( $node["group"] ) ) {
2099
- $args = array( "id" => $node["id"] , "title" => stripslashes( $node["title"] ) , "href" => $node["href"] , "parent" => $node["parent"] , "group" => false , "meta" => $node["meta"] );
2100
- $wp_admin_bar->add_menu( $args );
2101
- unset( $SettingNodes[$Boxtype][$node_type][$node_id] );
2102
- }
2103
- }
2104
- }
2105
- }
2106
- }
2107
-
2108
- // add groups
2109
- foreach($SettingNodes as $Boxtype => $allnodes) {
2110
- foreach($allnodes as $node_type => $nodes) {
2111
- foreach($nodes as $node_id => $node) {
2112
- if( !empty( $node["group"] ) ) {
2113
- $args = array( "id" => $node["id"] , "parent" => $node["parent"] , "meta" => $node["meta"] );
2114
- $wp_admin_bar->add_group( $args );
2115
- unset( $SettingNodes[$Boxtype][$node_type][$node_id] );
2116
- }
2117
- }
2118
- }
2119
- }
2120
-
2121
- }
2122
- }
2123
-
2124
- }
2125
-
2126
- // FilterStart
2127
- function notice_dismiss() {
2128
- $GetData = $this->get_flit_data( 'admin_general' );
2129
-
2130
- if( !empty( $GetData["UPFN"] ) ) {
2131
-
2132
- if( !empty( $GetData["notice_update_core"] ) ) {
2133
- add_filter( 'update_footer' , '__return_false' , 20) ;
2134
- add_filter( 'site_transient_update_core' , array( $this , 'notice_update_core' ) );
2135
- }
2136
-
2137
- if( !empty( $GetData["notice_update_plugin"] ) ) {
2138
- add_filter( 'site_transient_update_plugins' , array( $this , 'notice_update_plugin' ) );
2139
- }
2140
- if( !empty( $GetData["notice_update_theme"] ) ) {
2141
- add_filter( 'site_transient_update_themes' , array( $this , 'notice_update_theme' ) );
2142
- }
2143
-
2144
- }
2145
-
2146
- }
2147
-
2148
- // FilterStart
2149
- function notice_update_core( $site_transient_update_core ) {
2150
- if( !empty( $site_transient_update_core ) && !empty( $site_transient_update_core->updates[0] ) && !empty( $site_transient_update_core->updates[0]->response ) ) {
2151
- $site_transient_update_core->updates[0]->response = 'latest';
2152
- }
2153
-
2154
- return $site_transient_update_core;
2155
- }
2156
-
2157
- // FilterStart
2158
- function notice_update_plugin( $site_transient_update_plugins ) {
2159
- if( isset( $site_transient_update_plugins->response ) ) {
2160
- unset( $site_transient_update_plugins->response );
2161
- }
2162
-
2163
- return $site_transient_update_plugins;
2164
- }
2165
-
2166
- // FilterStart
2167
- function notice_update_theme( $site_transient_update_themes ) {
2168
- if( isset( $site_transient_update_themes->response ) ) {
2169
- unset( $site_transient_update_themes->response );
2170
- }
2171
-
2172
- return $site_transient_update_themes;
2173
- }
2174
-
2175
- // FilterStart
2176
- function remove_tab() {
2177
- $GetData = $this->get_flit_data( 'admin_general' );
2178
-
2179
- if( !empty( $GetData["UPFN"] ) ) {
2180
- unset( $GetData["UPFN"] );
2181
-
2182
- if( !empty( $GetData["help_tab"] ) ) {
2183
- $screen = get_current_screen();
2184
- if( !empty( $screen ) ) {
2185
- $screen->remove_help_tabs();
2186
- }
2187
- }
2188
-
2189
- if( !empty( $GetData["screen_option_tab"] ) ) {
2190
- add_filter( 'screen_options_show_screen' , '__return_false' );
2191
- }
2192
- }
2193
- }
2194
-
2195
- // FilterStart
2196
- function admin_footer_text( $text ) {
2197
- $GetData = $this->get_flit_data( 'admin_general' );
2198
-
2199
- $footer_text = $text;
2200
- if( !empty( $GetData["UPFN"] ) ) {
2201
- unset( $GetData["UPFN"] );
2202
-
2203
- $footer_text = $this->val_replace( stripslashes( $GetData["footer_text"] ) );
2204
- }
2205
-
2206
- return $footer_text;
2207
- }
2208
-
2209
- // FilterStart
2210
- function load_css() {
2211
- $GetData = $this->get_flit_data( 'admin_general' );
2212
-
2213
- if( !empty( $GetData["UPFN"] ) ) {
2214
- unset( $GetData["UPFN"] );
2215
-
2216
- if( !empty( $GetData["css"] ) ) {
2217
-
2218
- $css = strip_tags( $GetData["css"] );
2219
- $css = $this->val_replace( $css );
2220
-
2221
- wp_enqueue_style( $this->PageSlug . '-custom' , strip_tags( $css ) , array() , $this->Ver );
2222
- }
2223
-
2224
- }
2225
- }
2226
-
2227
- // FilterStart
2228
- function wp_dashboard_setup() {
2229
- global $wp_meta_boxes;
2230
-
2231
- if( empty( $wp_meta_boxes ) ) {
2232
-
2233
- return false;
2234
-
2235
- }
2236
-
2237
- $Data = $this->get_flit_data( 'dashboard' );
2238
-
2239
- if( !empty( $Data ) && is_array( $Data ) ) {
2240
- unset( $Data["UPFN"] );
2241
-
2242
- if( !empty( $Data["metabox_move"] ) ) {
2243
- wp_enqueue_script( 'not-move' , $this->Url . 'js/dashboard/not_move.js' , array( 'jquery' , 'jquery-ui-sortable' , 'dashboard' ) , $this->Ver , true );
2244
- unset( $Data["metabox_move"] );
2245
- }
2246
-
2247
- if( !empty( $Data["show_welcome_panel"] ) ) {
2248
- $user_id = get_current_user_id();
2249
- if( get_user_meta( $user_id , 'show_welcome_panel' , true ) == true ) {
2250
- update_user_meta( $user_id , 'show_welcome_panel' , 0 );
2251
- }
2252
- }
2253
-
2254
- foreach( $wp_meta_boxes["dashboard"] as $context => $meta_box ) {
2255
- foreach( $meta_box as $priority => $box ) {
2256
- foreach( $box as $metabox_id => $b ) {
2257
- if( !empty( $Data[$metabox_id]["remove"] ) ) {
2258
- remove_meta_box( $metabox_id , 'dashboard' , $context );
2259
- } elseif( !empty( $Data[$metabox_id]["name"] ) ) {
2260
- $wp_meta_boxes["dashboard"][$context][$priority][$metabox_id]["title"] = stripslashes( $Data[$metabox_id]["name"] );
2261
- }
2262
- }
2263
- }
2264
- }
2265
- }
2266
-
2267
- }
2268
-
2269
- // FilterStart
2270
- function manage_metabox() {
2271
- global $wp_meta_boxes, $current_screen, $post_type;
2272
-
2273
- if( empty( $current_screen ) or empty( $wp_meta_boxes ) or empty( $post_type ) ) {
2274
-
2275
- return false;
2276
-
2277
- }
2278
-
2279
- $GetData = $this->get_flit_data( 'manage_metabox' );
2280
-
2281
- if( !empty( $GetData["UPFN"] ) ) {
2282
- unset( $GetData["UPFN"] );
2283
-
2284
- if( !empty( $GetData ) && is_array( $GetData ) ) {
2285
-
2286
- if( $current_screen->base == 'post' ) {
2287
-
2288
- if( !empty( $GetData[$post_type] ) ) {
2289
-
2290
- $Metaboxes = $wp_meta_boxes[$post_type];
2291
- $Data = $GetData[$post_type];
2292
-
2293
- $Remove_metaboxes = array();
2294
- foreach( $Metaboxes as $context => $meta_box ) {
2295
- foreach( $meta_box as $priority => $box ) {
2296
- foreach( $box as $metabox_id => $b ) {
2297
- if( !empty( $Data[$metabox_id]["remove"] ) ) {
2298
-
2299
- remove_meta_box( $metabox_id , $post_type , $context );
2300
-
2301
- } else {
2302
-
2303
- if( !empty( $Data[$metabox_id]["name"] ) ) {
2304
- $wp_meta_boxes[$post_type][$context][$priority][$metabox_id]["title"] = stripslashes( $Data[$metabox_id]["name"] );
2305
- }
2306
-
2307
- if( !empty( $Data[$metabox_id]["toggle"] ) ) {
2308
- add_filter( 'postbox_classes_' . $post_type . '_' . $metabox_id , array( $this , 'manage_metabox_close' ) );
2309
- } else {
2310
- add_filter( 'postbox_classes_' . $post_type . '_' . $metabox_id , array( $this , 'manage_metabox_open' ) );
2311
- }
2312
-
2313
- }
2314
- }
2315
- }
2316
- }
2317
-
2318
- }
2319
-
2320
- }
2321
- }
2322
- }
2323
-
2324
- }
2325
-
2326
- // FilterStart
2327
- function manage_metabox_close( $classes ) {
2328
- $classes = array( 'closed' );
2329
- return $classes;
2330
- }
2331
-
2332
- // FilterStart
2333
- function manage_metabox_open( $classes ) {
2334
- $classes = array();
2335
- return $classes;
2336
- }
2337
-
2338
- // FilterStart
2339
- function sidemenu() {
2340
- global $menu;
2341
- global $submenu;
2342
-
2343
- if( empty( $menu ) ) {
2344
-
2345
- return false;
2346
-
2347
- }
2348
-
2349
- $GetData = $this->get_flit_data( 'sidemenu' );
2350
- $General = $this->get_flit_data( 'admin_general' );
2351
-
2352
- if( !empty( $GetData["UPFN"] ) ) {
2353
- unset( $GetData["UPFN"] );
2354
-
2355
- if( !empty( $GetData ) && is_array( $GetData ) && !empty( $GetData["main"] ) ) {
2356
- $SetMain_menu = array();
2357
- $SetMain_submenu = array();
2358
-
2359
- $separator_menu = array( 0 => "" , 1 => 'read' , 2 => 'separator1' , 3 => "" , 4 => 'wp-menu-separator' );
2360
- $customize_url = esc_url( add_query_arg( 'return', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'customize.php' ) );
2361
-
2362
- if( !empty( $GetData["main"] ) ) {
2363
-
2364
- foreach( $GetData["main"] as $mm_pos => $mm ) {
2365
-
2366
- if( $mm["slug"] == 'customize.php' ) {
2367
-
2368
- $GetData["main"][$mm_pos]["slug"] = $customize_url;
2369
-
2370
- } elseif( strstr( $mm["slug"] , 'customize.php?autofocus') ) {
2371
-
2372
- $controll = str_replace( 'customize.php?autofocus%5Bcontrol%5D=' , '' , $mm["slug"] );
2373
-
2374
- if( !empty( $controll ) )
2375
- $GetData["main"][$mm_pos]["slug"] = esc_url( add_query_arg( 'autofocus[control]' , $controll , $customize_url ) );
2376
-
2377
- }
2378
-
2379
- if( strstr( $mm["title"] , '[comment_count]') ) {
2380
- $GetData["main"][$mm_pos]["title"] = str_replace( '[comment_count]' , '<span class="update-plugins count-[comment_count]"><span class="comment-count">[comment_count_format]</span></span>' , $mm["title"] );
2381
- }
2382
- if( strstr( $mm["title"] , '[update_total]') ) {
2383
- $GetData["main"][$mm_pos]["title"] = str_replace( '[update_total]' , '<span class="update-plugins count-[update_total]"><span class="update-count">[update_total_format]</span></span>' , $mm["title"] );
2384
- }
2385
- if( strstr( $mm["title"] , '[update_plugins]') ) {
2386
- $GetData["main"][$mm_pos]["title"] = str_replace( '[update_plugins]' , '<span class="update-plugins count-[update_plugins]"><span class="plugin-count">[update_plugins_format]</span></span>' , $mm["title"] );
2387
- }
2388
- if( strstr( $mm["title"] , '[update_themes]') ) {
2389
- $GetData["main"][$mm_pos]["title"] = str_replace( '[update_themes]' , '<span class="update-plugins count-[update_themes]"><span class="theme-count">[update_themes_format]</span></span>' , $mm["title"] );
2390
- }
2391
-
2392
- }
2393
-
2394
- }
2395
-
2396
- if( !empty( $GetData["sub"] ) ) {
2397
-
2398
- foreach( $GetData["sub"] as $sm_pos => $sm ) {
2399
-
2400
- if( $sm["slug"] == 'customize.php' ) {
2401
-
2402
- $GetData["sub"][$sm_pos]["slug"] = $customize_url;
2403
-
2404
- } elseif( strstr( $sm["slug"] , 'customize.php?autofocus%5Bcontrol%5D=') ) {
2405
-
2406
- $controll = str_replace( 'customize.php?autofocus%5Bcontrol%5D=' , '' , $sm["slug"] );
2407
-
2408
- if( !empty( $controll ) )
2409
- $GetData["sub"][$sm_pos]["slug"] = esc_url( add_query_arg( 'autofocus[control]' , $controll , $customize_url ) );
2410
-
2411
- }
2412
-
2413
- if( strstr( $sm["title"] , '[comment_count]') ) {
2414
- $GetData["sub"][$sm_pos]["title"] = str_replace( '[comment_count]' , '<span class="update-plugins count-[comment_count]"><span class="comment-count">[comment_count_format]</span></span>' , $sm["title"] );
2415
- }
2416
- if( strstr( $sm["title"] , '[update_total]') ) {
2417
- $GetData["sub"][$sm_pos]["title"] = str_replace( '[update_total]' , '<span class="update-plugins count-[update_total]"><span class="update-count">[update_total_format]</span></span>' , $sm["title"] );
2418
- }
2419
- if( strstr( $sm["title"] , '[update_plugins]') ) {
2420
- $GetData["sub"][$sm_pos]["title"] = str_replace( '[update_plugins]' , '<span class="update-plugins count-[update_plugins]"><span class="plugin-count">[update_plugins_format]</span></span>' , $sm["title"] );
2421
- }
2422
- if( strstr( $sm["title"] , '[update_themes]') ) {
2423
- $GetData["sub"][$sm_pos]["title"] = str_replace( '[update_themes]' , '<span class="update-plugins count-[update_themes]"><span class="theme-count">[update_themes_format]</span></span>' , $sm["title"] );
2424
- }
2425
-
2426
- }
2427
-
2428
- }
2429
-
2430
- foreach($GetData["main"] as $mm_pos => $mm) {
2431
- if($mm["slug"] == 'separator') {
2432
- $SetMain_menu[] = $separator_menu;
2433
- } else {
2434
- $gm_search = false;
2435
- $mm_slug_decode = htmlspecialchars_decode( $mm["slug"] );
2436
- foreach($menu as $gm_pos => $gm) {
2437
- if($mm["slug"] == $gm[2] or $mm_slug_decode == $gm[2]) {
2438
- $menu[$gm_pos][0] = $this->val_replace( $mm["title"] );
2439
- $SetMain_menu[] = $menu[$gm_pos];
2440
- $gm_search = true;
2441
- break;
2442
- }
2443
- }
2444
- if( empty( $gm_search ) ) {
2445
- foreach($submenu as $gsm_parent_slug => $v) {
2446
- foreach($v as $gsm_pos => $gsm) {
2447
- if($mm["slug"] == $gsm[2] or $mm_slug_decode == $gsm[2]) {
2448
- foreach($menu as $tmp_m) {
2449
- if( $tmp_m[2] == $gsm_parent_slug) {
2450
- $submenu[$gsm_parent_slug][$gsm_pos][4] = $tmp_m[4];
2451
- break;
2452
- }
2453
- }
2454
- $submenu[$gsm_parent_slug][$gsm_pos][0] = $this->val_replace( $mm["title"] );
2455
- $SetMain_menu[] = $submenu[$gsm_parent_slug][$gsm_pos];
2456
-
2457
- }
2458
- }
2459
- }
2460
- }
2461
- }
2462
- }
2463
-
2464
- if( !empty( $GetData["sub"] ) ) {
2465
- foreach($GetData["sub"] as $sm_pos => $sm) {
2466
- $sm_slug_decode = htmlspecialchars_decode( $sm["slug"] );
2467
- if($sm["slug"] == 'separator') {
2468
- $SetMain_submenu[$sm["parent_slug"]][] = $separator_menu;
2469
- } else {
2470
- $gm_search = false;
2471
- foreach($menu as $gm_pos => $gm) {
2472
- if($sm["slug"] == $gm[2] or $sm_slug_decode == $gm[2]) {
2473
- $menu[$gm_pos][0] = $this->val_replace( $sm["title"] );
2474
- $SetMain_submenu[$sm["parent_slug"]][] = $menu[$gm_pos];
2475
- $gm_search = true;
2476
- break;
2477
- }
2478
- }
2479
- if( empty( $gm_search ) ) {
2480
- foreach($submenu as $gsm_parent_slug => $v) {
2481
- foreach($v as $gsm_pos => $gsm) {
2482
- if($sm["slug"] == $gsm[2] or $sm_slug_decode == $gsm[2]) {
2483
- $submenu[$gsm_parent_slug][$gsm_pos][0] = $this->val_replace( $sm["title"] );
2484
- $SetMain_submenu[$sm["parent_slug"]][] = $submenu[$gsm_parent_slug][$gsm_pos];
2485
- }
2486
- }
2487
- }
2488
- }
2489
- }
2490
- }
2491
- }
2492
-
2493
- $menu = $SetMain_menu;
2494
-
2495
- foreach( $SetMain_submenu as $slug => $menu_set ) {
2496
-
2497
- foreach( $menu_set as $key => $sm ) {
2498
-
2499
- if( !empty( $SetMain_submenu[$slug][$key][4] ) && strstr( $SetMain_submenu[$slug][$key][4] , 'menu-top' ) ) {
2500
- $SetMain_submenu[$slug][$key][4] = str_replace( 'menu-top' , '' , $SetMain_submenu[$slug][$key][4] );
2501
- }
2502
-
2503
- }
2504
-
2505
- }
2506
- $submenu = $SetMain_submenu;
2507
-
2508
- } else {
2509
- // empty menu
2510
- $menu = array();
2511
- }
2512
- }
2513
-
2514
- }
2515
-
2516
- // FilterStart
2517
- function add_edit_post_change_permalink( $permalink_html ) {
2518
- $GetData = $this->get_flit_data( 'post_add_edit' );
2519
-
2520
- if( !empty( $GetData["UPFN"] ) ) {
2521
- unset( $GetData["UPFN"] );
2522
-
2523
- if( !empty( $GetData ) && is_array( $GetData ) ) {
2524
- if( !empty( $GetData["default_permalink"] ) ) {
2525
- if( strpos( $permalink_html , 'change-permalinks' ) ) {
2526
-
2527
- $permalink_html = preg_replace( "/<span id=\"change-permalinks\">(.*)<\/span>/" , "" , $permalink_html );
2528
-
2529
- }
2530
- }
2531
- }
2532
- }
2533
-
2534
- return $permalink_html;
2535
- }
2536
-
2537
- // FilterStart
2538
- function allow_comments() {
2539
- global $current_screen;
2540
-
2541
- $PostAddEdit = $this->get_flit_data( 'post_add_edit' );
2542
- $RemoveMetaBox = $this->get_flit_data( 'manage_metabox' );
2543
-
2544
- if( !empty( $PostAddEdit["UPFN"] ) && !empty( $RemoveMetaBox["UPFN"] ) ) {
2545
- if( $current_screen->action == 'add' ) {
2546
- if( !empty( $RemoveMetaBox[$current_screen->id]["commentstatusdiv"] ) && !empty( $PostAddEdit["allow_comments"] ) ) {
2547
- $comment_status = get_option( 'default_comment_status' );
2548
- $comment_status = apply_filters( 'wauc_pre_get_comment_status' , $comment_status );
2549
- if( $comment_status == 'open' ) {
2550
- echo '<input name="comment_status" type="hidden" id="comment_status" value="open" />';
2551
- }
2552
- }
2553
- }
2554
-
2555
- }
2556
-
2557
- }
2558
-
2559
- // FilterStart
2560
- function admin_title( $title ) {
2561
- $GetData = $this->get_flit_data( 'admin_general' );
2562
-
2563
- if( !empty( $GetData["UPFN"] ) ) {
2564
- unset( $GetData["UPFN"] );
2565
-
2566
- if( !empty( $GetData["title_tag"] ) ) {
2567
- if( strpos( $title , ' WordPress' ) ) {
2568
- $title = str_replace( " &#8212; WordPress" , "" , $title );
2569
- }
2570
- }
2571
- }
2572
-
2573
- return $title;
2574
- }
2575
-
2576
- // FilterStart
2577
- function nav_menus() {
2578
- $GetData = $this->get_flit_data( 'appearance_menus' );
2579
- if( !empty( $GetData["UPFN"] ) ) {
2580
- unset( $GetData["UPFN"] );
2581
-
2582
- $nav_menus = wp_get_nav_menus();
2583
-
2584
- if( !empty( $GetData["add_new_menu"] ) ) {
2585
-
2586
- if( count( $nav_menus ) > 1 ) {
2587
-
2588
- echo '<style>.wrap > .manage-menus .add-new-menu-action, .locations-row-links .locations-add-menu-link { display: none; }</style>';
2589
-
2590
- } else {
2591
-
2592
- echo '<style>.wrap > .manage-menus, .locations-row-links .locations-add-menu-link { display: none; }</style>';
2593
-
2594
- }
2595
- }
2596
-
2597
- if( !empty( $GetData["delete_menu"] ) ) {
2598
-
2599
- echo '<style>.major-publishing-actions .delete-action { display: none; }</style>';
2600
-
2601
- }
2602
-
2603
- }
2604
- }
2605
-
2606
- // FilterStart
2607
- function admin_bar_resizing() {
2608
- $GetData = $this->get_flit_data( 'admin_general' );
2609
-
2610
- if ( empty( $GetData["resize_admin_bar"] ) ) {
2611
- wp_enqueue_style( $this->PageSlug . '-adminbar-resize' , $this->Url . 'css/adminbar/resize.css', array() , $this->Ver );
2612
- if( is_admin() ) {
2613
- wp_enqueue_script( $this->PageSlug . '-adminbar-resize' , $this->Url . 'js/adminbar/resize.js', array( 'jquery' ) , $this->Ver );
2614
- } else {
2615
- wp_enqueue_script( $this->PageSlug . '-adminbar-resize' , $this->Url . 'js/adminbar/resize-front.js', array( 'jquery' ) , $this->Ver );
2616
- }
2617
- }
2618
-
2619
- }
2620
-
2621
- // FilterStart
2622
- function display_msg() {
2623
- if( !empty( $_GET[$this->MsgQ] ) ) {
2624
- $msg = strip_tags( $_GET[$this->MsgQ] );
2625
- if( $msg == 'update' or $msg == 'delete' ) {
2626
- $this->Msg .= '<div class="updated"><p><strong>' . __( 'Settings saved.' ) . '</strong></p></div>';
2627
- } elseif( $msg == 'donated' ) {
2628
- $this->Msg .= '<div class="updated"><p><strong>' . __( 'Thank you for your donation.' , 'wp-admin-ui-customize' ) . '</strong></p></div>';
2629
- }
2630
- }
2631
- }
2632
-
2633
- // FilterStart
2634
- function layout_footer( $text ) {
2635
- $text = '<img src="' . $this->Schema . 'www.gravatar.com/avatar/7e05137c5a859aa987a809190b979ed4?s=18" width="18" /> Plugin developer : <a href="' . $this->AuthorUrl . '?utm_source=use_plugin&utm_medium=footer&utm_content=' . $this->ltd . '&utm_campaign=' . str_replace( '.' , '_' , $this->Ver ) . '" target="_blank">gqevu6bsiz</a>';
2636
- return $text;
2637
- }
2638
-
2639
- // FilterStart
2640
- function DisplayDonation() {
2641
- $donation = get_option( $this->Record["donate"] );
2642
- if( $this->DonateKey != $donation ) {
2643
- $this->Msg .= '<div class="error"><p><strong>' . __( 'Please consider making a donation.' , 'wp-admin-ui-customize' ) . '</strong> <a href="' . self_admin_url( 'admin.php?page=' . $this->PageSlug ) . '">' . __( 'Donate' , 'wp-admin-ui-customize' ) . '</a></p></div>';
2644
- }
2645
- }
2646
-
2647
- }
2648
-
2649
- $wauc = new WP_Admin_UI_Customize();
2650
-
2651
- endif;
2652
-
1
+ <?php
2
+ /*
3
+ Plugin Name: WP Admin UI Customize
4
+ Description: An excellent plugin to customize the management screens.
5
+ Plugin URI: http://wpadminuicustomize.com/?utm_source=use_plugin&utm_medium=list&utm_content=wauc&utm_campaign=1_5_9
6
+ Version: 1.5.9
7
+ Author: gqevu6bsiz
8
+ Author URI: http://gqevu6bsiz.chicappa.jp/?utm_source=use_plugin&utm_medium=list&utm_content=wauc&utm_campaign=1_5_9
9
+ Text Domain: wp-admin-ui-customize
10
+ Domain Path: /languages
11
+ */
12
+
13
+ /* Copyright 2012 gqevu6bsiz (email : gqevu6bsiz@gmail.com)
14
+
15
+ This program is free software; you can redistribute it and/or modify
16
+ it under the terms of the GNU General Public License, version 2, as
17
+ published by the Free Software Foundation.
18
+
19
+ This program is distributed in the hope that it will be useful,
20
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
+ GNU General Public License for more details.
23
+
24
+ You should have received a copy of the GNU General Public License
25
+ along with this program; if not, write to the Free Software
26
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
+ */
28
+
29
+
30
+
31
+
32
+ if ( !class_exists( 'WP_Admin_UI_Customize' ) ) :
33
+
34
+ class WP_Admin_UI_Customize
35
+ {
36
+
37
+ var $Ver,
38
+ $Name,
39
+ $Dir,
40
+ $Url,
41
+ $Site,
42
+ $AuthorUrl,
43
+ $ltd,
44
+ $Record,
45
+ $PageSlug,
46
+ $PluginSlug,
47
+ $Nonces,
48
+ $Schema,
49
+ $UPFN,
50
+ $DonateKey,
51
+ $Menu,
52
+ $SubMenu,
53
+ $Admin_bar,
54
+ $ActivatedPlugin,
55
+ $OtherPluginMenu,
56
+ $MsgQ,
57
+ $Msg;
58
+
59
+
60
+ function __construct() {
61
+ $this->Ver = '1.5.9';
62
+ $this->Name = 'WP Admin UI Customize';
63
+ $this->Dir = plugin_dir_path( __FILE__ );
64
+ $this->Url = plugin_dir_url( __FILE__ );
65
+ $this->Site = 'http://wpadminuicustomize.com/';
66
+ $this->AuthorUrl = 'http://gqevu6bsiz.chicappa.jp/';
67
+ $this->ltd = 'wauc';
68
+ $this->Record = array(
69
+ "user_role" => $this->ltd . '_user_role_setting',
70
+ "site" => $this->ltd . '_site_setting',
71
+ "admin_general" => $this->ltd . '_admin_general_setting',
72
+ "dashboard" => $this->ltd . '_dashboard_setting',
73
+ "regist_dashboard_metabox" => $this->ltd . '_regist_dashboard_metabox',
74
+ "admin_bar_menu" => $this->ltd . '_admin_bar_menu_setting',
75
+ "sidemenu" => $this->ltd . '_sidemenu_setting',
76
+ "manage_metabox" => $this->ltd . '_manage_metabox_setting',
77
+ "regist_metabox" => $this->ltd . '_regist_metabox',
78
+ "post_add_edit" => $this->ltd . '_post_add_edit_setting',
79
+ "appearance_menus" => $this->ltd . '_appearance_menus_setting',
80
+ "loginscreen" => $this->ltd . '_loginscreen_setting',
81
+ "plugin_cap" => $this->ltd . '_plugin_cap',
82
+ "donate" => $this->ltd . '_donated',
83
+ );
84
+ $this->PageSlug = 'wp_admin_ui_customize';
85
+ $this->PluginSlug = dirname( plugin_basename( __FILE__ ) );
86
+ $this->Nonces = array( "field" => $this->ltd . '_field' , "value" => $this->ltd . '_value' );
87
+ $this->Schema = is_ssl() ? 'https://' : 'http://';
88
+ $this->ActivatedPlugin = array();
89
+ $this->OtherPluginMenu = array();
90
+ $this->UPFN = 'Y';
91
+ $this->DonateKey = 'd77aec9bc89d445fd54b4c988d090f03';
92
+ $this->MsgQ = $this->ltd . '_msg';
93
+
94
+ $this->PluginSetup();
95
+ $this->FilterStart();
96
+ }
97
+
98
+
99
+
100
+
101
+
102
+ // PluginSetup
103
+ function PluginSetup() {
104
+ // load text domain
105
+ load_plugin_textdomain( 'wp-admin-ui-customize' , false , $this->PluginSlug . '/languages' );
106
+
107
+ add_action( 'plugins_loaded' , array( $this , 'plugins_loaded' ) );
108
+
109
+ // plugin links
110
+ add_filter( 'plugin_action_links' , array( $this , 'plugin_action_links' ) , 10 , 2 );
111
+
112
+ // plugin links
113
+ add_filter( 'network_admin_plugin_action_links' , array( $this , 'network_admin_plugin_action_links' ) , 10 , 2 );
114
+
115
+ // add menu
116
+ add_action( 'admin_menu' , array( $this , 'admin_menu' ) , 2 );
117
+
118
+ // setting check user role
119
+ add_action( 'admin_notices' , array( $this , 'settingCheck' ) );
120
+
121
+ // compatible other plugin check
122
+ add_action( 'wp_loaded' , array( $this , 'activated_plugin' ) );
123
+
124
+ // data update
125
+ add_action( 'admin_init' , array( $this , 'dataUpdate') );
126
+
127
+ // default admin bar menu load.
128
+ add_action( 'wp_before_admin_bar_render' , array( $this , 'admin_bar_default_load' ) , 1 );
129
+
130
+ // default side menu load.
131
+ add_action( 'admin_menu' , array( $this , 'sidemenu_default_load' ) , 10000 );
132
+
133
+ // default post metabox load.
134
+ add_action( 'admin_head' , array( $this , 'post_meta_boxes_load' ) , 10000 );
135
+
136
+ // default post metabox dashbaord load.
137
+ add_action( 'wp_dashboard_setup' , array( $this , 'post_meta_boxes_dashboard_load' ) , 10000 );
138
+
139
+ }
140
+
141
+ function plugins_loaded() {
142
+
143
+ do_action( $this->ltd . '_plugins_loaded' );
144
+
145
+ }
146
+
147
+ // PluginSetup
148
+ function plugin_action_links( $links , $file ) {
149
+ if( plugin_basename(__FILE__) == $file ) {
150
+ $link = '<a href="' . self_admin_url( 'admin.php?page=' . $this->PageSlug ) . '">' . __( 'Settings' ) . '</a>';
151
+ $support_link = '<a href="http://wordpress.org/support/plugin/' . $this->PluginSlug . '" target="_blank">' . __( 'Support Forums' ) . '</a>';
152
+ $delete_userrole_link = '<a href="' . self_admin_url( 'admin.php?page=' . $this->PageSlug . '_reset_userrole' ) . '">' . __( 'Reset User Roles' , 'wp-admin-ui-customize' ) . '</a>';
153
+ array_unshift( $links, $link , $delete_userrole_link , $support_link );
154
+ }
155
+ return $links;
156
+ }
157
+
158
+ // PluginSetup
159
+ function network_admin_plugin_action_links( $links , $file ) {
160
+ if( plugin_basename(__FILE__) == $file ) {
161
+ $support_link = '<a href="' . $this->Site . 'multisite_about/?utm_source=use_plugin&utm_medium=list&utm_content=' . $this->ltd . '&utm_campaign=' . str_replace( '.' , '_' , $this->Ver ) . '" target="_blank">Multisite Add-on</a>';
162
+ array_unshift( $links, $support_link );
163
+ }
164
+
165
+ return $links;
166
+ }
167
+
168
+ // PluginSetup
169
+ function admin_menu() {
170
+
171
+ if( !empty( $_GET["page"] ) ) {
172
+ $page = strip_tags( $_GET["page"] );
173
+ if( $page == $this->PageSlug . '_admin_bar' ) {
174
+ @header("X-XSS-Protection: 0");
175
+ }
176
+ }
177
+
178
+ $capability = $this->get_plugin_cap();
179
+
180
+ add_menu_page( $this->Name , $this->Name , $capability, $this->PageSlug , array( $this , 'setting_default') );
181
+ add_submenu_page( $this->PageSlug , __( 'Site Settings' , 'wp-admin-ui-customize' ) , __( 'Site Settings' , 'wp-admin-ui-customize' ) , $capability , $this->PageSlug . '_setting_site' , array( $this , 'setting_site' ) );
182
+ add_submenu_page( $this->PageSlug , sprintf( __( '%1$s %2$s' , 'wp-admin-ui-customize' ) , __( 'General' ) , __( 'Settings' ) ) , sprintf( __( '%1$s %2$s' , 'wp-admin-ui-customize' ) , __( 'General' ) , __( 'Settings' ) ) , $capability , $this->PageSlug . '_admin_general_setting' , array( $this , 'setting_admin_general' ) );
183
+ add_submenu_page( $this->PageSlug , __( 'Dashboard' ) , __( 'Dashboard' ) , $capability , $this->PageSlug . '_dashboard' , array( $this , 'setting_dashboard' ) );
184
+ add_submenu_page( $this->PageSlug , __( 'Admin Bar Menu' , 'wp-admin-ui-customize' ) , __( 'Admin Bar Menu' , 'wp-admin-ui-customize' ) , $capability , $this->PageSlug . '_admin_bar' , array( $this , 'setting_admin_bar_menu' ) );
185
+ add_submenu_page( $this->PageSlug , __( 'Side Menu' , 'wp-admin-ui-customize' ) , __( 'Side Menu' , 'wp-admin-ui-customize' ) , $capability , $this->PageSlug . '_sidemenu' , array( $this , 'setting_sidemenu' ) );
186
+ add_submenu_page( $this->PageSlug , __( 'Manage meta box' , 'wp-admin-ui-customize' ) , __( 'Manage meta box' , 'wp-admin-ui-customize' ) , $capability , $this->PageSlug . '_manage_metabox' , array( $this , 'setting_manage_metabox' ) );
187
+ add_submenu_page( $this->PageSlug , __( 'Add New Post and Edit Post Screen Setting' , 'wp-admin-ui-customize' ) , __( 'Add New Post and Edit Post Screen Setting' , 'wp-admin-ui-customize' ) , $capability , $this->PageSlug . '_post_add_edit_screen' , array( $this , 'setting_post_add_edit' ) );
188
+ add_submenu_page( $this->PageSlug , __( 'Appearance Menus Screen Setting' , 'wp-admin-ui-customize' ) , __( 'Appearance Menus Screen Setting' , 'wp-admin-ui-customize' ) , $capability , $this->PageSlug . '_appearance_menus' , array( $this , 'setting_appearance_menus' ) );
189
+ add_submenu_page( $this->PageSlug , __( 'Login Screen' , 'wp-admin-ui-customize' ) , __( 'Login Screen' , 'wp-admin-ui-customize' ) , $capability , $this->PageSlug . '_loginscreen' , array( $this , 'setting_loginscreen' ) );
190
+ add_submenu_page( $this->PageSlug , sprintf( __( '%1$s of %2$s %3$s' , 'wp-admin-ui-customize' ) , __( 'Change' ) , __( 'Plugin' ) , __( 'Capabilities' ) ) , sprintf( __( '%1$s of %2$s %3$s' , 'wp-admin-ui-customize' ) , __( 'Change' ) , __( 'Plugin' ) , __( 'Capabilities' ) ) , $capability , $this->PageSlug . '_plugin_cap' , array( $this , 'setting_plugin_cap' ) );
191
+ add_submenu_page( $this->PageSlug , __( 'Reset User Roles' , 'wp-admin-ui-customize' ) , __( 'Reset User Roles' , 'wp-admin-ui-customize' ) , $capability , $this->PageSlug . '_reset_userrole' , array( $this , 'reset_userrole' ) );
192
+ }
193
+
194
+ // PluginSetup
195
+ function activated_plugin() {
196
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
197
+
198
+ if( is_plugin_active( 'buddypress/bp-loader.php' ) ) {
199
+ $this->ActivatedPlugin["buddypress"] = true;
200
+ }
201
+
202
+ if( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
203
+ $this->ActivatedPlugin["woocommerce"] = true;
204
+ }
205
+
206
+ if( is_plugin_active( 'post-edit-toolbar/post-edit-toolbar.php' ) ) {
207
+ $this->ActivatedPlugin["post_edit_toolbar"] = true;
208
+ }
209
+
210
+ if( is_plugin_active( 'polylang/polylang.php' ) ) {
211
+ $this->ActivatedPlugin["polylang"] = true;
212
+ }
213
+
214
+ }
215
+
216
+
217
+
218
+
219
+ // SettingPage
220
+ function setting_default() {
221
+ $this->display_msg();
222
+ add_filter( 'admin_footer_text' , array( $this , 'layout_footer' ) );
223
+ include_once 'inc/setting_default.php';
224
+ }
225
+
226
+ // SettingPage
227
+ function setting_site() {
228
+ $this->display_msg();
229
+ add_filter( 'admin_footer_text' , array( $this , 'layout_footer' ) );
230
+ $this->DisplayDonation();
231
+ include_once 'inc/setting_site.php';
232
+ }
233
+
234
+ // SettingPage
235
+ function setting_admin_general() {
236
+ $this->display_msg();
237
+ add_filter( 'admin_footer_text' , array( $this , 'layout_footer' ) );
238
+ $this->DisplayDonation();
239
+ include_once 'inc/setting_admin_general.php';
240
+ }
241
+
242
+ // SettingPage
243
+ function setting_dashboard() {
244
+ $this->display_msg();
245
+ add_filter( 'admin_footer_text' , array( $this , 'layout_footer' ) );
246
+ $this->DisplayDonation();
247
+ include_once 'inc/setting_dashboard.php';
248
+ }
249
+
250
+ // SettingPage
251
+ function setting_admin_bar_menu() {
252
+ $this->display_msg();
253
+ add_filter( 'admin_footer_text' , array( $this , 'layout_footer' ) );
254
+ $this->DisplayDonation();
255
+ include_once 'inc/setting_admin_bar_menu.php';
256
+ }
257
+
258
+ // SettingPage
259
+ function setting_sidemenu() {
260
+ $this->display_msg();
261
+ add_filter( 'admin_footer_text' , array( $this , 'layout_footer' ) );
262
+ $this->DisplayDonation();
263
+ include_once 'inc/setting_sidemenu.php';
264
+ }
265
+
266
+ // SettingPage
267
+ function setting_manage_metabox() {
268
+ $this->display_msg();
269
+ add_filter( 'admin_footer_text' , array( $this , 'layout_footer' ) );
270
+ $this->DisplayDonation();
271
+ include_once 'inc/setting_manage_metabox.php';
272
+ }
273
+
274
+ // SettingPage
275
+ function setting_post_add_edit() {
276
+ $this->display_msg();
277
+ add_filter( 'admin_footer_text' , array( $this , 'layout_footer' ) );
278
+ $this->DisplayDonation();
279
+ include_once 'inc/setting_post_add_edit.php';
280
+ }
281
+
282
+ // SettingPage
283
+ function setting_appearance_menus() {
284
+ $this->display_msg();
285
+ add_filter( 'admin_footer_text' , array( $this , 'layout_footer' ) );
286
+ $this->DisplayDonation();
287
+ include_once 'inc/setting_appearance_menus.php';
288
+ }
289
+
290
+ // SettingPage
291
+ function setting_loginscreen() {
292
+ $this->display_msg();
293
+ add_filter( 'admin_footer_text' , array( $this , 'layout_footer' ) );
294
+ $this->DisplayDonation();
295
+ include_once 'inc/setting_loginscreen.php';
296
+ }
297
+
298
+ // SettingPage
299
+ function reset_userrole() {
300
+ $this->display_msg();
301
+ add_filter( 'admin_footer_text' , array( $this , 'layout_footer' ) );
302
+ include_once 'inc/reset_userrole.php';
303
+ }
304
+
305
+ // SettingPage
306
+ function setting_plugin_cap() {
307
+ $this->display_msg();
308
+ add_filter( 'admin_footer_text' , array( $this , 'layout_footer' ) );
309
+ include_once 'inc/setting_plugin_cap.php';
310
+ }
311
+
312
+
313
+
314
+
315
+
316
+ // GetData
317
+ function get_data( $record ) {
318
+ $GetData = get_option( $this->Record[$record] );
319
+ $GetData = apply_filters( 'wauc_pre_get_data' , $GetData , $record );
320
+
321
+ $Data = array();
322
+ if( !empty( $GetData ) && !empty( $GetData["UPFN"] ) && $GetData["UPFN"] == $this->UPFN ) {
323
+ $Data = $GetData;
324
+ }
325
+
326
+ return $Data;
327
+ }
328
+
329
+ // GetData
330
+ function get_flit_data( $record ) {
331
+ $GetData = get_option( $this->Record[$record] );
332
+ $GetData = apply_filters( 'wauc_pre_get_filt_data' , $GetData , $record );
333
+
334
+ $Data = array();
335
+ if( !empty( $GetData ) && !empty( $GetData["UPFN"] ) && $GetData["UPFN"] == $this->UPFN ) {
336
+ $Data = $GetData;
337
+ }
338
+
339
+ return $Data;
340
+ }
341
+
342
+
343
+
344
+ // Settingcheck
345
+ function settingCheck() {
346
+ global $current_screen;
347
+
348
+ $Data = $this->get_data( 'user_role' );
349
+ if( !empty( $Data["UPFN"] ) ) {
350
+ unset( $Data["UPFN"] );
351
+ }
352
+ if( empty( $Data ) ) {
353
+ if( $current_screen->parent_base == $this->PageSlug && $current_screen->id != 'toplevel_page_' . $this->PageSlug ) {
354
+ echo '<div class="error"><p><strong>' . sprintf( __( 'Authority to apply the setting is not selected. <a href="%s">From here</a>, please select the permissions you want to set.' , 'wp-admin-ui-customize' ) , admin_url( 'admin.php?page=' . $this->PageSlug ) ) . '</strong></p></div>';
355
+ }
356
+ }
357
+ }
358
+
359
+
360
+
361
+
362
+
363
+ // SetList
364
+ function get_user_role() {
365
+ $editable_roles = get_editable_roles();
366
+ foreach ( $editable_roles as $role => $details ) {
367
+ $editable_roles[$role]["label"] = translate_user_role( $details['name'] );
368
+ }
369
+
370
+ return $editable_roles;
371
+ }
372
+
373
+ // SetList
374
+ function get_apply_roles() {
375
+
376
+ $apply_user_roles = $this->get_data( 'user_role' );
377
+ unset( $apply_user_roles["UPFN"] );
378
+
379
+ $Contents = __( 'Apply user roles' , 'wp-admin-ui-customize' ) . ' : ';
380
+
381
+ if( !empty( $apply_user_roles ) ) {
382
+ $UserRoles = $this->get_user_role();
383
+ foreach( $apply_user_roles as $role => $v ) {
384
+ if( !empty( $UserRoles[$role] ) ) {
385
+ $Contents .= '[ ' . $UserRoles[$role]["label"] . ' ]';
386
+ }
387
+ }
388
+ } else {
389
+ $Contents .= __( 'None' );
390
+ }
391
+
392
+ $Contents = apply_filters( 'wauc_get_apply_roles' , $Contents );
393
+
394
+ return $Contents;
395
+
396
+ }
397
+
398
+ // SetList
399
+ function sidemenu_default_load() {
400
+ global $menu , $submenu;
401
+
402
+ if ( !get_option( 'link_manager_enabled' ) ) {
403
+ foreach( $menu as $key => $val ) {
404
+ if( !empty( $val[1] ) && $val[1] == 'manage_links' ) {
405
+ unset( $menu[$key] );
406
+ }
407
+ }
408
+ }
409
+
410
+ $this->Menu = $menu;
411
+ $this->SubMenu = $submenu;
412
+
413
+ if( !empty( $submenu ) ) {
414
+
415
+ foreach( $submenu as $submenu_key => $sm ) {
416
+
417
+ if( !empty( $sm ) ) {
418
+
419
+ foreach( $sm as $sm_key => $sm_set ) {
420
+
421
+ if( preg_match("/^customize.php/", $sm_set[2] ) )
422
+ $this->SubMenu[$submenu_key][$sm_key][2] = esc_url( remove_query_arg( array( 'return' ) , $sm_set[2] ) );
423
+
424
+ }
425
+
426
+ }
427
+
428
+ }
429
+
430
+ }
431
+
432
+ }
433
+
434
+ // SetList
435
+ function admin_bar_default_load() {
436
+ global $wp_admin_bar;
437
+
438
+ $this->Admin_bar = $wp_admin_bar->get_nodes();
439
+
440
+ // Other plugin
441
+ if( !empty( $this->ActivatedPlugin ) ) {
442
+
443
+ if( !empty( $this->ActivatedPlugin["buddypress"] ) ) {
444
+ $plugin_slug = 'buddypress';
445
+ foreach( $this->Admin_bar as $node_id => $node ) {
446
+ if( strstr( $node_id , $plugin_slug ) or strstr( $node_id , 'bp-' ) ) {
447
+ $this->OtherPluginMenu["admin_bar"][$plugin_slug][$node_id] = 1;
448
+ }
449
+ }
450
+ }
451
+
452
+ if( !empty( $this->ActivatedPlugin["post_edit_toolbar"] ) ) {
453
+ $plugin_slug = 'post_item_';
454
+ foreach( $this->Admin_bar as $node_id => $node ) {
455
+ if( strstr( $node_id , $plugin_slug ) ) {
456
+ $this->OtherPluginMenu["admin_bar"][$plugin_slug][$node_id] = 1;
457
+ }
458
+ }
459
+ $plugin_slug = 'page_item_';
460
+ foreach( $this->Admin_bar as $node_id => $node ) {
461
+ if( strstr( $node_id , $plugin_slug ) ) {
462
+ $this->OtherPluginMenu["admin_bar"][$plugin_slug][$node_id] = 1;
463
+ }
464
+ }
465
+ }
466
+
467
+ if( !empty( $this->ActivatedPlugin["polylang"] ) ) {
468
+ $plugin_slug = 'languages';
469
+ foreach( $this->Admin_bar as $node_id => $node ) {
470
+ if( strstr( $node_id , $plugin_slug ) or strstr( $node->id , $plugin_slug ) ) {
471
+ $this->OtherPluginMenu["admin_bar"]['polylang'][$node_id] = 1;
472
+ }
473
+ }
474
+ }
475
+
476
+ if( !empty( $this->OtherPluginMenu["admin_bar"] ) ) {
477
+ for($i = 0; $i < 4; $i++) {
478
+ foreach( $this->OtherPluginMenu["admin_bar"] as $plugin_slug => $plugin_menu ) {
479
+ foreach( $this->Admin_bar as $node_id => $node ) {
480
+ if( !empty( $node->parent ) && array_key_exists( $node->parent , $plugin_menu ) ) {
481
+ $this->OtherPluginMenu["admin_bar"][$plugin_slug][$node_id] = 1;
482
+ }
483
+ }
484
+ }
485
+ }
486
+ }
487
+
488
+ }
489
+ }
490
+
491
+ // SetList
492
+ function admin_bar_filter_load() {
493
+ $Default_bar = $this->Admin_bar;
494
+
495
+ $Delete_bar = array( "top-secondary" );
496
+ foreach( $Delete_bar as $del_name ) {
497
+ if( !empty( $Default_bar[$del_name] ) ) {
498
+ unset( $Default_bar[$del_name] );
499
+ }
500
+ }
501
+
502
+ // front
503
+ $Default_bar["dashboard"] = (object) array( "id" => "dashboard" , "title" => __( 'Dashboard' ) , "parent" => "site-name" , "href" => admin_url() , "group" => false );
504
+
505
+ foreach( $Default_bar as $node_id => $node ) {
506
+ if( $node->id == 'my-account' ) {
507
+ $Default_bar[$node_id]->title = sprintf( __( 'Howdy, %1$s' ) , '[user_name]' ) . '[user_avatar]';
508
+ } elseif( $node->id == 'user-info' ) {
509
+ $Default_bar[$node_id]->title = '[user_avatar_64]<span class="display-name">[user_name]</span><span class="username">[user_login_name]</span>';
510
+ } elseif( $node->id == 'logout' ) {
511
+ $Default_bar[$node_id]->href = preg_replace( '/&amp(.*)/' , '' , $node->href );
512
+ } elseif( $node->id == 'site-name' ) {
513
+ $Default_bar[$node_id]->title = '[blog_name]';
514
+ } elseif( $node->id == 'updates' ) {
515
+ $Default_bar[$node_id]->title = '[update_total]';
516
+ } elseif( $node->id == 'comments' ) {
517
+ $Default_bar[$node_id]->title = '[comment_count]';
518
+ }
519
+ }
520
+
521
+ $Filter_bar = array();
522
+ $MainMenuIDs = array();
523
+
524
+ foreach( $Default_bar as $node_id => $node ) {
525
+ if( empty( $node->parent ) ) {
526
+ $Filter_bar["left"]["main"][$node_id] = $node;
527
+ $MainMenuIDs[$node_id] = "left";
528
+ unset( $Default_bar[$node_id] );
529
+ } elseif( $node->parent == 'top-secondary' ) {
530
+ $Filter_bar["right"]["main"][$node_id] = $node;
531
+ $MainMenuIDs[$node_id] = "right";
532
+ unset( $Default_bar[$node_id] );
533
+ }
534
+ }
535
+
536
+ // meta field add
537
+ foreach( $Default_bar as $node_id => $node ) {
538
+ if( !isset( $node->meta ) ) {
539
+ $Default_bar[$node_id]->meta = array();
540
+ }
541
+ }
542
+
543
+ // sub node
544
+ foreach( $MainMenuIDs as $parent_id => $menu_type ) {
545
+ foreach( $Default_bar as $node_id => $node ) {
546
+ if( $node->parent == $parent_id ) {
547
+ $Filter_bar[$menu_type]["sub"][$node_id] = $node;
548
+ unset( $Default_bar[$node_id] );
549
+ }
550
+ }
551
+ }
552
+
553
+ $Place_types = $this->admin_bar_places();
554
+
555
+ // sub2 node
556
+ if( !empty( $Default_bar ) ) {
557
+ foreach( $Place_types as $place => $place_label ) {
558
+ if( !empty( $Filter_bar[$place]["sub"] ) && $place != 'front' ) {
559
+ foreach( $Filter_bar[$place]["sub"] as $parent_id => $parent_node ) {
560
+ foreach( $Default_bar as $node_id => $node ) {
561
+ if( $node->parent == $parent_id ) {
562
+ $Filter_bar[$place]["sub2"][$node_id] = $node;
563
+ unset( $Default_bar[$node_id] );
564
+ }
565
+ }
566
+ }
567
+ }
568
+ }
569
+ }
570
+
571
+ // sub3 node
572
+ if( !empty( $Default_bar ) ) {
573
+ foreach( $Place_types as $place => $place_label ) {
574
+ if( !empty( $Filter_bar[$place]["sub2"] ) && $place != 'front' ) {
575
+ foreach( $Filter_bar[$place]["sub2"] as $parent_id => $parent_node ) {
576
+ foreach( $Default_bar as $node_id => $node ) {
577
+ if( $node->parent == $parent_id ) {
578
+ $Filter_bar[$place]["sub3"][$node_id] = $node;
579
+ unset( $Default_bar[$node_id] );
580
+ }
581
+ }
582
+ }
583
+ }
584
+ }
585
+ }
586
+
587
+ // sub4 node
588
+ if( !empty( $Default_bar ) ) {
589
+ foreach( $Place_types as $place => $place_label ) {
590
+ if( !empty( $Filter_bar[$place]["sub3"] ) && $place != 'front' ) {
591
+ foreach( $Filter_bar[$place]["sub3"] as $parent_id => $parent_node ) {
592
+ foreach( $Default_bar as $node_id => $node ) {
593
+ if( $node->parent == $parent_id ) {
594
+ $Filter_bar[$place]["sub4"][$node_id] = $node;
595
+ unset( $Default_bar[$node_id] );
596
+ }
597
+ }
598
+ }
599
+ }
600
+ }
601
+ }
602
+
603
+ // front field
604
+ $Filter_bar["front"] = array( "main" => array() , "sub" => array() );
605
+ $Filter_bar["front"]["main"]["edit-post_type"] = new stdClass;
606
+ $Filter_bar["front"]["main"]["edit-post_type"] = (object) array( 'id' => 'edit-post_type' , 'title' => '' , 'href' => '' , 'group' => '' , 'meta' => array() );
607
+ $Filter_bar["front"]["main"]["edit-post_type"]->title = sprintf( '%1$s [post_type]' , __( 'Edit' ) );
608
+
609
+ $Filter_bar["front"]["main"]["search"] = new stdClass;
610
+ $Filter_bar["front"]["main"]["search"] = (object) array( 'id' => 'search' , 'title' => '' , 'href' => '' , 'group' => '' , 'meta' => array() );
611
+ $Filter_bar["front"]["main"]["search"]->title = __( 'Search' );
612
+ $Filter_bar["front"]["main"]["search"]->href = get_search_link();
613
+
614
+ // admin field
615
+ $Filter_bar['left']['main']['view-post_type'] = new stdClass;
616
+ $Filter_bar['left']['main']['view-post_type'] = (object) array( 'id' => 'view-post_type' , 'title' => '' , 'href' => '' , 'group' => '' , 'meta' => array() );
617
+ $Filter_bar['left']['main']['view-post_type']->title = sprintf( '%1$s [post_type]' , __( 'View' ) );
618
+
619
+ if( !empty( $this->ActivatedPlugin ) ) {
620
+
621
+ if( !empty( $this->ActivatedPlugin["post_edit_toolbar"] ) ) {
622
+ $plugin_slug = 'post_item_';
623
+ foreach( $Filter_bar['left']['sub'] as $node_id => $node ) {
624
+ if( strstr( $node_id , $plugin_slug ) ) {
625
+ unset( $Filter_bar['left']['sub'][$node_id] );
626
+ }
627
+ }
628
+ $plugin_slug = 'page_item_';
629
+ foreach( $Filter_bar['left']['sub'] as $node_id => $node ) {
630
+ if( strstr( $node_id , $plugin_slug ) ) {
631
+ unset( $Filter_bar['left']['sub'][$node_id] );
632
+ }
633
+ }
634
+ }
635
+
636
+ if( !empty( $this->ActivatedPlugin["polylang"] ) ) {
637
+ $plugin_slug = 'languages';
638
+ foreach( $Filter_bar['left']['sub'] as $node_id => $node ) {
639
+ if( strstr( $node->parent , $plugin_slug ) ) {
640
+ unset( $Filter_bar['left']['sub'][$node_id] );
641
+ }
642
+ }
643
+ }
644
+
645
+ }
646
+
647
+ return $Filter_bar;
648
+ }
649
+
650
+ // SetList
651
+ function post_meta_boxes_dashboard_load() {
652
+ global $current_screen;
653
+
654
+ $capability = $this->get_plugin_cap();
655
+
656
+ if( !empty( $current_screen ) && $current_screen->id == 'dashboard' && current_user_can( $capability ) ) {
657
+ global $wp_meta_boxes;
658
+
659
+ $post_type = 'dashboard';
660
+ $Metaboxes = $wp_meta_boxes[$post_type];
661
+
662
+ $Update = array();
663
+ $Update["UPFN"] = $this->UPFN;
664
+
665
+ if( !empty( $Metaboxes ) ) {
666
+ foreach( $Metaboxes as $context => $meta_box ) {
667
+ foreach( $meta_box as $priority => $box ) {
668
+ if( is_array( $box ) ) {
669
+ foreach( $box as $metabox_id => $b ) {
670
+ $Update["metaboxes"][$post_type][$context][$priority][$b["id"]] = strip_tags( $b["title"] );
671
+ }
672
+ }
673
+ }
674
+ }
675
+ }
676
+
677
+ if( !empty( $Update ) ) {
678
+ update_option( $this->Record["regist_dashboard_metabox"] , $Update );
679
+ }
680
+
681
+ }
682
+
683
+ }
684
+
685
+ // SetList
686
+ function post_meta_boxes_load() {
687
+ global $current_screen;
688
+
689
+ $capability = $this->get_plugin_cap();
690
+
691
+ if( !empty( $current_screen ) && $current_screen->base == 'post' && current_user_can( $capability ) ) {
692
+ global $wp_meta_boxes;
693
+
694
+ $regist_meta_boxes = $this->get_data( "regist_metabox" );
695
+
696
+ $post_type = $current_screen->post_type;
697
+ $Metaboxes = $wp_meta_boxes[$post_type];
698
+
699
+ $regist_meta_boxes['UPFN'] = $this->UPFN;
700
+
701
+ if( empty( $regist_meta_boxes['metaboxes'][$post_type] ) or !empty( $_GET[$this->ltd . '_metabox_load'] ) ) {
702
+
703
+ $regist_meta_boxes['metaboxes'][$post_type] = array();
704
+
705
+ }
706
+
707
+ if( !empty( $Metaboxes ) ) {
708
+
709
+ foreach( $Metaboxes as $context => $meta_box ) {
710
+
711
+ foreach( $meta_box as $priority => $box ) {
712
+
713
+ if( is_array( $box ) ) {
714
+
715
+ foreach( $box as $metabox_id => $metabox_detail ) {
716
+
717
+ if( !empty( $metabox_detail ) ) {
718
+
719
+ $regist_meta_boxes['metaboxes'][$post_type][$context][$priority][$metabox_id] = strip_tags( $metabox_detail['title'] );
720
+
721
+ }
722
+
723
+ }
724
+
725
+ }
726
+
727
+ }
728
+
729
+ }
730
+
731
+ }
732
+
733
+ if( !empty( $regist_meta_boxes ) ) {
734
+ update_option( $this->Record["regist_metabox"] , $regist_meta_boxes );
735
+ }
736
+
737
+ }
738
+
739
+ }
740
+
741
+ // SetList
742
+ function sidebar_menu_widget( $menu_widget ) {
743
+ $UserRoles = $this->get_user_role();
744
+ $new_widget = '';
745
+ if( !empty( $menu_widget["new"] ) ) {
746
+ $new_widget = 'new';
747
+ }
748
+ ?>
749
+ <div class="widget <?php echo $menu_widget["slug"]; ?> <?php echo $new_widget; ?>">
750
+
751
+ <div class="widget-top">
752
+ <div class="widget-title-action">
753
+ <a class="widget-action" href="#available"></a>
754
+ </div>
755
+ <div class="widget-title">
756
+ <h4>
757
+ <?php echo strip_tags( $menu_widget["title"] ); ?>
758
+ : <span class="in-widget-title"><?php echo $menu_widget["slug"]; ?></span>
759
+ </h4>
760
+ </div>
761
+ </div>
762
+
763
+ <div class="widget-inside">
764
+ <div class="settings">
765
+ <p class="description">
766
+ <?php if( $menu_widget["slug"] == 'custom_menu' ) : ?>
767
+ <?php _e( 'Url' ); ?>:
768
+ <input type="text" class="slugtext" value="" name="data[][slug]">
769
+ <?php else : ?>
770
+ <?php _e( 'Slug' ); ?>: <?php echo $menu_widget["slug"]; ?>
771
+ <input type="hidden" class="slugtext" value="<?php echo $menu_widget["slug"]; ?>" name="data[][slug]">
772
+ <?php endif; ?>
773
+ </p>
774
+ <?php _e( 'User Roles' ); ?> :
775
+ <ul class="display_roles">
776
+ <?php foreach( $UserRoles as $role_name => $val ) : ?>
777
+ <?php $has_cap = false; ?>
778
+ <?php if( !empty( $val["capabilities"][$menu_widget["cap"]] ) or $role_name == $menu_widget["cap"] ) : ?>
779
+ <?php $has_cap = 'has_cap'; ?>
780
+ <?php endif; ?>
781
+ <li class="<?php echo $role_name; ?> <?php echo $has_cap; ?>"><?php echo $val["label"]; ?></li>
782
+ <?php endforeach ;?>
783
+ </ul>
784
+ <label>
785
+ <?php _e( 'Title' ); ?> : <input type="text" class="regular-text titletext" value="<?php echo esc_attr( $menu_widget["title"] ); ?>" name="data[][title]">
786
+ </label>
787
+ <input type="hidden" class="parent_slugtext" value="<?php echo $menu_widget["parent_slug"]; ?>" name="data[][parent_slug]">
788
+ </div>
789
+
790
+ <?php if( $menu_widget["slug"] != 'separator' ) : ?>
791
+ <div class="submenu">
792
+ <p class="description"><?php _e( 'Sub Menus' , 'wp-admin-ui-customize' ); ?></p>
793
+ <?php if( empty( $menu_widget["new"] ) && !empty( $menu_widget["submenu"] ) ) : ?>
794
+ <?php foreach( $menu_widget["submenu"] as $sm ) : ?>
795
+ <?php $sepalator_widget = ''; ?>
796
+ <?php if( $sm["slug"] == 'separator' ) : $sepalator_widget = $sm["slug"]; endif; ?>
797
+
798
+ <div class="widget <?php echo $sepalator_widget; ?>">
799
+
800
+ <div class="widget-top">
801
+ <div class="widget-title-action">
802
+ <a class="widget-action" href="#available"></a>
803
+ </div>
804
+ <div class="widget-title">
805
+ <h4>
806
+ <?php echo strip_tags( $sm["title"] ); ?>
807
+ : <span class="in-widget-title"><?php echo $sm["slug"]; ?></span>
808
+ </h4>
809
+ </div>
810
+ </div>
811
+
812
+ <div class="widget-inside">
813
+ <div class="settings">
814
+ <p class="description">
815
+ <?php _e( 'Slug' ); ?>: <?php echo $sm["slug"]; ?>
816
+ <input type="hidden" class="slugtext" value="<?php echo $sm["slug"]; ?>" name="data[][slug]">
817
+ </p>
818
+ <?php _e( 'User Roles' ); ?> :
819
+ <ul class="display_roles">
820
+ <?php foreach( $UserRoles as $role_name => $val ) : ?>
821
+ <?php $has_cap = false; ?>
822
+ <?php if( !empty( $val["capabilities"][$sm["cap"]] ) or $role_name == $sm["cap"] ) : ?>
823
+ <?php $has_cap = 'has_cap'; ?>
824
+ <?php endif; ?>
825
+ <li class="<?php echo $role_name; ?> <?php echo $has_cap; ?>"><?php echo $val["label"]; ?></li>
826
+ <?php endforeach ;?>
827
+ </ul>
828
+ <label>
829
+ <?php _e( 'Title' ); ?> : <input type="text" class="regular-text titletext" value="<?php echo esc_attr( $sm["title"] ); ?>" name="data[][title]">
830
+ </label>
831
+ <input type="hidden" class="parent_slugtext" value="<?php echo $sm["parent_slug"]; ?>" name="data[][parent_slug]">
832
+ </div>
833
+ <div class="widget-control-actions">
834
+ <div class="alignleft">
835
+ <a href="#remove"><?php _e( 'Remove' ); ?></a>
836
+ </div>
837
+ <div class="clear"></div>
838
+ </div>
839
+ </div>
840
+ </div>
841
+
842
+ <?php endforeach; ?>
843
+ <?php endif; ?>
844
+ </div>
845
+ <div class="widget-control-actions">
846
+ <div class="alignleft">
847
+ <a href="#remove"><?php _e( 'Remove' ); ?></a>
848
+ </div>
849
+ <div class="clear"></div>
850
+ </div>
851
+
852
+ <?php endif; ?>
853
+ </div>
854
+
855
+ </div>
856
+ <?php
857
+ }
858
+
859
+ // SetList
860
+ function admin_bar_menu_widget( $Nodes , $menu_widget , $node_type ) {
861
+ if ( is_object( $menu_widget ) ) $menu_widget = (array) $menu_widget;
862
+ if( !isset( $menu_widget["group"] ) ) $menu_widget["group"] = 0;
863
+ if( !isset( $menu_widget["meta"]["class"] ) ) $menu_widget["meta"]["class"] = "";
864
+ $no_submenu = array( 'search' , 'bp-notifications' , 'languages' , 'menu-toggle' , 'post_list' , 'page_list' );
865
+ $activated_plugin = $this->ActivatedPlugin;
866
+ $other_plugin = $this->OtherPluginMenu;
867
+
868
+ $widget_class = $menu_widget["id"];
869
+ $new_widget = '';
870
+ if( !empty( $menu_widget["new"] ) ) {
871
+ $new_widget = 'new';
872
+ $widget_class .= ' new';
873
+ }
874
+ if( !empty( $menu_widget["group"] ) ) {
875
+ $widget_class .= ' widget-group';
876
+ }
877
+ ?>
878
+ <div class="widget <?php echo $widget_class; ?>">
879
+
880
+ <div class="widget-top">
881
+ <div class="widget-title-action">
882
+ <a class="widget-action" href="#available"></a>
883
+ </div>
884
+ <div class="widget-title">
885
+ <h4>
886
+ <?php if( !empty( $menu_widget["group"] ) ) : ?>
887
+ <?php _e( 'Menu Group' , 'wp-admin-ui-customize' ); ?>
888
+ : <span class="in-widget-title"><?php echo $menu_widget["id"]; ?></span>
889
+ <?php elseif( preg_match( '/\<form/' , $menu_widget["title"] ) ) : ?>
890
+ <?php echo $menu_widget["id"]; ?>
891
+ <?php else: ?>
892
+ <?php echo $menu_widget["title"]; ?>
893
+ : <span class="in-widget-title"><?php echo $menu_widget["id"]; ?></span>
894
+ <?php endif; ?>
895
+ </h4>
896
+ </div>
897
+ </div>
898
+
899
+ <div class="widget-inside">
900
+ <div class="settings">
901
+ <p class="field-url description">
902
+ <input type="hidden" class="idtext" value="<?php echo $menu_widget["id"]; ?>" name="data[][id]" />
903
+ <?php if( strstr( $menu_widget["id"] , 'custom_node' ) && empty( $menu_widget["group"] ) ) : ?>
904
+ URL: <input type="text" class="regular-text linktext" value="<?php echo $menu_widget["href"]; ?>" name="data[][href]" placeholder="http://" />
905
+ <?php else: ?>
906
+ <?php if( $menu_widget["id"] == 'edit-post_type' ) : ?>
907
+ <strong><?php _e( 'Show only on front end.' , 'wp-admin-ui-customize' ); ?></strong>
908
+ <?php elseif( !empty( $menu_widget["group"] ) ) : ?>
909
+ <strong><?php _e( 'Menu Group' , 'wp-admin-ui-customize' ); ?></strong>
910
+ <?php elseif( $menu_widget["id"] == 'menu-toggle' ) : ?>
911
+ <strong><?php echo $menu_widget["id"]; ?></strong>
912
+ <?php else: ?>
913
+ <a href="<?php echo $menu_widget["href"]; ?>" target="_blank"><?php echo $menu_widget["id"]; ?></a>
914
+ <?php endif; ?>
915
+ <input type="hidden" class="linktext" value="<?php echo $menu_widget["href"]; ?>" name="data[][href]" />
916
+ <?php endif; ?>
917
+ </p>
918
+ <p class="field-title description">
919
+ <label>
920
+ <?php if( !empty( $menu_widget["group"] ) ) : ?>
921
+ <input type="hidden" class="regular-text titletext" value="" name="data[][title]" />
922
+ <?php else : ?>
923
+ <?php _e( 'Title' ); ?> :
924
+
925
+ <?php $readonly_field = false; ?>
926
+ <?php if( in_array( $menu_widget["id"] , $no_submenu ) ) : ?>
927
+ <?php $readonly_field = true; ?>
928
+ <?php elseif( !empty( $activated_plugin ) ) : ?>
929
+ <?php foreach( $activated_plugin as $plugin_slug => $v ) : ?>
930
+ <?php if( !empty( $other_plugin["admin_bar"][$plugin_slug] ) && array_key_exists( $menu_widget["id"] , $other_plugin["admin_bar"][$plugin_slug] ) ) : ?>
931
+ <?php $readonly_field = true; ?>
932
+ <?php break; ?>
933
+ <?php endif; ?>
934
+ <?php endforeach; ?>
935
+ <?php endif; ?>
936
+ <?php if( $readonly_field ) : ?>
937
+ <input type="text" class="regular-text titletext" value="<?php echo esc_html( $menu_widget["title"] ); ?>" name="data[][title]" readonly="readonly" /><br />
938
+ <?php else : ?>
939
+ <input type="text" class="regular-text titletext" value="<?php echo esc_html( $menu_widget["title"] ); ?>" name="data[][title]" />
940
+ <?php endif; ?>
941
+ <?php endif; ?>
942
+ </label>
943
+ </p>
944
+ <p class="field-meta description">
945
+ <label class="description">
946
+ <?php if( !empty( $menu_widget["group"] ) or $menu_widget["id"] == 'menu-toggle' ) : ?>
947
+ <input type="hidden" class="meta_target" value="_blank" name="data[][meta][target]" />
948
+ <?php else: ?>
949
+ <?php $checked = ""; ?>
950
+ <?php if( !empty( $menu_widget["meta"]["target"] ) ) : ?>
951
+ <?php $checked = checked( $menu_widget["meta"]["target"] , '_blank' , 0 ); ?>
952
+ <?php endif; ?>
953
+ <input type="checkbox" class="meta_target" value="_blank" name="data[][meta][target]" <?php echo $checked; ?> />
954
+ <?php _e( 'Open link in a new window/tab' ); ?>
955
+ <?php endif; ?>
956
+ </label>
957
+ <input type="hidden" class="meta_class" value="<?php echo $menu_widget["meta"]["class"]; ?>" name="data[][meta][class]" />
958
+ </p>
959
+ <input type="hidden" class="parent" value="<?php echo $menu_widget["parent"]; ?>" name="data[][parent]" />
960
+ <input type="hidden" class="group" value="<?php echo $menu_widget["group"]; ?>" name="data[][group]" />
961
+ <input type="hidden" class="node_type" value="" name="data[][node_type]" />
962
+ </div>
963
+
964
+ <?php if( !in_array( $menu_widget["id"] , $no_submenu ) ) : ?>
965
+ <div class="submenu">
966
+ <p class="description"><?php _e( 'Sub Menus' , 'wp-admin-ui-customize' ); ?></p>
967
+
968
+ <?php if( empty( $new_widget ) && !empty( $node_type ) ) : ?>
969
+
970
+ <?php $subnode_type = ''; ?>
971
+ <?php if( $node_type == 'main' ) : ?>
972
+ <?php $subnode_type = 'sub'; ?>
973
+ <?php elseif( $node_type == 'sub' ) : ?>
974
+ <?php $subnode_type = 'sub2'; ?>
975
+ <?php elseif( $node_type == 'sub2' ) : ?>
976
+ <?php $subnode_type = 'sub3'; ?>
977
+ <?php elseif( $node_type == 'sub3' ) : ?>
978
+ <?php $subnode_type = 'sub4'; ?>
979
+ <?php endif; ?>
980
+
981
+ <?php if( !empty( $subnode_type ) && !empty( $Nodes[$subnode_type] ) ) : ?>
982
+ <?php foreach( $Nodes[$subnode_type] as $subnode_id => $subnode ) : ?>
983
+ <?php if( is_object( $subnode ) ) $subnode = get_object_vars( $subnode ); ?>
984
+ <?php if( $menu_widget["id"] == $subnode["parent"] ) : ?>
985
+ <?php array_map( array( $this , 'admin_bar_menu_widget' ) , array( $Nodes ) , array( $subnode ) , array( $subnode_type ) ); ?>
986
+ <?php endif; ?>
987
+ <?php endforeach; ?>
988
+ <?php endif; ?>
989
+
990
+ <?php endif; ?>
991
+
992
+ </div>
993
+ <?php endif; ?>
994
+
995
+ <div class="widget-control-actions">
996
+ <div class="alignleft">
997
+ <a href="#remove"><?php _e( 'Remove' ); ?></a>
998
+ </div>
999
+ <div class="clear"></div>
1000
+ </div>
1001
+ </div>
1002
+
1003
+ </div>
1004
+ <?php
1005
+ }
1006
+
1007
+ // SetList
1008
+ function get_custom_posts() {
1009
+ $args = array( );
1010
+ $all_custom_posts = get_post_types( $args , 'objects' );
1011
+
1012
+ $exclusion = array( "post" , "page" , "attachment" , "revision" , "nav_menu_item");
1013
+ $custom_posts = array();
1014
+ foreach($all_custom_posts as $post_type => $cpt) {
1015
+ if( !in_array( $post_type , $exclusion ) ) {
1016
+ if( !empty( $cpt->show_ui ) ) {
1017
+ $custom_posts[$post_type] = $cpt;
1018
+ }
1019
+ }
1020
+ }
1021
+
1022
+ return $custom_posts;
1023
+ }
1024
+
1025
+ // SetList
1026
+ function val_replace( $str ) {
1027
+
1028
+ if( !empty( $str ) ) {
1029
+
1030
+ $update_data = wp_get_update_data();
1031
+ $awaiting_mod = wp_count_comments();
1032
+ $awaiting_mod = $awaiting_mod->moderated;
1033
+ $current_user = wp_get_current_user();
1034
+ if( is_multisite() ) {
1035
+ $current_site = get_current_site();
1036
+ }
1037
+
1038
+ if( strstr( $str , '[blog_url]') ) {
1039
+ $str = str_replace( '[blog_url]' , get_bloginfo( 'url' ) , $str );
1040
+ }
1041
+ if( strstr( $str , '[template_directory_uri]') ) {
1042
+ $str = str_replace( '[template_directory_uri]' , get_bloginfo( 'template_directory' ) , $str );
1043
+ }
1044
+ if( strstr( $str , '[stylesheet_directory_uri]') ) {
1045
+ $str = str_replace( '[stylesheet_directory_uri]' , get_stylesheet_directory_uri() , $str );
1046
+ }
1047
+ if( strstr( $str , '[blog_name]') ) {
1048
+ $str = str_replace( '[blog_name]' , get_bloginfo( 'name' ) , $str );
1049
+ }
1050
+ if( strstr( $str , '[update_total]') ) {
1051
+ $str = str_replace( '[update_total]' , $update_data["counts"]["total"] , $str );
1052
+ }
1053
+ if( strstr( $str , '[update_total_format]') ) {
1054
+ $str = str_replace( '[update_total_format]' , number_format_i18n( $update_data["counts"]["total"] ) , $str );
1055
+ }
1056
+ if( strstr( $str , '[update_plugins]') ) {
1057
+ $str = str_replace( '[update_plugins]' , $update_data["counts"]["plugins"] , $str );
1058
+ }
1059
+ if( strstr( $str , '[update_plugins_format]') ) {
1060
+ $str = str_replace( '[update_plugins_format]' , number_format_i18n( $update_data["counts"]["plugins"] ) , $str );
1061
+ }
1062
+ if( strstr( $str , '[update_themes]') ) {
1063
+ $str = str_replace( '[update_themes]' , $update_data["counts"]["themes"] , $str );
1064
+ }
1065
+ if( strstr( $str , '[update_themes_format]') ) {
1066
+ $str = str_replace( '[update_themes_format]' , number_format_i18n( $update_data["counts"]["themes"] ) , $str );
1067
+ }
1068
+ if( strstr( $str , '[comment_count]') ) {
1069
+ $str = str_replace( '[comment_count]' , $awaiting_mod , $str );
1070
+ }
1071
+ if( strstr( $str , '[comment_count_format]') ) {
1072
+ $str = str_replace( '[comment_count_format]' , number_format_i18n( $awaiting_mod ) , $str );
1073
+ }
1074
+ if( strstr( $str , '[user_name]') ) {
1075
+ $str = str_replace( '[user_name]' , $current_user->display_name , $str );
1076
+ }
1077
+ if( strstr( $str , '[user_login_name]') ) {
1078
+ $str = str_replace( '[user_login_name]' , $current_user->user_login , $str );
1079
+ }
1080
+ if( strstr( $str , '[user_avatar]') ) {
1081
+ $str = str_replace( '[user_avatar]' , get_avatar( $current_user->ID , 16 ) , $str );
1082
+ }
1083
+ if( strstr( $str , '[user_avatar_64]') ) {
1084
+ $str = str_replace( '[user_avatar_64]' , get_avatar( $current_user->ID , 64 ) , $str );
1085
+ }
1086
+ if( strstr( $str , '[post_type]') ) {
1087
+
1088
+ $post_name = '';
1089
+
1090
+ if( is_admin() ) {
1091
+
1092
+ global $current_screen;
1093
+ global $typenow;
1094
+ global $tax;
1095
+
1096
+ if( $current_screen->base == 'edit' or $current_screen->base == 'post' && !empty( $typenow ) ) {
1097
+
1098
+ $post_type_object = get_post_type_object( $typenow );
1099
+
1100
+ if( !empty( $post_type_object->public ) ) {
1101
+
1102
+ $post_name = $post_type_object->labels->singular_name;
1103
+
1104
+ }
1105
+
1106
+ } elseif( $current_screen->base == 'edit-tags' && !empty( $tax ) ) {
1107
+
1108
+ if( !empty( $tax->public ) ) {
1109
+
1110
+ $post_name = $tax->labels->singular_name;
1111
+
1112
+ }
1113
+
1114
+ }
1115
+
1116
+
1117
+ } else {
1118
+
1119
+ $queried_object = get_queried_object();
1120
+
1121
+ if( !empty( $queried_object->post_type ) ) {
1122
+
1123
+ $post_type_object = get_post_type_object( $queried_object->post_type );
1124
+
1125
+ if( !empty( $post_type_object->public ) ) {
1126
+
1127
+ $post_name = $post_type_object->labels->singular_name;
1128
+
1129
+ }
1130
+
1131
+ } elseif( !empty( $queried_object->taxonomy ) ) {
1132
+
1133
+ $tax = get_taxonomy( $queried_object->taxonomy );
1134
+
1135
+ if( !empty( $tax->public ) ) {
1136
+
1137
+ $post_name = $tax->labels->singular_name;
1138
+
1139
+ }
1140
+
1141
+ }
1142
+
1143
+ }
1144
+
1145
+ $str = str_replace( '[post_type]' , $post_name , $str );
1146
+
1147
+ }
1148
+
1149
+ if( is_multisite() ) {
1150
+ if( strstr( $str , '[site_name]') ) {
1151
+ $str = str_replace( '[site_name]' , esc_attr( $current_site->site_name ) , $str );
1152
+ }
1153
+ if( strstr( $str , '[site_url]') ) {
1154
+ $str = str_replace( '[site_url]' , $this->Schema . esc_attr( $current_site->domain . $current_site->path ) , $str );
1155
+ }
1156
+ }
1157
+
1158
+ if( !empty( $this->ActivatedPlugin ) ) {
1159
+
1160
+ $activated_plugins = $this->ActivatedPlugin;
1161
+
1162
+ if( !empty( $activated_plugins['woocommerce'] ) ) {
1163
+
1164
+ if( strstr( $str , '[woocommerce_order_process_count]') ) {
1165
+
1166
+ $woocommerce_order_process_count = '';
1167
+ if( function_exists( 'wc_processing_order_count' ) ) {
1168
+
1169
+ $order_count = intval( wc_processing_order_count() );
1170
+ if ( !empty( $order_count ) ) {
1171
+ $woocommerce_order_process_count = ' <span class="awaiting-mod update-plugins count-' . $order_count . '"><span class="processing-count">' . number_format_i18n( $order_count ) . '</span></span>';
1172
+ }
1173
+ }
1174
+
1175
+ $str = str_replace( '[woocommerce_order_process_count]' , $woocommerce_order_process_count , $str );
1176
+ }
1177
+
1178
+ }
1179
+
1180
+ }
1181
+
1182
+ }
1183
+
1184
+ return $str;
1185
+ }
1186
+
1187
+ // SetList
1188
+ function current_user_role_group() {
1189
+ $UserRole = '';
1190
+ $User = wp_get_current_user();
1191
+ if( !empty( $User->roles ) ) {
1192
+ $current_roles = $User->roles;
1193
+ foreach( $current_roles as $role ) {
1194
+ $UserRole = $role;
1195
+ break;
1196
+ }
1197
+ }
1198
+ if( empty( $UserRole ) && is_multisite() ) {
1199
+ $current_site = get_current_site();
1200
+ switch_to_blog( $current_site->blog_id );
1201
+ $User = wp_get_current_user();
1202
+ if( !empty( $User->roles ) ) {
1203
+ $current_roles = $User->roles;
1204
+ foreach( $current_roles as $role ) {
1205
+ $UserRole = $role;
1206
+ break;
1207
+ }
1208
+ }
1209
+ restore_current_blog();
1210
+ }
1211
+ return $UserRole;
1212
+ }
1213
+
1214
+ // SetList
1215
+ function admin_bar_places() {
1216
+ return $Place_types = array( "left" => __( 'Left' ) , "right" => __( 'Right' ) , "front" => __( 'Front' , 'wp-admin-ui-customize' ) );
1217
+ }
1218
+
1219
+ // SetList
1220
+ function get_plugin_cap() {
1221
+ $capability = 'manage_options';
1222
+
1223
+ $Data = $this->get_data( 'plugin_cap' );
1224
+ if( !empty( $Data["edit_cap"] ) ) {
1225
+ $capability = $Data["edit_cap"];
1226
+ }
1227
+
1228
+ return $capability;
1229
+ }
1230
+
1231
+ // SetList
1232
+ function get_document_link( $document_type ) {
1233
+
1234
+ $link = $this->Site;
1235
+ $locale = get_locale();
1236
+
1237
+ if( !empty( $document_type ) ) {
1238
+
1239
+ if( $locale == 'ja' ) {
1240
+ $link .= 'ja/';
1241
+ } else {
1242
+ $link .= 'blog/';
1243
+ }
1244
+
1245
+ if( $document_type == 'admin_bar' ) {
1246
+ $link .= 'admin-bar-toolbar-settings/';
1247
+ }
1248
+
1249
+ }
1250
+
1251
+ echo $link;
1252
+
1253
+ }
1254
+
1255
+
1256
+
1257
+
1258
+ // DataUpdate
1259
+ function dataUpdate() {
1260
+
1261
+ $RecordField = false;
1262
+
1263
+ if( !empty( $_POST[$this->Nonces["field"]] ) ) {
1264
+
1265
+ if( !empty( $_POST["record_field"] ) ) {
1266
+ $RecordField = strip_tags( $_POST["record_field"] );
1267
+ }
1268
+
1269
+ if( !empty( $RecordField ) && !empty( $_POST["update"] ) ) {
1270
+
1271
+ if( $RecordField == 'user_role' ) {
1272
+ $this->update_userrole();
1273
+ } elseif( $RecordField == 'site' ) {
1274
+ $this->update_site();
1275
+ } elseif( $RecordField == 'admin_general' ) {
1276
+ $this->update_admin_general();
1277
+ } elseif( $RecordField == 'dashboard' ) {
1278
+ $this->update_dashboard();
1279
+ } elseif( $RecordField == 'admin_bar_menu' ) {
1280
+ $this->update_admin_bar_menu();
1281
+ } elseif( $RecordField == 'sidemenu' ) {
1282
+ $this->update_sidemenu();
1283
+ } elseif( $RecordField == 'manage_metabox' ) {
1284
+ $this->update_manage_metabox();
1285
+ } elseif( $RecordField == 'post_add_edit' ) {
1286
+ $this->update_post_add_edit();
1287
+ } elseif( $RecordField == 'appearance_menus' ) {
1288
+ $this->update_appearance_menus();
1289
+ } elseif( $RecordField == 'loginscreen' ) {
1290
+ $this->update_loginscreen();
1291
+ } elseif( $RecordField == 'plugin_cap' ) {
1292
+ $this->update_plugincap();
1293
+ }
1294
+
1295
+ }
1296
+
1297
+
1298
+ if( !empty( $RecordField ) && !empty( $_POST["reset"] ) ) {
1299
+
1300
+ if( $RecordField == 'manage_metabox' ) {
1301
+ delete_option( $this->Record["regist_metabox"] );
1302
+ } elseif( $RecordField == 'dashboard' ) {
1303
+ delete_option( $this->Record["regist_dashboard_metabox"] );
1304
+ }
1305
+
1306
+ if( $RecordField == 'all_settings' ) {
1307
+ $this->update_reset_all();
1308
+ } else {
1309
+ $this->update_reset( $RecordField );
1310
+ }
1311
+ }
1312
+
1313
+ if( !empty( $_POST["donate_key"] ) && !empty( $_POST["update"] ) ) {
1314
+ $this->DonatingCheck();
1315
+ }
1316
+ }
1317
+
1318
+ }
1319
+
1320
+ // DataUpdate
1321
+ function update_validate() {
1322
+ $Update = array();
1323
+
1324
+ if( !empty( $_POST[$this->UPFN] ) ) {
1325
+ $UPFN = strip_tags( $_POST[$this->UPFN] );
1326
+ if( $UPFN == $this->UPFN ) {
1327
+ $Update["UPFN"] = strip_tags( $_POST[$this->UPFN] );
1328
+ }
1329
+ }
1330
+
1331
+ return $Update;
1332
+ }
1333
+
1334
+ // DataUpdate
1335
+ function update_reset( $record ) {
1336
+ $Update = $this->update_validate();
1337
+ if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1338
+ $record = apply_filters( 'wauc_pre_delete' , $this->Record[$record] );
1339
+ delete_option( $record );
1340
+ wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'delete' , stripslashes( $_POST["_wp_http_referer"] ) ) ) );
1341
+ exit;
1342
+ }
1343
+ }
1344
+
1345
+ // DataUpdate
1346
+ function update_reset_all() {
1347
+ $Update = $this->update_validate();
1348
+ if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1349
+
1350
+ foreach( $this->Record as $key => $record ) {
1351
+ if( $key != 'donate' ) {
1352
+ delete_option( $record );
1353
+ }
1354
+ }
1355
+ wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'delete' , stripslashes( $_POST["_wp_http_referer"] ) ) ) );
1356
+ exit;
1357
+ }
1358
+ }
1359
+
1360
+ // DataUpdate
1361
+ function DonatingCheck() {
1362
+ $Update = $this->update_validate();
1363
+
1364
+ if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1365
+ if( !empty( $_POST["donate_key"] ) ) {
1366
+ $SubmitKey = md5( strip_tags( $_POST["donate_key"] ) );
1367
+ if( $this->DonateKey == $SubmitKey ) {
1368
+ update_option( $this->Record["donate"] , $SubmitKey );
1369
+ wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'donated' ) ) );
1370
+ exit;
1371
+ }
1372
+ }
1373
+ }
1374
+
1375
+ }
1376
+
1377
+ // DataUpdate
1378
+ function update_userrole() {
1379
+ $Update = $this->update_validate();
1380
+ if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1381
+
1382
+ if( !empty( $_POST["data"]["user_role"] ) ) {
1383
+ foreach($_POST["data"]["user_role"] as $key => $val) {
1384
+ $tmpK = strip_tags( $key );
1385
+ $tmpV = strip_tags ( $val );
1386
+ $Update[$tmpK] = $tmpV;
1387
+ }
1388
+ }
1389
+
1390
+ update_option( $this->Record["user_role"] , $Update );
1391
+ wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'update' , stripslashes( $_POST["_wp_http_referer"] ) ) ) );
1392
+ exit;
1393
+ }
1394
+ }
1395
+
1396
+ // DataUpdate
1397
+ function update_site() {
1398
+ $Update = $this->update_validate();
1399
+ if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1400
+
1401
+ if( !empty( $_POST["data"] ) ) {
1402
+ foreach($_POST["data"] as $key => $val) {
1403
+ $tmpK = strip_tags( $key );
1404
+ $tmpV = strip_tags ( $val );
1405
+ $Update[$tmpK] = $tmpV;
1406
+ }
1407
+ }
1408
+
1409
+ $Record = apply_filters( 'wauc_pre_update' , $this->Record["site"] );
1410
+ update_option( $Record , $Update );
1411
+ wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'update' , stripslashes( $_POST["_wp_http_referer"] ) ) ) );
1412
+ exit;
1413
+ }
1414
+ }
1415
+
1416
+ // DataUpdate
1417
+ function update_admin_general() {
1418
+ $Update = $this->update_validate();
1419
+ if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1420
+
1421
+ if( !empty( $_POST["data"] ) ) {
1422
+ foreach($_POST["data"] as $key => $val) {
1423
+ $tmpK = strip_tags( $key );
1424
+ $tmpV = $val;
1425
+ $Update[$tmpK] = $tmpV;
1426
+ }
1427
+ }
1428
+
1429
+ $Record = apply_filters( 'wauc_pre_update' , $this->Record["admin_general"] );
1430
+ update_option( $Record , $Update );
1431
+ wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'update' , stripslashes( $_POST["_wp_http_referer"] ) ) ) );
1432
+ exit;
1433
+ }
1434
+ }
1435
+
1436
+ // DataUpdate
1437
+ function update_dashboard() {
1438
+ $Update = $this->update_validate();
1439
+ if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1440
+
1441
+ if( !empty( $_POST["data"] ) ) {
1442
+ foreach($_POST["data"] as $key => $val) {
1443
+ $tmpK = strip_tags( $key );
1444
+ $tmpV = $val;
1445
+ $Update[$tmpK] = $tmpV;
1446
+ }
1447
+ }
1448
+
1449
+ $Record = apply_filters( 'wauc_pre_update' , $this->Record["dashboard"] );
1450
+ update_option( $Record , $Update );
1451
+ wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'update' , stripslashes( $_POST["_wp_http_referer"] ) ) ) );
1452
+ exit;
1453
+ }
1454
+ }
1455
+
1456
+ // DataUpdate
1457
+ function update_admin_bar_menu() {
1458
+ $Update = $this->update_validate();
1459
+ if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1460
+
1461
+ if( !empty( $_POST["data"] ) ) {
1462
+ foreach($_POST["data"] as $boxtype => $nodes) {
1463
+ if( $boxtype === 'left' or $boxtype === 'right' ) {
1464
+ foreach($nodes as $key => $node) {
1465
+ $id = "";
1466
+ if( !empty( $node["id"] ) ) {
1467
+ $id = strip_tags( $node["id"] );
1468
+ }
1469
+ $title = "";
1470
+ if( !empty( $node["title"] ) ) {
1471
+ $title = stripslashes( $node["title"] );
1472
+ }
1473
+ $href = "";
1474
+ if( !empty( $node["href"] ) ) {
1475
+ $href = strip_tags( $node["href"] );
1476
+ }
1477
+ $group = "";
1478
+ if( !empty( $node["group"] ) ) {
1479
+ $group = intval( $node["group"] );
1480
+ }
1481
+ $parent = "";
1482
+ if( !empty( $node["parent"] ) ) {
1483
+ $parent = strip_tags( $node["parent"] );
1484
+ }
1485
+ $node_type = "";
1486
+ if( !empty( $node["node_type"] ) ) {
1487
+ $node_type = strip_tags( $node["node_type"] );
1488
+ }
1489
+ $meta = array();
1490
+ if( !empty( $node["meta"] ) ) {
1491
+ foreach( $node["meta"] as $mk => $mv ) {
1492
+ if( !empty( $mv ) ) {
1493
+ $meta[strip_tags($mk)] = strip_tags($mv);
1494
+ }
1495
+ }
1496
+ }
1497
+
1498
+ $Update[$boxtype][$node_type][] = array( "id" => $id , "title" => $title , "href" => $href , "parent" => $parent , "group" => $group , "meta" => $meta );
1499
+ }
1500
+ }
1501
+ }
1502
+ }
1503
+
1504
+ $Record = apply_filters( 'wauc_pre_update' , $this->Record["admin_bar_menu"] );
1505
+ update_option( $Record , $Update );
1506
+ wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'update' , stripslashes( $_POST["_wp_http_referer"] ) ) ) );
1507
+ exit;
1508
+ }
1509
+ }
1510
+
1511
+ // DataUpdate
1512
+ function update_sidemenu() {
1513
+ $Update = $this->update_validate();
1514
+ if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1515
+
1516
+ if( !empty( $_POST["data"] ) ) {
1517
+ foreach($_POST["data"] as $menu) {
1518
+ if( !empty( $menu["title"] ) && !empty( $menu["slug"] ) ) {
1519
+ $slug = htmlspecialchars( $menu["slug"] );
1520
+ $title = stripslashes( $menu["title"] );
1521
+ $parent_slug = '';
1522
+ $depth = 'main';
1523
+
1524
+ if( !empty( $menu["parent_slug"] ) ) {
1525
+ $parent_slug = strip_tags( $menu["parent_slug"] );
1526
+ $depth = 'sub';
1527
+ }
1528
+
1529
+ $Update[$depth][] = array( "slug" => $slug , "title" => $title , "parent_slug" => $parent_slug );
1530
+ }
1531
+ }
1532
+ }
1533
+
1534
+ $Record = apply_filters( 'wauc_pre_update' , $this->Record["sidemenu"] );
1535
+ update_option( $Record , $Update );
1536
+ wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'update' , stripslashes( $_POST["_wp_http_referer"] ) ) ) );
1537
+ exit;
1538
+ }
1539
+ }
1540
+
1541
+ // DataUpdate
1542
+ function update_manage_metabox() {
1543
+ $Update = $this->update_validate();
1544
+ if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1545
+
1546
+ if( !empty( $_POST["data"] ) ) {
1547
+ foreach($_POST["data"] as $post_type => $val) {
1548
+ $post_type = strip_tags( $post_type );
1549
+ if( is_array( $val ) ) {
1550
+ foreach($val as $id => $v) {
1551
+ $tmpK = strip_tags( $id );
1552
+ $tmpV = $v;
1553
+ $Update[$post_type][$tmpK] = $tmpV;
1554
+ }
1555
+ }
1556
+ }
1557
+ }
1558
+
1559
+ $Record = apply_filters( 'wauc_pre_update' , $this->Record["manage_metabox"] );
1560
+ update_option( $Record , $Update );
1561
+ wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'update' , stripslashes( $_POST["_wp_http_referer"] ) ) ) );
1562
+ exit;
1563
+ }
1564
+ }
1565
+
1566
+ // DataUpdate
1567
+ function update_post_add_edit() {
1568
+ $Update = $this->update_validate();
1569
+ if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1570
+
1571
+ if( !empty( $_POST["data"] ) ) {
1572
+ foreach($_POST["data"] as $edited => $val) {
1573
+ $tmpK = strip_tags( $edited );
1574
+ $tmpV = strip_tags ( $val );
1575
+ $Update[$tmpK] = $tmpV;
1576
+ }
1577
+ }
1578
+
1579
+ $Record = apply_filters( 'wauc_pre_update' , $this->Record["post_add_edit"] );
1580
+ update_option( $Record , $Update );
1581
+ wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'update' , stripslashes( $_POST["_wp_http_referer"] ) ) ) );
1582
+ exit;
1583
+ }
1584
+ }
1585
+
1586
+ // DataUpdate
1587
+ function update_appearance_menus() {
1588
+ $Update = $this->update_validate();
1589
+ if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1590
+
1591
+ if( !empty( $_POST["data"] ) ) {
1592
+ foreach($_POST["data"] as $edited => $val) {
1593
+ $tmpK = strip_tags( $edited );
1594
+ $tmpV = strip_tags ( $val );
1595
+ $Update[$tmpK] = $tmpV;
1596
+ }
1597
+ }
1598
+
1599
+ $Record = apply_filters( 'wauc_pre_update' , $this->Record["appearance_menus"] );
1600
+ update_option( $Record , $Update );
1601
+ wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'update' , stripslashes( $_POST["_wp_http_referer"] ) ) ) );
1602
+ exit;
1603
+ }
1604
+ }
1605
+
1606
+ // DataUpdate
1607
+ function update_loginscreen() {
1608
+ $Update = $this->update_validate();
1609
+ if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1610
+
1611
+ if( !empty( $_POST["data"] ) ) {
1612
+ foreach($_POST["data"] as $key => $val) {
1613
+ $tmpK = strip_tags( $key );
1614
+ $tmpV = $val;
1615
+ $Update[$tmpK] = $tmpV;
1616
+ }
1617
+ }
1618
+
1619
+ $Record = apply_filters( 'wauc_pre_update' , $this->Record["loginscreen"] );
1620
+ update_option( $Record , $Update );
1621
+ wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'update' , stripslashes( $_POST["_wp_http_referer"] ) ) ) );
1622
+ exit;
1623
+
1624
+ }
1625
+ }
1626
+
1627
+ // DataUpdate
1628
+ function update_plugincap() {
1629
+ $Update = $this->update_validate();
1630
+ if( !empty( $Update ) && check_admin_referer( $this->Nonces["value"] , $this->Nonces["field"] ) ) {
1631
+
1632
+ if( !empty( $_POST["data"]["edit_cap"] ) ) {
1633
+ $Update["edit_cap"] = strip_tags( $_POST["data"]["edit_cap"] );
1634
+ }
1635
+
1636
+ $Record = apply_filters( 'wauc_pre_update' , $this->Record["plugin_cap"] );
1637
+ update_option( $Record , $Update );
1638
+ wp_redirect( esc_url_raw( add_query_arg( $this->MsgQ , 'update' , stripslashes( $_POST["_wp_http_referer"] ) ) ) );
1639
+ exit;
1640
+
1641
+ }
1642
+ }
1643
+
1644
+
1645
+
1646
+
1647
+
1648
+ // FilterStart
1649
+ function FilterStart() {
1650
+
1651
+ // site
1652
+ if( !is_admin() ) {
1653
+ add_action( 'wp_loaded' , array( $this , 'remove_action_front' ) ) ;
1654
+ add_filter( 'login_headerurl' , array( $this , 'login_headerurl' ) );
1655
+ add_filter( 'login_headertitle' , array( $this , 'login_headertitle' ) );
1656
+ add_action( 'login_head' , array( $this , 'login_head' ) );
1657
+ add_action( 'login_footer' , array( $this , 'login_footer' ) );
1658
+
1659
+ // front init
1660
+ add_action( 'wp_loaded' , array( $this , 'front_init' ) );
1661
+ }
1662
+
1663
+ // admin UI
1664
+ if( is_admin() && !is_network_admin () ) {
1665
+ // admin init
1666
+ add_action( 'wp_loaded' , array( $this , 'admin_init' ) );
1667
+ }
1668
+
1669
+ }
1670
+
1671
+ // FilterStart
1672
+ function admin_init() {
1673
+
1674
+ $SettingRole = $this->get_data( 'user_role' );
1675
+ $SettingRole = apply_filters( 'wauc_pre_setting_roles' , $SettingRole );
1676
+
1677
+ if( !empty( $SettingRole ) ) {
1678
+ unset($SettingRole["UPFN"]);
1679
+
1680
+ $UserRole = $this->current_user_role_group();
1681
+
1682
+ if( !is_network_admin() && !empty( $UserRole ) ) {
1683
+ if( array_key_exists( $UserRole , $SettingRole ) ) {
1684
+ add_action( 'wp_before_admin_bar_render' , array( $this , 'admin_bar_menu') , 25 );
1685
+ add_action( 'wp_loaded' , array( $this , 'notice_dismiss' ) , 2 );
1686
+ add_action( 'admin_head' , array( $this , 'remove_tab' ) );
1687
+ add_filter( 'admin_footer_text' , array( $this , 'admin_footer_text' ) );
1688
+ add_action( 'admin_print_styles' , array( $this , 'load_css' ) );
1689
+ add_action( 'wp_dashboard_setup' , array( $this , 'wp_dashboard_setup' ) , 10001 );
1690
+ add_action( 'admin_head' , array( $this , 'manage_metabox' ) , 10001 );
1691
+ add_filter( 'admin_head', array( $this , 'sidemenu' ) );
1692
+ add_filter( 'get_sample_permalink_html' , array( $this , 'add_edit_post_change_permalink' ) );
1693
+ add_filter( 'edit_form_after_title' , array( $this , 'allow_comments' ) );
1694
+ add_action( 'admin_print_styles-nav-menus.php', array( $this , 'nav_menus' ) );
1695
+ add_filter( 'admin_title', array( $this, 'admin_title' ) );
1696
+ add_action( 'admin_footer' , array( $this , 'admin_bar_resizing' ) );
1697
+ }
1698
+ }
1699
+ }
1700
+ }
1701
+
1702
+ // FilterStart
1703
+ function front_init() {
1704
+
1705
+ $SettingRole = $this->get_flit_data( 'user_role' );
1706
+ $SettingRole = apply_filters( 'wauc_pre_setting_roles' , $SettingRole );
1707
+
1708
+ if( !empty( $SettingRole ) ) {
1709
+ unset($SettingRole["UPFN"]);
1710
+
1711
+ $UserRole = $this->current_user_role_group();
1712
+
1713
+ if( !is_network_admin() && !empty( $UserRole ) ) {
1714
+ if( array_key_exists( $UserRole , $SettingRole ) ) {
1715
+
1716
+ add_action( 'wp_footer' , array( $this , 'admin_bar_resizing' ) );
1717
+ add_action( 'wp_loaded' , array( $this , 'notice_dismiss' ) , 2 );
1718
+
1719
+ $GetData = $this->get_flit_data( 'site' );
1720
+
1721
+ if( !empty( $GetData["admin_bar"] ) ) {
1722
+ if( $GetData["admin_bar"] == "hide" ) {
1723
+ add_filter( 'show_admin_bar' , '__return_false' );
1724
+ } elseif( $GetData["admin_bar"] == "front" ) {
1725
+ add_action( 'wp_before_admin_bar_render' , array( $this , 'admin_bar_menu') , 25 );
1726
+ }
1727
+ }
1728
+ }
1729
+ }
1730
+ }
1731
+ }
1732
+
1733
+ // FilterStart
1734
+ function remove_action_front() {
1735
+ $GetData = get_option( $this->Record['site'] );
1736
+
1737
+ if( !empty( $GetData["UPFN"] ) ) {
1738
+ unset( $GetData["UPFN"] );
1739
+ foreach($GetData as $key => $val) {
1740
+ if( $key == 'feed_links' ) {
1741
+ remove_action( 'wp_head', $key , 2 );
1742
+ } elseif( $key == 'feed_links_extra' ) {
1743
+ remove_action( 'wp_head', $key , 3 );
1744
+ } else {
1745
+ remove_action( 'wp_head', $key );
1746
+ }
1747
+ }
1748
+ }
1749
+ }
1750
+
1751
+ // FilterStart
1752
+ function login_headerurl() {
1753
+ $GetData = get_option( $this->Record["loginscreen"] );
1754
+
1755
+ $url = __( 'http://wordpress.org/' );
1756
+ if( !empty( $GetData["UPFN"] ) ) {
1757
+ unset( $GetData["UPFN"] );
1758
+
1759
+ if( !empty( $GetData["login_headerurl"] ) ) {
1760
+ $url = strip_tags( $GetData["login_headerurl"] );
1761
+ $url = $this->val_replace( $url );
1762
+ }
1763
+ }
1764
+
1765
+ return $url;
1766
+ }
1767
+
1768
+ // FilterStart
1769
+ function login_headertitle() {
1770
+ $GetData = get_option( $this->Record["loginscreen"] );
1771
+
1772
+ $title = __( 'Powered by WordPress' );
1773
+ if( !empty( $GetData["UPFN"] ) ) {
1774
+ unset( $GetData["UPFN"] );
1775
+
1776
+ if( !empty( $GetData["login_headertitle"] ) ) {
1777
+ $title = strip_tags( $GetData["login_headertitle"] );
1778
+ $title = $this->val_replace( $title );
1779
+ }
1780
+ }
1781
+
1782
+ return $title;
1783
+ }
1784
+
1785
+ // FilterStart
1786
+ function login_head() {
1787
+ $GetData = get_option( $this->Record["loginscreen"] );
1788
+
1789
+ if( !empty( $GetData["UPFN"] ) ) {
1790
+ unset( $GetData["UPFN"] );
1791
+
1792
+ if( !empty( $GetData["login_headerlogo"] ) ) {
1793
+ $logo = strip_tags( $GetData["login_headerlogo"] );
1794
+ $logo = $this->val_replace( $logo );
1795
+
1796
+ echo '<style type="text/css">.login h1 a { background-image: url(' . $logo . '); }</style>';
1797
+ }
1798
+
1799
+ if( !empty( $GetData["login_css"] ) ) {
1800
+ $css = strip_tags( $GetData["login_css"] );
1801
+ $css = $this->val_replace( $css );
1802
+
1803
+ wp_enqueue_style( $this->PageSlug , $css , array() , $this->Ver );
1804
+ }
1805
+
1806
+ }
1807
+
1808
+ }
1809
+
1810
+ // FilterStart
1811
+ function login_footer() {
1812
+ $GetData = get_option( $this->Record["loginscreen"] );
1813
+
1814
+ if( !empty( $GetData["UPFN"] ) ) {
1815
+ unset( $GetData["UPFN"] );
1816
+
1817
+ if( !empty( $GetData["login_footer"] ) ) {
1818
+ $text = $this->val_replace( stripslashes( $GetData["login_footer"] ) );
1819
+
1820
+ echo $text;
1821
+ }
1822
+
1823
+ }
1824
+ }
1825
+
1826
+ // FilterStart
1827
+ function admin_bar_menu() {
1828
+ global $wp_admin_bar;
1829
+
1830
+ if( empty( $wp_admin_bar ) ) {
1831
+
1832
+ return false;
1833
+
1834
+ }
1835
+
1836
+ $GetData = $this->get_flit_data( 'admin_bar_menu' );
1837
+
1838
+ if( !empty( $GetData["UPFN"] ) ) {
1839
+ unset( $GetData["UPFN"] );
1840
+ if( is_array( $GetData ) ) {
1841
+
1842
+ // admin bar initialize nodes
1843
+ $All_Nodes = $wp_admin_bar->get_nodes();
1844
+ foreach( $All_Nodes as $node ) {
1845
+ if( $node->id != 'top-secondary' ) {
1846
+ $wp_admin_bar->remove_node( $node->id );
1847
+ }
1848
+ }
1849
+
1850
+ $SettingNodes = $GetData;
1851
+ $user_id = get_current_user_id();
1852
+ $current_user = wp_get_current_user();
1853
+ $profile_url = get_edit_profile_url( $user_id );
1854
+ $update_data = wp_get_update_data();
1855
+ $activated_plugin = $this->ActivatedPlugin;
1856
+ $other_plugin = $this->OtherPluginMenu;
1857
+
1858
+ // all nodes adjustment
1859
+ foreach($SettingNodes as $Boxtype => $allnodes) {
1860
+ foreach($allnodes as $node_type => $nodes) {
1861
+ foreach($nodes as $key => $node) {
1862
+
1863
+ if( strstr( $node["id"] , 'custom_node' ) ) {
1864
+ if( !empty( $node["group"] ) ) {
1865
+ $node["meta"]["class"] = 'ab-sub-secondary';
1866
+ } else {
1867
+ $node["href"] = $this->val_replace( $node["href"] );
1868
+ }
1869
+ } elseif( $node["id"] == 'view-post_type' ) {
1870
+
1871
+ if( is_admin() ) {
1872
+
1873
+ if( !empty( $All_Nodes['preview'] ) ) {
1874
+
1875
+ $node["href"] = $All_Nodes['preview']->href;
1876
+ $node["meta"] = $All_Nodes['preview']->meta;
1877
+
1878
+ } elseif( !empty( $All_Nodes['view'] ) ) {
1879
+
1880
+ $node["href"] = $All_Nodes['view']->href;
1881
+ $node["meta"] = $All_Nodes['view']->meta;
1882
+
1883
+ } else {
1884
+
1885
+ unset( $SettingNodes[$Boxtype][$node_type][$key] );
1886
+ continue;
1887
+
1888
+ }
1889
+
1890
+ } else {
1891
+
1892
+ unset( $SettingNodes[$Boxtype][$node_type][$key] );
1893
+ continue;
1894
+
1895
+ }
1896
+
1897
+ } elseif( $node["id"] == 'edit-post_type' ) {
1898
+
1899
+ if( !empty( $All_Nodes["edit"] ) ) {
1900
+
1901
+ //$node["title"] = $All_Nodes["edit"]->title;
1902
+ $node["href"] = $All_Nodes["edit"]->href;
1903
+ $node["id"] = $All_Nodes["edit"]->id;
1904
+
1905
+ } else {
1906
+
1907
+ unset( $SettingNodes[$Boxtype][$node_type][$key] );
1908
+ continue;
1909
+
1910
+ }
1911
+
1912
+ } elseif( $node["id"] == 'search' ) {
1913
+ if( !empty( $All_Nodes["search"] ) ) {
1914
+ $node["title"] = $All_Nodes["search"]->title;
1915
+ $node["id"] = $All_Nodes["search"]->id;
1916
+ $node["href"] = "";
1917
+ $node["meta"]["class"] = $All_Nodes["search"]->meta["class"];
1918
+ } else {
1919
+ unset( $SettingNodes[$Boxtype][$node_type][$key] );
1920
+ continue;
1921
+ }
1922
+ } elseif( !empty( $All_Nodes[$node["id"]] ) ) {
1923
+ if( $node["id"] == 'search' ) {
1924
+ $node["href"] = $All_Nodes[$node["id"]]->href;
1925
+ $node["title"] = $All_Nodes[$node["id"]]->title;
1926
+ } else {
1927
+ $node["href"] = $All_Nodes[$node["id"]]->href;
1928
+ }
1929
+ } else {
1930
+ unset( $SettingNodes[$Boxtype][$node_type][$key] );
1931
+ continue;
1932
+ }
1933
+ if( !empty( $All_Nodes[$node["id"]]->meta["title"] ) ) {
1934
+ $node["meta"]["title"] = $All_Nodes[$node["id"]]->meta["title"];
1935
+ }
1936
+ if( $Boxtype == 'right' && $node_type == 'main' ) {
1937
+ $node["parent"] = "top-secondary";
1938
+ }
1939
+ if( strstr( $node["title"] , '[comment_count]') ) {
1940
+ if ( !current_user_can('edit_posts') ) {
1941
+ unset( $SettingNodes[$Boxtype][$node_type][$key] );
1942
+ continue;
1943
+ } else {
1944
+ $node["title"] = str_replace( '[comment_count]' , '<span class="ab-icon"></span><span id="ab-awaiting-mod" class="ab-label awaiting-mod pending-count count-[comment_count]">[comment_count_format]</span>' , $node["title"] );
1945
+ }
1946
+ }
1947
+ if( strstr( $node["title"] , '[update_total]') ) {
1948
+ if ( !$update_data['counts']['total'] ) {
1949
+ unset( $SettingNodes[$Boxtype][$node_type][$key] );
1950
+ continue;
1951
+ } else {
1952
+ $node["title"] = str_replace( '[update_total]' , '<span class="ab-icon"></span><span class="ab-label">[update_total_format]</span>' , $node["title"] );
1953
+ }
1954
+ }
1955
+ if( strstr( $node["title"] , '[update_plugins]') ) {
1956
+ if ( !$update_data['counts']['plugins'] ) {
1957
+ unset( $SettingNodes[$Boxtype][$node_type][$key] );
1958
+ continue;
1959
+ } else {
1960
+ $node["title"] = str_replace( '[update_plugins]' , '[update_plugins_format]' , $node["title"] );
1961
+ }
1962
+ }
1963
+ if( strstr( $node["title"] , '[update_themes]') ) {
1964
+ if ( !$update_data['counts']['themes'] ) {
1965
+ unset( $SettingNodes[$Boxtype][$node_type][$key] );
1966
+ continue;
1967
+ } else {
1968
+ $node["title"] = str_replace( '[update_themes]' , '[update_themes_format]' , $node["title"] );
1969
+ }
1970
+ }
1971
+ if( $node["id"] == 'logout' ) {
1972
+ $node["href"] = wp_logout_url();
1973
+ }
1974
+ if( $node["id"] == 'my-account' ) {
1975
+ $avatar = get_avatar( $user_id , 16 );
1976
+ $class = empty( $avatar ) ? '' : 'with-avatar';
1977
+ $node["meta"]["class"] = $class;
1978
+ }
1979
+ if( !isset( $node["group"] ) ) {
1980
+ $node["group"] = "";
1981
+ }
1982
+
1983
+ $node["title"] = $this->val_replace( $node["title"] );
1984
+
1985
+ $SettingNodes[$Boxtype][$node_type][$key] = $node;
1986
+
1987
+ }
1988
+ }
1989
+ }
1990
+
1991
+ // other plugin nodes
1992
+ foreach($SettingNodes as $Boxtype => $allnodes) {
1993
+ foreach($allnodes as $node_type => $nodes) {
1994
+ foreach($nodes as $key => $node) {
1995
+ if( !empty( $activated_plugin ) ) {
1996
+ if( $node["id"] == 'bp-notifications' ) {
1997
+ foreach($All_Nodes as $default_node_id => $default_node) {
1998
+ if( $default_node->parent == $node["id"] ) {
1999
+ $subnode_type = '';
2000
+ if( $node_type == 'main' ) {
2001
+ $subnode_type = 'sub';
2002
+ } elseif( $node_type == 'sub' ) {
2003
+ $subnode_type = 'sub2';
2004
+ } elseif( $node_type == 'sub2' ) {
2005
+ $subnode_type = 'sub3';
2006
+ } elseif( $node_type == 'sub3' ) {
2007
+ $subnode_type = 'sub4';
2008
+ }
2009
+ if( !empty( $subnode_type ) ) {
2010
+ $SettingNodes[$Boxtype][$subnode_type][] = (array) $default_node;
2011
+ }
2012
+ }
2013
+ }
2014
+ } elseif( $node["id"] == 'page_list' ) {
2015
+ foreach($All_Nodes as $default_node_id => $default_node) {
2016
+ if( $default_node->parent == $node["id"] ) {
2017
+ $subnode_type = '';
2018
+ if( $node_type == 'main' ) {
2019
+ $subnode_type = 'sub';
2020
+ } elseif( $node_type == 'sub' ) {
2021
+ $subnode_type = 'sub2';
2022
+ } elseif( $node_type == 'sub2' ) {
2023
+ $subnode_type = 'sub3';
2024
+ } elseif( $node_type == 'sub3' ) {
2025
+ $subnode_type = 'sub4';
2026
+ }
2027
+ if( !empty( $subnode_type ) ) {
2028
+ $SettingNodes[$Boxtype][$subnode_type][] = (array) $default_node;
2029
+ }
2030
+ }
2031
+ }
2032
+ } elseif( $node["id"] == 'post_list' ) {
2033
+ foreach($All_Nodes as $default_node_id => $default_node) {
2034
+ if( $default_node->parent == $node["id"] ) {
2035
+ $subnode_type = '';
2036
+ if( $node_type == 'main' ) {
2037
+ $subnode_type = 'sub';
2038
+ } elseif( $node_type == 'sub' ) {
2039
+ $subnode_type = 'sub2';
2040
+ } elseif( $node_type == 'sub2' ) {
2041
+ $subnode_type = 'sub3';
2042
+ } elseif( $node_type == 'sub3' ) {
2043
+ $subnode_type = 'sub4';
2044
+ }
2045
+ if( !empty( $subnode_type ) ) {
2046
+ $SettingNodes[$Boxtype][$subnode_type][] = (array) $default_node;
2047
+ }
2048
+ }
2049
+ }
2050
+ } elseif( $node["id"] == 'languages' ) {
2051
+ foreach($All_Nodes as $default_node_id => $default_node) {
2052
+ if( $default_node->parent == $node["id"] ) {
2053
+ $subnode_type = '';
2054
+ if( $node_type == 'main' ) {
2055
+ $subnode_type = 'sub';
2056
+ } elseif( $node_type == 'sub' ) {
2057
+ $subnode_type = 'sub2';
2058
+ } elseif( $node_type == 'sub2' ) {
2059
+ $subnode_type = 'sub3';
2060
+ } elseif( $node_type == 'sub3' ) {
2061
+ $subnode_type = 'sub4';
2062
+ }
2063
+ if( !empty( $subnode_type ) ) {
2064
+ $SettingNodes[$Boxtype][$subnode_type][] = (array) $default_node;
2065
+ }
2066
+ }
2067
+ }
2068
+ }
2069
+ foreach( $activated_plugin as $plugin_slug => $v ) {
2070
+ if( !empty( $other_plugin["admin_bar"][$plugin_slug] ) && array_key_exists( $node["id"] , $other_plugin["admin_bar"][$plugin_slug] ) ) {
2071
+ $SettingNodes[$Boxtype][$node_type][$key]["title"] = $All_Nodes[$node["id"]]->title;
2072
+ $SettingNodes[$Boxtype][$node_type][$key]["href"] = $All_Nodes[$node["id"]]->href;
2073
+ }
2074
+ }
2075
+ }
2076
+ }
2077
+ }
2078
+ }
2079
+
2080
+ // add main nodes
2081
+ foreach($SettingNodes as $Boxtype => $allnodes) {
2082
+ foreach($allnodes as $node_type => $nodes) {
2083
+ if( $node_type == 'main' ) {
2084
+ foreach($nodes as $node_id => $node) {
2085
+ $args = array( "id" => $node["id"] , "title" => stripslashes( $node["title"] ) , "href" => $node["href"] , "parent" => $node["parent"] , "group" => $node["group"] , "meta" => $node["meta"] );
2086
+ $wp_admin_bar->add_menu( $args );
2087
+ unset( $SettingNodes[$Boxtype][$node_type][$node_id] );
2088
+ }
2089
+ }
2090
+ }
2091
+ }
2092
+
2093
+ // add all nodes
2094
+ foreach($SettingNodes as $Boxtype => $allnodes) {
2095
+ foreach($allnodes as $node_type => $nodes) {
2096
+ if( $node_type != 'main' ) {
2097
+ foreach($nodes as $node_id => $node) {
2098
+ if( empty( $node["group"] ) ) {
2099
+ $args = array( "id" => $node["id"] , "title" => stripslashes( $node["title"] ) , "href" => $node["href"] , "parent" => $node["parent"] , "group" => false , "meta" => $node["meta"] );
2100
+ $wp_admin_bar->add_menu( $args );
2101
+ unset( $SettingNodes[$Boxtype][$node_type][$node_id] );
2102
+ }
2103
+ }
2104
+ }
2105
+ }
2106
+ }
2107
+
2108
+ // add groups
2109
+ foreach($SettingNodes as $Boxtype => $allnodes) {
2110
+ foreach($allnodes as $node_type => $nodes) {
2111
+ foreach($nodes as $node_id => $node) {
2112
+ if( !empty( $node["group"] ) ) {
2113
+ $args = array( "id" => $node["id"] , "parent" => $node["parent"] , "meta" => $node["meta"] );
2114
+ $wp_admin_bar->add_group( $args );
2115
+ unset( $SettingNodes[$Boxtype][$node_type][$node_id] );
2116
+ }
2117
+ }
2118
+ }
2119
+ }
2120
+
2121
+ }
2122
+ }
2123
+
2124
+ }
2125
+
2126
+ // FilterStart
2127
+ function notice_dismiss() {
2128
+ $GetData = $this->get_flit_data( 'admin_general' );
2129
+
2130
+ if( !empty( $GetData["UPFN"] ) ) {
2131
+
2132
+ if( !empty( $GetData["notice_update_core"] ) ) {
2133
+ add_filter( 'update_footer' , '__return_false' , 20) ;
2134
+ add_filter( 'site_transient_update_core' , array( $this , 'notice_update_core' ) );
2135
+ }
2136
+
2137
+ if( !empty( $GetData["notice_update_plugin"] ) ) {
2138
+ add_filter( 'site_transient_update_plugins' , array( $this , 'notice_update_plugin' ) );
2139
+ }
2140
+ if( !empty( $GetData["notice_update_theme"] ) ) {
2141
+ add_filter( 'site_transient_update_themes' , array( $this , 'notice_update_theme' ) );
2142
+ }
2143
+
2144
+ }
2145
+
2146
+ }
2147
+
2148
+ // FilterStart
2149
+ function notice_update_core( $site_transient_update_core ) {
2150
+ if( !empty( $site_transient_update_core ) && !empty( $site_transient_update_core->updates[0] ) && !empty( $site_transient_update_core->updates[0]->response ) ) {
2151
+ $site_transient_update_core->updates[0]->response = 'latest';
2152
+ }
2153
+
2154
+ return $site_transient_update_core;
2155
+ }
2156
+
2157
+ // FilterStart
2158
+ function notice_update_plugin( $site_transient_update_plugins ) {
2159
+ if( isset( $site_transient_update_plugins->response ) ) {
2160
+ unset( $site_transient_update_plugins->response );
2161
+ }
2162
+
2163
+ return $site_transient_update_plugins;
2164
+ }
2165
+
2166
+ // FilterStart
2167
+ function notice_update_theme( $site_transient_update_themes ) {
2168
+ if( isset( $site_transient_update_themes->response ) ) {
2169
+ unset( $site_transient_update_themes->response );
2170
+ }
2171
+
2172
+ return $site_transient_update_themes;
2173
+ }
2174
+
2175
+ // FilterStart
2176
+ function remove_tab() {
2177
+ $GetData = $this->get_flit_data( 'admin_general' );
2178
+
2179
+ if( !empty( $GetData["UPFN"] ) ) {
2180
+ unset( $GetData["UPFN"] );
2181
+
2182
+ if( !empty( $GetData["help_tab"] ) ) {
2183
+ $screen = get_current_screen();
2184
+ if( !empty( $screen ) ) {
2185
+ $screen->remove_help_tabs();
2186
+ }
2187
+ }
2188
+
2189
+ if( !empty( $GetData["screen_option_tab"] ) ) {
2190
+ add_filter( 'screen_options_show_screen' , '__return_false' );
2191
+ }
2192
+ }
2193
+ }
2194
+
2195
+ // FilterStart
2196
+ function admin_footer_text( $text ) {
2197
+ $GetData = $this->get_flit_data( 'admin_general' );
2198
+
2199
+ $footer_text = $text;
2200
+ if( !empty( $GetData["UPFN"] ) ) {
2201
+ unset( $GetData["UPFN"] );
2202
+
2203
+ $footer_text = $this->val_replace( stripslashes( $GetData["footer_text"] ) );
2204
+ }
2205
+
2206
+ return $footer_text;
2207
+ }
2208
+
2209
+ // FilterStart
2210
+ function load_css() {
2211
+ $GetData = $this->get_flit_data( 'admin_general' );
2212
+
2213
+ if( !empty( $GetData["UPFN"] ) ) {
2214
+ unset( $GetData["UPFN"] );
2215
+
2216
+ if( !empty( $GetData["css"] ) ) {
2217
+
2218
+ $css = strip_tags( $GetData["css"] );
2219
+ $css = $this->val_replace( $css );
2220
+
2221
+ wp_enqueue_style( $this->PageSlug . '-custom' , strip_tags( $css ) , array() , $this->Ver );
2222
+ }
2223
+
2224
+ }
2225
+ }
2226
+
2227
+ // FilterStart
2228
+ function wp_dashboard_setup() {
2229
+ global $wp_meta_boxes;
2230
+
2231
+ if( empty( $wp_meta_boxes ) ) {
2232
+
2233
+ return false;
2234
+
2235
+ }
2236
+
2237
+ $Data = $this->get_flit_data( 'dashboard' );
2238
+
2239
+ if( !empty( $Data ) && is_array( $Data ) ) {
2240
+ unset( $Data["UPFN"] );
2241
+
2242
+ if( !empty( $Data["metabox_move"] ) ) {
2243
+ wp_enqueue_script( 'not-move' , $this->Url . 'js/dashboard/not_move.js' , array( 'jquery' , 'jquery-ui-sortable' , 'dashboard' ) , $this->Ver , true );
2244
+ unset( $Data["metabox_move"] );
2245
+ }
2246
+
2247
+ if( !empty( $Data["show_welcome_panel"] ) ) {
2248
+ $user_id = get_current_user_id();
2249
+ if( get_user_meta( $user_id , 'show_welcome_panel' , true ) == true ) {
2250
+ update_user_meta( $user_id , 'show_welcome_panel' , 0 );
2251
+ }
2252
+ }
2253
+
2254
+ foreach( $wp_meta_boxes["dashboard"] as $context => $meta_box ) {
2255
+ foreach( $meta_box as $priority => $box ) {
2256
+ foreach( $box as $metabox_id => $b ) {
2257
+ if( !empty( $Data[$metabox_id]["remove"] ) ) {
2258
+ remove_meta_box( $metabox_id , 'dashboard' , $context );
2259
+ } elseif( !empty( $Data[$metabox_id]["name"] ) ) {
2260
+ $wp_meta_boxes["dashboard"][$context][$priority][$metabox_id]["title"] = stripslashes( $Data[$metabox_id]["name"] );
2261
+ }
2262
+ }
2263
+ }
2264
+ }
2265
+ }
2266
+
2267
+ }
2268
+
2269
+ // FilterStart
2270
+ function manage_metabox() {
2271
+ global $wp_meta_boxes, $current_screen, $post_type;
2272
+
2273
+ if( empty( $current_screen ) or empty( $wp_meta_boxes ) or empty( $post_type ) ) {
2274
+
2275
+ return false;
2276
+
2277
+ }
2278
+
2279
+ $GetData = $this->get_flit_data( 'manage_metabox' );
2280
+
2281
+ if( !empty( $GetData["UPFN"] ) ) {
2282
+ unset( $GetData["UPFN"] );
2283
+
2284
+ if( !empty( $GetData ) && is_array( $GetData ) ) {
2285
+
2286
+ if( $current_screen->base == 'post' ) {
2287
+
2288
+ if( !empty( $GetData[$post_type] ) ) {
2289
+
2290
+ $Metaboxes = $wp_meta_boxes[$post_type];
2291
+ $Data = $GetData[$post_type];
2292
+
2293
+ $Remove_metaboxes = array();
2294
+ foreach( $Metaboxes as $context => $meta_box ) {
2295
+ foreach( $meta_box as $priority => $box ) {
2296
+ foreach( $box as $metabox_id => $b ) {
2297
+ if( !empty( $Data[$metabox_id]["remove"] ) ) {
2298
+
2299
+ remove_meta_box( $metabox_id , $post_type , $context );
2300
+
2301
+ } else {
2302
+
2303
+ if( !empty( $Data[$metabox_id]["name"] ) ) {
2304
+ $wp_meta_boxes[$post_type][$context][$priority][$metabox_id]["title"] = stripslashes( $Data[$metabox_id]["name"] );
2305
+ }
2306
+
2307
+ if( !empty( $Data[$metabox_id]["toggle"] ) ) {
2308
+ add_filter( 'postbox_classes_' . $post_type . '_' . $metabox_id , array( $this , 'manage_metabox_close' ) );
2309
+ } else {
2310
+ add_filter( 'postbox_classes_' . $post_type . '_' . $metabox_id , array( $this , 'manage_metabox_open' ) );
2311
+ }
2312
+
2313
+ }
2314
+ }
2315
+ }
2316
+ }
2317
+
2318
+ }
2319
+
2320
+ }
2321
+ }
2322
+ }
2323
+
2324
+ }
2325
+
2326
+ // FilterStart
2327
+ function manage_metabox_close( $classes ) {
2328
+ $classes = array( 'closed' );
2329
+ return $classes;
2330
+ }
2331
+
2332
+ // FilterStart
2333
+ function manage_metabox_open( $classes ) {
2334
+ $classes = array();
2335
+ return $classes;
2336
+ }
2337
+
2338
+ // FilterStart
2339
+ function sidemenu() {
2340
+ global $menu;
2341
+ global $submenu;
2342
+
2343
+ if( empty( $menu ) ) {
2344
+
2345
+ return false;
2346
+
2347
+ }
2348
+
2349
+ $GetData = $this->get_flit_data( 'sidemenu' );
2350
+ $General = $this->get_flit_data( 'admin_general' );
2351
+
2352
+ if( !empty( $GetData["UPFN"] ) ) {
2353
+ unset( $GetData["UPFN"] );
2354
+
2355
+ if( !empty( $GetData ) && is_array( $GetData ) && !empty( $GetData["main"] ) ) {
2356
+ $SetMain_menu = array();
2357
+ $SetMain_submenu = array();
2358
+
2359
+ $separator_menu = array( 0 => "" , 1 => 'read' , 2 => 'separator1' , 3 => "" , 4 => 'wp-menu-separator' );
2360
+ $customize_url = esc_url( add_query_arg( 'return', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'customize.php' ) );
2361
+
2362
+ if( !empty( $GetData["main"] ) ) {
2363
+
2364
+ foreach( $GetData["main"] as $mm_pos => $mm ) {
2365
+
2366
+ if( $mm["slug"] == 'customize.php' ) {
2367
+
2368
+ $GetData["main"][$mm_pos]["slug"] = $customize_url;
2369
+
2370
+ } elseif( strstr( $mm["slug"] , 'customize.php?autofocus') ) {
2371
+
2372
+ $controll = str_replace( 'customize.php?autofocus%5Bcontrol%5D=' , '' , $mm["slug"] );
2373
+
2374
+ if( !empty( $controll ) )
2375
+ $GetData["main"][$mm_pos]["slug"] = esc_url( add_query_arg( 'autofocus[control]' , $controll , $customize_url ) );
2376
+
2377
+ }
2378
+
2379
+ if( strstr( $mm["title"] , '[comment_count]') ) {
2380
+ $GetData["main"][$mm_pos]["title"] = str_replace( '[comment_count]' , '<span class="update-plugins count-[comment_count]"><span class="comment-count">[comment_count_format]</span></span>' , $mm["title"] );
2381
+ }
2382
+ if( strstr( $mm["title"] , '[update_total]') ) {
2383
+ $GetData["main"][$mm_pos]["title"] = str_replace( '[update_total]' , '<span class="update-plugins count-[update_total]"><span class="update-count">[update_total_format]</span></span>' , $mm["title"] );
2384
+ }
2385
+ if( strstr( $mm["title"] , '[update_plugins]') ) {
2386
+ $GetData["main"][$mm_pos]["title"] = str_replace( '[update_plugins]' , '<span class="update-plugins count-[update_plugins]"><span class="plugin-count">[update_plugins_format]</span></span>' , $mm["title"] );
2387
+ }
2388
+ if( strstr( $mm["title"] , '[update_themes]') ) {
2389
+ $GetData["main"][$mm_pos]["title"] = str_replace( '[update_themes]' , '<span class="update-plugins count-[update_themes]"><span class="theme-count">[update_themes_format]</span></span>' , $mm["title"] );
2390
+ }
2391
+
2392
+ }
2393
+
2394
+ }
2395
+
2396
+ if( !empty( $GetData["sub"] ) ) {
2397
+
2398
+ foreach( $GetData["sub"] as $sm_pos => $sm ) {
2399
+
2400
+ if( $sm["slug"] == 'customize.php' ) {
2401
+
2402
+ $GetData["sub"][$sm_pos]["slug"] = $customize_url;
2403
+
2404
+ } elseif( strstr( $sm["slug"] , 'customize.php?autofocus%5Bcontrol%5D=') ) {
2405
+
2406
+ $controll = str_replace( 'customize.php?autofocus%5Bcontrol%5D=' , '' , $sm["slug"] );
2407
+
2408
+ if( !empty( $controll ) )
2409
+ $GetData["sub"][$sm_pos]["slug"] = esc_url( add_query_arg( 'autofocus[control]' , $controll , $customize_url ) );
2410
+
2411
+ }
2412
+
2413
+ if( strstr( $sm["title"] , '[comment_count]') ) {
2414
+ $GetData["sub"][$sm_pos]["title"] = str_replace( '[comment_count]' , '<span class="update-plugins count-[comment_count]"><span class="comment-count">[comment_count_format]</span></span>' , $sm["title"] );
2415
+ }
2416
+ if( strstr( $sm["title"] , '[update_total]') ) {
2417
+ $GetData["sub"][$sm_pos]["title"] = str_replace( '[update_total]' , '<span class="update-plugins count-[update_total]"><span class="update-count">[update_total_format]</span></span>' , $sm["title"] );
2418
+ }
2419
+ if( strstr( $sm["title"] , '[update_plugins]') ) {
2420
+ $GetData["sub"][$sm_pos]["title"] = str_replace( '[update_plugins]' , '<span class="update-plugins count-[update_plugins]"><span class="plugin-count">[update_plugins_format]</span></span>' , $sm["title"] );
2421
+ }
2422
+ if( strstr( $sm["title"] , '[update_themes]') ) {
2423
+ $GetData["sub"][$sm_pos]["title"] = str_replace( '[update_themes]' , '<span class="update-plugins count-[update_themes]"><span class="theme-count">[update_themes_format]</span></span>' , $sm["title"] );
2424
+ }
2425
+
2426
+ }
2427
+
2428
+ }
2429
+
2430
+ foreach($GetData["main"] as $mm_pos => $mm) {
2431
+ if($mm["slug"] == 'separator') {
2432
+ $SetMain_menu[] = $separator_menu;
2433
+ } else {
2434
+ $gm_search = false;
2435
+ $mm_slug_decode = htmlspecialchars_decode( $mm["slug"] );
2436
+ foreach($menu as $gm_pos => $gm) {
2437
+ if($mm["slug"] == $gm[2] or $mm_slug_decode == $gm[2]) {
2438
+ $menu[$gm_pos][0] = $this->val_replace( $mm["title"] );
2439
+ $SetMain_menu[] = $menu[$gm_pos];
2440
+ $gm_search = true;
2441
+ break;
2442
+ }
2443
+ }
2444
+ if( empty( $gm_search ) ) {
2445
+ foreach($submenu as $gsm_parent_slug => $v) {
2446
+ foreach($v as $gsm_pos => $gsm) {
2447
+ if($mm["slug"] == $gsm[2] or $mm_slug_decode == $gsm[2]) {
2448
+ foreach($menu as $tmp_m) {
2449
+ if( $tmp_m[2] == $gsm_parent_slug) {
2450
+ $submenu[$gsm_parent_slug][$gsm_pos][4] = $tmp_m[4];
2451
+ break;
2452
+ }
2453
+ }
2454
+ $submenu[$gsm_parent_slug][$gsm_pos][0] = $this->val_replace( $mm["title"] );
2455
+ $SetMain_menu[] = $submenu[$gsm_parent_slug][$gsm_pos];
2456
+
2457
+ }
2458
+ }
2459
+ }
2460
+ }
2461
+ }
2462
+ }
2463
+
2464
+ if( !empty( $GetData["sub"] ) ) {
2465
+ foreach($GetData["sub"] as $sm_pos => $sm) {
2466
+ $sm_slug_decode = htmlspecialchars_decode( $sm["slug"] );
2467
+ if($sm["slug"] == 'separator') {
2468
+ $SetMain_submenu[$sm["parent_slug"]][] = $separator_menu;
2469
+ } else {
2470
+ $gm_search = false;
2471
+ foreach($menu as $gm_pos => $gm) {
2472
+ if($sm["slug"] == $gm[2] or $sm_slug_decode == $gm[2]) {
2473
+ $menu[$gm_pos][0] = $this->val_replace( $sm["title"] );
2474
+ $SetMain_submenu[$sm["parent_slug"]][] = $menu[$gm_pos];
2475
+ $gm_search = true;
2476
+ break;
2477
+ }
2478
+ }
2479
+ if( empty( $gm_search ) ) {
2480
+ foreach($submenu as $gsm_parent_slug => $v) {
2481
+ foreach($v as $gsm_pos => $gsm) {
2482
+ if($sm["slug"] == $gsm[2] or $sm_slug_decode == $gsm[2]) {
2483
+ $submenu[$gsm_parent_slug][$gsm_pos][0] = $this->val_replace( $sm["title"] );
2484
+ $SetMain_submenu[$sm["parent_slug"]][] = $submenu[$gsm_parent_slug][$gsm_pos];
2485
+ }
2486
+ }
2487
+ }
2488
+ }
2489
+ }
2490
+ }
2491
+ }
2492
+
2493
+ $menu = $SetMain_menu;
2494
+
2495
+ foreach( $SetMain_submenu as $slug => $menu_set ) {
2496
+
2497
+ foreach( $menu_set as $key => $sm ) {
2498
+
2499
+ if( !empty( $SetMain_submenu[$slug][$key][4] ) && strstr( $SetMain_submenu[$slug][$key][4] , 'menu-top' ) ) {
2500
+ $SetMain_submenu[$slug][$key][4] = str_replace( 'menu-top' , '' , $SetMain_submenu[$slug][$key][4] );
2501
+ }
2502
+
2503
+ }
2504
+
2505
+ }
2506
+ $submenu = $SetMain_submenu;
2507
+
2508
+ } else {
2509
+ // empty menu
2510
+ $menu = array();
2511
+ }
2512
+ }
2513
+
2514
+ }
2515
+
2516
+ // FilterStart
2517
+ function add_edit_post_change_permalink( $permalink_html ) {
2518
+ $GetData = $this->get_flit_data( 'post_add_edit' );
2519
+
2520
+ if( !empty( $GetData["UPFN"] ) ) {
2521
+ unset( $GetData["UPFN"] );
2522
+
2523
+ if( !empty( $GetData ) && is_array( $GetData ) ) {
2524
+ if( !empty( $GetData["default_permalink"] ) ) {
2525
+ if( strpos( $permalink_html , 'change-permalinks' ) ) {
2526
+
2527
+ $permalink_html = preg_replace( "/<span id=\"change-permalinks\">(.*)<\/span>/" , "" , $permalink_html );
2528
+
2529
+ }
2530
+ }
2531
+ }
2532
+ }
2533
+
2534
+ return $permalink_html;
2535
+ }
2536
+
2537
+ // FilterStart
2538
+ function allow_comments() {
2539
+ global $current_screen;
2540
+
2541
+ $PostAddEdit = $this->get_flit_data( 'post_add_edit' );
2542
+ $RemoveMetaBox = $this->get_flit_data( 'manage_metabox' );
2543
+
2544
+ if( !empty( $PostAddEdit["UPFN"] ) && !empty( $RemoveMetaBox["UPFN"] ) ) {
2545
+ if( $current_screen->action == 'add' ) {
2546
+ if( !empty( $RemoveMetaBox[$current_screen->id]["commentstatusdiv"] ) && !empty( $PostAddEdit["allow_comments"] ) ) {
2547
+ $comment_status = get_option( 'default_comment_status' );
2548
+ $comment_status = apply_filters( 'wauc_pre_get_comment_status' , $comment_status );
2549
+ if( $comment_status == 'open' ) {
2550
+ echo '<input name="comment_status" type="hidden" id="comment_status" value="open" />';
2551
+ }
2552
+ }
2553
+ }
2554
+
2555
+ }
2556
+
2557
+ }
2558
+
2559
+ // FilterStart
2560
+ function admin_title( $title ) {
2561
+ $GetData = $this->get_flit_data( 'admin_general' );
2562
+
2563
+ if( !empty( $GetData["UPFN"] ) ) {
2564
+ unset( $GetData["UPFN"] );
2565
+
2566
+ if( !empty( $GetData["title_tag"] ) ) {
2567
+ if( strpos( $title , ' WordPress' ) ) {
2568
+ $title = str_replace( " &#8212; WordPress" , "" , $title );
2569
+ }
2570
+ }
2571
+ }
2572
+
2573
+ return $title;
2574
+ }
2575
+
2576
+ // FilterStart
2577
+ function nav_menus() {
2578
+ $GetData = $this->get_flit_data( 'appearance_menus' );
2579
+ if( !empty( $GetData["UPFN"] ) ) {
2580
+ unset( $GetData["UPFN"] );
2581
+
2582
+ $nav_menus = wp_get_nav_menus();
2583
+
2584
+ if( !empty( $GetData["add_new_menu"] ) ) {
2585
+
2586
+ if( count( $nav_menus ) > 1 ) {
2587
+
2588
+ echo '<style>.wrap > .manage-menus .add-new-menu-action, .locations-row-links .locations-add-menu-link { display: none; }</style>';
2589
+
2590
+ } else {
2591
+
2592
+ echo '<style>.wrap > .manage-menus, .locations-row-links .locations-add-menu-link { display: none; }</style>';
2593
+
2594
+ }
2595
+ }
2596
+
2597
+ if( !empty( $GetData["delete_menu"] ) ) {
2598
+
2599
+ echo '<style>.major-publishing-actions .delete-action { display: none; }</style>';
2600
+
2601
+ }
2602
+
2603
+ }
2604
+ }
2605
+
2606
+ // FilterStart
2607
+ function admin_bar_resizing() {
2608
+ $GetData = $this->get_flit_data( 'admin_general' );
2609
+
2610
+ if ( empty( $GetData["resize_admin_bar"] ) ) {
2611
+ wp_enqueue_style( $this->PageSlug . '-adminbar-resize' , $this->Url . 'css/adminbar/resize.css', array() , $this->Ver );
2612
+ if( is_admin() ) {
2613
+ wp_enqueue_script( $this->PageSlug . '-adminbar-resize' , $this->Url . 'js/adminbar/resize.js', array( 'jquery' ) , $this->Ver );
2614
+ } else {
2615
+ wp_enqueue_script( $this->PageSlug . '-adminbar-resize' , $this->Url . 'js/adminbar/resize-front.js', array( 'jquery' ) , $this->Ver );
2616
+ }
2617
+ }
2618
+
2619
+ }
2620
+
2621
+ // FilterStart
2622
+ function display_msg() {
2623
+ if( !empty( $_GET[$this->MsgQ] ) ) {
2624
+ $msg = strip_tags( $_GET[$this->MsgQ] );
2625
+ if( $msg == 'update' or $msg == 'delete' ) {
2626
+ $this->Msg .= '<div class="updated"><p><strong>' . __( 'Settings saved.' ) . '</strong></p></div>';
2627
+ } elseif( $msg == 'donated' ) {
2628
+ $this->Msg .= '<div class="updated"><p><strong>' . __( 'Thank you for your donation.' , 'wp-admin-ui-customize' ) . '</strong></p></div>';
2629
+ }
2630
+ }
2631
+ }
2632
+
2633
+ // FilterStart
2634
+ function layout_footer( $text ) {
2635
+ $text = '<img src="' . $this->Schema . 'www.gravatar.com/avatar/7e05137c5a859aa987a809190b979ed4?s=18" width="18" /> Plugin developer : <a href="' . $this->AuthorUrl . '?utm_source=use_plugin&utm_medium=footer&utm_content=' . $this->ltd . '&utm_campaign=' . str_replace( '.' , '_' , $this->Ver ) . '" target="_blank">gqevu6bsiz</a>';
2636
+ return $text;
2637
+ }
2638
+
2639
+ // FilterStart
2640
+ function DisplayDonation() {
2641
+ $donation = get_option( $this->Record["donate"] );
2642
+ if( $this->DonateKey != $donation ) {
2643
+ $this->Msg .= '<div class="error"><p><strong>' . __( 'Please consider making a donation.' , 'wp-admin-ui-customize' ) . '</strong> <a href="' . self_admin_url( 'admin.php?page=' . $this->PageSlug ) . '">' . __( 'Donate' , 'wp-admin-ui-customize' ) . '</a></p></div>';
2644
+ }
2645
+ }
2646
+
2647
+ }
2648
+
2649
+ $wauc = new WP_Admin_UI_Customize();
2650
+
2651
+ endif;
2652
+