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


PHP Piwik_Common类代码示例

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


在下文中一共展示了Piwik_Common类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderTable

 protected function renderTable($table)
 {
     if (!$table instanceof Piwik_DataTable_Array) {
         throw new Exception("RSS Feed only used on DataTable_Array");
     }
     $idSite = Piwik_Common::getRequestVar('idSite', 1);
     $period = Piwik_Common::getRequestVar('period');
     $currentUrl = Piwik_Url::getCurrentUrlWithoutFileName();
     $piwikUrl = $currentUrl . "?module=Home&action=index&idSite=" . $idSite . "&period=" . $period;
     $out = "";
     $moreRecentFirst = array_reverse($table->getArray(), true);
     foreach ($moreRecentFirst as $date => $subtable) {
         $timestamp = $table->metaData[$date]['timestamp'];
         $site = $table->metaData[$date]['site'];
         $pudDate = date('r', $timestamp);
         $dateUrl = date('Y-m-d', $timestamp);
         $thisPiwikUrl = htmlentities($piwikUrl . "&date={$dateUrl}");
         $siteName = $site->getName();
         $title = $siteName . " on " . $date;
         $out .= "\t<item>\n\t\t<pubDate>{$pudDate}</pubDate>\n\t\t<guid>{$thisPiwikUrl}</guid>\n\t\t<link>{$thisPiwikUrl}</link>\n\t\t<title>{$title}</title>\n\t\t<author>http://piwik.org</author>\n\t\t<description>";
         $out .= htmlspecialchars($this->renderDataTable($subtable));
         $out .= "</description>\n\t</item>\n";
     }
     $header = $this->getRssHeader();
     $footer = $this->getRssFooter();
     return $this->output($header . $out . $footer);
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:27,代码来源:Rss.php

示例2: init

 function init($currentControllerName, $currentControllerAction, $apiMethodToRequestDataTable)
 {
     parent::init($currentControllerName, $currentControllerAction, $apiMethodToRequestDataTable);
     $this->setParametersToModify(array('date' => Piwik_Common::getRequestVar('date', 'last30', 'string')));
     $this->disableShowAllViewsIcons();
     $this->disableShowTable();
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:7,代码来源:ChartEvolution.php

示例3: index

 public function index()
 {
     Piwik::checkUserIsSuperUser();
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         switch (Piwik_Common::getRequestVar('form')) {
             case "formMaskLength":
                 $this->handlePluginState(Piwik_Common::getRequestVar("anonymizeIPEnable", 0));
                 $maskLength = Zend_Registry::get('config')->Tracker;
                 $maskLength->ip_address_mask_length = Piwik_Common::getRequestVar("maskLength", 1);
                 Zend_Registry::get('config')->Tracker = $maskLength->toArray();
                 break;
             case "formDeleteSettings":
                 $deleteLogs = Zend_Registry::get('config')->Deletelogs;
                 $deleteLogs->delete_logs_enable = Piwik_Common::getRequestVar("deleteEnable", 0);
                 $deleteLogs->delete_logs_schedule_lowest_interval = Piwik_Common::getRequestVar("deleteLowestInterval", 7);
                 $deleteLogs->delete_logs_older_than = (int) Piwik_Common::getRequestVar("deleteOlderThan", 180) < 7 ? 7 : Piwik_Common::getRequestVar("deleteOlderThan", 180);
                 $deleteLogs->delete_max_rows_per_run = Piwik_Common::getRequestVar("deleteMaxRows", 100);
                 Zend_Registry::get('config')->Deletelogs = $deleteLogs->toArray();
                 break;
             default:
                 //do nothing
                 break;
         }
     }
     return $this->redirectToIndex('PrivacyManager', 'privacySettings', null, null, null, array('updated' => 1));
 }
开发者ID:neolf,项目名称:PIWIK4MOBILE,代码行数:26,代码来源:Controller.php

示例4: activate

 function activate()
 {
     Piwik::checkUserIsSuperUser();
     $pluginName = Piwik_Common::getRequestVar('pluginName', null, 'string');
     Piwik_PluginsManager::getInstance()->activatePlugin($pluginName);
     Piwik_Url::redirectToUrl('index.php?module=CorePluginsAdmin');
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:7,代码来源:Controller.php

示例5: main

 public function main()
 {
     $this->idSite = Piwik_Common::getRequestVar('idSite', null, 'int');
     $this->processOnlyIdGoal = Piwik_Common::getRequestVar('idGoal', 0, 'string');
     $this->isEcommerce = $this->processOnlyIdGoal == Piwik_Archive::LABEL_ECOMMERCE_ORDER;
     $this->viewProperties['show_exclude_low_population'] = true;
     $this->viewProperties['show_goals'] = true;
     if (Piwik_Common::getRequestVar('documentationForGoalsPage', 0, 'int') == 1) {
         $this->setReportDocumentation(Piwik_Translate('Goals_ConversionByTypeReportDocumentation', array('<br />', '<br />', '<a href="http://piwik.org/docs/tracking-goals-web-analytics/" target="_blank">', '</a>')));
     }
     $this->setMetricDocumentation('nb_visits', Piwik_Translate('Goals_ColumnVisits'));
     if ($this->isEcommerce) {
         $this->setMetricDocumentation('revenue_per_visit', Piwik_Translate('Goals_ColumnRevenuePerVisitDocumentation', Piwik_Translate('General_EcommerceOrders')));
         $this->setColumnsTranslations(array('goal_%s_conversion_rate' => Piwik_Translate('Goals_ConversionRate'), 'goal_%s_nb_conversions' => Piwik_Translate('General_EcommerceOrders'), 'goal_%s_revenue' => Piwik_Translate('General_TotalRevenue'), 'goal_%s_revenue_per_visit' => Piwik_Translate('General_ColumnValuePerVisit'), 'goal_%s_avg_order_revenue' => Piwik_Translate('General_AverageOrderValue'), 'goal_%s_items' => Piwik_Translate('General_PurchasedProducts')));
         $this->setColumnsToDisplay(array('label', 'nb_visits', 'goal_%s_nb_conversions', 'goal_%s_revenue', 'goal_%s_conversion_rate', 'goal_%s_avg_order_revenue', 'goal_%s_items', 'goal_%s_revenue_per_visit'));
         // Default sort column
         $this->setSortedColumn('goal_ecommerceOrder_revenue', 'desc');
     } else {
         $this->setMetricDocumentation('revenue_per_visit', Piwik_Translate('Goals_ColumnRevenuePerVisitDocumentation', Piwik_Translate('Goals_EcommerceAndGoalsMenu')));
         $this->setColumnsTranslations(array('goal_%s_conversion_rate' => Piwik_Translate('Goals_ConversionRate'), 'goal_%s_nb_conversions' => Piwik_Translate('Goals_Conversions'), 'goal_%s_revenue' => '%s ' . Piwik_Translate('Goals_ColumnRevenue'), 'goal_%s_revenue_per_visit' => '%s ' . Piwik_Translate('General_ColumnValuePerVisit'), 'nb_conversions' => Piwik_Translate('Goals_ColumnConversions'), 'conversion_rate' => Piwik_Translate('General_ColumnConversionRate'), 'revenue' => Piwik_Translate('Goals_ColumnRevenue'), 'revenue_per_visit' => Piwik_Translate('General_ColumnValuePerVisit')));
         $this->setColumnsToDisplay(array('label', 'nb_visits', 'goal_%s_nb_conversions', 'goal_%s_conversion_rate', 'goal_%s_revenue', 'goal_%s_revenue_per_visit', 'revenue_per_visit'));
         // Default sort column
         $columnsToDisplay = $this->getColumnsToDisplay();
         $columnNbConversionsCurrentGoal = $columnsToDisplay[2];
         if ($this->processOnlyIdGoal > 0 && strpos($columnNbConversionsCurrentGoal, '_nb_conversions') !== false) {
             $this->setSortedColumn($columnNbConversionsCurrentGoal, 'desc');
         }
     }
     parent::main();
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:30,代码来源:Goals.php

示例6: getSql

	static function getSql($schema = 'Myisam')
	{
		if(!Piwik::isTimezoneSupportEnabled())
		{
			return array();
		}
		// @see http://bugs.php.net/46111
		$timezones = timezone_identifiers_list();
		$brokenTZ = array();

		foreach ($timezones as $timezone) {
			$testDate = "2008-08-19 13:00:00 " . $timezone;
	
			if (!strtotime($testDate)) {
				$brokenTZ[] = $timezone;
			}
		}
		$timezoneList = '"'. implode('","', $brokenTZ) . '"';

		return array(
			'UPDATE '. Piwik_Common::prefixTable('site') .'
				SET timezone = "UTC" 
				WHERE timezone IN ('. $timezoneList .')' => false,

			'UPDATE `'. Piwik_Common::prefixTable('option') .'`
				SET option_value = "UTC" 
			WHERE option_name = "SitesManager_DefaultTimezone" 
				AND option_value IN ('. $timezoneList .')' => false,
		);
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:30,代码来源:0.9.1.php

示例7: update

	static function update()
	{
		$config = Zend_Registry::get('config');
		$salt = Piwik_Common::generateUniqId();
		try {
			if(isset($config->superuser->salt))
			{
				return;
			}

			if(is_writable( Piwik_Config::getDefaultUserConfigPath() ))
			{
				$superuser_info = $config->superuser->toArray();
				$superuser_info['salt'] = $salt;
				$config->superuser = $superuser_info;
				$config->__destruct();

				Piwik::createConfigObject();

				return;
			}
		} catch(Exception $e) { }

		throw new Piwik_Updater_UpdateErrorException("Edit config.ini.php and add below <code>[superuser]</code> the following line <br/><code>salt = $salt</code>");
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:25,代码来源:0.5.2.php

示例8: update

	static function update()
	{
		$obsoleteFiles = array(
			PIWIK_INCLUDE_PATH . '/core/Db/Mysqli.php',
		);
		foreach($obsoleteFiles as $obsoleteFile)
		{
			if(file_exists($obsoleteFile))
			{
				@unlink($obsoleteFile);
			}
		}

		$obsoleteDirectories = array(
			PIWIK_INCLUDE_PATH . '/core/Db/Pdo',
		);
		foreach($obsoleteDirectories as $dir)
		{
			if(file_exists($dir))
			{
				Piwik::unlinkRecursive($dir, true);
			}
		}

		// force regeneration of cache files
		Piwik::setUserIsSuperUser();
		$allSiteIds = Piwik_SitesManager_API::getInstance()->getAllSitesId();
		Piwik_Common::regenerateCacheWebsiteAttributes($allSiteIds);
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:29,代码来源:0.6.2.php

示例9: getIdActionFromSegment

 /**
  * Convert segment expression to an action ID or an SQL expression.
  * 
  * This method is used as a sqlFilter-callback for the segments of this plugin.
  * Usually, these callbacks only return a value that should be compared to the
  * column in the database. In this case, that doesn't work since multiple IDs
  * can match an expression (e.g. "pageUrl=@foo").
  */
 function getIdActionFromSegment($string, $sqlField, $matchType = '==')
 {
     // Field is visit_*_idaction_url or visit_*_idaction_name
     $actionType = strpos($sqlField, '_name') === false ? Piwik_Tracker_Action::TYPE_ACTION_URL : Piwik_Tracker_Action::TYPE_ACTION_NAME;
     // exact matches work by returning the id directly
     if ($matchType == Piwik_SegmentExpression::MATCH_EQUAL || $matchType == Piwik_SegmentExpression::MATCH_NOT_EQUAL) {
         $sql = Piwik_Tracker_Action::getSqlSelectActionId();
         $bind = array($string, $string, $actionType);
         $idAction = Piwik_FetchOne($sql, $bind);
         // if the action is not found, we hack -100 to ensure it tries to match against an integer
         // otherwise binding idaction_name to "false" returns some rows for some reasons (in case &segment=pageTitle==Větrnásssssss)
         if (empty($idAction)) {
             $idAction = -100;
         }
         return $idAction;
     }
     // now, we handle the cases =@ (contains) and !@ (does not contain)
     // build the expression based on the match type
     $sql = 'SELECT idaction FROM ' . Piwik_Common::prefixTable('log_action') . ' WHERE ';
     switch ($matchType) {
         case '=@':
             // use concat to make sure, no %s occurs because some plugins use %s in their sql
             $sql .= '( name LIKE CONCAT("%", ?, "%") AND type = ' . $actionType . ' )';
             break;
         case '!@':
             $sql .= '( name NOT LIKE CONCAT("%", ?, "%") AND type = ' . $actionType . ' )';
             break;
         default:
             throw new Exception("This match type is not available for action-segments.");
             break;
     }
     return array('SQL' => $sql, 'bind' => $string);
 }
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:41,代码来源:Actions.php

示例10: dispatch

	function dispatch($notification = null)
	{
		if($notification)
		{
			$exception = $notification->getNotificationObject();
			$message = $exception->getMessage();
		}
		else
		{
			$message = '';
		}

		Piwik_Translate::getInstance()->loadCoreTranslation();

		Piwik_PostEvent('Installation.startInstallation', $this);

		$step = Piwik_Common::getRequestVar('action', 'welcome', 'string');
		$controller = $this->getInstallationController();
		if(in_array($step, array_keys($controller->getInstallationSteps())) || $step == 'saveLanguage')
		{
			$controller->$step($message);
		}
		else
		{
			Piwik::exitWithErrorMessage(Piwik_Translate('Installation_NoConfigFound'));
		}

		exit;
	}	
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:29,代码来源:Installation.php

示例11: getSql

	static function getSql($schema = 'Myisam')
	{
		return array(
			'CREATE TABLE `'. Piwik_Common::prefixTable('option') .'` (
				idoption BIGINT NOT NULL AUTO_INCREMENT ,
				option_name VARCHAR( 64 ) NOT NULL ,
				option_value LONGTEXT NOT NULL ,
				PRIMARY KEY ( idoption , option_name )
			)' => false,

			// 0.1.7 [463]
			'ALTER IGNORE TABLE `'. Piwik_Common::prefixTable('log_visit') .'`
				 CHANGE `location_provider` `location_provider` VARCHAR( 100 ) DEFAULT NULL' => '1054',

			// 0.1.7 [470]
			'ALTER TABLE `'. Piwik_Common::prefixTable('logger_api_call') .'`
				CHANGE `parameter_names_default_values` `parameter_names_default_values` TEXT,
				CHANGE `parameter_values` `parameter_values` TEXT,
				CHANGE `returned_value` `returned_value` TEXT' => false,
			'ALTER TABLE `'. Piwik_Common::prefixTable('logger_error') .'`
				CHANGE `message` `message` TEXT' => false,
			'ALTER TABLE `'. Piwik_Common::prefixTable('logger_exception') .'`
				CHANGE `message` `message` TEXT' => false,
			'ALTER TABLE `'. Piwik_Common::prefixTable('logger_message') .'`
				CHANGE `message` `message` TEXT' => false,

			// 0.2.2 [489]
			'ALTER IGNORE TABLE `'. Piwik_Common::prefixTable('site') .'`
				 CHANGE `feedburnerName` `feedburnerName` VARCHAR( 100 ) DEFAULT NULL' => '1054',
		);
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:31,代码来源:0.2.10.php

示例12: init

	function init()
	{
		$resetToken = Piwik_Common::getRequestVar('token', '', 'string');

		$formElements = array(
			array('text', 'form_login'),
			array('password', 'form_password'),
			array('password', 'form_password_bis'),
			array('text', 'form_token'),
		);
		$this->addElements( $formElements );

		$defaults = array(
			'form_token' => $resetToken,
		);
		$this->setDefaults($defaults);

		$formRules = array(
			array('form_login', sprintf(Piwik_Translate('General_Required'), Piwik_Translate('General_Username')), 'required'),
			array('form_password', sprintf(Piwik_Translate('General_Required'), Piwik_Translate('Login_Password')), 'required'),
			array('form_password_bis', sprintf(Piwik_Translate('General_Required'), Piwik_Translate('Login_PasswordRepeat')), 'required'),
			array('form_token', sprintf(Piwik_Translate('General_Required'), Piwik_Translate('Login_PasswordResetToken')), 'required'),
			array('form_password', Piwik_Translate( 'Login_PasswordsDoNotMatch'), 'fieldHaveSameValue', 'form_password_bis'),
		);
		$this->addRules( $formRules );

		$this->addElement('submit', 'submit');
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:28,代码来源:ResetPasswordForm.php

示例13: render

 public function render()
 {
     $this->shuffleCloud();
     $return = array();
     if (empty($this->wordsArray)) {
         return array();
     }
     $maxValue = max($this->wordsArray);
     foreach ($this->wordsArray as $word => $popularity) {
         $wordTruncated = $word;
         if (Piwik_Common::mb_strlen($word) > $this->truncatingLimit) {
             $wordTruncated = Piwik_Common::mb_substr($word, 0, $this->truncatingLimit - 3) . '...';
         }
         // case hideFutureHoursWhenToday=1 shows hours with no visits
         if ($maxValue == 0) {
             $percent = 0;
         } else {
             $percent = $popularity / $maxValue * 100;
         }
         // CSS style value
         $sizeRange = $this->getClassFromPercent($percent);
         $return[$word] = array('word' => $word, 'wordTruncated' => $wordTruncated, 'value' => $popularity, 'size' => $sizeRange, 'percent' => $percent);
     }
     return $return;
 }
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:25,代码来源:Cloud.php

示例14: authenticate

    /**
     * Authenticates user
     *
     * @return Piwik_Auth_Result
     */
    public function authenticate()
    {
        $rootLogin = Piwik_Config::getInstance()->superuser['login'];
        $rootPassword = Piwik_Config::getInstance()->superuser['password'];
        $rootToken = Piwik_UsersManager_API::getInstance()->getTokenAuth($rootLogin, $rootPassword);
        if (is_null($this->login)) {
            if ($this->token_auth === $rootToken) {
                return new Piwik_Auth_Result(Piwik_Auth_Result::SUCCESS_SUPERUSER_AUTH_CODE, $rootLogin, $this->token_auth);
            }
            $login = Piwik_FetchOne('SELECT login
					FROM ' . Piwik_Common::prefixTable('user') . ' 
					WHERE token_auth = ?', array($this->token_auth));
            if (!empty($login)) {
                return new Piwik_Auth_Result(Piwik_Auth_Result::SUCCESS, $login, $this->token_auth);
            }
        } else {
            if (!empty($this->login)) {
                if ($this->login === $rootLogin && $this->getHashTokenAuth($rootLogin, $rootToken) === $this->token_auth || $rootToken === $this->token_auth) {
                    $this->setTokenAuth($rootToken);
                    return new Piwik_Auth_Result(Piwik_Auth_Result::SUCCESS_SUPERUSER_AUTH_CODE, $rootLogin, $this->token_auth);
                }
                $login = $this->login;
                $userToken = Piwik_FetchOne('SELECT token_auth
					FROM ' . Piwik_Common::prefixTable('user') . ' 
					WHERE login = ?', array($login));
                if (!empty($userToken) && ($this->getHashTokenAuth($login, $userToken) === $this->token_auth || $userToken === $this->token_auth)) {
                    $this->setTokenAuth($userToken);
                    return new Piwik_Auth_Result(Piwik_Auth_Result::SUCCESS, $login, $userToken);
                }
            }
        }
        return new Piwik_Auth_Result(Piwik_Auth_Result::FAILURE, $this->login, $this->token_auth);
    }
开发者ID:nnnnathann,项目名称:piwik,代码行数:38,代码来源:Auth.php

示例15: getEvolutionGraph

	public function getEvolutionGraph( $fetch = false, $columns = false)
	{
		$view = $this->getLastUnitGraph($this->pluginName, __FUNCTION__, "VisitFrequency.get");
		if(empty($columns))
		{
			$columns = Piwik_Common::getRequestVar('columns');
		}
		$columns = !is_array($columns) ? array($columns) : $columns;
		$view->setColumnsToDisplay($columns);
		$view->setColumnsTranslations(array(
			'nb_visits_returning' => Piwik_Translate('VisitFrequency_ColumnReturningVisits'),
			'nb_actions_returning' => Piwik_Translate('VisitFrequency_ColumnActionsByReturningVisits'),
			'avg_time_on_site_returning' => Piwik_Translate('VisitFrequency_ColumnAverageVisitDurationForReturningVisitors'),
			'bounce_rate_returning' => Piwik_Translate('VisitFrequency_ColumnBounceRateForReturningVisits'),
			'nb_actions_per_visit_returning' => Piwik_Translate('VisitFrequency_ColumnAvgActionsPerReturningVisit'),
		));
		
		$doc = Piwik_Translate('VisitFrequency_ReturningVisitsDocumentation').'<br />'
		     . Piwik_Translate('General_BrokenDownReportDocumentation').'<br />'
		     . Piwik_Translate('VisitFrequency_ReturningVisitDocumentation');
		
		$view->setReportDocumentation($doc);
		
		return $this->renderView($view, $fetch);
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:25,代码来源:Controller.php


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