| @@ -1,120 +1,181 @@ | ||
| 1 | -<?php | |
| 2 | -// options for all pages inn backend, global | |
| 3 | -?> | |
| 4 | - | |
| 5 | - <div id="poststuff" class="ui-sortable meta-box-sortables"> | |
| 6 | - <div class="postbox"> | |
| 7 | - <div class="handlediv" title="<?php _e('Click to toggle'); ?>"><br/></div> | |
| 8 | - <h3 class="hndle" id="global_options"><?php _e('Global options', FB_ADMINIMIZE_TEXTDOMAIN ); ?></h3> | |
| 9 | - <div class="inside"> | |
| 10 | - <br class="clear" /> | |
| 11 | - | |
| 12 | - <table summary="config_edit_post" class="widefat"> | |
| 13 | - <thead> | |
| 14 | - <tr> | |
| 15 | - <th><?php _e('Option', FB_ADMINIMIZE_TEXTDOMAIN ); ?></th> | |
| 16 | - <?php | |
| 17 | - foreach ($user_roles_names as $role_name) { ?> | |
| 18 | - <th><?php _e('Deactivate for', FB_ADMINIMIZE_TEXTDOMAIN ); echo '<br/>' . $role_name; ?></th> | |
| 19 | - <?php } ?> | |
| 20 | - </tr> | |
| 21 | - </thead> | |
| 22 | - | |
| 23 | - <tbody> | |
| 24 | - <?php | |
| 25 | - foreach ($user_roles as $role) { | |
| 26 | - $disabled_global_option_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_global_option_'. $role .'_items'); | |
| 27 | - } | |
| 28 | - | |
| 29 | - $global_options = array( | |
| 30 | - '.show-admin-bar', | |
| 31 | - '#favorite-actions', | |
| 32 | - '#screen-meta', | |
| 33 | - '#screen-options, #screen-options-link-wrap', | |
| 34 | - '#contextual-help-link-wrap', | |
| 35 | - '#your-profile .form-table fieldset' | |
| 36 | - ); | |
| 37 | - | |
| 38 | - $global_options_names = array( | |
| 39 | - __('Admin Bar', FB_ADMINIMIZE_TEXTDOMAIN), | |
| 40 | - __('Favorite Actions', FB_ADMINIMIZE_TEXTDOMAIN), | |
| 41 | - __('Screen-Meta', FB_ADMINIMIZE_TEXTDOMAIN), | |
| 42 | - __('Screen Options', FB_ADMINIMIZE_TEXTDOMAIN), | |
| 43 | - __('Contextual Help', FB_ADMINIMIZE_TEXTDOMAIN), | |
| 44 | - __('Admin Color Scheme', FB_ADMINIMIZE_TEXTDOMAIN) | |
| 45 | - ); | |
| 46 | - | |
| 47 | - $_mw_adminimize_own_values = _mw_adminimize_getOptionValue('_mw_adminimize_own_values'); | |
| 48 | - $_mw_adminimize_own_values = preg_split( "/\r\n/", $_mw_adminimize_own_values ); | |
| 49 | - foreach ( (array) $_mw_adminimize_own_values as $key => $_mw_adminimize_own_value ) { | |
| 50 | - $_mw_adminimize_own_value = trim($_mw_adminimize_own_value); | |
| 51 | - array_push($global_options, $_mw_adminimize_own_value); | |
| 52 | - } | |
| 53 | - | |
| 54 | - $_mw_adminimize_own_options = _mw_adminimize_getOptionValue('_mw_adminimize_own_options'); | |
| 55 | - $_mw_adminimize_own_options = preg_split( "/\r\n/", $_mw_adminimize_own_options ); | |
| 56 | - foreach ( (array) $_mw_adminimize_own_options as $key => $_mw_adminimize_own_option ) { | |
| 57 | - $_mw_adminimize_own_option = trim($_mw_adminimize_own_option); | |
| 58 | - array_push($global_options_names, $_mw_adminimize_own_option); | |
| 59 | - } | |
| 60 | - | |
| 61 | - $x = 0; | |
| 62 | - foreach ($global_options as $index => $global_option) { | |
| 63 | - if ( $global_option != '') { | |
| 64 | - $checked_user_role_ = array(); | |
| 65 | - foreach ($user_roles as $role) { | |
| 66 | - $checked_user_role_[$role] = ( isset($disabled_global_option_[$role]) && in_array($global_option, $disabled_global_option_[$role]) ) ? ' checked="checked"' : ''; | |
| 67 | - } | |
| 68 | - echo '<tr>' . "\n"; | |
| 69 | - echo '<td>' . $global_options_names[$index] . ' <span style="color:#ccc; font-weight: 400;">(' . $global_option . ')</span> </td>' . "\n"; | |
| 70 | - foreach ($user_roles as $role) { | |
| 71 | - echo '<td class="num"><input id="check_post'. $role . $x .'" type="checkbox"' . $checked_user_role_[$role] . ' name="mw_adminimize_disabled_global_option_'. $role .'_items[]" value="' . $global_option . '" /></td>' . "\n"; | |
| 72 | - } | |
| 73 | - echo '</tr>' . "\n"; | |
| 74 | - $x++; | |
| 75 | - } | |
| 76 | - } | |
| 77 | - ?> | |
| 78 | - </tbody> | |
| 79 | - </table> | |
| 80 | - | |
| 81 | - <?php | |
| 82 | - //your own global options | |
| 83 | - ?> | |
| 84 | - <br style="margin-top: 10px;" /> | |
| 85 | - <table summary="config_edit_post" class="widefat"> | |
| 86 | - <thead> | |
| 87 | - <tr> | |
| 88 | - <th><?php _e('Your own options', FB_ADMINIMIZE_TEXTDOMAIN ); echo '<br />'; _e('ID or class', FB_ADMINIMIZE_TEXTDOMAIN ); ?></th> | |
| 89 | - <th><?php echo '<br />'; _e('Option', FB_ADMINIMIZE_TEXTDOMAIN ); ?></th> | |
| 90 | - </tr> | |
| 91 | - </thead> | |
| 92 | - | |
| 93 | - <tbody> | |
| 94 | - <tr valign="top"> | |
| 95 | - <td colspan="2"><?php _e('It is possible to add your own IDs or classes from elements and tags. You can find IDs and classes with the FireBug Add-on for Firefox. Assign a value and the associate name per line.', FB_ADMINIMIZE_TEXTDOMAIN ); ?></td> | |
| 96 | - </tr> | |
| 97 | - <tr valign="top"> | |
| 98 | - <td> | |
| 99 | - <textarea name="_mw_adminimize_own_options" cols="60" rows="3" id="_mw_adminimize_own_options" style="width: 95%;" ><?php echo _mw_adminimize_getOptionValue('_mw_adminimize_own_options'); ?></textarea> | |
| 100 | - <br /> | |
| 101 | - <?php _e('Possible nomination for ID or class. Separate multiple nominations through a carriage return.', FB_ADMINIMIZE_TEXTDOMAIN ); ?> | |
| 102 | - </td> | |
| 103 | - <td> | |
| 104 | - <textarea class="code" name="_mw_adminimize_own_values" cols="60" rows="3" id="_mw_adminimize_own_values" style="width: 95%;" ><?php echo _mw_adminimize_getOptionValue('_mw_adminimize_own_values'); ?></textarea> | |
| 105 | - <br /> | |
| 106 | - <?php _e('Possible IDs or classes. Separate multiple values through a carriage return.', FB_ADMINIMIZE_TEXTDOMAIN ); ?> | |
| 107 | - </td> | |
| 108 | - </tr> | |
| 109 | - </tbody> | |
| 110 | - </table> | |
| 111 | - | |
| 112 | - <p id="submitbutton"> | |
| 113 | - <input type="hidden" name="_mw_adminimize_action" value="_mw_adminimize_insert" /> | |
| 114 | - <input class="button button-primary" type="submit" name="_mw_adminimize_save" value="<?php _e('Update Options', FB_ADMINIMIZE_TEXTDOMAIN ); ?> »" /><input type="hidden" name="page_options" value="'dofollow_timeout'" /> | |
| 115 | - </p> | |
| 116 | - <p><a class="alignright button" href="javascript:void(0);" onclick="window.scrollTo(0,0);" style="margin:3px 0 0 30px;"><?php _e('scroll to top', FB_ADMINIMIZE_TEXTDOMAIN); ?></a><br class="clear" /></p> | |
| 117 | - | |
| 118 | - </div> | |
| 119 | - </div> | |
| 120 | - </div> | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * @package Adminimize | |
| 4 | + * @subpackage Global Options | |
| 5 | + * @author Frank Bültge | |
| 6 | + */ | |
| 7 | +if ( ! function_exists( 'add_action' ) ) { | |
| 8 | + echo "Hi there! I'm just a part of plugin, not much I can do when called directly."; | |
| 9 | + exit; | |
| 10 | +} | |
| 11 | +?> | |
| 12 | + | |
| 13 | +<div id="poststuff" class="ui-sortable meta-box-sortables"> | |
| 14 | + <div class="postbox"> | |
| 15 | + <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle' ); ?>"><br /></div> | |
| 16 | + <h3 class="hndle" id="global_options"><?php esc_attr_e( 'Global options', 'adminimize' ); ?></h3> | |
| 17 | + | |
| 18 | + <div class="inside"> | |
| 19 | + <br class="clear" /> | |
| 20 | + | |
| 21 | + <table summary="config_edit_post" class="widefat"> | |
| 22 | + <thead> | |
| 23 | + <tr> | |
| 24 | + <th><?php esc_attr_e( 'Option', 'adminimize' ); ?></th> | |
| 25 | + <?php | |
| 26 | + foreach ( $user_roles_names as $role_name ) { ?> | |
| 27 | + <th><?php esc_attr_e( 'Deactivate for', 'adminimize' ); | |
| 28 | + echo '<br/>' . $role_name; ?></th> | |
| 29 | + <?php } ?> | |
| 30 | + </tr> | |
| 31 | + <tr> | |
| 32 | + <td><?php esc_attr_e( 'Select all', 'adminimize' ); ?></td> | |
| 33 | + <?php | |
| 34 | + foreach ( $user_roles_names as $role_name ) { | |
| 35 | + $role_name = strtolower( $role_name ); | |
| 36 | + $role_name = preg_replace( '/[^a-z0-9]+/', '', $role_name ); | |
| 37 | + echo '<td class="num">'; | |
| 38 | + echo '<input id="select_all" class="global_options_' . $role_name | |
| 39 | + . '" type="checkbox" name="" value="" />'; | |
| 40 | + echo '</td>' . "\n"; | |
| 41 | + } ?> | |
| 42 | + </tr> | |
| 43 | + </thead> | |
| 44 | + | |
| 45 | + <tbody> | |
| 46 | + <?php | |
| 47 | + foreach ( $user_roles as $role ) { | |
| 48 | + $disabled_global_option_[ $role ] = _mw_adminimize_get_option_value( | |
| 49 | + 'mw_adminimize_disabled_global_option_' . $role . '_items' | |
| 50 | + ); | |
| 51 | + } | |
| 52 | + | |
| 53 | + $global_options = array( | |
| 54 | + '.show-admin-bar', | |
| 55 | + '#favorite-actions', | |
| 56 | + '#screen-meta', | |
| 57 | + '#screen-options, #screen-options-link-wrap', | |
| 58 | + '#contextual-help-link-wrap', | |
| 59 | + '#your-profile .form-table fieldset', | |
| 60 | + '.admin-notices', | |
| 61 | + ); | |
| 62 | + | |
| 63 | + $global_options_names = array( | |
| 64 | + esc_attr__( 'Admin Bar', 'adminimize' ), | |
| 65 | + esc_attr__( 'Favorite Actions', 'adminimize' ), | |
| 66 | + esc_attr__( 'Screen-Meta', 'adminimize' ), | |
| 67 | + esc_attr__( 'Screen Options', 'adminimize' ), | |
| 68 | + esc_attr__( 'Contextual Help', 'adminimize' ), | |
| 69 | + esc_attr__( 'Admin Color Scheme', 'adminimize' ), | |
| 70 | + esc_attr__( 'Admin Notices', 'adminimize' ), | |
| 71 | + ); | |
| 72 | + | |
| 73 | + $_mw_adminimize_own_values = _mw_adminimize_get_option_value( '_mw_adminimize_own_values' ); | |
| 74 | + $_mw_adminimize_own_values = preg_split( "/\r\n/", $_mw_adminimize_own_values ); | |
| 75 | + foreach ( (array) $_mw_adminimize_own_values as $key => $_mw_adminimize_own_value ) { | |
| 76 | + $_mw_adminimize_own_value = trim( $_mw_adminimize_own_value ); | |
| 77 | + $global_options[] = $_mw_adminimize_own_value; | |
| 78 | + } | |
| 79 | + | |
| 80 | + $_mw_adminimize_own_options = _mw_adminimize_get_option_value( '_mw_adminimize_own_options' ); | |
| 81 | + $_mw_adminimize_own_options = preg_split( "/\r\n/", $_mw_adminimize_own_options ); | |
| 82 | + foreach ( (array) $_mw_adminimize_own_options as $key => $_mw_adminimize_own_option ) { | |
| 83 | + $_mw_adminimize_own_option = trim( $_mw_adminimize_own_option ); | |
| 84 | + $global_options_names[] = $_mw_adminimize_own_option; | |
| 85 | + } | |
| 86 | + | |
| 87 | + $x = 0; | |
| 88 | + foreach ( $global_options as $index => $global_option ) { | |
| 89 | + | |
| 90 | + if ( empty( $global_option ) ) { | |
| 91 | + continue; | |
| 92 | + } | |
| 93 | + | |
| 94 | + $checked_user_role_ = array(); | |
| 95 | + foreach ( $user_roles as $role ) { | |
| 96 | + $checked_user_role_[ $role ] = ( isset( $disabled_global_option_[ $role ] ) | |
| 97 | + && in_array( $global_option, $disabled_global_option_[ $role ] ) ) ? ' checked="checked"' | |
| 98 | + : ''; | |
| 99 | + } | |
| 100 | + echo '<tr>' . "\n"; | |
| 101 | + echo '<td>' . $global_options_names[ $index ] . ' <span>(' . $global_option . ')</span> </td>' . "\n"; | |
| 102 | + foreach ( $user_roles as $role ) { | |
| 103 | + echo '<td class="num"><input id="check_post' . $role . $x . '" class="global_options_' | |
| 104 | + . preg_replace( '/[^a-z0-9]+/', '', $role ) . '" type="checkbox"' | |
| 105 | + . $checked_user_role_[ $role ] . ' name="mw_adminimize_disabled_global_option_' | |
| 106 | + . $role . '_items[]" value="' . $global_option . '" /></td>' . "\n"; | |
| 107 | + } | |
| 108 | + echo '</tr>' . "\n"; | |
| 109 | + $x ++; | |
| 110 | + | |
| 111 | + } | |
| 112 | + ?> | |
| 113 | + </tbody> | |
| 114 | + </table> | |
| 115 | + | |
| 116 | + <?php | |
| 117 | + //your own global options | |
| 118 | + ?> | |
| 119 | + <br style="margin-top: 10px;" /> | |
| 120 | + <table summary="config_edit_post" class="widefat"> | |
| 121 | + <thead> | |
| 122 | + <tr> | |
| 123 | + <th><?php esc_attr_e( 'Your own options', 'adminimize' ); | |
| 124 | + echo '<br />'; | |
| 125 | + esc_attr_e( 'ID or class', 'adminimize' ); ?></th> | |
| 126 | + <th><?php echo '<br />'; | |
| 127 | + esc_attr_e( 'Option', 'adminimize' ); ?></th> | |
| 128 | + </tr> | |
| 129 | + </thead> | |
| 130 | + | |
| 131 | + <tbody> | |
| 132 | + <tr valign="top"> | |
| 133 | + <td colspan="2"><?php esc_attr_e( | |
| 134 | + 'It is possible to add your own IDs or classes from elements and tags. You can find IDs and classes with the FireBug Add-on for Firefox. Assign a value and the associate name per line.', | |
| 135 | + 'adminimize' | |
| 136 | + ); ?></td> | |
| 137 | + </tr> | |
| 138 | + <tr valign="top"> | |
| 139 | + <td> | |
| 140 | + <textarea name="_mw_adminimize_own_options" cols="60" rows="3" | |
| 141 | + id="_mw_adminimize_own_options" style="width: 95%;"><?php echo _mw_adminimize_get_option_value( | |
| 142 | + '_mw_adminimize_own_options' | |
| 143 | + ); ?></textarea> | |
| 144 | + <br /> | |
| 145 | + <?php esc_attr_e( | |
| 146 | + 'Possible nomination for ID or class. Separate multiple nominations through a carriage return.', | |
| 147 | + 'adminimize' | |
| 148 | + ); ?> | |
| 149 | + </td> | |
| 150 | + <td> | |
| 151 | + <textarea class="code" name="_mw_adminimize_own_values" cols="60" rows="3" | |
| 152 | + id="_mw_adminimize_own_values" style="width: 95%;"><?php echo _mw_adminimize_get_option_value( | |
| 153 | + '_mw_adminimize_own_values' | |
| 154 | + ); ?></textarea> | |
| 155 | + <br /> | |
| 156 | + <?php esc_attr_e( | |
| 157 | + 'Possible IDs or classes. Separate multiple values through a carriage return.', 'adminimize' | |
| 158 | + ); ?> | |
| 159 | + </td> | |
| 160 | + </tr> | |
| 161 | + </tbody> | |
| 162 | + </table> | |
| 163 | + | |
| 164 | + <p id="submitbutton"> | |
| 165 | + <input type="hidden" name="_mw_adminimize_action" value="_mw_adminimize_insert" /> | |
| 166 | + <input class="button button-primary" type="submit" name="_mw_adminimize_save" value="<?php esc_attr_e( | |
| 167 | + 'Update Options', 'adminimize' | |
| 168 | + ); ?> »" /><input type="hidden" name="page_options" value="'dofollow_timeout'" /> | |
| 169 | + </p> | |
| 170 | + | |
| 171 | + <p> | |
| 172 | + <a class="alignright button" href="javascript:void(0);" onclick="window.scrollTo(0,0);" | |
| 173 | + style="margin:3px 0 0 30px;"><?php esc_attr_e( | |
| 174 | + 'scroll to top', 'adminimize' | |
| 175 | + ); ?></a> | |
| 176 | + <br class="clear" /> | |
| 177 | + </p> | |
| 178 | + | |
| 179 | + </div> | |
| 180 | + </div> | |
| 181 | +</div> | |