本文整理汇总了PHP中Piwik::getWebsitesCountToDisplay方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik::getWebsitesCountToDisplay方法的具体用法?PHP Piwik::getWebsitesCountToDisplay怎么用?PHP Piwik::getWebsitesCountToDisplay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik
的用法示例。
在下文中一共展示了Piwik::getWebsitesCountToDisplay方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Renders the current view.
*
* @return string Generated template
*/
public function render()
{
try {
$this->currentModule = Piwik::getModule();
$this->currentAction = Piwik::getAction();
$userLogin = Piwik::getCurrentUserLogin();
$this->userLogin = $userLogin;
// workaround for #1331
$count = method_exists('Piwik', 'getWebsitesCountToDisplay') ? Piwik::getWebsitesCountToDisplay() : 1;
$sites = Piwik_SitesManager_API::getInstance()->getSitesWithAtLeastViewAccess($count);
usort($sites, create_function('$site1, $site2', 'return strcasecmp($site1["name"], $site2["name"]);'));
$this->sites = $sites;
$this->url = Piwik_Common::sanitizeInputValue(Piwik_Url::getCurrentUrl());
$this->token_auth = Piwik::getCurrentUserTokenAuth();
$this->userHasSomeAdminAccess = Piwik::isUserHasSomeAdminAccess();
$this->userIsSuperUser = Piwik::isUserIsSuperUser();
$this->latest_version_available = Piwik_UpdateCheck::isNewestVersionAvailable();
$this->disableLink = Piwik_Common::getRequestVar('disableLink', 0, 'int');
$this->isWidget = Piwik_Common::getRequestVar('widget', 0, 'int');
if (Zend_Registry::get('config')->General->autocomplete_min_sites <= count($sites)) {
$this->show_autocompleter = true;
} else {
$this->show_autocompleter = false;
}
// workaround for #1331
$this->loginModule = method_exists('Piwik', 'getLoginPluginName') ? Piwik::getLoginPluginName() : 'Login';
$user = Piwik_UsersManager_API::getInstance()->getUser($userLogin);
$this->userAlias = $user['alias'];
} catch (Exception $e) {
// can fail, for example at installation (no plugin loaded yet)
}
$this->totalTimeGeneration = Zend_Registry::get('timer')->getTime();
try {
$this->totalNumberOfQueries = Piwik::getQueryCount();
} catch (Exception $e) {
$this->totalNumberOfQueries = 0;
}
// workaround for #1331
if (method_exists('Piwik', 'overrideCacheControlHeaders')) {
Piwik::overrideCacheControlHeaders('no-store');
}
@header('Content-Type: ' . $this->contentType);
if ($this->xFrameOptions) {
@header('X-Frame-Options: ' . $this->xFrameOptions);
}
return $this->smarty->fetch($this->template);
}
示例2: render
/**
* Renders the current view.
*
* @return string Generated template
*/
public function render()
{
try {
$this->currentModule = Piwik::getModule();
$this->currentAction = Piwik::getAction();
$userLogin = Piwik::getCurrentUserLogin();
$this->userLogin = $userLogin;
$count = Piwik::getWebsitesCountToDisplay();
$sites = Piwik_SitesManager_API::getInstance()->getSitesWithAtLeastViewAccess($count);
usort($sites, create_function('$site1, $site2', 'return strcasecmp($site1["name"], $site2["name"]);'));
$this->sites = $sites;
$this->url = Piwik_Common::sanitizeInputValue(Piwik_Url::getCurrentUrl());
$this->token_auth = Piwik::getCurrentUserTokenAuth();
$this->userHasSomeAdminAccess = Piwik::isUserHasSomeAdminAccess();
$this->userIsSuperUser = Piwik::isUserIsSuperUser();
$this->latest_version_available = Piwik_UpdateCheck::isNewestVersionAvailable();
$this->disableLink = Piwik_Common::getRequestVar('disableLink', 0, 'int');
$this->isWidget = Piwik_Common::getRequestVar('widget', 0, 'int');
if (Piwik_Config::getInstance()->General['autocomplete_min_sites'] <= count($sites)) {
$this->show_autocompleter = true;
} else {
$this->show_autocompleter = false;
}
$this->loginModule = Piwik::getLoginPluginName();
$user = Piwik_UsersManager_API::getInstance()->getUser($userLogin);
$this->userAlias = $user['alias'];
} catch (Exception $e) {
// can fail, for example at installation (no plugin loaded yet)
}
$this->totalTimeGeneration = Zend_Registry::get('timer')->getTime();
try {
$this->totalNumberOfQueries = Piwik::getQueryCount();
} catch (Exception $e) {
$this->totalNumberOfQueries = 0;
}
Piwik::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->smarty->fetch($this->template);
}
示例3: getPatternMatchSites
public function getPatternMatchSites($pattern)
{
$ids = $this->getSitesIdWithAtLeastViewAccess();
$ids_str = '';
foreach($ids as $id_num => $id_val)
{
$ids_str .= $id_val.' , ';
}
$ids_str .= $id_val;
$db = Zend_Registry::get('db');
$bind = array('%'.$pattern.'%', 'http%'.$pattern.'%');
// Also match the idsite
$where = '';
if(is_numeric($pattern))
{
$bind[] = $pattern;
$where = 'OR s.idsite = ?';
}
$sites = $db->fetchAll("SELECT idsite, name, main_url
FROM ".Piwik_Common::prefixTable('site')." s
WHERE ( s.name like ?
OR s.main_url like ?
$where )
AND idsite in ($ids_str)
LIMIT ".Piwik::getWebsitesCountToDisplay(),
$bind) ;
return $sites;
}
示例4: getPatternMatchSites
public function getPatternMatchSites($pattern)
{
$ids = $this->getSitesIdWithAtLeastViewAccess();
$ids_str = '';
foreach ($ids as $id_num => $id_val) {
$ids_str .= $id_val . ' , ';
}
$ids_str .= $id_val;
$db = Zend_Registry::get('db');
$bind = array('%' . $pattern . '%', 'http%' . $pattern . '%');
$sites = $db->fetchAll("SELECT idsite, name, main_url \n\t\t\t\t\t\t\t\tFROM " . Piwik_Common::prefixTable('site') . " s\t\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\tAND idsite in ({$ids_str}) \n\t\t\t\t\t\t\t\tLIMIT " . Piwik::getWebsitesCountToDisplay(), $bind);
return $sites;
}