本文整理汇总了PHP中Piwik\FrontController类的典型用法代码示例。如果您正苦于以下问题:PHP FrontController类的具体用法?PHP FrontController怎么用?PHP FrontController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FrontController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dispatch
public function dispatch()
{
$module = Common::getRequestVar('module', '', 'string');
$action = Common::getRequestVar('action', '', 'string');
if ($module == 'CoreUpdater' || $module == 'Proxy' || $module == 'Installation' || $module == 'LanguagesManager' && $action == 'saveLanguage') {
return;
}
$updater = new PiwikCoreUpdater();
$updates = $updater->getComponentsWithNewVersion(array('core' => Version::VERSION));
if (!empty($updates)) {
Filesystem::deleteAllCacheOnUpdate();
}
if ($updater->getComponentUpdates() !== null) {
if (FrontController::shouldRethrowException()) {
throw new Exception("Piwik and/or some plugins have been upgraded to a new version. \n" . "--> Please run the update process first. See documentation: http://piwik.org/docs/update/ \n");
} elseif ($module === 'API') {
$outputFormat = strtolower(Common::getRequestVar('format', 'xml', 'string', $_GET + $_POST));
$response = new ResponseBuilder($outputFormat);
$e = new Exception('Database Upgrade Required. Your Piwik database is out-of-date, and must be upgraded before you can continue.');
echo $response->getResponseException($e);
Common::sendResponseCode(503);
exit;
} else {
Piwik::redirectToModule('CoreUpdater');
}
}
}
示例2: footerUserCountry
public static function footerUserCountry(&$out)
{
$out = '<div>
<h2>' . Piwik::translate('Provider_WidgetProviders') . '</h2>';
$out .= FrontController::getInstance()->fetchDispatch('Provider', 'getProvider');
$out .= '</div>';
}
示例3: execute
/**
* Execute command like: ./console core:run-scheduled-tasks
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->forceRunAllTasksIfRequested($input);
FrontController::getInstance()->init();
API::getInstance()->runScheduledTasks();
$this->writeSuccessMessage($output, array('Scheduled Tasks executed'));
}
示例4: footerVisitsFrequency
public static function footerVisitsFrequency(&$out)
{
$out = '</div>
<div id="rightcolumn">
';
$out .= FrontController::getInstance()->fetchDispatch('VisitorInterest', 'index');
$out .= '</div>';
}
示例5: getEcommerceLog
public function getEcommerceLog($fetch = false)
{
$saveGET = $_GET;
$_GET['segment'] = urlencode('visitEcommerceStatus!=none');
$_GET['widget'] = 1;
$output = FrontController::getInstance()->dispatch('Live', 'getVisitorLog', array($fetch));
$_GET = $saveGET;
return $output;
}
示例6: noAccess
/**
* Redirects to Login form with error message.
* Listens to User.isNotAuthorized hook.
*/
public function noAccess(Exception $exception)
{
$frontController = FrontController::getInstance();
if (Common::isXmlHttpRequest()) {
echo $frontController->dispatch('Login', 'ajaxNoAccess', array($exception->getMessage()));
return;
}
echo $frontController->dispatch('Login', 'login', array($exception->getMessage()));
}
示例7: testWhenRssFormatGetOneDoesNotError
/**
* Testing that getOne does not error out when format=rss, #10407
*
* @group Plugins
*/
public function testWhenRssFormatGetOneDoesNotError()
{
$_GET = array('method' => 'MultiSites.getOne', 'idSite' => $this->idSiteAccess, 'period' => 'month', 'date' => 'last10', 'format' => 'rss');
$output = FrontController::getInstance()->fetchDispatch('API');
$this->assertContains('<item>', $output);
$this->assertContains('</rss>', $output);
$this->assertNotContains('error', $output);
$_GET = array();
}
示例8: requestGetAllWithGroups
private function requestGetAllWithGroups($params)
{
$oldGet = $_GET;
$params['period'] = 'day';
$params['date'] = '2013-01-23';
$_GET = $params;
$sites = FrontController::getInstance()->dispatch('MultiSites', 'getAllWithGroups');
$_GET = $oldGet;
return $sites;
}
示例9: execute
/**
* Execute command like: ./console core:run-scheduled-tasks
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->forceRunAllTasksIfRequested($input);
FrontController::getInstance()->init();
$scheduledTasksResults = API::getInstance()->runScheduledTasks();
foreach ($scheduledTasksResults as $scheduledTasksResult) {
$output->writeln(sprintf('<comment>%s</comment> - %s', $scheduledTasksResult['task'], $scheduledTasksResult['output']));
}
$this->writeSuccessMessage($output, array('Scheduled Tasks executed'));
}
示例10: init
private function init()
{
$this->handleFatalErrors();
\Piwik\FrontController::createConfigObject();
if ($this->isDebugModeEnabled()) {
ErrorHandler::registerErrorHandler();
ExceptionHandler::setUp();
Common::printDebug("Debug enabled - Input parameters: ");
Common::printDebug(var_export($_GET, true));
}
}
示例11: showInContext
public function showInContext()
{
$controllerName = Common::getRequestVar('moduleToLoad');
$actionName = Common::getRequestVar('actionToLoad', 'index');
if ($actionName == 'showInContext') {
throw new Exception("Preventing infinite recursion...");
}
$view = $this->getDefaultIndexView();
$view->content = FrontController::getInstance()->fetchDispatch($controllerName, $actionName);
return $view->render();
}
示例12: _getDashboardView
protected function _getDashboardView($template)
{
$view = new View($template);
$this->setGeneralVariablesView($view);
$view->availableWidgets = Common::json_encode(WidgetsList::get());
$view->availableLayouts = $this->getAvailableLayouts();
$view->dashboardId = Common::getRequestVar('idDashboard', 1, 'int');
// get the layout via FrontController so controller events are posted
$view->dashboardLayout = FrontController::getInstance()->dispatch('Dashboard', 'getDashboardLayout', array($checkToken = false));
return $view;
}
示例13: generateSafeModeOutput
/**
* @param $lastError
* @return mixed|void
* @throws AuthenticationFailedException
* @throws Exception
*/
private static function generateSafeModeOutput($lastError)
{
Common::sendResponseCode(500);
$controller = FrontController::getInstance();
try {
$controller->init();
$message = $controller->dispatch('CorePluginsAdmin', 'safemode', array($lastError));
} catch (Exception $e) {
// may fail in safe mode (eg. global.ini.php not found)
$message = sprintf("Piwik encoutered an error: %s (which lead to: %s)", $lastError['message'], $e->getMessage());
}
return $message;
}
示例14: dispatch
/**
* @param \Exception|null $exception
*/
public function dispatch($exception = null)
{
if ($exception) {
$message = $exception->getMessage();
} else {
$message = '';
}
$action = Common::getRequestVar('action', 'welcome', 'string');
if ($this->isAllowedAction($action)) {
echo FrontController::getInstance()->dispatch('Installation', $action, array($message));
} else {
Piwik::exitWithErrorMessage(Piwik::translate('Installation_NoConfigFound'));
}
exit;
}
示例15: execute
/**
* Execute command like: ./console core:run-scheduled-tasks
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->forceRunAllTasksIfRequested($input);
FrontController::getInstance()->init();
// TODO use dependency injection
/** @var Scheduler $scheduler */
$scheduler = StaticContainer::get('Piwik\\Scheduler\\Scheduler');
$task = $input->getArgument('task');
if ($task) {
$this->runSingleTask($scheduler, $task, $output);
} else {
$scheduler->run();
}
$this->writeSuccessMessage($output, array('Scheduled Tasks executed'));
}