PluginProbe
Adminimize / 1.7.15
Adminimize v1.7.15
1.11.14 1.11.13 1.11.1 1.11.10 1.11.11 1.11.12 1.11.2 1.11.3 1.11.4 1.11.5 1.11.6 1.11.7 1.11.8 1.11.9 1.3 1.4.7 1.6 1.7.12 1.7.13 1.7.14 1.7.15 1.7.16 1.7.17 1.7.18 1.7.19 All 53 releases
adminimize / adminimize.php

adminimize.php in Adminimize 1.7.15, at adminimize.php

1,638 lines 57.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package Adminimize
4 * @author Frank B&uuml;ltge
5 */
6
7 /*
8 Plugin Name: Adminimize
9 Plugin URI: http://bueltge.de/wordpress-admin-theme-adminimize/674/
10 Text Domain: adminimize
11 Domain Path: /languages
12 Description: Visually compresses the administratrive meta-boxes so that more admin page content can be initially seen. The plugin that lets you hide 'unnecessary' items from the WordPress administration menu, for alle roles of your install. You can also hide post meta controls on the edit-area to simplify the interface. It is possible to simplify the admin in different for all roles.
13 Author: Frank B&uuml;ltge
14 Author URI: http://bueltge.de/
15 Version: 1.7.15
16 License: GPL
17 */
18
19 /**
20 * The stylesheet and the initial idea is from Eric A. Meyer, http://meyerweb.com/
21 * and i have written a plugin with many options on the basis
22 * of differently user-right and a user-friendly range in admin-area.
23 */
24
25
26 global $wp_version;
27 if ( !function_exists ('add_action') || version_compare($wp_version, "2.5alpha", "<") ) {
28 if ( function_exists ('add_action') )
29 $exit_msg = 'The plugin <em><a href="http://bueltge.de/wordpress-admin-theme-adminimize/674/">Adminimize</a></em> requires WordPress 2.5 or newer. <a href="http://codex.wordpress.org/Upgrading_WordPress">Please update WordPress</a> or delete the plugin.';
30 else
31 $exit_msg = '';
32
33 header('Status: 403 Forbidden');
34 header('HTTP/1.1 403 Forbidden');
35 exit($exit_msg);
36 }
37
38 if ( function_exists('add_action') ) {
39
40 // Pre-2.6 compatibility
41 if ( !defined( 'WP_CONTENT_URL' ) )
42 define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content' );
43 if ( !defined( 'WP_CONTENT_DIR' ) )
44 define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
45 if ( !defined( 'WP_PLUGIN_URL' ) )
46 define( 'WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins' );
47 if ( !defined( 'WP_PLUGIN_DIR' ) )
48 define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );
49
50 // plugin definitions
51 define( 'FB_ADMINIMIZE_BASENAME', plugin_basename( __FILE__ ) );
52 define( 'FB_ADMINIMIZE_BASEFOLDER', plugin_basename( dirname( __FILE__ ) ) );
53 define( 'FB_ADMINIMIZE_TEXTDOMAIN', 'adminimize' );
54 }
55
56 function _mw_adminimize_textdomain() {
57
58 load_plugin_textdomain( FB_ADMINIMIZE_TEXTDOMAIN, FALSE, dirname( FB_ADMINIMIZE_BASENAME ) . '/languages');
59 }
60
61
62 function _mw_adminimize_register_styles() {
63
64 wp_register_style( 'adminimize-style', plugins_url( 'css/style.css', __FILE__ ) );
65 }
66
67
68 function recursive_in_array($needle, $haystack) {
69
70 if ( '' != $haystack ) {
71 foreach ($haystack as $stalk) {
72 if ( $needle == $stalk || ( is_array($stalk) && recursive_in_array($needle, $stalk) ) ) {
73 return TRUE;
74 }
75 }
76 return FALSE;
77 }
78 }
79
80
81 /**
82 * some basics for message
83 */
84 class _mw_adminimize_message_class {
85
86 /**
87 * constructor
88 */
89 function _mw_adminimize_message_class() {
90 $this->localizionName = FB_ADMINIMIZE_TEXTDOMAIN;
91 $this->errors = new WP_Error();
92 $this->initialize_errors();
93 }
94
95 /**
96 * get_error - Returns an error message based on the passed code
97 * Parameters - $code (the error code as a string)
98 * @return Returns an error message
99 */
100 function get_error($code = '') {
101 $errorMessage = $this->errors->get_error_message($code);
102 if ($errorMessage == NULL) {
103 return __("Unknown error.", $this->localizionName);
104 }
105 return $errorMessage;
106 }
107
108 /**
109 * Initializes all the error messages
110 */
111 function initialize_errors() {
112 $this->errors->add('_mw_adminimize_update', __('The updates were saved.', $this->localizionName));
113 $this->errors->add('_mw_adminimize_access_denied', __('You have not enough rights to edit entries in the database.', $this->localizionName));
114 $this->errors->add('_mw_adminimize_import', __('All entries in the database were imported.', $this->localizionName));
115 $this->errors->add('_mw_adminimize_deinstall', __('All entries in the database were deleted.', $this->localizionName));
116 $this->errors->add('_mw_adminimize_deinstall_yes', __('Set the checkbox on deinstall-button.', $this->localizionName));
117 $this->errors->add('_mw_adminimize_get_option', __('Can\'t load menu and submenu.', $this->localizionName));
118 $this->errors->add('_mw_adminimize_set_theme', __('Backend-Theme was activated!', $this->localizionName));
119 $this->errors->add('_mw_adminimize_load_theme', __('Load user data to themes was successful.', $this->localizionName));
120 }
121 }
122
123
124 function _mw_adminimize_exclude_super_admin() {
125 // exclude super admin
126 if ( function_exists('is_super_admin')
127 && is_super_admin()
128 && 1 == _mw_adminimize_getOptionValue('_mw_adminimize_exclude_super_admin')
129 )
130 return TRUE;
131
132 return FALSE;
133 }
134
135
136 /**
137 * get_all_user_roles() - Returns an array with all user roles(names) in it.
138 * Inclusive self defined roles (for example with the 'Role Manager' plugin).
139 * code by Vincent Weber, www.webRtistik.nl
140 * @uses $wp_roles
141 * @return $user_roles
142 */
143 function get_all_user_roles() {
144 global $wp_roles;
145
146 $user_roles = array();
147
148 if ( isset($wp_roles->roles) && is_array($wp_roles->roles) ) {
149 foreach ($wp_roles->roles as $role => $data) {
150 array_push($user_roles, $role);
151 //$data contains caps, maybe for later use..
152 }
153 }
154
155 return $user_roles;
156 }
157
158
159 /**
160 * get_all_user_roles_names() - Returns an array with all user roles_names in it.
161 * Inclusive self defined roles (for example with the 'Role Manager' plugin).
162 * @uses $wp_roles
163 * @return $user_roles_names
164 */
165 function get_all_user_roles_names() {
166 global $wp_roles;
167
168 $user_roles_names = array();
169
170 foreach ($wp_roles->role_names as $role_name => $data) {
171 if ( function_exists('translate_user_role') )
172 $data = translate_user_role( $data );
173 else
174 $data = translate_with_context( $data );
175
176 array_push($user_roles_names, $data );
177 }
178
179 return $user_roles_names;
180 }
181
182 /**
183 * Control Flash Uploader
184 *
185 * @return boolean
186 */
187 function _mw_adminimize_control_flashloader() {
188
189 $_mw_adminimize_control_flashloader = _mw_adminimize_getOptionValue('_mw_adminimize_control_flashloader');
190
191 if ($_mw_adminimize_control_flashloader == '1') {
192 return FALSE;
193 } else {
194 return TRUE;
195 }
196 }
197
198
199 /**
200 * check user-option and add new style
201 * @uses $pagenow
202 */
203 function _mw_adminimize_init() {
204 global $pagenow, $menu, $submenu, $adminimizeoptions, $wp_version;
205
206 if ( function_exists('get_post_type_object') ) {
207 if ( isset($_GET['post']) )
208 $post_id = (int) $_GET['post'];
209 elseif ( isset($_POST['post_ID']) )
210 $post_id = (int) $_POST['post_ID'];
211 else
212 $post_id = 0;
213 $post_ID = $post_id;
214 $post = NULL;
215 $post_type_object = NULL;
216 $post_type = NULL;
217 if ( $post_id ) {
218 $post = get_post($post_id);
219 if ( $post ) {
220 $post_type_object = get_post_type_object($post->post_type);
221 if ( $post_type_object ) {
222 $post_type = $post->post_type;
223 $current_screen->post_type = $post->post_type;
224 $current_screen->id = $current_screen->post_type;
225 }
226 }
227 } elseif ( isset($_POST['post_type']) ) {
228 $post_type_object = get_post_type_object($_POST['post_type']);
229 if ( $post_type_object ) {
230 $post_type = $post_type_object->name;
231 $current_screen->post_type = $post_type;
232 $current_screen->id = $current_screen->post_type;
233 }
234 }
235 } else {
236 $post_type = '';
237 }
238
239 $user_roles = get_all_user_roles();
240
241 $adminimizeoptions = get_option('mw_adminimize');
242
243 foreach ($user_roles as $role) {
244 $disabled_global_option_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_global_option_'. $role .'_items');
245 $disabled_metaboxes_post_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_metaboxes_post_'. $role .'_items');
246 $disabled_metaboxes_page_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_metaboxes_page_'. $role .'_items');
247 $disabled_link_option_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_link_option_'. $role .'_items');
248 $disabled_nav_menu_option_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_nav_menu_option_'. $role .'_items');
249 }
250
251 $disabled_metaboxes_post_all = array();
252 $disabled_metaboxes_page_all = array();
253
254 foreach ($user_roles as $role) {
255 array_push($disabled_metaboxes_post_all, $disabled_metaboxes_post_[$role]);
256 array_push($disabled_metaboxes_page_all, $disabled_metaboxes_page_[$role]);
257 }
258
259 $_mw_admin_color = get_user_option('admin_color');
260
261 //global options
262 // exclude super admin
263 if ( ! _mw_adminimize_exclude_super_admin() ) {
264 $_mw_adminimize_footer = _mw_adminimize_getOptionValue('_mw_adminimize_footer');
265 switch ($_mw_adminimize_footer) {
266 case 1:
267 wp_enqueue_script( '_mw_adminimize_remove_footer', WP_PLUGIN_URL . '/' . FB_ADMINIMIZE_BASEFOLDER . '/js/remove_footer.js', array('jquery') );
268 break;
269 }
270
271 $_mw_adminimize_header = _mw_adminimize_getOptionValue('_mw_adminimize_header');
272 switch ($_mw_adminimize_header) {
273 case 1:
274 wp_enqueue_script( '_mw_adminimize_remove_header', WP_PLUGIN_URL . '/' . FB_ADMINIMIZE_BASEFOLDER . '/js/remove_header.js', array('jquery') );
275 break;
276 }
277
278 //post-page options
279 $post_page_pages = array('post-new.php', 'post.php', 'page-new.php', 'page.php');
280 if ( in_array( $pagenow, $post_page_pages ) ) {
281
282 $_mw_adminimize_writescroll = _mw_adminimize_getOptionValue('_mw_adminimize_writescroll');
283 switch ($_mw_adminimize_writescroll) {
284 case 1:
285 wp_enqueue_script( '_mw_adminimize_writescroll', WP_PLUGIN_URL . '/' . FB_ADMINIMIZE_BASEFOLDER . '/js/writescroll.js', array('jquery') );
286 break;
287 }
288 $_mw_adminimize_tb_window = _mw_adminimize_getOptionValue('_mw_adminimize_tb_window');
289 switch ($_mw_adminimize_tb_window) {
290 case 1:
291 wp_deregister_script('media-upload');
292 wp_enqueue_script('media-upload', WP_PLUGIN_URL . '/' . FB_ADMINIMIZE_BASEFOLDER . '/js/tb_window.js', array('thickbox'));
293 break;
294 }
295 $_mw_adminimize_timestamp = _mw_adminimize_getOptionValue('_mw_adminimize_timestamp');
296 switch ($_mw_adminimize_timestamp) {
297 case 1:
298 wp_enqueue_script( '_mw_adminimize_timestamp', WP_PLUGIN_URL . '/' . FB_ADMINIMIZE_BASEFOLDER . '/js/timestamp.js', array('jquery') );
299 break;
300 }
301
302 //category options
303 $_mw_adminimize_cat_full = _mw_adminimize_getOptionValue('_mw_adminimize_cat_full');
304 switch ($_mw_adminimize_cat_full) {
305 case 1:
306 wp_enqueue_style( 'adminimize-ful-category', WP_PLUGIN_URL . '/' . FB_ADMINIMIZE_BASEFOLDER . '/css/mw_cat_full.css' );
307 break;
308 }
309
310 // set default editor tinymce
311 if ( recursive_in_array('#editor-toolbar #edButtonHTML, #quicktags', $disabled_metaboxes_page_all)
312 || recursive_in_array('#editor-toolbar #edButtonHTML, #quicktags', $disabled_metaboxes_post_all) )
313 add_filter( 'wp_default_editor', create_function('', 'return "tinymce";') );
314
315 // remove media bottons
316 if ( recursive_in_array('media_buttons', $disabled_metaboxes_page_all)
317 || recursive_in_array('media_buttons', $disabled_metaboxes_post_all) )
318 remove_action('media_buttons', 'media_buttons');
319
320 //add_filter('image_downsize', '_mw_adminimize_image_downsize', 1, 3);
321 }
322
323 $_mw_adminimize_control_flashloader = _mw_adminimize_getOptionValue('_mw_adminimize_control_flashloader');
324 switch ($_mw_adminimize_control_flashloader) {
325 case 1:
326 add_filter( 'flash_uploader', '_mw_adminimize_control_flashloader', 1 );
327 break;
328 }
329 }
330
331 if ( ($_mw_admin_color == 'mw_fresh') ||
332 ($_mw_admin_color == 'mw_classic') ||
333 ($_mw_admin_color == 'mw_colorblind') ||
334 ($_mw_admin_color == 'mw_grey') ||
335 ($_mw_admin_color == 'mw_fresh_ozh_am') ||
336 ($_mw_admin_color == 'mw_classic_ozh_am') ||
337 ($_mw_admin_color == 'mw_fresh_lm') ||
338 ($_mw_admin_color == 'mw_classic_lm') ||
339 ($_mw_admin_color == 'mw_wp23')
340 ) {
341
342 // only posts
343 if (
344 ( 'post-new.php' == $pagenow ) ||
345 ( 'post.php' == $pagenow ) ||
346 ( 'post' == $post_type )
347 ) {
348 if ( version_compare( substr($wp_version, 0, 3), '2.7', '<' ) )
349 add_action('admin_head', '_mw_adminimize_remove_box', 99);
350
351 // check for array empty
352 if ( !isset($disabled_metaboxes_post_['editor']['0']) )
353 $disabled_metaboxes_post_['editor']['0'] = '';
354 if ( isset($disabled_metaboxes_post_['administrator']['0']) )
355 $disabled_metaboxes_post_['administrator']['0'] = '';
356 if ( version_compare(substr($wp_version, 0, 3), '2.7', '<') ) {
357 if ( !recursive_in_array('#categorydivsb', $disabled_metaboxes_post_all) )
358 add_action('submitpost_box', '_mw_adminimize_sidecat_list_category_box');
359 if ( !recursive_in_array('#tagsdivsb', $disabled_metaboxes_post_all) )
360 add_action('submitpost_box', '_mw_adminimize_sidecat_list_tag_box');
361 }
362 }
363
364 // only pages
365 if (
366 ( 'page-new.php' == $pagenow ) ||
367 ( 'page.php' == $pagenow ) ||
368 ( 'post_type=page' == esc_attr($_SERVER['QUERY_STRING']) ) ||
369 ( 'page' == $post_type )
370 ) {
371
372 // check for array empty
373 if ( !isset($disabled_metaboxes_page_['editor']['0']) )
374 $disabled_metaboxes_page_['editor']['0'] = '';
375 if ( isset($disabled_metaboxes_page_['administrator']['0']) )
376 $disabled_metaboxes_page_['administrator']['0'] = '';
377 }
378
379 }
380
381 // set menu option
382 add_action('admin_head', '_mw_adminimize_set_menu_option', 1);
383
384 // global_options
385 add_action('admin_head', '_mw_adminimize_set_global_option', 1);
386
387 // admin bar
388 _mw_adminimize_remove_admin_bar();
389
390 // set metabox post option
391 $post_pages = array('post-new.php', 'post.php', 'post');
392 if ( in_array( $pagenow, $post_pages ) || in_array($post_type, $post_pages) ) {
393 if ( ( esc_attr($_SERVER['QUERY_STRING']) != 'post_type=page' ) && ($post_type != 'page') )
394 add_action('admin_head', '_mw_adminimize_set_metabox_post_option', 1);
395 }
396
397 // set metabox page option
398 $page_pages = array( 'page-new.php', 'page.php', 'post_type=page', 'page' );
399 if ( in_array( $pagenow, $page_pages ) || in_array($post_type, $page_pages) || in_array( esc_attr($_SERVER['QUERY_STRING']), $page_pages) )
400 add_action('admin_head', '_mw_adminimize_set_metabox_page_option', 1);
401
402 // set link option
403 $link_pages = array('link-manager.php', 'link-add.php', 'edit-link-categories.php');
404 if ( in_array( $pagenow, $link_pages ) )
405 add_action('admin_head', '_mw_adminimize_set_link_option', 1);
406
407 // set wp nav menu options
408 $nav_menu_pages = array('nav-menus.php');
409 if ( in_array( $pagenow, $nav_menu_pages ) )
410 add_action('admin_head', '_mw_adminimize_set_nav_menu_option', 1);
411
412 add_action('in_admin_footer', '_mw_adminimize_admin_footer');
413
414 $adminimizeoptions['mw_adminimize_default_menu'] = $menu;
415 $adminimizeoptions['mw_adminimize_default_submenu'] = $submenu;
416 }
417
418 // on init of WordPress
419 add_action( 'init', '_mw_adminimize_textdomain' );
420 add_action( 'init', '_mw_adminimize_register_styles' );
421 add_action( 'init', '_mw_adminimize_init', 1 );
422
423 // on admin init
424 add_action( 'admin_menu', '_mw_adminimize_add_settings_page' );
425 add_action( 'admin_menu', '_mw_adminimize_remove_dashboard' );
426 add_action( 'admin_init', '_mw_adminimize_admin_styles', 1 );
427
428 register_activation_hook( __FILE__, '_mw_adminimize_install' );
429 register_uninstall_hook( __FILE__, '_mw_adminimize_deinstall' );
430 //register_deactivation_hook(__FILE__, '_mw_adminimize_deinstall');
431
432
433 /**
434 * Uses WordPress filter for image_downsize, kill wp-image-dimension
435 * code by Andrew Rickmann
436 * http://www.wp-fun.co.uk/
437 * @param $value, $id, $size
438 */
439 function _mw_adminimize_image_downsize($value = FALSE, $id = 0, $size = "medium") {
440
441 if ( !wp_attachment_is_image($id) )
442 return FALSE;
443
444 $img_url = wp_get_attachment_url($id);
445
446 // Mimic functionality in image_downsize function in wp-includes/media.php
447 if ( $intermediate = image_get_intermediate_size($id, $size) ) {
448 $img_url = str_replace( basename($img_url), $intermediate['file'], $img_url );
449 } elseif ( $size == 'thumbnail' ) {
450 // fall back to the old thumbnail
451 if ( $thumb_file = wp_get_attachment_thumb_file() && $info = getimagesize($thumb_file) ) {
452 $img_url = str_replace( basename($img_url), basename($thumb_file), $img_url );
453 }
454 }
455
456 if ( $img_url)
457 return array($img_url, 0, 0);
458
459 return FALSE;
460 }
461
462
463 /**
464 * list category-box in sidebar
465 * @uses $post_ID
466 */
467 function _mw_adminimize_sidecat_list_category_box() {
468 global $post_ID;
469 ?>
470
471 <div class="inside" id="categorydivsb">
472 <p><strong><?php _e("Categories"); ?></strong></p>
473 <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
474 <?php wp_category_checklist($post_ID); ?>
475 </ul>
476 <?php if ( !defined('WP_PLUGIN_DIR') ) { // for wp <2.6 ?>
477 <div id="category-adder" class="wp-hidden-children">
478 <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>
479 <p id="category-add" class="wp-hidden-child">
480 <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" />
481 <?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>
482 <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php _e( 'Add' ); ?>" tabindex="3" />
483 <?php wp_nonce_field( 'add-category', '_ajax_nonce', FALSE ); ?>
484 <span id="category-ajax-response"></span>
485 </p>
486 </div>
487 <?php } else { ?>
488 <div id="category-adder" class="wp-hidden-children">
489 <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>
490 <p id="category-add" class="wp-hidden-child">
491 <label class="hidden" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" aria-required="TRUE"/>
492 <br />
493 <label class="hidden" for="newcat_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>
494 <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php _e( 'Add' ); ?>" tabindex="3" />
495 <?php wp_nonce_field( 'add-category', '_ajax_nonce', FALSE ); ?>
496 <span id="category-ajax-response"></span>
497 </p>
498 </div>
499 <?php } ?>
500 </div>
501 <?php
502 }
503
504
505 /**
506 * list tag-box in sidebar
507 * @uses $post_ID
508 */
509 function _mw_adminimize_sidecat_list_tag_box() {
510 global $post_ID;
511
512 if ( !class_exists('SimpleTagsAdmin') ) {
513 ?>
514 <div class="inside" id="tagsdivsb">
515 <p><strong><?php _e('Tags'); ?></strong></p>
516 <p id="jaxtag"><label class="hidden" for="newtag"><?php _e('Tags'); ?></label><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit($post_ID); ?>" /></p>
517 <div id="tagchecklist"></div>
518 </div>
519 <?php
520 }
521 }
522
523
524 /**
525 * remove default categorydiv
526 * @echo script
527 */
528 function _mw_adminimize_remove_box() {
529
530 if ( function_exists('remove_meta_box') ) {
531 if ( !class_exists('SimpleTagsAdmin') )
532 remove_meta_box('tagsdiv', 'post', 'normal');
533
534 remove_meta_box('categorydiv', 'post', 'normal');
535 } else {
536 $_mw_adminimize_sidecat_admin_head = "\n" . '<script type="text/javascript">' . "\n";
537 $_mw_adminimize_sidecat_admin_head .= "\t" . 'jQuery(document).ready(function() { jQuery(\'#categorydiv\').remove(); });' . "\n";
538 $_mw_adminimize_sidecat_admin_head .= "\t" . 'jQuery(document).ready(function() { jQuery(\'#tagsdiv\').remove(); });' . "\n";
539 $_mw_adminimize_sidecat_admin_head .= '</script>' . "\n";
540
541 echo $_mw_adminimize_sidecat_admin_head;
542 }
543 }
544
545
546 /**
547 * add new adminstyle to usersettings
548 * @param $file
549 */
550 function _mw_adminimize_admin_styles($file) {
551 global $wp_version;
552
553 $_mw_adminimize_path = WP_PLUGIN_URL . '/' . plugin_basename( dirname(__FILE__) ) . '/css/';
554
555 if ( version_compare( $wp_version, '2.7alpha', '>=' ) ) {
556 // MW Adminimize Classic
557 $styleName = 'Adminimize:' . ' ' . __('Blue');
558 wp_admin_css_color (
559 'mw_classic', $styleName, $_mw_adminimize_path . 'mw_classic27.css',
560 array('#073447', '#21759b', '#eaf3fa', '#bbd8e7')
561 );
562
563 // MW Adminimize Fresh
564 $styleName = 'Adminimize:' . ' ' . __('Gray');
565 wp_admin_css_color (
566 'mw_fresh', $styleName, $_mw_adminimize_path . 'mw_fresh27.css',
567 array('#464646', '#6d6d6d', '#f1f1f1', '#dfdfdf')
568 );
569
570 // MW Adminimize Classic Fixed
571 $styleName = 'Adminimize:' . ' Fixed ' . __('Blue');
572 wp_admin_css_color (
573 'mw_classic_fixed', $styleName, $_mw_adminimize_path . 'mw_classic28_fixed.css',
574 array('#073447', '#21759b', '#eaf3fa', '#bbd8e7')
575 );
576
577 // MW Adminimize Fresh Fixed
578 $styleName = 'Adminimize:' . ' Fixed ' . __('Gray');
579 wp_admin_css_color (
580 'mw_fresh_fixed', $styleName, $_mw_adminimize_path . 'mw_fresh28_fixed.css',
581 array('#464646', '#6d6d6d', '#f1f1f1', '#dfdfdf')
582 );
583
584 // MW Adminimize Classic Tweak
585 $styleName = 'Adminimize:' . ' Tweak ' . __('Blue');
586 wp_admin_css_color (
587 'mw_classic_tweak', $styleName, $_mw_adminimize_path . 'mw_classic28_tweak.css',
588 array('#073447', '#21759b', '#eaf3fa', '#bbd8e7')
589 );
590
591 // MW Adminimize Fresh Tweak
592 $styleName = 'Adminimize:' . ' Tweak ' . __('Gray');
593 wp_admin_css_color (
594 'mw_fresh_tweak', $styleName, $_mw_adminimize_path . 'mw_fresh28_tweak.css',
595 array('#464646', '#6d6d6d', '#f1f1f1', '#dfdfdf')
596 );
597
598 } else {
599 // MW Adminimize Classic
600 $styleName = 'MW Adminimize:' . ' ' . __('Classic');
601 wp_admin_css_color (
602 'mw_classic', $styleName, $_mw_adminimize_path . 'mw_classic.css',
603 array('#07273E', '#14568A', '#D54E21', '#2683AE')
604 );
605
606 // MW Adminimize Fresh
607 $styleName = 'MW Adminimize:' . ' ' . __('Fresh');
608 wp_admin_css_color (
609 'mw_fresh', $styleName, $_mw_adminimize_path . 'mw_fresh.css',
610 array('#464646', '#CEE1EF', '#D54E21', '#2683AE')
611 );
612
613 // MW Adminimize WordPress 2.3
614 $styleName = 'MW Adminimize:' . ' ' . __('WordPress 2.3');
615 wp_admin_css_color (
616 'mw_wp23', $styleName, $_mw_adminimize_path . 'mw_wp23.css',
617 array('#000000', '#14568A', '#448ABD', '#83B4D8')
618 );
619
620 // MW Adminimize Colorblind
621 $styleName = 'MW Adminimize:' . ' ' . __('Maybe i\'m colorblind');
622 wp_admin_css_color (
623 'mw_colorblind', $styleName, $_mw_adminimize_path . 'mw_colorblind.css',
624 array('#FF9419', '#F0720C', '#710001', '#550007', '#CF4529')
625 );
626
627 // MW Adminimize Grey
628 $styleName = 'MW Adminimize:' . ' ' . __('Grey');
629 wp_admin_css_color (
630 'mw_grey', $styleName, $_mw_adminimize_path . 'mw_grey.css',
631 array('#000000', '#787878', '#F0F0F0', '#D8D8D8', '#909090')
632 );
633 }
634 /**
635 * style and changes for plugin Admin Drop Down Menu
636 * by Ozh
637 * http://planetozh.com/blog/my-projects/wordpress-admin-menu-drop-down-css/
638 */
639 if ( function_exists('wp_ozh_adminmenu') ) {
640
641 // MW Adminimize Classic include ozh adminmenu
642 $styleName = 'MW Adminimize inc. Admin Drop Down Menu' . ' ' . __('Classic');
643 wp_admin_css_color (
644 'mw_classic_ozh_am', $styleName, $_mw_adminimize_path . 'mw_classic_ozh_am.css',
645 array('#07273E', '#14568A', '#D54E21', '#2683AE')
646 );
647
648 // MW Adminimize Fresh include ozh adminmenu
649 $styleName = 'MW Adminimize inc. Admin Drop Down Menu' . ' ' . __('Fresh');
650 wp_admin_css_color (
651 'mw_fresh_ozh_am', $styleName, $_mw_adminimize_path . 'mw_fresh_ozh_am.css',
652 array('#464646', '#CEE1EF', '#D54E21', '#2683AE')
653 );
654
655 }
656
657 /**
658 * style and changes for plugin Lighter Menus
659 * by corpodibacco
660 * http://www.italyisfalling.com/lighter-menus
661 */
662 if ( function_exists('lm_build') ) {
663
664 // MW Adminimize Classic include Lighter Menus
665 $styleName = 'MW Adminimize inc. Lighter Menus' . ' ' . __('Classic');
666 wp_admin_css_color (
667 'mw_classic_lm', $styleName, $_mw_adminimize_path . 'mw_classic_lm.css',
668 array('#07273E', '#14568A', '#D54E21', '#2683AE')
669 );
670
671 // MW Adminimize Fresh include Lighter Menus
672 $styleName = 'MW Adminimize inc. Lighter Menus' . ' ' . __('Fresh');
673 wp_admin_css_color (
674 'mw_fresh_lm', $styleName, $_mw_adminimize_path . 'mw_fresh_lm.css',
675 array('#464646', '#CEE1EF', '#D54E21', '#2683AE')
676 );
677
678 }
679 }
680
681
682 /**
683 * remove the dashbord
684 * @author of basic Austin Matzko
685 * http://www.ilfilosofo.com/blog/2006/05/24/plugin-remove-the-wordpress-dashboard/
686 */
687 function _mw_adminimize_remove_dashboard() {
688 global $menu, $submenu, $user_ID, $wp_version;
689
690 $user_roles = get_all_user_roles();
691
692 foreach ($user_roles as $role) {
693 $disabled_menu_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_menu_'. $role .'_items');
694 $disabled_submenu_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_submenu_'. $role .'_items');
695 }
696
697 $disabled_menu_all = array();
698 $disabled_submenu_all = array();
699
700 foreach ($user_roles as $role) {
701 array_push($disabled_menu_all, $disabled_menu_[$role]);
702 array_push($disabled_submenu_all, $disabled_submenu_[$role]);
703 }
704
705 // remove dashboard
706 if ( $disabled_menu_all != '' || $disabled_submenu_all != '' ) {
707
708 foreach ($user_roles as $role) {
709
710 if ( current_user_can($role) ) {
711 if ( recursive_in_array('index.php', $disabled_menu_[$role]) || recursive_in_array('index.php', $disabled_submenu_[$role]) )
712 $redirect = TRUE;
713 else
714 $redirect = FALSE;
715 }
716 }
717
718 if ( $redirect ) {
719 $_mw_adminimize_db_redirect = _mw_adminimize_getOptionValue('_mw_adminimize_db_redirect');
720 $_mw_adminimize_db_redirect_admin_url = get_option('siteurl') . '/wp-admin/';
721 switch ($_mw_adminimize_db_redirect) {
722 case 0:
723 $_mw_adminimize_db_redirect = $_mw_adminimize_db_redirect_admin_url . 'profile.php';
724 break;
725 case 1:
726 $_mw_adminimize_db_redirect = $_mw_adminimize_db_redirect_admin_url . 'edit.php';
727 break;
728 case 2:
729 $_mw_adminimize_db_redirect = $_mw_adminimize_db_redirect_admin_url . 'edit.php?post_type=page';
730 break;
731 case 3:
732 $_mw_adminimize_db_redirect = $_mw_adminimize_db_redirect_admin_url . 'post-new.php';
733 break;
734 case 4:
735 $_mw_adminimize_db_redirect = $_mw_adminimize_db_redirect_admin_url . 'page-new.php';
736 break;
737 case 5:
738 $_mw_adminimize_db_redirect = $_mw_adminimize_db_redirect_admin_url . 'edit-comments.php';
739 break;
740 case 6:
741 $_mw_adminimize_db_redirect = _mw_adminimize_getOptionValue('_mw_adminimize_db_redirect_txt');
742 break;
743 }
744
745 // fallback for WP smaller 3.0
746 if ( version_compare($wp_version, "3.0alpha", "<") && 'edit.php?post_type=page' == $_mw_adminimize_db_redirect )
747 $_mw_adminimize_db_redirect = 'edit-pages.php';
748
749 $the_user = new WP_User($user_ID);
750 reset($menu);
751 $page = key($menu);
752
753 while ( (__('Dashboard') != $menu[$page][0]) && next($menu) || (__('Dashboard') != $menu[$page][1]) && next($menu) )
754 $page = key($menu);
755
756 if (__('Dashboard') == $menu[$page][0] || __('Dashboard') == $menu[$page][1])
757 unset($menu[$page]);
758 reset($menu); $page = key($menu);
759
760 while ( !$the_user->has_cap($menu[$page][1]) && next($menu) )
761 $page = key($menu);
762
763 if ( preg_match('#wp-admin/?(index.php)?$#', $_SERVER['REQUEST_URI']) ) {
764 wp_redirect( $_mw_adminimize_db_redirect );
765 }
766 }
767 }
768 }
769
770
771 /**
772 * remove the flash_uploader
773 */
774 function _mw_adminimize_disable_flash_uploader() {
775
776 return FALSE;
777 }
778
779
780 /**
781 * set menu options from database
782 */
783 function _mw_adminimize_set_menu_option() {
784 global $pagenow, $menu, $submenu, $user_identity, $wp_version;
785
786 // exclude super admin
787 if ( _mw_adminimize_exclude_super_admin() )
788 return NULL;
789
790 $user_roles = get_all_user_roles();
791
792 foreach ($user_roles as $role) {
793 $disabled_menu_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_menu_'. $role .'_items');
794 $disabled_submenu_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_submenu_'. $role .'_items');
795 }
796
797 $_mw_adminimize_admin_head = "\n";
798 $_mw_adminimize_user_info = _mw_adminimize_getOptionValue('_mw_adminimize_user_info');
799 $_mw_adminimize_ui_redirect = _mw_adminimize_getOptionValue('_mw_adminimize_ui_redirect');
800
801 switch ($_mw_adminimize_user_info) {
802 case 1:
803 $_mw_adminimize_admin_head .= '<script type="text/javascript">' . "\n";
804 $_mw_adminimize_admin_head .= "\t" . 'jQuery(document).ready(function() { jQuery(\'#user_info\').remove(); });' . "\n";
805 $_mw_adminimize_admin_head .= '</script>' . "\n";
806 break;
807 case 2:
808 if ( version_compare($wp_version, "3.0alpha", ">=") ) {
809 $_mw_adminimize_admin_head .= '<link rel="stylesheet" href="' . WP_PLUGIN_URL . '/' . plugin_basename( dirname(__FILE__) ) . '/css/mw_small_user_info30.css" type="text/css" />' . "\n";
810 } elseif ( version_compare(substr($wp_version, 0, 3), '2.7', '>=') ) {
811 $_mw_adminimize_admin_head .= '<link rel="stylesheet" href="' . WP_PLUGIN_URL . '/' . plugin_basename( dirname(__FILE__) ) . '/css/mw_small_user_info27.css" type="text/css" />' . "\n";
812 } else {
813 $_mw_adminimize_admin_head .= '<link rel="stylesheet" href="' . WP_PLUGIN_URL . '/' . plugin_basename( dirname(__FILE__) ) . '/css/mw_small_user_info.css" type="text/css" />' . "\n";
814 }
815 $_mw_adminimize_admin_head .= '<script type="text/javascript">' . "\n";
816 $_mw_adminimize_admin_head .= "\t" . 'jQuery(document).ready(function() { jQuery(\'#user_info\').remove();';
817 if ($_mw_adminimize_ui_redirect == '1') {
818 $_mw_adminimize_admin_head .= 'jQuery(\'div#wpcontent\').after(\'<div id="small_user_info"><p><a href="' . get_option('siteurl') . wp_nonce_url( ('/wp-login.php?action=logout&amp;redirect_to=') . get_option('siteurl') , 'log-out' ) . '" title="' . __('Log Out') . '">' . __('Log Out') . '</a></p></div>\') });' . "\n";
819 } else {
820 $_mw_adminimize_admin_head .= 'jQuery(\'div#wpcontent\').after(\'<div id="small_user_info"><p><a href="' . get_option('siteurl') . wp_nonce_url( ('/wp-login.php?action=logout') , 'log-out' ) . '" title="' . __('Log Out') . '">' . __('Log Out') . '</a></p></div>\') });' . "\n";
821 }
822 $_mw_adminimize_admin_head .= '</script>' . "\n";
823 break;
824 case 3:
825 if ( version_compare($wp_version, "3.0alpha", ">=") ) {
826 $_mw_adminimize_admin_head .= '<link rel="stylesheet" href="' . WP_PLUGIN_URL . '/' . plugin_basename( dirname(__FILE__) ) . '/css/mw_small_user_info30.css" type="text/css" />' . "\n";
827 } elseif ( version_compare(substr($wp_version, 0, 3), '2.7', '>=') ) {
828 $_mw_adminimize_admin_head .= '<link rel="stylesheet" href="' . WP_PLUGIN_URL . '/' . plugin_basename( dirname(__FILE__) ) . '/css/mw_small_user_info27.css" type="text/css" />' . "\n";
829 } else {
830 $_mw_adminimize_admin_head .= '<link rel="stylesheet" href="' . WP_PLUGIN_URL . '/' . plugin_basename( dirname(__FILE__) ) . '/css/mw_small_user_info.css" type="text/css" />' . "\n";
831 }
832 $_mw_adminimize_admin_head .= '<script type="text/javascript">' . "\n";
833 $_mw_adminimize_admin_head .= "\t" . 'jQuery(document).ready(function() { jQuery(\'#user_info\').remove();';
834 if ($_mw_adminimize_ui_redirect == '1') {
835 $_mw_adminimize_admin_head .= 'jQuery(\'div#wpcontent\').after(\'<div id="small_user_info"><p><a href="' . get_option('siteurl') . ('/wp-admin/profile.php') . '">' . $user_identity . '</a> | <a href="' . get_option('siteurl') . wp_nonce_url( ('/wp-login.php?action=logout&amp;redirect_to=') . get_option('siteurl'), 'log-out' ) . '" title="' . __('Log Out') . '">' . __('Log Out') . '</a></p></div>\') });' . "\n";
836 } else {
837 $_mw_adminimize_admin_head .= 'jQuery(\'div#wpcontent\').after(\'<div id="small_user_info"><p><a href="' . get_option('siteurl') . ('/wp-admin/profile.php') . '">' . $user_identity . '</a> | <a href="' . get_option('siteurl') . wp_nonce_url( ('/wp-login.php?action=logout'), 'log-out' ) . '" title="' . __('Log Out') . '">' . __('Log Out') . '</a></p></div>\') });' . "\n";
838 }
839 $_mw_adminimize_admin_head .= '</script>' . "\n";
840 break;
841 }
842
843 // set menu
844 if ( '' != $disabled_menu_['editor'] ) {
845
846 // set admin-menu
847 foreach ($user_roles as $role) {
848 $user = wp_get_current_user();
849 if ( in_array($role, $user->roles) ) {
850 if ( current_user_can($role) ) {
851 $mw_adminimize_menu = $disabled_menu_[$role];
852 $mw_adminimize_submenu = $disabled_submenu_[$role];
853 }
854 }
855 }
856
857 // fallback on users.php on all userroles smaller admin
858 if ( is_array($mw_adminimize_menu) && in_array('users.php', $mw_adminimize_menu) )
859 $mw_adminimize_menu[] = 'profile.php';
860
861 if ( isset($menu) && !empty($menu) ) {
862 foreach ($menu as $index => $item) {
863 if ( 'index.php' === $item )
864 continue;
865
866 if ( isset($mw_adminimize_menu) && in_array($item[2], $mw_adminimize_menu) ) {
867 unset($menu[$index]);
868 }
869
870 if ( isset($submenu) && !empty($submenu[$item[2]]) ) {
871 foreach ($submenu[$item[2]] as $subindex => $subitem) {
872 if ( isset($mw_adminimize_submenu) && in_array($subitem[2], $mw_adminimize_submenu))
873 //if ('profile.php' === $subitem[2])
874 // unset($menu[70]);
875 unset($submenu[$item[2]][$subindex]);
876 }
877 }
878 }
879 }
880
881 }
882
883 echo $_mw_adminimize_admin_head;
884 }
885
886
887 /**
888 * set global options in backend in all areas
889 */
890 function _mw_adminimize_set_global_option() {
891 global $_wp_admin_css_colors;
892
893 // exclude super admin
894 if ( _mw_adminimize_exclude_super_admin() )
895 return NULL;
896
897 $user_roles = get_all_user_roles();
898
899 $_mw_adminimize_admin_head = '';
900
901 remove_action('admin_head', 'index_js');
902
903 foreach ($user_roles as $role) {
904 $disabled_global_option_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_global_option_'. $role .'_items');
905 }
906
907 foreach ($user_roles as $role) {
908 if ( !isset($disabled_global_option_[$role]['0']) )
909 $disabled_global_option_[$role]['0'] = '';
910 }
911
912 $remove_adminbar = FALSE;
913 // new 1.7.8
914 foreach ($user_roles as $role) {
915 $user = wp_get_current_user();
916 if ( in_array($role, $user->roles) ) {
917 if ( current_user_can($role) && is_array($disabled_global_option_[$role]) ) {
918 $global_options = implode(', ', $disabled_global_option_[$role]);
919 if ( recursive_in_array('.show-admin-bar', $disabled_global_option_[$role]) )
920 $remove_adminbar = TRUE;
921 }
922 }
923 }
924 if ( 0 != strpos($global_options, '#your-profile .form-table fieldset') )
925 $_wp_admin_css_colors = 0;
926 $_mw_adminimize_admin_head .= '<!-- global options -->' . "\n";
927 $_mw_adminimize_admin_head .= '<style type="text/css">' . $global_options . ' {display: none !important;}</style>' . "\n";
928
929 if ($global_options)
930 echo $_mw_adminimize_admin_head;
931 }
932
933
934 function _mw_adminimize_remove_admin_bar() {
935
936 // exclude super admin
937 if ( _mw_adminimize_exclude_super_admin() )
938 return NULL;
939
940 $user_roles = get_all_user_roles();
941
942 foreach ($user_roles as $role) {
943 $disabled_global_option_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_global_option_'. $role .'_items');
944 }
945
946 foreach ($user_roles as $role) {
947 if ( !isset($disabled_global_option_[$role]['0']) )
948 $disabled_global_option_[$role]['0'] = '';
949 }
950
951 $remove_adminbar = FALSE;
952 // new 1.7.8
953 foreach ($user_roles as $role) {
954 $user = wp_get_current_user();
955 if ( in_array($role, $user->roles) ) {
956 if ( current_user_can($role) && is_array($disabled_global_option_[$role]) ) {
957 $global_options = implode(', ', $disabled_global_option_[$role]);
958 if ( recursive_in_array('.show-admin-bar', $disabled_global_option_[$role]) )
959 $remove_adminbar = TRUE;
960 }
961 }
962 }
963
964 // for deactivate admin bar
965 if ( $remove_adminbar ) {
966 add_filter( 'show_admin_bar', '__return_false' );
967 wp_deregister_script( 'admin-bar' );
968 wp_deregister_style( 'admin-bar' );
969 remove_action( 'wp_footer', 'wp_admin_bar_render', 1000 );
970 }
971 }
972
973
974 /**
975 * set metabox options from database an area post
976 */
977 function _mw_adminimize_set_metabox_post_option() {
978
979 // exclude super admin
980 if ( _mw_adminimize_exclude_super_admin() )
981 return NULL;
982
983 $user_roles = get_all_user_roles();
984
985 $_mw_adminimize_admin_head = '';
986
987 remove_action('admin_head', 'index_js');
988
989 foreach ($user_roles as $role) {
990 $disabled_metaboxes_post_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_metaboxes_post_'. $role .'_items');
991
992 if ( !isset($disabled_metaboxes_post_[$role]['0']) )
993 $disabled_metaboxes_post_[$role]['0'] = '';
994
995 // new 1.7.8
996 foreach ($user_roles as $role) {
997 $user = wp_get_current_user();
998 if ( in_array($role, $user->roles) ) {
999 if ( current_user_can($role) && isset($disabled_metaboxes_post_[$role]) && is_array($disabled_metaboxes_post_[$role]) ) {
1000 $metaboxes = implode(',', $disabled_metaboxes_post_[$role]);
1001 }
1002 }
1003 }
1004 }
1005
1006 $_mw_adminimize_admin_head .= '<style type="text/css">' . $metaboxes . ' {display: none !important;}</style>' . "\n";
1007
1008 if ($metaboxes)
1009 echo $_mw_adminimize_admin_head;
1010 }
1011
1012
1013 /**
1014 * set metabox options from database an area page
1015 */
1016 function _mw_adminimize_set_metabox_page_option() {
1017
1018 // exclude super admin
1019 if ( _mw_adminimize_exclude_super_admin() )
1020 return NULL;
1021
1022 $user_roles = get_all_user_roles();
1023
1024 $_mw_adminimize_admin_head = '';
1025
1026 remove_action('admin_head', 'index_js');
1027
1028 foreach ($user_roles as $role) {
1029 $disabled_metaboxes_page_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_metaboxes_page_'. $role .'_items');
1030
1031 if ( !isset($disabled_metaboxes_page_[$role]['0']) )
1032 $disabled_metaboxes_page_[$role]['0'] = '';
1033
1034 // new 1.7.8
1035 foreach ($user_roles as $role) {
1036 $user = wp_get_current_user();
1037 if ( in_array($role, $user->roles) ) {
1038 if ( current_user_can($role) && is_array($disabled_metaboxes_page_[$role]) ) {
1039 $metaboxes = implode(',', $disabled_metaboxes_page_[$role]);
1040 }
1041 }
1042 }
1043 }
1044
1045 $_mw_adminimize_admin_head .= '<style type="text/css">' . $metaboxes . ' {display: none !important;}</style>' . "\n";
1046
1047 if ($metaboxes)
1048 echo $_mw_adminimize_admin_head;
1049 }
1050
1051
1052 /**
1053 * set link options in area Links of Backend
1054 */
1055 function _mw_adminimize_set_link_option() {
1056
1057 // exclude super admin
1058 if ( _mw_adminimize_exclude_super_admin() )
1059 return NULL;
1060
1061 $user_roles = get_all_user_roles();
1062
1063 $_mw_adminimize_admin_head = '';
1064
1065 remove_action('admin_head', 'index_js');
1066
1067 foreach ($user_roles as $role) {
1068 $disabled_link_option_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_link_option_'. $role .'_items');
1069 }
1070
1071 foreach ($user_roles as $role) {
1072 if ( !isset($disabled_link_option_[$role]['0']) )
1073 $disabled_link_option_[$role]['0'] = '';
1074 }
1075
1076 // new 1.7.8
1077 foreach ($user_roles as $role) {
1078 $user = wp_get_current_user();
1079 if ( in_array($role, $user->roles) ) {
1080 if ( current_user_can($role) && is_array($disabled_link_option_[$role]) ) {
1081 $link_options = implode(',', $disabled_link_option_[$role]);
1082 }
1083 }
1084 }
1085 $_mw_adminimize_admin_head .= '<style type="text/css">' . $link_options . ' {display: none !important;}</style>' . "\n";
1086
1087 if ($link_options)
1088 echo $_mw_adminimize_admin_head;
1089 }
1090
1091 /**
1092 * remove objects on wp nav menu
1093 */
1094 function _mw_adminimize_set_nav_menu_option() {
1095
1096 // exclude super admin
1097 if ( _mw_adminimize_exclude_super_admin() )
1098 return NULL;
1099
1100 $user_roles = get_all_user_roles();
1101
1102 $_mw_adminimize_admin_head = '';
1103
1104 remove_action('admin_head', 'index_js');
1105
1106 foreach ($user_roles as $role) {
1107 $disabled_nav_menu_option_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_nav_menu_option_'. $role .'_items');
1108 }
1109
1110 foreach ($user_roles as $role) {
1111 if ( !isset($disabled_nav_menu_option_[$role]['0']) )
1112 $disabled_nav_menu_option_[$role]['0'] = '';
1113 }
1114
1115 // new 1.7.8
1116 foreach ($user_roles as $role) {
1117 $user = wp_get_current_user();
1118 if ( in_array($role, $user->roles) ) {
1119 if ( current_user_can($role) && is_array($disabled_nav_menu_option_[$role]) ) {
1120 $nav_menu_options = implode(',', $disabled_nav_menu_option_[$role]);
1121 }
1122 }
1123 }
1124 //remove_meta_box($id, 'nav-menus', 'side');
1125 $_mw_adminimize_admin_head .= '<style type="text/css">' . $nav_menu_options . ' {display: none !important;}</style>' . "\n";
1126
1127 if ($nav_menu_options)
1128 echo $_mw_adminimize_admin_head;
1129 }
1130
1131
1132 /**
1133 * small user-info
1134 * @uses $post_ID
1135 */
1136 function _mw_adminimize_small_user_info() {
1137 ?>
1138 <div id="small_user_info">
1139 <p><a href="<?php echo wp_nonce_url( site_url('wp-login.php?action=logout'), 'log-out' ) ?>" title="<?php _e('Log Out') ?>"><?php _e('Log Out'); ?></a></p>
1140 </div>
1141 <?php
1142 }
1143
1144
1145 /**
1146 * include options-page in wp-admin
1147 */
1148 require_once('adminimize_page.php');
1149
1150
1151 /**
1152 * credit in wp-footer
1153 */
1154 function _mw_adminimize_admin_footer() {
1155
1156 $plugin_data = get_plugin_data( __FILE__ );
1157 $plugin_data['Title'] = $plugin_data['Name'];
1158
1159 if ( !empty($plugin_data['PluginURI']) && !empty($plugin_data['Name']) )
1160 $plugin_data['Title'] = '<a href="' . $plugin_data['PluginURI'] . '" title="'.__( 'Visit plugin homepage' ).'">' . $plugin_data['Name'] . '</a>';
1161
1162 if ( basename($_SERVER['REQUEST_URI']) == 'adminimize.php') {
1163 printf('%1$s ' . __('plugin') . ' | ' . __('Version') . ' <a href="http://wordpress.org/extend/plugins/adminimize/changelog/" title="' . __('History', FB_ADMINIMIZE_TEXTDOMAIN ) . '">%2$s</a> | ' . __('Author') . ' %3$s<br />', $plugin_data['Title'], $plugin_data['Version'], $plugin_data['Author']);
1164 }
1165
1166 if ( _mw_adminimize_getOptionValue('_mw_adminimize_advice') == 1 && basename($_SERVER['REQUEST_URI']) != 'adminimize.php' ) {
1167 printf('%1$s ' . __('plugin activate', FB_ADMINIMIZE_TEXTDOMAIN ) . ' | ' . stripslashes( _mw_adminimize_getOptionValue('_mw_adminimize_advice_txt') ) . '<br />', $plugin_data['Title']);
1168 }
1169
1170 }
1171
1172
1173 /**
1174 * @version WP 2.8
1175 * Add action link(s) to plugins page
1176 *
1177 * @package Secure WordPress
1178 *
1179 * @param $links, $file
1180 * @return $links
1181 */
1182 function _mw_adminimize_filter_plugin_meta($links, $file) {
1183
1184 /* create link */
1185 if ( FB_ADMINIMIZE_BASENAME == $file ) {
1186 array_unshift(
1187 $links,
1188 sprintf( '<a href="options-general.php?page=%s">%s</a>', FB_ADMINIMIZE_BASENAME, __('Settings') )
1189 );
1190 }
1191
1192 return $links;
1193 }
1194
1195
1196 /**
1197 * Images/ Icons in base64-encoding
1198 * @use function _mw_adminimize_get_resource_url() for display
1199 */
1200 if ( isset($_GET['resource']) && !empty($_GET['resource']) ) {
1201
1202 # base64 encoding performed by base64img.php from http://php.holtsmark.no
1203 $resources = array(
1204 'adminimize.gif' =>
1205 'R0lGODlhCwALAKIEAPb29tTU1Kurq5SUlP///wAAAAAAAAAAAC'.
1206 'H5BAEAAAQALAAAAAALAAsAAAMlSErTuw1Ix4a8s4mYgxZbE4wf'.
1207 'OIzkAJqop64nWm7tULHu0+xLAgA7'.
1208 '');
1209
1210 if (array_key_exists($_GET['resource'], $resources)) {
1211
1212 $content = base64_decode($resources[ $_GET['resource'] ]);
1213
1214 $lastMod = filemtime(__FILE__);
1215 $client = ( isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? $_SERVER['HTTP_IF_MODIFIED_SINCE'] : FALSE );
1216 // Checking if the client is validating his cache and if it is current.
1217 if (isset($client) && (strtotime($client) == $lastMod)) {
1218 // Client's cache IS current, so we just respond '304 Not Modified'.
1219 header('Last-Modified: '.gmdate('D, d M Y H:i:s', $lastMod).' GMT', TRUE, 304);
1220 exit;
1221 } else {
1222 // Image not cached or cache outdated, we respond '200 OK' and output the image.
1223 header('Last-Modified: '.gmdate('D, d M Y H:i:s', $lastMod).' GMT', TRUE, 200);
1224 header('Content-Length: '.strlen($content));
1225 header('Content-Type: image/' . substr(strrchr($_GET['resource'], '.'), 1) );
1226 echo $content;
1227 exit;
1228 }
1229 }
1230
1231 }
1232
1233
1234 /**
1235 * Display Images/ Icons in base64-encoding
1236 * @return $resourceID
1237 */
1238 function _mw_adminimize_get_resource_url($resourceID) {
1239
1240 return trailingslashit( get_bloginfo('url') ) . '?resource=' . $resourceID;
1241 }
1242
1243
1244 /**
1245 * content of help
1246 *
1247 * @package Secure WordPress
1248 */
1249 function _mw_adminimize_contextual_help() {
1250
1251 $content = __('<a href="http://wordpress.org/extend/plugins/adminimize/">Documentation</a>', FB_ADMINIMIZE_TEXTDOMAIN );
1252
1253 return $content;
1254 }
1255
1256
1257 /**
1258 * settings in plugin-admin-page
1259 */
1260 function _mw_adminimize_add_settings_page() {
1261 global $wp_version;
1262
1263 if ( current_user_can('switch_themes') && function_exists('add_submenu_page') ) {
1264
1265 $menutitle = '';
1266 if ( version_compare( $wp_version, '2.7alpha', '>' ) ) {
1267 $menutitle = '<img src="' . _mw_adminimize_get_resource_url('adminimize.gif') . '" alt="" />';
1268 }
1269 $menutitle .= ' ' . __('Adminimize', FB_ADMINIMIZE_TEXTDOMAIN );
1270
1271 $pagehook = add_submenu_page('options-general.php', __('Adminimize Options', FB_ADMINIMIZE_TEXTDOMAIN ), $menutitle, 'unfiltered_html', __FILE__, '_mw_adminimize_options');
1272 add_action( 'load-' . $pagehook, '_mw_adminimize_on_load_page' );
1273 add_filter( 'plugin_action_links', '_mw_adminimize_filter_plugin_meta', 10, 2 );
1274 }
1275
1276 }
1277
1278
1279 function _mw_adminimize_on_load_page() {
1280
1281 add_filter( 'contextual_help', '_mw_adminimize_contextual_help' );
1282
1283 wp_enqueue_style( 'adminimize-style' );
1284 }
1285
1286
1287 /**
1288 * Set theme for users
1289 */
1290 function _mw_adminimize_set_theme() {
1291
1292 if ( !current_user_can('edit_users') )
1293 wp_die(__('Cheatin&#8217; uh?'));
1294
1295 $user_ids = $_POST[mw_adminimize_theme_items];
1296 $admin_color = htmlspecialchars( stripslashes( $_POST[_mw_adminimize_set_theme] ) );
1297
1298 if ( !$user_ids )
1299 return FALSE;
1300
1301 foreach( $user_ids as $user_id) {
1302 update_usermeta($user_id, 'admin_color', $admin_color);
1303 }
1304
1305 }
1306
1307
1308 /**
1309 * read otpions
1310 */
1311 function _mw_adminimize_getOptionValue($key) {
1312
1313 $adminimizeoptions = get_option('mw_adminimize');
1314
1315 if ( isset($adminimizeoptions[$key]) )
1316 return ($adminimizeoptions[$key]);
1317 }
1318
1319
1320 /**
1321 * Update options in database
1322 */
1323 function _mw_adminimize_update() {
1324 global $menu, $submenu, $adminimizeoptions;
1325
1326 $user_roles = get_all_user_roles();
1327
1328 if (isset($_POST['_mw_adminimize_user_info'])) {
1329 $adminimizeoptions['_mw_adminimize_user_info'] = strip_tags(stripslashes($_POST['_mw_adminimize_user_info']));
1330 } else {
1331 $adminimizeoptions['_mw_adminimize_user_info'] = 0;
1332 }
1333
1334 if (isset($_POST['_mw_adminimize_dashmenu'])) {
1335 $adminimizeoptions['_mw_adminimize_dashmenu'] = strip_tags(stripslashes($_POST['_mw_adminimize_dashmenu']));
1336 } else {
1337 $adminimizeoptions['_mw_adminimize_dashmenu'] = 0;
1338 }
1339
1340 if (isset($_POST['_mw_adminimize_footer'])) {
1341 $adminimizeoptions['_mw_adminimize_footer'] = strip_tags(stripslashes($_POST['_mw_adminimize_footer']));
1342 } else {
1343 $adminimizeoptions['_mw_adminimize_footer'] = 0;
1344 }
1345
1346 if (isset($_POST['_mw_adminimize_header'])) {
1347 $adminimizeoptions['_mw_adminimize_header'] = strip_tags(stripslashes($_POST['_mw_adminimize_header']));
1348 } else {
1349 $adminimizeoptions['_mw_adminimize_header'] = 0;
1350 }
1351
1352 if (isset($_POST['_mw_adminimize_exclude_super_admin'])) {
1353 $adminimizeoptions['_mw_adminimize_exclude_super_admin'] = strip_tags(stripslashes($_POST['_mw_adminimize_exclude_super_admin']));
1354 } else {
1355 $adminimizeoptions['_mw_adminimize_exclude_super_admin'] = 0;
1356 }
1357
1358 if (isset($_POST['_mw_adminimize_writescroll'])) {
1359 $adminimizeoptions['_mw_adminimize_writescroll'] = strip_tags(stripslashes($_POST['_mw_adminimize_writescroll']));
1360 } else {
1361 $adminimizeoptions['_mw_adminimize_writescroll'] = 0;
1362 }
1363
1364 if (isset($_POST['_mw_adminimize_tb_window'])) {
1365 $adminimizeoptions['_mw_adminimize_tb_window'] = strip_tags(stripslashes($_POST['_mw_adminimize_tb_window']));
1366 } else {
1367 $adminimizeoptions['_mw_adminimize_tb_window'] = 0;
1368 }
1369
1370 if (isset($_POST['_mw_adminimize_cat_full'])) {
1371 $adminimizeoptions['_mw_adminimize_cat_full'] = strip_tags(stripslashes($_POST['_mw_adminimize_cat_full']));
1372 } else {
1373 $adminimizeoptions['_mw_adminimize_cat_full'] = 0;
1374 }
1375
1376 if (isset($_POST['_mw_adminimize_db_redirect'])) {
1377 $adminimizeoptions['_mw_adminimize_db_redirect'] = strip_tags(stripslashes($_POST['_mw_adminimize_db_redirect']));
1378 } else {
1379 $adminimizeoptions['_mw_adminimize_db_redirect'] = 0;
1380 }
1381
1382 if (isset($_POST['_mw_adminimize_ui_redirect'])) {
1383 $adminimizeoptions['_mw_adminimize_ui_redirect'] = strip_tags(stripslashes($_POST['_mw_adminimize_ui_redirect']));
1384 } else {
1385 $adminimizeoptions['_mw_adminimize_ui_redirect'] = 0;
1386 }
1387
1388 if (isset($_POST['_mw_adminimize_advice'])) {
1389 $adminimizeoptions['_mw_adminimize_advice'] = strip_tags(stripslashes($_POST['_mw_adminimize_advice']));
1390 } else {
1391 $adminimizeoptions['_mw_adminimize_advice'] = 0;
1392 }
1393
1394 if (isset($_POST['_mw_adminimize_advice_txt'])) {
1395 $adminimizeoptions['_mw_adminimize_advice_txt'] = stripslashes($_POST['_mw_adminimize_advice_txt']);
1396 } else {
1397 $adminimizeoptions['_mw_adminimize_advice_txt'] = 0;
1398 }
1399
1400 if (isset($_POST['_mw_adminimize_timestamp'])) {
1401 $adminimizeoptions['_mw_adminimize_timestamp'] = strip_tags(stripslashes($_POST['_mw_adminimize_timestamp']));
1402 } else {
1403 $adminimizeoptions['_mw_adminimize_timestamp'] = 0;
1404 }
1405
1406 if (isset($_POST['_mw_adminimize_control_flashloader'])) {
1407 $adminimizeoptions['_mw_adminimize_control_flashloader'] = strip_tags(stripslashes($_POST['_mw_adminimize_control_flashloader']));
1408 } else {
1409 $adminimizeoptions['_mw_adminimize_control_flashloader'] = 0;
1410 }
1411
1412 if (isset($_POST['_mw_adminimize_db_redirect_txt'])) {
1413 $adminimizeoptions['_mw_adminimize_db_redirect_txt'] = stripslashes($_POST['_mw_adminimize_db_redirect_txt']);
1414 } else {
1415 $adminimizeoptions['_mw_adminimize_db_redirect_txt'] = 0;
1416 }
1417
1418 // menu update
1419 foreach ($user_roles as $role) {
1420 if (isset($_POST['mw_adminimize_disabled_menu_'. $role .'_items'])) {
1421 $adminimizeoptions['mw_adminimize_disabled_menu_'. $role .'_items'] = $_POST['mw_adminimize_disabled_menu_'. $role .'_items'];
1422 } else {
1423 $adminimizeoptions['mw_adminimize_disabled_menu_'. $role .'_items'] = array();
1424 }
1425
1426 if (isset($_POST['mw_adminimize_disabled_submenu_'. $role .'_items'])) {
1427 $adminimizeoptions['mw_adminimize_disabled_submenu_'. $role .'_items'] = $_POST['mw_adminimize_disabled_submenu_'. $role .'_items'];
1428 } else {
1429 $adminimizeoptions['mw_adminimize_disabled_submenu_'. $role .'_items'] = array();
1430 }
1431 }
1432
1433 // global_options, metaboxes update
1434 foreach ($user_roles as $role) {
1435 if (isset($_POST['mw_adminimize_disabled_global_option_'. $role . '_items'])) {
1436 $adminimizeoptions['mw_adminimize_disabled_global_option_'. $role . '_items'] = $_POST['mw_adminimize_disabled_global_option_'. $role . '_items'];
1437 } else {
1438 $adminimizeoptions['mw_adminimize_disabled_global_option_'. $role . '_items'] = array();
1439 }
1440
1441 if (isset($_POST['mw_adminimize_disabled_metaboxes_post_'. $role . '_items'])) {
1442 $adminimizeoptions['mw_adminimize_disabled_metaboxes_post_'. $role . '_items'] = $_POST['mw_adminimize_disabled_metaboxes_post_'. $role . '_items'];
1443 } else {
1444 $adminimizeoptions['mw_adminimize_disabled_metaboxes_post_'. $role . '_items'] = array();
1445 }
1446
1447 if (isset($_POST['mw_adminimize_disabled_metaboxes_page_'. $role . '_items'])) {
1448 $adminimizeoptions['mw_adminimize_disabled_metaboxes_page_'. $role . '_items'] = $_POST['mw_adminimize_disabled_metaboxes_page_'. $role . '_items'];
1449 } else {
1450 $adminimizeoptions['mw_adminimize_disabled_metaboxes_page_'. $role . '_items'] = array();
1451 }
1452
1453 if (isset($_POST['mw_adminimize_disabled_link_option_'. $role . '_items'])) {
1454 $adminimizeoptions['mw_adminimize_disabled_link_option_'. $role . '_items'] = $_POST['mw_adminimize_disabled_link_option_'. $role . '_items'];
1455 } else {
1456 $adminimizeoptions['mw_adminimize_disabled_link_option_'. $role . '_items'] = array();
1457 }
1458
1459 // wp nav menu options
1460 if (isset($_POST['mw_adminimize_disabled_nav_menu_option_'. $role . '_items'])) {
1461 $adminimizeoptions['mw_adminimize_disabled_nav_menu_option_'. $role . '_items'] = $_POST['mw_adminimize_disabled_nav_menu_option_'. $role . '_items'];
1462 } else {
1463 $adminimizeoptions['mw_adminimize_disabled_nav_menu_option_'. $role . '_items'] = array();
1464 }
1465 }
1466
1467 // own options
1468 if (isset($_POST['_mw_adminimize_own_values'])) {
1469 $adminimizeoptions['_mw_adminimize_own_values'] = stripslashes($_POST['_mw_adminimize_own_values']);
1470 } else {
1471 $adminimizeoptions['_mw_adminimize_own_values'] = 0;
1472 }
1473
1474 if (isset($_POST['_mw_adminimize_own_options'])) {
1475 $adminimizeoptions['_mw_adminimize_own_options'] = stripslashes($_POST['_mw_adminimize_own_options']);
1476 } else {
1477 $adminimizeoptions['_mw_adminimize_own_options'] = 0;
1478 }
1479
1480 // own post options
1481 if (isset($_POST['_mw_adminimize_own_post_values'])) {
1482 $adminimizeoptions['_mw_adminimize_own_post_values'] = stripslashes($_POST['_mw_adminimize_own_post_values']);
1483 } else {
1484 $adminimizeoptions['_mw_adminimize_own_post_values'] = 0;
1485 }
1486
1487 if (isset($_POST['_mw_adminimize_own_post_options'])) {
1488 $adminimizeoptions['_mw_adminimize_own_post_options'] = stripslashes($_POST['_mw_adminimize_own_post_options']);
1489 } else {
1490 $adminimizeoptions['_mw_adminimize_own_post_options'] = 0;
1491 }
1492
1493 // own page options
1494 if (isset($_POST['_mw_adminimize_own_page_values'])) {
1495 $adminimizeoptions['_mw_adminimize_own_page_values'] = stripslashes($_POST['_mw_adminimize_own_page_values']);
1496 } else {
1497 $adminimizeoptions['_mw_adminimize_own_page_values'] = 0;
1498 }
1499
1500 if (isset($_POST['_mw_adminimize_own_page_options'])) {
1501 $adminimizeoptions['_mw_adminimize_own_page_options'] = stripslashes($_POST['_mw_adminimize_own_page_options']);
1502 } else {
1503 $adminimizeoptions['_mw_adminimize_own_page_options'] = 0;
1504 }
1505
1506 // own link options
1507 if (isset($_POST['_mw_adminimize_own_link_values'])) {
1508 $adminimizeoptions['_mw_adminimize_own_link_values'] = stripslashes($_POST['_mw_adminimize_own_link_values']);
1509 } else {
1510 $adminimizeoptions['_mw_adminimize_own_link_values'] = 0;
1511 }
1512
1513 if (isset($_POST['_mw_adminimize_own_link_options'])) {
1514 $adminimizeoptions['_mw_adminimize_own_link_options'] = stripslashes($_POST['_mw_adminimize_own_link_options']);
1515 } else {
1516 $adminimizeoptions['_mw_adminimize_own_link_options'] = 0;
1517 }
1518
1519 // wp nav menu options
1520 if (isset($_POST['_mw_adminimize_own_nav_menu_values'])) {
1521 $adminimizeoptions['_mw_adminimize_own_nav_menu_values'] = stripslashes($_POST['_mw_adminimize_own_nav_menu_values']);
1522 } else {
1523 $adminimizeoptions['_mw_adminimize_own_nav_menu_values'] = 0;
1524 }
1525
1526 if (isset($_POST['_mw_adminimize_own_nav_menu_options'])) {
1527 $adminimizeoptions['_mw_adminimize_own_nav_menu_options'] = stripslashes($_POST['_mw_adminimize_own_nav_menu_options']);
1528 } else {
1529 $adminimizeoptions['_mw_adminimize_own_nav_menu_options'] = 0;
1530 }
1531
1532 // update
1533 update_option('mw_adminimize', $adminimizeoptions);
1534 $adminimizeoptions = get_option('mw_adminimize');
1535
1536 $myErrors = new _mw_adminimize_message_class();
1537 $myErrors = '<div id="message" class="updated fade"><p>' . $myErrors->get_error('_mw_adminimize_update') . '</p></div>';
1538 echo $myErrors;
1539 }
1540
1541
1542 /**
1543 * Delete options in database
1544 */
1545 function _mw_adminimize_deinstall() {
1546
1547 delete_option('mw_adminimize');
1548 }
1549
1550
1551 /**
1552 * Install options in database
1553 */
1554 function _mw_adminimize_install() {
1555 global $menu, $submenu;
1556
1557 $user_roles = get_all_user_roles();
1558 $adminimizeoptions = array();
1559
1560 foreach ($user_roles as $role) {
1561 $adminimizeoptions['mw_adminimize_disabled_menu_'. $role .'_items'] = array();
1562 $adminimizeoptions['mw_adminimize_disabled_submenu_'. $role .'_items'] = array();
1563 $adminimizeoptions['mw_adminimize_disabled_global_option_'. $role .'_items'] = array();
1564 $adminimizeoptions['mw_adminimize_disabled_metaboxes_post_'. $role .'_items'] = array();
1565 $adminimizeoptions['mw_adminimize_disabled_metaboxes_page_'. $role .'_items'] = array();
1566 }
1567
1568 $adminimizeoptions['mw_adminimize_default_menu'] = $menu;
1569 $adminimizeoptions['mw_adminimize_default_submenu'] = $submenu;
1570
1571 add_option('mw_adminimize', $adminimizeoptions);
1572 }
1573
1574 /**
1575 * export options in file
1576 */
1577 function _mw_adminimize_export() {
1578 global $wpdb;
1579
1580 $filename = 'adminimize_export-' . date('Y-m-d_G-i-s') . '.seq';
1581
1582 header("Content-Description: File Transfer");
1583 header("Content-Disposition: attachment; filename=" . urlencode($filename));
1584 header("Content-Type: application/force-download");
1585 header("Content-Type: application/octet-stream");
1586 header("Content-Type: application/download");
1587 header('Content-Type: text/seq; charset=' . get_option('blog_charset'), TRUE);
1588 flush();
1589
1590 $export_data = mysql_query("SELECT option_value FROM $wpdb->options WHERE option_name = 'mw_adminimize'");
1591 $export_data = mysql_result($export_data, 0);
1592 echo $export_data;
1593 flush();
1594 }
1595
1596 /**
1597 * import options in table _options
1598 */
1599 function _mw_adminimize_import() {
1600
1601 // check file extension
1602 $str_file_name = $_FILES['datei']['name'];
1603 $str_file_ext = explode(".", $str_file_name);
1604
1605 if ($str_file_ext[1] != 'seq') {
1606 $addreferer = 'notexist';
1607 } elseif (file_exists($_FILES['datei']['name'])) {
1608 $addreferer = 'exist';
1609 } else {
1610 // path for file
1611 $str_ziel = WP_CONTENT_DIR . '/' . $_FILES['datei']['name'];
1612 // transfer
1613 move_uploaded_file($_FILES['datei']['tmp_name'], $str_ziel);
1614 // access authorisation
1615 chmod($str_ziel, 0644);
1616 // SQL import
1617 ini_set('default_socket_timeout', 120);
1618 $import_file = file_get_contents($str_ziel);
1619
1620 _mw_adminimize_deinstall();
1621 $import_file = unserialize($import_file);
1622
1623 if ( file_exists($str_ziel) )
1624 unlink($str_ziel);
1625 update_option('mw_adminimize', $import_file);
1626 if ( file_exists($str_ziel) )
1627 unlink($str_ziel);
1628
1629 $addreferer = 'true';
1630 }
1631
1632 $myErrors = new _mw_adminimize_message_class();
1633 $myErrors = '<div id="message" class="updated fade"><p>' . $myErrors->get_error('_mw_adminimize_import') . '</p></div>';
1634 echo $myErrors;
1635 }
1636
1637 ?>
1638