diff options
author | mattab <matthieu.aubry@gmail.com> | 2013-10-09 13:45:41 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2013-10-09 13:45:41 +0400 |
commit | 500373c8f5bb32fa8c3488c551f357570c80e78d (patch) | |
tree | 12d4ea151445a1849e9ed4a06583a4fa956d3da5 /plugins | |
parent | 88a1d58d355430416f352c22ca3e4a6d56032bcc (diff) |
Refs #4202 Menu refactor GO. This one is tricky...
Diffstat (limited to 'plugins')
35 files changed, 105 insertions, 69 deletions
diff --git a/plugins/API/API.php b/plugins/API/API.php index 1cc57b3551..fda5c70ca1 100644 --- a/plugins/API/API.php +++ b/plugins/API/API.php @@ -18,6 +18,7 @@ use Piwik\DataTable\Row; use Piwik\DataTable; use Piwik\Date; use Piwik\Filesystem; +use Piwik\Menu\MenuTop; use Piwik\Metrics; use Piwik\Piwik; use Piwik\SettingsPiwik; @@ -666,7 +667,7 @@ class Plugin extends \Piwik\Plugin $apiUrlParams = array('module' => 'API', 'action' => 'listAllAPI', 'segment' => false); $tooltip = Piwik::translate('API_TopLinkTooltip'); - Piwik_AddTopMenu('General_API', $apiUrlParams, true, 7, $isHTML = false, $tooltip); + MenuTop::addEntry('General_API', $apiUrlParams, true, 7, $isHTML = false, $tooltip); $this->addTopMenuMobileApp(); } @@ -679,7 +680,7 @@ class Plugin extends \Piwik\Plugin require_once PIWIK_INCLUDE_PATH . '/libs/UserAgentParser/UserAgentParser.php'; $os = \UserAgentParser::getOperatingSystem($_SERVER['HTTP_USER_AGENT']); if ($os && in_array($os['id'], array('AND', 'IPD', 'IPA', 'IPH'))) { - Piwik_AddTopMenu('Piwik Mobile App', array('module' => 'Proxy', 'action' => 'redirect', 'url' => 'http://piwik.org/mobile/'), true, 4); + MenuTop::addEntry('Piwik Mobile App', array('module' => 'Proxy', 'action' => 'redirect', 'url' => 'http://piwik.org/mobile/'), true, 4); } } diff --git a/plugins/Actions/Actions.php b/plugins/Actions/Actions.php index 9f904d7409..97398fee58 100644 --- a/plugins/Actions/Actions.php +++ b/plugins/Actions/Actions.php @@ -14,6 +14,7 @@ use Piwik\API\Request; use Piwik\ArchiveProcessor; use Piwik\Common; use Piwik\Db; +use Piwik\Menu\MenuMain; use Piwik\MetricsFormatter; use Piwik\Piwik; use Piwik\SegmentExpression; @@ -565,16 +566,16 @@ class Actions extends \Piwik\Plugin function addMenus() { - Piwik_AddMenu('General_Actions', '', array('module' => 'Actions', 'action' => 'indexPageUrls'), true, 15); - Piwik_AddMenu('General_Actions', 'General_Pages', array('module' => 'Actions', 'action' => 'indexPageUrls'), true, 1); - Piwik_AddMenu('General_Actions', 'Actions_SubmenuPagesEntry', array('module' => 'Actions', 'action' => 'indexEntryPageUrls'), true, 2); - Piwik_AddMenu('General_Actions', 'Actions_SubmenuPagesExit', array('module' => 'Actions', 'action' => 'indexExitPageUrls'), true, 3); - Piwik_AddMenu('General_Actions', 'Actions_SubmenuPageTitles', array('module' => 'Actions', 'action' => 'indexPageTitles'), true, 4); - Piwik_AddMenu('General_Actions', 'General_Outlinks', array('module' => 'Actions', 'action' => 'indexOutlinks'), true, 6); - Piwik_AddMenu('General_Actions', 'General_Downloads', array('module' => 'Actions', 'action' => 'indexDownloads'), true, 7); + MenuMain::getInstance()->add('General_Actions', '', array('module' => 'Actions', 'action' => 'indexPageUrls'), true, 15); + MenuMain::getInstance()->add('General_Actions', 'General_Pages', array('module' => 'Actions', 'action' => 'indexPageUrls'), true, 1); + MenuMain::getInstance()->add('General_Actions', 'Actions_SubmenuPagesEntry', array('module' => 'Actions', 'action' => 'indexEntryPageUrls'), true, 2); + MenuMain::getInstance()->add('General_Actions', 'Actions_SubmenuPagesExit', array('module' => 'Actions', 'action' => 'indexExitPageUrls'), true, 3); + MenuMain::getInstance()->add('General_Actions', 'Actions_SubmenuPageTitles', array('module' => 'Actions', 'action' => 'indexPageTitles'), true, 4); + MenuMain::getInstance()->add('General_Actions', 'General_Outlinks', array('module' => 'Actions', 'action' => 'indexOutlinks'), true, 6); + MenuMain::getInstance()->add('General_Actions', 'General_Downloads', array('module' => 'Actions', 'action' => 'indexDownloads'), true, 7); if ($this->isSiteSearchEnabled()) { - Piwik_AddMenu('General_Actions', 'Actions_SubmenuSitesearch', array('module' => 'Actions', 'action' => 'indexSiteSearch'), true, 5); + MenuMain::getInstance()->add('General_Actions', 'Actions_SubmenuSitesearch', array('module' => 'Actions', 'action' => 'indexSiteSearch'), true, 5); } } diff --git a/plugins/CoreAdminHome/Controller.php b/plugins/CoreAdminHome/Controller.php index 77ed3e8f95..ffedbcf624 100644 --- a/plugins/CoreAdminHome/Controller.php +++ b/plugins/CoreAdminHome/Controller.php @@ -15,6 +15,7 @@ use Piwik\API\ResponseBuilder; use Piwik\ArchiveProcessor\Rules; use Piwik\Common; use Piwik\Config; +use Piwik\Menu\MenuTop; use Piwik\Nonce; use Piwik\Piwik; use Piwik\Plugins\LanguagesManager\API as APILanguagesManager; @@ -144,7 +145,7 @@ class Controller extends \Piwik\Controller\Admin { $view = new View('@CoreAdminHome/trackingCodeGenerator'); $this->setBasicVariablesView($view); - $view->topMenu = Piwik_GetTopMenu(); + $view->topMenu = MenuTop::getInstance()->getMenu(); $viewableIdSites = APISitesManager::getInstance()->getSitesIdWithAtLeastViewAccess(); diff --git a/plugins/CoreAdminHome/CoreAdminHome.php b/plugins/CoreAdminHome/CoreAdminHome.php index 24fb7e52b2..923c729555 100644 --- a/plugins/CoreAdminHome/CoreAdminHome.php +++ b/plugins/CoreAdminHome/CoreAdminHome.php @@ -14,6 +14,7 @@ use Piwik\DataAccess\ArchiveSelector; use Piwik\DataAccess\ArchiveTableCreator; use Piwik\Date; use Piwik\Db; +use Piwik\Menu\MenuAdmin; use Piwik\Piwik; use Piwik\ScheduledTask; use Piwik\ScheduledTime\Daily; @@ -80,14 +81,14 @@ class CoreAdminHome extends \Piwik\Plugin function addMenu() { - Piwik_AddAdminSubMenu('CoreAdminHome_MenuManage', null, "", Piwik::isUserHasSomeAdminAccess(), $order = 1); - Piwik_AddAdminSubMenu('CoreAdminHome_MenuDiagnostic', null, "", Piwik::isUserHasSomeAdminAccess(), $order = 6); - Piwik_AddAdminSubMenu('General_Settings', null, "", Piwik::isUserHasSomeAdminAccess(), $order = 5); - Piwik_AddAdminSubMenu('General_Settings', 'CoreAdminHome_MenuGeneralSettings', + MenuAdmin::getInstance()->add('CoreAdminHome_MenuManage', null, "", Piwik::isUserHasSomeAdminAccess(), $order = 1); + MenuAdmin::getInstance()->add('CoreAdminHome_MenuDiagnostic', null, "", Piwik::isUserHasSomeAdminAccess(), $order = 6); + MenuAdmin::getInstance()->add('General_Settings', null, "", Piwik::isUserHasSomeAdminAccess(), $order = 5); + MenuAdmin::getInstance()->add('General_Settings', 'CoreAdminHome_MenuGeneralSettings', array('module' => 'CoreAdminHome', 'action' => 'generalSettings'), Piwik::isUserHasSomeAdminAccess(), $order = 6); - Piwik_AddAdminSubMenu('CoreAdminHome_MenuManage', 'CoreAdminHome_TrackingCode', + MenuAdmin::getInstance()->add('CoreAdminHome_MenuManage', 'CoreAdminHome_TrackingCode', array('module' => 'CoreAdminHome', 'action' => 'trackingCodeGenerator'), Piwik::isUserHasSomeAdminAccess(), $order = 4); diff --git a/plugins/CoreAdminHome/templates/_menu.twig b/plugins/CoreAdminHome/templates/_menu.twig index 70ba3572c2..5ec9b95cbd 100644 --- a/plugins/CoreAdminHome/templates/_menu.twig +++ b/plugins/CoreAdminHome/templates/_menu.twig @@ -1,7 +1,7 @@ -{% if menu|length > 1 %} +{% if adminMenu|length > 1 %} <div class="Menu Menu--admin"> <ul class="Menu-tabList"> - {% for name,submenu in menu %} + {% for name,submenu in adminMenu %} {% if submenu._hasSubmenu %} <li> <span>{{ name|translate }}</span> diff --git a/plugins/CoreHome/Controller.php b/plugins/CoreHome/Controller.php index 63053b7ca9..b201d30463 100644 --- a/plugins/CoreHome/Controller.php +++ b/plugins/CoreHome/Controller.php @@ -15,6 +15,7 @@ use Piwik\API\Request; use Piwik\Common; use Piwik\Date; use Piwik\FrontController; +use Piwik\Menu\MenuMain; use Piwik\Piwik; use Piwik\Plugins\CoreHome\DataTableRowAction\MultiRowEvolution; use Piwik\Plugins\CoreHome\DataTableRowAction\RowEvolution; @@ -72,7 +73,7 @@ class Controller extends \Piwik\Controller { $view = new View('@CoreHome/getDefaultIndexView'); $this->setGeneralVariablesView($view); - $view->menu = Piwik_GetMenu(); + $view->menu = MenuMain::getInstance()->getMenu(); $view->content = ''; return $view; } diff --git a/plugins/CorePluginsAdmin/CorePluginsAdmin.php b/plugins/CorePluginsAdmin/CorePluginsAdmin.php index b1fe58b414..c84fef6f72 100644 --- a/plugins/CorePluginsAdmin/CorePluginsAdmin.php +++ b/plugins/CorePluginsAdmin/CorePluginsAdmin.php @@ -10,6 +10,7 @@ */ namespace Piwik\Plugins\CorePluginsAdmin; +use Piwik\Menu\MenuAdmin; use Piwik\Piwik; use Piwik\ScheduledTask; use Piwik\ScheduledTime\Daily; @@ -71,16 +72,16 @@ class CorePluginsAdmin extends \Piwik\Plugin } } - Piwik_AddAdminSubMenu('CorePluginsAdmin_MenuPlatform', null, "", !Piwik::isUserIsAnonymous(), $order = 15); - Piwik_AddAdminSubMenu('CorePluginsAdmin_MenuPlatform', Piwik::translate('General_Plugins') . $pluginsUpdateMessage, + MenuAdmin::getInstance()->add('CorePluginsAdmin_MenuPlatform', null, "", !Piwik::isUserIsAnonymous(), $order = 15); + MenuAdmin::getInstance()->add('CorePluginsAdmin_MenuPlatform', Piwik::translate('General_Plugins') . $pluginsUpdateMessage, array('module' => 'CorePluginsAdmin', 'action' => 'plugins', 'activated' => ''), Piwik::isUserIsSuperUser(), $order = 1); - Piwik_AddAdminSubMenu('CorePluginsAdmin_MenuPlatform', Piwik::translate('CorePluginsAdmin_Themes') . $themesUpdateMessage, + MenuAdmin::getInstance()->add('CorePluginsAdmin_MenuPlatform', Piwik::translate('CorePluginsAdmin_Themes') . $themesUpdateMessage, array('module' => 'CorePluginsAdmin', 'action' => 'themes', 'activated' => ''), Piwik::isUserIsSuperUser(), $order = 3); - Piwik_AddAdminSubMenu('CorePluginsAdmin_MenuPlatform', 'CorePluginsAdmin_MenuExtend', + MenuAdmin::getInstance()->add('CorePluginsAdmin_MenuPlatform', 'CorePluginsAdmin_MenuExtend', array('module' => 'CorePluginsAdmin', 'action' => 'extend', 'activated' => ''), !Piwik::isUserIsAnonymous(), $order = 5); diff --git a/plugins/CoreVisualizations/JqplotDataGenerator/Evolution.php b/plugins/CoreVisualizations/JqplotDataGenerator/Evolution.php index 342bd1bdb0..8fbf5e7e78 100644 --- a/plugins/CoreVisualizations/JqplotDataGenerator/Evolution.php +++ b/plugins/CoreVisualizations/JqplotDataGenerator/Evolution.php @@ -14,6 +14,7 @@ namespace Piwik\Plugins\CoreVisualizations\JqplotDataGenerator; use Piwik\Common; use Piwik\DataTable; use Piwik\DataTable\Row; +use Piwik\Menu\MenuMain; use Piwik\Plugins\CoreVisualizations\JqplotDataGenerator; use Piwik\Url; use Piwik\ViewDataTable; @@ -168,7 +169,7 @@ class Evolution extends JqplotDataGenerator foreach ($piwikParameters as $parameter) { unset($queryString[$parameter]); } - if (\Piwik\Menu\Main::getInstance()->isUrlFound($queryString)) { + if (MenuMain::getInstance()->isUrlFound($queryString)) { return $queryString; } return false; diff --git a/plugins/CustomVariables/CustomVariables.php b/plugins/CustomVariables/CustomVariables.php index b6a5e72fd6..763ee09634 100644 --- a/plugins/CustomVariables/CustomVariables.php +++ b/plugins/CustomVariables/CustomVariables.php @@ -11,6 +11,7 @@ namespace Piwik\Plugins\CustomVariables; use Piwik\ArchiveProcessor; +use Piwik\Menu\MenuMain; use Piwik\Piwik; use Piwik\Tracker; use Piwik\WidgetsList; @@ -52,7 +53,7 @@ class CustomVariables extends \Piwik\Plugin public function addMenus() { - Piwik_AddMenu('General_Visitors', 'CustomVariables_CustomVariables', array('module' => 'CustomVariables', 'action' => 'index'), $display = true, $order = 50); + MenuMain::getInstance()->add('General_Visitors', 'CustomVariables_CustomVariables', array('module' => 'CustomVariables', 'action' => 'index'), $display = true, $order = 50); } /** diff --git a/plugins/DBStats/DBStats.php b/plugins/DBStats/DBStats.php index c1f3c58f59..be12d261fa 100644 --- a/plugins/DBStats/DBStats.php +++ b/plugins/DBStats/DBStats.php @@ -13,6 +13,7 @@ namespace Piwik\Plugins\DBStats; use Piwik\Common; use Piwik\Date; +use Piwik\Menu\MenuAdmin; use Piwik\Option; use Piwik\Piwik; use Piwik\ScheduledTask; @@ -41,7 +42,7 @@ class DBStats extends \Piwik\Plugin function addMenu() { - Piwik_AddAdminSubMenu('CoreAdminHome_MenuDiagnostic', 'DBStats_DatabaseUsage', + MenuAdmin::getInstance()->add('CoreAdminHome_MenuDiagnostic', 'DBStats_DatabaseUsage', array('module' => 'DBStats', 'action' => 'index'), Piwik::isUserIsSuperUser(), $order = 6); diff --git a/plugins/Dashboard/Dashboard.php b/plugins/Dashboard/Dashboard.php index 6311043d99..dd6a0741fd 100644 --- a/plugins/Dashboard/Dashboard.php +++ b/plugins/Dashboard/Dashboard.php @@ -13,6 +13,8 @@ namespace Piwik\Plugins\Dashboard; use Exception; use Piwik\Common; use Piwik\Db; +use Piwik\Menu\MenuMain; +use Piwik\Menu\MenuTop; use Piwik\Piwik; use Piwik\Site; use Piwik\WidgetsList; @@ -198,7 +200,7 @@ class Dashboard extends \Piwik\Plugin public function addMenus() { - Piwik_AddMenu('Dashboard_Dashboard', '', array('module' => 'Dashboard', 'action' => 'embeddedIndex', 'idDashboard' => 1), true, 5); + MenuMain::getInstance()->add('Dashboard_Dashboard', '', array('module' => 'Dashboard', 'action' => 'embeddedIndex', 'idDashboard' => 1), true, 5); if (!Piwik::isUserIsAnonymous()) { $login = Piwik::getCurrentUserLogin(); @@ -207,7 +209,7 @@ class Dashboard extends \Piwik\Plugin if (count($dashboards) > 1) { $pos = 0; foreach ($dashboards AS $dashboard) { - Piwik_AddMenu('Dashboard_Dashboard', $dashboard['name'], array('module' => 'Dashboard', 'action' => 'embeddedIndex', 'idDashboard' => $dashboard['iddashboard']), true, $pos); + MenuMain::getInstance()->add('Dashboard_Dashboard', $dashboard['name'], array('module' => 'Dashboard', 'action' => 'embeddedIndex', 'idDashboard' => $dashboard['iddashboard']), true, $pos); $pos++; } } @@ -225,7 +227,7 @@ class Dashboard extends \Piwik\Plugin } $urlParams = array('module' => 'CoreHome', 'action' => 'index'); - Piwik_AddTopMenu('Dashboard_Dashboard', $urlParams, true, 1, $isHTML = false, $tooltip); + MenuTop::addEntry('Dashboard_Dashboard', $urlParams, true, 1, $isHTML = false, $tooltip); } public function getJsFiles(&$jsFiles) diff --git a/plugins/DevicesDetection/DevicesDetection.php b/plugins/DevicesDetection/DevicesDetection.php index 01075107ec..b2d42e4390 100644 --- a/plugins/DevicesDetection/DevicesDetection.php +++ b/plugins/DevicesDetection/DevicesDetection.php @@ -17,6 +17,7 @@ use Piwik\ArchiveProcessor; use Piwik\Common; use Piwik\Config; use Piwik\Db; +use Piwik\Menu\MenuMain; use Piwik\Piwik; use Piwik\WidgetsList; use UserAgentParserEnhanced; @@ -290,7 +291,7 @@ class DevicesDetection extends \Piwik\Plugin public function addMenu() { - Piwik_AddMenu('General_Visitors', 'DevicesDetection_submenu', array('module' => 'DevicesDetection', 'action' => 'index')); + MenuMain::getInstance()->add('General_Visitors', 'DevicesDetection_submenu', array('module' => 'DevicesDetection', 'action' => 'index')); } public function getReportDisplayProperties(&$properties) diff --git a/plugins/ExamplePlugin/Controller.php b/plugins/ExamplePlugin/Controller.php index 38104a177f..1dc8c07e59 100644 --- a/plugins/ExamplePlugin/Controller.php +++ b/plugins/ExamplePlugin/Controller.php @@ -85,7 +85,7 @@ class Controller extends \Piwik\Controller $out .= '<code>$this->str_date</code> = current selected date in YYYY-MM-DD format<br />'; $out .= '<h3>Misc</h3>'; - $out .= '<code>Piwik_AddMenu( $mainMenuName, $subMenuName, $url );</code> - Adds an entry to the menu in the Piwik interface (See the example in the <a href="https://github.com/piwik/piwik/blob/1.0/plugins/UserCountry/UserCountry.php#L76">UserCountry Plugin file</a>)<br />'; + $out .= '<code>\Piwik\Menu\Main::getInstance()->add( $mainMenuName, $subMenuName, $url );</code> - Adds an entry to the menu in the Piwik interface (See the example in the <a href="https://github.com/piwik/piwik/blob/1.0/plugins/UserCountry/UserCountry.php#L76">UserCountry Plugin file</a>)<br />'; $out .= '<code>WidgetsList::add( $widgetCategory, $widgetName, $controllerName, $controllerAction, $customParameters = array());</code> - Adds a widget that users can add in the dashboard, or export using the Widgets link at the top of the screen. See the example in the <a href="https://github.com/piwik/piwik/blob/1.0/plugins/UserCountry/UserCountry.php#L70">UserCountry Plugin file</a> or any other plugin)<br />'; $out .= '<code>Common::prefixTable("site")</code> = <b>' . Common::prefixTable("site") . '</b><br />'; diff --git a/plugins/ExampleUI/ExampleUI.php b/plugins/ExampleUI/ExampleUI.php index 2c22bb90b7..e5d11ffddd 100644 --- a/plugins/ExampleUI/ExampleUI.php +++ b/plugins/ExampleUI/ExampleUI.php @@ -10,6 +10,7 @@ */ namespace Piwik\Plugins\ExampleUI; +use Piwik\Menu\MenuMain; /** * @package ExampleUI @@ -28,7 +29,7 @@ class ExampleUI extends \Piwik\Plugin function addMenus() { - Piwik_AddMenu('UI Framework', '', array('module' => 'ExampleUI', 'action' => 'dataTables'), true, 30); + MenuMain::getInstance()->add('UI Framework', '', array('module' => 'ExampleUI', 'action' => 'dataTables'), true, 30); $this->addSubMenu('Data tables', 'dataTables', 1); $this->addSubMenu('Bar graph', 'barGraph', 2); @@ -40,6 +41,6 @@ class ExampleUI extends \Piwik\Plugin private function addSubMenu($subMenu, $action, $order) { - Piwik_AddMenu('UI Framework', $subMenu, array('module' => 'ExampleUI', 'action' => $action), true, $order); + MenuMain::getInstance()->add('UI Framework', $subMenu, array('module' => 'ExampleUI', 'action' => $action), true, $order); } } diff --git a/plugins/Feedback/Feedback.php b/plugins/Feedback/Feedback.php index f59e988a24..1e39ff47f5 100644 --- a/plugins/Feedback/Feedback.php +++ b/plugins/Feedback/Feedback.php @@ -9,6 +9,7 @@ * @package Feedback */ namespace Piwik\Plugins\Feedback; +use Piwik\Menu\MenuTop; use Piwik\Piwik; @@ -34,7 +35,7 @@ class Feedback extends \Piwik\Plugin public function addTopMenu() { - Piwik_AddTopMenu( + MenuTop::addEntry( 'General_GiveUsYourFeedback', array('module' => 'Feedback', 'action' => 'index', 'segment' => false), true, diff --git a/plugins/Goals/Goals.php b/plugins/Goals/Goals.php index 8e7955c75c..1d60a52966 100644 --- a/plugins/Goals/Goals.php +++ b/plugins/Goals/Goals.php @@ -14,6 +14,7 @@ use Piwik\ArchiveProcessor; use Piwik\Common; use Piwik\Db; +use Piwik\Menu\MenuMain; use Piwik\Piwik; use Piwik\Site; use Piwik\Tracker\GoalManager; @@ -458,18 +459,18 @@ class Goals extends \Piwik\Plugin $mainGoalMenu = $this->getGoalCategoryName($idSite); $site = new Site($idSite); if (count($goals) == 0) { - Piwik_AddMenu($mainGoalMenu, '', array( + MenuMain::getInstance()->add($mainGoalMenu, '', array( 'module' => 'Goals', 'action' => ($site->isEcommerceEnabled() ? 'ecommerceReport' : 'addNewGoal'), 'idGoal' => ($site->isEcommerceEnabled() ? Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER : null)), true, 25); if ($site->isEcommerceEnabled()) { - Piwik_AddMenu($mainGoalMenu, 'Goals_Ecommerce', array('module' => 'Goals', 'action' => 'ecommerceReport', 'idGoal' => Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER), true, 1); + MenuMain::getInstance()->add($mainGoalMenu, 'Goals_Ecommerce', array('module' => 'Goals', 'action' => 'ecommerceReport', 'idGoal' => Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER), true, 1); } - Piwik_AddMenu($mainGoalMenu, 'Goals_AddNewGoal', array('module' => 'Goals', 'action' => 'addNewGoal')); + MenuMain::getInstance()->add($mainGoalMenu, 'Goals_AddNewGoal', array('module' => 'Goals', 'action' => 'addNewGoal')); } else { - Piwik_AddMenu($mainGoalMenu, '', array( + MenuMain::getInstance()->add($mainGoalMenu, '', array( 'module' => 'Goals', 'action' => ($site->isEcommerceEnabled() ? 'ecommerceReport' : 'index'), 'idGoal' => ($site->isEcommerceEnabled() ? Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER : null)), @@ -477,11 +478,11 @@ class Goals extends \Piwik\Plugin 25); if ($site->isEcommerceEnabled()) { - Piwik_AddMenu($mainGoalMenu, 'Goals_Ecommerce', array('module' => 'Goals', 'action' => 'ecommerceReport', 'idGoal' => Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER), true, 1); + MenuMain::getInstance()->add($mainGoalMenu, 'Goals_Ecommerce', array('module' => 'Goals', 'action' => 'ecommerceReport', 'idGoal' => Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER), true, 1); } - Piwik_AddMenu($mainGoalMenu, 'Goals_GoalsOverview', array('module' => 'Goals', 'action' => 'index'), true, 2); + MenuMain::getInstance()->add($mainGoalMenu, 'Goals_GoalsOverview', array('module' => 'Goals', 'action' => 'index'), true, 2); foreach ($goals as $goal) { - Piwik_AddMenu($mainGoalMenu, str_replace('%', '%%', Translate::clean($goal['name'])), array('module' => 'Goals', 'action' => 'goalReport', 'idGoal' => $goal['idgoal'])); + MenuMain::getInstance()->add($mainGoalMenu, str_replace('%', '%%', Translate::clean($goal['name'])), array('module' => 'Goals', 'action' => 'goalReport', 'idGoal' => $goal['idgoal'])); } } } diff --git a/plugins/Installation/Installation.php b/plugins/Installation/Installation.php index dca5ecb666..5f7bafd4e5 100644 --- a/plugins/Installation/Installation.php +++ b/plugins/Installation/Installation.php @@ -11,6 +11,7 @@ namespace Piwik\Plugins\Installation; use Piwik\Common; +use Piwik\Menu\MenuAdmin; use Piwik\Piwik; use Piwik\Translate; @@ -78,7 +79,7 @@ class Installation extends \Piwik\Plugin */ public function addMenu() { - Piwik_AddAdminMenu('Installation_SystemCheck', + MenuAdmin::addEntry('Installation_SystemCheck', array('module' => 'Installation', 'action' => 'systemCheckPage'), $addIf = Piwik::isUserIsSuperUser(), $order = 15); diff --git a/plugins/LanguagesManager/LanguagesManager.php b/plugins/LanguagesManager/LanguagesManager.php index f46ddacfe6..d3e162a875 100644 --- a/plugins/LanguagesManager/LanguagesManager.php +++ b/plugins/LanguagesManager/LanguagesManager.php @@ -17,6 +17,7 @@ use Piwik\Config; use Piwik\Cookie; use Piwik\Db; +use Piwik\Menu\MenuTop; use Piwik\Piwik; use Piwik\Translate; use Piwik\View; @@ -54,7 +55,7 @@ class LanguagesManager extends \Piwik\Plugin public function showLanguagesSelector() { - Piwik_AddTopMenu('LanguageSelector', $this->getLanguagesSelector(), true, $order = 30, true); + MenuTop::addEntry('LanguageSelector', $this->getLanguagesSelector(), true, $order = 30, true); } /** diff --git a/plugins/Live/Live.php b/plugins/Live/Live.php index e08d556b0a..f309877ce0 100644 --- a/plugins/Live/Live.php +++ b/plugins/Live/Live.php @@ -12,6 +12,7 @@ namespace Piwik\Plugins\Live; use Piwik\Common; +use Piwik\Menu\MenuMain; use Piwik\Piwik; use Piwik\WidgetsList; @@ -52,7 +53,7 @@ class Live extends \Piwik\Plugin public function addMenu() { - Piwik_AddMenu('General_Visitors', 'Live_VisitorLog', array('module' => 'Live', 'action' => 'indexVisitorLog'), true, $order = 5); + MenuMain::getInstance()->add('General_Visitors', 'Live_VisitorLog', array('module' => 'Live', 'action' => 'indexVisitorLog'), true, $order = 5); } public function addWidget() diff --git a/plugins/MobileMessaging/MobileMessaging.php b/plugins/MobileMessaging/MobileMessaging.php index 846a453ff6..736bdf0d3d 100644 --- a/plugins/MobileMessaging/MobileMessaging.php +++ b/plugins/MobileMessaging/MobileMessaging.php @@ -10,6 +10,7 @@ */ namespace Piwik\Plugins\MobileMessaging; +use Piwik\Menu\MenuAdmin; use Piwik\Option; use Piwik\Piwik; use Piwik\Plugins\API\API as APIPlugins; @@ -86,10 +87,11 @@ class MobileMessaging extends \Piwik\Plugin function addMenu() { - Piwik_AddAdminMenu( + MenuAdmin::addEntry( 'MobileMessaging_SettingsMenu', array('module' => 'MobileMessaging', 'action' => 'index'), - true + true, + $order = 12 ); } diff --git a/plugins/MultiSites/MultiSites.php b/plugins/MultiSites/MultiSites.php index ef38a890da..00d718d00d 100644 --- a/plugins/MultiSites/MultiSites.php +++ b/plugins/MultiSites/MultiSites.php @@ -9,6 +9,7 @@ * @package MultiSites */ namespace Piwik\Plugins\MultiSites; +use Piwik\Menu\MenuTop; use Piwik\Piwik; @@ -78,7 +79,7 @@ class MultiSites extends \Piwik\Plugin { $urlParams = array('module' => 'MultiSites', 'action' => 'index', 'segment' => false); $tooltip = Piwik::translate('MultiSites_TopLinkTooltip'); - Piwik_AddTopMenu('General_MultiSitesSummary', $urlParams, true, 3, $isHTML = false, $tooltip); + MenuTop::addEntry('General_MultiSitesSummary', $urlParams, true, 3, $isHTML = false, $tooltip); } public function getJsFiles(&$jsFiles) diff --git a/plugins/PrivacyManager/PrivacyManager.php b/plugins/PrivacyManager/PrivacyManager.php index 7c1880cc3f..98de8bd5e0 100644 --- a/plugins/PrivacyManager/PrivacyManager.php +++ b/plugins/PrivacyManager/PrivacyManager.php @@ -15,6 +15,7 @@ use Piwik\Common; use Piwik\Config; use Piwik\Date; use Piwik\Db; +use Piwik\Menu\MenuAdmin; use Piwik\Metrics; use Piwik\Option; @@ -97,7 +98,7 @@ class PrivacyManager extends \Piwik\Plugin function addMenu() { - Piwik_AddAdminMenu('PrivacyManager_MenuPrivacySettings', + MenuAdmin::addEntry('PrivacyManager_MenuPrivacySettings', array('module' => 'PrivacyManager', 'action' => 'privacySettings'), Piwik::isUserHasSomeAdminAccess(), $order = 7); diff --git a/plugins/Provider/Provider.php b/plugins/Provider/Provider.php index d47e774d2d..41dc2e6fff 100644 --- a/plugins/Provider/Provider.php +++ b/plugins/Provider/Provider.php @@ -17,6 +17,7 @@ use Piwik\Db; use Piwik\FrontController; use Piwik\IP; +use Piwik\Menu\MenuMain; use Piwik\Piwik; use Piwik\WidgetsList; @@ -98,7 +99,7 @@ class Provider extends \Piwik\Plugin public function addMenu() { - Piwik_RenameMenuEntry('General_Visitors', 'UserCountry_SubmenuLocations', + MenuMain::getInstance()->rename('General_Visitors', 'UserCountry_SubmenuLocations', 'General_Visitors', 'Provider_SubmenuLocationsProvider'); } diff --git a/plugins/Referrers/Referrers.php b/plugins/Referrers/Referrers.php index 96cd26d111..e2714706eb 100644 --- a/plugins/Referrers/Referrers.php +++ b/plugins/Referrers/Referrers.php @@ -12,6 +12,7 @@ namespace Piwik\Plugins\Referrers; use Piwik\ArchiveProcessor; use Piwik\Common; +use Piwik\Menu\MenuMain; use Piwik\Piwik; use Piwik\SettingsPiwik; use Piwik\WidgetsList; @@ -230,11 +231,11 @@ class Referrers extends \Piwik\Plugin */ function addMenus() { - Piwik_AddMenu('Referrers_Referrers', '', array('module' => 'Referrers', 'action' => 'index'), true, 20); - Piwik_AddMenu('Referrers_Referrers', 'General_Overview', array('module' => 'Referrers', 'action' => 'index'), true, 1); - Piwik_AddMenu('Referrers_Referrers', 'Referrers_SubmenuSearchEngines', array('module' => 'Referrers', 'action' => 'getSearchEnginesAndKeywords'), true, 2); - Piwik_AddMenu('Referrers_Referrers', 'Referrers_SubmenuWebsites', array('module' => 'Referrers', 'action' => 'indexWebsites'), true, 3); - Piwik_AddMenu('Referrers_Referrers', 'Referrers_Campaigns', array('module' => 'Referrers', 'action' => 'indexCampaigns'), true, 4); + MenuMain::getInstance()->add('Referrers_Referrers', '', array('module' => 'Referrers', 'action' => 'index'), true, 20); + MenuMain::getInstance()->add('Referrers_Referrers', 'General_Overview', array('module' => 'Referrers', 'action' => 'index'), true, 1); + MenuMain::getInstance()->add('Referrers_Referrers', 'Referrers_SubmenuSearchEngines', array('module' => 'Referrers', 'action' => 'getSearchEnginesAndKeywords'), true, 2); + MenuMain::getInstance()->add('Referrers_Referrers', 'Referrers_SubmenuWebsites', array('module' => 'Referrers', 'action' => 'indexWebsites'), true, 3); + MenuMain::getInstance()->add('Referrers_Referrers', 'Referrers_Campaigns', array('module' => 'Referrers', 'action' => 'indexCampaigns'), true, 4); } /** diff --git a/plugins/ScheduledReports/ScheduledReports.php b/plugins/ScheduledReports/ScheduledReports.php index b31f2af312..f59f6a4dbe 100644 --- a/plugins/ScheduledReports/ScheduledReports.php +++ b/plugins/ScheduledReports/ScheduledReports.php @@ -16,6 +16,7 @@ use Piwik\Config; use Piwik\Date; use Piwik\Db; use Piwik\Mail; +use Piwik\Menu\MenuTop; use Piwik\Piwik; use Piwik\Plugins\MobileMessaging\API as APIMobileMessaging; use Piwik\Plugins\MobileMessaging\MobileMessaging; @@ -470,7 +471,7 @@ class ScheduledReports extends \Piwik\Plugin function addTopMenu() { - Piwik_AddTopMenu( + MenuTop::addEntry( $this->getTopMenuTranslationKey(), array('module' => 'ScheduledReports', 'action' => 'index', 'segment' => false), true, diff --git a/plugins/SitesManager/SitesManager.php b/plugins/SitesManager/SitesManager.php index 0671890c2a..5b4f8db061 100644 --- a/plugins/SitesManager/SitesManager.php +++ b/plugins/SitesManager/SitesManager.php @@ -10,6 +10,7 @@ */ namespace Piwik\Plugins\SitesManager; +use Piwik\Menu\MenuAdmin; use Piwik\Piwik; /** @@ -38,7 +39,7 @@ class SitesManager extends \Piwik\Plugin function addMenu() { - Piwik_AddAdminSubMenu('CoreAdminHome_MenuManage', 'SitesManager_Sites', + MenuAdmin::getInstance()->add('CoreAdminHome_MenuManage', 'SitesManager_Sites', array('module' => 'SitesManager', 'action' => 'index'), Piwik::isUserHasSomeAdminAccess(), $order = 1); diff --git a/plugins/UserCountry/UserCountry.php b/plugins/UserCountry/UserCountry.php index 7ca5500011..2a8fb5af51 100644 --- a/plugins/UserCountry/UserCountry.php +++ b/plugins/UserCountry/UserCountry.php @@ -13,6 +13,8 @@ namespace Piwik\Plugins\UserCountry; use Piwik\ArchiveProcessor; use Piwik\Common; use Piwik\IP; +use Piwik\Menu\MenuAdmin; +use Piwik\Menu\MenuMain; use Piwik\Piwik; use Piwik\Plugins\UserCountry\LocationProvider\DefaultProvider; use Piwik\Plugins\UserCountry\LocationProvider; @@ -186,15 +188,15 @@ class UserCountry extends \Piwik\Plugin public function addMenu() { - Piwik_AddMenu('General_Visitors', 'UserCountry_SubmenuLocations', array('module' => 'UserCountry', 'action' => 'index')); + MenuMain::getInstance()->add('General_Visitors', 'UserCountry_SubmenuLocations', array('module' => 'UserCountry', 'action' => 'index')); } /** - * Event handler. Adds menu items to the Admin menu. + * Event handler. Adds menu items to the MenuAdmin menu. */ public function addAdminMenu() { - Piwik_AddAdminSubMenu('General_Settings', 'UserCountry_Geolocation', + MenuAdmin::getInstance()->add('General_Settings', 'UserCountry_Geolocation', array('module' => 'UserCountry', 'action' => 'adminIndex'), Piwik::isUserIsSuperUser(), $order = 8); diff --git a/plugins/UserCountryMap/UserCountryMap.php b/plugins/UserCountryMap/UserCountryMap.php index c976d784fb..1fd94f98dd 100644 --- a/plugins/UserCountryMap/UserCountryMap.php +++ b/plugins/UserCountryMap/UserCountryMap.php @@ -11,6 +11,7 @@ namespace Piwik\Plugins\UserCountryMap; use Piwik\FrontController; +use Piwik\Menu\MenuMain; use Piwik\Piwik; use Piwik\Version; use Piwik\WidgetsList; @@ -64,7 +65,7 @@ class UserCountryMap extends \Piwik\Plugin public function addMenu() { - Piwik_AddMenu('General_Visitors', 'UserCountryMap_RealTimeMap', array('module' => 'UserCountryMap', 'action' => 'realtimeWorldMap'), true, $order = 70); + MenuMain::getInstance()->add('General_Visitors', 'UserCountryMap_RealTimeMap', array('module' => 'UserCountryMap', 'action' => 'realtimeWorldMap'), true, $order = 70); } public function getJsFiles(&$jsFiles) diff --git a/plugins/UserSettings/UserSettings.php b/plugins/UserSettings/UserSettings.php index 51c93d0122..8db1ba1dbf 100644 --- a/plugins/UserSettings/UserSettings.php +++ b/plugins/UserSettings/UserSettings.php @@ -11,6 +11,7 @@ namespace Piwik\Plugins\UserSettings; use Piwik\ArchiveProcessor; +use Piwik\Menu\MenuMain; use Piwik\Piwik; use Piwik\WidgetsList; @@ -428,7 +429,7 @@ class UserSettings extends \Piwik\Plugin */ function addMenu() { - Piwik_AddMenu('General_Visitors', 'General_Settings', array('module' => 'UserSettings', 'action' => 'index')); + MenuMain::getInstance()->add('General_Visitors', 'General_Settings', array('module' => 'UserSettings', 'action' => 'index')); } /** diff --git a/plugins/UsersManager/UsersManager.php b/plugins/UsersManager/UsersManager.php index f86cb58f39..5e6bd1c428 100644 --- a/plugins/UsersManager/UsersManager.php +++ b/plugins/UsersManager/UsersManager.php @@ -11,6 +11,7 @@ namespace Piwik\Plugins\UsersManager; use Exception; +use Piwik\Menu\MenuAdmin; use Piwik\Option; use Piwik\Piwik; use Piwik\SettingsPiwik; @@ -93,11 +94,11 @@ class UsersManager extends \Piwik\Plugin */ function addMenu() { - Piwik_AddAdminSubMenu('CoreAdminHome_MenuManage', 'UsersManager_MenuUsers', + MenuAdmin::getInstance()->add('CoreAdminHome_MenuManage', 'UsersManager_MenuUsers', array('module' => 'UsersManager', 'action' => 'index'), Piwik::isUserHasSomeAdminAccess(), $order = 2); - Piwik_AddAdminSubMenu('CoreAdminHome_MenuManage', 'UsersManager_MenuUserSettings', + MenuAdmin::getInstance()->add('CoreAdminHome_MenuManage', 'UsersManager_MenuUserSettings', array('module' => 'UsersManager', 'action' => 'userSettings'), Piwik::isUserHasSomeViewAccess(), $order = 3); diff --git a/plugins/VisitFrequency/VisitFrequency.php b/plugins/VisitFrequency/VisitFrequency.php index a3199e9624..6b9f434061 100644 --- a/plugins/VisitFrequency/VisitFrequency.php +++ b/plugins/VisitFrequency/VisitFrequency.php @@ -10,6 +10,7 @@ */ namespace Piwik\Plugins\VisitFrequency; +use Piwik\Menu\MenuMain; use Piwik\Piwik; use Piwik\WidgetsList; @@ -65,6 +66,6 @@ class VisitFrequency extends \Piwik\Plugin function addMenu() { - Piwik_AddMenu('General_Visitors', 'VisitFrequency_SubmenuFrequency', array('module' => 'VisitFrequency', 'action' => 'index')); + MenuMain::getInstance()->add('General_Visitors', 'VisitFrequency_SubmenuFrequency', array('module' => 'VisitFrequency', 'action' => 'index')); } } diff --git a/plugins/VisitTime/VisitTime.php b/plugins/VisitTime/VisitTime.php index b6b3c9d3ba..62c3f6fc9f 100644 --- a/plugins/VisitTime/VisitTime.php +++ b/plugins/VisitTime/VisitTime.php @@ -14,6 +14,7 @@ use Exception; use Piwik\ArchiveProcessor; use Piwik\Common; +use Piwik\Menu\MenuMain; use Piwik\Period; use Piwik\Piwik; use Piwik\Site; @@ -88,7 +89,7 @@ class VisitTime extends \Piwik\Plugin function addMenu() { - Piwik_AddMenu('General_Visitors', 'VisitTime_SubmenuTimes', array('module' => 'VisitTime', 'action' => 'index')); + MenuMain::getInstance()->add('General_Visitors', 'VisitTime_SubmenuTimes', array('module' => 'VisitTime', 'action' => 'index')); } public function getReportsWithGoalMetrics(&$dimensions) diff --git a/plugins/VisitorInterest/VisitorInterest.php b/plugins/VisitorInterest/VisitorInterest.php index a6a9b41509..4225f5cfc3 100644 --- a/plugins/VisitorInterest/VisitorInterest.php +++ b/plugins/VisitorInterest/VisitorInterest.php @@ -13,6 +13,7 @@ namespace Piwik\Plugins\VisitorInterest; use Piwik\ArchiveProcessor; use Piwik\FrontController; +use Piwik\Menu\MenuMain; use Piwik\Metrics; use Piwik\Piwik; use Piwik\WidgetsList; @@ -110,7 +111,7 @@ class VisitorInterest extends \Piwik\Plugin public function addMenu() { - Piwik_RenameMenuEntry('General_Visitors', 'VisitFrequency_SubmenuFrequency', + MenuMain::getInstance()->rename('General_Visitors', 'VisitFrequency_SubmenuFrequency', 'General_Visitors', 'VisitorInterest_Engagement'); } diff --git a/plugins/VisitsSummary/VisitsSummary.php b/plugins/VisitsSummary/VisitsSummary.php index a2022b25cd..9a19633e11 100644 --- a/plugins/VisitsSummary/VisitsSummary.php +++ b/plugins/VisitsSummary/VisitsSummary.php @@ -10,6 +10,7 @@ */ namespace Piwik\Plugins\VisitsSummary; +use Piwik\Menu\MenuMain; use Piwik\Piwik; use Piwik\WidgetsList; @@ -68,8 +69,8 @@ class VisitsSummary extends \Piwik\Plugin function addMenu() { - Piwik_AddMenu('General_Visitors', '', array('module' => 'VisitsSummary', 'action' => 'index'), true, 10); - Piwik_AddMenu('General_Visitors', 'General_Overview', array('module' => 'VisitsSummary', 'action' => 'index'), true, 1); + MenuMain::getInstance()->add('General_Visitors', '', array('module' => 'VisitsSummary', 'action' => 'index'), true, 10); + MenuMain::getInstance()->add('General_Visitors', 'General_Overview', array('module' => 'VisitsSummary', 'action' => 'index'), true, 1); } } diff --git a/plugins/Widgetize/Widgetize.php b/plugins/Widgetize/Widgetize.php index c9941994da..eeb8e31e3b 100644 --- a/plugins/Widgetize/Widgetize.php +++ b/plugins/Widgetize/Widgetize.php @@ -11,6 +11,7 @@ */ namespace Piwik\Plugins\Widgetize; +use Piwik\Menu\MenuTop; use Piwik\Piwik; /** @@ -37,7 +38,7 @@ class Widgetize extends \Piwik\Plugin $tooltip = Piwik::translate('Widgetize_TopLinkTooltip'); $urlParams = array('module' => 'Widgetize', 'action' => 'index', 'segment' => false); - Piwik_AddTopMenu('General_Widgets', $urlParams, true, 5, $isHTML = false, $tooltip); + MenuTop::addEntry('General_Widgets', $urlParams, true, 5, $isHTML = false, $tooltip); } public function getJsFiles(&$jsFiles) |