Plugin Directory

Changeset 3783089


Ignore:
Timestamp:
11/04/2026 04:43:15 AM (112 minutes ago)
Author:
alexodiy
Message:

Release Easy Hide Admin Menu Items 1.4.0

Add drag-and-drop menu sorting, separator controls, and adjustable sidebar width.
Separate site-wide and personal preferences and enforce AJAX permissions.
Update translations, the plugin readme, and the seven directory screenshots.
Publish the 1.4.0 stable tag.

Location:
easy-hide-admin-menu-items
Files:
27 added
8 deleted
34 edited
1 copied

Legend:

Unmodified
Added
Removed
  • easy-hide-admin-menu-items/tags/1.4.0/assets/css/style.css

    r3474229 r3783089  
    7272
    7373#wp-admin-bar-ehami-switch .switch__content {
    74     display: none;
    7574    position: absolute;
    7675    right: 0;
    … …  
    8685    overflow-x: hidden;
    8786    overflow-y: auto;
     87
     88    /* CSS-driven show/hide — replaces jQuery slideDown/slideUp. */
     89    visibility: hidden;
     90    opacity: 0;
     91    pointer-events: none;
     92    transition: opacity 0.2s ease, visibility 0.2s ease;
     93}
     94
     95#wp-admin-bar-ehami-switch .switch__content.--open {
     96    visibility: visible;
     97    opacity: 1;
     98    pointer-events: auto;
    8899}
    89100/* Mozilla Firefox */
    … …  
    167178#adminmenu .menu-top .ehami-remove-sub-li:hover {
    168179    transform: scale(1.2);
    169 }
    170 
    171 .ui-effects-transfer {
    172     border: 2px dotted #72aee6;
    173     background: #72aee6;
    174     z-index: 9999;
    175180}
    176181
    … …  
    234239}
    235240
     241/**
     242 * Inline save notice — shown near Save button and in the header.
     243 * No content jump: elements are always in the DOM, just hidden.
     244 *
     245 * @since 1.4.0
     246 */
     247
     248.ehami-save-row {
     249        display: flex;
     250        align-items: center;
     251        gap: 12px;
     252        margin: 1em 0;
     253}
     254
     255.ehami-save-row .submit {
     256        margin: 0;
     257        padding: 0;
     258}
     259
     260.ehami-inline-notice {
     261        display: inline-flex;
     262        align-items: center;
     263        gap: 4px;
     264        font-size: 13px;
     265        line-height: 1.4;
     266        opacity: 0;
     267        white-space: nowrap;
     268}
     269
     270.ehami-inline-notice .dashicons {
     271        font-size: 18px;
     272        width: 18px;
     273        height: 18px;
     274        line-height: 18px;
     275}
     276
     277.ehami-inline-notice.--success {
     278        color: #00a32a;
     279}
     280
     281.ehami-inline-notice.--error {
     282        color: #d63638;
     283}
     284
     285
    236286.ehami-settings-saving {
    237287    position: absolute;
    … …  
    290340}
    291341
    292 .admin-color-light .ui-effects-transfer {
    293     border: 2px dotted #04a4cc;
    294     background: #04a4cc;
    295 }
    296 
    297342/**
    298343 * Styles themes color .admin-color-modern
    … …  
    338383}
    339384
    340 .admin-color-modern .ui-effects-transfer {
    341     border: 2px dotted #33f078;
    342     background: #33f078;
    343 }
    344 
    345385/**
    346386 * Styles themes color .admin-color-blue
    … …  
    389429}
    390430
    391 .admin-color-blue .ui-effects-transfer {
    392     border: 2px dotted #4796b3;
    393     background: #4796b3;
    394 }
    395 
    396431/**
    397432 * Styles themes color .admin-color-coffee
    … …  
    440475}
    441476
    442 .admin-color-coffee .ui-effects-transfer {
    443     border: 2px dotted #59524c;
    444     background: #59524c;
    445 }
    446 
    447477/**
    448478 * Styles themes color .admin-color-ectoplasm
    … …  
    491521}
    492522
    493 .admin-color-ectoplasm .ui-effects-transfer {
    494     border: 2px dotted #523f6d;
    495     background: #523f6d;
    496 }
    497 
    498523/**
    499524 * Styles themes color .admin-color-midnight
    … …  
    542567}
    543568
    544 .admin-color-midnight .ui-effects-transfer {
    545     border: 2px dotted #363b3f;
    546     background: #363b3f;
    547 }
    548 
    549569/**
    550570 * Styles themes color .admin-color-ocean
    … …  
    593613}
    594614
    595 .admin-color-ocean .ui-effects-transfer {
    596     border: 2px dotted #738e96;
    597     background: #738e96;
    598 }
    599 
    600615/**
    601616 * Styles themes color .admin-color-sunrise
    … …  
    643658    border-left: 2px solid #f7e3d3;
    644659    background-color: #cf4944;
    645 }
    646 
    647 .admin-color-sunrise .ui-effects-transfer {
    648     border: 2px dotted #cf4944;
    649     background: #cf4944;
    650660}
    651661
    … …  
    677687    color: #eee;
    678688}
     689
     690/**
     691 * Experimental badge and separator row
     692 */
     693
     694.ehami-settings__experimental-badge {
     695    margin-top: 8px;
     696    display: flex;
     697    align-items: center;
     698    gap: 10px;
     699}
     700
     701.ehami-badge {
     702    display: inline-block;
     703    padding: 2px 8px;
     704    border-radius: 3px;
     705    font-size: 11px;
     706    font-weight: 600;
     707    line-height: 1.6;
     708    text-transform: uppercase;
     709}
     710
     711.ehami-badge--experimental {
     712    background: #fcf0c3;
     713    color: #6e4e00;
     714}
     715
     716.ehami-settings__separator-row td {
     717    padding: 0;
     718}
     719
     720.ehami-settings__separator-row hr {
     721        margin: 0;
     722        border: none;
     723        border-top: 1px solid #ccc;
     724}
     725
     726.ehami-settings__reset-order {
     727        margin-top: 6px;
     728}
     729
     730.ehami-reset-link {
     731        color: #b32d2e;
     732        text-decoration: none;
     733}
     734
     735.ehami-reset-link:hover {
     736        color: #a00;
     737}
     738
     739.ehami-reset-link .dashicons {
     740        font-size: 16px;
     741        width: 16px;
     742        height: 16px;
     743        vertical-align: text-bottom;
     744        margin-right: 2px;
     745}
     746
     747/**
     748 * Menu sorting — SortableJS + drag handle.
     749 * Handle icon appears on hover (right side), same animation as hide icon (left side).
     750 *
     751 * @since 1.4.0
     752 */
     753
     754/* Drag handle — hidden by default, slides in from right on hover.
     755   Matches WP .wp-menu-image dimensions: 36x34px. */
     756#adminmenu .menu-top .ehami-sort-handle {
     757        position: absolute;
     758        top: 0;
     759        right: -36px;
     760        width: 36px;
     761        height: 34px;
     762        line-height: 34px;
     763        text-align: center;
     764        padding: 0;
     765        color: #a7aaad;
     766        z-index: 9999;
     767        background-color: #2c3338;
     768        cursor: grab;
     769        font-size: 20px;
     770        transition: right 0.5s cubic-bezier(0.8, -0.2, 0.55, 1.3) 1s,
     771                    opacity 0.3s linear 1s;
     772        opacity: 0;
     773}
     774
     775#adminmenu .menu-top:hover .ehami-sort-handle {
     776        right: 0;
     777        opacity: 1;
     778}
     779
     780#adminmenu .menu-top .ehami-sort-handle:hover {
     781        color: #72aee6;
     782}
     783
     784/* Separator as drag handle — hover highlight + grab cursor. */
     785#adminmenu li.wp-menu-separator.ehami-sort-handle {
     786        cursor: grab;
     787        transition: background 0.2s ease;
     788}
     789
     790#adminmenu li.wp-menu-separator.ehami-sort-handle:hover {
     791        background: rgba(114, 174, 230, 0.2);
     792}
     793
     794#adminmenu li.wp-menu-separator.ehami-sort-handle:hover .separator {
     795        background: #72aee6;
     796        height: 2px;
     797}
     798
     799/**
     800 * Folded sidebar + mobile: reposition hide icon and sort handle
     801 * as a vertical dropdown below the menu item (36 x 34 px each).
     802 *
     803 * @since 1.4.0
     804 */
     805
     806/* Shared dropdown styles for both folded and mobile contexts.
     807   Applied via .folded prefix and duplicated inside @media (max-width: 782px)
     808   because mobile WP admin does not always add the .folded class. */
     809.folded #adminmenu .menu-top .ehami-remove-li,
     810.folded #adminmenu .menu-top .ehami-sort-handle {
     811        position: absolute;
     812        left: 0;
     813        right: auto;
     814        width: 36px;
     815        height: 34px;
     816        padding: 0;
     817        z-index: 10003;
     818        background-color: #2c3338;
     819        box-shadow: inset 4px 0 0 0 #2271b1;
     820        opacity: 0;
     821        pointer-events: none;
     822        transition: opacity 0.18s ease;
     823        font-size: 16px;
     824}
     825
     826.folded #adminmenu .menu-top .ehami-remove-li {
     827        top: 100%;
     828        display: flex;
     829        align-items: center;
     830        justify-content: center;
     831        transform: none;
     832}
     833
     834.folded #adminmenu .menu-top .ehami-sort-handle {
     835        top: calc(100% + 34px);
     836        line-height: 34px;
     837}
     838
     839.folded #adminmenu .menu-top:hover .ehami-remove-li,
     840.folded #adminmenu .menu-top:hover .ehami-sort-handle,
     841.folded #adminmenu .menu-top.opensub .ehami-remove-li,
     842.folded #adminmenu .menu-top.opensub .ehami-sort-handle {
     843        opacity: 1;
     844        pointer-events: auto;
     845}
     846
     847.folded #adminmenu .menu-top .ehami-remove-li:hover {
     848        background-color: #3c4349;
     849        transform: none;
     850}
     851
     852.folded #adminmenu .menu-top .ehami-sort-handle:hover {
     853        background-color: #3c4349;
     854        color: #72aee6;
     855}
     856
     857/* Mobile (< 782 px): identical dropdown layout. */
     858@media (max-width: 782px) {
     859        #adminmenu .menu-top .ehami-remove-li,
     860        #adminmenu .menu-top .ehami-sort-handle {
     861                position: absolute;
     862                left: 0;
     863                right: auto;
     864                width: 36px;
     865                height: 34px;
     866                padding: 0;
     867                z-index: 10003;
     868                background-color: #2c3338;
     869                box-shadow: inset 4px 0 0 0 #2271b1;
     870                opacity: 0;
     871                pointer-events: none;
     872                transition: opacity 0.18s ease;
     873                font-size: 16px;
     874        }
     875
     876        #adminmenu .menu-top .ehami-remove-li {
     877                top: 100%;
     878                display: flex;
     879                align-items: center;
     880                justify-content: center;
     881                transform: none;
     882        }
     883
     884        #adminmenu .menu-top .ehami-sort-handle {
     885                top: calc(100% + 34px);
     886                line-height: 34px;
     887        }
     888
     889        #adminmenu .menu-top:hover .ehami-remove-li,
     890        #adminmenu .menu-top:hover .ehami-sort-handle,
     891        #adminmenu .menu-top.opensub .ehami-remove-li,
     892        #adminmenu .menu-top.opensub .ehami-sort-handle {
     893                opacity: 1;
     894                pointer-events: auto;
     895        }
     896
     897        #adminmenu .menu-top .ehami-remove-li:hover {
     898                background-color: #3c4349;
     899                transform: none;
     900        }
     901
     902        #adminmenu .menu-top .ehami-sort-handle:hover {
     903                background-color: #3c4349;
     904                color: #72aee6;
     905        }
     906}
     907
     908/* Ghost: placeholder left in place — shows where the item will land. */
     909#adminmenu > li.menu-top.ehami-sortable-ghost {
     910        background: rgba(114, 174, 230, 0.12) !important;
     911        border: 2px dashed #72aee6;
     912        border-radius: 3px;
     913        height: 36px !important;
     914        min-height: 0 !important;
     915        overflow: hidden;
     916}
     917
     918#adminmenu > li.wp-menu-separator.ehami-sortable-ghost {
     919        background: rgba(114, 174, 230, 0.25) !important;
     920        border: 1px dashed #72aee6;
     921        border-radius: 2px;
     922        height: 6px !important;
     923}
     924
     925#adminmenu > li.ehami-sortable-ghost > * {
     926        visibility: hidden;
     927}
     928
     929#adminmenu > li.ehami-sortable-ghost .wp-submenu {
     930        display: none !important;
     931}
     932
     933/* Drag clone: the floating copy that follows the cursor.
     934   Background comes from CSS variable set by JS on drag start —
     935   automatically matches any admin color scheme. */
     936li.ehami-sortable-drag {
     937        background: var(--ehami-sidebar-bg, #1d2327) !important;
     938        opacity: 0.95 !important;
     939        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
     940        border-radius: 3px;
     941}
     942
     943li.ehami-sortable-drag .wp-submenu {
     944        display: none !important;
     945}
     946
     947/* Separator drag clone — visible bright line so user sees what they're dragging. */
     948li.wp-menu-separator.ehami-sortable-drag {
     949        background: transparent !important;
     950        box-shadow: none !important;
     951        height: auto !important;
     952        padding: 4px 0 !important;
     953}
     954
     955li.wp-menu-separator.ehami-sortable-drag .separator {
     956        height: 3px !important;
     957        background: #72aee6 !important;
     958        border-radius: 2px;
     959        margin: 0 8px;
     960}
     961
     962li.ehami-sortable-drag .ehami-sort-handle,
     963li.ehami-sortable-drag .ehami-remove-li {
     964        display: none !important;
     965}
     966
     967/* When "Don't display hide icons" is checked — disable all sorting interactions. */
     968.ehami-icons-hidden #adminmenu .menu-top .ehami-sort-handle {
     969        display: none !important;
     970}
     971
     972.ehami-icons-hidden #adminmenu li.wp-menu-separator.ehami-sort-handle {
     973        cursor: default;
     974        pointer-events: none;
     975}
     976
     977.ehami-icons-hidden #adminmenu li.wp-menu-separator.ehami-sort-handle:hover {
     978        background: transparent;
     979}
     980
     981.ehami-icons-hidden #adminmenu li.wp-menu-separator.ehami-sort-handle:hover .separator {
     982        background: inherit;
     983        height: inherit;
     984}
     985
     986/* Prevent text selection while dragging. */
     987.ehami-sorting-active {
     988        user-select: none !important;
     989        -webkit-user-select: none !important;
     990        cursor: grabbing !important;
     991}
     992
     993/* Admin color scheme support for drag handle. */
     994.admin-color-light #adminmenu .menu-top .ehami-sort-handle {
     995        background-color: #fff;
     996        color: #999;
     997}
     998
     999.admin-color-light #adminmenu .menu-top .ehami-sort-handle:hover {
     1000        color: #04a4cc;
     1001}
     1002
     1003.admin-color-modern #adminmenu .menu-top .ehami-sort-handle {
     1004        background-color: #0c0c0c;
     1005        color: #86888a;
     1006}
     1007
     1008.admin-color-modern #adminmenu .menu-top .ehami-sort-handle:hover {
     1009        color: #33f078;
     1010}
     1011
     1012/* Admin color scheme overrides for folded dropdown icons.
     1013   @since 1.4.0 */
     1014.admin-color-light.folded #adminmenu .menu-top .ehami-remove-li,
     1015.admin-color-light.folded #adminmenu .menu-top .ehami-sort-handle {
     1016        background-color: #f1f1f1;
     1017        box-shadow: inset 4px 0 0 0 #888;
     1018}
     1019
     1020.admin-color-modern.folded #adminmenu .menu-top .ehami-remove-li,
     1021.admin-color-modern.folded #adminmenu .menu-top .ehami-sort-handle {
     1022        background-color: #1e1e1e;
     1023        box-shadow: inset 4px 0 0 0 #3858e9;
     1024}
     1025
     1026.admin-color-blue.folded #adminmenu .menu-top .ehami-remove-li,
     1027.admin-color-blue.folded #adminmenu .menu-top .ehami-sort-handle {
     1028        background-color: #52accc;
     1029        box-shadow: inset 4px 0 0 0 #e2ecf1;
     1030}
     1031
     1032.admin-color-coffee.folded #adminmenu .menu-top .ehami-remove-li,
     1033.admin-color-coffee.folded #adminmenu .menu-top .ehami-sort-handle {
     1034        background-color: #46403c;
     1035        box-shadow: inset 4px 0 0 0 #c7a589;
     1036}
     1037
     1038.admin-color-ectoplasm.folded #adminmenu .menu-top .ehami-remove-li,
     1039.admin-color-ectoplasm.folded #adminmenu .menu-top .ehami-sort-handle {
     1040        background-color: #413256;
     1041        box-shadow: inset 4px 0 0 0 #a3b745;
     1042}
     1043
     1044.admin-color-midnight.folded #adminmenu .menu-top .ehami-remove-li,
     1045.admin-color-midnight.folded #adminmenu .menu-top .ehami-sort-handle {
     1046        background-color: #26292c;
     1047        box-shadow: inset 4px 0 0 0 #e14d43;
     1048}
     1049
     1050.admin-color-ocean.folded #adminmenu .menu-top .ehami-remove-li,
     1051.admin-color-ocean.folded #adminmenu .menu-top .ehami-sort-handle {
     1052        background-color: #627c83;
     1053        box-shadow: inset 4px 0 0 0 #9ebaa0;
     1054}
     1055
     1056.admin-color-sunrise.folded #adminmenu .menu-top .ehami-remove-li,
     1057.admin-color-sunrise.folded #adminmenu .menu-top .ehami-sort-handle {
     1058        background-color: #be3631;
     1059        box-shadow: inset 4px 0 0 0 #dd823b;
     1060}
     1061
     1062/**
     1063 * Sidebar resize — Notion/Outline-style drag handle.
     1064 *
     1065 * Invisible grab zone on the right edge of the sidebar.
     1066 * On hover a thin vertical line appears at the boundary.
     1067 * Drag left/right to resize. Release to save.
     1068 *
     1069 * @since 1.4.0
     1070 */
     1071
     1072/* Grab zone — fixed to viewport, stretches from admin bar to bottom of screen. */
     1073.ehami-resize-handle {
     1074        position: fixed;
     1075        top: 32px;
     1076        bottom: 0;
     1077        width: 2px;
     1078        cursor: col-resize;
     1079        z-index: 9999;
     1080}
     1081
     1082/* Keep the WP menu arrow (triangle) above the resize handle. */
     1083ul#adminmenu a.wp-has-current-submenu:after,
     1084ul#adminmenu > li.current > a.current:after {
     1085        z-index: 10000;
     1086}
     1087
     1088/* Vertical line — appears on hover/active.
     1089   Color is set via --ehami-resize-color CSS variable by JS (matches admin color scheme). */
     1090.ehami-resize-handle::after {
     1091        content: "";
     1092        position: absolute;
     1093        top: 0;
     1094        left: 50%;
     1095        transform: translateX(-50%);
     1096        width: 4px;
     1097        height: 100%;
     1098        background: transparent;
     1099        transition: background 0.15s ease;
     1100}
     1101
     1102.ehami-resize-handle:hover::after,
     1103.ehami-resize-handle.ehami-resize-active::after {
     1104        background: var(--ehami-resize-color, #2271b1);
     1105}
     1106
     1107/* Prevent text selection and pointer events during resize. */
     1108.ehami-resizing {
     1109        user-select: none !important;
     1110        -webkit-user-select: none !important;
     1111        cursor: col-resize !important;
     1112}
     1113
     1114.ehami-resizing iframe {
     1115        pointer-events: none;
     1116}
     1117
     1118/* Hide resize handle when menu is folded or on mobile. */
     1119.folded .ehami-resize-handle {
     1120        display: none;
     1121}
     1122
     1123@media (max-width: 960px) {
     1124        .auto-fold .ehami-resize-handle {
     1125                display: none;
     1126        }
     1127}
     1128
     1129@media (max-width: 782px) {
     1130        .ehami-resize-handle {
     1131                display: none;
     1132        }
     1133}
     1134
     1135/**
     1136 * Video tooltip — play icon next to settings labels.
     1137 * On hover shows a small popup with auto-playing video.
     1138 *
     1139 * @since 1.5.0
     1140 */
     1141
     1142.ehami-video-hint {
     1143        display: inline-block;
     1144        position: relative;
     1145        vertical-align: middle;
     1146        margin-left: 4px;
     1147        cursor: pointer;
     1148}
     1149
     1150.ehami-video-hint .dashicons {
     1151        font-size: 16px;
     1152        width: 16px;
     1153        height: 16px;
     1154        line-height: 16px;
     1155        color: #a7aaad;
     1156        transition: color 0.15s ease;
     1157}
     1158
     1159.ehami-video-hint:hover .dashicons {
     1160        color: #2271b1;
     1161}
     1162
     1163/* Tooltip container — anchored to the icon, appears on hover. */
     1164.ehami-video-tooltip {
     1165        position: absolute;
     1166        left: 50%;
     1167        bottom: calc(100% + 8px);
     1168        transform: translateX(-50%);
     1169        width: 400px;
     1170        background: #1d2327;
     1171        border-radius: 6px;
     1172        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
     1173        overflow: hidden;
     1174        z-index: 100001;
     1175        opacity: 0;
     1176        visibility: hidden;
     1177        transition: opacity 0.2s ease, visibility 0.2s ease;
     1178        pointer-events: none;
     1179}
     1180
     1181.ehami-video-hint:hover .ehami-video-tooltip {
     1182        opacity: 1;
     1183        visibility: visible;
     1184        pointer-events: auto;
     1185}
     1186
     1187/* Arrow pointing down from the tooltip. */
     1188.ehami-video-tooltip::after {
     1189        content: "";
     1190        position: absolute;
     1191        left: 50%;
     1192        bottom: -6px;
     1193        transform: translateX(-50%);
     1194        border-left: 6px solid transparent;
     1195        border-right: 6px solid transparent;
     1196        border-top: 6px solid #1d2327;
     1197}
     1198
     1199/* Video element inside the tooltip. */
     1200.ehami-video-tooltip video {
     1201        display: block;
     1202        width: 100%;
     1203        height: auto;
     1204        border-radius: 6px;
     1205}
     1206
     1207/* Spinner — shown while video is loading. */
     1208.ehami-video-tooltip .ehami-video-spinner {
     1209        position: absolute;
     1210        top: 50%;
     1211        left: 50%;
     1212        transform: translate(-50%, -50%);
     1213        width: 24px;
     1214        height: 24px;
     1215        border: 3px solid rgba(255, 255, 255, 0.2);
     1216        border-top-color: #fff;
     1217        border-radius: 50%;
     1218        animation: ehami-spin 0.6s linear infinite;
     1219}
     1220
     1221.ehami-video-tooltip .ehami-video-spinner.--hidden {
     1222        display: none;
     1223}
     1224
     1225@keyframes ehami-spin {
     1226        to { transform: translate(-50%, -50%) rotate(360deg); }
     1227}
     1228
     1229/**
     1230 * Fly-to-bar animation — menu item clone flies toward the admin bar toggle.
     1231 *
     1232 * @since 1.5.0
     1233 */
     1234
     1235/* Transfer outline — visible dashed border that flies from sidebar to admin bar. */
     1236.ehami-fly-clone {
     1237        position: fixed;
     1238        z-index: 100000;
     1239        pointer-events: none;
     1240        border: 2px dashed #72aee6;
     1241        border-radius: 3px;
     1242        background: rgba(114, 174, 230, 0.08);
     1243}
     1244
     1245.ehami-fly-clone.--animating {
     1246        transition: left 0.5s cubic-bezier(0.4, 0, 0.2, 1),
     1247                    top 0.5s cubic-bezier(0.4, 0, 0.2, 1),
     1248                    width 0.5s cubic-bezier(0.4, 0, 0.2, 1),
     1249                    height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
     1250}
  • easy-hide-admin-menu-items/tags/1.4.0/autoload.php

    r3474229 r3783089  
    77
    88spl_autoload_register(
    9         static function ( $class ) {
    10                 if ( strpos( $class, __NAMESPACE__ . '\\' ) !== 0 ) {
     9        static function ( $class_name ) {
     10                if ( strpos( $class_name, __NAMESPACE__ . '\\' ) !== 0 ) {
    1111                        return;
    1212                }
    1313
    14                 $path = str_replace( [ __NAMESPACE__, '\\' ], [ __DIR__ . '/src', '/' ], $class );
     14                $path = str_replace( [ __NAMESPACE__, '\\' ], [ __DIR__ . '/src', '/' ], $class_name );
    1515
    1616                require_once "$path.php";
  • easy-hide-admin-menu-items/tags/1.4.0/ehami.php

    r3474229 r3783089  
    66 * Domain Path: /languages
    77 * Description: The plugin allows hiding selected admin menu items.
    8  * Version: 1.3.9
     8 * Version: 1.4.0
    99 * Author: Campusboy, Dan Zakirov, Tkama
    1010 * License: GPL-2.0+
  • easy-hide-admin-menu-items/tags/1.4.0/languages/ehami-ru_RU.po

    r3474229 r3783089  
    1 # Translation of Plugins - Easy Hide Admin Menu Items - Stable (latest release) in Russian
    2 # This file is distributed under the same license as the Plugins - Easy Hide Admin Menu Items - Stable (latest release) package.
    3 msgid ""
    4 msgstr ""
     1# Translation of Easy Hide Admin Menu Items in Russian
     2# This file is distributed under the same license as the Easy Hide Admin Menu Items package.
     3msgid ""
     4msgstr ""
     5"Project-Id-Version: Easy Hide Admin Menu Items 1.4.0\n"
    56"PO-Revision-Date: 2024-03-06 19:20:09+0000\n"
     7"Language: ru_RU\n"
    68"MIME-Version: 1.0\n"
    79"Content-Type: text/plain; charset=UTF-8\n"
    … …  
    911"Plural-Forms: nplurals=3; plural=(n % 10 == 1 && n % 100 != 11) ? 0 : ((n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 12 || n % 100 > 14)) ? 1 : 2);\n"
    1012"X-Generator: GlotPress/4.0.0-rc.1\n"
    11 "Language: ru\n"
    12 "Project-Id-Version: Plugins - Easy Hide Admin Menu Items - Stable (latest release)\n"
    1313
    1414#: templates/switcher.php:36
    … …  
    1616msgstr "Отключить иконки скрытия"
    1717
    18 #: templates/admin-page-options.php:123
     18#: templates/admin-page-options.php:275
    1919msgid "Leave a review"
    2020msgstr "Оставить отзыв"
    2121
    22 #: templates/admin-page-options.php:121
    23 msgid "Please consider leaving a review for our plugin. Your reviews help us improve and serve you better."
    24 msgstr "Пожалуйста, рассмотрите возможность оставить отзыв о нашем плагине. Ваша обратная связь мотивирует нас качественно улучшать сервис."
    25 
    26 #: templates/admin-page-options.php:109
     22#: templates/admin-page-options.php:273
     23msgid ""
     24"Please consider leaving a review for our plugin. Your reviews help us "
     25"improve and serve you better."
     26msgstr ""
     27"Пожалуйста, рассмотрите возможность оставить отзыв о нашем плагине. Ваша "
     28"обратная связь мотивирует нас качественно улучшать сервис."
     29
     30#: templates/admin-page-options.php:261
    2731msgid "contact us here"
    2832msgstr "обращаться к нам"
    2933
    30 #: templates/admin-page-options.php:108
    31 msgid "For support, please contact our helpdesk. If you encounter any issues or have any questions, feel free to"
    32 msgstr "Для получения поддержки, пожалуйста, обратитесь на форум. Если у вас возникнут проблемы или вопросы, не стесняйтесь"
     34#: templates/admin-page-options.php:260
     35msgid ""
     36"For support, please contact our helpdesk. If you encounter any issues or "
     37"have any questions, feel free to"
     38msgstr ""
     39"Для получения поддержки, пожалуйста, обратитесь на форум. Если у вас "
     40"возникнут проблемы или вопросы, не стесняйтесь"
    3341
    3442#: src/Review.php:190
    … …  
    5058#. translators: %s is a placeholder for the plugin name
    5159#: src/Review.php:161
    52 msgid "We are very pleased that you are using the %s plugin within a few days."
     60#, php-format
     61msgid ""
     62"We are very pleased that you are using the %s plugin within a few days."
    5363msgstr "Мы очень рады, что вы используете плагин %s уже несколько дней."
    5464
    … …  
    5767msgstr "Здравствуйте!"
    5868
    59 #. Author of the plugin
    60 #: ehami.php
     69#. Author of the plugin/theme
    6170msgid "Campusboy, Dan Zakirov, Tkama"
    6271msgstr "Campusboy, Dan Zakirov, Tkama"
    … …  
    7079msgstr "Скрыть или показать скрытые пункты меню"
    7180
    72 #: templates/admin-page-options.php:98
    73 msgid "Thank you for using Easy Hide Admin Menu Items! Your feedback and comments are highly valuable to us and will assist us in improving the plugin further."
    74 msgstr "Благодарим вас за использование плагина Easy Hide Admin Menu Items! Ваши отзывы и комментарии имеют для нас большую ценность и помогут нам дальше улучшать плагин."
    75 
    76 #: templates/admin-page-options.php:94
     81#: templates/admin-page-options.php:250
     82msgid ""
     83"Thank you for using Easy Hide Admin Menu Items! Your feedback and comments "
     84"are highly valuable to us and will assist us in improving the plugin "
     85"further."
     86msgstr ""
     87"Благодарим вас за использование плагина Easy Hide Admin Menu Items! Ваши "
     88"отзывы и комментарии имеют для нас большую ценность и помогут нам дальше "
     89"улучшать плагин."
     90
     91#: templates/admin-page-options.php:246
    7792msgid "Message From the Author"
    7893msgstr "Сообщение от авторов"
    7994
    80 #: templates/admin-page-options.php:84
     95#: templates/admin-page-options.php:234
    8196msgid "Save Settings"
    8297msgstr "Сохранить настройки"
    8398
    84 #: templates/admin-page-options.php:44
     99#: templates/admin-page-options.php:52
    85100msgid "Main Settings"
    86101msgstr "Основные настройки"
    87102
    88 #: templates/admin-page-options.php:35
     103#: templates/admin-page-options.php:43
    89104msgid "Easy Hide Admin Menu Items Settings"
    90105msgstr "Настройки Easy Hide Admin Menu Items"
    91106
     107#: templates/admin-page-options.php:29
     108msgid ""
     109"If checked, all data (option and user metadata) will be deleted when the "
     110"plugin is deleted."
     111msgstr ""
     112"Если отмечено, то все данные (опции и метаданные пользователей) будут "
     113"удалены из базы данных при удалении плагина."
     114
    92115#: templates/admin-page-options.php:28
    93 msgid "If checked, all data (option and user metadata) will be deleted when the plugin is deleted."
    94 msgstr "Если отмечено, то все данные (опции и метаданные пользователей) будут удалены из базы данных при удалении плагина."
    95 
    96 #: templates/admin-page-options.php:27
    97116msgid "Allow the deletion of all plugin data after it is deleted"
    98117msgstr "Разрешить удаление всех данных после удаления плагина"
    99118
    100 #: templates/admin-page-options.php:23
     119#: templates/admin-page-options.php:24
    101120msgid "Uninstall plugin"
    102121msgstr "Удаление плагина"
    103122
    104123#: templates/admin-page-options.php:20
    105 msgid "If checked, you can hide the child menu. This may be useful when there are too many child menus causing distraction."
    106 msgstr "Если отмечено, вы можете скрывать дочерние меню. Это может быть полезно, когда слишком много дочерних меню которыми вы не пользуетесь."
     124msgid ""
     125"If checked, you can hide the child menu. This may be useful when there are "
     126"too many child menus causing distraction."
     127msgstr ""
     128"Если отмечено, вы можете скрывать дочерние меню. Это может быть полезно, "
     129"когда слишком много дочерних меню которыми вы не пользуетесь."
    107130
    108131#: templates/admin-page-options.php:19
    … …  
    115138
    116139#: templates/admin-page-options.php:12
    117 msgid "If checked, each user with access to the admin panel can save hidden menu settings individually for their own preferences."
    118 msgstr "Если отмечено, каждый пользователь с доступом к административной панели может сохранить скрытые настройки меню индивидуально для своих предпочтений."
     140msgid ""
     141"If checked, each user with access to the admin panel can save hidden menu "
     142"settings individually for their own preferences."
     143msgstr ""
     144"Если отмечено, каждый пользователь с доступом к административной панели "
     145"может сохранить скрытые настройки меню индивидуально для своих предпочтений."
    119146
    120147#: templates/admin-page-options.php:11
    121148msgid "Allow other users to set their own preferences."
    122 msgstr "Разрешить другим пользователям настраивать меню для себя на своё усмотрение."
     149msgstr ""
     150"Разрешить другим пользователям настраивать меню для себя на своё усмотрение."
    123151
    124152#: templates/admin-page-options.php:7
    … …  
    134162msgstr "Настройки меню администратора"
    135163
    136 #: src/Assets.php:38
     164#: src/Assets.php:35
    137165msgid "Hide menu"
    138166msgstr "Скрыть меню"
    139167
    140 #: src/Assets.php:37 templates/switcher.php:26
     168#: src/Assets.php:34 templates/switcher.php:26
    141169msgid "No hidden menu items"
    142170msgstr "Скрытые меню отсутствуют"
    143171
    144 #: src/Ajax.php:23 src/Ajax.php:40 src/Ajax.php:59 src/Ajax.php:79
    145 #: src/Ajax.php:98
     172#: src/Ajax.php:27 src/Ajax.php:44 src/Ajax.php:71 src/Ajax.php:91
     173#: src/Ajax.php:110 src/Ajax.php:132 src/Ajax.php:162 src/Ajax.php:184
     174#: src/Ajax.php:208
    146175msgid "Sorry, you are not allowed to manage options for this site."
    147176msgstr "Извините, у вас нет прав на управление опциями для этого сайта."
    148177
    149 #. Description of the plugin
    150 #: ehami.php
     178#. Description of the plugin/theme
    151179msgid "The plugin allows hiding selected admin menu items."
    152180msgstr "Плагин позволяет скрывать выбранные пункты меню администратора."
    153181
    154 #. Plugin URI of the plugin
    155 #: ehami.php
     182#. Plugin URI of the plugin/theme
    156183msgid "https://github.com/campusboy87/easy-hide-admin-menu-items"
    157184msgstr "https://github.com/campusboy87/easy-hide-admin-menu-items"
    158185
    159 #. Plugin Name of the plugin
    160 #: ehami.php
     186#. Plugin Name of the plugin/theme
    161187msgid "Easy Hide Admin Menu Items"
    162188msgstr "Easy Hide Admin Menu Items"
     189
     190#: src/Assets.php:38
     191msgid "Settings saved."
     192msgstr "Настройки сохранены."
     193
     194#: src/Assets.php:39
     195msgid "Error saving settings."
     196msgstr "Не удалось сохранить настройки."
     197
     198#: templates/admin-page-options.php:35
     199msgid "No changes (default)"
     200msgstr "Без изменений (по умолчанию)"
     201
     202#: templates/admin-page-options.php:36
     203msgid "Hide all separators"
     204msgstr "Скрыть все разделители"
     205
     206#: templates/admin-page-options.php:37
     207msgid "Highlight separators"
     208msgstr "Выделить разделители"
     209
     210#: templates/admin-page-options.php:102 templates/admin-page-options.php:108
     211msgid "Menu Sorting"
     212msgstr "Сортировка меню"
     213
     214#: templates/admin-page-options.php:119
     215msgid "Enable drag-and-drop menu reordering"
     216msgstr "Разрешить изменение порядка пунктов меню перетаскиванием"
     217
     218#: templates/admin-page-options.php:128
     219msgid "Drag the handle icon on the right side of menu items to reorder them."
     220msgstr ""
     221"Чтобы изменить порядок пунктов меню, перетащите значок справа от пункта."
     222
     223#: templates/admin-page-options.php:131
     224msgid "Note:"
     225msgstr "Примечание:"
     226
     227#: templates/admin-page-options.php:132
     228msgid ""
     229"your custom order is preserved even when this option is disabled. Use "
     230"\"Reset menu order\" to restore the default order."
     231msgstr ""
     232"заданный порядок сохраняется даже при отключении этой настройки. Чтобы "
     233"восстановить порядок по умолчанию, нажмите «Сбросить порядок меню»."
     234
     235#: templates/admin-page-options.php:135 templates/admin-page-options.php:179
     236#: templates/admin-page-options.php:224
     237msgid "Experimental"
     238msgstr "Экспериментальная функция"
     239
     240#: templates/admin-page-options.php:138
     241msgid "Reset menu order"
     242msgstr "Сбросить порядок меню"
     243
     244#: templates/admin-page-options.php:150 templates/admin-page-options.php:156
     245msgid "Sidebar Width"
     246msgstr "Ширина боковой панели"
     247
     248#: templates/admin-page-options.php:167
     249msgid "Enable sidebar width resize"
     250msgstr "Разрешить изменение ширины боковой панели"
     251
     252#: templates/admin-page-options.php:176
     253msgid "Drag the right edge of the sidebar to adjust the menu width."
     254msgstr "Чтобы изменить ширину меню, перетащите правый край боковой панели."
     255
     256#: templates/admin-page-options.php:182
     257msgid "Reset sidebar width"
     258msgstr "Сбросить ширину боковой панели"
     259
     260#: templates/admin-page-options.php:194 templates/admin-page-options.php:200
     261msgid "Menu Separators"
     262msgstr "Разделители меню"
     263
     264#: templates/admin-page-options.php:221
     265msgid ""
     266"Control the visibility of separator lines between menu groups in the admin "
     267"sidebar."
     268msgstr ""
     269"Управляйте отображением линий между группами пунктов меню в боковой панели "
     270"администратора."
  • easy-hide-admin-menu-items/tags/1.4.0/languages/ehami.pot

    r3474229 r3783089  
     1#
    12#, fuzzy
    23msgid ""
    34msgstr ""
    4 "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
    5 "Project-Id-Version: Easy Hide Admin Menu Items\n"
     5"Project-Id-Version: Easy Hide Admin Menu Items 1.4.0\n"
    66"POT-Creation-Date: 2024-03-07 07:45+0300\n"
    77"PO-Revision-Date: 2024-03-07 07:45+0300\n"
    … …  
    1111"Content-Type: text/plain; charset=UTF-8\n"
    1212"Content-Transfer-Encoding: 8bit\n"
     13"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
    1314"X-Generator: Poedit 2.0.7\n"
    1415"X-Poedit-Basepath: ..\n"
    1516"X-Poedit-Flags-xgettext: --add-comments=translators:\n"
    16 "X-Poedit-WPHeader: ehami.php\n"
    17 "X-Poedit-SourceCharset: UTF-8\n"
    18 "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
    19 "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
    20 "_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
     17"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
    2118"X-Poedit-SearchPath-0: .\n"
    2219"X-Poedit-SearchPathExcluded-0: *.js\n"
    23 
    24 #: src/Ajax.php:23 src/Ajax.php:40 src/Ajax.php:59 src/Ajax.php:79
    25 #: src/Ajax.php:98
     20"X-Poedit-SourceCharset: UTF-8\n"
     21"X-Poedit-WPHeader: ehami.php\n"
     22
     23#: src/Ajax.php:27 src/Ajax.php:44 src/Ajax.php:71 src/Ajax.php:91
     24#: src/Ajax.php:110 src/Ajax.php:132 src/Ajax.php:162 src/Ajax.php:184
     25#: src/Ajax.php:208
    2626msgid "Sorry, you are not allowed to manage options for this site."
    2727msgstr ""
    2828
    29 #: src/Assets.php:37 templates/switcher.php:26
     29#: src/Assets.php:34 templates/switcher.php:26
    3030msgid "No hidden menu items"
    3131msgstr ""
    3232
     33#: src/Assets.php:35
     34msgid "Hide menu"
     35msgstr ""
     36
    3337#: src/Assets.php:38
    34 msgid "Hide menu"
     38msgid "Settings saved."
     39msgstr ""
     40
     41#: src/Assets.php:39
     42msgid "Error saving settings."
    3543msgstr ""
    3644
    … …  
    4250#: src/Review.php:161
    4351#, php-format
    44 msgid "We are very pleased that you are using the %s plugin within a few days."
     52msgid ""
     53"We are very pleased that you are using the %s plugin within a few days."
    4554msgstr ""
    4655
    … …  
    97106msgstr ""
    98107
    99 #: templates/admin-page-options.php:23
     108#: templates/admin-page-options.php:24
    100109msgid "Uninstall plugin"
    101110msgstr ""
    102111
    103 #: templates/admin-page-options.php:27
     112#: templates/admin-page-options.php:28
    104113msgid "Allow the deletion of all plugin data after it is deleted"
    105114msgstr ""
    106115
    107 #: templates/admin-page-options.php:28
     116#: templates/admin-page-options.php:29
    108117msgid ""
    109118"If checked, all data (option and user metadata) will be deleted when the "
    … …  
    112121
    113122#: templates/admin-page-options.php:35
     123msgid "No changes (default)"
     124msgstr ""
     125
     126#: templates/admin-page-options.php:36
     127msgid "Hide all separators"
     128msgstr ""
     129
     130#: templates/admin-page-options.php:37
     131msgid "Highlight separators"
     132msgstr ""
     133
     134#: templates/admin-page-options.php:43
    114135msgid "Easy Hide Admin Menu Items Settings"
    115136msgstr ""
    116137
    117 #: templates/admin-page-options.php:44
     138#: templates/admin-page-options.php:52
    118139msgid "Main Settings"
    119140msgstr ""
    120141
    121 #: templates/admin-page-options.php:84
     142#: templates/admin-page-options.php:102 templates/admin-page-options.php:108
     143msgid "Menu Sorting"
     144msgstr ""
     145
     146#: templates/admin-page-options.php:119
     147msgid "Enable drag-and-drop menu reordering"
     148msgstr ""
     149
     150#: templates/admin-page-options.php:128
     151msgid "Drag the handle icon on the right side of menu items to reorder them."
     152msgstr ""
     153
     154#: templates/admin-page-options.php:131
     155msgid "Note:"
     156msgstr ""
     157
     158#: templates/admin-page-options.php:132
     159msgid ""
     160"your custom order is preserved even when this option is disabled. Use "
     161"\"Reset menu order\" to restore the default order."
     162msgstr ""
     163
     164#: templates/admin-page-options.php:135 templates/admin-page-options.php:179
     165#: templates/admin-page-options.php:224
     166msgid "Experimental"
     167msgstr ""
     168
     169#: templates/admin-page-options.php:138
     170msgid "Reset menu order"
     171msgstr ""
     172
     173#: templates/admin-page-options.php:150 templates/admin-page-options.php:156
     174msgid "Sidebar Width"
     175msgstr ""
     176
     177#: templates/admin-page-options.php:167
     178msgid "Enable sidebar width resize"
     179msgstr ""
     180
     181#: templates/admin-page-options.php:176
     182msgid "Drag the right edge of the sidebar to adjust the menu width."
     183msgstr ""
     184
     185#: templates/admin-page-options.php:182
     186msgid "Reset sidebar width"
     187msgstr ""
     188
     189#: templates/admin-page-options.php:194 templates/admin-page-options.php:200
     190msgid "Menu Separators"
     191msgstr ""
     192
     193#: templates/admin-page-options.php:221
     194msgid ""
     195"Control the visibility of separator lines between menu groups in the admin "
     196"sidebar."
     197msgstr ""
     198
     199#: templates/admin-page-options.php:234
    122200msgid "Save Settings"
    123201msgstr ""
    124202
    125 #: templates/admin-page-options.php:94
     203#: templates/admin-page-options.php:246
    126204msgid "Message From the Author"
    127205msgstr ""
    128206
    129 #: templates/admin-page-options.php:98
     207#: templates/admin-page-options.php:250
    130208msgid ""
    131209"Thank you for using Easy Hide Admin Menu Items! Your feedback and comments "
    132 "are highly valuable to us and will assist us in improving the plugin further."
    133 msgstr ""
    134 
    135 #: templates/admin-page-options.php:108
     210"are highly valuable to us and will assist us in improving the plugin "
     211"further."
     212msgstr ""
     213
     214#: templates/admin-page-options.php:260
    136215msgid ""
    137216"For support, please contact our helpdesk. If you encounter any issues or "
    … …  
    139218msgstr ""
    140219
    141 #: templates/admin-page-options.php:109
     220#: templates/admin-page-options.php:261
    142221msgid "contact us here"
    143222msgstr ""
    144223
    145 #: templates/admin-page-options.php:121
     224#: templates/admin-page-options.php:273
    146225msgid ""
    147226"Please consider leaving a review for our plugin. Your reviews help us "
    … …  
    149228msgstr ""
    150229
    151 #: templates/admin-page-options.php:123
     230#: templates/admin-page-options.php:275
    152231msgid "Leave a review"
    153232msgstr ""
  • easy-hide-admin-menu-items/tags/1.4.0/readme.txt

    r3474229 r3783089  
    55Requires at least: 5.9.0
    66Tested up to: 6.9
    7 Stable tag: 1.3.9
     7Stable tag: 1.4.0
    88Requires PHP: 7.0
    99License: GPLv2 or later
    … …  
    4040
    4141Enhance your WordPress admin panel experience by effortlessly managing menu items and optimizing the interface according to your specific needs. Experience a clutter-free and user-friendly environment with Easy Hide Admin Menu Items.
     42
     43### Experimental Features in 1.4.0
     44
     45These features are available under Appearance → Admin Menu Settings. They are marked as experimental and your feedback is welcome.
     46
     47* **Menu Sorting:** Drag-and-drop reordering of admin menu items. A handle icon appears on hover — grab it to move items up or down. Your custom order is saved per user or globally depending on your settings. Disabling this option preserves your saved order.
     48* **Menu Separators:** Control the visibility of separator lines between menu groups. Choose to hide them completely or highlight them for better visual separation.
     49* **Sidebar Width:** Resize the expanded desktop menu by dragging its edge or using the width slider. The standard folded and mobile layouts are preserved.
    4250
    4351== Frequently Asked Questions ==
    … …  
    7684== Screenshots ==
    7785
    78 1. Hide unnecessary main menus effortlessly with our plugin
    79 2. Activate child menu hiding
    80 3. Explore and customize your preferences with easy-to-use plugin settings
    81 4. Experience a user-friendly admin panel with our plugin's sleek design
     861. A cleaner WordPress admin menu with hidden entries available from the toolbar.
     872. Use the eye icon beside a main menu item to hide it.
     883. Hide a submenu entry without hiding its parent menu.
     894. Admin Menu Settings lets you switch between shared and personal preferences.
     905. Experimental sorting lets you reorder menu items by dragging their handles.
     916. Experimental sidebar resizing saves the width of the expanded desktop menu.
     927. Experimental separator controls highlight or hide the boundaries between menu groups.
    8293
    8394== Changelog ==
     95
     96= 1.4.0 =
     97- Added experimental drag-and-drop sorting for the WordPress admin menu.
     98- Added experimental sidebar resizing for the expanded desktop menu.
     99- Added experimental controls to hide or highlight menu separators.
     100- Added Slovak localization and updated Russian translations.
     101- Restricted shared menu changes to users with the manage_options capability.
     102- Kept personal menu visibility, order, and width separate between users.
     103- Fixed saved sidebar widths overriding the folded and mobile layouts.
     104- Aligned the icons in the review notice buttons.
     105- Updated the WordPress.org gallery with seven screenshots.
     106- Restored PHP 7.0 compatibility and corrected the review AJAX callbacks.
    84107
    85108= 1.3.9 =
  • easy-hide-admin-menu-items/tags/1.4.0/src/Ajax.php

    r3474229 r3783089  
    1313                add_action( 'wp_ajax_ehami_remove_item', [ $this, 'action_remove_item_from_db' ] );
    1414                add_action( 'wp_ajax_ehami_hide_icons_disable', [ $this, 'action_hide_icons_disable' ] );
     15                add_action( 'wp_ajax_ehami_save_menu_order', [ $this, 'action_save_menu_order' ] );
     16                add_action( 'wp_ajax_ehami_reset_menu_order', [ $this, 'action_reset_menu_order' ] );
     17                add_action( 'wp_ajax_ehami_save_sidebar_width', [ $this, 'action_save_sidebar_width' ] );
     18                add_action( 'wp_ajax_ehami_reset_sidebar_width', [ $this, 'action_reset_sidebar_width' ] );
    1519        }
    1620
    … …  
    1923                check_ajax_referer( self::NONCE_KEY );
    2024
    21                 if ( ! current_user_can( 'read' ) ) {
    22                         wp_die(
    23                                 esc_html__( 'Sorry, you are not allowed to manage options for this site.' ),
     25                if ( ! current_user_can( plugin()->settings->save_individually ? 'read' : 'manage_options' ) ) {
     26                        wp_die(
     27                                esc_html__( 'Sorry, you are not allowed to manage options for this site.', 'ehami' ),
    2428                                403
    2529                        );
    … …  
    3842                if ( ! current_user_can( 'manage_options' ) ) {
    3943                        wp_die(
    40                                 esc_html__( 'Sorry, you are not allowed to manage options for this site.' ),
    41                                 403
    42                         );
    43                 }
    44 
    45                 plugin()->settings->save_options( [
     44                                esc_html__( 'Sorry, you are not allowed to manage options for this site.', 'ehami' ),
     45                                403
     46                        );
     47                }
     48
     49                $options = [
    4650                        'save_individually'            => (bool) sanitize_text_field( wp_unslash( $_POST['options']['save_individually'] ?? false ) ),
    4751                        'hide_submenu'                 => (bool) sanitize_text_field( wp_unslash( $_POST['options']['hide_submenu'] ?? false ) ),
    4852                        'remove_all_data_on_uninstall' => (bool) sanitize_text_field( wp_unslash( $_POST['options']['remove_all_data_on_uninstall'] ?? false ) ),
    49                 ] );
     53                        'enable_menu_sorting'          => (bool) sanitize_text_field( wp_unslash( $_POST['options']['enable_menu_sorting'] ?? false ) ),
     54                        'enable_sidebar_resize'        => (bool) sanitize_text_field( wp_unslash( $_POST['options']['enable_sidebar_resize'] ?? false ) ),
     55                ];
     56
     57                if ( isset( $_POST['options']['separators_mode'] ) ) {
     58                        $options['separators_mode'] = sanitize_text_field( wp_unslash( $_POST['options']['separators_mode'] ) );
     59                }
     60
     61                plugin()->settings->save_options( $options );
    5062
    5163                wp_die();
    … …  
    5567                check_ajax_referer( self::NONCE_KEY );
    5668
    57                 if ( ! current_user_can( 'read' ) ) {
    58                         wp_die(
    59                                 esc_html__( 'Sorry, you are not allowed to manage options for this site.' ),
     69                if ( ! current_user_can( plugin()->settings->save_individually ? 'read' : 'manage_options' ) ) {
     70                        wp_die(
     71                                esc_html__( 'Sorry, you are not allowed to manage options for this site.', 'ehami' ),
    6072                                403
    6173                        );
    … …  
    7587                check_ajax_referer( self::NONCE_KEY );
    7688
    77                 if ( ! current_user_can( 'read' ) ) {
    78                         wp_die(
    79                                 esc_html__( 'Sorry, you are not allowed to manage options for this site.' ),
     89                if ( ! current_user_can( plugin()->settings->save_individually ? 'read' : 'manage_options' ) ) {
     90                        wp_die(
     91                                esc_html__( 'Sorry, you are not allowed to manage options for this site.', 'ehami' ),
    8092                                403
    8193                        );
    … …  
    94106                check_ajax_referer( self::NONCE_KEY );
    95107
    96                 if ( ! current_user_can( 'read' ) ) {
    97                         wp_die(
    98                                 esc_html__( 'Sorry, you are not allowed to manage options for this site.' ),
    99                                 403
    100                         );
    101                 }
    102 
    103                 plugin()->settings->save_options( [
    104                         'hide_icons_disable' => (bool) sanitize_text_field( wp_unslash( $_POST['options']['hide_icons_disable'] ?? false ) )
    105                 ] );
    106 
    107                 wp_die();
    108         }
    109 
     108                if ( ! current_user_can( plugin()->settings->save_individually ? 'read' : 'manage_options' ) ) {
     109                        wp_die(
     110                                esc_html__( 'Sorry, you are not allowed to manage options for this site.', 'ehami' ),
     111                                403
     112                        );
     113                }
     114
     115                plugin()->settings->save_options( [
     116                        'hide_icons_disable' => (bool) sanitize_text_field( wp_unslash( $_POST['options']['hide_icons_disable'] ?? false ) ),
     117                ] );
     118
     119                wp_die();
     120        }
     121
     122        /**
     123         * Save menu order via AJAX (called on drag-and-drop end).
     124         *
     125         * @since 1.4.0
     126         */
     127        public function action_save_menu_order() {
     128                check_ajax_referer( self::NONCE_KEY );
     129
     130                if ( ! current_user_can( plugin()->settings->save_individually ? 'read' : 'manage_options' ) ) {
     131                        wp_die(
     132                                esc_html__( 'Sorry, you are not allowed to manage options for this site.', 'ehami' ),
     133                                403
     134                        );
     135                }
     136
     137                // Each selector and position is sanitized separately below.
     138                $order = isset( $_POST['order'] ) && is_array( $_POST['order'] ) ? wp_unslash( $_POST['order'] ) : []; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
     139
     140                $sanitized = [];
     141                foreach ( $order as $selector => $position ) {
     142                        $sanitized[ sanitize_text_field( $selector ) ] = absint( $position );
     143                }
     144
     145                plugin()->settings->save_options( [
     146                        'menu_order' => $sanitized,
     147                ] );
     148
     149                wp_die();
     150        }
     151
     152        /**
     153         * Reset menu order to default (called from settings page).
     154         *
     155         * @since 1.4.0
     156         */
     157        public function action_reset_menu_order() {
     158                check_ajax_referer( self::NONCE_KEY );
     159
     160                if ( ! current_user_can( plugin()->settings->save_individually ? 'read' : 'manage_options' ) ) {
     161                        wp_die(
     162                                esc_html__( 'Sorry, you are not allowed to manage options for this site.', 'ehami' ),
     163                                403
     164                        );
     165                }
     166
     167                plugin()->settings->save_options( [
     168                        'menu_order' => [],
     169                ] );
     170
     171                wp_send_json_success();
     172        }
     173
     174        /**
     175         * Save sidebar width via AJAX (called on resize end or range change).
     176         *
     177         * @since 1.4.0
     178         */
     179        public function action_save_sidebar_width() {
     180                check_ajax_referer( self::NONCE_KEY );
     181
     182                if ( ! current_user_can( plugin()->settings->save_individually ? 'read' : 'manage_options' ) ) {
     183                        wp_die(
     184                                esc_html__( 'Sorry, you are not allowed to manage options for this site.', 'ehami' ),
     185                                403
     186                        );
     187                }
     188
     189                $width = isset( $_POST['width'] ) ? absint( $_POST['width'] ) : 0;
     190
     191                plugin()->settings->save_options( [
     192                        'sidebar_width' => $width,
     193                ] );
     194
     195                wp_die();
     196        }
     197
     198        /**
     199         * Reset sidebar width to default (called from settings page).
     200         *
     201         * @since 1.4.0
     202         */
     203        public function action_reset_sidebar_width() {
     204                check_ajax_referer( self::NONCE_KEY );
     205
     206                if ( ! current_user_can( plugin()->settings->save_individually ? 'read' : 'manage_options' ) ) {
     207                        wp_die(
     208                                esc_html__( 'Sorry, you are not allowed to manage options for this site.', 'ehami' ),
     209                                403
     210                        );
     211                }
     212
     213                plugin()->settings->save_options( [
     214                        'sidebar_width' => 0,
     215                ] );
     216
     217                wp_send_json_success();
     218        }
    110219}
  • easy-hide-admin-menu-items/tags/1.4.0/src/Assets.php

    r3474229 r3783089  
    1010
    1111        public function enqueue_assets() {
    12                 wp_enqueue_style( 'ehami-style', plugin()->url . '/assets/css/style.css', [], plugin()->info['version'] );
     12                $version = plugin()->info['version'];
     13                $url     = plugin()->url;
     14
     15                wp_enqueue_style( 'ehami-style', $url . '/assets/css/style.css', [], $version );
    1316                $this->add_inline_style( 'ehami-style' );
    1417
    15                 /**
    16                  * Load the user interface script only if the 'save_individually' option is set to true in the global settings,
    17                  * or if the current user is an administrator.
    18                  */
    19                 if ( true === plugin()->settings->save_individually || current_user_can( 'administrator' ) ) {
     18                // SortableJS — loaded separately because it's a vendor library.
     19                wp_enqueue_script( 'sortablejs', $url . '/assets/js/vendor/Sortable.min.js', [], '1.15.7', true );
    2020
    21                         wp_enqueue_script(
    22                                 'ehami-user-interface',
    23                                 plugin()->url . '/assets/js/user-interface.js',
    24                                 [
    25                                         'jquery',
    26                                         'jquery-effects-transfer',
    27                                 ],
    28                                 plugin()->info['version'],
    29                                 true
    30                         );
     21                // Main script — all EHAMI modules in one file.
     22                wp_enqueue_script( 'ehami', $url . '/assets/js/ehami.js', [ 'sortablejs' ], $version, true );
     23                wp_add_inline_script( 'ehami', 'var ehami = ' . wp_json_encode( $this->get_script_data() ), 'before' );
     24        }
    3125
    32                 }
    33 
    34                 wp_enqueue_script( 'ehami-settings-page', plugin()->url . '/assets/js/settings-page.js', [ 'jquery' ], plugin()->info['version'], true );
    35                 $data = [
    36                         'nonce'        => wp_create_nonce( 'ehami-nonce' ),
    37                         'no_items'     => __( 'No hidden menu items', 'ehami' ),
    38                         'hid'          => __( 'Hide menu', 'ehami' ),
    39                         'count_items'  => count( plugin()->settings->items ),
    40                         'hide_submenu' => plugin()->settings->hide_submenu,
     26        /**
     27         * Build the data object passed to all JS modules via the `ehami` global.
     28         *
     29         * @return array
     30         */
     31        private function get_script_data(): array {
     32                return [
     33                        'nonce'                 => wp_create_nonce( 'ehami-nonce' ),
     34                        'no_items'              => __( 'No hidden menu items', 'ehami' ),
     35                        'hid'                   => __( 'Hide menu', 'ehami' ),
     36                        'count_items'           => count( plugin()->settings->items ),
     37                        'hide_submenu'          => plugin()->settings->hide_submenu,
     38                        'saved'                 => __( 'Settings saved.', 'ehami' ),
     39                        'save_error'            => __( 'Error saving settings.', 'ehami' ),
     40                        'enable_menu_sorting'   => plugin()->settings->enable_menu_sorting,
     41                        'can_customize'         => plugin()->settings->save_individually || current_user_can( 'manage_options' ),
     42                        'menu_order'            => plugin()->settings->menu_order,
     43                        'enable_sidebar_resize' => plugin()->settings->enable_sidebar_resize,
     44                        'sidebar_width'         => plugin()->settings->sidebar_width,
     45                        'video_url'             => plugin()->url . '/assets/mp4/',
    4146                ];
    42                 wp_add_inline_script( 'ehami-user-interface', 'const ehami = ' . wp_json_encode( $data ), 'before' );
    4347        }
    4448
    4549        public function add_inline_style( string $handle ) {
     50                $css = '';
     51
     52                // Hidden menu items.
    4653                $items = plugin()->settings->items;
    47 
    48                 if ( ! $items ) {
    49                         return;
     54                if ( $items ) {
     55                        foreach ( $items as $id => $text ) {
     56                                if ( strpos( $id, '.php' ) !== false ) {
     57                                        // for submenu items
     58                                        $css .= sprintf( '.ehami-enable #adminmenu .wp-submenu a[href="%s"] { display: none; }', esc_attr( $id ) );
     59                                } elseif ( strpos( $id, '#' ) !== false ) {
     60                                        // for parent menu items
     61                                        $css .= sprintf( '.ehami-enable #adminmenu %s { display: none; }', esc_attr( $id ) );
     62                                }
     63                        }
    5064                }
    5165
    52                 $css = '';
    53                 foreach ( $items as $id => $text ) {
    54                         if ( str_contains( $id, '.php' ) ) {
    55                                 // for submenu items
    56                                 $css .= sprintf( '.ehami-enable #adminmenu .wp-submenu a[href="%s"] { display: none; }', esc_attr( $id ) );
    57                         } elseif ( str_contains( $id, '#' ) ) {
    58                                 // for parent menu items
    59                                 $css .= sprintf( '.ehami-enable #adminmenu %s { display: none; }', esc_attr( $id ) );
    60                         }
     66                // Sidebar width override.
     67                // Apply only to the expanded desktop menu; WordPress folds it on narrower screens.
     68                $sidebar_width = plugin()->settings->sidebar_width;
     69                if ( plugin()->settings->enable_sidebar_resize && $sidebar_width > 0 ) {
     70                        $w = (int) $sidebar_width;
     71                        $css .= sprintf(
     72                                '@media (min-width: 961px) {' .
     73                                'body:not(.folded) #adminmenuwrap, body:not(.folded) #adminmenuback, body:not(.folded) #adminmenu { width: %1$dpx; }' .
     74                                'body:not(.folded) #wpcontent, body:not(.folded) #wpfooter { margin-left: %1$dpx; }' .
     75                                'body:not(.folded) #adminmenu .wp-not-current-submenu .wp-submenu { left: %1$dpx; }' .
     76                                'body:not(.folded) #adminmenu .wp-has-current-submenu .wp-submenu { width: 100%%; }' .
     77                                '}',
     78                                $w
     79                        );
    6180                }
    62                 wp_add_inline_style( $handle, $css );
     81
     82                // Separators mode.
     83                $separators_mode = plugin()->settings->separators_mode;
     84                if ( $separators_mode === 'hidden' ) {
     85                        $css .= '#adminmenu li.wp-menu-separator { display: none; }';
     86                } elseif ( $separators_mode === 'highlight' ) {
     87                        $css .= '#adminmenu li.wp-menu-separator { height: auto; margin: 0; }';
     88                        $css .= '#adminmenu li.wp-menu-separator > .separator { height: 2px; margin: 8px 12px; background: rgba(255,255,255,0.08); border: none; }';
     89                }
     90
     91                if ( $css ) {
     92                        wp_add_inline_style( $handle, $css );
     93                }
    6394        }
    64 
    6595}
  • easy-hide-admin-menu-items/tags/1.4.0/src/Review.php

    r3474229 r3783089  
    2121
    2222                // Check if the condition is met before adding hooks.
    23                 if ( is_array( $ehami_data_install ) && strtotime( gmdate( 'Y-m-d' ) ) >= strtotime( $ehami_data_install['date'] ) ) {
     23                if ( is_array( $ehami_data_install ) && isset( $ehami_data_install['date'] ) && strtotime( gmdate( 'Y-m-d' ) ) >= strtotime( $ehami_data_install['date'] ) ) {
    2424                        add_action( 'admin_head', [ $this, 'add_admin_inline_style' ] );
    2525                        add_action( 'admin_footer', [ $this, 'add_admin_footer_script' ] );
    … …  
    6161                                gap: 5px;
    6262                        }
     63
     64                        .wp-core-ui .button.ehami_review__link .dashicons {
     65                                line-height: 1;
     66                        }
    6367                </style>
    6468                <?php
    … …  
    147151
    148152                                        <img class="ehami_review__img"
    149                                              src="https://ps.w.org/easy-hide-admin-menu-items/assets/icon-128x128.png" alt="">
     153                                                src="https://ps.w.org/easy-hide-admin-menu-items/assets/icon-128x128.png" alt="">
    150154
    151155                                </div>
    … …  
    185189
    186190                                                <a id="ehami_leave_feedback" class="button button-primary ehami_review__link"
    187                                                    href="https://wordpress.org/support/plugin/easy-hide-admin-menu-items/reviews/#new-post"
    188                                                    target="_blank">
     191                                                        href="https://wordpress.org/support/plugin/easy-hide-admin-menu-items/reviews/#new-post"
     192                                                        target="_blank">
    189193
    190194                                                        <?php echo esc_html__( 'Leave feedback', 'ehami' ); ?>
    … …  
    233237        public function leave_feedback_ajax_callback() {
    234238                $this->review_ajax_callback( 'feedback_submitted', '+5 years' );
    235                 wp_die();
    236239        }
    237240
    … …  
    241244        public function remind_ajax_callback() {
    242245                $this->review_ajax_callback( 'remind_submitted', '+1 days' );
    243                 wp_die();
    244246        }
    245247
    … …  
    249251        public function already_ajax_callback() {
    250252                $this->review_ajax_callback( 'already_submitted', '+4 years' );
    251                 wp_die();
    252253        }
    253254}
  • easy-hide-admin-menu-items/tags/1.4.0/src/Settings.php

    r3474229 r3783089  
    44
    55/**
    6  * @property-read array $items
    7  * @property-read bool $status
    8  * @property-read bool $save_individually
    9  * @property-read bool $hide_submenu
    10  * @property-read bool $remove_all_data_on_uninstall
    11  * @property-read bool $hide_icons_disable
     6 * @property-read array  $items
     7 * @property-read bool   $status
     8 * @property-read bool   $save_individually
     9 * @property-read bool   $hide_submenu
     10 * @property-read bool   $remove_all_data_on_uninstall
     11 * @property-read bool   $hide_icons_disable
     12 * @property-read string $separators_mode
     13 * @property-read bool   $enable_menu_sorting
     14 * @property-read array  $menu_order
     15 * @property-read bool   $enable_sidebar_resize
     16 * @property-read int    $sidebar_width
    1217 */
    1318class Settings {
    … …  
    2328                'remove_all_data_on_uninstall' => false,
    2429                'hide_icons_disable'           => false,
     30                // Experimental features.
     31                'enable_menu_sorting'          => false,
     32                'menu_order'                   => [],
     33                'separators_mode'              => 'default',
     34                'enable_sidebar_resize'        => false,
     35                'sidebar_width'                => 0,
    2536        ];
    2637
    … …  
    3849
    3950                if ( $this->options['save_individually'] ) {
     51                        if ( metadata_exists( 'user', get_current_user_id(), 'ehami_user_status' ) ) {
     52                                $this->options['status'] = (bool) get_user_meta( get_current_user_id(), 'ehami_user_status', true );
     53                        }
    4054                        $this->options['items']              = get_user_meta( get_current_user_id(), self::USER_ITEMS_META_KEY, true ) ?: [];
    4155                        $this->options['hide_icons_disable'] = get_user_meta( get_current_user_id(), 'hide_icons_disable', true ) ?: false;
     56                        $this->options['menu_order']         = get_user_meta( get_current_user_id(), 'ehami_user_menu_order', true ) ?: [];
     57                        $this->options['sidebar_width']      = (int) get_user_meta( get_current_user_id(), 'ehami_sidebar_width', true );
    4258                }
    4359        }
    … …  
    5066                $options = $this->sanitize_options( $new_options );
    5167
    52                 update_option( self::OPTION_NAME, $options, false );
     68                if ( $options['save_individually'] ) {
     69                        $global_options = array_merge( self::DEFAULT_OPTIONS, $this->get_db_options() );
     70                        $personal_keys  = [
     71                                'status'             => 'ehami_user_status',
     72                                'items'              => self::USER_ITEMS_META_KEY,
     73                                'hide_icons_disable' => 'hide_icons_disable',
     74                                'menu_order'         => 'ehami_user_menu_order',
     75                                'sidebar_width'      => 'ehami_sidebar_width',
     76                        ];
    5377
    54                 if ( $options['save_individually'] && array_key_exists( 'hide_icons_disable', $options ) ) {
    55                         update_user_meta( get_current_user_id(), 'hide_icons_disable', $options['hide_icons_disable'] );
     78                        foreach ( $personal_keys as $key => $meta_key ) {
     79                                if ( isset( $new_options[ $key ] ) && ( ! is_array( self::DEFAULT_OPTIONS[ $key ] ) || is_array( $new_options[ $key ] ) ) ) {
     80                                        $value = $key === 'items' ? wp_slash( $options[ $key ] ) : $options[ $key ];
     81                                        update_user_meta( get_current_user_id(), $meta_key, $value );
     82                                }
     83
     84                                $options[ $key ] = $global_options[ $key ];
     85                        }
    5686                }
    5787
    58                 if ( $options['save_individually'] && array_key_exists( 'items', $options ) ) {
    59                         update_user_meta( get_current_user_id(), self::USER_ITEMS_META_KEY, wp_slash( $options['items'] ) );
    60                 }
    61 
     88                update_option( self::OPTION_NAME, $options, false );
    6289        }
    6390
    … …  
    87114                if ( isset( $new_options['items'] ) && is_array( $new_options['items'] ) ) {
    88115                        $options['items'] = array_map( 'sanitize_text_field', $new_options['items'] );
     116                }
     117
     118                if ( isset( $new_options['enable_menu_sorting'] ) ) {
     119                        $options['enable_menu_sorting'] = (bool) $new_options['enable_menu_sorting'];
     120                }
     121
     122                if ( isset( $new_options['menu_order'] ) && is_array( $new_options['menu_order'] ) ) {
     123                        $sanitized_order = [];
     124                        foreach ( $new_options['menu_order'] as $selector => $position ) {
     125                                $sanitized_order[ sanitize_text_field( $selector ) ] = absint( $position );
     126                        }
     127                        $options['menu_order'] = $sanitized_order;
     128                }
     129
     130                if ( isset( $new_options['separators_mode'] ) ) {
     131                        $allowed_modes = [ 'default', 'hidden', 'highlight' ];
     132                        $mode          = sanitize_text_field( $new_options['separators_mode'] );
     133                        $options['separators_mode'] = in_array( $mode, $allowed_modes, true ) ? $mode : 'default';
     134                }
     135
     136                if ( isset( $new_options['enable_sidebar_resize'] ) ) {
     137                        $options['enable_sidebar_resize'] = (bool) $new_options['enable_sidebar_resize'];
     138                }
     139
     140                if ( isset( $new_options['sidebar_width'] ) ) {
     141                        $width = absint( $new_options['sidebar_width'] );
     142                        // Clamp to valid range: 0 (default/unset), or 160–480.
     143                        if ( $width > 0 ) {
     144                                $width = max( 160, min( 480, $width ) );
     145                        }
     146                        $options['sidebar_width'] = $width;
    89147                }
    90148
    … …  
    119177                return ! is_null( $this->{$name} );
    120178        }
    121 
    122179}
  • easy-hide-admin-menu-items/tags/1.4.0/src/Settings_Page.php

    r3474229 r3783089  
    4141                return $actions;
    4242        }
    43 
    4443}
  • easy-hide-admin-menu-items/tags/1.4.0/src/Switcher.php

    r3474229 r3783089  
    1313                 * If the condition is met, or if the current user is an administrator, initialize the user interface.
    1414                 */
    15                 if ( true === plugin()->settings->save_individually || current_user_can( 'administrator' ) ) {
     15                if ( plugin()->settings->save_individually || current_user_can( 'manage_options' ) ) {
    1616                        add_action( 'admin_bar_menu', [ $this, 'add_to_admin_bar' ] );
    1717                }
    … …  
    3939                return plugin()->settings->status ? $classes . ' ehami-enable' : $classes;
    4040        }
    41 
    4241}
  • easy-hide-admin-menu-items/tags/1.4.0/src/Uninstall.php

    r3474229 r3783089  
    4343
    4444        private function delete_users_options( $blog_id ) {
    45                 $meta_key = $this->settings::USER_ITEMS_META_KEY;
     45                $meta_keys = [
     46                        $this->settings::USER_ITEMS_META_KEY,
     47                        'hide_icons_disable',
     48                        'ehami_user_status',
     49                        'ehami_user_menu_order',
     50                        'ehami_sidebar_width',
     51                ];
    4652
    47                 $user_ids = get_users(
    48                         [
    49                                 'blog_id'      => $blog_id,
    50                                 'fields'       => 'ID',
    51                                 'meta_key'     => $meta_key, // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key
    52                                 'meta_compare' => 'EXISTS',
    53                         ]
    54                 );
     53                foreach ( $meta_keys as $meta_key ) {
     54                        $user_ids = get_users(
     55                                [
     56                                        'blog_id'      => $blog_id,
     57                                        'fields'       => 'ID',
     58                                        'meta_key'     => $meta_key, // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key
     59                                        'meta_compare' => 'EXISTS',
     60                                ]
     61                        );
    5562
    56                 foreach ( $user_ids as $user_id ) {
    57                         delete_user_meta( $user_id, $meta_key );
     63                        foreach ( $user_ids as $user_id ) {
     64                                delete_user_meta( $user_id, $meta_key );
     65                        }
    5866                }
    5967        }
  • easy-hide-admin-menu-items/tags/1.4.0/templates/admin-page-options.php

    r3474229 r3783089  
    1919                'description' => __( 'Allow hiding child admin menus', 'ehami' ),
    2020                'help'        => __( 'If checked, you can hide the child menu. This may be useful when there are too many child menus causing distraction.', 'ehami' ),
     21                'video'       => 'child-menu',
    2122        ],
    2223        [
    … …  
    2829                'help'        => __( 'If checked, all data (option and user metadata) will be deleted when the plugin is deleted.', 'ehami' ),
    2930        ],
     31];
     32
     33$current_separators_mode = plugin()->settings->separators_mode;
     34$separators_options      = [
     35        'default'   => __( 'No changes (default)', 'ehami' ),
     36        'hidden'    => __( 'Hide all separators', 'ehami' ),
     37        'highlight' => __( 'Highlight separators', 'ehami' ),
    3038];
    3139?>
    … …  
    7078                                                                                                <?php echo esc_html( $field['description'] ); ?>
    7179                                                                                        </label>
     80                                                                                        <?php if ( ! empty( $field['video'] ) ) : ?>
     81                                                                                                <span class="ehami-video-hint" data-video="<?php echo esc_attr( $field['video'] ); ?>">
     82                                                                                                        <span class="dashicons dashicons-video-alt3"></span>
     83                                                                                                </span>
     84                                                                                        <?php endif; ?>
    7285                                                                                </div>
    7386
    … …  
    7992                                                        </tr>
    8093                                                <?php } ?>
     94
     95                                        <!-- Experimental: Menu Sorting -->
     96                                        <tr class="ehami-settings__separator-row">
     97                                                <td colspan="2"><hr></td>
     98                                        </tr>
     99                                        <tr>
     100                                                <th scope="row">
     101                                                        <label for="ehami_enable_menu_sorting">
     102                                                                <?php esc_html_e( 'Menu Sorting', 'ehami' ); ?>
     103                                                        </label>
     104                                                </th>
     105                                                <td>
     106                                                        <fieldset class="ehami-settings__main-fieldset">
     107                                                                <legend class="screen-reader-text">
     108                                                                        <span><?php esc_html_e( 'Menu Sorting', 'ehami' ); ?></span>
     109                                                                </legend>
     110
     111                                                                <div class="ehami-settings__main-field">
     112                                                                        <label for="ehami_enable_menu_sorting">
     113                                                                                <input
     114                                                                                                type="checkbox"
     115                                                                                                id="ehami_enable_menu_sorting"
     116                                                                                                name="enable_menu_sorting"
     117                                                                                                value="1" <?php checked( plugin()->settings->enable_menu_sorting, true ); ?>
     118                                                                                >
     119                                                                                <?php esc_html_e( 'Enable drag-and-drop menu reordering', 'ehami' ); ?>
     120                                                                        </label>
     121                                                                        <span class="ehami-video-hint" data-video="menu-sorting">
     122                                                                                <span class="dashicons dashicons-video-alt3"></span>
     123                                                                        </span>
     124                                                                </div>
     125
     126                                                                <div class="ehami-settings__main-field-description">
     127                                                                        <p class="description">
     128                                                                                <?php esc_html_e( 'Drag the handle icon on the right side of menu items to reorder them.', 'ehami' ); ?>
     129                                                                        </p>
     130                                                                        <p class="description">
     131                                                                                <strong><?php esc_html_e( 'Note:', 'ehami' ); ?></strong>
     132                                                                                <?php esc_html_e( 'your custom order is preserved even when this option is disabled. Use "Reset menu order" to restore the default order.', 'ehami' ); ?>
     133                                                                        </p>
     134                                                                        <p class="ehami-settings__experimental-badge">
     135                                                                                <span class="ehami-badge ehami-badge--experimental"><?php esc_html_e( 'Experimental', 'ehami' ); ?></span>
     136                                                                                <a href="#" id="ehami-reset-menu-order" class="ehami-reset-link">
     137                                                                                        <span class="dashicons dashicons-image-rotate"></span>
     138                                                                                        <?php esc_html_e( 'Reset menu order', 'ehami' ); ?>
     139                                                                                </a>
     140                                                                        </p>
     141                                                                </div>
     142                                                        </fieldset>
     143                                                </td>
     144                                        </tr>
     145
     146                                        <!-- Experimental: Sidebar Width -->
     147                                        <tr>
     148                                                <th scope="row">
     149                                                        <label for="ehami_enable_sidebar_resize">
     150                                                                <?php esc_html_e( 'Sidebar Width', 'ehami' ); ?>
     151                                                        </label>
     152                                                </th>
     153                                                <td>
     154                                                        <fieldset class="ehami-settings__main-fieldset">
     155                                                                <legend class="screen-reader-text">
     156                                                                        <span><?php esc_html_e( 'Sidebar Width', 'ehami' ); ?></span>
     157                                                                </legend>
     158
     159                                                                <div class="ehami-settings__main-field">
     160                                                                        <label for="ehami_enable_sidebar_resize">
     161                                                                                <input
     162                                                                                                type="checkbox"
     163                                                                                                id="ehami_enable_sidebar_resize"
     164                                                                                                name="enable_sidebar_resize"
     165                                                                                                value="1" <?php checked( plugin()->settings->enable_sidebar_resize, true ); ?>
     166                                                                                >
     167                                                                                <?php esc_html_e( 'Enable sidebar width resize', 'ehami' ); ?>
     168                                                                        </label>
     169                                                                        <span class="ehami-video-hint" data-video="sidebar-width">
     170                                                                                <span class="dashicons dashicons-video-alt3"></span>
     171                                                                        </span>
     172                                                                </div>
     173
     174                                                                <div class="ehami-settings__main-field-description">
     175                                                                        <p class="description">
     176                                                                                <?php esc_html_e( 'Drag the right edge of the sidebar to adjust the menu width.', 'ehami' ); ?>
     177                                                                        </p>
     178                                                                        <p class="ehami-settings__experimental-badge">
     179                                                                                <span class="ehami-badge ehami-badge--experimental"><?php esc_html_e( 'Experimental', 'ehami' ); ?></span>
     180                                                                                <a href="#" id="ehami-reset-sidebar-width" class="ehami-reset-link">
     181                                                                                        <span class="dashicons dashicons-image-rotate"></span>
     182                                                                                        <?php esc_html_e( 'Reset sidebar width', 'ehami' ); ?>
     183                                                                                </a>
     184                                                                        </p>
     185                                                                </div>
     186                                                        </fieldset>
     187                                                </td>
     188                                        </tr>
     189
     190                                        <!-- Experimental: Separators -->
     191                                        <tr>
     192                                                <th scope="row">
     193                                                        <label for="ehami_separators_mode">
     194                                                                <?php esc_html_e( 'Menu Separators', 'ehami' ); ?>
     195                                                        </label>
     196                                                </th>
     197                                                <td>
     198                                                        <fieldset class="ehami-settings__main-fieldset">
     199                                                                <legend class="screen-reader-text">
     200                                                                        <span><?php esc_html_e( 'Menu Separators', 'ehami' ); ?></span>
     201                                                                </legend>
     202
     203                                                                <div class="ehami-settings__main-field">
     204                                                                        <select id="ehami_separators_mode" name="separators_mode">
     205                                                                                <?php foreach ( $separators_options as $value => $label ) : ?>
     206                                                                                        <option
     207                                                                                                value="<?php echo esc_attr( $value ); ?>"
     208                                                                                                <?php selected( $current_separators_mode, $value ); ?>
     209                                                                                        >
     210                                                                                                <?php echo esc_html( $label ); ?>
     211                                                                                        </option>
     212                                                                                <?php endforeach; ?>
     213                                                                        </select>
     214                                                                        <span class="ehami-video-hint" data-video="separators">
     215                                                                                <span class="dashicons dashicons-video-alt3"></span>
     216                                                                        </span>
     217                                                                </div>
     218
     219                                                                <div class="ehami-settings__main-field-description">
     220                                                                        <p class="description">
     221                                                                                <?php esc_html_e( 'Control the visibility of separator lines between menu groups in the admin sidebar.', 'ehami' ); ?>
     222                                                                        </p>
     223                                                                        <p class="ehami-settings__experimental-badge">
     224                                                                                <span class="ehami-badge ehami-badge--experimental"><?php esc_html_e( 'Experimental', 'ehami' ); ?></span>
     225                                                                        </p>
     226                                                                </div>
     227                                                        </fieldset>
     228                                                </td>
     229                                        </tr>
    81230                                                </tbody>
    82231                                        </table>
    83232
    84                                         <?php submit_button( esc_html__( 'Save Settings', 'ehami' ), 'primary', 'submit_ehami_settings' ); ?>
     233                                        <div class="ehami-save-row">
     234                                                <?php submit_button( esc_html__( 'Save Settings', 'ehami' ), 'primary', 'submit_ehami_settings', false ); ?>
     235                                                <span class="ehami-inline-notice" aria-live="polite"></span>
     236                                        </div>
    85237                                </div>
    86238
    … …  
    90242                        </div>
    91243
    92                         <!-- Added a block for the author's message -->
     244                <!-- Added a block for the author's message -->
    93245                        <div id="ehami-author-info" class="stuffbox ehami-settings__author">
    94246                                <h2 class="ehami-settings__author-title"><?php esc_html_e( 'Message From the Author', 'ehami' ); ?></h2>
  • easy-hide-admin-menu-items/tags/1.4.0/templates/switcher.php

    r3474229 r3783089  
    3030                <div class="ehami-block-checkbox">
    3131                        <input type="checkbox"
    32                                id="hide-icons-checkbox"
    33                                name="hide_icons_disable"
     32                                        id="hide-icons-checkbox"
     33                                        name="hide_icons_disable"
    3434                                <?php echo $hide_icons_disable ? 'checked' : ''; ?>
    3535                        />
  • easy-hide-admin-menu-items/trunk/assets/css/style.css

    r3474229 r3783089  
    7272
    7373#wp-admin-bar-ehami-switch .switch__content {
    74     display: none;
    7574    position: absolute;
    7675    right: 0;
    … …  
    8685    overflow-x: hidden;
    8786    overflow-y: auto;
     87
     88    /* CSS-driven show/hide — replaces jQuery slideDown/slideUp. */
     89    visibility: hidden;
     90    opacity: 0;
     91    pointer-events: none;
     92    transition: opacity 0.2s ease, visibility 0.2s ease;
     93}
     94
     95#wp-admin-bar-ehami-switch .switch__content.--open {
     96    visibility: visible;
     97    opacity: 1;
     98    pointer-events: auto;
    8899}
    89100/* Mozilla Firefox */
    … …  
    167178#adminmenu .menu-top .ehami-remove-sub-li:hover {
    168179    transform: scale(1.2);
    169 }
    170 
    171 .ui-effects-transfer {
    172     border: 2px dotted #72aee6;
    173     background: #72aee6;
    174     z-index: 9999;
    175180}
    176181
    … …  
    234239}
    235240
     241/**
     242 * Inline save notice — shown near Save button and in the header.
     243 * No content jump: elements are always in the DOM, just hidden.
     244 *
     245 * @since 1.4.0
     246 */
     247
     248.ehami-save-row {
     249        display: flex;
     250        align-items: center;
     251        gap: 12px;
     252        margin: 1em 0;
     253}
     254
     255.ehami-save-row .submit {
     256        margin: 0;
     257        padding: 0;
     258}
     259
     260.ehami-inline-notice {
     261        display: inline-flex;
     262        align-items: center;
     263        gap: 4px;
     264        font-size: 13px;
     265        line-height: 1.4;
     266        opacity: 0;
     267        white-space: nowrap;
     268}
     269
     270.ehami-inline-notice .dashicons {
     271        font-size: 18px;
     272        width: 18px;
     273        height: 18px;
     274        line-height: 18px;
     275}
     276
     277.ehami-inline-notice.--success {
     278        color: #00a32a;
     279}
     280
     281.ehami-inline-notice.--error {
     282        color: #d63638;
     283}
     284
     285
    236286.ehami-settings-saving {
    237287    position: absolute;
    … …  
    290340}
    291341
    292 .admin-color-light .ui-effects-transfer {
    293     border: 2px dotted #04a4cc;
    294     background: #04a4cc;
    295 }
    296 
    297342/**
    298343 * Styles themes color .admin-color-modern
    … …  
    338383}
    339384
    340 .admin-color-modern .ui-effects-transfer {
    341     border: 2px dotted #33f078;
    342     background: #33f078;
    343 }
    344 
    345385/**
    346386 * Styles themes color .admin-color-blue
    … …  
    389429}
    390430
    391 .admin-color-blue .ui-effects-transfer {
    392     border: 2px dotted #4796b3;
    393     background: #4796b3;
    394 }
    395 
    396431/**
    397432 * Styles themes color .admin-color-coffee
    … …  
    440475}
    441476
    442 .admin-color-coffee .ui-effects-transfer {
    443     border: 2px dotted #59524c;
    444     background: #59524c;
    445 }
    446 
    447477/**
    448478 * Styles themes color .admin-color-ectoplasm
    … …  
    491521}
    492522
    493 .admin-color-ectoplasm .ui-effects-transfer {
    494     border: 2px dotted #523f6d;
    495     background: #523f6d;
    496 }
    497 
    498523/**
    499524 * Styles themes color .admin-color-midnight
    … …  
    542567}
    543568
    544 .admin-color-midnight .ui-effects-transfer {
    545     border: 2px dotted #363b3f;
    546     background: #363b3f;
    547 }
    548 
    549569/**
    550570 * Styles themes color .admin-color-ocean
    … …  
    593613}
    594614
    595 .admin-color-ocean .ui-effects-transfer {
    596     border: 2px dotted #738e96;
    597     background: #738e96;
    598 }
    599 
    600615/**
    601616 * Styles themes color .admin-color-sunrise
    … …  
    643658    border-left: 2px solid #f7e3d3;
    644659    background-color: #cf4944;
    645 }
    646 
    647 .admin-color-sunrise .ui-effects-transfer {
    648     border: 2px dotted #cf4944;
    649     background: #cf4944;
    650660}
    651661
    … …  
    677687    color: #eee;
    678688}
     689
     690/**
     691 * Experimental badge and separator row
     692 */
     693
     694.ehami-settings__experimental-badge {
     695    margin-top: 8px;
     696    display: flex;
     697    align-items: center;
     698    gap: 10px;
     699}
     700
     701.ehami-badge {
     702    display: inline-block;
     703    padding: 2px 8px;
     704    border-radius: 3px;
     705    font-size: 11px;
     706    font-weight: 600;
     707    line-height: 1.6;
     708    text-transform: uppercase;
     709}
     710
     711.ehami-badge--experimental {
     712    background: #fcf0c3;
     713    color: #6e4e00;
     714}
     715
     716.ehami-settings__separator-row td {
     717    padding: 0;
     718}
     719
     720.ehami-settings__separator-row hr {
     721        margin: 0;
     722        border: none;
     723        border-top: 1px solid #ccc;
     724}
     725
     726.ehami-settings__reset-order {
     727        margin-top: 6px;
     728}
     729
     730.ehami-reset-link {
     731        color: #b32d2e;
     732        text-decoration: none;
     733}
     734
     735.ehami-reset-link:hover {
     736        color: #a00;
     737}
     738
     739.ehami-reset-link .dashicons {
     740        font-size: 16px;
     741        width: 16px;
     742        height: 16px;
     743        vertical-align: text-bottom;
     744        margin-right: 2px;
     745}
     746
     747/**
     748 * Menu sorting — SortableJS + drag handle.
     749 * Handle icon appears on hover (right side), same animation as hide icon (left side).
     750 *
     751 * @since 1.4.0
     752 */
     753
     754/* Drag handle — hidden by default, slides in from right on hover.
     755   Matches WP .wp-menu-image dimensions: 36x34px. */
     756#adminmenu .menu-top .ehami-sort-handle {
     757        position: absolute;
     758        top: 0;
     759        right: -36px;
     760        width: 36px;
     761        height: 34px;
     762        line-height: 34px;
     763        text-align: center;
     764        padding: 0;
     765        color: #a7aaad;
     766        z-index: 9999;
     767        background-color: #2c3338;
     768        cursor: grab;
     769        font-size: 20px;
     770        transition: right 0.5s cubic-bezier(0.8, -0.2, 0.55, 1.3) 1s,
     771                    opacity 0.3s linear 1s;
     772        opacity: 0;
     773}
     774
     775#adminmenu .menu-top:hover .ehami-sort-handle {
     776        right: 0;
     777        opacity: 1;
     778}
     779
     780#adminmenu .menu-top .ehami-sort-handle:hover {
     781        color: #72aee6;
     782}
     783
     784/* Separator as drag handle — hover highlight + grab cursor. */
     785#adminmenu li.wp-menu-separator.ehami-sort-handle {
     786        cursor: grab;
     787        transition: background 0.2s ease;
     788}
     789
     790#adminmenu li.wp-menu-separator.ehami-sort-handle:hover {
     791        background: rgba(114, 174, 230, 0.2);
     792}
     793
     794#adminmenu li.wp-menu-separator.ehami-sort-handle:hover .separator {
     795        background: #72aee6;
     796        height: 2px;
     797}
     798
     799/**
     800 * Folded sidebar + mobile: reposition hide icon and sort handle
     801 * as a vertical dropdown below the menu item (36 x 34 px each).
     802 *
     803 * @since 1.4.0
     804 */
     805
     806/* Shared dropdown styles for both folded and mobile contexts.
     807   Applied via .folded prefix and duplicated inside @media (max-width: 782px)
     808   because mobile WP admin does not always add the .folded class. */
     809.folded #adminmenu .menu-top .ehami-remove-li,
     810.folded #adminmenu .menu-top .ehami-sort-handle {
     811        position: absolute;
     812        left: 0;
     813        right: auto;
     814        width: 36px;
     815        height: 34px;
     816        padding: 0;
     817        z-index: 10003;
     818        background-color: #2c3338;
     819        box-shadow: inset 4px 0 0 0 #2271b1;
     820        opacity: 0;
     821        pointer-events: none;
     822        transition: opacity 0.18s ease;
     823        font-size: 16px;
     824}
     825
     826.folded #adminmenu .menu-top .ehami-remove-li {
     827        top: 100%;
     828        display: flex;
     829        align-items: center;
     830        justify-content: center;
     831        transform: none;
     832}
     833
     834.folded #adminmenu .menu-top .ehami-sort-handle {
     835        top: calc(100% + 34px);
     836        line-height: 34px;
     837}
     838
     839.folded #adminmenu .menu-top:hover .ehami-remove-li,
     840.folded #adminmenu .menu-top:hover .ehami-sort-handle,
     841.folded #adminmenu .menu-top.opensub .ehami-remove-li,
     842.folded #adminmenu .menu-top.opensub .ehami-sort-handle {
     843        opacity: 1;
     844        pointer-events: auto;
     845}
     846
     847.folded #adminmenu .menu-top .ehami-remove-li:hover {
     848        background-color: #3c4349;
     849        transform: none;
     850}
     851
     852.folded #adminmenu .menu-top .ehami-sort-handle:hover {
     853        background-color: #3c4349;
     854        color: #72aee6;
     855}
     856
     857/* Mobile (< 782 px): identical dropdown layout. */
     858@media (max-width: 782px) {
     859        #adminmenu .menu-top .ehami-remove-li,
     860        #adminmenu .menu-top .ehami-sort-handle {
     861                position: absolute;
     862                left: 0;
     863                right: auto;
     864                width: 36px;
     865                height: 34px;
     866                padding: 0;
     867                z-index: 10003;
     868                background-color: #2c3338;
     869                box-shadow: inset 4px 0 0 0 #2271b1;
     870                opacity: 0;
     871                pointer-events: none;
     872                transition: opacity 0.18s ease;
     873                font-size: 16px;
     874        }
     875
     876        #adminmenu .menu-top .ehami-remove-li {
     877                top: 100%;
     878                display: flex;
     879                align-items: center;
     880                justify-content: center;
     881                transform: none;
     882        }
     883
     884        #adminmenu .menu-top .ehami-sort-handle {
     885                top: calc(100% + 34px);
     886                line-height: 34px;
     887        }
     888
     889        #adminmenu .menu-top:hover .ehami-remove-li,
     890        #adminmenu .menu-top:hover .ehami-sort-handle,
     891        #adminmenu .menu-top.opensub .ehami-remove-li,
     892        #adminmenu .menu-top.opensub .ehami-sort-handle {
     893                opacity: 1;
     894                pointer-events: auto;
     895        }
     896
     897        #adminmenu .menu-top .ehami-remove-li:hover {
     898                background-color: #3c4349;
     899                transform: none;
     900        }
     901
     902        #adminmenu .menu-top .ehami-sort-handle:hover {
     903                background-color: #3c4349;
     904                color: #72aee6;
     905        }
     906}
     907
     908/* Ghost: placeholder left in place — shows where the item will land. */
     909#adminmenu > li.menu-top.ehami-sortable-ghost {
     910        background: rgba(114, 174, 230, 0.12) !important;
     911        border: 2px dashed #72aee6;
     912        border-radius: 3px;
     913        height: 36px !important;
     914        min-height: 0 !important;
     915        overflow: hidden;
     916}
     917
     918#adminmenu > li.wp-menu-separator.ehami-sortable-ghost {
     919        background: rgba(114, 174, 230, 0.25) !important;
     920        border: 1px dashed #72aee6;
     921        border-radius: 2px;
     922        height: 6px !important;
     923}
     924
     925#adminmenu > li.ehami-sortable-ghost > * {
     926        visibility: hidden;
     927}
     928
     929#adminmenu > li.ehami-sortable-ghost .wp-submenu {
     930        display: none !important;
     931}
     932
     933/* Drag clone: the floating copy that follows the cursor.
     934   Background comes from CSS variable set by JS on drag start —
     935   automatically matches any admin color scheme. */
     936li.ehami-sortable-drag {
     937        background: var(--ehami-sidebar-bg, #1d2327) !important;
     938        opacity: 0.95 !important;
     939        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
     940        border-radius: 3px;
     941}
     942
     943li.ehami-sortable-drag .wp-submenu {
     944        display: none !important;
     945}
     946
     947/* Separator drag clone — visible bright line so user sees what they're dragging. */
     948li.wp-menu-separator.ehami-sortable-drag {
     949        background: transparent !important;
     950        box-shadow: none !important;
     951        height: auto !important;
     952        padding: 4px 0 !important;
     953}
     954
     955li.wp-menu-separator.ehami-sortable-drag .separator {
     956        height: 3px !important;
     957        background: #72aee6 !important;
     958        border-radius: 2px;
     959        margin: 0 8px;
     960}
     961
     962li.ehami-sortable-drag .ehami-sort-handle,
     963li.ehami-sortable-drag .ehami-remove-li {
     964        display: none !important;
     965}
     966
     967/* When "Don't display hide icons" is checked — disable all sorting interactions. */
     968.ehami-icons-hidden #adminmenu .menu-top .ehami-sort-handle {
     969        display: none !important;
     970}
     971
     972.ehami-icons-hidden #adminmenu li.wp-menu-separator.ehami-sort-handle {
     973        cursor: default;
     974        pointer-events: none;
     975}
     976
     977.ehami-icons-hidden #adminmenu li.wp-menu-separator.ehami-sort-handle:hover {
     978        background: transparent;
     979}
     980
     981.ehami-icons-hidden #adminmenu li.wp-menu-separator.ehami-sort-handle:hover .separator {
     982        background: inherit;
     983        height: inherit;
     984}
     985
     986/* Prevent text selection while dragging. */
     987.ehami-sorting-active {
     988        user-select: none !important;
     989        -webkit-user-select: none !important;
     990        cursor: grabbing !important;
     991}
     992
     993/* Admin color scheme support for drag handle. */
     994.admin-color-light #adminmenu .menu-top .ehami-sort-handle {
     995        background-color: #fff;
     996        color: #999;
     997}
     998
     999.admin-color-light #adminmenu .menu-top .ehami-sort-handle:hover {
     1000        color: #04a4cc;
     1001}
     1002
     1003.admin-color-modern #adminmenu .menu-top .ehami-sort-handle {
     1004        background-color: #0c0c0c;
     1005        color: #86888a;
     1006}
     1007
     1008.admin-color-modern #adminmenu .menu-top .ehami-sort-handle:hover {
     1009        color: #33f078;
     1010}
     1011
     1012/* Admin color scheme overrides for folded dropdown icons.
     1013   @since 1.4.0 */
     1014.admin-color-light.folded #adminmenu .menu-top .ehami-remove-li,
     1015.admin-color-light.folded #adminmenu .menu-top .ehami-sort-handle {
     1016        background-color: #f1f1f1;
     1017        box-shadow: inset 4px 0 0 0 #888;
     1018}
     1019
     1020.admin-color-modern.folded #adminmenu .menu-top .ehami-remove-li,
     1021.admin-color-modern.folded #adminmenu .menu-top .ehami-sort-handle {
     1022        background-color: #1e1e1e;
     1023        box-shadow: inset 4px 0 0 0 #3858e9;
     1024}
     1025
     1026.admin-color-blue.folded #adminmenu .menu-top .ehami-remove-li,
     1027.admin-color-blue.folded #adminmenu .menu-top .ehami-sort-handle {
     1028        background-color: #52accc;
     1029        box-shadow: inset 4px 0 0 0 #e2ecf1;
     1030}
     1031
     1032.admin-color-coffee.folded #adminmenu .menu-top .ehami-remove-li,
     1033.admin-color-coffee.folded #adminmenu .menu-top .ehami-sort-handle {
     1034        background-color: #46403c;
     1035        box-shadow: inset 4px 0 0 0 #c7a589;
     1036}
     1037
     1038.admin-color-ectoplasm.folded #adminmenu .menu-top .ehami-remove-li,
     1039.admin-color-ectoplasm.folded #adminmenu .menu-top .ehami-sort-handle {
     1040        background-color: #413256;
     1041        box-shadow: inset 4px 0 0 0 #a3b745;
     1042}
     1043
     1044.admin-color-midnight.folded #adminmenu .menu-top .ehami-remove-li,
     1045.admin-color-midnight.folded #adminmenu .menu-top .ehami-sort-handle {
     1046        background-color: #26292c;
     1047        box-shadow: inset 4px 0 0 0 #e14d43;
     1048}
     1049
     1050.admin-color-ocean.folded #adminmenu .menu-top .ehami-remove-li,
     1051.admin-color-ocean.folded #adminmenu .menu-top .ehami-sort-handle {
     1052        background-color: #627c83;
     1053        box-shadow: inset 4px 0 0 0 #9ebaa0;
     1054}
     1055
     1056.admin-color-sunrise.folded #adminmenu .menu-top .ehami-remove-li,
     1057.admin-color-sunrise.folded #adminmenu .menu-top .ehami-sort-handle {
     1058        background-color: #be3631;
     1059        box-shadow: inset 4px 0 0 0 #dd823b;
     1060}
     1061
     1062/**
     1063 * Sidebar resize — Notion/Outline-style drag handle.
     1064 *
     1065 * Invisible grab zone on the right edge of the sidebar.
     1066 * On hover a thin vertical line appears at the boundary.
     1067 * Drag left/right to resize. Release to save.
     1068 *
     1069 * @since 1.4.0
     1070 */
     1071
     1072/* Grab zone — fixed to viewport, stretches from admin bar to bottom of screen. */
     1073.ehami-resize-handle {
     1074        position: fixed;
     1075        top: 32px;
     1076        bottom: 0;
     1077        width: 2px;
     1078        cursor: col-resize;
     1079        z-index: 9999;
     1080}
     1081
     1082/* Keep the WP menu arrow (triangle) above the resize handle. */
     1083ul#adminmenu a.wp-has-current-submenu:after,
     1084ul#adminmenu > li.current > a.current:after {
     1085        z-index: 10000;
     1086}
     1087
     1088/* Vertical line — appears on hover/active.
     1089   Color is set via --ehami-resize-color CSS variable by JS (matches admin color scheme). */
     1090.ehami-resize-handle::after {
     1091        content: "";
     1092        position: absolute;
     1093        top: 0;
     1094        left: 50%;
     1095        transform: translateX(-50%);
     1096        width: 4px;
     1097        height: 100%;
     1098        background: transparent;
     1099        transition: background 0.15s ease;
     1100}
     1101
     1102.ehami-resize-handle:hover::after,
     1103.ehami-resize-handle.ehami-resize-active::after {
     1104        background: var(--ehami-resize-color, #2271b1);
     1105}
     1106
     1107/* Prevent text selection and pointer events during resize. */
     1108.ehami-resizing {
     1109        user-select: none !important;
     1110        -webkit-user-select: none !important;
     1111        cursor: col-resize !important;
     1112}
     1113
     1114.ehami-resizing iframe {
     1115        pointer-events: none;
     1116}
     1117
     1118/* Hide resize handle when menu is folded or on mobile. */
     1119.folded .ehami-resize-handle {
     1120        display: none;
     1121}
     1122
     1123@media (max-width: 960px) {
     1124        .auto-fold .ehami-resize-handle {
     1125                display: none;
     1126        }
     1127}
     1128
     1129@media (max-width: 782px) {
     1130        .ehami-resize-handle {
     1131                display: none;
     1132        }
     1133}
     1134
     1135/**
     1136 * Video tooltip — play icon next to settings labels.
     1137 * On hover shows a small popup with auto-playing video.
     1138 *
     1139 * @since 1.5.0
     1140 */
     1141
     1142.ehami-video-hint {
     1143        display: inline-block;
     1144        position: relative;
     1145        vertical-align: middle;
     1146        margin-left: 4px;
     1147        cursor: pointer;
     1148}
     1149
     1150.ehami-video-hint .dashicons {
     1151        font-size: 16px;
     1152        width: 16px;
     1153        height: 16px;
     1154        line-height: 16px;
     1155        color: #a7aaad;
     1156        transition: color 0.15s ease;
     1157}
     1158
     1159.ehami-video-hint:hover .dashicons {
     1160        color: #2271b1;
     1161}
     1162
     1163/* Tooltip container — anchored to the icon, appears on hover. */
     1164.ehami-video-tooltip {
     1165        position: absolute;
     1166        left: 50%;
     1167        bottom: calc(100% + 8px);
     1168        transform: translateX(-50%);
     1169        width: 400px;
     1170        background: #1d2327;
     1171        border-radius: 6px;
     1172        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
     1173        overflow: hidden;
     1174        z-index: 100001;
     1175        opacity: 0;
     1176        visibility: hidden;
     1177        transition: opacity 0.2s ease, visibility 0.2s ease;
     1178        pointer-events: none;
     1179}
     1180
     1181.ehami-video-hint:hover .ehami-video-tooltip {
     1182        opacity: 1;
     1183        visibility: visible;
     1184        pointer-events: auto;
     1185}
     1186
     1187/* Arrow pointing down from the tooltip. */
     1188.ehami-video-tooltip::after {
     1189        content: "";
     1190        position: absolute;
     1191        left: 50%;
     1192        bottom: -6px;
     1193        transform: translateX(-50%);
     1194        border-left: 6px solid transparent;
     1195        border-right: 6px solid transparent;
     1196        border-top: 6px solid #1d2327;
     1197}
     1198
     1199/* Video element inside the tooltip. */
     1200.ehami-video-tooltip video {
     1201        display: block;
     1202        width: 100%;
     1203        height: auto;
     1204        border-radius: 6px;
     1205}
     1206
     1207/* Spinner — shown while video is loading. */
     1208.ehami-video-tooltip .ehami-video-spinner {
     1209        position: absolute;
     1210        top: 50%;
     1211        left: 50%;
     1212        transform: translate(-50%, -50%);
     1213        width: 24px;
     1214        height: 24px;
     1215        border: 3px solid rgba(255, 255, 255, 0.2);
     1216        border-top-color: #fff;
     1217        border-radius: 50%;
     1218        animation: ehami-spin 0.6s linear infinite;
     1219}
     1220
     1221.ehami-video-tooltip .ehami-video-spinner.--hidden {
     1222        display: none;
     1223}
     1224
     1225@keyframes ehami-spin {
     1226        to { transform: translate(-50%, -50%) rotate(360deg); }
     1227}
     1228
     1229/**
     1230 * Fly-to-bar animation — menu item clone flies toward the admin bar toggle.
     1231 *
     1232 * @since 1.5.0
     1233 */
     1234
     1235/* Transfer outline — visible dashed border that flies from sidebar to admin bar. */
     1236.ehami-fly-clone {
     1237        position: fixed;
     1238        z-index: 100000;
     1239        pointer-events: none;
     1240        border: 2px dashed #72aee6;
     1241        border-radius: 3px;
     1242        background: rgba(114, 174, 230, 0.08);
     1243}
     1244
     1245.ehami-fly-clone.--animating {
     1246        transition: left 0.5s cubic-bezier(0.4, 0, 0.2, 1),
     1247                    top 0.5s cubic-bezier(0.4, 0, 0.2, 1),
     1248                    width 0.5s cubic-bezier(0.4, 0, 0.2, 1),
     1249                    height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
     1250}
  • easy-hide-admin-menu-items/trunk/autoload.php

    r3474229 r3783089  
    77
    88spl_autoload_register(
    9         static function ( $class ) {
    10                 if ( strpos( $class, __NAMESPACE__ . '\\' ) !== 0 ) {
     9        static function ( $class_name ) {
     10                if ( strpos( $class_name, __NAMESPACE__ . '\\' ) !== 0 ) {
    1111                        return;
    1212                }
    1313
    14                 $path = str_replace( [ __NAMESPACE__, '\\' ], [ __DIR__ . '/src', '/' ], $class );
     14                $path = str_replace( [ __NAMESPACE__, '\\' ], [ __DIR__ . '/src', '/' ], $class_name );
    1515
    1616                require_once "$path.php";
  • easy-hide-admin-menu-items/trunk/ehami.php

    r3474229 r3783089  
    66 * Domain Path: /languages
    77 * Description: The plugin allows hiding selected admin menu items.
    8  * Version: 1.3.9
     8 * Version: 1.4.0
    99 * Author: Campusboy, Dan Zakirov, Tkama
    1010 * License: GPL-2.0+
  • easy-hide-admin-menu-items/trunk/languages/ehami-ru_RU.po

    r3474229 r3783089  
    1 # Translation of Plugins - Easy Hide Admin Menu Items - Stable (latest release) in Russian
    2 # This file is distributed under the same license as the Plugins - Easy Hide Admin Menu Items - Stable (latest release) package.
    3 msgid ""
    4 msgstr ""
     1# Translation of Easy Hide Admin Menu Items in Russian
     2# This file is distributed under the same license as the Easy Hide Admin Menu Items package.
     3msgid ""
     4msgstr ""
     5"Project-Id-Version: Easy Hide Admin Menu Items 1.4.0\n"
    56"PO-Revision-Date: 2024-03-06 19:20:09+0000\n"
     7"Language: ru_RU\n"
    68"MIME-Version: 1.0\n"
    79"Content-Type: text/plain; charset=UTF-8\n"
    … …  
    911"Plural-Forms: nplurals=3; plural=(n % 10 == 1 && n % 100 != 11) ? 0 : ((n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 12 || n % 100 > 14)) ? 1 : 2);\n"
    1012"X-Generator: GlotPress/4.0.0-rc.1\n"
    11 "Language: ru\n"
    12 "Project-Id-Version: Plugins - Easy Hide Admin Menu Items - Stable (latest release)\n"
    1313
    1414#: templates/switcher.php:36
    … …  
    1616msgstr "Отключить иконки скрытия"
    1717
    18 #: templates/admin-page-options.php:123
     18#: templates/admin-page-options.php:275
    1919msgid "Leave a review"
    2020msgstr "Оставить отзыв"
    2121
    22 #: templates/admin-page-options.php:121
    23 msgid "Please consider leaving a review for our plugin. Your reviews help us improve and serve you better."
    24 msgstr "Пожалуйста, рассмотрите возможность оставить отзыв о нашем плагине. Ваша обратная связь мотивирует нас качественно улучшать сервис."
    25 
    26 #: templates/admin-page-options.php:109
     22#: templates/admin-page-options.php:273
     23msgid ""
     24"Please consider leaving a review for our plugin. Your reviews help us "
     25"improve and serve you better."
     26msgstr ""
     27"Пожалуйста, рассмотрите возможность оставить отзыв о нашем плагине. Ваша "
     28"обратная связь мотивирует нас качественно улучшать сервис."
     29
     30#: templates/admin-page-options.php:261
    2731msgid "contact us here"
    2832msgstr "обращаться к нам"
    2933
    30 #: templates/admin-page-options.php:108
    31 msgid "For support, please contact our helpdesk. If you encounter any issues or have any questions, feel free to"
    32 msgstr "Для получения поддержки, пожалуйста, обратитесь на форум. Если у вас возникнут проблемы или вопросы, не стесняйтесь"
     34#: templates/admin-page-options.php:260
     35msgid ""
     36"For support, please contact our helpdesk. If you encounter any issues or "
     37"have any questions, feel free to"
     38msgstr ""
     39"Для получения поддержки, пожалуйста, обратитесь на форум. Если у вас "
     40"возникнут проблемы или вопросы, не стесняйтесь"
    3341
    3442#: src/Review.php:190
    … …  
    5058#. translators: %s is a placeholder for the plugin name
    5159#: src/Review.php:161
    52 msgid "We are very pleased that you are using the %s plugin within a few days."
     60#, php-format
     61msgid ""
     62"We are very pleased that you are using the %s plugin within a few days."
    5363msgstr "Мы очень рады, что вы используете плагин %s уже несколько дней."
    5464
    … …  
    5767msgstr "Здравствуйте!"
    5868
    59 #. Author of the plugin
    60 #: ehami.php
     69#. Author of the plugin/theme
    6170msgid "Campusboy, Dan Zakirov, Tkama"
    6271msgstr "Campusboy, Dan Zakirov, Tkama"
    … …  
    7079msgstr "Скрыть или показать скрытые пункты меню"
    7180
    72 #: templates/admin-page-options.php:98
    73 msgid "Thank you for using Easy Hide Admin Menu Items! Your feedback and comments are highly valuable to us and will assist us in improving the plugin further."
    74 msgstr "Благодарим вас за использование плагина Easy Hide Admin Menu Items! Ваши отзывы и комментарии имеют для нас большую ценность и помогут нам дальше улучшать плагин."
    75 
    76 #: templates/admin-page-options.php:94
     81#: templates/admin-page-options.php:250
     82msgid ""
     83"Thank you for using Easy Hide Admin Menu Items! Your feedback and comments "
     84"are highly valuable to us and will assist us in improving the plugin "
     85"further."
     86msgstr ""
     87"Благодарим вас за использование плагина Easy Hide Admin Menu Items! Ваши "
     88"отзывы и комментарии имеют для нас большую ценность и помогут нам дальше "
     89"улучшать плагин."
     90
     91#: templates/admin-page-options.php:246
    7792msgid "Message From the Author"
    7893msgstr "Сообщение от авторов"
    7994
    80 #: templates/admin-page-options.php:84
     95#: templates/admin-page-options.php:234
    8196msgid "Save Settings"
    8297msgstr "Сохранить настройки"
    8398
    84 #: templates/admin-page-options.php:44
     99#: templates/admin-page-options.php:52
    85100msgid "Main Settings"
    86101msgstr "Основные настройки"
    87102
    88 #: templates/admin-page-options.php:35
     103#: templates/admin-page-options.php:43
    89104msgid "Easy Hide Admin Menu Items Settings"
    90105msgstr "Настройки Easy Hide Admin Menu Items"
    91106
     107#: templates/admin-page-options.php:29
     108msgid ""
     109"If checked, all data (option and user metadata) will be deleted when the "
     110"plugin is deleted."
     111msgstr ""
     112"Если отмечено, то все данные (опции и метаданные пользователей) будут "
     113"удалены из базы данных при удалении плагина."
     114
    92115#: templates/admin-page-options.php:28
    93 msgid "If checked, all data (option and user metadata) will be deleted when the plugin is deleted."
    94 msgstr "Если отмечено, то все данные (опции и метаданные пользователей) будут удалены из базы данных при удалении плагина."
    95 
    96 #: templates/admin-page-options.php:27
    97116msgid "Allow the deletion of all plugin data after it is deleted"
    98117msgstr "Разрешить удаление всех данных после удаления плагина"
    99118
    100 #: templates/admin-page-options.php:23
     119#: templates/admin-page-options.php:24
    101120msgid "Uninstall plugin"
    102121msgstr "Удаление плагина"
    103122
    104123#: templates/admin-page-options.php:20
    105 msgid "If checked, you can hide the child menu. This may be useful when there are too many child menus causing distraction."
    106 msgstr "Если отмечено, вы можете скрывать дочерние меню. Это может быть полезно, когда слишком много дочерних меню которыми вы не пользуетесь."
     124msgid ""
     125"If checked, you can hide the child menu. This may be useful when there are "
     126"too many child menus causing distraction."
     127msgstr ""
     128"Если отмечено, вы можете скрывать дочерние меню. Это может быть полезно, "
     129"когда слишком много дочерних меню которыми вы не пользуетесь."
    107130
    108131#: templates/admin-page-options.php:19
    … …  
    115138
    116139#: templates/admin-page-options.php:12
    117 msgid "If checked, each user with access to the admin panel can save hidden menu settings individually for their own preferences."
    118 msgstr "Если отмечено, каждый пользователь с доступом к административной панели может сохранить скрытые настройки меню индивидуально для своих предпочтений."
     140msgid ""
     141"If checked, each user with access to the admin panel can save hidden menu "
     142"settings individually for their own preferences."
     143msgstr ""
     144"Если отмечено, каждый пользователь с доступом к административной панели "
     145"может сохранить скрытые настройки меню индивидуально для своих предпочтений."
    119146
    120147#: templates/admin-page-options.php:11
    121148msgid "Allow other users to set their own preferences."
    122 msgstr "Разрешить другим пользователям настраивать меню для себя на своё усмотрение."
     149msgstr ""
     150"Разрешить другим пользователям настраивать меню для себя на своё усмотрение."
    123151
    124152#: templates/admin-page-options.php:7
    … …  
    134162msgstr "Настройки меню администратора"
    135163
    136 #: src/Assets.php:38
     164#: src/Assets.php:35
    137165msgid "Hide menu"
    138166msgstr "Скрыть меню"
    139167
    140 #: src/Assets.php:37 templates/switcher.php:26
     168#: src/Assets.php:34 templates/switcher.php:26
    141169msgid "No hidden menu items"
    142170msgstr "Скрытые меню отсутствуют"
    143171
    144 #: src/Ajax.php:23 src/Ajax.php:40 src/Ajax.php:59 src/Ajax.php:79
    145 #: src/Ajax.php:98
     172#: src/Ajax.php:27 src/Ajax.php:44 src/Ajax.php:71 src/Ajax.php:91
     173#: src/Ajax.php:110 src/Ajax.php:132 src/Ajax.php:162 src/Ajax.php:184
     174#: src/Ajax.php:208
    146175msgid "Sorry, you are not allowed to manage options for this site."
    147176msgstr "Извините, у вас нет прав на управление опциями для этого сайта."
    148177
    149 #. Description of the plugin
    150 #: ehami.php
     178#. Description of the plugin/theme
    151179msgid "The plugin allows hiding selected admin menu items."
    152180msgstr "Плагин позволяет скрывать выбранные пункты меню администратора."
    153181
    154 #. Plugin URI of the plugin
    155 #: ehami.php
     182#. Plugin URI of the plugin/theme
    156183msgid "https://github.com/campusboy87/easy-hide-admin-menu-items"
    157184msgstr "https://github.com/campusboy87/easy-hide-admin-menu-items"
    158185
    159 #. Plugin Name of the plugin
    160 #: ehami.php
     186#. Plugin Name of the plugin/theme
    161187msgid "Easy Hide Admin Menu Items"
    162188msgstr "Easy Hide Admin Menu Items"
     189
     190#: src/Assets.php:38
     191msgid "Settings saved."
     192msgstr "Настройки сохранены."
     193
     194#: src/Assets.php:39
     195msgid "Error saving settings."
     196msgstr "Не удалось сохранить настройки."
     197
     198#: templates/admin-page-options.php:35
     199msgid "No changes (default)"
     200msgstr "Без изменений (по умолчанию)"
     201
     202#: templates/admin-page-options.php:36
     203msgid "Hide all separators"
     204msgstr "Скрыть все разделители"
     205
     206#: templates/admin-page-options.php:37
     207msgid "Highlight separators"
     208msgstr "Выделить разделители"
     209
     210#: templates/admin-page-options.php:102 templates/admin-page-options.php:108
     211msgid "Menu Sorting"
     212msgstr "Сортировка меню"
     213
     214#: templates/admin-page-options.php:119
     215msgid "Enable drag-and-drop menu reordering"
     216msgstr "Разрешить изменение порядка пунктов меню перетаскиванием"
     217
     218#: templates/admin-page-options.php:128
     219msgid "Drag the handle icon on the right side of menu items to reorder them."
     220msgstr ""
     221"Чтобы изменить порядок пунктов меню, перетащите значок справа от пункта."
     222
     223#: templates/admin-page-options.php:131
     224msgid "Note:"
     225msgstr "Примечание:"
     226
     227#: templates/admin-page-options.php:132
     228msgid ""
     229"your custom order is preserved even when this option is disabled. Use "
     230"\"Reset menu order\" to restore the default order."
     231msgstr ""
     232"заданный порядок сохраняется даже при отключении этой настройки. Чтобы "
     233"восстановить порядок по умолчанию, нажмите «Сбросить порядок меню»."
     234
     235#: templates/admin-page-options.php:135 templates/admin-page-options.php:179
     236#: templates/admin-page-options.php:224
     237msgid "Experimental"
     238msgstr "Экспериментальная функция"
     239
     240#: templates/admin-page-options.php:138
     241msgid "Reset menu order"
     242msgstr "Сбросить порядок меню"
     243
     244#: templates/admin-page-options.php:150 templates/admin-page-options.php:156
     245msgid "Sidebar Width"
     246msgstr "Ширина боковой панели"
     247
     248#: templates/admin-page-options.php:167
     249msgid "Enable sidebar width resize"
     250msgstr "Разрешить изменение ширины боковой панели"
     251
     252#: templates/admin-page-options.php:176
     253msgid "Drag the right edge of the sidebar to adjust the menu width."
     254msgstr "Чтобы изменить ширину меню, перетащите правый край боковой панели."
     255
     256#: templates/admin-page-options.php:182
     257msgid "Reset sidebar width"
     258msgstr "Сбросить ширину боковой панели"
     259
     260#: templates/admin-page-options.php:194 templates/admin-page-options.php:200
     261msgid "Menu Separators"
     262msgstr "Разделители меню"
     263
     264#: templates/admin-page-options.php:221
     265msgid ""
     266"Control the visibility of separator lines between menu groups in the admin "
     267"sidebar."
     268msgstr ""
     269"Управляйте отображением линий между группами пунктов меню в боковой панели "
     270"администратора."
  • easy-hide-admin-menu-items/trunk/languages/ehami.pot

    r3474229 r3783089  
     1#
    12#, fuzzy
    23msgid ""
    34msgstr ""
    4 "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
    5 "Project-Id-Version: Easy Hide Admin Menu Items\n"
     5"Project-Id-Version: Easy Hide Admin Menu Items 1.4.0\n"
    66"POT-Creation-Date: 2024-03-07 07:45+0300\n"
    77"PO-Revision-Date: 2024-03-07 07:45+0300\n"
    … …  
    1111"Content-Type: text/plain; charset=UTF-8\n"
    1212"Content-Transfer-Encoding: 8bit\n"
     13"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
    1314"X-Generator: Poedit 2.0.7\n"
    1415"X-Poedit-Basepath: ..\n"
    1516"X-Poedit-Flags-xgettext: --add-comments=translators:\n"
    16 "X-Poedit-WPHeader: ehami.php\n"
    17 "X-Poedit-SourceCharset: UTF-8\n"
    18 "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
    19 "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
    20 "_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
     17"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
    2118"X-Poedit-SearchPath-0: .\n"
    2219"X-Poedit-SearchPathExcluded-0: *.js\n"
    23 
    24 #: src/Ajax.php:23 src/Ajax.php:40 src/Ajax.php:59 src/Ajax.php:79
    25 #: src/Ajax.php:98
     20"X-Poedit-SourceCharset: UTF-8\n"
     21"X-Poedit-WPHeader: ehami.php\n"
     22
     23#: src/Ajax.php:27 src/Ajax.php:44 src/Ajax.php:71 src/Ajax.php:91
     24#: src/Ajax.php:110 src/Ajax.php:132 src/Ajax.php:162 src/Ajax.php:184
     25#: src/Ajax.php:208
    2626msgid "Sorry, you are not allowed to manage options for this site."
    2727msgstr ""
    2828
    29 #: src/Assets.php:37 templates/switcher.php:26
     29#: src/Assets.php:34 templates/switcher.php:26
    3030msgid "No hidden menu items"
    3131msgstr ""
    3232
     33#: src/Assets.php:35
     34msgid "Hide menu"
     35msgstr ""
     36
    3337#: src/Assets.php:38
    34 msgid "Hide menu"
     38msgid "Settings saved."
     39msgstr ""
     40
     41#: src/Assets.php:39
     42msgid "Error saving settings."
    3543msgstr ""
    3644
    … …  
    4250#: src/Review.php:161
    4351#, php-format
    44 msgid "We are very pleased that you are using the %s plugin within a few days."
     52msgid ""
     53"We are very pleased that you are using the %s plugin within a few days."
    4554msgstr ""
    4655
    … …  
    97106msgstr ""
    98107
    99 #: templates/admin-page-options.php:23
     108#: templates/admin-page-options.php:24
    100109msgid "Uninstall plugin"
    101110msgstr ""
    102111
    103 #: templates/admin-page-options.php:27
     112#: templates/admin-page-options.php:28
    104113msgid "Allow the deletion of all plugin data after it is deleted"
    105114msgstr ""
    106115
    107 #: templates/admin-page-options.php:28
     116#: templates/admin-page-options.php:29
    108117msgid ""
    109118"If checked, all data (option and user metadata) will be deleted when the "
    … …  
    112121
    113122#: templates/admin-page-options.php:35
     123msgid "No changes (default)"
     124msgstr ""
     125
     126#: templates/admin-page-options.php:36
     127msgid "Hide all separators"
     128msgstr ""
     129
     130#: templates/admin-page-options.php:37
     131msgid "Highlight separators"
     132msgstr ""
     133
     134#: templates/admin-page-options.php:43
    114135msgid "Easy Hide Admin Menu Items Settings"
    115136msgstr ""
    116137
    117 #: templates/admin-page-options.php:44
     138#: templates/admin-page-options.php:52
    118139msgid "Main Settings"
    119140msgstr ""
    120141
    121 #: templates/admin-page-options.php:84
     142#: templates/admin-page-options.php:102 templates/admin-page-options.php:108
     143msgid "Menu Sorting"
     144msgstr ""
     145
     146#: templates/admin-page-options.php:119
     147msgid "Enable drag-and-drop menu reordering"
     148msgstr ""
     149
     150#: templates/admin-page-options.php:128
     151msgid "Drag the handle icon on the right side of menu items to reorder them."
     152msgstr ""
     153
     154#: templates/admin-page-options.php:131
     155msgid "Note:"
     156msgstr ""
     157
     158#: templates/admin-page-options.php:132
     159msgid ""
     160"your custom order is preserved even when this option is disabled. Use "
     161"\"Reset menu order\" to restore the default order."
     162msgstr ""
     163
     164#: templates/admin-page-options.php:135 templates/admin-page-options.php:179
     165#: templates/admin-page-options.php:224
     166msgid "Experimental"
     167msgstr ""
     168
     169#: templates/admin-page-options.php:138
     170msgid "Reset menu order"
     171msgstr ""
     172
     173#: templates/admin-page-options.php:150 templates/admin-page-options.php:156
     174msgid "Sidebar Width"
     175msgstr ""
     176
     177#: templates/admin-page-options.php:167
     178msgid "Enable sidebar width resize"
     179msgstr ""
     180
     181#: templates/admin-page-options.php:176
     182msgid "Drag the right edge of the sidebar to adjust the menu width."
     183msgstr ""
     184
     185#: templates/admin-page-options.php:182
     186msgid "Reset sidebar width"
     187msgstr ""
     188
     189#: templates/admin-page-options.php:194 templates/admin-page-options.php:200
     190msgid "Menu Separators"
     191msgstr ""
     192
     193#: templates/admin-page-options.php:221
     194msgid ""
     195"Control the visibility of separator lines between menu groups in the admin "
     196"sidebar."
     197msgstr ""
     198
     199#: templates/admin-page-options.php:234
    122200msgid "Save Settings"
    123201msgstr ""
    124202
    125 #: templates/admin-page-options.php:94
     203#: templates/admin-page-options.php:246
    126204msgid "Message From the Author"
    127205msgstr ""
    128206
    129 #: templates/admin-page-options.php:98
     207#: templates/admin-page-options.php:250
    130208msgid ""
    131209"Thank you for using Easy Hide Admin Menu Items! Your feedback and comments "
    132 "are highly valuable to us and will assist us in improving the plugin further."
    133 msgstr ""
    134 
    135 #: templates/admin-page-options.php:108
     210"are highly valuable to us and will assist us in improving the plugin "
     211"further."
     212msgstr ""
     213
     214#: templates/admin-page-options.php:260
    136215msgid ""
    137216"For support, please contact our helpdesk. If you encounter any issues or "
    … …  
    139218msgstr ""
    140219
    141 #: templates/admin-page-options.php:109
     220#: templates/admin-page-options.php:261
    142221msgid "contact us here"
    143222msgstr ""
    144223
    145 #: templates/admin-page-options.php:121
     224#: templates/admin-page-options.php:273
    146225msgid ""
    147226"Please consider leaving a review for our plugin. Your reviews help us "
    … …  
    149228msgstr ""
    150229
    151 #: templates/admin-page-options.php:123
     230#: templates/admin-page-options.php:275
    152231msgid "Leave a review"
    153232msgstr ""
  • easy-hide-admin-menu-items/trunk/readme.txt

    r3474229 r3783089  
    55Requires at least: 5.9.0
    66Tested up to: 6.9
    7 Stable tag: 1.3.9
     7Stable tag: 1.4.0
    88Requires PHP: 7.0
    99License: GPLv2 or later
    … …  
    4040
    4141Enhance your WordPress admin panel experience by effortlessly managing menu items and optimizing the interface according to your specific needs. Experience a clutter-free and user-friendly environment with Easy Hide Admin Menu Items.
     42
     43### Experimental Features in 1.4.0
     44
     45These features are available under Appearance → Admin Menu Settings. They are marked as experimental and your feedback is welcome.
     46
     47* **Menu Sorting:** Drag-and-drop reordering of admin menu items. A handle icon appears on hover — grab it to move items up or down. Your custom order is saved per user or globally depending on your settings. Disabling this option preserves your saved order.
     48* **Menu Separators:** Control the visibility of separator lines between menu groups. Choose to hide them completely or highlight them for better visual separation.
     49* **Sidebar Width:** Resize the expanded desktop menu by dragging its edge or using the width slider. The standard folded and mobile layouts are preserved.
    4250
    4351== Frequently Asked Questions ==
    … …  
    7684== Screenshots ==
    7785
    78 1. Hide unnecessary main menus effortlessly with our plugin
    79 2. Activate child menu hiding
    80 3. Explore and customize your preferences with easy-to-use plugin settings
    81 4. Experience a user-friendly admin panel with our plugin's sleek design
     861. A cleaner WordPress admin menu with hidden entries available from the toolbar.
     872. Use the eye icon beside a main menu item to hide it.
     883. Hide a submenu entry without hiding its parent menu.
     894. Admin Menu Settings lets you switch between shared and personal preferences.
     905. Experimental sorting lets you reorder menu items by dragging their handles.
     916. Experimental sidebar resizing saves the width of the expanded desktop menu.
     927. Experimental separator controls highlight or hide the boundaries between menu groups.
    8293
    8394== Changelog ==
     95
     96= 1.4.0 =
     97- Added experimental drag-and-drop sorting for the WordPress admin menu.
     98- Added experimental sidebar resizing for the expanded desktop menu.
     99- Added experimental controls to hide or highlight menu separators.
     100- Added Slovak localization and updated Russian translations.
     101- Restricted shared menu changes to users with the manage_options capability.
     102- Kept personal menu visibility, order, and width separate between users.
     103- Fixed saved sidebar widths overriding the folded and mobile layouts.
     104- Aligned the icons in the review notice buttons.
     105- Updated the WordPress.org gallery with seven screenshots.
     106- Restored PHP 7.0 compatibility and corrected the review AJAX callbacks.
    84107
    85108= 1.3.9 =
  • easy-hide-admin-menu-items/trunk/src/Ajax.php

    r3474229 r3783089  
    1313                add_action( 'wp_ajax_ehami_remove_item', [ $this, 'action_remove_item_from_db' ] );
    1414                add_action( 'wp_ajax_ehami_hide_icons_disable', [ $this, 'action_hide_icons_disable' ] );
     15                add_action( 'wp_ajax_ehami_save_menu_order', [ $this, 'action_save_menu_order' ] );
     16                add_action( 'wp_ajax_ehami_reset_menu_order', [ $this, 'action_reset_menu_order' ] );
     17                add_action( 'wp_ajax_ehami_save_sidebar_width', [ $this, 'action_save_sidebar_width' ] );
     18                add_action( 'wp_ajax_ehami_reset_sidebar_width', [ $this, 'action_reset_sidebar_width' ] );
    1519        }
    1620
    … …  
    1923                check_ajax_referer( self::NONCE_KEY );
    2024
    21                 if ( ! current_user_can( 'read' ) ) {
    22                         wp_die(
    23                                 esc_html__( 'Sorry, you are not allowed to manage options for this site.' ),
     25                if ( ! current_user_can( plugin()->settings->save_individually ? 'read' : 'manage_options' ) ) {
     26                        wp_die(
     27                                esc_html__( 'Sorry, you are not allowed to manage options for this site.', 'ehami' ),
    2428                                403
    2529                        );
    … …  
    3842                if ( ! current_user_can( 'manage_options' ) ) {
    3943                        wp_die(
    40                                 esc_html__( 'Sorry, you are not allowed to manage options for this site.' ),
    41                                 403
    42                         );
    43                 }
    44 
    45                 plugin()->settings->save_options( [
     44                                esc_html__( 'Sorry, you are not allowed to manage options for this site.', 'ehami' ),
     45                                403
     46                        );
     47                }
     48
     49                $options = [
    4650                        'save_individually'            => (bool) sanitize_text_field( wp_unslash( $_POST['options']['save_individually'] ?? false ) ),
    4751                        'hide_submenu'                 => (bool) sanitize_text_field( wp_unslash( $_POST['options']['hide_submenu'] ?? false ) ),
    4852                        'remove_all_data_on_uninstall' => (bool) sanitize_text_field( wp_unslash( $_POST['options']['remove_all_data_on_uninstall'] ?? false ) ),
    49                 ] );
     53                        'enable_menu_sorting'          => (bool) sanitize_text_field( wp_unslash( $_POST['options']['enable_menu_sorting'] ?? false ) ),
     54                        'enable_sidebar_resize'        => (bool) sanitize_text_field( wp_unslash( $_POST['options']['enable_sidebar_resize'] ?? false ) ),
     55                ];
     56
     57                if ( isset( $_POST['options']['separators_mode'] ) ) {
     58                        $options['separators_mode'] = sanitize_text_field( wp_unslash( $_POST['options']['separators_mode'] ) );
     59                }
     60
     61                plugin()->settings->save_options( $options );
    5062
    5163                wp_die();
    … …  
    5567                check_ajax_referer( self::NONCE_KEY );
    5668
    57                 if ( ! current_user_can( 'read' ) ) {
    58                         wp_die(
    59                                 esc_html__( 'Sorry, you are not allowed to manage options for this site.' ),
     69                if ( ! current_user_can( plugin()->settings->save_individually ? 'read' : 'manage_options' ) ) {
     70                        wp_die(
     71                                esc_html__( 'Sorry, you are not allowed to manage options for this site.', 'ehami' ),
    6072                                403
    6173                        );
    … …  
    7587                check_ajax_referer( self::NONCE_KEY );
    7688
    77                 if ( ! current_user_can( 'read' ) ) {
    78                         wp_die(
    79                                 esc_html__( 'Sorry, you are not allowed to manage options for this site.' ),
     89                if ( ! current_user_can( plugin()->settings->save_individually ? 'read' : 'manage_options' ) ) {
     90                        wp_die(
     91                                esc_html__( 'Sorry, you are not allowed to manage options for this site.', 'ehami' ),
    8092                                403
    8193                        );
    … …  
    94106                check_ajax_referer( self::NONCE_KEY );
    95107
    96                 if ( ! current_user_can( 'read' ) ) {
    97                         wp_die(
    98                                 esc_html__( 'Sorry, you are not allowed to manage options for this site.' ),
    99                                 403
    100                         );
    101                 }
    102 
    103                 plugin()->settings->save_options( [
    104                         'hide_icons_disable' => (bool) sanitize_text_field( wp_unslash( $_POST['options']['hide_icons_disable'] ?? false ) )
    105                 ] );
    106 
    107                 wp_die();
    108         }
    109 
     108                if ( ! current_user_can( plugin()->settings->save_individually ? 'read' : 'manage_options' ) ) {
     109                        wp_die(
     110                                esc_html__( 'Sorry, you are not allowed to manage options for this site.', 'ehami' ),
     111                                403
     112                        );
     113                }
     114
     115                plugin()->settings->save_options( [
     116                        'hide_icons_disable' => (bool) sanitize_text_field( wp_unslash( $_POST['options']['hide_icons_disable'] ?? false ) ),
     117                ] );
     118
     119                wp_die();
     120        }
     121
     122        /**
     123         * Save menu order via AJAX (called on drag-and-drop end).
     124         *
     125         * @since 1.4.0
     126         */
     127        public function action_save_menu_order() {
     128                check_ajax_referer( self::NONCE_KEY );
     129
     130                if ( ! current_user_can( plugin()->settings->save_individually ? 'read' : 'manage_options' ) ) {
     131                        wp_die(
     132                                esc_html__( 'Sorry, you are not allowed to manage options for this site.', 'ehami' ),
     133                                403
     134                        );
     135                }
     136
     137                // Each selector and position is sanitized separately below.
     138                $order = isset( $_POST['order'] ) && is_array( $_POST['order'] ) ? wp_unslash( $_POST['order'] ) : []; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
     139
     140                $sanitized = [];
     141                foreach ( $order as $selector => $position ) {
     142                        $sanitized[ sanitize_text_field( $selector ) ] = absint( $position );
     143                }
     144
     145                plugin()->settings->save_options( [
     146                        'menu_order' => $sanitized,
     147                ] );
     148
     149                wp_die();
     150        }
     151
     152        /**
     153         * Reset menu order to default (called from settings page).
     154         *
     155         * @since 1.4.0
     156         */
     157        public function action_reset_menu_order() {
     158                check_ajax_referer( self::NONCE_KEY );
     159
     160                if ( ! current_user_can( plugin()->settings->save_individually ? 'read' : 'manage_options' ) ) {
     161                        wp_die(
     162                                esc_html__( 'Sorry, you are not allowed to manage options for this site.', 'ehami' ),
     163                                403
     164                        );
     165                }
     166
     167                plugin()->settings->save_options( [
     168                        'menu_order' => [],
     169                ] );
     170
     171                wp_send_json_success();
     172        }
     173
     174        /**
     175         * Save sidebar width via AJAX (called on resize end or range change).
     176         *
     177         * @since 1.4.0
     178         */
     179        public function action_save_sidebar_width() {
     180                check_ajax_referer( self::NONCE_KEY );
     181
     182                if ( ! current_user_can( plugin()->settings->save_individually ? 'read' : 'manage_options' ) ) {
     183                        wp_die(
     184                                esc_html__( 'Sorry, you are not allowed to manage options for this site.', 'ehami' ),
     185                                403
     186                        );
     187                }
     188
     189                $width = isset( $_POST['width'] ) ? absint( $_POST['width'] ) : 0;
     190
     191                plugin()->settings->save_options( [
     192                        'sidebar_width' => $width,
     193                ] );
     194
     195                wp_die();
     196        }
     197
     198        /**
     199         * Reset sidebar width to default (called from settings page).
     200         *
     201         * @since 1.4.0
     202         */
     203        public function action_reset_sidebar_width() {
     204                check_ajax_referer( self::NONCE_KEY );
     205
     206                if ( ! current_user_can( plugin()->settings->save_individually ? 'read' : 'manage_options' ) ) {
     207                        wp_die(
     208                                esc_html__( 'Sorry, you are not allowed to manage options for this site.', 'ehami' ),
     209                                403
     210                        );
     211                }
     212
     213                plugin()->settings->save_options( [
     214                        'sidebar_width' => 0,
     215                ] );
     216
     217                wp_send_json_success();
     218        }
    110219}
  • easy-hide-admin-menu-items/trunk/src/Assets.php

    r3474229 r3783089  
    1010
    1111        public function enqueue_assets() {
    12                 wp_enqueue_style( 'ehami-style', plugin()->url . '/assets/css/style.css', [], plugin()->info['version'] );
     12                $version = plugin()->info['version'];
     13                $url     = plugin()->url;
     14
     15                wp_enqueue_style( 'ehami-style', $url . '/assets/css/style.css', [], $version );
    1316                $this->add_inline_style( 'ehami-style' );
    1417
    15                 /**
    16                  * Load the user interface script only if the 'save_individually' option is set to true in the global settings,
    17                  * or if the current user is an administrator.
    18                  */
    19                 if ( true === plugin()->settings->save_individually || current_user_can( 'administrator' ) ) {
     18                // SortableJS — loaded separately because it's a vendor library.
     19                wp_enqueue_script( 'sortablejs', $url . '/assets/js/vendor/Sortable.min.js', [], '1.15.7', true );
    2020
    21                         wp_enqueue_script(
    22                                 'ehami-user-interface',
    23                                 plugin()->url . '/assets/js/user-interface.js',
    24                                 [
    25                                         'jquery',
    26                                         'jquery-effects-transfer',
    27                                 ],
    28                                 plugin()->info['version'],
    29                                 true
    30                         );
     21                // Main script — all EHAMI modules in one file.
     22                wp_enqueue_script( 'ehami', $url . '/assets/js/ehami.js', [ 'sortablejs' ], $version, true );
     23                wp_add_inline_script( 'ehami', 'var ehami = ' . wp_json_encode( $this->get_script_data() ), 'before' );
     24        }
    3125
    32                 }
    33 
    34                 wp_enqueue_script( 'ehami-settings-page', plugin()->url . '/assets/js/settings-page.js', [ 'jquery' ], plugin()->info['version'], true );
    35                 $data = [
    36                         'nonce'        => wp_create_nonce( 'ehami-nonce' ),
    37                         'no_items'     => __( 'No hidden menu items', 'ehami' ),
    38                         'hid'          => __( 'Hide menu', 'ehami' ),
    39                         'count_items'  => count( plugin()->settings->items ),
    40                         'hide_submenu' => plugin()->settings->hide_submenu,
     26        /**
     27         * Build the data object passed to all JS modules via the `ehami` global.
     28         *
     29         * @return array
     30         */
     31        private function get_script_data(): array {
     32                return [
     33                        'nonce'                 => wp_create_nonce( 'ehami-nonce' ),
     34                        'no_items'              => __( 'No hidden menu items', 'ehami' ),
     35                        'hid'                   => __( 'Hide menu', 'ehami' ),
     36                        'count_items'           => count( plugin()->settings->items ),
     37                        'hide_submenu'          => plugin()->settings->hide_submenu,
     38                        'saved'                 => __( 'Settings saved.', 'ehami' ),
     39                        'save_error'            => __( 'Error saving settings.', 'ehami' ),
     40                        'enable_menu_sorting'   => plugin()->settings->enable_menu_sorting,
     41                        'can_customize'         => plugin()->settings->save_individually || current_user_can( 'manage_options' ),
     42                        'menu_order'            => plugin()->settings->menu_order,
     43                        'enable_sidebar_resize' => plugin()->settings->enable_sidebar_resize,
     44                        'sidebar_width'         => plugin()->settings->sidebar_width,
     45                        'video_url'             => plugin()->url . '/assets/mp4/',
    4146                ];
    42                 wp_add_inline_script( 'ehami-user-interface', 'const ehami = ' . wp_json_encode( $data ), 'before' );
    4347        }
    4448
    4549        public function add_inline_style( string $handle ) {
     50                $css = '';
     51
     52                // Hidden menu items.
    4653                $items = plugin()->settings->items;
    47 
    48                 if ( ! $items ) {
    49                         return;
     54                if ( $items ) {
     55                        foreach ( $items as $id => $text ) {
     56                                if ( strpos( $id, '.php' ) !== false ) {
     57                                        // for submenu items
     58                                        $css .= sprintf( '.ehami-enable #adminmenu .wp-submenu a[href="%s"] { display: none; }', esc_attr( $id ) );
     59                                } elseif ( strpos( $id, '#' ) !== false ) {
     60                                        // for parent menu items
     61                                        $css .= sprintf( '.ehami-enable #adminmenu %s { display: none; }', esc_attr( $id ) );
     62                                }
     63                        }
    5064                }
    5165
    52                 $css = '';
    53                 foreach ( $items as $id => $text ) {
    54                         if ( str_contains( $id, '.php' ) ) {
    55                                 // for submenu items
    56                                 $css .= sprintf( '.ehami-enable #adminmenu .wp-submenu a[href="%s"] { display: none; }', esc_attr( $id ) );
    57                         } elseif ( str_contains( $id, '#' ) ) {
    58                                 // for parent menu items
    59                                 $css .= sprintf( '.ehami-enable #adminmenu %s { display: none; }', esc_attr( $id ) );
    60                         }
     66                // Sidebar width override.
     67                // Apply only to the expanded desktop menu; WordPress folds it on narrower screens.
     68                $sidebar_width = plugin()->settings->sidebar_width;
     69                if ( plugin()->settings->enable_sidebar_resize && $sidebar_width > 0 ) {
     70                        $w = (int) $sidebar_width;
     71                        $css .= sprintf(
     72                                '@media (min-width: 961px) {' .
     73                                'body:not(.folded) #adminmenuwrap, body:not(.folded) #adminmenuback, body:not(.folded) #adminmenu { width: %1$dpx; }' .
     74                                'body:not(.folded) #wpcontent, body:not(.folded) #wpfooter { margin-left: %1$dpx; }' .
     75                                'body:not(.folded) #adminmenu .wp-not-current-submenu .wp-submenu { left: %1$dpx; }' .
     76                                'body:not(.folded) #adminmenu .wp-has-current-submenu .wp-submenu { width: 100%%; }' .
     77                                '}',
     78                                $w
     79                        );
    6180                }
    62                 wp_add_inline_style( $handle, $css );
     81
     82                // Separators mode.
     83                $separators_mode = plugin()->settings->separators_mode;
     84                if ( $separators_mode === 'hidden' ) {
     85                        $css .= '#adminmenu li.wp-menu-separator { display: none; }';
     86                } elseif ( $separators_mode === 'highlight' ) {
     87                        $css .= '#adminmenu li.wp-menu-separator { height: auto; margin: 0; }';
     88                        $css .= '#adminmenu li.wp-menu-separator > .separator { height: 2px; margin: 8px 12px; background: rgba(255,255,255,0.08); border: none; }';
     89                }
     90
     91                if ( $css ) {
     92                        wp_add_inline_style( $handle, $css );
     93                }
    6394        }
    64 
    6595}
  • easy-hide-admin-menu-items/trunk/src/Review.php

    r3474229 r3783089  
    2121
    2222                // Check if the condition is met before adding hooks.
    23                 if ( is_array( $ehami_data_install ) && strtotime( gmdate( 'Y-m-d' ) ) >= strtotime( $ehami_data_install['date'] ) ) {
     23                if ( is_array( $ehami_data_install ) && isset( $ehami_data_install['date'] ) && strtotime( gmdate( 'Y-m-d' ) ) >= strtotime( $ehami_data_install['date'] ) ) {
    2424                        add_action( 'admin_head', [ $this, 'add_admin_inline_style' ] );
    2525                        add_action( 'admin_footer', [ $this, 'add_admin_footer_script' ] );
    … …  
    6161                                gap: 5px;
    6262                        }
     63
     64                        .wp-core-ui .button.ehami_review__link .dashicons {
     65                                line-height: 1;
     66                        }
    6367                </style>
    6468                <?php
    … …  
    147151
    148152                                        <img class="ehami_review__img"
    149                                              src="https://ps.w.org/easy-hide-admin-menu-items/assets/icon-128x128.png" alt="">
     153                                                src="https://ps.w.org/easy-hide-admin-menu-items/assets/icon-128x128.png" alt="">
    150154
    151155                                </div>
    … …  
    185189
    186190                                                <a id="ehami_leave_feedback" class="button button-primary ehami_review__link"
    187                                                    href="https://wordpress.org/support/plugin/easy-hide-admin-menu-items/reviews/#new-post"
    188                                                    target="_blank">
     191                                                        href="https://wordpress.org/support/plugin/easy-hide-admin-menu-items/reviews/#new-post"
     192                                                        target="_blank">
    189193
    190194                                                        <?php echo esc_html__( 'Leave feedback', 'ehami' ); ?>
    … …  
    233237        public function leave_feedback_ajax_callback() {
    234238                $this->review_ajax_callback( 'feedback_submitted', '+5 years' );
    235                 wp_die();
    236239        }
    237240
    … …  
    241244        public function remind_ajax_callback() {
    242245                $this->review_ajax_callback( 'remind_submitted', '+1 days' );
    243                 wp_die();
    244246        }
    245247
    … …  
    249251        public function already_ajax_callback() {
    250252                $this->review_ajax_callback( 'already_submitted', '+4 years' );
    251                 wp_die();
    252253        }
    253254}
  • easy-hide-admin-menu-items/trunk/src/Settings.php

    r3474229 r3783089  
    44
    55/**
    6  * @property-read array $items
    7  * @property-read bool $status
    8  * @property-read bool $save_individually
    9  * @property-read bool $hide_submenu
    10  * @property-read bool $remove_all_data_on_uninstall
    11  * @property-read bool $hide_icons_disable
     6 * @property-read array  $items
     7 * @property-read bool   $status
     8 * @property-read bool   $save_individually
     9 * @property-read bool   $hide_submenu
     10 * @property-read bool   $remove_all_data_on_uninstall
     11 * @property-read bool   $hide_icons_disable
     12 * @property-read string $separators_mode
     13 * @property-read bool   $enable_menu_sorting
     14 * @property-read array  $menu_order
     15 * @property-read bool   $enable_sidebar_resize
     16 * @property-read int    $sidebar_width
    1217 */
    1318class Settings {
    … …  
    2328                'remove_all_data_on_uninstall' => false,
    2429                'hide_icons_disable'           => false,
     30                // Experimental features.
     31                'enable_menu_sorting'          => false,
     32                'menu_order'                   => [],
     33                'separators_mode'              => 'default',
     34                'enable_sidebar_resize'        => false,
     35                'sidebar_width'                => 0,
    2536        ];
    2637
    … …  
    3849
    3950                if ( $this->options['save_individually'] ) {
     51                        if ( metadata_exists( 'user', get_current_user_id(), 'ehami_user_status' ) ) {
     52                                $this->options['status'] = (bool) get_user_meta( get_current_user_id(), 'ehami_user_status', true );
     53                        }
    4054                        $this->options['items']              = get_user_meta( get_current_user_id(), self::USER_ITEMS_META_KEY, true ) ?: [];
    4155                        $this->options['hide_icons_disable'] = get_user_meta( get_current_user_id(), 'hide_icons_disable', true ) ?: false;
     56                        $this->options['menu_order']         = get_user_meta( get_current_user_id(), 'ehami_user_menu_order', true ) ?: [];
     57                        $this->options['sidebar_width']      = (int) get_user_meta( get_current_user_id(), 'ehami_sidebar_width', true );
    4258                }
    4359        }
    … …  
    5066                $options = $this->sanitize_options( $new_options );
    5167
    52                 update_option( self::OPTION_NAME, $options, false );
     68                if ( $options['save_individually'] ) {
     69                        $global_options = array_merge( self::DEFAULT_OPTIONS, $this->get_db_options() );
     70                        $personal_keys  = [
     71                                'status'             => 'ehami_user_status',
     72                                'items'              => self::USER_ITEMS_META_KEY,
     73                                'hide_icons_disable' => 'hide_icons_disable',
     74                                'menu_order'         => 'ehami_user_menu_order',
     75                                'sidebar_width'      => 'ehami_sidebar_width',
     76                        ];
    5377
    54                 if ( $options['save_individually'] && array_key_exists( 'hide_icons_disable', $options ) ) {
    55                         update_user_meta( get_current_user_id(), 'hide_icons_disable', $options['hide_icons_disable'] );
     78                        foreach ( $personal_keys as $key => $meta_key ) {
     79                                if ( isset( $new_options[ $key ] ) && ( ! is_array( self::DEFAULT_OPTIONS[ $key ] ) || is_array( $new_options[ $key ] ) ) ) {
     80                                        $value = $key === 'items' ? wp_slash( $options[ $key ] ) : $options[ $key ];
     81                                        update_user_meta( get_current_user_id(), $meta_key, $value );
     82                                }
     83
     84                                $options[ $key ] = $global_options[ $key ];
     85                        }
    5686                }
    5787
    58                 if ( $options['save_individually'] && array_key_exists( 'items', $options ) ) {
    59                         update_user_meta( get_current_user_id(), self::USER_ITEMS_META_KEY, wp_slash( $options['items'] ) );
    60                 }
    61 
     88                update_option( self::OPTION_NAME, $options, false );
    6289        }
    6390
    … …  
    87114                if ( isset( $new_options['items'] ) && is_array( $new_options['items'] ) ) {
    88115                        $options['items'] = array_map( 'sanitize_text_field', $new_options['items'] );
     116                }
     117
     118                if ( isset( $new_options['enable_menu_sorting'] ) ) {
     119                        $options['enable_menu_sorting'] = (bool) $new_options['enable_menu_sorting'];
     120                }
     121
     122                if ( isset( $new_options['menu_order'] ) && is_array( $new_options['menu_order'] ) ) {
     123                        $sanitized_order = [];
     124                        foreach ( $new_options['menu_order'] as $selector => $position ) {
     125                                $sanitized_order[ sanitize_text_field( $selector ) ] = absint( $position );
     126                        }
     127                        $options['menu_order'] = $sanitized_order;
     128                }
     129
     130                if ( isset( $new_options['separators_mode'] ) ) {
     131                        $allowed_modes = [ 'default', 'hidden', 'highlight' ];
     132                        $mode          = sanitize_text_field( $new_options['separators_mode'] );
     133                        $options['separators_mode'] = in_array( $mode, $allowed_modes, true ) ? $mode : 'default';
     134                }
     135
     136                if ( isset( $new_options['enable_sidebar_resize'] ) ) {
     137                        $options['enable_sidebar_resize'] = (bool) $new_options['enable_sidebar_resize'];
     138                }
     139
     140                if ( isset( $new_options['sidebar_width'] ) ) {
     141                        $width = absint( $new_options['sidebar_width'] );
     142                        // Clamp to valid range: 0 (default/unset), or 160–480.
     143                        if ( $width > 0 ) {
     144                                $width = max( 160, min( 480, $width ) );
     145                        }
     146                        $options['sidebar_width'] = $width;
    89147                }
    90148
    … …  
    119177                return ! is_null( $this->{$name} );
    120178        }
    121 
    122179}
  • easy-hide-admin-menu-items/trunk/src/Settings_Page.php

    r3474229 r3783089  
    4141                return $actions;
    4242        }
    43 
    4443}
  • easy-hide-admin-menu-items/trunk/src/Switcher.php

    r3474229 r3783089  
    1313                 * If the condition is met, or if the current user is an administrator, initialize the user interface.
    1414                 */
    15                 if ( true === plugin()->settings->save_individually || current_user_can( 'administrator' ) ) {
     15                if ( plugin()->settings->save_individually || current_user_can( 'manage_options' ) ) {
    1616                        add_action( 'admin_bar_menu', [ $this, 'add_to_admin_bar' ] );
    1717                }
    … …  
    3939                return plugin()->settings->status ? $classes . ' ehami-enable' : $classes;
    4040        }
    41 
    4241}
  • easy-hide-admin-menu-items/trunk/src/Uninstall.php

    r3474229 r3783089  
    4343
    4444        private function delete_users_options( $blog_id ) {
    45                 $meta_key = $this->settings::USER_ITEMS_META_KEY;
     45                $meta_keys = [
     46                        $this->settings::USER_ITEMS_META_KEY,
     47                        'hide_icons_disable',
     48                        'ehami_user_status',
     49                        'ehami_user_menu_order',
     50                        'ehami_sidebar_width',
     51                ];
    4652
    47                 $user_ids = get_users(
    48                         [
    49                                 'blog_id'      => $blog_id,
    50                                 'fields'       => 'ID',
    51                                 'meta_key'     => $meta_key, // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key
    52                                 'meta_compare' => 'EXISTS',
    53                         ]
    54                 );
     53                foreach ( $meta_keys as $meta_key ) {
     54                        $user_ids = get_users(
     55                                [
     56                                        'blog_id'      => $blog_id,
     57                                        'fields'       => 'ID',
     58                                        'meta_key'     => $meta_key, // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key
     59                                        'meta_compare' => 'EXISTS',
     60                                ]
     61                        );
    5562
    56                 foreach ( $user_ids as $user_id ) {
    57                         delete_user_meta( $user_id, $meta_key );
     63                        foreach ( $user_ids as $user_id ) {
     64                                delete_user_meta( $user_id, $meta_key );
     65                        }
    5866                }
    5967        }
  • easy-hide-admin-menu-items/trunk/templates/admin-page-options.php

    r3474229 r3783089  
    1919                'description' => __( 'Allow hiding child admin menus', 'ehami' ),
    2020                'help'        => __( 'If checked, you can hide the child menu. This may be useful when there are too many child menus causing distraction.', 'ehami' ),
     21                'video'       => 'child-menu',
    2122        ],
    2223        [
    … …  
    2829                'help'        => __( 'If checked, all data (option and user metadata) will be deleted when the plugin is deleted.', 'ehami' ),
    2930        ],
     31];
     32
     33$current_separators_mode = plugin()->settings->separators_mode;
     34$separators_options      = [
     35        'default'   => __( 'No changes (default)', 'ehami' ),
     36        'hidden'    => __( 'Hide all separators', 'ehami' ),
     37        'highlight' => __( 'Highlight separators', 'ehami' ),
    3038];
    3139?>
    … …  
    7078                                                                                                <?php echo esc_html( $field['description'] ); ?>
    7179                                                                                        </label>
     80                                                                                        <?php if ( ! empty( $field['video'] ) ) : ?>
     81                                                                                                <span class="ehami-video-hint" data-video="<?php echo esc_attr( $field['video'] ); ?>">
     82                                                                                                        <span class="dashicons dashicons-video-alt3"></span>
     83                                                                                                </span>
     84                                                                                        <?php endif; ?>
    7285                                                                                </div>
    7386
    … …  
    7992                                                        </tr>
    8093                                                <?php } ?>
     94
     95                                        <!-- Experimental: Menu Sorting -->
     96                                        <tr class="ehami-settings__separator-row">
     97                                                <td colspan="2"><hr></td>
     98                                        </tr>
     99                                        <tr>
     100                                                <th scope="row">
     101                                                        <label for="ehami_enable_menu_sorting">
     102                                                                <?php esc_html_e( 'Menu Sorting', 'ehami' ); ?>
     103                                                        </label>
     104                                                </th>
     105                                                <td>
     106                                                        <fieldset class="ehami-settings__main-fieldset">
     107                                                                <legend class="screen-reader-text">
     108                                                                        <span><?php esc_html_e( 'Menu Sorting', 'ehami' ); ?></span>
     109                                                                </legend>
     110
     111                                                                <div class="ehami-settings__main-field">
     112                                                                        <label for="ehami_enable_menu_sorting">
     113                                                                                <input
     114                                                                                                type="checkbox"
     115                                                                                                id="ehami_enable_menu_sorting"
     116                                                                                                name="enable_menu_sorting"
     117                                                                                                value="1" <?php checked( plugin()->settings->enable_menu_sorting, true ); ?>
     118                                                                                >
     119                                                                                <?php esc_html_e( 'Enable drag-and-drop menu reordering', 'ehami' ); ?>
     120                                                                        </label>
     121                                                                        <span class="ehami-video-hint" data-video="menu-sorting">
     122                                                                                <span class="dashicons dashicons-video-alt3"></span>
     123                                                                        </span>
     124                                                                </div>
     125
     126                                                                <div class="ehami-settings__main-field-description">
     127                                                                        <p class="description">
     128                                                                                <?php esc_html_e( 'Drag the handle icon on the right side of menu items to reorder them.', 'ehami' ); ?>
     129                                                                        </p>
     130                                                                        <p class="description">
     131                                                                                <strong><?php esc_html_e( 'Note:', 'ehami' ); ?></strong>
     132                                                                                <?php esc_html_e( 'your custom order is preserved even when this option is disabled. Use "Reset menu order" to restore the default order.', 'ehami' ); ?>
     133                                                                        </p>
     134                                                                        <p class="ehami-settings__experimental-badge">
     135                                                                                <span class="ehami-badge ehami-badge--experimental"><?php esc_html_e( 'Experimental', 'ehami' ); ?></span>
     136                                                                                <a href="#" id="ehami-reset-menu-order" class="ehami-reset-link">
     137                                                                                        <span class="dashicons dashicons-image-rotate"></span>
     138                                                                                        <?php esc_html_e( 'Reset menu order', 'ehami' ); ?>
     139                                                                                </a>
     140                                                                        </p>
     141                                                                </div>
     142                                                        </fieldset>
     143                                                </td>
     144                                        </tr>
     145
     146                                        <!-- Experimental: Sidebar Width -->
     147                                        <tr>
     148                                                <th scope="row">
     149                                                        <label for="ehami_enable_sidebar_resize">
     150                                                                <?php esc_html_e( 'Sidebar Width', 'ehami' ); ?>
     151                                                        </label>
     152                                                </th>
     153                                                <td>
     154                                                        <fieldset class="ehami-settings__main-fieldset">
     155                                                                <legend class="screen-reader-text">
     156                                                                        <span><?php esc_html_e( 'Sidebar Width', 'ehami' ); ?></span>
     157                                                                </legend>
     158
     159                                                                <div class="ehami-settings__main-field">
     160                                                                        <label for="ehami_enable_sidebar_resize">
     161                                                                                <input
     162                                                                                                type="checkbox"
     163                                                                                                id="ehami_enable_sidebar_resize"
     164                                                                                                name="enable_sidebar_resize"
     165                                                                                                value="1" <?php checked( plugin()->settings->enable_sidebar_resize, true ); ?>
     166                                                                                >
     167                                                                                <?php esc_html_e( 'Enable sidebar width resize', 'ehami' ); ?>
     168                                                                        </label>
     169                                                                        <span class="ehami-video-hint" data-video="sidebar-width">
     170                                                                                <span class="dashicons dashicons-video-alt3"></span>
     171                                                                        </span>
     172                                                                </div>
     173
     174                                                                <div class="ehami-settings__main-field-description">
     175                                                                        <p class="description">
     176                                                                                <?php esc_html_e( 'Drag the right edge of the sidebar to adjust the menu width.', 'ehami' ); ?>
     177                                                                        </p>
     178                                                                        <p class="ehami-settings__experimental-badge">
     179                                                                                <span class="ehami-badge ehami-badge--experimental"><?php esc_html_e( 'Experimental', 'ehami' ); ?></span>
     180                                                                                <a href="#" id="ehami-reset-sidebar-width" class="ehami-reset-link">
     181                                                                                        <span class="dashicons dashicons-image-rotate"></span>
     182                                                                                        <?php esc_html_e( 'Reset sidebar width', 'ehami' ); ?>
     183                                                                                </a>
     184                                                                        </p>
     185                                                                </div>
     186                                                        </fieldset>
     187                                                </td>
     188                                        </tr>
     189
     190                                        <!-- Experimental: Separators -->
     191                                        <tr>
     192                                                <th scope="row">
     193                                                        <label for="ehami_separators_mode">
     194                                                                <?php esc_html_e( 'Menu Separators', 'ehami' ); ?>
     195                                                        </label>
     196                                                </th>
     197                                                <td>
     198                                                        <fieldset class="ehami-settings__main-fieldset">
     199                                                                <legend class="screen-reader-text">
     200                                                                        <span><?php esc_html_e( 'Menu Separators', 'ehami' ); ?></span>
     201                                                                </legend>
     202
     203                                                                <div class="ehami-settings__main-field">
     204                                                                        <select id="ehami_separators_mode" name="separators_mode">
     205                                                                                <?php foreach ( $separators_options as $value => $label ) : ?>
     206                                                                                        <option
     207                                                                                                value="<?php echo esc_attr( $value ); ?>"
     208                                                                                                <?php selected( $current_separators_mode, $value ); ?>
     209                                                                                        >
     210                                                                                                <?php echo esc_html( $label ); ?>
     211                                                                                        </option>
     212                                                                                <?php endforeach; ?>
     213                                                                        </select>
     214                                                                        <span class="ehami-video-hint" data-video="separators">
     215                                                                                <span class="dashicons dashicons-video-alt3"></span>
     216                                                                        </span>
     217                                                                </div>
     218
     219                                                                <div class="ehami-settings__main-field-description">
     220                                                                        <p class="description">
     221                                                                                <?php esc_html_e( 'Control the visibility of separator lines between menu groups in the admin sidebar.', 'ehami' ); ?>
     222                                                                        </p>
     223                                                                        <p class="ehami-settings__experimental-badge">
     224                                                                                <span class="ehami-badge ehami-badge--experimental"><?php esc_html_e( 'Experimental', 'ehami' ); ?></span>
     225                                                                        </p>
     226                                                                </div>
     227                                                        </fieldset>
     228                                                </td>
     229                                        </tr>
    81230                                                </tbody>
    82231                                        </table>
    83232
    84                                         <?php submit_button( esc_html__( 'Save Settings', 'ehami' ), 'primary', 'submit_ehami_settings' ); ?>
     233                                        <div class="ehami-save-row">
     234                                                <?php submit_button( esc_html__( 'Save Settings', 'ehami' ), 'primary', 'submit_ehami_settings', false ); ?>
     235                                                <span class="ehami-inline-notice" aria-live="polite"></span>
     236                                        </div>
    85237                                </div>
    86238
    … …  
    90242                        </div>
    91243
    92                         <!-- Added a block for the author's message -->
     244                <!-- Added a block for the author's message -->
    93245                        <div id="ehami-author-info" class="stuffbox ehami-settings__author">
    94246                                <h2 class="ehami-settings__author-title"><?php esc_html_e( 'Message From the Author', 'ehami' ); ?></h2>
  • easy-hide-admin-menu-items/trunk/templates/switcher.php

    r3474229 r3783089  
    3030                <div class="ehami-block-checkbox">
    3131                        <input type="checkbox"
    32                                id="hide-icons-checkbox"
    33                                name="hide_icons_disable"
     32                                        id="hide-icons-checkbox"
     33                                        name="hide_icons_disable"
    3434                                <?php echo $hide_icons_disable ? 'checked' : ''; ?>
    3535                        />
Note: See TracChangeset for help on using the changeset viewer.