本文整理汇总了PHP中Piwik\Site::setSitesFromArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Site::setSitesFromArray方法的具体用法?PHP Site::setSitesFromArray怎么用?PHP Site::setSitesFromArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Site
的用法示例。
在下文中一共展示了Site::setSitesFromArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSitesFromIds
/**
* Returns the list of websites from the ID array in parameters.
* The user access is not checked in this method so the ID have to be accessible by the user!
*
* @param array $idSites list of website ID
* @param bool $limit
* @return array
*/
private function getSitesFromIds($idSites, $limit = false)
{
if (count($idSites) === 0) {
return array();
}
if ($limit) {
$limit = "LIMIT " . (int) $limit;
}
$db = Db::get();
$sites = $db->fetchAll("SELECT *\n\t\t\t\t\t\t\t\tFROM " . Common::prefixTable("site") . "\n\t\t\t\t\t\t\t\tWHERE idsite IN (" . implode(", ", $idSites) . ")\n\t\t\t\t\t\t\t\tORDER BY idsite ASC {$limit}");
Site::setSitesFromArray($sites);
return $sites;
}
示例2: getSitesFromIds
/**
* Returns the list of websites from the ID array in parameters.
* The user access is not checked in this method so the ID have to be accessible by the user!
*
* @param array $idSites list of website ID
* @param bool $limit
* @return array
*/
private function getSitesFromIds($idSites, $limit = false)
{
$sites = $this->getModel()->getSitesFromIds($idSites, $limit);
Site::setSitesFromArray($sites);
return $sites;
}
示例3: getSitesIdFromPattern
/**
* Fetches the list of sites which names match the string pattern
*
* @param string $pattern
* @param bool $_restrictSitesToLogin
* @return array|string
*/
private function getSitesIdFromPattern($pattern, $_restrictSitesToLogin)
{
// First clear cache
Site::clearCache();
if (empty($pattern)) {
/** @var Scheduler $scheduler */
$scheduler = StaticContainer::getContainer()->get('Piwik\\Scheduler\\Scheduler');
// Then, warm the cache with only the data we should have access to
if (Piwik::hasUserSuperUserAccess() && !$scheduler->isRunningTask()) {
APISitesManager::getInstance()->getAllSites();
} else {
APISitesManager::getInstance()->getSitesWithAtLeastViewAccess($limit = false, $_restrictSitesToLogin);
}
} else {
$sites = Request::processRequest('SitesManager.getPatternMatchSites', array('pattern' => $pattern, 'showColumns' => '', 'hideColumns' => '', 'serialize' => 0, 'format' => 'original'));
if (!empty($sites)) {
$idSites = array();
foreach ($sites as $site) {
$idSites[] = $site['idsite'];
}
$model = new ModelSitesManager();
$sites = $model->getSitesFromIds($idSites);
// getPatternMatchSites does not return all sites information...
Site::setSitesFromArray($sites);
}
}
// Both calls above have called Site::setSitesFromArray. We now get these sites:
$sitesToProblablyAdd = Site::getSites();
return $sitesToProblablyAdd;
}