diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/Config.php | 2 | ||||
-rw-r--r-- | core/Controller.php | 3 | ||||
-rw-r--r-- | core/Controller/Admin.php | 9 | ||||
-rw-r--r-- | core/DataTable.php | 10 | ||||
-rw-r--r-- | core/Menu/MenuAbstract.php | 4 | ||||
-rw-r--r-- | core/Menu/MenuAdmin.php | 8 | ||||
-rw-r--r-- | core/Menu/MenuTop.php | 30 | ||||
-rw-r--r-- | core/Url.php | 1 |
8 files changed, 51 insertions, 16 deletions
diff --git a/core/Config.php b/core/Config.php index ffc095d038..1ed8ddee47 100644 --- a/core/Config.php +++ b/core/Config.php @@ -13,8 +13,6 @@ namespace Piwik; use Exception; -require_once PIWIK_INCLUDE_PATH . '/core/functions.php'; - /** * For general performance (and specifically, the Tracker), we use deferred (lazy) initialization * and cache sections. We also avoid any dependency on Zend Framework's Zend_Config. diff --git a/core/Controller.php b/core/Controller.php index 5eb739a937..dd3fe35bde 100644 --- a/core/Controller.php +++ b/core/Controller.php @@ -13,6 +13,7 @@ namespace Piwik; use Exception; use Piwik\API\Request; use Piwik\DataTable\Filter\CalculateEvolutionFilter; +use Piwik\Menu\MenuTop; use Piwik\Period\Month; use Piwik\Period; use Piwik\Period\Range; @@ -423,7 +424,7 @@ abstract class Controller $this->setBasicVariablesView($view); - $view->topMenu = Piwik_GetTopMenu(); + $view->topMenu = MenuTop::getInstance()->getMenu(); } catch (Exception $e) { Piwik_ExitWithMessage($e->getMessage(), $e->getTraceAsString()); } diff --git a/core/Controller/Admin.php b/core/Controller/Admin.php index 75849258e5..a955403b6e 100644 --- a/core/Controller/Admin.php +++ b/core/Controller/Admin.php @@ -12,6 +12,8 @@ namespace Piwik\Controller; use Piwik\Config; use Piwik\Controller; +use Piwik\Menu\MenuAdmin; +use Piwik\Menu\MenuTop; use Piwik\Piwik; use Piwik\PluginsManager; use Piwik\Url; @@ -52,8 +54,8 @@ abstract class Admin extends Controller $view->statisticsNotRecorded = true; } - $view->topMenu = Piwik_GetTopMenu(); - $view->currentAdminMenuName = \Piwik\Menu\Admin::getInstance()->getCurrentAdminMenuName(); + $view->topMenu = MenuTop::getInstance()->getMenu(); + $view->currentAdminMenuName = MenuAdmin::getInstance()->getCurrentAdminMenuName(); $view->enableFrames = Config::getInstance()->General['enable_framed_settings']; if (!$view->enableFrames) { @@ -83,7 +85,8 @@ abstract class Admin extends Controller self::checkPhpVersion($view); - $view->menu = Piwik_GetAdminMenu(); + $adminMenu = MenuAdmin::getInstance()->getMenu(); + $view->adminMenu = $adminMenu; } static protected function getPiwikVersion() diff --git a/core/DataTable.php b/core/DataTable.php index c09cb3bfe3..8bb6a93227 100644 --- a/core/DataTable.php +++ b/core/DataTable.php @@ -1509,3 +1509,13 @@ class DataTable return $result; } } + + +// Bridge for when serialized classes were not using namespaces yet (pre Piwik 2.0) +class Piwik_DataTable_Row_DataTableSummary extends DataTableSummaryRow +{ +} + +class Piwik_DataTable_Row extends Row +{ +} diff --git a/core/Menu/MenuAbstract.php b/core/Menu/MenuAbstract.php index a0fa8c4c2b..fc4eddb0ca 100644 --- a/core/Menu/MenuAbstract.php +++ b/core/Menu/MenuAbstract.php @@ -36,7 +36,7 @@ abstract class MenuAbstract * * @return Array */ - public function get() + public function getMenu() { $this->buildMenu(); $this->applyEdits(); @@ -55,7 +55,7 @@ abstract class MenuAbstract * @param int $order * @param bool|string $tooltip Tooltip to display. */ - public function add($menuName, $subMenuName, $url, $displayedForCurrentUser, $order = 50, $tooltip = false) + public function add($menuName, $subMenuName, $url, $displayedForCurrentUser = true, $order = 50, $tooltip = false) { if ($displayedForCurrentUser) { // make sure the idSite value used is numeric (hack-y fix for #3426) diff --git a/core/Menu/MenuAdmin.php b/core/Menu/MenuAdmin.php index f34aa15865..852e252e64 100644 --- a/core/Menu/MenuAdmin.php +++ b/core/Menu/MenuAdmin.php @@ -20,7 +20,7 @@ class MenuAdmin extends MenuAbstract static private $instance = null; /** - * @return \Piwik\Menu\MenuAdmin + * @return MenuAdmin */ static public function getInstance() { @@ -63,7 +63,7 @@ class MenuAdmin extends MenuAbstract * ``` * public function addMenuItems() * { - * \Piwik\Menu\MenuAdmin::getInstance()->add( + * MenuAdmin::getInstance()->add( * 'MenuName', * 'SubmenuName', * array('module' => 'MyPlugin', 'action' => 'index'), @@ -73,7 +73,7 @@ class MenuAdmin extends MenuAbstract * } * ``` */ - Piwik::postEvent('Menu.MenuAdmin.addItems'); + Piwik::postEvent('Menu.Admin.addItems'); } return parent::getMenu(); } @@ -85,7 +85,7 @@ class MenuAdmin extends MenuAbstract */ function getCurrentAdminMenuName() { - $menu = \Piwik\Menu\MenuAdmin::getInstance(); + $menu = MenuAdmin::getInstance()->getMenu(); $currentModule = Piwik::getModule(); $currentAction = Piwik::getAction(); foreach ($menu as $submenu) { diff --git a/core/Menu/MenuTop.php b/core/Menu/MenuTop.php index 8573e527fd..29f056367a 100644 --- a/core/Menu/MenuTop.php +++ b/core/Menu/MenuTop.php @@ -20,7 +20,7 @@ class MenuTop extends MenuAbstract static private $instance = null; /** - * @return \Piwik\Menu\MenuTop + * @return MenuTop */ static public function getInstance() { @@ -30,6 +30,28 @@ class MenuTop extends MenuAbstract return self::$instance; } + + /** + * Adds a new entry to the TopMenu. + * + * @param string $topMenuName + * @param string $data + * @param boolean $displayedForCurrentUser + * @param int $order + * @param bool $isHTML + * @param bool|string $tooltip Tooltip to display. + * @api + */ + public static function addEntry($topMenuName, $data, $displayedForCurrentUser = true, $order = 10, $isHTML = false, $tooltip = false) + { + if ($isHTML) { + MenuTop::getInstance()->addHtml($topMenuName, $data, $displayedForCurrentUser, $order, $tooltip); + } else { + MenuTop::getInstance()->add($topMenuName, null, $data, $displayedForCurrentUser, $order, $tooltip); + } + } + + /** * Directly adds a menu entry containing html. * @@ -52,7 +74,7 @@ class MenuTop extends MenuAbstract } /** - * Triggers the Menu.MenuTop.addItems hook and returns the menu. + * Triggers the Menu.Top.addItems hook and returns the menu. * * @return Array */ @@ -71,7 +93,7 @@ class MenuTop extends MenuAbstract * ``` * public function addMenuItems() * { - * Piwik_AddTopMenu( + * MenuTop::addEntry( * 'TopMenuName', * array('module' => 'MyPlugin', 'action' => 'index'), * Piwik::isUserIsSuperUser(), @@ -80,7 +102,7 @@ class MenuTop extends MenuAbstract * } * ``` */ - Piwik::postEvent('Menu.MenuTop.addItems'); + Piwik::postEvent('Menu.Top.addItems'); } return parent::getMenu(); } diff --git a/core/Url.php b/core/Url.php index 6a4f4a4ad7..bb16135e84 100644 --- a/core/Url.php +++ b/core/Url.php @@ -343,6 +343,7 @@ class Url */ static function getCurrentQueryStringWithParametersModified($params) { + var_dump($params); $urlValues = self::getArrayFromCurrentQueryString(); foreach ($params as $key => $value) { $urlValues[$key] = $value; |