update_options(); if (isset($_POST['menuId'])) { ?> addNew])) { ?>

renderInstructions() ?>
$v): ?>
Menu ID:
_set($menuId); $wid->form($v); ?>

'ADD NEW' and you're ready!", DosCeroMenuPlugin::DOMAIN) ?>

'MENU ID' is the number that you will later use in the PHP code to show the menu on your site", DosCeroMenuPlugin::DOMAIN) ?>

HTML ID: is the html unique id given to your menu. That code will allow you to apply css style or javascript to that particular menu", DosCeroMenuPlugin::DOMAIN) ?>

Layout: show the menu either on a horizontal (default) or vertical fasion", DosCeroMenuPlugin::DOMAIN) ?>

Expansion mode (vertical): the subitems/buttons that are expanded can be configured to be shown from right to left or left to right. This is only valid for vertical menues.", DosCeroMenuPlugin::DOMAIN) ?>

array() ,'lastId' => 1 ) ); } function update_options() { $options = self::get_options(); if (isset($_POST[$this->addNew])): $wid = new DosCeroMenuMenuWidget(); $options['instances']['new'] = $wid->getDefaultArgs(); endif; if (isset($_POST[$this->save])): $menuId = $_POST['menuId']; $lastId = $_POST['lastId']; $widgetDosCeroMenuWidget = $_POST['widget-doscero_menu_widget']; $wid = new DosCeroMenuMenuWidget(); $options['instances'][$menuId] = $wid->update($widgetDosCeroMenuWidget[$menuId], array()); if ($lastId == $menuId) $options['lastId']++; update_option(DosCeroMenuPlugin::OPTION, $options); endif; if (isset($_POST[$this->remove])): $menuId = $_POST['menuId']; unset($options['instances'][$menuId]); update_option(DosCeroMenuPlugin::OPTION, $options); endif; if (isset($_POST[$this->removeAll])): delete_option(DosCeroMenuPlugin::OPTION); $options = self::get_options(); endif; return $options; } function renderConfigurationPage() { include_once(dirname(__FILE__).'/DosCero.Menu.Config.php'); } function renderStylePage() { include_once(dirname(__FILE__).'/DosCero.Menu.Style.php'); } function renderHelpPage() { include_once(dirname(__FILE__).'/DosCero.Menu.Help.php'); } function admin_menu() { add_submenu_page('themes.php', __('2cero menu', DosCeroMenuPlugin::DOMAIN), __('2cero menu', DosCeroMenuPlugin::DOMAIN), 'manage_options', 'DosCeroMenu_ap_menu', array($this, 'renderAppareancePage')); add_menu_page(__('2cero menu', DosCeroMenuPlugin::DOMAIN), __('2cero menu', DosCeroMenuPlugin::DOMAIN), 'manage_options', 'DosCeroMenu_ap', array($this, 'renderConfigurationPage'), WP_PLUGIN_URL . '/DosCero.Menu/img/2ceroicon.png'); add_submenu_page('DosCeroMenu_ap', __('2cero menu configuration', DosCeroMenuPlugin::DOMAIN), __('Configuration', DosCeroMenuPlugin::DOMAIN), 'manage_options', 'DosCeroMenu_ap', array($this, 'renderConfigurationPage')); add_submenu_page('DosCeroMenu_ap', __('2cero menu create or edit', DosCeroMenuPlugin::DOMAIN), __('Create or edit', DosCeroMenuPlugin::DOMAIN), 'manage_options', 'DosCeroMenu_createEdit', array($this, 'renderAppareancePage')); add_submenu_page('DosCeroMenu_ap', __('2cero menu styles', DosCeroMenuPlugin::DOMAIN), __('Styles', DosCeroMenuPlugin::DOMAIN), 'manage_options', 'DosCeroMenu_style', array($this, 'renderStylePage')); add_submenu_page('DosCeroMenu_ap', __('2cero menu help', DosCeroMenuPlugin::DOMAIN), __('Help', DosCeroMenuPlugin::DOMAIN), 'manage_options', 'DosCeroMenu_help', array($this, 'renderHelpPage')); } function widget_init() { //register_widget( '\DosCero\Menu\MenuWidget' ); register_widget( 'DosCeroMenuMenuWidget' ); } function plugins_loaded() { //register_sidebar_widget(__('2Cero Menu', DosCeroMenuPlugin::DOMAIN), '\DosCero\Menu\MenuWidget'); register_sidebar_widget(__('2Cero Menu', DosCeroMenuPlugin::DOMAIN), 'DosCeroMenuMenuWidget'); } function menu_render($content) { $regStart = '<\!--2CeroMenu\('; $regEnd = '\)-->'; $regSearch = '/'.$regStart.'(\d+)'.$regEnd.'/'; if (!preg_match_all($regSearch, $content, $matches)) return; foreach($matches as $k => $match) { if ($k == 0) continue; $matchNumber = $match[0]; $widcontent = self::Render($matchNumber, true); if (strlen($widcontent)>0) $content = preg_replace('/'.$regStart.$matchNumber.$regEnd.'/',$widcontent,$content); } return $content; } public static function Render($menuId, $returnContent = false) { $options = self::get_options(); if (!isset($options['instances'][$menuId])) return ''; $wid = new DosCeroMenuMenuWidget(); $widcontent = ''; ob_start(); $wid->widget(array(),$options['instances'][$menuId]); $widcontent = ob_get_contents(); ob_end_clean(); if ($returnContent) return $widcontent; echo $widcontent; } } //} //namespace { //$dosCeroPlugin = new \DosCero\Menu\Plugin; $dosCeroPlugin = new DosCeroMenuPlugin; //} ?>