• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Piwik_Date类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __construct

 /**
  * The constructor
  * Initialize some local variables from the request
  * @param int $idSite
  * @param Piwik_Date $date ($this->date from controller)
  * @throws Exception
  */
 public function __construct($idSite, $date, $graphType = null)
 {
     $this->apiMethod = Piwik_Common::getRequestVar('apiMethod', '', 'string');
     if (empty($this->apiMethod)) {
         throw new Exception("Parameter apiMethod not set.");
     }
     $this->label = Piwik_Common::getRequestVar('label', '', 'string');
     $this->label = Piwik_Common::unsanitizeInputValue($this->label);
     if ($this->label === '') {
         throw new Exception("Parameter label not set.");
     }
     $this->period = Piwik_Common::getRequestVar('period', '', 'string');
     if (empty($this->period)) {
         throw new Exception("Parameter period not set.");
     }
     $this->idSite = $idSite;
     $this->graphType = $graphType;
     if ($this->period != 'range') {
         // handle day, week, month and year: display last X periods
         $end = $date->toString();
         list($this->date, $lastN) = Piwik_ViewDataTable_GenerateGraphHTML_ChartEvolution::getDateRangeAndLastN($this->period, $end);
     }
     $this->segment = Piwik_Common::getRequestVar('segment', '', 'string');
     $this->loadEvolutionReport();
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:32,代码来源:RowEvolution.php


示例2: setGeneralVariablesView

 protected function setGeneralVariablesView($view)
 {
     // date
     $view->date = $this->strDate;
     $oDate = new Piwik_Date($this->strDate);
     $view->prettyDate = $oDate->getLocalized(Piwik_Translate('Home_LocalizedDateFormat'));
     // period
     $currentPeriod = Piwik_Common::getRequestVar('period');
     $otherPeriodsAvailable = array('day', 'week', 'month', 'year');
     $otherPeriodsNames = array('day' => Piwik_Translate('Home_PeriodDay'), 'week' => Piwik_Translate('Home_PeriodWeek'), 'month' => Piwik_Translate('Home_PeriodMonth'), 'year' => Piwik_Translate('Home_PeriodYear'));
     $found = array_search($currentPeriod, $otherPeriodsAvailable);
     if ($found !== false) {
         unset($otherPeriodsAvailable[$found]);
     }
     $view->period = $currentPeriod;
     $view->otherPeriods = $otherPeriodsAvailable;
     $view->periodsNames = $otherPeriodsNames;
     // other
     $view->idSite = Piwik_Common::getRequestVar('idSite');
     $view->userLogin = Piwik::getCurrentUserLogin();
     $view->sites = Piwik_SitesManager_API::getSitesWithAtLeastViewAccess();
     $view->url = Piwik_Url::getCurrentUrl();
     $view->menu = Piwik_GetMenu();
     $view->menuJson = json_encode($view->menu);
     //var_dump($view->menuJson);
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:26,代码来源:Controller.php


示例3: __construct

 /**
  * Builds the controller object, reads the date from the request, extracts plugin name from 
  *
  */
 function __construct()
 {
     $aPluginName = explode('_', get_class($this));
     $this->pluginName = $aPluginName[1];
     $this->strDate = Piwik_Common::getRequestVar('date', 'yesterday', 'string');
     // the date looks like YYYY-MM-DD we can build it
     try {
         $this->date = Piwik_Date::factory($this->strDate);
         $this->strDate = $this->date->toString();
     } catch (Exception $e) {
         // the date looks like YYYY-MM-DD,YYYY-MM-DD or other format
         // case the date looks like a range
         $this->date = null;
     }
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:19,代码来源:Controller.php


示例4: setUp

 public function setUp()
 {
     // add one site
     $this->idSite = $this->createWebsite($this->dateTime, 1, "Site #0");
     // add two goals
     $goals = Piwik_Goals_API::getInstance();
     $this->idGoal1 = $goals->addGoal($this->idSite, 'all', 'url', 'http', 'contains', false, 5);
     $this->idGoal2 = $goals->addGoal($this->idSite, 'all', 'url', 'http', 'contains');
     $urls = array();
     for ($i = 0; $i != 2; ++$i) {
         $url = "http://whatever.com/" . ($i - 1) . "/" . ($i + 1);
         $title = "page view " . ($i - 1) . " / " . ($i + 1);
         $urls[$url] = $title;
     }
     $visitTimes = array();
     $date = Piwik_Date::factory($this->dateTime);
     for ($i = 0; $i != 250; ++$i) {
         // spread visits out through entire year
         $day = floor(365 * $i / 250);
         for ($j = 0; $j != 2; ++$j) {
             $visitTimes[] = $date->addDay($day)->addHour($j)->toString();
         }
     }
     // add 12,000 page views (2 visits of 2 page views for 12 visitors on 250 days spread out through year)
     for ($visitor = 0; $visitor != 12; ++$visitor) {
         $t = $this->getTracker($this->idSite, $this->dateTime);
         foreach ($visitTimes as $visitTime) {
             $t->setForceVisitDateTime($visitTime);
             foreach ($urls as $url => $title) {
                 $t->setUrl($url);
                 $t->doTrackPageView($title);
             }
         }
     }
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:35,代码来源:OneSiteTwelveThousandPageViews_Year.benchmark.php


示例5: removeHoursInFuture

	protected function removeHoursInFuture($table, $idSite, $period, $date)
	{
		$site = new Piwik_Site($idSite);
		
		if(	$period == 'day'
			&& ($date == 'today'
				||  $date == Piwik_Date::factory('now', $site->getTimezone())->toString()))
		{
			$currentHour = Piwik_Date::factory('now', $site->getTimezone())->toString('G');
			// If no data for today, this is an exception to the API output rule, as we normally return nothing:
			// we shall return all hours of the day, with nb_visits = 0
			if($table->getRowsCount() == 0)
			{
				for($hour = 0; $hour <= $currentHour; $hour++)
				{
					$table->addRowFromSimpleArray( array('label' => $hour, 'nb_visits' => 0));
				}
				return $table;
			}
			
			$idsToDelete = array();
			foreach($table->getRows() as $id => $row)
			{
				$hour = $row->getColumn('label');
				if($hour > $currentHour)
				{
					$idsToDelete[] = $id;
				}
			}
			$table->deleteRows($idsToDelete);
		}
		return $table;
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:33,代码来源:API.php


示例6: getScheduledTasks

 function getScheduledTasks($notification)
 {
     // Reports have to be sent when the period ends for all websites
     $maxHourOffset = 0;
     $uniqueTimezones = Piwik_SitesManager_API::getInstance()->getUniqueSiteTimezones();
     $baseDate = Piwik_Date::factory("1971-01-01");
     foreach ($uniqueTimezones as &$timezone) {
         $offsetDate = Piwik_Date::factory($baseDate->toString(), $timezone);
         // Earlier means a negative timezone
         if ($offsetDate->isEarlier($baseDate)) {
             // Gets the timezone offset
             $hourOffset = 24 - date('H', $offsetDate->getTimestamp());
             if ($hourOffset > $maxHourOffset) {
                 $maxHourOffset = $hourOffset;
             }
         }
     }
     $tasks =& $notification->getNotificationObject();
     $dailySchedule = new Piwik_ScheduledTime_Daily();
     $dailySchedule->setHour($maxHourOffset);
     $tasks[] = new Piwik_ScheduledTask($this, 'dailySchedule', $dailySchedule);
     $weeklySchedule = new Piwik_ScheduledTime_Weekly();
     $weeklySchedule->setHour($maxHourOffset);
     $tasks[] = new Piwik_ScheduledTask($this, 'weeklySchedule', $weeklySchedule);
     $monthlySchedule = new Piwik_ScheduledTime_Monthly();
     $monthlySchedule->setHour($maxHourOffset);
     $tasks[] = new Piwik_ScheduledTask($this, 'monthlySchedule', $monthlySchedule);
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:28,代码来源:PDFReports.php


示例7: isFinished

 public function isFinished()
 {
     $todayMidnight = Piwik_Date::today();
     if ($this->date->isEarlier($todayMidnight)) {
         return true;
     }
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:7,代码来源:Day.php


示例8: trackVisits

 protected static function trackVisits()
 {
     $dateTimes = self::$dateTimes;
     $idSite = self::$idSite;
     $i = 0;
     $ridx = 0;
     foreach ($dateTimes as $dateTime) {
         $i++;
         $visitor = self::getTracker($idSite, $dateTime, $defaultInit = true);
         // Fake the visit count cookie
         $visitor->setDebugStringAppend("&_idvc={$i}");
         $visitor->setForceVisitDateTime(Piwik_Date::factory($dateTime)->addHour(0.1)->getDatetime());
         $visitor->setUrl('http://example.org/homepage');
         $visitor->setUrlReferrer(self::$referrerUrls[$ridx++]);
         self::checkResponse($visitor->doTrackPageView('ou pas'));
         // Test change the IP, the visit should not be split but recorded to the same idvisitor
         $visitor->setIp('200.1.15.22');
         $visitor->setForceVisitDateTime(Piwik_Date::factory($dateTime)->addHour(0.2)->getDatetime());
         $visitor->setUrl('http://example.org/news');
         self::checkResponse($visitor->doTrackPageView('ou pas'));
         $visitor->setForceVisitDateTime(Piwik_Date::factory($dateTime)->addHour(1)->getDatetime());
         $visitor->setUrl('http://example.org/news');
         $visitor->setUrlReferrer(self::$referrerUrls[$ridx++]);
         self::checkResponse($visitor->doTrackPageView('ou pas'));
     }
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:26,代码来源:OneVisitorOneWebsite_SeveralDaysDateRangeTest.php


示例9: trackVisits

 protected static function trackVisits()
 {
     // tests run in UTC, the Tracker in UTC
     $dateTime = self::$dateTime;
     $idSite = self::$idSite;
     $t = self::getTracker($idSite, $dateTime, $defaultInit = true, $useThirdPartyCookie = 1);
     // Also testing to record this as a bot while specifically allowing bots
     $t->setUserAgent('Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)');
     $t->DEBUG_APPEND_URL .= '&bots=1';
     $t->DEBUG_APPEND_URL .= '&forceIpAnonymization=1';
     // VISIT 1 = Referrer is "Keyword not defined"
     // Alsotrigger goal to check that attribution goes to this keyword
     $t->setUrlReferrer('http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CC&url=http%3A%2F%2Fpiwik.org%2F&ei=&usg=');
     $t->setUrl('http://example.org/this%20is%20cool!');
     self::checkResponse($t->doTrackPageView('incredible title!'));
     $idGoal = Piwik_Goals_API::getInstance()->addGoal($idSite, 'triggered js', 'manually', '', '');
     $t->setForceVisitDateTime(Piwik_Date::factory($dateTime)->addHour(0.3)->getDatetime());
     self::checkResponse($t->doTrackGoal($idGoal, $revenue = 42));
     // VISIT 2 = Referrer has keyword, but the URL should be rewritten
     // in Live Output to point to google search result page
     $t->setForceVisitDateTime(Piwik_Date::factory($dateTime)->addHour(2)->getDatetime());
     $t->setUrlReferrer('http://www.google.com.vn/url?sa=t&rct=j&q=%3C%3E%26%5C%22the%20pdo%20extension%20is%20required%20for%20this%20adapter%20but%20the%20extension%20is%20not%20loaded&source=web&cd=4&ved=0FjAD&url=http%3A%2F%2Fforum.piwik.org%2Fread.php%3F2%2C1011&ei=y-HHAQ&usg=AFQjCN2-nt5_GgDeg&cad=rja');
     // Test with empty title, that the output of Live is valid
     self::checkResponse($t->doTrackPageView(''));
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:25,代码来源:OneVisitor_NoKeywordSpecifiedTest.php


示例10: trackVisits

 protected static function trackVisits()
 {
     // Visitor site1
     $visitor = self::getTracker(self::$idSite1, self::$dateTime, $defaultInit = true);
     // Test w/ iso-8859-15
     $visitor->setForceVisitDateTime(Piwik_Date::factory(self::$dateTime)->addHour(0.3)->getDatetime());
     $visitor->setUrlReferrer('http://anothersite.com/whatever.html?whatever=Ato%FC');
     $visitor->setUrl('http://example.org/index.htm?random=param&mykwd=Search 2%FC&test&cats= Search Category &search_count=INCORRECT!');
     $visitor->setDebugStringAppend('&cs=iso-8859-15');
     self::checkResponse($visitor->doTrackPageView('Site Search results'));
     $visitor->setDebugStringAppend('');
     // Test w/ windows-1251
     $visitor = self::getTracker(self::$idSite1, self::$dateTime, $defaultInit = true);
     $visitor->setForceVisitDateTime(Piwik_Date::factory(self::$dateTime)->addHour(0.3)->getDatetime());
     $visitor->setUrlReferrer('http://anothersite.com/whatever.html?txt=%EC%E5%F8%EA%EE%E2%FB%E5');
     $visitor->setUrl('http://example.org/page/index.htm?whatever=%EC%E5%F8%EA%EE%E2%FB%E5');
     $visitor->setDebugStringAppend('&cs=windows-1251');
     self::checkResponse($visitor->doTrackPageView('Page title is always UTF-8'));
     $visitor->setDebugStringAppend('');
     // Test invalid char set
     $visitor = self::getTracker(self::$idSite1, self::$dateTime, $defaultInit = true);
     $visitor->setForceVisitDateTime(Piwik_Date::factory(self::$dateTime)->addHour(1)->getDatetime());
     $visitor->setUrlReferrer('http://anothersite.com/whatever.html');
     $visitor->setUrl('http://example.org/index.htm?random=param&mykwd=a+keyword&test&cats= Search Category &search_count=INCORRECT!');
     $visitor->setDebugStringAppend('&cs=GTF-42');
     // galactic transformation format
     self::checkResponse($visitor->doTrackPageView('Site Search results'));
     $visitor->setDebugStringAppend('');
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:29,代码来源:NonUnicodeTests.php


示例11: testGetPrettyString

 /**
  * @group Core
  * @group Period
  * @group Period_Year
  */
 public function testGetPrettyString()
 {
     Piwik_Translate::getInstance()->loadEnglishTranslation();
     $year = new Piwik_Period_Year(Piwik_Date::factory('2024-10-09'));
     $shouldBe = '2024';
     $this->assertEquals($shouldBe, $year->getPrettyString());
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:12,代码来源:YearTest.php


示例12: setDateTodayIfWebsiteCreatedToday

	protected function setDateTodayIfWebsiteCreatedToday()
	{
		$date = Piwik_Common::getRequestVar('date', false);
		if($date == 'today'
			|| Piwik_Common::getRequestVar('period', false) == 'range') 
		{
			return;
		} 
		$websiteId = Piwik_Common::getRequestVar('idSite', false, 'int');
		if ($websiteId) 
		{
			$website = new Piwik_Site($websiteId);
			$datetimeCreationDate = $this->site->getCreationDate()->getDatetime();
			$creationDateLocalTimezone = Piwik_Date::factory($datetimeCreationDate, $website->getTimezone())->toString('Y-m-d');
			$todayLocalTimezone = Piwik_Date::factory('now', $website->getTimezone())->toString('Y-m-d');
			if( $creationDateLocalTimezone == $todayLocalTimezone ) 
			{
				Piwik::redirectToModule( 'CoreHome', 'index', 
										array(	'date' => 'today', 
												'idSite' => $websiteId, 
												'period' => Piwik_Common::getRequestVar('period')) 
				);
			}
		}
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:25,代码来源:Controller.php


示例13: trackVisits

 protected function trackVisits()
 {
     $dateTime = $this->dateTime;
     $idSite = $this->idSite;
     $idGoal_OneConversionPerVisit = $this->idGoal_OneConversionPerVisit;
     $idGoal_MultipleConversionPerVisit = $this->idGoal_MultipleConversionPerVisit;
     $t = $this->getTracker($idSite, $dateTime, $defaultInit = true);
     // Record 1st goal, should only have 1 conversion
     $t->setUrl('http://example.org/index.htm');
     $t->setForceVisitDateTime(Piwik_Date::factory($dateTime)->addHour(0.3)->getDatetime());
     $this->checkResponse($t->doTrackPageView('Thank you mate'));
     $t->setForceVisitDateTime(Piwik_Date::factory($dateTime)->addHour(0.4)->getDatetime());
     $this->checkResponse($t->doTrackGoal($idGoal_OneConversionPerVisit, $revenue = 10000000));
     // Record 2nd goal, should record both conversions
     $t->setForceVisitDateTime(Piwik_Date::factory($dateTime)->addHour(0.5)->getDatetime());
     $this->checkResponse($t->doTrackGoal($idGoal_MultipleConversionPerVisit, $revenue = 300));
     $t->setForceVisitDateTime(Piwik_Date::factory($dateTime)->addHour(0.6)->getDatetime());
     $this->checkResponse($t->doTrackGoal($idGoal_MultipleConversionPerVisit, $revenue = 366));
     // Update & set to not allow multiple
     $goals = Piwik_Goals_API::getInstance()->getGoals($idSite);
     $goal = $goals[$idGoal_OneConversionPerVisit];
     $this->assertTrue($goal['allow_multiple'] == 0);
     Piwik_Goals_API::getInstance()->updateGoal($idSite, $idGoal_OneConversionPerVisit, $goal['name'], @$goal['match_attribute'], @$goal['pattern'], @$goal['pattern_type'], @$goal['case_sensitive'], $goal['revenue'], $goal['allow_multiple'] = 1);
     $this->assertTrue($goal['allow_multiple'] == 1);
     // 1st goal should Now be tracked
     $t->setForceVisitDateTime(Piwik_Date::factory($dateTime)->addHour(0.61)->getDatetime());
     $this->checkResponse($t->doTrackGoal($idGoal_OneConversionPerVisit, $revenue = 656));
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:28,代码来源:TrackGoals_AllowMultipleConversionsPerVisit.test.php


示例14: index

 function index()
 {
     $view = Piwik_View::factory('SitesManager');
     if (Piwik::isUserIsSuperUser()) {
         $sites = Piwik_SitesManager_API::getInstance()->getAllSites();
         Piwik_Site::setSites($sites);
         $sites = array_values($sites);
     } else {
         $sites = Piwik_SitesManager_API::getInstance()->getSitesWithAdminAccess();
         Piwik_Site::setSitesFromArray($sites);
     }
     foreach ($sites as &$site) {
         $site['alias_urls'] = Piwik_SitesManager_API::getInstance()->getSiteUrlsFromId($site['idsite']);
         $site['excluded_ips'] = str_replace(',', '<br/>', $site['excluded_ips']);
         $site['excluded_parameters'] = str_replace(',', '<br/>', $site['excluded_parameters']);
     }
     $view->adminSites = $sites;
     $view->adminSitesCount = count($sites);
     $timezones = Piwik_SitesManager_API::getInstance()->getTimezonesList();
     $view->timezoneSupported = Piwik::isTimezoneSupportEnabled();
     $view->timezones = Piwik_Common::json_encode($timezones);
     $view->defaultTimezone = Piwik_SitesManager_API::getInstance()->getDefaultTimezone();
     $view->currencies = Piwik_Common::json_encode(Piwik_SitesManager_API::getInstance()->getCurrencyList());
     $view->defaultCurrency = Piwik_SitesManager_API::getInstance()->getDefaultCurrency();
     $view->utcTime = Piwik_Date::now()->getDatetime();
     $excludedIpsGlobal = Piwik_SitesManager_API::getInstance()->getExcludedIpsGlobal();
     $view->globalExcludedIps = str_replace(',', "\n", $excludedIpsGlobal);
     $excludedQueryParametersGlobal = Piwik_SitesManager_API::getInstance()->getExcludedQueryParametersGlobal();
     $view->globalExcludedQueryParameters = str_replace(',', "\n", $excludedQueryParametersGlobal);
     $view->currentIpAddress = Piwik_IP::getIpFromHeader();
     $view->showAddSite = (bool) Piwik_Common::getRequestVar('showaddsite', false);
     $this->setBasicVariablesView($view);
     $view->menu = Piwik_GetAdminMenu();
     echo $view->render();
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:35,代码来源:Controller.php


示例15: index

 function index()
 {
     $view = Piwik_View::factory('SitesManager');
     $sites = Piwik_SitesManager_API::getInstance()->getSitesWithAdminAccess();
     foreach ($sites as $site) {
         $sitesIndexedById[$site['idsite']] = $site;
     }
     Piwik_Site::setSites($sitesIndexedById);
     foreach ($sites as &$site) {
         $site['alias_urls'] = Piwik_SitesManager_API::getInstance()->getSiteUrlsFromId($site['idsite']);
         $site['excluded_ips'] = str_replace(',', '<br/>', $site['excluded_ips']);
         $site['excluded_parameters'] = str_replace(',', '<br/>', $site['excluded_parameters']);
     }
     $view->adminSites = $sites;
     $view->adminSitesCount = count($sites);
     $timezones = Piwik_SitesManager_API::getInstance()->getTimezonesList();
     $view->timezoneSupported = Piwik::isTimezoneSupportEnabled();
     $view->timezones = json_encode($timezones);
     $view->defaultTimezone = Piwik_SitesManager_API::getInstance()->getDefaultTimezone();
     $view->currencies = json_encode(Piwik_SitesManager_API::getInstance()->getCurrencyList());
     $view->defaultCurrency = Piwik_SitesManager_API::getInstance()->getDefaultCurrency();
     $view->utcTime = Piwik_Date::now()->getDatetime();
     $excludedIpsGlobal = Piwik_SitesManager_API::getInstance()->getExcludedIpsGlobal();
     $view->globalExcludedIps = str_replace(',', "\n", $excludedIpsGlobal);
     $excludedQueryParametersGlobal = Piwik_SitesManager_API::getInstance()->getExcludedQueryParametersGlobal();
     $view->globalExcludedQueryParameters = str_replace(',', "\n", $excludedQueryParametersGlobal);
     $view->currentIpAddress = Piwik_Common::getIpString();
     $this->setBasicVariablesView($view);
     $view->menu = Piwik_GetAdminMenu();
     echo $view->render();
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:31,代码来源:Controller.php


示例16: renderTable

 /**
  * Computes the output for the given data table
  *
  * @param Piwik_DataTable  $table
  * @return string
  * @throws Exception
  */
 protected function renderTable($table)
 {
     if (!$table instanceof Piwik_DataTable_Array || $table->getKeyName() != 'date') {
         throw new Exception("RSS feeds can be generated for one specific website &idSite=X." . "\nPlease specify only one idSite or consider using &format=XML instead.");
     }
     $idSite = Piwik_Common::getRequestVar('idSite', 1, 'int');
     $period = Piwik_Common::getRequestVar('period');
     $piwikUrl = Piwik_Url::getCurrentUrlWithoutFileName() . "?module=CoreHome&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);
         $dateInSiteTimezone = Piwik_Date::factory($timestamp)->setTimezone($site->getTimezone())->toString('Y-m-d');
         $thisPiwikUrl = Piwik_Common::sanitizeInputValue($piwikUrl . "&date={$dateInSiteTimezone}");
         $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 .= Piwik_Common::sanitizeInputValue($this->renderDataTable($subtable));
         $out .= "</description>\n\t</item>\n";
     }
     $header = $this->getRssHeader();
     $footer = $this->getRssFooter();
     return $header . $out . $footer;
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:33,代码来源:Rss.php


示例17: setUp

 public function setUp()
 {
     // add one site
     $this->idSite = $this->createWebsite($this->dateTime, 1, "Site #0");
     // add two goals
     $goals = Piwik_Goals_API::getInstance();
     $this->idGoal1 = $goals->addGoal($this->idSite, 'all', 'url', 'http', 'contains', false, 5);
     $this->idGoal2 = $goals->addGoal($this->idSite, 'all', 'url', 'http', 'contains');
     $urls = array();
     for ($i = 0; $i != 10; ++$i) {
         $url = "http://whatever.com/" . ($i - 1) . "/" . ($i + 1);
         $title = "page view " . ($i - 1) . " / " . ($i + 1);
         $urls[$url] = $title;
     }
     $visitTimes = array();
     $date = Piwik_Date::factory($this->dateTime);
     for ($i = 0; $i != 12; ++$i) {
         $visitTimes[] = $date->addHour($i)->toString();
     }
     // add 10,000 page views (10 visits of 10 page views for 100 visitors)
     for ($visitor = 0; $visitor != 100; ++$visitor) {
         $t = $this->getTracker($this->idSite, $this->dateTime, $defaultInit = true);
         foreach ($visitTimes as $visitTime) {
             $t->setForceVisitDateTime($visitTime);
             foreach ($urls as $url => $title) {
                 $t->setUrl($url);
                 $t->doTrackPageView($title);
             }
         }
     }
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:31,代码来源:OneSiteTwelveThousandPageViews_OneDay.benchmark.php


示例18: build

 /**
  * Builds an Archive object or returns the same archive if previously built.
  *
  * @param int $idSite
  * @param string|Piwik_Date $date 'YYYY-MM-DD' or magic keywords 'today' @see Piwik_Date::factory()
  * @param string $period 'week' 'day' etc.
  * 
  * @return Piwik_Archive
  */
 public static function build($idSite, $period, $strDate)
 {
     $oSite = new Piwik_Site($idSite);
     // if a period date string is detected: either 'last30', 'previous10' or 'YYYY-MM-DD,YYYY-MM-DD'
     if (is_string($strDate) && (ereg('^(last|previous){1}([0-9]*)$', $strDate, $regs) || ereg('^([0-9]{4}-[0-9]{1,2}-[0-9]{1,2}),([0-9]{4}-[0-9]{1,2}-[0-9]{1,2})$', $strDate, $regs))) {
         require_once 'Archive/Array.php';
         $archive = new Piwik_Archive_Array($oSite, $period, $strDate);
     } else {
         if (is_string($strDate)) {
             $oDate = Piwik_Date::factory($strDate);
         } else {
             $oDate = $strDate;
         }
         $date = $oDate->toString();
         if (isset(self::$alreadyBuilt[$idSite][$date][$period])) {
             return self::$alreadyBuilt[$idSite][$date][$period];
         }
         $oPeriod = Piwik_Period::factory($period, $oDate);
         $archive = new Piwik_Archive_Single();
         $archive->setPeriod($oPeriod);
         $archive->setSite($oSite);
         self::$alreadyBuilt[$idSite][$date][$period] = $archive;
     }
     return $archive;
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:34,代码来源:Archive.php


示例19: cacheDataByArchiveNameReports

 /**
  * Caches the intermediate DataTables used in the getIndividualReportsSummary and
  * getIndividualMetricsSummary reports in the option table.
  */
 public function cacheDataByArchiveNameReports()
 {
     $api = Piwik_DBStats_API::getInstance();
     $api->getIndividualReportsSummary(true);
     $api->getIndividualMetricsSummary(true);
     $now = Piwik_Date::now()->getLocalized("%longYear%, %shortMonth% %day%");
     Piwik_SetOption(self::TIME_OF_LAST_TASK_RUN_OPTION, $now);
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:12,代码来源:DBStats.php


示例20: trackVisits

 protected function trackVisits()
 {
     $idSite = $this->idSite;
     $dateTime = $this->dateTime;
     $t = $this->getTracker($idSite, $dateTime, $defaultInit = true);
     // Record 1st page view
     $t->setUrl('http://example.org/index.htm');
     $this->checkResponse($t->doTrackPageView('incredible title!'));
     $t->setForceVisitDateTime(Piwik_Date::factory($dateTime)->addHour(0.3)->getDatetime());
     $this->checkResponse($t->doTrackGoal($this->idGoal3, $revenue = 42.256));
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:11,代码来源:ApiGetReportMetadata.test.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Piwik_FrontController类代码示例发布时间:2022-05-23
下一篇:
PHP Piwik_DataTable_Manager类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap