Admin Menu Editor - Version 1.9.2

Version Description

  • Updated the appearance of the settings page to match the admin CSS changes introduced in WordPress 5.3.
  • Fixed inconsistent dialog title bar colours that could occur when another plugin loaded the default WP dialog styles.
  • Fixed a bug where certain top level menus could stay permanently highlighted because some of their submenus were hidden via CSS/JS and unclickable.
  • When there's an error loading the menu configuration (e.g. because it's in an incompatible format), the plugin will now display an admin notice instead of letting through an uncaught exception.
  • Removed the link to Visual Admin Customizer from the plugin settings page.
  • Tested up to WP 5.3.
Download this release

Release Info

Developer whiteshadow
Plugin Icon 128x128 Admin Menu Editor
Version 1.9.2
Comparing to
See all releases

Code changes from version 1.9.1 to 1.9.2

css/_boxes.scss ADDED
@@ -0,0 +1,87 @@
1
+ $amePostboxBorderColor: #ccd0d4; //Was #e5e5e5 before WP 5.3.
2
+
3
+ @mixin ame-emulated-postbox($toggleWidth: 36px, $horizontalPadding: 12px) {
4
+ $borderColor: $amePostboxBorderColor;
5
+ $headerBackground: #fff;
6
+
7
+ position: relative;
8
+ box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
9
+ background: $headerBackground;
10
+
11
+ margin-bottom: 20px;
12
+
13
+ .ws-ame-postbox-header {
14
+ position: relative;
15
+ font-size: 14px;
16
+ margin: 0;
17
+ line-height: 1.4;
18
+
19
+ border: 1px solid $borderColor;
20
+
21
+ h3 {
22
+ padding: 10px $horizontalPadding;
23
+ margin: 0;
24
+ font-size: 1em;
25
+ line-height: 1;
26
+ white-space: nowrap;
27
+ text-overflow: ellipsis;
28
+ overflow: hidden;
29
+ }
30
+ }
31
+
32
+ .ws-ame-postbox-toggle {
33
+ color: #72777c;
34
+ background: $headerBackground;
35
+
36
+ display: block;
37
+ font: normal 20px/1 dashicons;
38
+ text-align: center;
39
+ cursor: pointer;
40
+ border: none;
41
+
42
+ position: absolute;
43
+ top: 0;
44
+ right: 0;
45
+ bottom: 0;
46
+ width: $toggleWidth;
47
+ height: 100%;
48
+ padding: 0;
49
+
50
+ &:hover {
51
+ color: #23282d;
52
+ }
53
+
54
+ &:active, &:focus {
55
+ outline: none;
56
+ padding: 0;
57
+ }
58
+
59
+ &:before {
60
+ content: '\f142';
61
+ display: inline-block;
62
+ vertical-align: middle;
63
+ }
64
+
65
+ &:after {
66
+ display: inline-block;
67
+ content: "";
68
+ vertical-align: middle;
69
+ height: 100%;
70
+ }
71
+ }
72
+
73
+ .ws-ame-postbox-content {
74
+ border: 1px solid $borderColor;
75
+ border-top: none;
76
+
77
+ padding: $horizontalPadding;
78
+ }
79
+
80
+ &.ws-ame-closed-postbox .ws-ame-postbox-content {
81
+ display: none;
82
+ }
83
+
84
+ &.ws-ame-closed-postbox .ws-ame-postbox-toggle:before {
85
+ content: '\f140'; //downward triangle
86
+ }
87
+ }
css/_indeterminate-checkbox.scss ADDED
@@ -0,0 +1,24 @@
1
+ @mixin ame-indeterminate-checkbox {
2
+ &:indeterminate:before {
3
+ content: '\25a0'; //Unicode black square. Another option would be BLACK LARGE SQUARE (U+2B1B).
4
+ color: #1e8cbe;
5
+
6
+ //Large square.
7
+ //margin: -6px 0 0 -1px;
8
+ //font: 400 18px/1 dashicons;
9
+
10
+ //Smaller square.
11
+ margin: -3px 0 0 -1px;
12
+ font: 400 14px/1 dashicons;
13
+
14
+ //Even smaller square.
15
+ //margin: -2px 0 0 -1px;
16
+ //font: 400 13px/1 dashicons;
17
+
18
+ float: left;
19
+ display: inline-block;
20
+ vertical-align: middle;
21
+ width: 16px;
22
+ -webkit-font-smoothing: antialiased;
23
+ }
24
+ }
css/menu-editor.css CHANGED
@@ -10,7 +10,7 @@
10
width: 310px;
11
float: left;
12
display: block;
13
- border: 1px solid #cdd5d5;
14
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
15
background-color: #FFFFFF;
16
border-radius: 0px;
@@ -297,6 +297,8 @@
297
height: 16px;
298
vertical-align: top;
299
background: url("../images/pencil_delete_gray.png") no-repeat center; }
300
301
.ws_reset_button:hover {
302
background-image: url("../images/pencil_delete.png"); }
@@ -312,8 +314,7 @@
312
visibility: hidden; }
313
314
/* The input box in each field editor */
315
- #ws_menu_editor .ws_editbox input[type="text"],
316
- #ws_menu_editor .ws_editbox select {
317
display: block;
318
float: left;
319
width: 254px;
@@ -322,6 +323,9 @@
322
line-height: 17px;
323
padding-top: 3px;
324
padding-bottom: 3px; }
325
326
#ws_menu_editor .ws_edit_field label {
327
display: block;
@@ -332,13 +336,16 @@
332
333
#ws_menu_editor input[type="text"].ws_field_value {
334
min-height: 25px; }
335
336
/* Dropdown button for combo-box fields */
337
#ws_menu_editor .ws_dropdown_button,
338
#ws_menu_access_editor .ws_dropdown_button {
339
box-sizing: border-box;
340
- width: 20px;
341
height: 25px;
342
margin: 1px 1px 1px 0;
343
padding: 0;
344
text-align: center;
@@ -359,10 +366,26 @@
359
-webkit-border-top-left-radius: 0;
360
-webkit-border-bottom-left-radius: 0; }
361
362
#ws_menu_access_editor .ws_dropdown_button {
363
display: inline-block;
364
height: 27px; }
365
366
#ws_menu_editor .ws_dropdown_button {
367
display: block;
368
float: left; }
@@ -387,8 +410,11 @@ to accommodate the drop-down button.
387
box-sizing: border-box;
388
height: 27px; }
389
390
#ws_menu_editor .ws_has_dropdown input.ws_field_value {
391
- width: 234px; }
392
393
/* Unlike others, this field is just a single checkbox, so it has a smaller height */
394
#ws_menu_editor .ws_edit_field-custom {
@@ -645,7 +671,12 @@ select.ws_dropdown optgroup option {
645
padding: 0;
646
position: relative;
647
box-sizing: border-box;
648
- height: 25px; }
649
650
/* Current icon node (CSS class version, for the built-in WP icon sprites) */
651
.ws_select_icon .icon16 {
@@ -660,6 +691,8 @@ select.ws_dropdown optgroup option {
660
position: relative;
661
top: -3px;
662
left: -3px; }
663
664
/* Current icon node (image version) */
665
.ws_select_icon img {
@@ -829,6 +862,14 @@ a#ws-ame-delete-color-preset:hover {
829
background: white;
830
cursor: pointer;
831
line-height: 20px; }
832
833
.ws_open_color_editor {
834
width: 58px; }
@@ -866,18 +907,17 @@ a#ws-ame-delete-color-preset:hover {
866
.ui-front {
867
z-index: 10000; }
868
869
- .ui-dialog {
870
background: white;
871
border: 1px solid #c0c0c0;
872
padding: 0;
873
-moz-border-radius: 5px;
874
-webkit-border-radius: 5px;
875
border-radius: 5px; }
876
- .ui-dialog .ui-dialog-content {
877
padding: 8px 8px 8px 8px;
878
font-size: 1.1em; }
879
-
880
- .ui-dialog-titlebar {
881
display: block;
882
height: 22px;
883
margin: 0;
@@ -892,12 +932,10 @@ a#ws-ame-delete-color-preset:hover {
892
border-top-left-radius: 4px;
893
border-top-right-radius: 4px;
894
border-bottom: 1px solid #809fd9; }
895
-
896
- .ui-dialog-title {
897
color: white;
898
font-weight: bold; }
899
-
900
- .ui-dialog-titlebar-close {
901
background: #86A7E3 url(../images/x.png) no-repeat center;
902
width: 22px;
903
height: 22px;
@@ -907,8 +945,7 @@ a#ws-ame-delete-color-preset:hover {
907
border-radius: 3px;
908
-moz-border-radius: 3px;
909
-webkit-border-radius: 3px; }
910
-
911
- .ui-dialog-titlebar-close:hover {
912
/*background-image: url(../images/x-light.png);*/
913
background-color: #a6c2f5; }
914
@@ -1445,6 +1482,12 @@ a#ws-ame-delete-color-preset:hover {
1445
/*content: " \f504";
1446
font-family: dashicons, sans-serif;*/ }
1447
1448
/*********************************************
1449
Miscellaneous
1450
**********************************************/
10
width: 310px;
11
float: left;
12
display: block;
13
+ border: 1px solid #ccd0d4;
14
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
15
background-color: #FFFFFF;
16
border-radius: 0px;
297
height: 16px;
298
vertical-align: top;
299
background: url("../images/pencil_delete_gray.png") no-repeat center; }
300
+ .ame-is-wp53-plus .ws_reset_button {
301
+ margin-top: 5px; }
302
303
.ws_reset_button:hover {
304
background-image: url("../images/pencil_delete.png"); }
314
visibility: hidden; }
315
316
/* The input box in each field editor */
317
+ #ws_menu_editor .ws_editbox input[type="text"], #ws_menu_editor .ws_editbox select {
318
display: block;
319
float: left;
320
width: 254px;
323
line-height: 17px;
324
padding-top: 3px;
325
padding-bottom: 3px; }
326
+ .ame-is-wp53-plus #ws_menu_editor .ws_editbox input[type="text"],
327
+ .ame-is-wp53-plus #ws_menu_editor .ws_editbox select {
328
+ height: 28px; }
329
330
#ws_menu_editor .ws_edit_field label {
331
display: block;
336
337
#ws_menu_editor input[type="text"].ws_field_value {
338
min-height: 25px; }
339
+ .ame-is-wp53-plus #ws_menu_editor input[type="text"].ws_field_value {
340
+ min-height: 28px; }
341
342
/* Dropdown button for combo-box fields */
343
#ws_menu_editor .ws_dropdown_button,
344
#ws_menu_access_editor .ws_dropdown_button {
345
box-sizing: border-box;
346
+ width: 25px;
347
height: 25px;
348
+ min-height: 25px;
349
margin: 1px 1px 1px 0;
350
padding: 0;
351
text-align: center;
366
-webkit-border-top-left-radius: 0;
367
-webkit-border-bottom-left-radius: 0; }
368
369
+ .ame-is-wp53-plus #ws_menu_editor .ws_dropdown_button,
370
+ #ws_menu_access_editor.ame-is-wp53-plus .ws_dropdown_button {
371
+ height: 28px;
372
+ border-color: #7e8993;
373
+ background-color: white;
374
+ border-left-style: none;
375
+ font-size: 10px !important;
376
+ line-height: 24px;
377
+ color: #555; }
378
+ .ame-is-wp53-plus #ws_menu_editor .ws_dropdown_button:hover,
379
+ #ws_menu_access_editor.ame-is-wp53-plus .ws_dropdown_button:hover {
380
+ color: #23282d; }
381
+
382
#ws_menu_access_editor .ws_dropdown_button {
383
display: inline-block;
384
height: 27px; }
385
386
+ #ws_menu_access_editor.ame-is-wp53-plus .ws_dropdown_button {
387
+ height: 30px; }
388
+
389
#ws_menu_editor .ws_dropdown_button {
390
display: block;
391
float: left; }
410
box-sizing: border-box;
411
height: 27px; }
412
413
+ #ws_menu_access_editor.ame-is-wp53-plus input.ws_has_dropdown {
414
+ height: 30px; }
415
+
416
#ws_menu_editor .ws_has_dropdown input.ws_field_value {
417
+ width: 229px; }
418
419
/* Unlike others, this field is just a single checkbox, so it has a smaller height */
420
#ws_menu_editor .ws_edit_field-custom {
671
padding: 0;
672
position: relative;
673
box-sizing: border-box;
674
+ height: 25px;
675
+ min-height: 25px; }
676
+ .ame-is-wp53-plus #ws_menu_editor .ws_select_icon {
677
+ height: 28px;
678
+ min-height: 28px;
679
+ margin-top: 1px; }
680
681
/* Current icon node (CSS class version, for the built-in WP icon sprites) */
682
.ws_select_icon .icon16 {
691
position: relative;
692
top: -3px;
693
left: -3px; }
694
+ .ame-is-wp53-plus .ws_select_icon .icon16 {
695
+ top: -1px; }
696
697
/* Current icon node (image version) */
698
.ws_select_icon img {
862
background: white;
863
cursor: pointer;
864
line-height: 20px; }
865
+ .ame-is-wp53-plus .ws_color_scheme_display {
866
+ border-color: #7e8993;
867
+ border-radius: 4px;
868
+ margin-top: 1px;
869
+ margin-bottom: 1px;
870
+ padding: 3px 8px;
871
+ height: 28px;
872
+ line-height: 20px; }
873
874
.ws_open_color_editor {
875
width: 58px; }
907
.ui-front {
908
z-index: 10000; }
909
910
+ .settings_page_menu_editor .ui-dialog {
911
background: white;
912
border: 1px solid #c0c0c0;
913
padding: 0;
914
-moz-border-radius: 5px;
915
-webkit-border-radius: 5px;
916
border-radius: 5px; }
917
+ .settings_page_menu_editor .ui-dialog .ui-dialog-content {
918
padding: 8px 8px 8px 8px;
919
font-size: 1.1em; }
920
+ .settings_page_menu_editor .ui-dialog-titlebar {
921
display: block;
922
height: 22px;
923
margin: 0;
932
border-top-left-radius: 4px;
933
border-top-right-radius: 4px;
934
border-bottom: 1px solid #809fd9; }
935
+ .settings_page_menu_editor .ui-dialog-title {
936
color: white;
937
font-weight: bold; }
938
+ .settings_page_menu_editor .ui-button.ui-dialog-titlebar-close {
939
background: #86A7E3 url(../images/x.png) no-repeat center;
940
width: 22px;
941
height: 22px;
945
border-radius: 3px;
946
-moz-border-radius: 3px;
947
-webkit-border-radius: 3px; }
948
+ .settings_page_menu_editor .ui-dialog-titlebar-close:hover {
949
/*background-image: url(../images/x-light.png);*/
950
background-color: #a6c2f5; }
951
1482
/*content: " \f504";
1483
font-family: dashicons, sans-serif;*/ }
1484
1485
+ /*********************************************
1486
+ WordPress 5.3+ consistent styles
1487
+ **********************************************/
1488
+ .ame-is-wp53-plus .ws_edit_field input[type="button"] {
1489
+ margin-top: 1px; }
1490
+
1491
/*********************************************
1492
Miscellaneous
1493
**********************************************/
css/menu-editor.scss CHANGED
@@ -1,5 +1,7 @@
1
/* Admin Menu Editor CSS file */
2
3
#ws_menu_editor {
4
min-width: 780px;
5
}
@@ -11,6 +13,7 @@
11
$mainContainerWidth: 310px;
12
$mainContainerBorderWidth: 1px;
13
$mainContainerBorderRadius: 0px;
14
15
.ws_main_container {
16
margin: 2px;
@@ -18,7 +21,7 @@ $mainContainerBorderRadius: 0px;
18
float: left;
19
display:block;
20
21
- border: $mainContainerBorderWidth solid #cdd5d5;
22
box-shadow: 0 1px 1px rgba(0,0,0,0.04);
23
background-color: #FFFFFF;
24
@@ -101,6 +104,8 @@ $mainContainerBorderRadius: 0px;
101
/**
102
* The checkbox that lets the user show/hide a menu for the currently selected actor.
103
*/
104
#ws_menu_editor .ws_actor_access_checkbox,
105
#ws_menu_editor input[type="checkbox"].ws_actor_access_checkbox /* Ensure we override WP defaults. */
106
{
@@ -109,28 +114,7 @@ $mainContainerBorderRadius: 0px;
109
margin-top: 1px;
110
vertical-align: text-top;
111
112
- &:indeterminate:before {
113
- content: '\25a0'; //Unicode black square. Another option would be BLACK LARGE SQUARE (U+2B1B).
114
- color: #1e8cbe;
115
-
116
- //Large square.
117
- //margin: -6px 0 0 -1px;
118
- //font: 400 18px/1 dashicons;
119
-
120
- //Smaller square.
121
- margin: -3px 0 0 -1px;
122
- font: 400 14px/1 dashicons;
123
-
124
- //Even smaller square.
125
- //margin: -2px 0 0 -1px;
126
- //font: 400 13px/1 dashicons;
127
-
128
- float: left;
129
- display: inline-block;
130
- vertical-align: middle;
131
- width: 16px;
132
- -webkit-font-smoothing: antialiased;
133
- }
134
}
135
136
@media screen and (max-width: 782px) {
@@ -426,6 +410,10 @@ $mainContainerBorderRadius: 0px;
426
vertical-align: top;
427
428
background: url("../images/pencil_delete_gray.png") no-repeat center;
429
}
430
431
.ws_reset_button:hover {
@@ -446,6 +434,8 @@ $mainContainerBorderRadius: 0px;
446
447
/* The input box in each field editor */
448
$basicInputWidth: 254px;
449
#ws_menu_editor .ws_editbox input[type="text"],
450
#ws_menu_editor .ws_editbox select {
451
display: block;
@@ -458,6 +448,10 @@ $basicInputWidth: 254px;
458
459
padding-top: 3px;
460
padding-bottom: 3px;
461
}
462
463
#ws_menu_editor .ws_edit_field label {
@@ -471,15 +465,22 @@ $basicInputWidth: 254px;
471
472
#ws_menu_editor input[type="text"].ws_field_value {
473
min-height: 25px;
474
}
475
476
/* Dropdown button for combo-box fields */
477
#ws_menu_editor .ws_dropdown_button,
478
#ws_menu_access_editor .ws_dropdown_button
479
{
480
box-sizing: border-box;
481
- width: 20px;
482
height: 25px;
483
484
margin: 1px 1px 1px 0;
485
padding: 0;
@@ -507,11 +508,33 @@ $basicInputWidth: 254px;
507
-webkit-border-bottom-left-radius: 0;
508
}
509
510
#ws_menu_access_editor .ws_dropdown_button {
511
display: inline-block;
512
height: 27px;
513
}
514
515
#ws_menu_editor .ws_dropdown_button {
516
display: block;
517
float: left;
@@ -543,8 +566,12 @@ to accommodate the drop-down button.
543
height: 27px;
544
}
545
546
#ws_menu_editor .ws_has_dropdown input.ws_field_value {
547
- width: 234px;
548
}
549
550
/* Unlike others, this field is just a single checkbox, so it has a smaller height */
@@ -883,6 +910,13 @@ $activeToolTabBackground: #FDFDFD;
883
884
box-sizing: border-box;
885
height: 25px;
886
}
887
888
/* Current icon node (CSS class version, for the built-in WP icon sprites) */
@@ -899,6 +933,10 @@ $activeToolTabBackground: #FDFDFD;
899
position: relative;
900
top: -3px;
901
left: -3px;
902
}
903
904
/* Current icon node (image version) */
@@ -1128,6 +1166,18 @@ $colorFieldRightMargin: 5px;
1128
cursor: pointer;
1129
1130
line-height: $colorFieldHeight - 6px;
1131
}
1132
1133
.ws_open_color_editor {
@@ -1175,69 +1225,71 @@ $colorFieldRightMargin: 5px;
1175
z-index: 10000;
1176
}
1177
1178
- .ui-dialog {
1179
- background: white;
1180
- border: 1px solid #c0c0c0;
1181
1182
- padding: 0;
1183
-
1184
- -moz-border-radius: 5px;
1185
- -webkit-border-radius: 5px;
1186
- border-radius: 5px;
1187
1188
- .ui-dialog-content {
1189
- padding: 8px 8px 8px 8px;
1190
- font-size: 1.1em;
1191
}
1192
- }
1193
1194
- .ui-dialog-titlebar {
1195
- display: block;
1196
- height: 22px;
1197
- margin: 0;
1198
- padding: 4px 4px 4px 8px;
1199
-
1200
- background-color: #86A7E3;
1201
- font-size: 1.0em;
1202
- line-height: 22px;
1203
1204
- -webkit-border-top-left-radius: 4px;
1205
- -webkit-border-top-right-radius: 4px;
1206
1207
- -moz-border-radius-topleft: 4px;
1208
- -moz-border-radius-topright: 4px;
1209
1210
- border-top-left-radius: 4px;
1211
- border-top-right-radius: 4px;
1212
1213
- border-bottom: 1px solid #809fd9;
1214
- }
1215
1216
- .ui-dialog-title {
1217
- color: white;
1218
- font-weight: bold;
1219
- }
1220
1221
- .ui-dialog-titlebar-close {
1222
- background: #86A7E3 url(../images/x.png) no-repeat center;
1223
- width: 22px;
1224
- height: 22px;
1225
- display: block;
1226
- float: right;
1227
- color: white;
1228
-
1229
- border-radius: 3px;
1230
- -moz-border-radius: 3px;
1231
- -webkit-border-radius: 3px;
1232
- }
1233
1234
- .ui-dialog-titlebar-close:hover {
1235
- /*background-image: url(../images/x-light.png);*/
1236
- background-color: #a6c2f5;
1237
- }
1238
1239
- .ui-icon-closethick {
1240
-
1241
}
1242
1243
#export_dialog .ws_dialog_panel {
@@ -2049,6 +2101,14 @@ $userSelectionPanelPadding: 10px;
2049
font-family: dashicons, sans-serif;*/
2050
}
2051
2052
/*********************************************
2053
Miscellaneous
2054
**********************************************/
1
/* Admin Menu Editor CSS file */
2
3
+ @import "boxes";
4
+
5
#ws_menu_editor {
6
min-width: 780px;
7
}
13
$mainContainerWidth: 310px;
14
$mainContainerBorderWidth: 1px;
15
$mainContainerBorderRadius: 0px;
16
+ $mainContainerBorderColor: $amePostboxBorderColor; //Was #cdd5d5 before WP 5.3.
17
18
.ws_main_container {
19
margin: 2px;
21
float: left;
22
display:block;
23
24
+ border: $mainContainerBorderWidth solid $mainContainerBorderColor;
25
box-shadow: 0 1px 1px rgba(0,0,0,0.04);
26
background-color: #FFFFFF;
27
104
/**
105
* The checkbox that lets the user show/hide a menu for the currently selected actor.
106
*/
107
+ @import "_indeterminate-checkbox.scss";
108
+
109
#ws_menu_editor .ws_actor_access_checkbox,
110
#ws_menu_editor input[type="checkbox"].ws_actor_access_checkbox /* Ensure we override WP defaults. */
111
{
114
margin-top: 1px;
115
vertical-align: text-top;
116
117
+ @include ame-indeterminate-checkbox;
118
}
119
120
@media screen and (max-width: 782px) {
410
vertical-align: top;
411
412
background: url("../images/pencil_delete_gray.png") no-repeat center;
413
+
414
+ .ame-is-wp53-plus & {
415
+ margin-top: 5px;
416
+ }
417
}
418
419
.ws_reset_button:hover {
434
435
/* The input box in each field editor */
436
$basicInputWidth: 254px;
437
+ $basicInputWp53Height: 28px;
438
+
439
#ws_menu_editor .ws_editbox input[type="text"],
440
#ws_menu_editor .ws_editbox select {
441
display: block;
448
449
padding-top: 3px;
450
padding-bottom: 3px;
451
+
452
+ .ame-is-wp53-plus & {
453
+ height: $basicInputWp53Height;
454
+ }
455
}
456
457
#ws_menu_editor .ws_edit_field label {
465
466
#ws_menu_editor input[type="text"].ws_field_value {
467
min-height: 25px;
468
+
469
+ .ame-is-wp53-plus & {
470
+ min-height: $basicInputWp53Height;
471
+ }
472
}
473
474
/* Dropdown button for combo-box fields */
475
+ $dropdownButtonWidth: 25px;
476
+
477
#ws_menu_editor .ws_dropdown_button,
478
#ws_menu_access_editor .ws_dropdown_button
479
{
480
box-sizing: border-box;
481
+ width: $dropdownButtonWidth;
482
height: 25px;
483
+ min-height: 25px;
484
485
margin: 1px 1px 1px 0;
486
padding: 0;
508
-webkit-border-bottom-left-radius: 0;
509
}
510
511
+ .ame-is-wp53-plus #ws_menu_editor .ws_dropdown_button,
512
+ #ws_menu_access_editor.ame-is-wp53-plus .ws_dropdown_button
513
+ {
514
+ height: $basicInputWp53Height;
515
+
516
+ border-color: #7e8993;
517
+ background-color: white;
518
+ border-left-style: none;
519
+
520
+ font-size: 10px !important;
521
+ line-height: 24px;
522
+ color: #555;
523
+
524
+ &:hover {
525
+ color: #23282d;
526
+ }
527
+ }
528
+
529
#ws_menu_access_editor .ws_dropdown_button {
530
display: inline-block;
531
height: 27px;
532
}
533
534
+ #ws_menu_access_editor.ame-is-wp53-plus .ws_dropdown_button {
535
+ height: 30px;
536
+ }
537
+
538
#ws_menu_editor .ws_dropdown_button {
539
display: block;
540
float: left;
566
height: 27px;
567
}
568
569
+ #ws_menu_access_editor.ame-is-wp53-plus input.ws_has_dropdown {
570
+ height: 30px;
571
+ }
572
+
573
#ws_menu_editor .ws_has_dropdown input.ws_field_value {
574
+ width: $basicInputWidth - $dropdownButtonWidth;
575
}
576
577
/* Unlike others, this field is just a single checkbox, so it has a smaller height */
910
911
box-sizing: border-box;
912
height: 25px;
913
+ min-height: 25px;
914
+
915
+ .ame-is-wp53-plus & {
916
+ height: $basicInputWp53Height;
917
+ min-height: $basicInputWp53Height;
918
+ margin-top: 1px;
919
+ }
920
}
921
922
/* Current icon node (CSS class version, for the built-in WP icon sprites) */
933
position: relative;
934
top: -3px;
935
left: -3px;
936
+
937
+ .ame-is-wp53-plus & {
938
+ top: -1px;
939
+ }
940
}
941
942
/* Current icon node (image version) */
1166
cursor: pointer;
1167
1168
line-height: $colorFieldHeight - 6px;
1169
+
1170
+ .ame-is-wp53-plus & {
1171
+ border-color: #7e8993;
1172
+ border-radius: 4px;
1173
+
1174
+ margin-top: 1px;
1175
+ margin-bottom: 1px;
1176
+
1177
+ padding: 3px 8px;
1178
+ height: 28px;
1179
+ line-height: 20px;
1180
+ }
1181
}
1182
1183
.ws_open_color_editor {
1225
z-index: 10000;
1226
}
1227
1228
+ .settings_page_menu_editor {
1229
+ .ui-dialog {
1230
+ background: white;
1231
+ border: 1px solid #c0c0c0;
1232
1233
+ padding: 0;
1234
1235
+ -moz-border-radius: 5px;
1236
+ -webkit-border-radius: 5px;
1237
+ border-radius: 5px;
1238
+
1239
+ .ui-dialog-content {
1240
+ padding: 8px 8px 8px 8px;
1241
+ font-size: 1.1em;
1242
+ }
1243
}
1244
1245
+ .ui-dialog-titlebar {
1246
+ display: block;
1247
+ height: 22px;
1248
+ margin: 0;
1249
+ padding: 4px 4px 4px 8px;
1250
1251
+ background-color: #86A7E3;
1252
+ font-size: 1.0em;
1253
+ line-height: 22px;
1254
1255
+ -webkit-border-top-left-radius: 4px;
1256
+ -webkit-border-top-right-radius: 4px;
1257
1258
+ -moz-border-radius-topleft: 4px;
1259
+ -moz-border-radius-topright: 4px;
1260
1261
+ border-top-left-radius: 4px;
1262
+ border-top-right-radius: 4px;
1263
1264
+ border-bottom: 1px solid #809fd9;
1265
+ }
1266
1267
+ .ui-dialog-title {
1268
+ color: white;
1269
+ font-weight: bold;
1270
+ }
1271
1272
+ .ui-button.ui-dialog-titlebar-close {
1273
+ background: #86A7E3 url(../images/x.png) no-repeat center;
1274
+ width: 22px;
1275
+ height: 22px;
1276
+ display: block;
1277
+ float: right;
1278
+ color: white;
1279
1280
+ border-radius: 3px;
1281
+ -moz-border-radius: 3px;
1282
+ -webkit-border-radius: 3px;
1283
+ }
1284
+
1285
+ .ui-dialog-titlebar-close:hover {
1286
+ /*background-image: url(../images/x-light.png);*/
1287
+ background-color: #a6c2f5;
1288
+ }
1289
+
1290
+ .ui-icon-closethick {
1291
+
1292
+ }
1293
}
1294
1295
#export_dialog .ws_dialog_panel {
2101
font-family: dashicons, sans-serif;*/
2102
}
2103
2104
+ /*********************************************
2105
+ WordPress 5.3+ consistent styles
2106
+ **********************************************/
2107
+
2108
+ .ame-is-wp53-plus .ws_edit_field input[type="button"] {
2109
+ margin-top: 1px;
2110
+ }
2111
+
2112
/*********************************************
2113
Miscellaneous
2114
**********************************************/
css/screen-meta.css CHANGED
@@ -9,11 +9,12 @@
9
height: 28px;
10
margin: 0 0 0 6px;
11
12
- border: 1px solid #ddd;
13
border-top: none;
14
background: #fff;
15
- -webkit-box-shadow: 0 1px 1px -1px rgba(0,0,0,0.1);
16
- box-shadow: 0 1px 1px -1px rgba(0,0,0,0.1);
17
}
18
19
#screen-meta .custom-screen-meta-link-wrap a.custom-screen-meta-link,
@@ -23,7 +24,7 @@
23
text-decoration: none;
24
display: block;
25
min-height: 22px;
26
- box-shadow: 0 1px 0 #cccccc;
27
}
28
29
#screen-meta-links a.custom-screen-meta-link::after {
@@ -41,8 +42,10 @@
41
color: #DEFFD8;
42
text-shadow: none;
43
box-shadow: none;
44
}
45
46
- #ws-pro-version-notice a.show-settings:hover {
47
color: white;
48
}
9
height: 28px;
10
margin: 0 0 0 6px;
11
12
+ border: 1px solid #ccd0d4;
13
border-top: none;
14
+ border-radius: 0 0 4px 4px;
15
+
16
background: #fff;
17
+ box-shadow: none;
18
}
19
20
#screen-meta .custom-screen-meta-link-wrap a.custom-screen-meta-link,
24
text-decoration: none;
25
display: block;
26
min-height: 22px;
27
+ box-shadow: none;
28
}
29
30
#screen-meta-links a.custom-screen-meta-link::after {
42
color: #DEFFD8;
43
text-shadow: none;
44
box-shadow: none;
45
+ border: none;
46
+ background-color: #00C31F;
47
}
48
49
+ #screen-meta-links #ws-pro-version-notice a.show-settings:hover {
50
color: white;
51
}
css/style-classic.css CHANGED
@@ -97,21 +97,23 @@ a.ws_button:hover {
97
Export and import
98
*************************************/
99
100
- .ui-dialog {
101
background: white;
102
border: 1px solid #c0c0c0;
103
}
104
105
- .ui-dialog-titlebar {
106
background-color: #86A7E3;
107
}
108
109
- .ui-dialog-title {
110
color: white;
111
}
112
113
- .ui-dialog-titlebar-close {
114
background-color: transparent;
115
border-style: none;
116
117
color: white; /* WP default: #666; */
@@ -121,20 +123,20 @@ a.ws_button:hover {
121
top: 0;
122
right: 0;
123
width: 36px;
124
- height: 30px;
125
text-align: center;
126
}
127
128
- .ui-dialog-titlebar-close::before {
129
font: normal 20px/30px 'dashicons';
130
content: '\f158';
131
132
vertical-align: top;
133
width: 36px;
134
- height: 30px;
135
}
136
137
- .ui-dialog-titlebar-close:hover {
138
background: transparent none;
139
color: #004665;
140
}
97
Export and import
98
*************************************/
99
100
+ .settings_page_menu_editor .ui-dialog {
101
background: white;
102
border: 1px solid #c0c0c0;
103
}
104
105
+ .settings_page_menu_editor .ui-dialog-titlebar {
106
background-color: #86A7E3;
107
+ height: 22px;
108
}
109
110
+ .settings_page_menu_editor .ui-dialog-title {
111
color: white;
112
}
113
114
+ .settings_page_menu_editor .ui-button.ui-dialog-titlebar-close {
115
background-color: transparent;
116
+ background-image: none;
117
border-style: none;
118
119
color: white; /* WP default: #666; */
123
top: 0;
124
right: 0;
125
width: 36px;
126
+ height: 22px;
127
text-align: center;
128
}
129
130
+ .settings_page_menu_editor .ui-dialog-titlebar-close::before {
131
font: normal 20px/30px 'dashicons';
132
content: '\f158';
133
134
vertical-align: top;
135
width: 36px;
136
+ height: 22px;
137
}
138
139
+ .settings_page_menu_editor .ui-dialog-titlebar-close:hover {
140
background: transparent none;
141
color: #004665;
142
}
css/style-modern-one.css CHANGED
@@ -137,17 +137,16 @@ a.ws_edit_link {
137
margin-left: 0;
138
margin-right: 0; }
139
140
- .ui-dialog {
141
background: white;
142
border: 1px solid #c0c0c0;
143
border-radius: 0; }
144
-
145
- .ui-dialog-titlebar {
146
background-color: #fcfcfc;
147
border-bottom: 1px solid #dfdfdf;
148
height: auto;
149
padding: 0; }
150
- .ui-dialog-titlebar .ui-dialog-titlebar-close {
151
background: none;
152
border-style: none;
153
color: #666;
@@ -160,19 +159,18 @@ a.ws_edit_link {
160
width: 36px;
161
height: 36px;
162
text-align: center; }
163
- .ui-dialog-titlebar .ui-dialog-titlebar-close .ui-icon, .ui-dialog-titlebar .ui-dialog-titlebar-close .ui-button-text {
164
display: none; }
165
- .ui-dialog-titlebar .ui-dialog-titlebar-close::before {
166
font: normal 20px/36px 'dashicons';
167
content: '\f158';
168
vertical-align: middle;
169
width: 36px;
170
height: 36px; }
171
- .ui-dialog-titlebar .ui-dialog-titlebar-close:hover {
172
background: transparent none;
173
color: #2ea2cc; }
174
-
175
- .ui-dialog-title {
176
color: #444444;
177
font-size: 18px;
178
font-weight: 600;
137
margin-left: 0;
138
margin-right: 0; }
139
140
+ .settings_page_menu_editor .ui-dialog {
141
background: white;
142
border: 1px solid #c0c0c0;
143
border-radius: 0; }
144
+ .settings_page_menu_editor .ui-dialog-titlebar {
145
background-color: #fcfcfc;
146
border-bottom: 1px solid #dfdfdf;
147
height: auto;
148
padding: 0; }
149
+ .settings_page_menu_editor .ui-dialog-titlebar .ui-button.ui-dialog-titlebar-close {
150
background: none;
151
border-style: none;
152
color: #666;
159
width: 36px;
160
height: 36px;
161
text-align: center; }
162
+ .settings_page_menu_editor .ui-dialog-titlebar .ui-button.ui-dialog-titlebar-close .ui-icon, .settings_page_menu_editor .ui-dialog-titlebar .ui-button.ui-dialog-titlebar-close .ui-button-text {
163
display: none; }
164
+ .settings_page_menu_editor .ui-dialog-titlebar .ui-dialog-titlebar-close::before {
165
font: normal 20px/36px 'dashicons';
166
content: '\f158';
167
vertical-align: middle;
168
width: 36px;
169
height: 36px; }
170
+ .settings_page_menu_editor .ui-dialog-titlebar .ui-dialog-titlebar-close:hover {
171
background: transparent none;
172
color: #2ea2cc; }
173
+ .settings_page_menu_editor .ui-dialog-title {
174
color: #444444;
175
font-size: 18px;
176
font-weight: 600;
css/style-modern-one.scss CHANGED
@@ -286,61 +286,63 @@ a.ws_edit_link {
286
// Dialogs
287
//==============================================
288
289
- .ui-dialog {
290
- background: white;
291
- border: 1px solid #c0c0c0;
292
- border-radius: 0;
293
- }
294
295
- .ui-dialog-titlebar {
296
- background-color: #fcfcfc;
297
- border-bottom: 1px solid #dfdfdf;
298
- height: auto;
299
- padding: 0;
300
301
- .ui-dialog-titlebar-close {
302
- background: none;
303
- border-style: none;
304
305
- color: #666;
306
- cursor: pointer;
307
- padding: 0;
308
- margin: 0;
309
- position: absolute;
310
- top: 0;
311
- right: 0;
312
313
- width: 36px;
314
- height: 36px;
315
316
- text-align: center;
317
318
- .ui-icon, .ui-button-text {
319
- display: none;
320
}
321
- }
322
323
- .ui-dialog-titlebar-close::before {
324
- font: normal 20px/36px 'dashicons';
325
- content: '\f158';
326
327
- vertical-align: middle;
328
- width: 36px;
329
- height: 36px;
330
- }
331
332
- .ui-dialog-titlebar-close:hover {
333
- background: transparent none;
334
- color: #2ea2cc;
335
}
336
- }
337
338
- .ui-dialog-title {
339
- color: #444444;
340
- font-size: 18px;
341
- font-weight: 600;
342
- line-height: 36px;
343
344
- padding: 0 36px 0 8px;
345
- display: block;
346
- }
286
// Dialogs
287
//==============================================
288
289
+ .settings_page_menu_editor {
290
+ .ui-dialog {
291
+ background: white;
292
+ border: 1px solid #c0c0c0;
293
+ border-radius: 0;
294
+ }
295
296
+ .ui-dialog-titlebar {
297
+ background-color: #fcfcfc;
298
+ border-bottom: 1px solid #dfdfdf;
299
+ height: auto;
300
+ padding: 0;
301
302
+ .ui-button.ui-dialog-titlebar-close {
303
+ background: none;
304
+ border-style: none;
305
306
+ color: #666;
307
+ cursor: pointer;
308
+ padding: 0;
309
+ margin: 0;
310
+ position: absolute;
311
+ top: 0;
312
+ right: 0;
313
314
+ width: 36px;
315
+ height: 36px;
316
317
+ text-align: center;
318
319
+ .ui-icon, .ui-button-text {
320
+ display: none;
321
+ }
322
}
323
324
+ .ui-dialog-titlebar-close::before {
325
+ font: normal 20px/36px 'dashicons';
326
+ content: '\f158';
327
328
+ vertical-align: middle;
329
+ width: 36px;
330
+ height: 36px;
331
+ }
332
333
+ .ui-dialog-titlebar-close:hover {
334
+ background: transparent none;
335
+ color: #2ea2cc;
336
+ }
337
}
338
339
+ .ui-dialog-title {
340
+ color: #444444;
341
+ font-size: 18px;
342
+ font-weight: 600;
343
+ line-height: 36px;
344
345
+ padding: 0 36px 0 8px;
346
+ display: block;
347
+ }
348
+ }
includes/editor-page.php CHANGED
@@ -33,29 +33,10 @@ $hide_button_extra_tooltip = 'When "All" is selected, this will hide the menu fr
33
34
//Output the "Upgrade to Pro" message
35
if ( !apply_filters('admin_menu_editor_is_pro', false) ){
36
- //Pseudo-randomly decide whether to show the VAC link.
37
- $is_vac_link_visible = (hexdec( substr(md5(get_site_url() . 'vc3'), -3) ) % 100) <= 20; //20% of sites will see it.
38
?>
39
<script type="text/javascript">
40
(function($){
41
- var screenLinks = $('#screen-meta-links'),
42
- showVacLink = (<?php echo $is_vac_link_visible ? 'true' : 'false' ?>);
43
-
44
- if (showVacLink) {
45
- screenLinks.append(
46
- $('<div>', {
47
- 'class' : 'custom-screen-meta-link-wrap',
48
- 'id' : 'ws-visual-admin-customizer-ad'
49
- }).append($('<a>', {
50
- 'href' : 'https://wordpress.org/plugins/visual-admin-customizer/',
51
- 'class' : 'show-settings custom-screen-meta-link',
52
- 'title' : 'A free plugin for customizing the WordPress admin interface',
53
- 'target': '_blank',
54
- 'text' : 'Visual Admin Customizer'
55
- }))
56
- );
57
- }
58
-
59
screenLinks.append(
60
'<div id="ws-pro-version-notice" class="custom-screen-meta-link-wrap">' +
61
'<a href="http://adminmenueditor.com/upgrade-to-pro/?utm_source=Admin%2BMenu%2BEditor%2Bfree&utm_medium=text_link&utm_content=top_upgrade_link&utm_campaign=Plugins" id="ws-pro-version-notice-link" class="show-settings custom-screen-meta-link" target="_blank" title="View Pro version details">Upgrade to Pro</a>' +
33
34
//Output the "Upgrade to Pro" message
35
if ( !apply_filters('admin_menu_editor_is_pro', false) ){
36
?>
37
<script type="text/javascript">
38
(function($){
39
+ var screenLinks = $('#screen-meta-links');
40
screenLinks.append(
41
'<div id="ws-pro-version-notice" class="custom-screen-meta-link-wrap">' +
42
'<a href="http://adminmenueditor.com/upgrade-to-pro/?utm_source=Admin%2BMenu%2BEditor%2Bfree&utm_medium=text_link&utm_content=top_upgrade_link&utm_campaign=Plugins" id="ws-pro-version-notice-link" class="show-settings custom-screen-meta-link" target="_blank" title="View Pro version details">Upgrade to Pro</a>' +
includes/menu-editor-core.php CHANGED
@@ -113,6 +113,11 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
113
*/
114
private $access_test_runner = null;
115
116
function init(){
117
$this->sitewide_options = true;
118
@@ -1276,26 +1281,48 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
1276
return $this->test_menu;
1277
}
1278
1279
- if ( $config_id === 'network-admin' ) {
1280
- if ( empty($this->options['custom_network_menu']) ) {
1281
- return null;
1282
- }
1283
- $this->cached_custom_menu = ameMenu::load_array($this->options['custom_network_menu']);
1284
- } else if ( $config_id === 'site' ) {
1285
- $site_specific_options = get_option($this->option_name, null);
1286
- if ( is_array($site_specific_options) && isset($site_specific_options['custom_menu']) ) {
1287
- $this->cached_custom_menu = ameMenu::load_array($site_specific_options['custom_menu']);
1288
}
1289
- } else {
1290
- if ( empty($this->options['custom_menu']) ) {
1291
- return null;
1292
}
1293
- $this->cached_custom_menu = ameMenu::load_array($this->options['custom_menu']);
1294
}
1295
1296
return $this->cached_custom_menu;
1297
}
1298
1299
private function guess_menu_config_id() {
1300
if ( is_network_admin() ) {
1301
return 'network-admin';
@@ -2616,6 +2643,9 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
2616
} else {
2617
$wrap_classes[] = 'ame-is-free-version';
2618
}
2619
2620
echo '<div class="', implode(' ', $wrap_classes), '">';
2621
printf(
@@ -4178,11 +4208,6 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
4178
'className' => 'ameAdminCss',
4179
'title' => 'Admin CSS',
4180
),*/
4181
- /*'tweaks' => array(
4182
- 'relativePath' => 'modules/tweaks/tweaks.php',
4183
- 'className' => 'ameTweakManager',
4184
- 'title' => 'Tweaks',
4185
- ),*/
4186
'hide-admin-menu' => array(
4187
'relativePath' => 'extras/modules/hide-admin-menu/hide-admin-menu.php',
4188
'className' => 'ameAdminMenuHider',
113
*/
114
private $access_test_runner = null;
115
116
+ /**
117
+ * @var Exception|null
118
+ */
119
+ private $last_menu_exception = null;
120
+
121
function init(){
122
$this->sitewide_options = true;
123
1281
return $this->test_menu;
1282
}
1283
1284
+ try {
1285
+ if ( $config_id === 'network-admin' ) {
1286
+ if ( empty($this->options['custom_network_menu']) ) {
1287
+ return null;
1288
+ }
1289
+ $this->cached_custom_menu = ameMenu::load_array($this->options['custom_network_menu']);
1290
+ } else if ( $config_id === 'site' ) {
1291
+ $site_specific_options = get_option($this->option_name, null);
1292
+ if ( is_array($site_specific_options) && isset($site_specific_options['custom_menu']) ) {
1293
+ $this->cached_custom_menu = ameMenu::load_array($site_specific_options['custom_menu']);
1294
+ }
1295
+ } else {
1296
+ if ( empty($this->options['custom_menu']) ) {
1297
+ return null;
1298
+ }
1299
+ $this->cached_custom_menu = ameMenu::load_array($this->options['custom_menu']);
1300
}
1301
+ } catch (InvalidMenuException $exception) {
1302
+ if ( is_admin() && is_user_logged_in() && !did_action('all_admin_notices') ) {
1303
+ add_action('all_admin_notices', array($this, 'show_config_corruption_error'));
1304
+ $this->last_menu_exception = $exception;
1305
}
1306
+ return null;
1307
}
1308
1309
return $this->cached_custom_menu;
1310
}
1311
1312
+ /**
1313
+ * Display a notice about the exception that was thrown when loading the menu configuration.
1314
+ */
1315
+ public function show_config_corruption_error() {
1316
+ if ( !$this->current_user_can_edit_menu() || is_null($this->last_menu_exception) ) {
1317
+ return;
1318
+ }
1319
+ printf(
1320
+ '<div class="notice notice-error"><p>%s</p></div>',
1321
+ '<strong>Admin Menu Editor encountered an error while trying to load the menu configuration!</strong><br> '
1322
+ . esc_html($this->last_menu_exception->getMessage())
1323
+ );
1324
+ }
1325
+
1326
private function guess_menu_config_id() {
1327
if ( is_network_admin() ) {
1328
return 'network-admin';
2643
} else {
2644
$wrap_classes[] = 'ame-is-free-version';
2645
}
2646
+ if ( isset($GLOBALS['wp_version']) && version_compare($GLOBALS['wp_version'], '5.3-RC1', '>=') ) {
2647
+ $wrap_classes[] = 'ame-is-wp53-plus';
2648
+ }
2649
2650
echo '<div class="', implode(' ', $wrap_classes), '">';
2651
printf(
4208
'className' => 'ameAdminCss',
4209
'title' => 'Admin CSS',
4210
),*/
4211
'hide-admin-menu' => array(
4212
'relativePath' => 'extras/modules/hide-admin-menu/hide-admin-menu.php',
4213
'className' => 'ameAdminMenuHider',
includes/menu.php CHANGED
@@ -40,7 +40,7 @@ abstract class ameMenu {
40
$compared = version_compare($arr['format']['version'], self::format_version);
41
if ( $compared > 0 ) {
42
throw new InvalidMenuException(sprintf(
43
- "Can't load a menu created by a newer version of the plugin. Menu format: '%s', newest supported format: '%s'.",
44
$arr['format']['version'],
45
self::format_version
46
));
@@ -99,7 +99,7 @@ abstract class ameMenu {
99
$is_valid_preset = true;
100
foreach($preset as $property => $color) {
101
//Note: It would good to check $property against a list of known color names.
102
- if ( !is_string($property) || !is_string($color) || !preg_match('/^\#[0-9a-f]{6}#x2F;i', $color) ) {
103
$is_valid_preset = false;
104
break;
105
}
@@ -206,7 +206,22 @@ abstract class ameMenu {
206
*/
207
public static function to_json($menu) {
208
$menu = self::add_format_header($menu);
209
- return json_encode($menu);
210
}
211
212
/**
40
$compared = version_compare($arr['format']['version'], self::format_version);
41
if ( $compared > 0 ) {
42
throw new InvalidMenuException(sprintf(
43
+ "Can't load a menu created by a newer version of the plugin. Menu format: '%s', newest supported format: '%s'. Try updating the plugin.",
44
$arr['format']['version'],
45
self::format_version
46
));
99
$is_valid_preset = true;
100
foreach($preset as $property => $color) {
101
//Note: It would good to check $property against a list of known color names.
102
+ if ( !is_string($property) || !is_string($color) || !preg_match('/^#[0-9a-f]{6}#x2F;i', $color) ) {
103
$is_valid_preset = false;
104
break;
105
}
206
*/
207
public static function to_json($menu) {
208
$menu = self::add_format_header($menu);
209
+ $result = json_encode($menu);
210
+ if ( !is_string($result) ) {
211
+ $message = sprintf(
212
+ 'Failed to encode the menu configuration as JSON. json_encode returned a %s.',
213
+ gettype($result)
214
+ );
215
+ if ( function_exists('json_last_error') ) {
216
+ /** @noinspection PhpComposerExtensionStubsInspection */
217
+ $message .= sprintf(' JSON error code: %d.', json_last_error());
218
+ }
219
+ if ( function_exists('json_last_error_msg') ) {
220
+ $message .= sprintf(' JSON error message: %s', json_last_error_msg());
221
+ }
222
+ throw new RuntimeException($message);
223
+ }
224
+ return $result;
225
}
226
227
/**
js/actor-manager.js CHANGED
@@ -496,6 +496,66 @@ var AmeActorManager = /** @class */ (function () {
496
AmeActorManager._ = wsAmeLodash;
497
return AmeActorManager;
498
}());
499
if (typeof wsAmeActorData !== 'undefined') {
500
AmeActors = new AmeActorManager(wsAmeActorData.roles, wsAmeActorData.users, wsAmeActorData.isMultisite, wsAmeActorData.suspectedMetaCaps);
501
if (typeof wsAmeActorData['capPower'] !== 'undefined') {
496
AmeActorManager._ = wsAmeLodash;
497
return AmeActorManager;
498
}());
499
+ var AmeObservableActorSettings = /** @class */ (function () {
500
+ function AmeObservableActorSettings(initialData) {
501
+ this.items = {};
502
+ this.numberOfObservables = ko.observable(0);
503
+ if (initialData) {
504
+ this.setAll(initialData);
505
+ }
506
+ }
507
+ AmeObservableActorSettings.prototype.get = function (actor, defaultValue) {
508
+ if (defaultValue === void 0) { defaultValue = null; }
509
+ if (this.items.hasOwnProperty(actor)) {
510
+ var value = this.items[actor]();
511
+ if (value === null) {
512
+ return defaultValue;
513
+ }
514
+ return value;
515
+ }
516
+ this.numberOfObservables(); //Establish a dependency.
517
+ return defaultValue;
518
+ };
519
+ AmeObservableActorSettings.prototype.set = function (actor, value) {
520
+ if (!this.items.hasOwnProperty(actor)) {
521
+ this.items[actor] = ko.observable(value);
522
+ this.numberOfObservables(this.numberOfObservables() + 1);
523
+ }
524
+ else {
525
+ this.items[actor](value);
526
+ }
527
+ };
528
+ AmeObservableActorSettings.prototype.getAll = function () {
529
+ var result = {};
530
+ for (var actorId in this.items) {
531
+ if (this.items.hasOwnProperty(actorId)) {
532
+ var value = this.items[actorId]();
533
+ if (value !== null) {
534
+ result[actorId] = value;
535
+ }
536
+ }
537
+ }
538
+ return result;
539
+ };
540
+ AmeObservableActorSettings.prototype.setAll = function (values) {
541
+ for (var actorId in values) {
542
+ if (values.hasOwnProperty(actorId)) {
543
+ this.set(actorId, values[actorId]);
544
+ }
545
+ }
546
+ };
547
+ /**
548
+ * Reset all values to null.
549
+ */
550
+ AmeObservableActorSettings.prototype.resetAll = function () {
551
+ for (var actorId in this.items) {
552
+ if (this.items.hasOwnProperty(actorId)) {
553
+ this.items[actorId](null);
554
+ }
555
+ }
556
+ };
557
+ return AmeObservableActorSettings;
558
+ }());
559
if (typeof wsAmeActorData !== 'undefined') {
560
AmeActors = new AmeActorManager(wsAmeActorData.roles, wsAmeActorData.users, wsAmeActorData.isMultisite, wsAmeActorData.suspectedMetaCaps);
561
if (typeof wsAmeActorData['capPower'] !== 'undefined') {
js/actor-manager.ts CHANGED
@@ -657,6 +657,71 @@ interface AmeActorManagerInterface {
657
actorExists(actorId: string): boolean;
658
}
659
660
if (typeof wsAmeActorData !== 'undefined') {
661
AmeActors = new AmeActorManager(
662
wsAmeActorData.roles,
657
actorExists(actorId: string): boolean;
658
}
659
660
+ class AmeObservableActorSettings {
661
+ private items: { [actorId: string] : KnockoutObservable<boolean>; } = {};
662
+ private readonly numberOfObservables: KnockoutObservable<number>;
663
+
664
+ constructor(initialData?: AmeDictionary<boolean>) {
665
+ this.numberOfObservables = ko.observable(0);
666
+ if (initialData) {
667
+ this.setAll(initialData);
668
+ }
669
+ }
670
+
671
+ get(actor: string, defaultValue = null): boolean {
672
+ if (this.items.hasOwnProperty(actor)) {
673
+ let value = this.items[actor]();
674
+ if (value === null) {
675
+ return defaultValue;
676
+ }
677
+ return value;
678
+ }
679
+ this.numberOfObservables(); //Establish a dependency.
680
+ return defaultValue;
681
+ }
682
+
683
+ set(actor: string, value: boolean) {
684
+ if (!this.items.hasOwnProperty(actor)) {
685
+ this.items[actor] = ko.observable(value);
686
+ this.numberOfObservables(this.numberOfObservables() + 1);
687
+ } else {
688
+ this.items[actor](value);
689
+ }
690
+ }
691
+
692
+ getAll(): AmeDictionary<boolean> {
693
+ let result: AmeDictionary<boolean> = {};
694
+ for (let actorId in this.items) {
695
+ if (this.items.hasOwnProperty(actorId)) {
696
+ let value = this.items[actorId]();
697
+ if (value !== null) {
698
+ result[actorId] = value;
699
+ }
700
+ }
701
+ }
702
+ return result;
703
+ }
704
+
705
+ setAll(values: AmeDictionary<boolean>) {
706
+ for (let actorId in values) {
707
+ if (values.hasOwnProperty(actorId)) {
708
+ this.set(actorId, values[actorId]);
709
+ }
710
+ }
711
+ }
712
+
713
+ /**
714
+ * Reset all values to null.
715
+ */
716
+ resetAll() {
717
+ for (let actorId in this.items) {
718
+ if (this.items.hasOwnProperty(actorId)) {
719
+ this.items[actorId](null);
720
+ }
721
+ }
722
+ }
723
+ }
724
+
725
if (typeof wsAmeActorData !== 'undefined') {
726
AmeActors = new AmeActorManager(
727
wsAmeActorData.roles,
menu-editor.php CHANGED
@@ -3,7 +3,7 @@
3
Plugin Name: Admin Menu Editor
4
Plugin URI: http://w-shadow.com/blog/2008/12/20/admin-menu-editor-for-wordpress/
5
Description: Lets you directly edit the WordPress admin menu. You can re-order, hide or rename existing menus, add custom menus and more.
6
- Version: 1.9.1
7
Author: Janis Elsts
8
Author URI: http://w-shadow.com/blog/
9
*/
3
Plugin Name: Admin Menu Editor
4
Plugin URI: http://w-shadow.com/blog/2008/12/20/admin-menu-editor-for-wordpress/
5
Description: Lets you directly edit the WordPress admin menu. You can re-order, hide or rename existing menus, add custom menus and more.
6
+ Version: 1.9.2
7
Author: Janis Elsts
8
Author URI: http://w-shadow.com/blog/
9
*/
modules/access-editor/access-editor-template.php CHANGED
@@ -1,4 +1,10 @@
1
- <div id="ws_menu_access_editor" title="Permissions">
2
3
<div class="ws_dialog_panel">
4
<div class="error inline" id="ws_hardcoded_role_error">
1
+ <?php
2
+ $ameDialogClasses = array();
3
+ if ( isset($GLOBALS['wp_version']) && version_compare($GLOBALS['wp_version'], '5.3-RC1', '>=') ) {
4
+ $ameDialogClasses[] = 'ame-is-wp53-plus';
5
+ }
6
+ ?>
7
+ <div id="ws_menu_access_editor" title="Permissions" class="<?php echo implode(' ', $ameDialogClasses); ?>">
8
9
<div class="ws_dialog_panel">
10
<div class="error inline" id="ws_hardcoded_role_error">
modules/actor-selector/actor-selector.js CHANGED
@@ -205,6 +205,26 @@ var AmeActorSelector = /** @class */ (function () {
205
}
206
return name;
207
};
208
AmeActorSelector._ = wsAmeLodash;
209
return AmeActorSelector;
210
}());
205
}
206
return name;
207
};
208
+ /**
209
+ * Wrap the selected actor in a computed observable so that it can be used with Knockout.
210
+ * @param ko
211
+ */
212
+ AmeActorSelector.prototype.createKnockoutObservable = function (ko) {
213
+ var _this = this;
214
+ var internalObservable = ko.observable(this.selectedActor);
215
+ var publicObservable = ko.computed({
216
+ read: function () {
217
+ return internalObservable();
218
+ },
219
+ write: function (newActor) {
220
+ _this.setSelectedActor(newActor);
221
+ }
222
+ });
223
+ this.onChange(function (newSelectedActor) {
224
+ internalObservable(newSelectedActor);
225
+ });
226
+ return publicObservable;
227
+ };
228
AmeActorSelector._ = wsAmeLodash;
229
return AmeActorSelector;
230
}());
modules/actor-selector/actor-selector.ts CHANGED
@@ -280,4 +280,24 @@ class AmeActorSelector {
280
}
281
return name;
282
}
283
}
280
}
281
return name;
282
}
283
+
284
+ /**
285
+ * Wrap the selected actor in a computed observable so that it can be used with Knockout.
286
+ * @param ko
287
+ */
288
+ createKnockoutObservable(ko: KnockoutStatic): KnockoutComputed<string> {
289
+ const internalObservable = ko.observable(this.selectedActor);
290
+ const publicObservable = ko.computed<string>({
291
+ read: function () {
292
+ return internalObservable();
293
+ },
294
+ write: (newActor: string) => {
295
+ this.setSelectedActor(newActor);
296
+ }
297
+ });
298
+ this.onChange((newSelectedActor: string) => {
299
+ internalObservable(newSelectedActor);
300
+ });
301
+ return publicObservable;
302
+ }
303
}
modules/highlight-new-menus/assets/highlight-menus.js CHANGED
@@ -14,8 +14,6 @@ jQuery(function($) {
14
* the AJAX request won't be triggered. It will be sent only once the function stops
15
* being called for N milliseconds. Additionally, it will wait at least N milliseconds
16
* between requests.
17
- *
18
- * @param string menuUrls
19
*/
20
var flagAsSeen = (function() {
21
var queue = [],
@@ -54,6 +52,9 @@ jQuery(function($) {
54
timeout = null;
55
}
56
57
return function(menuUrl) {
58
if ((menuUrl === '') || seenOnThisPage.hasOwnProperty(menuUrl)) {
59
return;
@@ -127,6 +128,18 @@ jQuery(function($) {
127
maybeFlagItem($(this));
128
});
129
130
if (foundNewMenus) {
131
$adminMenu.on('mouseenter click focusin', 'li.ws-nmh-is-new-menu', function() {
132
maybeFlagItem($(this).closest('li'));
14
* the AJAX request won't be triggered. It will be sent only once the function stops
15
* being called for N milliseconds. Additionally, it will wait at least N milliseconds
16
* between requests.
17
*/
18
var flagAsSeen = (function() {
19
var queue = [],
52
timeout = null;
53
}
54
55
+ /**
56
+ * @param string menuUrl
57
+ */
58
return function(menuUrl) {
59
if ((menuUrl === '') || seenOnThisPage.hasOwnProperty(menuUrl)) {
60
return;
128
maybeFlagItem($(this));
129
});
130
131
+ //Flag any hidden items as seen. The user can't actually click hidden items,
132
+ //so the parent menu would permanently stay highlighted if we didn't do this.
133
+ if (foundNewMenus) {
134
+ //We want to run after all other $(document).ready callbacks because some
135
+ //of them might hide admin menu items by calling $('selector').hide().
136
+ setTimeout(function() {
137
+ $newItems.filter(':hidden').not('.wp-submenu-head').each(function() {
138
+ maybeFlagItem($(this));
139
+ });
140
+ }, 60);
141
+ }
142
+
143
if (foundNewMenus) {
144
$adminMenu.on('mouseenter click focusin', 'li.ws-nmh-is-new-menu', function() {
145
maybeFlagItem($(this).closest('li'));
modules/highlight-new-menus/wsNewMenuHighlighter.php CHANGED
@@ -201,7 +201,7 @@ class wsNewMenuHighlighter {
201
'ws-nmh-admin-script',
202
plugins_url('assets/highlight-menus.js', __FILE__),
203
$dependencies,
204
- '20170503'
205
);
206
207
wp_localize_script(
201
'ws-nmh-admin-script',
202
plugins_url('assets/highlight-menus.js', __FILE__),
203
$dependencies,
204
+ '20191111'
205
);
206
207
wp_localize_script(
modules/tweaks/default-tweaks.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
- return array(
3
- 'hide-screen-meta-links' => array(
4
- 'label' => 'Hide screen meta links',
5
- 'selector' => '#screen-meta-links'
6
- ),
7
- 'hide-screen-options' => array(
8
- 'label' => 'Hide the "Screen Options" button',
9
- 'selector' => '#screen-options-link-wrap',
10
- 'parent' => 'hide-screen-meta-links',
11
- ),
12
- 'hide-help-panel' => array(
13
- 'label' => 'Hide the "Help" button',
14
- 'selector' => '#contextual-help-link-wrap',
15
- 'parent' => 'hide-screen-meta-links',
16
- ),
17
- 'hide-all-admin-notices' => array(
18
- 'label' => 'Hide ALL admin notices',
19
- 'selector' => '.wrap .notice, .wrap .updated',
20
- ),
21
- );
modules/tweaks/tweaks-template.php DELETED
@@ -1,13 +0,0 @@
1
- <?php
2
- /**
3
- * @var string $tabUrl Fully qualified URL of the tab.
4
- * @var array $tweaks
5
- */
6
-
7
- ?>
8
- <div id="ame-tweak-manager">
9
- <?php require AME_ROOT_DIR . '/modules/actor-selector/actor-selector-template.php'; ?>
10
-
11
- <pre><?php print_r($tweaks); ?></pre>
12
- </div>
13
-
modules/tweaks/tweaks.php DELETED
@@ -1,158 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * Idea: Show tweaks as options in menu properties, e.g. in a "Tweaks" section styled like the collapsible
5
- * property sheets in Delphi.
6
- */
7
-
8
- class ameTweakManager extends amePersistentModule {
9
- protected $tabSlug = 'tweaks';
10
- protected $tabTitle = 'Tweaks';
11
- protected $optionName = 'ws_ame_tweak_settings';
12
-
13
- private $tweaks = array();
14
-
15
- private $postponedTweaks = array();
16
- private $pendingSelectorTweaks = array();
17
-
18
- public function __construct($menuEditor) {
19
- parent::__construct($menuEditor);
20
-
21
- add_action('init', array($this, 'processTweaks'), 200);
22
- add_action('admin_head', array($this, 'outputSelectors'));
23
- }
24
-
25
- private function registerTweaks() {
26
- $this->tweaks = require (__DIR__ . '/default-tweaks.php');
27
- do_action('admin-menu-editor-register_tweaks', $this);
28
- }
29
-
30
- public function processTweaks() {
31
- $settings = $this->loadSettings();
32
- $isTweakEnabled = ameUtils::get($settings, 'isTweakEnabled');
33
-
34
- $this->registerTweaks();
35
-
36
- $currentUser = wp_get_current_user();
37
- $roles = $this->menuEditor->get_user_roles($currentUser);
38
- $isSuperAdmin = is_multisite() && is_super_admin($currentUser->ID);
39
-
40
- foreach ($this->tweaks as $id => $tweak) {
41
- if ( empty($isTweakEnabled[$id]) ) {
42
- continue; //This tweak is not enabled for anyone.
43
- }
44
-
45
- if ( !$this->appliesToUser($isTweakEnabled[$id], $currentUser, $roles, $isSuperAdmin) ) {
46
- continue;
47
- }
48
-
49
- if ( isset($tweak['initFilter']) && !call_user_func($tweak['initFilter']) ) {
50
- continue;
51
- }
52
-
53
- if ( !empty($tweak['screens']) || !empty($tweak['screenFilter']) ) {
54
- $this->postponedTweaks[$id] = $tweak;
55
- continue;
56
- }
57
-
58
- $this->applyTweak($id, $tweak);
59
- }
60
-
61
- if ( !empty($this->postponedTweaks) ) {
62
- add_action('current_screen', array($this, 'processPostponedTweaks'), 10, 1);
63
- }
64
- }
65
-
66
- /**
67
- * @param array $enabledForActor
68
- * @param WP_User $user
69
- * @param array $roles
70
- * @param bool $isSuperAdmin
71
- * @return bool
72
- */
73
- private function appliesToUser($enabledForActor, $user, $roles, $isSuperAdmin = false) {
74
- //User-specific settings have priority over everything else.
75
- $userActor = 'user:' . $user->user_login;
76
- if ( isset($enabledForActor[$userActor]) ) {
77
- return $enabledForActor[$userActor];
78
- }
79
-
80
- //The "Super Admin" flag has priority over regular roles.
81
- if ( $isSuperAdmin && isset($enabledForActor['special:super_admin']) ) {
82
- return $enabledForActor['special:super_admin'];
83
- }
84
-
85
- //If it's enabled for any role, it's enabled for the user.
86
- foreach($roles as $role) {
87
- if ( !empty($enabledForActor['role:' . $role]) ) {
88
- return true;
89
- }
90
- }
91
-
92
- //By default, all tweaks are disabled.
93
- return false;
94
- }
95
-
96
- private function applyTweak($id, $tweak) {
97
- //Run callbacks immediately.
98
- if ( isset($tweak['callback']) ) {
99
- call_user_func($tweak['callback']);
100
- }
101
-
102
- //Queue selectors for later.
103
- if ( !empty($tweak['selector']) ) {
104
- $this->pendingSelectorTweaks[$id] = $tweak;
105
- }
106
- }
107
-
108
- /**
109
- * @param WP_Screen $screen
110
- */
111
- public function processPostponedTweaks($screen = null) {
112
- if ( empty($screen) && function_exists('get_current_screen') ) {
113
- $screen = get_current_screen();
114
- }
115
- $screenId = isset($screen, $screen->id) ? $screen->id : null;
116
-
117
- foreach($this->postponedTweaks as $id => $tweak) {
118
- if ( !empty($tweak['screens']) && !in_array($screenId, $tweak['screens']) ) {
119
- continue;
120
- }
121
-
122
- if ( !empty($tweak['screenFilter']) && !call_user_func($tweak['screenFilter'], $screen) ) {
123
- continue;
124
- }
125
-
126
- $this->applyTweak($id, $tweak);
127
- }
128
-
129
- $this->postponedTweaks = array();
130
- }
131
-
132
- public function outputSelectors() {
133
- if ( empty($this->pendingSelectorTweaks) ) {
134
- return;
135
- }
136
-
137
- $selectors = array();
138
- foreach($this->pendingSelectorTweaks as $tweak) {
139
- $selectors[] = $tweak['selector'];
140
- }
141
- $css = sprintf(
142
- '<style type="text/css">%s { display: none; }</style>',
143
- implode(',', $selectors)
144
- );
145
-
146
- echo '<!-- AME selector tweaks -->', "\n", $css, "\n";
147
-
148
- $this->pendingSelectorTweaks = array();
149
- }
150
-
151
- protected function getTemplateVariables($templateName) {
152
- $variables = parent::getTemplateVariables($templateName);
153
- $variables['tweaks'] = $this->tweaks;
154
- return $variables;
155
- }
156
-
157
-
158
- }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: whiteshadow
3
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A6P9S6CE3SRSW
4
Tags: admin, dashboard, menu, security, wpmu
5
Requires at least: 4.1
6
- Tested up to: 5.2
7
- Stable tag: 1.9.1
8
9
Lets you edit the WordPress admin menu. You can re-order, hide or rename menus, add custom menus and more.
10
@@ -63,6 +63,14 @@ Plugins installed in the `mu-plugins` directory are treated as "always on", so y
63
64
== Changelog ==
65
66
= 1.9.1 =
67
* Fixed a minor conflict with Toolset Types.
68
* Fixed a conflict with the MailPoet plugin where it was not possible to change the plugin's menu icon.
3
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A6P9S6CE3SRSW
4
Tags: admin, dashboard, menu, security, wpmu
5
Requires at least: 4.1
6
+ Tested up to: 5.3
7
+ Stable tag: 1.9.2
8
9
Lets you edit the WordPress admin menu. You can re-order, hide or rename menus, add custom menus and more.
10
63
64
== Changelog ==
65
66
+ = 1.9.2 =
67
+ * Updated the appearance of the settings page to match the admin CSS changes introduced in WordPress 5.3.
68
+ * Fixed inconsistent dialog title bar colours that could occur when another plugin loaded the default WP dialog styles.
69
+ * Fixed a bug where certain top level menus could stay permanently highlighted because some of their submenus were hidden via CSS/JS and unclickable.
70
+ * When there's an error loading the menu configuration (e.g. because it's in an incompatible format), the plugin will now display an admin notice instead of letting through an uncaught exception.
71
+ * Removed the link to Visual Admin Customizer from the plugin settings page.
72
+ * Tested up to WP 5.3.
73
+
74
= 1.9.1 =
75
* Fixed a minor conflict with Toolset Types.
76
* Fixed a conflict with the MailPoet plugin where it was not possible to change the plugin's menu icon.