当前位置: 首页>>代码示例>>PHP>>正文


PHP Piwik_FrontController类代码示例

本文整理汇总了PHP中Piwik_FrontController的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_FrontController类的具体用法?PHP Piwik_FrontController怎么用?PHP Piwik_FrontController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Piwik_FrontController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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') . ' &quot;' . htmlentities(self::$aryGlobalSettings['piwik_path']) . '&quot;: ' . __('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 "&nbsp;   {$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


注:本文中的Piwik_FrontController类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。