本文整理汇总了PHP中Piwik\Piwik::isUserIsAnonymous方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik::isUserIsAnonymous方法的具体用法?PHP Piwik::isUserIsAnonymous怎么用?PHP Piwik::isUserIsAnonymous使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Piwik
的用法示例。
在下文中一共展示了Piwik::isUserIsAnonymous方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor.
*/
public function __construct($idSite = false)
{
parent::__construct();
$this->jsClass = "SegmentSelectorControl";
$this->cssIdentifier = "segmentEditorPanel";
$this->cssClass = "piwikTopControl";
$this->idSite = $idSite ?: Common::getRequestVar('idSite', false, 'int');
$this->selectedSegment = Common::getRequestVar('segment', false, 'string');
$segments = APIMetadata::getInstance()->getSegmentsMetadata($this->idSite);
$segmentsByCategory = $customVariablesSegments = array();
foreach ($segments as $segment) {
if ($segment['category'] == Piwik::translate('General_Visit') && ($segment['type'] == 'metric' && $segment['segment'] != 'visitIp')) {
$metricsLabel = Piwik::translate('General_Metrics');
$metricsLabel[0] = strtolower($metricsLabel[0]);
$segment['category'] .= ' (' . $metricsLabel . ')';
}
$segmentsByCategory[$segment['category']][] = $segment;
}
uksort($segmentsByCategory, array($this, 'sortSegmentCategories'));
$this->createRealTimeSegmentsIsEnabled = Config::getInstance()->General['enable_create_realtime_segments'];
$this->segmentsByCategory = $segmentsByCategory;
$this->nameOfCurrentSegment = '';
$this->isSegmentNotAppliedBecauseBrowserArchivingIsDisabled = 0;
$this->availableSegments = API::getInstance()->getAll($this->idSite);
foreach ($this->availableSegments as &$savedSegment) {
$savedSegment['name'] = Common::sanitizeInputValue($savedSegment['name']);
if (!empty($this->selectedSegment) && $this->selectedSegment == $savedSegment['definition']) {
$this->nameOfCurrentSegment = $savedSegment['name'];
$this->isSegmentNotAppliedBecauseBrowserArchivingIsDisabled = $this->wouldApplySegment($savedSegment) ? 0 : 1;
}
}
$this->authorizedToCreateSegments = SegmentEditorAPI::getInstance()->isUserCanAddNewSegment($this->idSite);
$this->isUserAnonymous = Piwik::isUserIsAnonymous();
$this->segmentTranslations = $this->getTranslations();
}
示例2: getSelector
public function getSelector()
{
$view = new View('@SegmentEditor/getSelector');
$idSite = Common::getRequestVar('idSite');
$this->setGeneralVariablesView($view);
$segments = APIMetadata::getInstance()->getSegmentsMetadata($idSite);
$segmentsByCategory = $customVariablesSegments = array();
foreach ($segments as $segment) {
if ($segment['category'] == Piwik::translate('General_Visit') && ($segment['type'] == 'metric' && $segment['segment'] != 'visitIp')) {
$metricsLabel = Piwik::translate('General_Metrics');
$metricsLabel[0] = strtolower($metricsLabel[0]);
$segment['category'] .= ' (' . $metricsLabel . ')';
}
$segmentsByCategory[$segment['category']][] = $segment;
}
uksort($segmentsByCategory, array($this, 'sortSegmentCategories'));
$view->segmentsByCategory = $segmentsByCategory;
$savedSegments = API::getInstance()->getAll($idSite);
foreach ($savedSegments as &$savedSegment) {
$savedSegment['name'] = Common::sanitizeInputValue($savedSegment['name']);
}
$view->savedSegmentsJson = Common::json_encode($savedSegments);
$view->authorizedToCreateSegments = !Piwik::isUserIsAnonymous();
$view->segmentTranslations = Common::json_encode($this->getTranslations());
$out = $view->render();
return $out;
}
示例3: configureTopMenu
public function configureTopMenu(MenuTop $menu)
{
$login = Piwik::getCurrentUserLogin();
$user = APIUsersManager::getInstance()->getUser($login);
if (!empty($user['alias'])) {
$login = $user['alias'];
}
if (Plugin\Manager::getInstance()->isPluginActivated('Feedback')) {
$menu->addItem('General_Help', null, array('module' => 'Feedback', 'action' => 'index'));
}
if (Piwik::isUserIsAnonymous()) {
if (Plugin\Manager::getInstance()->isPluginActivated('Feedback')) {
$menu->addItem($login, null, array('module' => 'Feedback', 'action' => 'index'), 998);
} else {
$menu->addItem($login, null, array('module' => 'API', 'action' => 'listAllAPI'), 998);
}
} else {
$menu->addItem($login, null, array('module' => 'UsersManager', 'action' => 'userSettings'), 998);
}
$module = $this->getLoginModule();
if (Piwik::isUserIsAnonymous()) {
$menu->addItem('Login_LogIn', null, array('module' => $module, 'action' => false), 999);
} else {
$menu->addItem('General_Logout', null, array('module' => $module, 'action' => 'logout', 'idSite' => null), 999);
}
}
示例4: configureAdminMenu
public function configureAdminMenu(MenuAdmin $menu)
{
$menu->addPlatformItem('General_API', $this->urlForAction('listAllAPI', array('segment' => false)), 7, Piwik::translate('API_TopLinkTooltip'));
if (Piwik::isUserIsAnonymous()) {
$menu->addPlatformItem('API_Glossary', $this->urlForAction('glossary', array('segment' => false)), 50);
}
}
示例5: configureTopMenu
public function configureTopMenu(MenuTop $menu)
{
$login = Piwik::getCurrentUserLogin();
$user = APIUsersManager::getInstance()->getUser($login);
if (!empty($user['alias'])) {
$login = $user['alias'];
}
if (Plugin\Manager::getInstance()->isPluginActivated('Feedback')) {
$menu->registerMenuIcon('General_Help', 'icon-help');
$menu->addItem('General_Help', null, array('module' => 'Feedback', 'action' => 'index'), $order = 990, Piwik::translate('General_Help'));
}
$menu->registerMenuIcon($login, 'icon-user');
if (Piwik::isUserIsAnonymous()) {
if (Plugin\Manager::getInstance()->isPluginActivated('ScheduledReports')) {
$menu->addItem($login, null, array('module' => 'ScheduledReports', 'action' => 'index'), 970, Piwik::translate('ScheduledReports_PersonalEmailReports'));
} else {
$menu->addItem($login, null, array('module' => 'API', 'action' => 'listAllAPI'), 970, Piwik::translate('API_ReportingApiReference'));
}
} else {
$tooltip = sprintf('%s: %s', Piwik::translate('UsersManager_PersonalSettings'), $login);
$menu->addItem($login, null, array('module' => 'UsersManager', 'action' => 'userSettings'), 970, $tooltip);
}
$module = $this->getLoginModule();
if (Piwik::isUserIsAnonymous()) {
$menu->registerMenuIcon('Login_LogIn', 'icon-sign-in');
$menu->addItem('Login_LogIn', null, array('module' => $module, 'action' => false), 1000, Piwik::translate('Login_LogIn'));
} else {
$menu->registerMenuIcon('General_Logout', 'icon-sign-out');
$menu->addItem('General_Logout', null, array('module' => $module, 'action' => 'logout', 'idSite' => null), 1000, Piwik::translate('General_Logout'));
}
}
示例6: getTopMenuTranslationKey
function getTopMenuTranslationKey()
{
// if MobileMessaging is not activated, display 'Email reports'
if (!\Piwik\Plugin\Manager::getInstance()->isPluginActivated('MobileMessaging')) {
return self::PDF_REPORTS_TOP_MENU_TRANSLATION_KEY;
}
if (Piwik::isUserIsAnonymous()) {
return self::MOBILE_MESSAGING_TOP_MENU_TRANSLATION_KEY;
}
try {
$reports = API::getInstance()->getReports();
$reportCount = count($reports);
// if there are no reports and the mobile account is
// - not configured: display 'Email reports'
// - configured: display 'Email & SMS reports'
if ($reportCount == 0) {
return APIMobileMessaging::getInstance()->areSMSAPICredentialProvided() ? self::MOBILE_MESSAGING_TOP_MENU_TRANSLATION_KEY : self::PDF_REPORTS_TOP_MENU_TRANSLATION_KEY;
}
} catch (\Exception $e) {
return self::PDF_REPORTS_TOP_MENU_TRANSLATION_KEY;
}
$anyMobileReport = false;
foreach ($reports as $report) {
if ($report['type'] == MobileMessaging::MOBILE_TYPE) {
$anyMobileReport = true;
break;
}
}
// if there is at least one sms report, display 'Email & SMS reports'
if ($anyMobileReport) {
return self::MOBILE_MESSAGING_TOP_MENU_TRANSLATION_KEY;
}
return self::PDF_REPORTS_TOP_MENU_TRANSLATION_KEY;
}
示例7: configureAdminMenu
public function configureAdminMenu(MenuAdmin $menu)
{
$hasSuperUserAcess = Piwik::hasUserSuperUserAccess();
$isAnonymous = Piwik::isUserIsAnonymous();
$isMarketplaceEnabled = CorePluginsAdmin::isMarketplaceEnabled();
$pluginsUpdateMessage = '';
$themesUpdateMessage = '';
if ($hasSuperUserAcess && $isMarketplaceEnabled) {
$marketplace = new Marketplace();
$pluginsHavingUpdate = $marketplace->getPluginsHavingUpdate($themesOnly = false);
$themesHavingUpdate = $marketplace->getPluginsHavingUpdate($themesOnly = true);
if (!empty($pluginsHavingUpdate)) {
$pluginsUpdateMessage = sprintf(' (%d)', count($pluginsHavingUpdate));
}
if (!empty($themesHavingUpdate)) {
$themesUpdateMessage = sprintf(' (%d)', count($themesHavingUpdate));
}
}
$menu->add('CorePluginsAdmin_MenuPlatform', null, "", !$isAnonymous, $order = 7);
$menu->add('CorePluginsAdmin_MenuPlatform', Piwik::translate('General_Plugins') . $pluginsUpdateMessage, array('module' => 'CorePluginsAdmin', 'action' => 'plugins', 'activated' => ''), $hasSuperUserAcess, $order = 1);
$menu->add('CorePluginsAdmin_MenuPlatform', Piwik::translate('CorePluginsAdmin_Themes') . $themesUpdateMessage, array('module' => 'CorePluginsAdmin', 'action' => 'themes', 'activated' => ''), $hasSuperUserAcess, $order = 3);
if ($isMarketplaceEnabled) {
$menu->add('CorePluginsAdmin_MenuPlatform', 'CorePluginsAdmin_Marketplace', array('module' => 'CorePluginsAdmin', 'action' => 'extend', 'activated' => ''), !$isAnonymous, $order = 5);
}
}
示例8: configureTopMenu
public function configureTopMenu(MenuTop $menu)
{
if (Piwik::isUserIsAnonymous() || !SettingsPiwik::isPiwikInstalled()) {
$langManager = new LanguagesManager();
$menu->addHtml('LanguageSelector', $langManager->getLanguagesSelector(), true, $order = 30, false);
}
}
示例9: init
public function init()
{
$this->addWidget('Live_VisitorsInRealTime', 'widget');
// the visitor profile uses a segment that is not accessible to the anonymous user, so don't bother showing this widget
if (!Piwik::isUserIsAnonymous()) {
$this->addWidget('Live_VisitorProfile', 'getVisitorProfilePopup');
}
}
示例10: configureUserMenu
public function configureUserMenu(MenuUser $menu)
{
if (!Piwik::isUserIsAnonymous()) {
$menu->addManageItem('CoreAdminHome_TrackingCode', $this->urlForAction('trackingCodeGenerator'), $order = 10);
if (SettingsManager::hasUserPluginsSettingsForCurrentUser()) {
$menu->addPersonalItem('CoreAdminHome_PluginSettings', $this->urlForAction('userPluginSettings'), $order = 15);
}
}
}
示例11: configure
public static function configure(WidgetConfig $config)
{
$config->setCategoryId('General_Visitors');
$config->setName('Live_VisitorProfile');
$config->setOrder(25);
if (Piwik::isUserIsAnonymous()) {
$config->disable();
}
}
示例12: index
public function index()
{
$view = new View('@ScheduledReports/index');
$this->setGeneralVariablesView($view);
$view->countWebsites = count(APISitesManager::getInstance()->getSitesIdWithAtLeastViewAccess());
// get report types
$reportTypes = API::getReportTypes();
$view->reportTypes = $reportTypes;
$view->defaultReportType = self::DEFAULT_REPORT_TYPE;
$view->defaultReportFormat = ScheduledReports::DEFAULT_REPORT_FORMAT;
$view->displayFormats = ScheduledReports::getDisplayFormats();
$reportsByCategoryByType = array();
$reportFormatsByReportType = array();
$allowMultipleReportsByReportType = array();
foreach ($reportTypes as $reportType => $reportTypeIcon) {
// get report formats
$reportFormatsByReportType[$reportType] = API::getReportFormats($reportType);
$allowMultipleReportsByReportType[$reportType] = API::allowMultipleReports($reportType);
// get report metadata
$reportsByCategory = array();
$availableReportMetadata = API::getReportMetadata($this->idSite, $reportType);
foreach ($availableReportMetadata as $reportMetadata) {
$reportsByCategory[$reportMetadata['category']][] = $reportMetadata;
}
$reportsByCategoryByType[$reportType] = $reportsByCategory;
}
$view->reportsByCategoryByReportType = $reportsByCategoryByType;
$view->reportFormatsByReportType = $reportFormatsByReportType;
$view->allowMultipleReportsByReportType = $allowMultipleReportsByReportType;
$reports = array();
$reportsById = array();
if (!Piwik::isUserIsAnonymous()) {
$reports = API::getInstance()->getReports($this->idSite, $period = false, $idReport = false, $ifSuperUserReturnOnlySuperUserReports = true);
foreach ($reports as &$report) {
$report['recipients'] = API::getReportRecipients($report);
$reportsById[$report['idreport']] = $report;
}
}
$view->reports = $reports;
$view->reportsJSON = Common::json_encode($reportsById);
$view->downloadOutputType = API::OUTPUT_INLINE;
$view->periods = ScheduledReports::getPeriodToFrequency();
$view->defaultPeriod = ScheduledReports::DEFAULT_PERIOD;
$view->defaultHour = ScheduledReports::DEFAULT_HOUR;
$view->language = LanguagesManager::getLanguageCodeForCurrentUser();
$view->segmentEditorActivated = false;
if (API::isSegmentEditorActivated()) {
$savedSegmentsById = array();
foreach (APISegmentEditor::getInstance()->getAll($this->idSite) as $savedSegment) {
$savedSegmentsById[$savedSegment['idsegment']] = $savedSegment['name'];
}
$view->savedSegmentsById = $savedSegmentsById;
$view->segmentEditorActivated = true;
}
return $view->render();
}
示例13: configureTopMenu
public function configureTopMenu(MenuTop $menu)
{
$module = $this->getLoginModule();
if (Piwik::isUserIsAnonymous()) {
$menu->registerMenuIcon('Login_LogIn', 'icon-sign-in');
$menu->addItem('Login_LogIn', null, array('module' => $module, 'action' => false), 1000, Piwik::translate('Login_LogIn'));
} else {
$menu->registerMenuIcon('General_Logout', 'icon-sign-out');
$menu->addItem('General_Logout', null, array('module' => $module, 'action' => 'logout', 'idSite' => null), 1000, Piwik::translate('General_Logout'));
}
}
示例14: getClientVisitCustomVariables
public function getClientVisitCustomVariables()
{
if (Piwik::hasUserSuperUserAccess()) {
$access = 'superuser';
} elseif (Piwik::isUserIsAnonymous()) {
$access = 'anonymous';
} else {
// I do not check between view/admin as it could trigger slow DB queries to fetch sites with access
$access = 'user';
}
return array(array('id' => 1, 'name' => 'Access', 'value' => $access));
}
示例15: configureReportingMenu
public function configureReportingMenu(MenuReporting $menu)
{
$menu->addItem('Dashboard_Dashboard', '', $this->urlForAction('embeddedIndex', array('idDashboard' => 1)), 5);
if (!Piwik::isUserIsAnonymous()) {
$login = Piwik::getCurrentUserLogin();
$dashboard = new Dashboard();
$dashboards = $dashboard->getAllDashboards($login);
$pos = 0;
foreach ($dashboards as $dashboard) {
$menu->addItem('Dashboard_Dashboard', $dashboard['name'], $this->urlForAction('embeddedIndex', array('idDashboard' => $dashboard['iddashboard'])), $pos);
$pos++;
}
}
}