本文整理汇总了PHP中Piwik\Date::getTimestamp方法的典型用法代码示例。如果您正苦于以下问题:PHP Date::getTimestamp方法的具体用法?PHP Date::getTimestamp怎么用?PHP Date::getTimestamp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Date
的用法示例。
在下文中一共展示了Date::getTimestamp方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCacheId
private function getCacheId()
{
$end = '';
if ($this->defaultEndDate) {
$end = $this->defaultEndDate->getTimestamp();
}
$today = $this->today->getTimestamp();
return 'range' . $this->strPeriod . $this->strDate . $this->timezone . $end . $today;
}
示例2: setUp
public function setUp()
{
$firstFixture = array_shift($this->fixtures);
$this->setUpFixture($firstFixture);
$initialSitesProperties = SitesManagerAPI::getInstance()->getAllSites();
foreach ($this->fixtures as $fixture) {
$this->restoreSitesProperties($initialSitesProperties);
$this->setUpFixture($fixture);
}
Option::set("Tests.forcedNowTimestamp", $this->now->getTimestamp());
}
示例3: compareYear
/**
* Performs three-way comparison of the month of the current date against the given `$date`'s year.
*
* @param \Piwik\Date $date Year to compare
* @return int Returns `0` if the current year is equal to `$date`'s, `-1` if the current year is
* earlier or `1` if the current year is later.
*/
public function compareYear(Date $date)
{
$currentYear = date('Y', $this->getTimestamp());
$toCompareYear = date('Y', $date->getTimestamp());
if ($currentYear == $toCompareYear) {
return 0;
}
if ($currentYear < $toCompareYear) {
return -1;
}
return 1;
}
示例4: getMinTimeProcessedForTemporaryArchive
public static function getMinTimeProcessedForTemporaryArchive(Date $dateStart, \Piwik\Period $period, Segment $segment, Site $site)
{
$now = time();
$minimumArchiveTime = $now - Rules::getTodayArchiveTimeToLive();
$idSites = array($site->getId());
$isArchivingDisabled = Rules::isArchivingDisabledFor($idSites, $segment, $period->getLabel());
if ($isArchivingDisabled) {
if ($period->getNumberOfSubperiods() == 0 && $dateStart->getTimestamp() <= $now) {
// Today: accept any recent enough archive
$minimumArchiveTime = false;
} else {
// This week, this month, this year:
// accept any archive that was processed today after 00:00:01 this morning
$timezone = $site->getTimezone();
$minimumArchiveTime = Date::factory(Date::factory('now', $timezone)->getDateStartUTC())->setTimezone($timezone)->getTimestamp();
}
}
return $minimumArchiveTime;
}
示例5: search
/**
* Returns all annotations within a specific date range. The result is
* an array that maps site IDs with arrays of annotations within the range.
*
* Note: The date range is inclusive.
*
* @see self::get for info on what attributes stored within annotations.
*
* @param Date|bool $startDate The start of the date range.
* @param Date|bool $endDate The end of the date range.
* @param array|bool|int|string $idSite IDs of the sites whose annotations to
* search through.
* @return array Array mapping site IDs with arrays of annotations, eg:
* array(
* '5' => array(
* array(...), // annotation
* array(...), // annotation
* ...
* ),
* '6' => array(
* array(...), // annotation
* array(...), // annotation
* ...
* ),
* )
*/
public function search($startDate, $endDate, $idSite = false)
{
if ($idSite) {
$idSites = Site::getIdSitesFromIdSitesString($idSite);
} else {
$idSites = array_keys($this->annotations);
}
// collect annotations that are within the right date range & belong to the right
// site
$result = array();
foreach ($idSites as $idSite) {
if (!isset($this->annotations[$idSite])) {
continue;
}
foreach ($this->annotations[$idSite] as $idNote => $annotation) {
if ($startDate !== false) {
$annotationDate = Date::factory($annotation['date']);
if ($annotationDate->getTimestamp() < $startDate->getTimestamp() || $annotationDate->getTimestamp() > $endDate->getTimestamp()) {
continue;
}
}
$this->augmentAnnotationData($idSite, $idNote, $annotation);
$result[$idSite][] = $annotation;
}
// sort by annotation date
if (!empty($result[$idSite])) {
uasort($result[$idSite], array($this, 'compareAnnotationDate'));
}
}
return $result;
}