本文整理汇总了PHP中Piwik\SettingsPiwik::getWebsitesCountToDisplay方法的典型用法代码示例。如果您正苦于以下问题:PHP SettingsPiwik::getWebsitesCountToDisplay方法的具体用法?PHP SettingsPiwik::getWebsitesCountToDisplay怎么用?PHP SettingsPiwik::getWebsitesCountToDisplay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\SettingsPiwik
的用法示例。
在下文中一共展示了SettingsPiwik::getWebsitesCountToDisplay方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPatternMatchSites
public function getPatternMatchSites($pattern)
{
$ids = $this->getSitesIdWithAtLeastViewAccess();
if (empty($ids)) {
return array();
}
$ids_str = '';
foreach ($ids as $id_val) {
$ids_str .= $id_val . ' , ';
}
$ids_str .= $id_val;
$db = Db::get();
$bind = array('%' . $pattern . '%', 'http%' . $pattern . '%', '%' . $pattern . '%');
// Also match the idsite
$where = '';
if (is_numeric($pattern)) {
$bind[] = $pattern;
$where = 'OR s.idsite = ?';
}
$sites = $db->fetchAll("SELECT idsite, name, main_url, `group`\n\t\t\t\t\t\t\t\tFROM " . Common::prefixTable('site') . " s\n\t\t\t\t\t\t\t\tWHERE (\t\ts.name like ?\n\t\t\t\t\t\t\t\t\t\tOR \ts.main_url like ?\n\t\t\t\t\t\t\t\t\t\tOR \ts.`group` like ?\n\t\t\t\t\t\t\t\t\t\t {$where} )\n\t\t\t\t\t\t\t\t\tAND idsite in ({$ids_str})\n\t\t\t\t\t\t\t\tLIMIT " . SettingsPiwik::getWebsitesCountToDisplay(), $bind);
return $sites;
}
示例2: getPatternMatchSites
public function getPatternMatchSites($pattern)
{
$ids = $this->getSitesIdWithAtLeastViewAccess();
if (empty($ids)) {
return array();
}
$limit = SettingsPiwik::getWebsitesCountToDisplay();
$sites = $this->getModel()->getPatternMatchSites($ids, $pattern, $limit);
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, 'limit' => SettingsPiwik::getWebsitesCountToDisplay(), 'showColumns' => '', 'hideColumns' => '', 'format' => 'original'));
if (!empty($sites)) {
Site::setSitesFromArray($sites);
}
}
// Both calls above have called Site::setSitesFromArray. We now get these sites:
$sitesToProblablyAdd = Site::getSites();
return $sitesToProblablyAdd;
}
示例4: getNumWebsitesToDisplayPerPage
/**
* Returns the number of websites to display per page.
*
* For example this is used in the All Websites Dashboard, in the Website Selector etc. If multiple websites are
* shown somewhere, one should request this method to detect how many websites should be shown per page when
* using paging. To use paging is always recommended since some installations have thousands of websites.
*
* @return int
*/
public function getNumWebsitesToDisplayPerPage()
{
Piwik::checkUserHasSomeViewAccess();
return SettingsPiwik::getWebsitesCountToDisplay();
}
示例5: render
/**
* Renders the current view. Also sends the stored 'Content-Type' HTML header.
* See {@link setContentType()}.
*
* @return string Generated template.
*/
public function render()
{
try {
$this->currentModule = Piwik::getModule();
$this->currentAction = Piwik::getAction();
$userLogin = Piwik::getCurrentUserLogin();
$this->userLogin = $userLogin;
$count = SettingsPiwik::getWebsitesCountToDisplay();
$sites = APISitesManager::getInstance()->getSitesWithAtLeastViewAccess($count);
usort($sites, function ($site1, $site2) {
return strcasecmp($site1["name"], $site2["name"]);
});
$this->sites = $sites;
$this->url = Common::sanitizeInputValue(Url::getCurrentUrl());
$this->token_auth = Piwik::getCurrentUserTokenAuth();
$this->userHasSomeAdminAccess = Piwik::isUserHasSomeAdminAccess();
$this->userIsSuperUser = Piwik::isUserIsSuperUser();
$this->latest_version_available = UpdateCheck::isNewestVersionAvailable();
$this->disableLink = Common::getRequestVar('disableLink', 0, 'int');
$this->isWidget = Common::getRequestVar('widget', 0, 'int');
if (Config::getInstance()->General['autocomplete_min_sites'] <= count($sites)) {
$this->show_autocompleter = true;
} else {
$this->show_autocompleter = false;
}
$this->loginModule = Piwik::getLoginPluginName();
$user = APIUsersManager::getInstance()->getUser($userLogin);
$this->userAlias = $user['alias'];
} catch (Exception $e) {
// can fail, for example at installation (no plugin loaded yet)
}
try {
$this->totalTimeGeneration = Registry::get('timer')->getTime();
$this->totalNumberOfQueries = Profiler::getQueryCount();
} catch (Exception $e) {
$this->totalNumberOfQueries = 0;
}
ProxyHttp::overrideCacheControlHeaders('no-store');
@header('Content-Type: ' . $this->contentType);
// always sending this header, sometimes empty, to ensure that Dashboard embed loads (which could call this header() multiple times, the last one will prevail)
@header('X-Frame-Options: ' . (string) $this->xFrameOptions);
return $this->renderTwigTemplate();
}