Пример #1
0
function wp_ozh_adminmenu_init()
{
    global $wp_ozh_adminmenu, $plugin_page;
    if ($plugin_page == 'ozh_admin_menu') {
        wp_ozh_adminmenu_load_page();
    }
    if (isset($_POST['ozh_adminmenu']) && $_POST['ozh_adminmenu'] == 1) {
        wp_ozh_adminmenu_processform();
    }
    // Superfluous double checking
    if (!defined('WP_CONTENT_URL')) {
        define('WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
    }
    if (!defined('WP_PLUGIN_URL')) {
        define('WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins');
    }
    if (!defined('WP_CONTENT_DIR')) {
        define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
    }
    if (!defined('WP_PLUGIN_DIR')) {
        define('WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins');
    }
    // full path, no trailing slash
    $defaults = wp_ozh_adminmenu_defaults();
    if (!count($wp_ozh_adminmenu)) {
        $wp_ozh_adminmenu = (array) get_option('ozh_adminmenu');
        unset($wp_ozh_adminmenu[0]);
    }
    $wp_ozh_adminmenu = array_merge($defaults, $wp_ozh_adminmenu);
    // Cannot have wpicons == 0 && compact == 1
    if ($wp_ozh_adminmenu['compact'] == 1) {
        $wp_ozh_adminmenu['wpicons'] = 1;
    }
    // upon Fluency activation+deactivation, too_many_plugins can be 0, let's fix this
    if (!$wp_ozh_adminmenu['too_many_plugins']) {
        $wp_ozh_adminmenu['too_many_plugins'] = 30;
    }
    // On minimode, add a Logout link to the Users menu
    if ($wp_ozh_adminmenu['minimode']) {
        add_users_page(__('Log Out'), __('Log Out'), 1, 'ozh_admin_menu_logout');
    }
}
Пример #2
0
function wp_ozh_adminmenu_init()
{
    global $wp_ozh_adminmenu, $plugin_page;
    if ($plugin_page == 'ozh_admin_menu') {
        wp_ozh_adminmenu_load_page();
    }
    if (isset($_POST['ozh_adminmenu']) && $_POST['ozh_adminmenu'] == 1) {
        wp_ozh_adminmenu_processform();
    }
    $defaults = wp_ozh_adminmenu_defaults();
    if (!count($wp_ozh_adminmenu)) {
        $wp_ozh_adminmenu = (array) get_option('ozh_adminmenu');
        unset($wp_ozh_adminmenu[0]);
    }
    // Allow plugins to modify the config
    $wp_ozh_adminmenu = apply_filters('ozh_adminmenu_init_config', array_merge($defaults, $wp_ozh_adminmenu));
    // Cannot have wpicons == 0 && compact == 1
    if ($wp_ozh_adminmenu['compact'] == 1) {
        $wp_ozh_adminmenu['wpicons'] = 1;
    }
    // upon Fluency activation+deactivation, too_many_plugins can be 0, let's fix this
    if (!$wp_ozh_adminmenu['too_many_plugins']) {
        $wp_ozh_adminmenu['too_many_plugins'] = 30;
    }
    // On minimode, add a Logout link to the Users menu
    if ($wp_ozh_adminmenu['minimode']) {
        add_users_page(__('Log Out'), __('Log Out'), 'read', 'ozh_admin_menu_logout');
    }
}
Пример #3
0
function wp_ozh_adminmenu_init() {
	global $wp_ozh_adminmenu, $plugin_page;
	
	if ($plugin_page == 'ozh_admin_menu')
		wp_ozh_adminmenu_load_page();

	if (isset($_POST['ozh_adminmenu']) && ($_POST['ozh_adminmenu'] == 1) )
		wp_ozh_adminmenu_processform();
	
	$defaults = wp_ozh_adminmenu_defaults();
	
	if (!count($wp_ozh_adminmenu)) {
		$wp_ozh_adminmenu = (array)get_option('ozh_adminmenu');
		unset($wp_ozh_adminmenu[0]);
	}
	
	$wp_ozh_adminmenu = array_merge($defaults, $wp_ozh_adminmenu);
	// Cannot have wpicons == 0 && compact == 1
	if ($wp_ozh_adminmenu['compact'] == 1)
		$wp_ozh_adminmenu['wpicons'] = 1;
	// upon Fluency activation+deactivation, too_many_plugins can be 0, let's fix this
	if (!$wp_ozh_adminmenu['too_many_plugins']) $wp_ozh_adminmenu['too_many_plugins'] = 30;

	// On minimode, add a Logout link to the Users menu
	if ($wp_ozh_adminmenu['minimode'])
		add_users_page(__('Log Out'), __('Log Out'), 1, 'ozh_admin_menu_logout');
}