当前位置: 首页>>代码示例>>PHP>>正文


PHP Piwik::getCurrentUserLogin方法代码示例

本文整理汇总了PHP中Piwik\Piwik::getCurrentUserLogin方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik::getCurrentUserLogin方法的具体用法?PHP Piwik::getCurrentUserLogin怎么用?PHP Piwik::getCurrentUserLogin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Piwik\Piwik的用法示例。


在下文中一共展示了Piwik::getCurrentUserLogin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($username)
 {
     $this->username = $username;
     $this->title = 'Piwik - ' . Url::getCurrentHost();
     $this->description = Piwik::getCurrentUserLogin();
     $this->load();
 }
开发者ID:sgiehl,项目名称:piwik-plugin-GoogleAuthenticator,代码行数:7,代码来源:Storage.php

示例2: 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'));
     }
 }
开发者ID:dorelljames,项目名称:piwik,代码行数:31,代码来源:Menu.php

示例3: recordUserSettings

 /**
  * Checks if the provided CURRENT password is correct and calls the parent
  * class function if so. Otherwise provides error message.
  *
  * @see the parent class function for parameters and return value
  */
 public function recordUserSettings()
 {
     try {
         $passwordCurrent = Common::getRequestvar('passwordCurrent', false);
         $passwordCurrent = Crypto::decrypt($passwordCurrent);
         // Note: Compare loosely, so both, "" (password input empty; forms send strings)
         //       and "password input not sent" are covered - see
         //       https://secure.php.net/manual/en/types.comparisons.php
         if ($passwordCurrent != "") {
             $userName = Piwik::getCurrentUserLogin();
             // gets username as string or "anonymous"
             // see Piwik\Plugins\Login\Auth for used password hash function
             // (in setPassword()) and access to hashed password (in getTokenAuthSecret())
             if ($userName != 'anonymous') {
                 $model = new Model();
                 $user = $model->getUser($userName);
                 if (UsersManagerEncrypted::getPasswordHash($passwordCurrent) === $user['password']) {
                     $toReturn = parent::recordUserSettings();
                 } else {
                     throw new Exception(Piwik::translate('UsersManagerEncrypted_CurrentPasswordIncorrect'));
                 }
             } else {
                 throw new Exception(Piwik::translate('UsersManagerEncrypted_UserNotAuthenticated'));
             }
         } else {
             throw new Exception(Piwik::translate('UsersManagerEncrypted_CurrentPasswordNotProvided'));
         }
     } catch (Exception $e) {
         $response = new ResponseBuilder(Common::getRequestVar('format'));
         $toReturn = $response->getResponseException($e);
     }
     return $toReturn;
 }
开发者ID:Joey3000,项目名称:piwik-UsersManagerEncrypted,代码行数:39,代码来源:Controller.php

示例4: 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);
     }
 }
开发者ID:CaptainSharf,项目名称:SSAD_Project,代码行数:26,代码来源:Menu.php

示例5: makeSetting

 /**
  * Creates a new user setting.
  *
  * Settings will be displayed in the UI depending on the order of `makeSetting` calls. This means you can define
  * the order of the displayed settings by calling makeSetting first for more important settings.
  *
  * @param string $name         The name of the setting that shall be created
  * @param mixed  $defaultValue The default value for this setting. Note the value will not be converted to the
  *                             specified type.
  * @param string $type         The PHP internal type the value of this setting should have.
  *                             Use one of FieldConfig::TYPE_* constancts
  * @param \Closure $fieldConfigCallback   A callback method to configure the field that shall be displayed in the
  *                             UI to define the value for this setting
  * @return UserSetting   Returns an instance of the created measurable setting.
  */
 protected function makeSetting($name, $defaultValue, $type, $configureCallback)
 {
     $userLogin = Piwik::getCurrentUserLogin();
     $setting = new UserSetting($name, $defaultValue, $type, $this->pluginName, $userLogin);
     $setting->setConfigureCallback($configureCallback);
     $this->addSetting($setting);
     return $setting;
 }
开发者ID:piwik,项目名称:piwik,代码行数:23,代码来源:UserSettings.php

示例6: getUserDashboards

 /**
  * Get all dashboards which a user has created.
  * @return \array[]
  */
 private function getUserDashboards()
 {
     $userLogin = Piwik::getCurrentUserLogin();
     $userDashboards = $this->dashboard->getAllDashboards($userLogin);
     $dashboards = array();
     foreach ($userDashboards as $userDashboard) {
         $widgets = $this->getVisibleWidgetsWithinDashboard($userDashboard);
         $dashboards[] = $this->buildDashboard($userDashboard, $widgets);
     }
     return $dashboards;
 }
开发者ID:piwik,项目名称:piwik,代码行数:15,代码来源:API.php

示例7: getUserDashboards

 /**
  * Get all dashboards which a user has created.
  *
  * @return array[]
  */
 private function getUserDashboards()
 {
     $userLogin = Piwik::getCurrentUserLogin();
     $userDashboards = $this->dashboard->getAllDashboards($userLogin);
     $dashboards = array();
     foreach ($userDashboards as $userDashboard) {
         if ($this->hasDashboardColumns($userDashboard)) {
             $widgets = $this->getExistingWidgetsWithinDashboard($userDashboard);
             $dashboards[] = $this->buildDashboard($userDashboard, $widgets);
         }
     }
     return $dashboards;
 }
开发者ID:a4tunado,项目名称:piwik,代码行数:18,代码来源:API.php

示例8: getDefaultPeriod

 /**
  * Returns default period type for Piwik reports.
  *
  * @return string `'day'`, `'week'`, `'month'`, `'year'` or `'range'`
  * @api
  */
 public function getDefaultPeriod()
 {
     $userSettingsDate = APIUsersManager::getInstance()->getUserPreference(Piwik::getCurrentUserLogin(), APIUsersManager::PREFERENCE_DEFAULT_REPORT_DATE);
     if ($userSettingsDate === false) {
         return Config::getInstance()->General['default_period'];
     }
     if (in_array($userSettingsDate, array('today', 'yesterday'))) {
         return 'day';
     }
     if (strpos($userSettingsDate, 'last') === 0 || strpos($userSettingsDate, 'previous') === 0) {
         return 'range';
     }
     return $userSettingsDate;
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:20,代码来源:UserPreferences.php

示例9: 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++;
         }
     }
 }
开发者ID:a4tunado,项目名称:piwik,代码行数:14,代码来源:Menu.php

示例10: configureReportingMenu

 public function configureReportingMenu(MenuReporting $menu)
 {
     $menu->add('Dashboard_Dashboard', '', array('module' => 'Dashboard', 'action' => 'embeddedIndex', 'idDashboard' => 1), true, 5);
     if (!Piwik::isUserIsAnonymous()) {
         $login = Piwik::getCurrentUserLogin();
         $dashboard = new Dashboard();
         $dashboards = $dashboard->getAllDashboards($login);
         $pos = 0;
         foreach ($dashboards as $dashboard) {
             $menu->add('Dashboard_Dashboard', $dashboard['name'], array('module' => 'Dashboard', 'action' => 'embeddedIndex', 'idDashboard' => $dashboard['iddashboard']), true, $pos);
             $pos++;
         }
     }
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:14,代码来源:Menu.php

示例11: createAlert

 private function createAlert($name, $period, $idSites, $metric, $report, $login = false)
 {
     if (false === $login) {
         $login = Piwik::getCurrentUserLogin();
     }
     $emails = array('test1@example.com', 'test2@example.com');
     $phoneNumbers = array('0123456789');
     $reportMatched = '';
     if ('VisitsSummary_get' != $report) {
         $reportMatched = 'Piwik';
     }
     $model = new Model();
     $model->createAlert($name, $idSites, $login, $period, 0, $emails, $phoneNumbers, $metric, 'less_than', 5, $comparedTo = 1, $report, 'matches_exactly', $reportMatched);
 }
开发者ID:andrzejewsky,项目名称:plugin-CustomAlerts,代码行数:14,代码来源:CustomAlerts.php

示例12: redirectToCoreHomeIndex

 function redirectToCoreHomeIndex()
 {
     $defaultReport = API::getInstance()->getUserPreference(Piwik::getCurrentUserLogin(), API::PREFERENCE_DEFAULT_REPORT);
     $module = 'CoreHome';
     $action = 'index';
     // User preference: default report to load is the All Websites dashboard
     if ($defaultReport == 'MultiSites' && \Piwik\Plugin\Manager::getInstance()->isPluginActivated('MultiSites')) {
         $module = 'MultiSites';
     }
     if ($defaultReport == Piwik::getLoginPluginName()) {
         $module = Piwik::getLoginPluginName();
     }
     $idSite = Common::getRequestVar('idSite', false, 'int');
     parent::redirectToIndex($module, $action, $idSite);
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:15,代码来源:Controller.php

示例13: buildUserSettingName

 private function buildUserSettingName($name, $userLogin = null)
 {
     if (empty($userLogin)) {
         $userLogin = Piwik::getCurrentUserLogin();
     }
     // the asterisk tag is indeed important here and better than an underscore. Imagine a plugin has the settings
     // "api_password" and "api". A user having the login "_password" could otherwise under circumstances change the
     // setting for "api" although he is not allowed to. It is not so important at the moment because only alNum is
     // currently allowed as a name this might change in the future.
     $appendix = '#' . $userLogin . '#';
     if (Common::stringEndsWith($name, $appendix)) {
         return $name;
     }
     return $name . $appendix;
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:15,代码来源:UserSetting.php

示例14: saveLanguage

 /**
  * anonymous = in the session
  * authenticated user = in the session and in DB
  */
 public function saveLanguage()
 {
     $language = Common::getRequestVar('language');
     // Prevent CSRF only when piwik is not installed yet (During install user can change language)
     if (DbHelper::isInstalled()) {
         $this->checkTokenInUrl();
     }
     LanguagesManager::setLanguageForSession($language);
     if (\Piwik\Registry::isRegistered('access')) {
         $currentUser = Piwik::getCurrentUserLogin();
         if ($currentUser && $currentUser !== 'anonymous') {
             API::getInstance()->setLanguageForUser($currentUser, $language);
         }
     }
     Url::redirectToReferrer();
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:20,代码来源:Controller.php

示例15: addPiwikClientTracking

 public function addPiwikClientTracking(&$out)
 {
     $settings = StaticContainer::get('Piwik\\Plugins\\AnonymousPiwikUsageMeasurement\\Settings');
     $config = array('targets' => array(), 'visitorCustomVariables' => array(), 'trackingDomain' => self::TRACKING_DOMAIN, 'exampleDomain' => self::EXAMPLE_DOMAIN, 'userId' => Piwik::getCurrentUserLogin());
     if (Piwik::isUserIsAnonymous() || !$settings->canUserOptOut->getValue() || !$settings->userTrackingEnabled->isReadableByCurrentUser() || $settings->userTrackingEnabled->getValue()) {
         // an anonymous user is currently always tracked, an anonymous user would not have permission to read
         // this user setting. The `isUserIsAnonymous()` check is not needed but there to improve performance
         // in case user is anonymous. Then we avoid checking whether user has access to any sites which can be slow
         // a user not having any view permission is also always tracked so far as such a user is not allowed to read
         // this setting
         $targets = StaticContainer::get('Piwik\\Plugins\\AnonymousPiwikUsageMeasurement\\Tracker\\Targets');
         $customVars = StaticContainer::get('Piwik\\Plugins\\AnonymousPiwikUsageMeasurement\\Tracker\\CustomVariables');
         $config['targets'] = $targets->getTargets();
         $config['visitorCustomVariables'] = $customVars->getClientVisitCustomVariables();
     }
     $out .= "\nvar piwikUsageTracking = " . json_encode($config) . ";\n";
 }
开发者ID:andrzejewsky,项目名称:plugin-AnonymousPiwikUsageMeasurement,代码行数:17,代码来源:AnonymousPiwikUsageMeasurement.php


注:本文中的Piwik\Piwik::getCurrentUserLogin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。