本文整理汇总了PHP中Piwik_FrontController类的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_FrontController类的具体用法?PHP Piwik_FrontController怎么用?PHP Piwik_FrontController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Piwik_FrontController类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getInstance
/**
* returns singleton
*
* @return Piwik_FrontController
*/
public static function getInstance()
{
if (self::$instance == null) {
self::$instance = new self();
}
return self::$instance;
}
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:12,代码来源:FrontController.php
示例2: goalReport
function goalReport()
{
$idGoal = Piwik_Common::getRequestVar('idGoal', null, 'int');
if (!isset($this->goals[$idGoal])) {
Piwik::redirectToModule('Goals', 'index', array('idGoal' => null));
}
$goalDefinition = $this->goals[$idGoal];
$view = Piwik_View::factory('single_goal');
$view->currency = Piwik::getCurrency();
$goal = $this->getMetricsForGoal($idGoal);
foreach ($goal as $name => $value) {
$view->{$name} = $value;
}
$view->name = $goalDefinition['name'];
$view->title = $goalDefinition['name'] . ' - Conversions';
$view->graphEvolution = $this->getEvolutionGraph(true, array(Piwik_Goals::getRecordName('nb_conversions', $idGoal)), $idGoal);
$view->nameGraphEvolution = 'GoalsgetEvolutionGraph';
$view->topSegments = $this->getTopSegments($idGoal);
// conversion rate for new and returning visitors
$request = new Piwik_API_Request("method=Goals.getConversionRateReturningVisitors&format=original");
$view->conversion_rate_returning = round($request->process(), self::CONVERSION_RATE_PRECISION);
$request = new Piwik_API_Request("method=Goals.getConversionRateNewVisitors&format=original");
$view->conversion_rate_new = round($request->process(), self::CONVERSION_RATE_PRECISION);
$verticalSlider = array();
// string label
// array parameters to ajax call on click (module, action)
// specific order
// (intermediate labels)
// automatically load the first from the list, highlights it
$view->tableByConversion = Piwik_FrontController::getInstance()->fetchDispatch('Referers', 'getKeywords', array(false, 'tableGoals'));
echo $view->render();
}
开发者ID:Doluci,项目名称:tomatocart,代码行数:32,代码来源:Controller.php
示例3: getInstance
/**
* returns singleton
*
* @return Piwik_FrontController
*/
public static function getInstance()
{
if (self::$instance == null) {
$c = __CLASS__;
self::$instance = new $c();
}
return self::$instance;
}
开发者ID:Doluci,项目名称:tomatocart,代码行数:13,代码来源:FrontController.php
示例4: showInContext
public function showInContext()
{
$controllerName = Piwik_Common::getRequestVar('moduleToLoad');
$actionName = Piwik_Common::getRequestVar('actionToLoad', 'index');
$view = $this->getDefaultIndexView();
$view->content = Piwik_FrontController::getInstance()->fetchDispatch($controllerName, $actionName);
echo $view->render();
}
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:8,代码来源:Controller.php
示例5: iframe
function iframe()
{
$controllerName = Piwik_Common::getRequestVar('moduleToWidgetize');
$actionName = Piwik_Common::getRequestVar('actionToWidgetize');
$parameters = array($fetch = true);
$outputDataTable = Piwik_FrontController::getInstance()->fetchDispatch($controllerName, $actionName, $parameters);
$view = Piwik_View::factory('iframe');
$view->content = $outputDataTable;
echo $view->render();
}
开发者ID:Doluci,项目名称:tomatocart,代码行数:10,代码来源:Controller.php
示例6: iframe
function iframe()
{
Piwik_API_Request::reloadAuthUsingTokenAuth();
$this->init();
$controllerName = Piwik_Common::getRequestVar('moduleToWidgetize');
$actionName = Piwik_Common::getRequestVar('actionToWidgetize');
$parameters = array ( $fetch = true );
$outputDataTable = Piwik_FrontController::getInstance()->fetchDispatch( $controllerName, $actionName, $parameters);
$view = Piwik_View::factory('iframe');
$this->setGeneralVariablesView($view);
$view->content = $outputDataTable;
echo $view->render();
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:13,代码来源:Controller.php
示例7: toC_Piwik
function toC_Piwik()
{
define('PIWIK_USER_PATH', DIR_FS_CATALOG . 'ext/piwik');
define('PIWIK_INCLUDE_PATH', DIR_FS_CATALOG . 'ext/piwik');
define('PIWIK_ENABLE_DISPATCH', false);
define('PIWIK_ENABLE_ERROR_HANDLER', false);
define('PIWIK_ENABLE_SESSION_START', 0);
define('PIWIK_DISPLAY_ERRORS', 0);
require_once PIWIK_INCLUDE_PATH . "/libs/PEAR.php";
require_once PIWIK_INCLUDE_PATH . "/index.php";
require_once PIWIK_INCLUDE_PATH . "/core/API/Request.php";
Piwik_FrontController::getInstance()->init();
}
开发者ID:Doluci,项目名称:tomatocart,代码行数:13,代码来源:piwik.php
示例8: getWidgetsForFlexForm
static function getWidgetsForFlexForm(&$PA, &$fobj)
{
$PA['items'] = array();
tx_piwikintegration_install::getInstaller()->getConfigObject()->initPiwikDatabase();
$controller = Piwik_FrontController::getInstance()->init();
$_GET['idSite'] = 1;
$widgets = Piwik_GetWidgetsList();
foreach ($widgets as $pluginCat => $plugin) {
foreach ($plugin as $widget) {
$PA['items'][] = array($pluginCat . ' : ' . $widget['name'], base64_encode(json_encode($widget['parameters'])), 'i/catalog.gif');
}
}
}
开发者ID:heiko-hardt,项目名称:TYPO3.piwikintegration,代码行数:13,代码来源:class.tx_piwikintegration_flexform.php
示例9: dispatch
function dispatch()
{
$module = Piwik_Common::getRequestVar('module', '', 'string');
$updater = new Piwik_Updater();
$updater->addComponentToCheck('core', Piwik_Version::VERSION);
$updates = $updater->getComponentsWithNewVersion();
if (!empty($updates)) {
Piwik::deleteAllCacheOnUpdate();
}
if (self::getComponentUpdates($updater) !== null && $module != 'CoreUpdater' && $module != 'Proxy') {
if (Piwik_FrontController::shouldRethrowException()) {
throw new Exception("Piwik and/or some plugins have been upgraded to a new version. Please run the update process first. See documentation: http://piwik.org/docs/update/");
} else {
Piwik::redirectToModule('CoreUpdater');
}
}
}
开发者ID:nnnnathann,项目名称:piwik,代码行数:17,代码来源:CoreUpdater.php
示例10: Piwik_ExceptionHandler
/**
* Exception handler used to display nicely exceptions in Piwik
*
* @param Exception $exception
*/
function Piwik_ExceptionHandler(Exception $exception)
{
try {
Zend_Registry::get('logger_exception')->logEvent($exception);
} catch (Exception $e) {
if (Piwik_FrontController::shouldRethrowException()) {
throw $exception;
}
// case when the exception is raised before the logger being ready
// we handle the exception a la mano, but using the Logger formatting properties
$event = array();
$event['errno'] = $exception->getCode();
$event['message'] = $exception->getMessage();
$event['errfile'] = $exception->getFile();
$event['errline'] = $exception->getLine();
$event['backtrace'] = $exception->getTraceAsString();
$formatter = new Piwik_Log_Exception_Formatter_ScreenFormatter();
$message = $formatter->format($event);
$message .= "<br /><br />And this exception raised another exception \"" . $e->getMessage() . "\"";
Piwik::exitWithErrorMessage($message);
}
}
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:27,代码来源:ExceptionHandler.php
示例11: callPHP
/**
* Call PHP API
*
* @param $strParams API call params
*/
function callPHP($strParams)
{
if (PIWIK_INCLUDE_PATH === FALSE) {
return serialize(array('result' => 'error', 'message' => __('Could not resolve', 'wp-piwik') . ' "' . htmlentities(self::$aryGlobalSettings['piwik_path']) . '": ' . __('realpath() returns false', 'wp-piwik') . '.'));
}
if (file_exists(PIWIK_INCLUDE_PATH . "/index.php")) {
require_once PIWIK_INCLUDE_PATH . "/index.php";
}
if (file_exists(PIWIK_INCLUDE_PATH . "/core/API/Request.php")) {
require_once PIWIK_INCLUDE_PATH . "/core/API/Request.php";
}
if (class_exists('Piwik_FrontController')) {
Piwik_FrontController::getInstance()->init();
}
// Add Piwik URL to params
$strParams .= '&piwikUrl=' . urlencode(self::$aryGlobalSettings['piwik_url']);
// This inits the API Request with the specified parameters
if (class_exists('Piwik_API_Request')) {
$objRequest = new Piwik_API_Request($strParams);
} else {
return NULL;
}
// Calls the API and fetch XML data back
return $objRequest->process();
}
开发者ID:Blueprint-Marketing,项目名称:interoccupy.net,代码行数:30,代码来源:wp-piwik.php
示例12: getGraphData
protected function getGraphData()
{
$saveGet = $_GET;
$params = array_merge($this->generateGraphDataParams, $this->parametersToModify);
foreach ($params as $key => $val) {
// We do not forward filter data to the graph controller.
// This would cause the graph to have filter_limit=5 set by default,
// which would break them (graphs need the full dataset to build the "Others" aggregate value)
if (strpos($key, 'filter_') !== false) {
continue;
}
if (is_array($val)) {
$val = implode(',', $val);
}
$_GET[$key] = $val;
}
$content = Piwik_FrontController::getInstance()->fetchDispatch($this->currentControllerName, $this->currentControllerAction, array());
$_GET = $saveGet;
return str_replace(array("\r", "\n"), '', $content);
}
开发者ID:josl,项目名称:CGE-File-Sharing,代码行数:20,代码来源:GenerateGraphHTML.php
示例13: callWidgetsCompareOutput
/**
* Calls a set of controller actions & either checks the result against
* expected output or just checks if errors occurred when called.
*
* The behavior of this function can be modified by setting
* Test_Integration::$widgetTestingLevel (or $testingLevelOverride):
* <ul>
* <li>If set to <b>NO_WIDGET_TESTING</b> this function simply returns.<li>
* <li>If set to <b>CHECK_WIDGET_ERRORS</b> controller actions are called &
* this function will just check for errors.</li>
* <li>If set to <b>COMPARE_WIDGET_OUTPUT</b> controller actions are
* called & the output is checked against expected output.</li>
* </ul>
*
* @param string $testName Unique name of this test group. Expected/processed
* file names use this as a prefix.
* @param array $actions Array of controller actions to call. Each element
* must be in the following format: 'Controller.action'
* @param array $requestParameters The request parameters to set.
* @param array $userTypes The user types to test the controller with. Can contain
* these values: 'anonymous', 'view', 'admin', 'superuser'.
* Defaults to all four.
* @param int $testingLevelOverride Overrides Test_Integration::$widgetTestingLevel.
*/
public function callWidgetsCompareOutput($testName, $actions, $requestParameters, $userTypes = false, $testingLevelOverride = false)
{
// deal with the testing level
if (Test_Integration::$widgetTestingLevel == self::NO_WIDGET_TESTING) {
return;
}
if ($testingLevelOverride === false) {
$testingLevelOverride = self::$widgetTestingLevel;
}
// process $userTypes argument
if (!$userTypes) {
$userTypes = array('anonymous', 'view', 'admin', 'superuser');
} else {
if (!is_array($userTypes)) {
$userTypes = array($userTypes);
}
}
$oldGet = $_GET;
// get all testable controller actions if necessary
$actionParams = array();
if ($actions == 'all') {
// Goals.addWidgets requires idSite to be set
$_GET['idSite'] = isset($requestParameters['idSite']) ? $requestParameters['idSite'] : '0';
list($actions, $actionParams) = $this->findAllWidgets();
$_GET = $oldGet;
} else {
if (!is_array($actions)) {
$actions = array($actions);
}
}
// run the tests
foreach ($actions as $controllerAction) {
$customParams = isset($actionParams[$controllerAction]) ? $actionParams[$controllerAction] : array();
list($controllerName, $actionName) = explode('.', $controllerAction);
foreach ($userTypes as $userType) {
$this->setUserType($userType);
try {
// set request parameters
$_GET = array();
foreach ($customParams as $key => $value) {
$_GET[$key] = $value;
}
foreach ($requestParameters as $key => $value) {
$_GET[$key] = $value;
}
$_GET['module'] = $controllerName;
$_GET['action'] = $actionName;
if ($testingLevelOverride == self::CHECK_WIDGET_ERRORS) {
$this->errorsOccurredInTest = array();
set_error_handler(array($this, "customErrorHandler"));
}
// call controller action
$response = Piwik_FrontController::getInstance()->fetchDispatch();
list($processedFilePath, $expectedFilePath) = $this->getProcessedAndExpectedPaths($testName . '_' . $userType, $controllerAction, 'html');
if ($testingLevelOverride == self::CHECK_WIDGET_ERRORS) {
restore_error_handler();
if (!empty($this->errorsOccurredInTest)) {
// write processed (only if there are errors)
file_put_contents($processedFilePath, $response);
$this->fail("PHP Errors occurred in calling controller action '{$controllerAction}':");
foreach ($this->errorsOccurredInTest as $error) {
echo " {$error}<br/>\n";
}
} else {
$this->pass();
}
} else {
// write raw processed response
file_put_contents($processedFilePath, $response);
// load expected
$expected = $this->loadExpectedFile($expectedFilePath);
if (!$expected) {
continue;
}
// normalize eol delimeters
$expected = str_replace("\r\n", "\n", $expected);
//.........这里部分代码省略.........
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:101,代码来源:Integration.php
示例14: __construct
/**
* Initialize Piwik Connector.
*
* require_once PIWIK_INCLUDE_PATH . "/index.php";
* require_once PIWIK_INCLUDE_PATH . "/core/API/Request.php";
* Piwik_FrontController::getInstance()->init();
*
* $con = new Knp\PiwikClient\Connection\PiwikConnection();
*
* @param boolean $initFrontController will init Piwik instance if true
*/
public function __construct($initFrontController = false)
{
if ($initFrontController) {
\Piwik_FrontController::getInstance()->init();
}
}
开发者ID:pampy,项目名称:PiwikClient,代码行数:17,代码来源:PiwikConnection.php
示例15: footerUserCountry
public static function footerUserCountry($notification)
{
$out =& $notification->getNotificationObject();
$out = '</div>
<div id="rightcolumn">
<h2>' . Piwik_Translate('Provider_WidgetProviders') . '</h2>';
$out .= Piwik_FrontController::getInstance()->fetchDispatch('Provider', 'getProvider');
$out .= '</div>';
}
开发者ID:neolf,项目名称:PIWIK4MOBILE,代码行数:9,代码来源:Provider.php
示例16: error_reporting
error_reporting(E_ALL | E_NOTICE);
@ini_set('display_errors', !defined('PIWIK_DISPLAY_ERRORS') || PIWIK_DISPLAY_ERRORS ? 1 : 0);
@ini_set('xdebug.show_exception_trace', 0);
@ini_set('magic_quotes_runtime', 0);
define('PIWIK_DOCUMENT_ROOT', dirname(__FILE__) == '/' ? '' : dirname(__FILE__));
if (!defined('PIWIK_USER_PATH')) {
define('PIWIK_USER_PATH', PIWIK_DOCUMENT_ROOT);
}
if (!defined('PIWIK_INCLUDE_PATH')) {
define('PIWIK_INCLUDE_PATH', PIWIK_DOCUMENT_ROOT);
}
require_once PIWIK_INCLUDE_PATH . '/libs/upgradephp/upgrade.php';
require_once PIWIK_INCLUDE_PATH . '/core/testMinimumPhpVersion.php';
// NOTE: the code above this comment must be PHP4 compatible
session_cache_limiter('nocache');
@date_default_timezone_set('UTC');
require_once PIWIK_INCLUDE_PATH . '/core/Loader.php';
if (!defined('PIWIK_ENABLE_SESSION_START') || PIWIK_ENABLE_SESSION_START) {
Piwik_Session::start();
}
if (!defined('PIWIK_ENABLE_ERROR_HANDLER') || PIWIK_ENABLE_ERROR_HANDLER) {
require_once PIWIK_INCLUDE_PATH . '/core/ErrorHandler.php';
require_once PIWIK_INCLUDE_PATH . '/core/ExceptionHandler.php';
set_error_handler('Piwik_ErrorHandler');
set_exception_handler('Piwik_ExceptionHandler');
}
if (!defined('PIWIK_ENABLE_DISPATCH') || PIWIK_ENABLE_DISPATCH) {
$controller = Piwik_FrontController::getInstance();
$controller->init();
$controller->dispatch();
}
开发者ID:Gninety,项目名称:Microweber,代码行数:31,代码来源:index.php
示例17: redirectToIndex
function redirectToIndex($moduleToRedirect, $actionToRedirect)
{
$sitesId = Piwik_SitesManager_API::getSitesIdWithAtLeastViewAccess();
if (!empty($sitesId)) {
$firstSiteId = $sitesId[0];
$firstSite = new Piwik_Site($firstSiteId);
if ($firstSite->getCreationDate()->isToday()) {
$defaultDate = 'today';
} else {
$defaultDate = Zend_Registry::get('config')->General->default_day;
}
$defaultPeriod = Zend_Registry::get('config')->General->default_period;
header("Location:index.php?module=" . $moduleToRedirect . "&action=" . $actionToRedirect . "&idSite={$firstSiteId}&period={$defaultPeriod}&date={$defaultDate}");
} else {
if (Piwik::isUserIsSuperUser()) {
Piwik_ExitWithMessage("Error: no website were found in this Piwik installation. \n\t\t\t\t<br>Check the table '" . Piwik::prefixTable('site') . "' that should contain your Piwik websites.", false, true);
}
$currentLogin = Piwik::getCurrentUserLogin();
if (!empty($currentLogin) && $currentLogin != 'anonymous') {
$errorMessage = sprintf(Piwik_Translate('CoreHome_NoPrivileges'), $currentLogin);
$errorMessage .= "<br /><br /> <b><a href='?module=" . Zend_Registry::get('auth')->getName() . "&action=logout'>› " . Piwik_Translate('General_Logout') . "</a></b><br />";
Piwik_ExitWithMessage($errorMessage, false, true);
} else {
Piwik_FrontController::dispatch('Login', false);
}
}
exit;
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:28,代码来源:Controller.php
示例18: getFlashData
protected function getFlashData()
{
$saveGet = $_GET;
foreach($this->parametersToModify as $key => $val)
{
if (is_array($val)) {
$_GET[$key] = unserialize(serialize($val));
} else {
$_GET[$key] = $val;
}
}
$content = Piwik_FrontController::getInstance()->fetchDispatch( $this->currentControllerName, $this->currentControllerAction, array());
$_GET = $saveGet;
return str_replace(array("\r", "\n", "'", '\"'), array('', '', "\\'", '\\\"'), $content);
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:18,代码来源:GenerateGraphHTML.php
示例19: footerMobileDevices
public static function footerMobileDevices($notification)
{
$out =& $notification->getNotificationObject();
$out = '</div>
<div id="rightcolumn">
<h2>Mobile Devices</h2>';
$out .= Piwik_FrontController::getInstance()->fetchDispatch('MobileAnalytics', 'getDeviceName');
$out .= '</div>';
}
开发者ID:kamermans,项目名称:MobileAnalytics,代码行数:9,代码来源:MobileAnalytics.php
示例20: redirectToIndex
/**
* Helper method used to redirect the current http request to another module/action
* If specified, will also redirect to a given website, period and /or date
*
* @param string $moduleToRedirect Module, eg. "MultiSites"
* @param string $actionToRedirect Action, eg. "index"
* @param string $websiteId Website ID, eg. 1
* @param string $defaultPeriod Default period, eg. "day"
* @param string $defaultDate Default date, eg. "today"
* @param array $parameters Parameters to append to url
*/
function redirectToIndex($moduleToRedirect, $actionToRedirect, $websiteId = null, $defaultPeriod = null, $defaultDate = null, $parameters = array())
{
if (is_null($websiteId)) {
$websiteId = $this->getDefaultWebsiteId();
}
if (is_null($defaultDate)) {
$defaultDate = $this->getDefaultDate();
}
if (is_null($defaultPeriod)) {
$defaultPeriod = $this->getDefaultPeriod();
}
$parametersString = '';
if (!empty($parameters)) {
$parametersString = '&' . Piwik_Url::getQueryStringFromParameters($parameters);
}
if ($websiteId) {
$url = "Location: index.php?module=" . $moduleToRedirect . "&action=" . $actionToRedirect . "&idSite=" . $websiteId . "&period=" . $defaultPeriod . "&date=" . $defaultDate . $parametersString;
header($url);
exit;
}
if (Piwik::isUserIsSuperUser()) {
Piwik_ExitWithMessage("Error: no website was found in this Piwik installation. \n\t\t\t<br />Check the table '" . Piwik_Common::prefixTable('site') . "' in your database, it should contain your Piwik websites.", false, true);
}
$currentLogin = Piwik::getCurrentUserLogin();
if (!empty($currentLogin) && $currentLogin != 'anonymous') {
$errorMessage = sprintf(Piwik_Translate('CoreHome_NoPrivilegesAskPiwikAdmin'), $currentLogin, "<br/><a href='mailto:" . Piwik::getSuperUserEmail() . "?subject=Access to Piwik for user {$currentLogin}'>", "</a>");
$errorMessage .= "<br /><br /> <b><a href='index.php?module=" . Zend_Registry::get('auth')->getName() . "&action=logout'>› " . Piwik_Translate('General_Logout') . "</a></b><br />";
Piwik_ExitWithMessage($errorMessage, false, true);
}
Piwik_FrontController::getInstance()->dispatch(Piwik::getLoginPluginName(), false);
exit;
}
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:43,代码来源:Controller.php
注:本文中的Piwik_FrontController类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论