本文整理汇总了PHP中Piwik\FrontController::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP FrontController::getInstance方法的具体用法?PHP FrontController::getInstance怎么用?PHP FrontController::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\FrontController
的用法示例。
在下文中一共展示了FrontController::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: footerUserCountry
public static function footerUserCountry(&$out)
{
$out = '<div>
<h2>' . Piwik::translate('Provider_WidgetProviders') . '</h2>';
$out .= FrontController::getInstance()->fetchDispatch('Provider', 'getProvider');
$out .= '</div>';
}
示例2: 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'));
}
示例3: footerVisitsFrequency
public static function footerVisitsFrequency(&$out)
{
$out = '</div>
<div id="rightcolumn">
';
$out .= FrontController::getInstance()->fetchDispatch('VisitorInterest', 'index');
$out .= '</div>';
}
示例4: 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()));
}
示例5: 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();
}
示例6: 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;
}
示例7: 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;
}
示例8: 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'));
}
示例9: _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;
}
示例10: 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();
}
示例11: 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;
}
示例12: 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'));
}
示例13: 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;
}
示例14: iframe
public function iframe()
{
Request::reloadAuthUsingTokenAuth();
$this->init();
$controllerName = Common::getRequestVar('moduleToWidgetize');
$actionName = Common::getRequestVar('actionToWidgetize');
if ($controllerName == 'Dashboard' && $actionName == 'index') {
$view = new View('@Widgetize/iframe_empty');
} else {
$view = new View('@Widgetize/iframe');
}
$this->setGeneralVariablesView($view);
$view->setXFrameOptions('allow');
$view->content = FrontController::getInstance()->fetchDispatch($controllerName, $actionName);
return $view->render();
}
示例15: dispatch
/**
* @param \Exception|null $exception
*/
public function dispatch($exception = null)
{
if ($exception) {
$message = $exception->getMessage();
} else {
$message = '';
}
Translate::loadCoreTranslation();
$step = Common::getRequestVar('action', 'welcome', 'string');
$controller = $this->getInstallationController();
$isActionWhiteListed = in_array($step, array('saveLanguage', 'getBaseCss'));
if (in_array($step, array_keys($controller->getInstallationSteps())) || $isActionWhiteListed) {
echo FrontController::getInstance()->dispatch('Installation', $step, array($message));
} else {
Piwik::exitWithErrorMessage(Piwik::translate('Installation_NoConfigFound'));
}
exit;
}