| @@ -1,14 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Adminimize | |
| 4 | - * @subpackage Settings page | |
| 5 | - * @author Frank Bültge | |
| 3 | + * options-page in wp-admin | |
| 6 | 4 | */ |
| 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 | 5 | |
| 12 | 6 | // export options |
| 13 | 7 | if ( isset( $_GET['_mw_adminimize_export'] ) ) { |
| 14 | 8 | _mw_adminimize_export(); |
| @@ -22,10 +16,10 @@ | ||
| 22 | 16 | |
| 23 | 17 | $_mw_adminimize_user_info = ''; |
| 24 | 18 | |
| 25 | 19 | //get array with userroles |
| 26 | - $user_roles = _mw_adminimize_get_all_user_roles(); | |
| 27 | - $user_roles_names = _mw_adminimize_get_all_user_roles_names(); | |
| 20 | + $user_roles = get_all_user_roles(); | |
| 21 | + $user_roles_names = get_all_user_roles_names(); | |
| 28 | 22 | |
| 29 | 23 | // update options |
| 30 | 24 | if ( ( isset($_POST['_mw_adminimize_action']) && $_POST['_mw_adminimize_action'] == '_mw_adminimize_insert') && $_POST['_mw_adminimize_save'] ) { |
| 31 | 25 | |
| @@ -30,11 +24,11 @@ | ||
| 30 | 24 | if ( ( isset($_POST['_mw_adminimize_action']) && $_POST['_mw_adminimize_action'] == '_mw_adminimize_insert') && $_POST['_mw_adminimize_save'] ) { |
| 31 | 25 | |
| 32 | 26 | if ( function_exists('current_user_can') && current_user_can('manage_options') ) { |
| 33 | 27 | check_admin_referer('mw_adminimize_nonce'); |
| 34 | - | |
| 28 | + | |
| 35 | 29 | _mw_adminimize_update(); |
| 36 | - | |
| 30 | + | |
| 37 | 31 | } else { |
| 38 | 32 | $myErrors = new _mw_adminimize_message_class(); |
| 39 | 33 | $myErrors = '<div id="message" class="error"><p>' . $myErrors->get_error('_mw_adminimize_access_denied') . '</p></div>'; |
| 40 | 34 | wp_die($myErrors); |
| @@ -134,31 +128,196 @@ | ||
| 134 | 128 | |
| 135 | 129 | // Write Page Options |
| 136 | 130 | require_once('inc-options/write_page_options.php'); |
| 137 | 131 | |
| 138 | - // Custom Post Type | |
| 139 | - if ( function_exists( 'get_post_types' ) ) | |
| 140 | - require_once('inc-options/write_cp_options.php'); | |
| 141 | - | |
| 142 | 132 | // Links Options |
| 143 | 133 | require_once('inc-options/links_options.php'); |
| 144 | - | |
| 134 | + | |
| 145 | 135 | // WP Nav Menu Options |
| 146 | 136 | require_once('inc-options/wp_nav_menu_options.php'); |
| 147 | 137 | ?> |
| 148 | 138 | </form> |
| 149 | 139 | |
| 150 | - <?php | |
| 151 | - // Theme Options | |
| 152 | - require_once('inc-options/theme_options.php'); | |
| 140 | + <div id="poststuff" class="ui-sortable meta-box-sortables"> | |
| 141 | + <div class="postbox"> | |
| 142 | + <div class="handlediv" title="<?php _e('Click to toggle'); ?>"><br/></div> | |
| 143 | + <h3 class="hndle" id="set_theme"><?php _e('Set Theme', FB_ADMINIMIZE_TEXTDOMAIN ) ?></h3> | |
| 144 | + <div class="inside"> | |
| 145 | + <br class="clear" /> | |
| 146 | + | |
| 147 | + <?php if ( !isset($_POST['_mw_adminimize_action']) || !($_POST['_mw_adminimize_action'] == '_mw_adminimize_load_theme') ) { ?> | |
| 148 | + <form name="set_theme" method="post" id="_mw_adminimize_set_theme" action="?page=<?php echo $_GET['page'];?>" > | |
| 149 | + <?php wp_nonce_field('mw_adminimize_nonce'); ?> | |
| 150 | + <p><?php _e('For better peformance with many users on your blog; load only userlist, when you will change the theme options for users.', FB_ADMINIMIZE_TEXTDOMAIN ); ?></p> | |
| 151 | + <p id="submitbutton"> | |
| 152 | + <input type="hidden" name="_mw_adminimize_action" value="_mw_adminimize_load_theme" /> | |
| 153 | + <input type="submit" name="_mw_adminimize_load" value="<?php _e('Load User Data', FB_ADMINIMIZE_TEXTDOMAIN ); ?> »" class="button button-primary" /> | |
| 154 | + </p> | |
| 155 | + </form> | |
| 156 | + <?php } | |
| 157 | + if ( isset($_POST['_mw_adminimize_action']) && ($_POST['_mw_adminimize_action'] == '_mw_adminimize_load_theme') ) { ?> | |
| 158 | + <form name="set_theme" method="post" id="_mw_adminimize_set_theme" action="?page=<?php echo $_GET['page'];?>" > | |
| 159 | + <?php wp_nonce_field('mw_adminimize_nonce'); ?> | |
| 160 | + <table class="widefat"> | |
| 161 | + <thead> | |
| 162 | + <tr class="thead"> | |
| 163 | + <th> </th> | |
| 164 | + <th class="num"><?php _e('User-ID') ?></th> | |
| 165 | + <th><?php _e('Username') ?></th> | |
| 166 | + <th><?php _e('Display name publicly as') ?></th> | |
| 167 | + <th><?php _e('Admin-Color Scheme') ?></th> | |
| 168 | + <th><?php _e('User Level') ?></th> | |
| 169 | + <th><?php _e('Role') ?></th> | |
| 170 | + </tr> | |
| 171 | + </thead> | |
| 172 | + <tbody id="users" class="list:user user-list"> | |
| 173 | + <?php | |
| 174 | + $wp_user_search = $wpdb->get_results("SELECT ID, user_login, display_name FROM $wpdb->users ORDER BY ID"); | |
| 175 | + | |
| 176 | + $style = ''; | |
| 177 | + foreach ( $wp_user_search as $userid ) { | |
| 178 | + $user_id = (int) $userid->ID; | |
| 179 | + $user_login = stripslashes($userid->user_login); | |
| 180 | + $display_name = stripslashes($userid->display_name); | |
| 181 | + $current_color = get_user_option('admin_color', $user_id); | |
| 182 | + $user_level = (int) get_user_option($table_prefix . 'user_level', $user_id); | |
| 183 | + $user_object = new WP_User($user_id); | |
| 184 | + $roles = $user_object->roles; | |
| 185 | + $role = array_shift($roles); | |
| 186 | + if ( function_exists('translate_user_role') ) | |
| 187 | + $role_name = translate_user_role( $wp_roles->role_names[$role] ); | |
| 188 | + elseif ( function_exists('before_last_bar') ) | |
| 189 | + $role_name = before_last_bar( $wp_roles->role_names[$role], 'User role' ); | |
| 190 | + else | |
| 191 | + $role_name = strrpos( $wp_roles->role_names[$role], '|' ); | |
| 192 | + | |
| 193 | + $style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"'; | |
| 194 | + $return = ''; | |
| 195 | + $return .= '<tr>' . "\n"; | |
| 196 | + $return .= "\t" . '<td><input type="checkbox" name="mw_adminimize_theme_items[]" value="' . $user_id . '" /></td>' . "\n"; | |
| 197 | + $return .= "\t" . '<td class="num">'. $user_id .'</td>' . "\n"; | |
| 198 | + $return .= "\t" . '<td>'. $user_login .'</td>' . "\n"; | |
| 199 | + $return .= "\t" . '<td>'. $display_name .'</td>' . "\n"; | |
| 200 | + $return .= "\t" . '<td>'. $current_color . '</td>' . "\n"; | |
| 201 | + $return .= "\t" . '<td class="num">'. $user_level . '</td>' . "\n"; | |
| 202 | + $return .= "\t" . '<td>'. $role_name . '</td>' . "\n"; | |
| 203 | + $return .= '</tr>' . "\n"; | |
| 204 | + | |
| 205 | + echo $return; | |
| 206 | + } | |
| 207 | + ?> | |
| 208 | + <tr valign="top"> | |
| 209 | + <td> </td> | |
| 210 | + <td> </td> | |
| 211 | + <td> </td> | |
| 212 | + <td> </td> | |
| 213 | + <td> | |
| 214 | + <select name="_mw_adminimize_set_theme"> | |
| 215 | + <?php foreach ( $_wp_admin_css_colors as $color => $color_info ): ?> | |
| 216 | + <option value="<?php echo $color; ?>"><?php echo $color_info->name . ' (' . $color . ')' ?></option> | |
| 217 | + <?php endforeach; ?> | |
| 218 | + </select> | |
| 219 | + </td> | |
| 220 | + <td> </td> | |
| 221 | + <td> </td> | |
| 222 | + </tr> | |
| 223 | + </tbody> | |
| 224 | + </table> | |
| 225 | + <p id="submitbutton"> | |
| 226 | + <input type="hidden" name="_mw_adminimize_action" value="_mw_adminimize_set_theme" /> | |
| 227 | + <input type="hidden" name="_mw_adminimize_load" value="_mw_adminimize_load_theme" /> | |
| 228 | + <input type="submit" name="_mw_adminimize_save" value="<?php _e('Set Theme', FB_ADMINIMIZE_TEXTDOMAIN ); ?> »" class="button button-primary" /> | |
| 229 | + </p> | |
| 230 | + </form> | |
| 231 | + <?php } ?> | |
| 232 | + | |
| 233 | + <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> | |
| 234 | + </div> | |
| 235 | + </div> | |
| 236 | + </div> | |
| 153 | 237 | |
| 154 | - // Im/Export Options | |
| 155 | - require_once('inc-options/im_export_options.php'); | |
| 156 | - | |
| 157 | - // deinstall options | |
| 158 | - require_once('inc-options/deinstall_options.php'); | |
| 159 | - ?> | |
| 160 | - | |
| 238 | + <div id="poststuff" class="ui-sortable meta-box-sortables"> | |
| 239 | + <div class="postbox"> | |
| 240 | + <div class="handlediv" title="<?php _e('Click to toggle'); ?>"><br/></div> | |
| 241 | + <h3 class="hndle" id="import"><?php _e('Export/Import Options', FB_ADMINIMIZE_TEXTDOMAIN ) ?></h3> | |
| 242 | + <div class="inside"> | |
| 243 | + <br class="clear" /> | |
| 244 | + | |
| 245 | + <h4><?php _e('Export', FB_ADMINIMIZE_TEXTDOMAIN ) ?></h4> | |
| 246 | + <form name="export_options" method="get" action=""> | |
| 247 | + <p><?php _e('You can save a .seq file with your options.', FB_ADMINIMIZE_TEXTDOMAIN ) ?></p> | |
| 248 | + <p id="submitbutton"> | |
| 249 | + <input type="hidden" name="_mw_adminimize_export" value="true" /> | |
| 250 | + <input type="submit" name="_mw_adminimize_save" value="<?php _e('Export »', FB_ADMINIMIZE_TEXTDOMAIN ) ?>" class="button" /> | |
| 251 | + </p> | |
| 252 | + </form> | |
| 253 | + | |
| 254 | + <h4><?php _e('Import', FB_ADMINIMIZE_TEXTDOMAIN ) ?></h4> | |
| 255 | + <form name="import_options" enctype="multipart/form-data" method="post" action="?page=<?php echo $_GET['page'];?>"> | |
| 256 | + <?php wp_nonce_field('mw_adminimize_nonce'); ?> | |
| 257 | + <p><?php _e('Choose a Adminimize (<em>.seq</em>) file to upload, then click <em>Upload file and import</em>.', FB_ADMINIMIZE_TEXTDOMAIN ) ?></p> | |
| 258 | + <p> | |
| 259 | + <label for="datei_id"><?php _e('Choose a file from your computer', FB_ADMINIMIZE_TEXTDOMAIN ) ?>: </label> | |
| 260 | + <input name="datei" id="datei_id" type="file" /> | |
| 261 | + </p> | |
| 262 | + <p id="submitbutton"> | |
| 263 | + <input type="hidden" name="_mw_adminimize_action" value="_mw_adminimize_import" /> | |
| 264 | + <input type="submit" name="_mw_adminimize_save" value="<?php _e('Upload file and import »', FB_ADMINIMIZE_TEXTDOMAIN ) ?>" class="button" /> | |
| 265 | + </p> | |
| 266 | + </form> | |
| 267 | + <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> | |
| 268 | + | |
| 269 | + </div> | |
| 270 | + </div> | |
| 271 | + </div> | |
| 272 | + | |
| 273 | + <div id="poststuff" class="ui-sortable meta-box-sortables"> | |
| 274 | + <div class="postbox"> | |
| 275 | + <div class="handlediv" title="<?php _e('Click to toggle'); ?>"><br/></div> | |
| 276 | + <h3 class="hndle" id="uninstall"><?php _e('Deinstall Options', FB_ADMINIMIZE_TEXTDOMAIN ) ?></h3> | |
| 277 | + <div class="inside"> | |
| 278 | + | |
| 279 | + <p><?php _e('Use this option for clean your database from all entries of this plugin. When you deactivate the plugin, the deinstall of the plugin <strong>clean not</strong> all entries in the database.', FB_ADMINIMIZE_TEXTDOMAIN ); ?></p> | |
| 280 | + <form name="deinstall_options" method="post" id="_mw_adminimize_options_deinstall" action="?page=<?php echo $_GET['page'];?>"> | |
| 281 | + <?php wp_nonce_field('mw_adminimize_nonce'); ?> | |
| 282 | + <p id="submitbutton"> | |
| 283 | + <input type="submit" name="_mw_adminimize_deinstall" value="<?php _e('Delete Options', FB_ADMINIMIZE_TEXTDOMAIN ); ?> »" class="button-secondary" /> | |
| 284 | + <input type="checkbox" name="_mw_adminimize_deinstall_yes" value="_mw_adminimize_deinstall" /> | |
| 285 | + <input type="hidden" name="_mw_adminimize_action" value="_mw_adminimize_deinstall" /> | |
| 286 | + </p> | |
| 287 | + </form> | |
| 288 | + <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> | |
| 289 | + | |
| 290 | + </div> | |
| 291 | + </div> | |
| 292 | + </div> | |
| 293 | + | |
| 294 | + <div id="poststuff" class="ui-sortable meta-box-sortables"> | |
| 295 | + <div class="postbox" > | |
| 296 | + <div class="handlediv" title="<?php _e('Click to toggle'); ?>"><br/></div> | |
| 297 | + <h3 class="hndle" id="about"><?php _e('About the plugin', FB_ADMINIMIZE_TEXTDOMAIN ) ?></h3> | |
| 298 | + <div class="inside"> | |
| 299 | + | |
| 300 | + <p><?php _e('Further information: Visit the <a href="http://bueltge.de/wordpress-admin-theme-adminimize/674/">plugin homepage</a> for further information or to grab the latest version of this plugin.', FB_ADMINIMIZE_TEXTDOMAIN); ?></p> | |
| 301 | + <p> | |
| 302 | + <span style="float: left;"> | |
| 303 | + <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> | |
| 304 | + <input type="hidden" name="cmd" value="_s-xclick"> | |
| 305 | + <input type="hidden" name="hosted_button_id" value="4578111"> | |
| 306 | + <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="<?php _e('PayPal - The safer, easier way to pay online!', FB_ADMINIMIZE_TEXTDOMAIN); ?>"> | |
| 307 | + <img alt="" border="0" src="https://www.paypal.com/de_DE/i/scr/pixel.gif" width="1" height="1"> | |
| 308 | + </form> | |
| 309 | + </span> | |
| 310 | + <?php _e('You want to thank me? Visit my <a href="http://bueltge.de/wunschliste/">wishlist</a> or donate.', FB_ADMINIMIZE_TEXTDOMAIN); ?> | |
| 311 | + </p> | |
| 312 | + <p>© Copyright 2008 - <?php echo date('Y'); ?> <a href="http://bueltge.de">Frank Bültge</a></p> | |
| 313 | + <p class="textright" style="color:#ccc"><small><?php echo $wpdb->num_queries; ?>q, <?php timer_stop(1); ?>s</small></p> | |
| 314 | + <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> | |
| 315 | + | |
| 316 | + </div> | |
| 317 | + </div> | |
| 318 | + </div> | |
| 319 | + | |
| 161 | 320 | <script type="text/javascript"> |
| 162 | 321 | <!-- |
| 163 | 322 | <?php if ( version_compare( $wp_version, '2.7alpha', '<' ) ) { ?> |
| 164 | 323 | jQuery('.postbox h3').prepend('<a class="togbox">+</a> '); |