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


PHP Piwik_Site::getCurrency方法代码示例

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


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

示例1: getCurrency

 /**
  * Get currency symbol for a site
  *
  * @param int $idSite
  * @return string
  */
 public static function getCurrency($idSite)
 {
     $symbols = self::getCurrencyList();
     $site = new Piwik_Site($idSite);
     $currency = $site->getCurrency();
     if (isset($symbols[$currency])) {
         return $symbols[$currency][0];
     }
     return '';
 }
开发者ID:neolf,项目名称:PIWIK4MOBILE,代码行数:16,代码来源:Piwik.php

示例2: array

 function test_setDefaultTimezoneAndCurrencyAndExcludedQueryParametersAndExcludedIps()
 {
     // test that they return default values
     $defaultTimezone = Piwik_SitesManager_API::getInstance()->getDefaultTimezone();
     $this->assertEqual($defaultTimezone, 'UTC');
     $defaultCurrency = Piwik_SitesManager_API::getInstance()->getDefaultCurrency();
     $this->assertEqual($defaultCurrency, 'USD');
     $excludedIps = Piwik_SitesManager_API::getInstance()->getExcludedIpsGlobal();
     $this->assertEqual($excludedIps, '');
     $excludedQueryParameters = Piwik_SitesManager_API::getInstance()->getExcludedQueryParametersGlobal();
     $this->assertEqual($excludedQueryParameters, '');
     // test that when not specified, defaults are set as expected
     $idsite = Piwik_SitesManager_API::getInstance()->addSite("site1", array('http://example.org'));
     $site = new Piwik_Site($idsite);
     $this->assertEqual($site->getTimezone(), 'UTC');
     $this->assertEqual($site->getCurrency(), 'USD');
     $this->assertEqual($site->getExcludedQueryParameters(), '');
     $this->assertEqual($site->getExcludedIps(), '');
     $this->assertEqual($site->isEcommerceEnabled(), false);
     // set the global timezone and get it
     $newDefaultTimezone = 'UTC+5.5';
     Piwik_SitesManager_API::getInstance()->setDefaultTimezone($newDefaultTimezone);
     $defaultTimezone = Piwik_SitesManager_API::getInstance()->getDefaultTimezone();
     $this->assertEqual($defaultTimezone, $newDefaultTimezone);
     // set the default currency and get it
     $newDefaultCurrency = 'EUR';
     Piwik_SitesManager_API::getInstance()->setDefaultCurrency($newDefaultCurrency);
     $defaultCurrency = Piwik_SitesManager_API::getInstance()->getDefaultCurrency();
     $this->assertEqual($defaultCurrency, $newDefaultCurrency);
     // set the global IPs to exclude and get it
     $newGlobalExcludedIps = '1.1.1.*,1.1.*.*,150.1.1.1';
     Piwik_SitesManager_API::getInstance()->setGlobalExcludedIps($newGlobalExcludedIps);
     $globalExcludedIps = Piwik_SitesManager_API::getInstance()->getExcludedIpsGlobal();
     $this->assertEqual($globalExcludedIps, $newGlobalExcludedIps);
     // set the global URL query params to exclude and get it
     $newGlobalExcludedQueryParameters = 'PHPSESSID,blabla, TesT';
     // removed the space
     $expectedGlobalExcludedQueryParameters = 'PHPSESSID,blabla,TesT';
     Piwik_SitesManager_API::getInstance()->setGlobalExcludedQueryParameters($newGlobalExcludedQueryParameters);
     $globalExcludedQueryParameters = Piwik_SitesManager_API::getInstance()->getExcludedQueryParametersGlobal();
     $this->assertEqual($globalExcludedQueryParameters, $expectedGlobalExcludedQueryParameters);
     // create a website and check that default currency and default timezone are set
     // however, excluded IPs and excluded query Params are not returned
     $idsite = Piwik_SitesManager_API::getInstance()->addSite("site1", array('http://example.org'), $ecommerce = 1, '', '', $newDefaultTimezone);
     $site = new Piwik_Site($idsite);
     $this->assertEqual($site->getTimezone(), $newDefaultTimezone);
     $this->assertEqual($site->getCreationDate()->toString(), date('Y-m-d'));
     $this->assertEqual($site->getCurrency(), $newDefaultCurrency);
     $this->assertEqual($site->getExcludedIps(), '');
     $this->assertEqual($site->getExcludedQueryParameters(), '');
     $this->assertEqual($site->isEcommerceEnabled(), true);
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:52,代码来源:SitesManager.test.php

示例3: getCleanedVisitorsFromDetails

	/**
	 * For an array of visits, query the list of pages for this visit 
	 * as well as make the data human readable
	 */
	private function getCleanedVisitorsFromDetails($visitorDetails, $idSite)
	{
		$table = new Piwik_DataTable();

		$site = new Piwik_Site($idSite);
		$timezone = $site->getTimezone();
		$currencies = Piwik_SitesManager_API::getInstance()->getCurrencySymbols();
		foreach($visitorDetails as $visitorDetail)
		{
			$this->cleanVisitorDetails($visitorDetail, $idSite);
			$visitor = new Piwik_Live_Visitor($visitorDetail);
			$visitorDetailsArray = $visitor->getAllVisitorDetails();

			$visitorDetailsArray['siteCurrency'] = $site->getCurrency();
			$visitorDetailsArray['siteCurrencySymbol'] = @$currencies[$site->getCurrency()];
			$visitorDetailsArray['serverTimestamp'] = $visitorDetailsArray['lastActionTimestamp'];
			$dateTimeVisit = Piwik_Date::factory($visitorDetailsArray['lastActionTimestamp'], $timezone);
			$visitorDetailsArray['serverTimePretty'] = $dateTimeVisit->getLocalized('%time%');
			$visitorDetailsArray['serverDatePretty'] = $dateTimeVisit->getLocalized('%shortDay% %day% %shortMonth%');
			
			$dateTimeVisitFirstAction = Piwik_Date::factory($visitorDetailsArray['firstActionTimestamp'], $timezone);
			$visitorDetailsArray['serverDatePrettyFirstAction'] = $dateTimeVisitFirstAction->getLocalized('%shortDay% %day% %shortMonth%');
			$visitorDetailsArray['serverTimePrettyFirstAction'] = $dateTimeVisitFirstAction->getLocalized('%time%');
			
			$idvisit = $visitorDetailsArray['idVisit'];

			$sqlCustomVariables = '';
			for($i = 1; $i <= Piwik_Tracker::MAX_CUSTOM_VARIABLES; $i++)
			{
				$sqlCustomVariables .= ', custom_var_k' . $i . ', custom_var_v' . $i;
			}
			// The second join is a LEFT join to allow returning records that don't have a matching page title
			// eg. Downloads, Outlinks. For these, idaction_name is set to 0
			$sql = "
				SELECT
					log_action.type as type,
					log_action.name AS url,
					log_action_title.name AS pageTitle,
					log_action.idaction AS pageIdAction,
					log_link_visit_action.idlink_va AS pageId,
					log_link_visit_action.server_time as serverTimePretty
					$sqlCustomVariables
				FROM " .Piwik_Common::prefixTable('log_link_visit_action')." AS log_link_visit_action
					INNER JOIN " .Piwik_Common::prefixTable('log_action')." AS log_action
					ON  log_link_visit_action.idaction_url = log_action.idaction
					LEFT JOIN " .Piwik_Common::prefixTable('log_action')." AS log_action_title
					ON  log_link_visit_action.idaction_name = log_action_title.idaction
				WHERE log_link_visit_action.idvisit = ?
				 ";
			$actionDetails = Piwik_FetchAll($sql, array($idvisit));
			
			foreach($actionDetails as &$actionDetail)
			{
				$customVariablesPage = array();
				for($i = 1; $i <= Piwik_Tracker::MAX_CUSTOM_VARIABLES; $i++)
				{
					if(!empty($actionDetail['custom_var_k'.$i])
						&& !empty($actionDetail['custom_var_v'.$i]))
					{
						$customVariablesPage[$i] = array(
							'customVariableName'.$i => $actionDetail['custom_var_k'.$i],
							'customVariableValue'.$i => $actionDetail['custom_var_v'.$i],
						);
					}
					unset($actionDetail['custom_var_k'.$i]);
					unset($actionDetail['custom_var_v'.$i]);
				}
				if(!empty($customVariablesPage))
				{
					$actionDetail['customVariables'] = $customVariablesPage;
				}
			}
			
			// If the visitor converted a goal, we shall select all Goals
			$sql = "
				SELECT 
						'goal' as type,
						goal.name as goalName,
						goal.revenue as revenue,
						log_conversion.idlink_va as goalPageId,
						log_conversion.server_time as serverTimePretty,
						log_conversion.url as url
				FROM ".Piwik_Common::prefixTable('log_conversion')." AS log_conversion
				LEFT JOIN ".Piwik_Common::prefixTable('goal')." AS goal 
					ON (goal.idsite = log_conversion.idsite
						AND  
						goal.idgoal = log_conversion.idgoal)
					AND goal.deleted = 0
				WHERE log_conversion.idvisit = ?
					AND log_conversion.idgoal > 0
			";
			$goalDetails = Piwik_FetchAll($sql, array($idvisit));

			$sql = "SELECT 
						case idgoal when ".Piwik_Tracker_GoalManager::IDGOAL_CART." then '".Piwik_Archive::LABEL_ECOMMERCE_CART."' else '".Piwik_Archive::LABEL_ECOMMERCE_ORDER."' end as type,
						idorder as orderId,
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:101,代码来源:API.php

示例4: getCleanedVisitorsFromDetails

 /**
  * For an array of visits, query the list of pages for this visit 
  * as well as make the data human readable
  */
 private function getCleanedVisitorsFromDetails($visitorDetails, $idSite)
 {
     $table = new Piwik_DataTable();
     $site = new Piwik_Site($idSite);
     $timezone = $site->getTimezone();
     foreach ($visitorDetails as $visitorDetail) {
         $this->cleanVisitorDetails($visitorDetail, $idSite);
         $visitor = new Piwik_Live_Visitor($visitorDetail);
         $visitorDetailsArray = $visitor->getAllVisitorDetails();
         $visitorDetailsArray['siteCurrency'] = $site->getCurrency();
         $visitorDetailsArray['serverTimestamp'] = $visitorDetailsArray['lastActionTimestamp'];
         $dateTimeVisit = Piwik_Date::factory($visitorDetailsArray['lastActionTimestamp'], $timezone);
         $visitorDetailsArray['serverTimePretty'] = $dateTimeVisit->getLocalized('%time%');
         $visitorDetailsArray['serverDatePretty'] = $dateTimeVisit->getLocalized('%shortDay% %day% %shortMonth%');
         $dateTimeVisitFirstAction = Piwik_Date::factory($visitorDetailsArray['firstActionTimestamp'], $timezone);
         $visitorDetailsArray['serverDatePrettyFirstAction'] = $dateTimeVisitFirstAction->getLocalized('%shortDay% %day% %shortMonth%');
         $visitorDetailsArray['serverTimePrettyFirstAction'] = $dateTimeVisitFirstAction->getLocalized('%time%');
         $idvisit = $visitorDetailsArray['idVisit'];
         // The second join is a LEFT join to allow returning records that don't have a matching page title
         // eg. Downloads, Outlinks. For these, idaction_name is set to 0
         $sql = "\n\t\t\t\tSELECT\n\t\t\t\t\tlog_action.type as type,\n\t\t\t\t\tlog_action.name AS url,\n\t\t\t\t\tlog_action_title.name AS pageTitle,\n\t\t\t\t\tlog_action.idaction AS pageIdAction,\n\t\t\t\t\tlog_link_visit_action.idlink_va AS pageId,\n\t\t\t\t\tlog_link_visit_action.server_time as serverTimePretty\n\t\t\t\tFROM " . Piwik_Common::prefixTable('log_link_visit_action') . " AS log_link_visit_action\n\t\t\t\t\tINNER JOIN " . Piwik_Common::prefixTable('log_action') . " AS log_action\n\t\t\t\t\tON  log_link_visit_action.idaction_url = log_action.idaction\n\t\t\t\t\tLEFT JOIN " . Piwik_Common::prefixTable('log_action') . " AS log_action_title\n\t\t\t\t\tON  log_link_visit_action.idaction_name = log_action_title.idaction\n\t\t\t\tWHERE log_link_visit_action.idvisit = ?\n\t\t\t\t ";
         $actionDetails = Piwik_FetchAll($sql, array($idvisit));
         // If the visitor converted a goal, we shall select all Goals
         $sql = "\n\t\t\t\tSELECT \n\t\t\t\t\t\t'goal' as type,\n\t\t\t\t\t\tgoal.name as goalName,\n\t\t\t\t\t\tgoal.revenue as revenue,\n\t\t\t\t\t\tlog_conversion.idlink_va as goalPageId,\n\t\t\t\t\t\tlog_conversion.server_time as serverTimePretty,\n\t\t\t\t\t\tlog_conversion.url as url\n\t\t\t\tFROM " . Piwik_Common::prefixTable('log_conversion') . " AS log_conversion\n\t\t\t\tLEFT JOIN " . Piwik_Common::prefixTable('goal') . " AS goal \n\t\t\t\t\tON (goal.idsite = log_conversion.idsite\n\t\t\t\t\t\tAND  \n\t\t\t\t\t\tgoal.idgoal = log_conversion.idgoal)\n\t\t\t\t\tAND goal.deleted = 0\n\t\t\t\tWHERE log_conversion.idvisit = ?\n\t\t\t";
         $goalDetails = Piwik_FetchAll($sql, array($idvisit));
         $actions = array_merge($actionDetails, $goalDetails);
         usort($actions, array($this, 'sortByServerTime'));
         $visitorDetailsArray['actionDetails'] = $actions;
         // Convert datetimes to the site timezone
         foreach ($visitorDetailsArray['actionDetails'] as &$details) {
             switch ($details['type']) {
                 case 'goal':
                     break;
                 case Piwik_Tracker_Action_Interface::TYPE_DOWNLOAD:
                     $details['type'] = 'download';
                     break;
                 case Piwik_Tracker_Action_Interface::TYPE_OUTLINK:
                     $details['type'] = 'outlink';
                     break;
                 default:
                     $details['type'] = 'action';
                     break;
             }
             $dateTimeVisit = Piwik_Date::factory($details['serverTimePretty'], $timezone);
             $details['serverTimePretty'] = $dateTimeVisit->getLocalized('%shortDay% %day% %shortMonth% %time%');
         }
         $visitorDetailsArray['goalConversions'] = count($goalDetails);
         $table->addRowFromArray(array(Piwik_DataTable_Row::COLUMNS => $visitorDetailsArray));
     }
     return $table;
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:55,代码来源:API.php


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