本文整理汇总了PHP中Piwik_Site::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_Site::getId方法的具体用法?PHP Piwik_Site::getId怎么用?PHP Piwik_Site::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik_Site
的用法示例。
在下文中一共展示了Piwik_Site::getId方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
/**
* Builds an array of Piwik_Archive of a given date range
*
* @param Piwik_Site $oSite
* @param string $strPeriod eg. 'day' 'week' etc.
* @param string $strDate A date range, eg. 'last10', 'previous5' or 'YYYY-MM-DD,YYYY-MM-DD'
*/
function __construct(Piwik_Site $oSite, $strPeriod, $strDate, Piwik_Segment $segment)
{
$rangePeriod = new Piwik_Period_Range($strPeriod, $strDate, $oSite->getTimezone());
foreach ($rangePeriod->getSubperiods() as $subPeriod) {
$startDate = $subPeriod->getDateStart();
$archive = Piwik_Archive::build($oSite->getId(), $strPeriod, $startDate, $segment->getString());
$archive->setSegment($segment);
$this->archives[] = $archive;
}
}
示例2: foreach
/**
* Builds an array of Piwik_Archive of a given date range
*
* @param Piwik_Site $oSite
* @param string $strPeriod eg. 'day' 'week' etc.
* @param string $strDate A date range, eg. 'last10', 'previous5' or 'YYYY-MM-DD,YYYY-MM-DD'
*/
function __construct(Piwik_Site $oSite, $strPeriod, $strDate)
{
$rangePeriod = new Piwik_Period_Range($strPeriod, $strDate);
foreach ($rangePeriod->getSubperiods() as $subPeriod) {
$startDate = $subPeriod->getDateStart();
$archive = Piwik_Archive::build($oSite->getId(), $strPeriod, $startDate);
$archive->prepareArchive();
$timestamp = $archive->getTimestampStartDate();
$this->archives[$timestamp] = $archive;
}
ksort($this->archives);
}
示例3: loadArchiveProperties
/**
* Inits the object
*/
protected function loadArchiveProperties()
{
$this->idsite = $this->site->getId();
$this->periodId = $this->period->getId();
$this->dateStart = $this->period->getDateStart();
$this->dateEnd = $this->period->getDateEnd();
$this->tableArchiveNumeric = new Piwik_TablePartitioning_Monthly('archive_numeric');
$this->tableArchiveNumeric->setIdSite($this->idsite);
$this->tableArchiveNumeric->setTimestamp($this->dateStart->get());
$this->tableArchiveBlob = new Piwik_TablePartitioning_Monthly('archive_blob');
$this->tableArchiveBlob->setIdSite($this->idsite);
$this->tableArchiveBlob->setTimestamp($this->dateStart->get());
$this->strDateStart = $this->dateStart->toString();
$this->strDateEnd = $this->dateEnd->toString();
// if the current archive is a DAY and if it's today,
// we set this maxTimestampArchive that defines the lifetime value of today's archive
$this->maxTimestampArchive = 0;
if ($this->period->getNumberOfSubperiods() == 0 && $this->period->toString() == date("Y-m-d")) {
$this->maxTimestampArchive = time() - Zend_Registry::get('config')->General->time_before_today_archive_considered_outdated;
$browserArchivingEnabled = Zend_Registry::get('config')->General->enable_browser_archiving_triggering;
// see #1150; if new archives are not triggered from the browser,
// we still want to try and return the latest archive available for today (rather than return nothing)
if (!$browserArchivingEnabled) {
$this->maxTimestampArchive = 0;
}
} else {
if ($this->period->isFinished()) {
$this->maxTimestampArchive = $this->period->getDateEnd()->setTime('00:00:00')->addDay(1)->getTimestamp();
} else {
$this->maxTimestampArchive = Piwik_Date::today()->getTimestamp();
}
}
$db = Zend_Registry::get('db');
$this->compressBlob = $db->hasBlobDataType();
}
示例4: getIdSite
/**
* Returns the Id site associated with this archive
*
* @return int
*/
public function getIdSite()
{
return $this->site->getId();
}
示例5: loadArchiveProperties
/**
* Inits the object
*
* @return void
*/
protected function loadArchiveProperties()
{
$this->idsite = $this->site->getId();
$this->periodId = $this->period->getId();
$this->dateStart = $this->period->getDateStart();
$this->dateEnd = $this->period->getDateEnd();
$this->tableArchiveNumeric = new Piwik_TablePartitioning_Monthly('archive_numeric');
$this->tableArchiveNumeric->setIdSite($this->idsite);
$this->tableArchiveNumeric->setTimestamp($this->dateStart->get());
$this->tableArchiveBlob = new Piwik_TablePartitioning_Monthly('archive_blob');
$this->tableArchiveBlob->setIdSite($this->idsite);
$this->tableArchiveBlob->setTimestamp($this->dateStart->get());
$this->strDateStart = $this->dateStart->toString();
$this->strDateEnd = $this->dateEnd->toString();
// if the current archive is a DAY and if it's today,
// we set this maxTimestampArchive that defines the lifetime value of today's archive
$this->maxTimestampArchive = 0;
if ($this->period->getNumberOfSubperiods() == 0 && $this->period->toString() == date("Y-m-d")) {
$this->maxTimestampArchive = time() - Zend_Registry::get('config')->General->time_before_today_archive_considered_outdated;
} else {
if ($this->period->isFinished()) {
$this->maxTimestampArchive = $this->period->getDateEnd()->setTime('00:00:00')->addDay(1)->getTimestamp();
} else {
$this->maxTimestampArchive = Piwik_Date::today()->getTimestamp();
}
}
}
示例6: init
/**
* Sets object attributes that will be used throughout the process
*/
public function init()
{
$this->idsite = $this->site->getId();
$this->periodId = $this->period->getId();
$dateStartLocalTimezone = $this->period->getDateStart();
$dateEndLocalTimezone = $this->period->getDateEnd();
$this->tableArchiveNumeric = self::makeNumericArchiveTable($this->period);
$this->tableArchiveBlob = self::makeBlobArchiveTable($this->period);
$dateStartUTC = $dateStartLocalTimezone->setTimezone($this->site->getTimezone());
$dateEndUTC = $dateEndLocalTimezone->setTimezone($this->site->getTimezone());
$this->startDatetimeUTC = $dateStartUTC->getDateStartUTC();
$this->endDatetimeUTC = $dateEndUTC->getDateEndUTC();
$this->startTimestampUTC = $dateStartUTC->getTimestamp();
$this->endTimestampUTC = strtotime($this->endDatetimeUTC);
$this->minDatetimeArchiveProcessedUTC = $this->getMinTimeArchivedProcessed();
$db = Zend_Registry::get('db');
$this->compressBlob = $db->hasBlobDataType();
}
示例7: loadArchiveProperties
/**
* Inits the object
*/
protected function loadArchiveProperties()
{
$this->idsite = $this->site->getId();
$this->periodId = $this->period->getId();
$this->dateStart = $this->period->getDateStart();
$this->dateEnd = $this->period->getDateEnd();
$this->tableArchiveNumeric = new Piwik_TablePartitioning_Monthly('archive_numeric');
$this->tableArchiveNumeric->setIdSite($this->idsite);
$this->tableArchiveNumeric->setTimestamp($this->dateStart->get());
$this->tableArchiveBlob = new Piwik_TablePartitioning_Monthly('archive_blob');
$this->tableArchiveBlob->setIdSite($this->idsite);
$this->tableArchiveBlob->setTimestamp($this->dateStart->get());
$this->strDateStart = $this->dateStart->toString();
$this->strDateEnd = $this->dateEnd->toString();
// if the current archive is a DAY and if it's today,
// we set this maxTimestampArchive that defines the lifetime value of today's archive
$this->maxTimestampArchive = 0;
if( $this->period->getNumberOfSubperiods() == 0
&& $this->period->toString() == date("Y-m-d")
)
{
$this->maxTimestampArchive = time() - Zend_Registry::get('config')->General->time_before_today_archive_considered_outdated;
}
// either
// - if the period we're looking for is finished, we look for a ts_archived that
// is greater than the last day of the archive
// - if the period we're looking for is not finished, we look for a recent enough archive
// recent enough means maxTimestampArchive = 00:00:01 this morning
else
{
if($this->period->isFinished())
{
$this->maxTimestampArchive = $this->period->getDateEnd()->setTime('00:00:00')->addDay(1)->getTimestamp();
}
else
{
$this->maxTimestampArchive = Piwik_Date::today()->getTimestamp();
}
}
$db = Zend_Registry::get('db');
$this->compressBlob = $db->hasBlobDataType();
}
示例8: init
/**
* Sets object attributes that will be used throughout the process
*/
public function init()
{
$this->idsite = $this->site->getId();
$this->periodId = $this->period->getId();
$dateStartLocalTimezone = $this->period->getDateStart();
$dateEndLocalTimezone = $this->period->getDateEnd();
$this->tableArchiveNumeric = new Piwik_TablePartitioning_Monthly('archive_numeric');
$this->tableArchiveNumeric->setIdSite($this->idsite);
$this->tableArchiveNumeric->setTimestamp($dateStartLocalTimezone->getTimestamp());
$this->tableArchiveBlob = new Piwik_TablePartitioning_Monthly('archive_blob');
$this->tableArchiveBlob->setIdSite($this->idsite);
$this->tableArchiveBlob->setTimestamp($dateStartLocalTimezone->getTimestamp());
$dateStartUTC = $dateStartLocalTimezone->setTimezone($this->site->getTimezone());
$dateEndUTC = $dateEndLocalTimezone->setTimezone($this->site->getTimezone());
$this->startDatetimeUTC = $dateStartUTC->getDateStartUTC();
$this->endDatetimeUTC = $dateEndUTC->getDateEndUTC();
$this->startTimestampUTC = $dateStartUTC->getTimestamp();
$this->endTimestampUTC = strtotime($this->endDatetimeUTC);
$this->minDatetimeArchiveProcessedUTC = $this->getMinTimeArchivedProcessed();
$db = Zend_Registry::get('db');
$this->compressBlob = $db->hasBlobDataType();
}
示例9: initForLiveUsage
/**
* The archive processing classes have features that might be useful for live querying;
* In particular, Piwik_ArchiveProcessing_Day::query*. In order to reuse those methods
* outside the actual archiving or to reuse archiving code for live querying, an instance
* of archive processing has to be faked.
*
* For example, this code can be used in an API method:
* $archiveProcessing = new Piwik_ArchiveProcessing_Day();
* $archiveProcessing->setSite(new Piwik_Site($idSite));
* $archiveProcessing->setPeriod(Piwik_Period::advancedFactory($period, $date));
* $archiveProcessing->setSegment(new Piwik_Segment($segment, $idSite));
* $archiveProcessing->initForLiveUsage();
* Then, either use $archiveProcessing->query* or pass the instance to the archiving
* code of the plugin. Note that even though we use Piwik_ArchiveProcessing_Day, this
* works for any $period and $date that has been passed to the API.
*/
public function initForLiveUsage()
{
$this->idsite = $this->site->getId();
$this->initDates();
}