本文整理汇总了PHP中Piwik_FrontController::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_FrontController::getInstance方法的具体用法?PHP Piwik_FrontController::getInstance怎么用?PHP Piwik_FrontController::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik_FrontController
的用法示例。
在下文中一共展示了Piwik_FrontController::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: 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();
}
示例3: 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();
}
示例4: 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();
}
示例5: 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');
}
}
}
示例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();
}
示例7: 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;
}
示例8: 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);
}
示例9: __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();
}
}
示例10: 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>';
}
示例11: getEcommerceLog
public function getEcommerceLog($fetch = false)
{
$saveGET = $_GET;
$_GET['filterEcommerce'] = 1;
$_GET['widget'] = 1;
$_GET['segment'] = 'visitEcommerceStatus!=none';
$output = Piwik_FrontController::getInstance()->dispatch('Live', 'getVisitorLog', array($fetch));
$_GET = $saveGET;
return $output;
}
示例12: 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();
}
示例13: 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);
}
示例14: 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>';
}
示例15: 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();
}