/** * FLUSH THE REWRITES: */ function flush_rewrites() { //if we're in the admin: if (is_admin()) { $rewrites = $this->rewrite_list; $rewritestring = ''; //create the rewrite string: if (!empty($rewrites)) { foreach ($rewrites as $slug => $rewrite) { $rewritestring .= '|' . $slug . '|'; } } //check if there are new redirects: $redirects = get_cuisine_setting('rewrites'); if (empty($redirects) || $redirects != $rewritestring) { //then flush the rewrite rules: global $wp_rewrite; $wp_rewrite->flush_rules(); //and update the redirects options: update_cuisine_setting('rewrites', $rewritestring); } } }
/** * Menu items to be added to Simple View from Cuisine: * * @access public * @return array */ function cuisine_register_native_menu_items($array) { global $cuisine; $settings = get_cuisine_setting('simple_view'); if ($settings['edit_menus']) { $a['Title'] = 'Menu\'s'; $a['link'] = 'nav-menus.php'; $a['icon'] = $cuisine->asset_url . '/images/menu-icon.png'; $array[] = $a; } return $array; }
/** * Output the UI for the overview page: * * @access public * @return css */ function cuisine_simple_ui_overview() { $settings = get_cuisine_setting('simple_view'); if (isset($_GET['post_type']) && $_GET['post_type'] == 'page') { echo '<style>'; if ($settings['add_pages']) { echo '.add-new-h2{display:inline !important;}'; } else { echo '.add-new-h2{display:none !important;}'; } if ($settings['delete_pages']) { echo '.trash{display:inline !important;}'; } else { echo '.trash{display:none !important;}'; echo '.tablenav.top{display:none !important;}'; echo 'input[type="checkbox"]{display:none}'; } do_action('cuisine_simple_view_style'); echo '</style>'; } }
/** * RETURN THE HTML FOR THE CUISINE OPTION PAGE * * @access public * @return html */ function cuisine_show_options_page() { global $cuisine; $s = get_cuisine_setting('simple_view'); if ($cuisine->production_mode) { $prod_class = 'productionmode'; } else { $prod_class = 'developmentmode'; } ?> <div class="wrap"> <form action="<?php echo admin_url(); ?> admin.php?page=cuisine_options" method="POST"> <?php global $cuisine; $cuisine->plugins->get_plugin_nonce(); ?> <h2><?php _e('Cuisine Options', 'cuisine'); ?> </h2> <?php if (current_user_can('toggle_production_mode')) { ?> <a class="cuisine_form_section cuisine_production_section <?php echo $prod_class; ?> " href="<?php echo admin_url(); ?> admin.php?page=cuisine_options&toggle_production_mode=true"> <h3><?php _e('Website Status', 'cuisine'); ?> </h3> <?php if ($cuisine->production_mode) { echo '<p>' . __('website is functioning normally in', 'cuisine') . ' <strong>' . __('PRODUCTION MODE', 'cuisine') . '</strong></p>'; echo '<p class="warning_txt">' . __('Click this bar to toggle it back to development mode.', 'cuisine') . '</p>'; } else { echo '<p>' . __('website might be a bit unstable because it\'s in', 'cuisine') . ' <strong>' . __('DEVELOPMENT MODE') . '</strong></p>'; echo '<p class="warning_txt">' . __('Click this bar to toggle it to production mode.', 'cuisine') . '</p>'; } ?> </a> <?php } ?> <div class="cuisine_form_section"> <h3><?php _e('First admin page', 'cuisine'); ?> </h3> <label> <input type="checkbox" name="cuisine_simple_view" <?php checked($s['simple_view'], true); ?> /> <?php _e('Enabled Simple View', 'cuisine'); ?> </label> <label> <input type="checkbox" name="cuisine_show_pages" <?php checked($s['show_pages_front'], true); ?> /> <?php _e('Show all pages directly', 'cuisine'); ?> </label> <label><?php _e('Icon size', 'cuisine'); ?> <select name="cuisine_icon_size"> <option value="50" <?php selected($s['icon_size'], '50'); ?> ><?php _e('Small', 'cuisine'); ?> </option> <option value="120" <?php selected($s['icon_size'], '120'); ?> ><?php _e('Medium', 'cuisine'); ?> </option> <option value="190" <?php selected($s['icon_size'], '190'); ?> ><?php _e('Large', 'cuisine'); ?> </option> <option value="250" <?php selected($s['icon_size'], '250'); ?> ><?php _e('Extra large', 'cuisine'); ?> </option> </select> </label> <label> <input type="checkbox" name="cuisine_edit_menus" <?php checked($s['edit_menus'], true); ?> /> <?php _e('Users can edit menu\'s', 'cuisine'); ?> </label> </div> <div class="cuisine_form_section"> <h3><?php _e('Overview page', 'cuisine'); ?> </h3> <label> <input type="checkbox" name="cuisine_add_pages" <?php checked($s['add_pages'], true); ?> /> <?php _e('Users can add new pages', 'cuisine'); ?> </label> <label> <input type="checkbox" name="cuisine_delete_pages" <?php checked($s['delete_pages'], true); ?> /> <?php _e('Users can delete pages', 'cuisine'); ?> </label> <label> <input type="checkbox" name="cuisine_back_button" <?php checked($s['back_button'], true); ?> /> <?php _e('Show \'Back button\'', 'cuisine'); ?> </label> </div> <div class="cuisine_form_section"> <input type="submit" value="<?php _e('Submit', 'cuisine'); ?> " class="primary"> </div> </form> </div> <?php }