/** * Triggers the TopMenu.add hook and returns the menu. * * @return Array */ public function get() { if (!$this->menu) { Core_PostEvent('TopMenu.add'); } return parent::get(); }
/** * Authenticate user and password. Redirect if successful. * * @param string $login user name * @param string $md5Password md5 hash of password * @param bool $rememberMe Remember me? * @param string $urlToRedirect URL to redirect to, if successfully authenticated * @return string failure message if unable to authenticate */ protected function authenticateAndRedirect($login, $password, $rememberMe, $urlToRedirect = 'index.php') { $info = array('login' => $login, 'password' => $password, 'rememberMe' => $rememberMe); //Piwik_Nonce::discardNonce('Piwik_Login.login'); Core_PostEvent('Login.initSession', $info); Core_Url::redirectToUrl($urlToRedirect); }
/** * Triggers the Menu.add hook and returns the menu. * * @return Array */ public function get() { // We trigger the Event only once! if (!$this->menu) { Core_PostEvent('Menu.add'); } return parent::get(); }
function smarty_function_postEvent($params, &$smarty) { if (!isset($params['name'])) { throw new Exception("The smarty function postEvent needs a 'name' parameter."); } $eventName = $params['name']; $str = ''; Core_PostEvent($eventName, $str); return $str; }
function dispatch($module = null, $action = null, $parameters = null) { if (is_null($module)) { $defaultModule = Core_Helper::getDefaultModuleName(); $module = Core_Common::getRequestVar('module', $defaultModule, 'string'); } if (is_null($action)) { $action = Core_Common::getRequestVar('action', false); } if (is_null($parameters)) { $parameters = array(); } if (!ctype_alnum($module)) { throw new Exception("Invalid module name '{$module}'"); } $controllerClassName = "Module_" . $module . "_Controller"; /* Check if the plugin has been activated */ if (!Core_ModuleManager::getInstance()->isModuleActivated($module)) { throw new Core_FrontController_PluginDeactivatedException($module); } // Dynamically create the class $controller = new $controllerClassName(); if ($action === false) { $action = $controller->getDefaultAction(); } // Dynamically call the action if (!is_callable(array($controller, $action))) { throw new Exception("Action not found in {$controllerClassName}::{$action}()."); } try { $controller->preDispatch(); return call_user_func_array(array($controller, $action), $parameters); } catch (Core_Access_NoAccessException $e) { Core_PostEvent('FrontController.NoAccessException'); } catch (Exception $e) { echo 'Error: ' . $e; return null; } }