/** * Checks to see if Cuisine's simple view exists and toggles views. * * @access public * @return void **/ function cuisine_admin_init() { //if the simple view option doesnt exist, create it: if (!cuisine_simple_view_exists()) { cuisine_update_simple_view('false'); } //Check if we are toggeling production mode: cuisine_toggle_production_mode(); //toggle views: cuisine_check_toggle_simple_view(); if (cuisine_simple_view_is_active()) { //add the UI: add_action('admin_footer', 'cuisine_admin_simple_ui'); //add the body class: add_filter('admin_body_class', 'cuisine_admin_body_class'); //add simple view menu items from cuisine: add_filter('register_cuisine_simple_view_plugin', 'cuisine_register_native_menu_items'); } else { //add the top menu button: cuisine_advanced_view_button(); } // Add an extra button to the editor where we can add Shortcodes and other stuff: add_filter('mce_external_plugins', 'cuisine_add_editor_plugins'); add_filter('mce_buttons', 'cuisine_add_editor_button'); }
/** * Check if the simpel view is toggled: * * @access public * @return void */ function cuisine_check_toggle_simple_view() { //check if the current user can toggle: if (!current_user_can('toggle_admin_mode')) { return false; } if (isset($_GET['toggle-simple-view'])) { //get the view option: $view = cuisine_get_simple_view(); // update the simple view option: if ($view == 'false') { cuisine_update_simple_view('true'); } else { cuisine_update_simple_view('false'); } //redirect the user to the dashboard: wp_redirect(admin_url()); exit; } }