| @@ -8,17 +8,12 @@ | ||
| 8 | 8 | if ( ! function_exists( 'add_action' ) ) { |
| 9 | 9 | die( "Hi there! I'm just a part of plugin, not much I can do when called directly." ); |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | -/** @var $wp_admin_bar WP_Admin_Bar */ | |
| 13 | 12 | if ( ! isset( $wp_admin_bar ) ) { |
| 14 | 13 | $wp_admin_bar = ''; |
| 15 | 14 | } |
| 16 | 15 | |
| 17 | -if ( ! isset( $user_roles ) ) { | |
| 18 | - $user_roles = _mw_adminimize_get_all_user_roles(); | |
| 19 | -} | |
| 20 | - | |
| 21 | 16 | if ( ! isset( $user_roles_names ) ) { |
| 22 | 17 | $user_roles_names = _mw_adminimize_get_all_user_roles_names(); |
| 23 | 18 | } |
| 24 | 19 | ?> |
| @@ -23,11 +18,11 @@ | ||
| 23 | 18 | } |
| 24 | 19 | ?> |
| 25 | 20 | <div id="poststuff" class="ui-sortable meta-box-sortables"> |
| 26 | 21 | <div class="postbox"> |
| 27 | - <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'adminimize' ); ?>"><br /></div> | |
| 28 | - <h3 class="hndle" id="admin_bar_options" title="<?php esc_attr_e( 'Click to toggle', 'adminimize' ); ?>"><?php | |
| 29 | - esc_attr_e( 'Admin Bar Back end Options', 'adminimize' ); ?></h3> | |
| 22 | + <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle' ); ?>"><br /></div> | |
| 23 | + <h3 class="hndle" id="admin_bar_options" title="<?php esc_attr_e( 'Click to toggle' ); ?>"><?php | |
| 24 | + esc_attr_e( 'Admin Bar Back end options', 'adminimize' ); ?></h3> | |
| 30 | 25 | |
| 31 | 26 | <div class="inside"> |
| 32 | 27 | <br class="clear" /> |
| 33 | 28 | |
| @@ -52,11 +47,12 @@ | ||
| 52 | 47 | </tr> |
| 53 | 48 | <tr> |
| 54 | 49 | <td><?php esc_attr_e( 'Select all', 'adminimize' ); ?></td> |
| 55 | 50 | <?php |
| 56 | - foreach ( $user_roles as $role_slug ) { | |
| 51 | + foreach ( $user_roles_names as $role_name ) { | |
| 52 | + $role_name = strtolower( $role_name ); | |
| 57 | 53 | echo '<td class="num">'; |
| 58 | - echo '<input id="select_all" class="admin_bar_' . $role_slug | |
| 54 | + echo '<input id="select_all" class="admin_bar_' . $role_name | |
| 59 | 55 | . '" type="checkbox" name="" value="" />'; |
| 60 | 56 | echo '</td>' . "\n"; |
| 61 | 57 | } ?> |
| 62 | 58 | </tr> |
| @@ -82,18 +78,19 @@ | ||
| 82 | 78 | foreach ( $admin_bar_items as $key => $value ) { |
| 83 | 79 | |
| 84 | 80 | $is_parent = ! empty( $value->parent ); |
| 85 | 81 | $has_link = ! empty( $value->href ); |
| 86 | - | |
| 87 | 82 | // No title on the item. |
| 88 | 83 | if ( ! $value->title ) { |
| 89 | 84 | $value->title = '<b><i>' . esc_attr__( 'No Title!', 'adminimize' ) . '</i></b>'; |
| 90 | 85 | } |
| 91 | 86 | |
| 87 | + $item_class = ' class="form-invalid"'; | |
| 92 | 88 | $item_string = '• '; |
| 93 | 89 | $before_title = '<b>'; |
| 94 | 90 | $after_title = '</b> <small>' . esc_attr__( 'Group', 'adminimize' ) . '</small>'; |
| 95 | 91 | if ( $is_parent ) { |
| 92 | + $item_class = ''; | |
| 96 | 93 | $item_string = '— '; |
| 97 | 94 | $before_title = ''; |
| 98 | 95 | $after_title = ''; |
| 99 | 96 | } |
| @@ -101,14 +98,14 @@ | ||
| 101 | 98 | $checked_user_role_ = array(); |
| 102 | 99 | foreach ( $user_roles as $role ) { |
| 103 | 100 | $checked_user_role_[ $role ] = ( isset( $disabled_admin_bar_option_[ $role ] ) |
| 104 | 101 | && in_array( |
| 105 | - $key, $disabled_admin_bar_option_[ $role ], FALSE | |
| 102 | + $key, $disabled_admin_bar_option_[ $role ] | |
| 106 | 103 | ) |
| 107 | 104 | ) ? ' checked="checked"' : ''; |
| 108 | 105 | } |
| 109 | 106 | |
| 110 | - echo '<tr>' . "\n"; | |
| 107 | + echo '<tr' . $item_class . '>' . "\n"; | |
| 111 | 108 | echo '<td>'. $before_title . $item_string . strip_tags( $value->title, '<strong><b><em><i>' ) |
| 112 | 109 | . $after_title . ' <span>(' . $key . ')</span> </td>' . "\n"; |
| 113 | 110 | foreach ( $user_roles as $role ) { |
| 114 | 111 | echo '<td class="num"><input id="check_post' . $role . $x . '" class="admin_bar_' |
| @@ -118,11 +115,12 @@ | ||
| 118 | 115 | } |
| 119 | 116 | echo '</tr>' . "\n"; |
| 120 | 117 | $x ++; |
| 121 | 118 | } |
| 119 | + } else { | |
| 120 | + $message = '<span style="font-size: 35px;">☝</span>' | |
| 121 | + . esc_attr__( 'Switch to another back-end page and come back to update the options to get all items of the admin bar in the back end area.', 'adminimize' ); | |
| 122 | 122 | } |
| 123 | - $message = '<span style="font-size: 35px;">☝</span>' | |
| 124 | - . esc_attr__( 'Switch to another back-end page and come back to update the options to get all items of the admin bar in the back end area.', 'adminimize' ); | |
| 125 | 123 | ?> |
| 126 | 124 | </tbody> |
| 127 | 125 | </table> |
| 128 | 126 | |