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


PHP UserStatus::getCity方法代码示例

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


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

示例1: execute


//.........这里部分代码省略.........
                 $data[$name]['blockedtimestamp'] = wfTimestamp(TS_ISO_8601, $row->ipb_timestamp);
                 $data[$name]['blockreason'] = $row->ipb_reason;
                 $data[$name]['blockexpiry'] = $row->ipb_expiry;
             }
             if (isset($this->prop['emailable'])) {
                 $data[$name]['emailable'] = $user->canReceiveEmail();
             }
             if (isset($this->prop['gender'])) {
                 $gender = $user->getOption('gender');
                 if (strval($gender) === '') {
                     $gender = 'unknown';
                 }
                 $data[$name]['gender'] = $gender;
             }
             if (isset($this->prop['centralids'])) {
                 $data[$name] += ApiQueryUserInfo::getCentralUserInfo($this->getConfig(), $user, $params['attachedwiki']);
             }
             if (isset($this->prop['designation'])) {
                 $data[$name]['designation'] = $huijiUser->getDesignation(false, true);
             }
             if (isset($this->prop['avatar'])) {
                 $data[$name]['avatar'] = array("l" => $huijiUser->getAvatar('l')->getAvatarUrlPath(), "ml" => $huijiUser->getAvatar('ml')->getAvatarUrlPath(), "m" => $huijiUser->getAvatar('m')->getAvatarUrlPath(), "s" => $huijiUser->getAvatar('s')->getAvatarUrlPath());
             }
             if (isset($this->prop['status'])) {
                 $us = new UserStatus($user);
                 $data[$name]['status'] = $us->getStatus();
             }
             if (isset($this->prop['birthday'])) {
                 $us = new UserStatus($user);
                 $data[$name]['birthday'] = $us->getBirthday();
             }
             if (isset($this->prop['city'])) {
                 $us = new UserStatus($user);
                 $data[$name]['city'] = $us->getCity();
             }
             if (isset($this->prop['province'])) {
                 $us = new UserStatus($user);
                 $data[$name]['province'] = $us->getProvince();
             }
             if (isset($this->prop['followingcount'])) {
                 $data[$name]['followingcount'] = $huijiUser->getFollowingUsersCount();
             }
             if (isset($this->prop['followercount'])) {
                 $data[$name]['followercount'] = $huijiUser->getFollowerCount();
             }
             if (isset($this->prop['followingsitescount'])) {
                 $data[$name]['followingsitescount'] = $huijiUser->getFollowingSitesCount();
             }
             if (isset($this->prop['stats'])) {
                 $data[$name]['stats'] = $huijiUser->getStats();
             }
             if (isset($this->prop['level'])) {
                 $data[$name]['level'] = $huijiUser->getLevel()->getLevelNumber();
             }
             if (isset($this->prop['followingsites'])) {
                 $vals['followingsites'] = $huijiUser->getFollowingSites(true);
             }
             if (isset($this->prop['context'])) {
                 if ($this->getUser()->isLoggedIn()) {
                     $data[$name]['context']['followedbyme'] = $huijiUser->isFollowedBy($this->getUser()) ? "true" : "false";
                     $me = HuijiUser::newFromUser($this->getUser());
                     $iAmFollowing = $me->getFollowingUsers();
                     $heIsFollowing = $huijiUser->getFollowingUsers();
                     $bothfollowing = [];
                     if ($heIsFollowing != null) {
                         foreach ($heIsFollowing as $someUser) {
开发者ID:HuijiWiki,项目名称:HuijiMiddleware,代码行数:67,代码来源:ApiQueryHuijiUsers.php

示例2: getProfileTop

    /**
     * Get the header for the social profile page, which includes the user's
     * points and user level (if enabled in the site configuration) and lots
     * more.
     *
     * @param $user_id Integer: user ID
     * @param $user_name String: user name
     */
    function getProfileTop($user_id, $user_name)
    {
        global $wgOut, $wgUser, $wgLang;
        global $wgUserLevels;
        $stats = new UserStats($user_id, $user_name);
        $stats_data = $stats->getUserStats();
        $user_level = new UserLevel($stats_data['points']);
        $level_link = Title::makeTitle(NS_HELP, wfMessage('user-profile-userlevels-link')->inContentLanguage()->text());
        $this->initializeProfileData($user_name);
        $profile_data = $this->profile_data;
        // Variables and other crap
        $page_title = $this->getTitle()->getText();
        $title_parts = explode('/', $page_title);
        $user = $title_parts[0];
        $id = User::idFromName($user);
        $user_safe = urlencode($user);
        // Safe urls
        $add_relationship = SpecialPage::getTitleFor('AddRelationship');
        $remove_relationship = SpecialPage::getTitleFor('RemoveRelationship');
        $give_gift = SpecialPage::getTitleFor('GiveGift');
        $send_board_blast = SpecialPage::getTitleFor('SendBoardBlast');
        $update_profile = SpecialPage::getTitleFor('UpdateProfile');
        $watchlist = SpecialPage::getTitleFor('Watchlist');
        $contributions = SpecialPage::getTitleFor('Contributions', $user);
        $send_message = SpecialPage::getTitleFor('UserBoard');
        $upload_avatar = SpecialPage::getTitleFor('UploadAvatar');
        $user_page = Title::makeTitle(NS_USER, $user);
        $user_social_profile = Title::makeTitle(NS_USER_PROFILE, $user);
        $user_wiki = Title::makeTitle(NS_USER_WIKI, $user);
        $us = new UserStatus($this->user);
        $city = $us->getCity();
        $city = Sanitizer::escapeHtmlAllowEntities($city);
        $birthday = $us->getBirthday();
        $status = $us->getStatus();
        $status = Sanitizer::escapeHtmlAllowEntities($status);
        $gender = $us->getGender();
        if ($gender == 'male') {
            $genderIcon = '♂';
            $gendertext = '他';
        } elseif ($gender == 'female') {
            $genderIcon = '♀';
            $gendertext = '她';
        } else {
            $genderIcon = '♂/♀';
            $gendertext = 'TA';
        }
        if ($this->isOwner()) {
            $gendertext = '你';
        }
        if ($id != 0) {
            $relationship = UserRelationship::getUserRelationshipByID($id, $wgUser->getID());
        }
        $avatar = new wAvatar($this->user_id, 'l');
        wfDebug('profile type: ' . $profile_data['user_page_type'] . "\n");
        $output = '';
        //get more
        $target = SpecialPage::getTitleFor('ShowFollowedSites');
        $query = array('user_id' => $wgUser->getId(), 'target_user_id' => $this->user_id);
        $mailVerify = $wgUser->getEmailAuthenticationTimestamp();
        if ($mailVerify == NULL) {
            $href = "/wiki/Special:ConfirmEmail";
        } else {
            $href = "/wiki/Special:UploadAvatar";
        }
        $output .= '<div id="profile-right" class="col-md-6 col-sm-12 col-xs-12">';
        $output .= '<div id="profile-title-container">
				<h1 id="profile-title">
				<div id="profile-image">' . ($this->isOwner() ? '<div class="profile-image-container crop-headimg" id="crop-avatar"><div class="avatar-view upload-tool" title="上传头像">' . $avatar->getOwnerAvatarURL() . '</div>' . $this->cropModal() . '</div>' : $avatar->getAvatarURL()) . '</div>' . $user_name . '</h1></div>';
        $output .= '<div class="modal fade watch-url" tabindex="-1" role="dialog" aria-labelledby="mySmModalLabel" aria-hidden="true">
                      <div class="modal-dialog modal-sm">
                        <div class="modal-content">
                          <div class="modal-header">
                              <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                              <h4 class="modal-title" id="gridSystemModalLabel">' . $gendertext . '关注的wiki</h4>
                          </div>
                            <div class="modal-body">
	                            <div class="list-group">
								</div>
								' . Linker::LinkKnown($target, '<i class="fa fa-arrows-alt"></i> 全部', array('type' => 'button', 'class' => 'btn btn-default'), $query) . '
							</div>
                        </div>
                      </div>
                    </div>';
        // Show the user's level and the amount of points they have if
        // UserLevels has been configured contributions
        $notice = SpecialPage::getTitleFor('ViewFollows');
        $contributions = SpecialPage::getTitleFor('Contributions');
        $output .= '<div>
					    <ul class="user-follow-msg">
					        <li><h5>编辑</h5>' . Linker::link($contributions, $stats_data['edits'], array(), array('target' => $user, 'contribs' => 'user')) . '</li>
					        <li><h4>|</h4></li>
					        <li><h5>关注</h5>' . Linker::link($notice, UserUserFollow::getFollowingCount(User::newFromName($user)), array('id' => 'user-following-count'), array('user' => $user, 'rel_type' => 1)) . '</li>
//.........这里部分代码省略.........
开发者ID:volvor,项目名称:SocialProfile,代码行数:101,代码来源:UserProfilePage.php

示例3: getCurrentUserInfo


//.........这里部分代码省略.........
         $p = $this->getModulePrefix();
         $this->setWarning("{$p}prop=preferencestoken has been deprecated. Please use action=query&meta=tokens instead.");
     }
     if (isset($this->prop['preferencestoken']) && !$this->lacksSameOriginSecurity() && $user->isAllowed('editmyoptions')) {
         $vals['preferencestoken'] = $user->getEditToken('', $this->getMain()->getRequest());
     }
     if (isset($this->prop['editcount'])) {
         // use intval to prevent null if a non-logged-in user calls
         // api.php?format=jsonfm&action=query&meta=userinfo&uiprop=editcount
         $vals['editcount'] = intval($user->getEditCount());
     }
     if (isset($this->prop['ratelimits'])) {
         $vals['ratelimits'] = $this->getRateLimits();
     }
     if (isset($this->prop['realname']) && !in_array('realname', $this->getConfig()->get('HiddenPrefs'))) {
         $vals['realname'] = $user->getRealName();
     }
     if ($user->isAllowed('viewmyprivateinfo')) {
         if (isset($this->prop['email'])) {
             $vals['email'] = $user->getEmail();
             $auth = $user->getEmailAuthenticationTimestamp();
             if (!is_null($auth)) {
                 $vals['emailauthenticated'] = wfTimestamp(TS_ISO_8601, $auth);
             }
         }
     }
     if (isset($this->prop['registrationdate'])) {
         $regDate = $user->getRegistration();
         if ($regDate !== false) {
             $vals['registrationdate'] = wfTimestamp(TS_ISO_8601, $regDate);
         }
     }
     if (isset($this->prop['acceptlang'])) {
         $langs = $this->getRequest()->getAcceptLang();
         $acceptLang = [];
         foreach ($langs as $lang => $val) {
             $r = ['q' => $val];
             ApiResult::setContentValue($r, 'code', $lang);
             $acceptLang[] = $r;
         }
         ApiResult::setIndexedTagName($acceptLang, 'lang');
         $vals['acceptlang'] = $acceptLang;
     }
     if (isset($this->prop['unreadcount'])) {
         $store = MediaWikiServices::getInstance()->getWatchedItemStore();
         $unreadNotifications = $store->countUnreadNotifications($user, self::WL_UNREAD_LIMIT);
         if ($unreadNotifications === true) {
             $vals['unreadcount'] = self::WL_UNREAD_LIMIT . '+';
         } else {
             $vals['unreadcount'] = $unreadNotifications;
         }
     }
     if (isset($this->prop['centralids'])) {
         $vals += self::getCentralUserInfo($this->getConfig(), $this->getUser(), $this->params['attachedwiki']);
     }
     if (isset($this->prop['designation'])) {
         $vals['designation'] = $huijiUser->getDesignation(false, true);
     }
     if (isset($this->prop['avatar'])) {
         $vals['avatar'] = array("l" => $huijiUser->getAvatar('l')->getAvatarUrlPath(), "ml" => $huijiUser->getAvatar('ml')->getAvatarUrlPath(), "m" => $huijiUser->getAvatar('m')->getAvatarUrlPath(), "s" => $huijiUser->getAvatar('s')->getAvatarUrlPath());
     }
     if (isset($this->prop['gender'])) {
         $vals['gender'] = $huijiUser->getOption('gender');
     }
     if (isset($this->prop['status'])) {
         $us = new UserStatus($user);
         $vals['status'] = $us->getStatus();
     }
     if (isset($this->prop['birthday'])) {
         $us = new UserStatus($user);
         $vals['birthday'] = $us->getBirthday();
     }
     if (isset($this->prop['city'])) {
         $us = new UserStatus($user);
         $vals['city'] = $us->getCity();
     }
     if (isset($this->prop['province'])) {
         $us = new UserStatus($user);
         $vals['province'] = $us->getProvince();
     }
     if (isset($this->prop['followingcount'])) {
         $vals['followingcount'] = $huijiUser->getFollowingUsersCount();
     }
     if (isset($this->prop['followercount'])) {
         $vals['followercount'] = $huijiUser->getFollowerCount();
     }
     if (isset($this->prop['followingsitescount'])) {
         $vals['followingsitescount'] = $huijiUser->getFollowingSitesCount();
     }
     if (isset($this->prop['stats'])) {
         $vals['stats'] = $huijiUser->getStats();
     }
     if (isset($this->prop['level'])) {
         $vals['level'] = $huijiUser->getLevel()->getLevelNumber();
     }
     if (isset($this->prop['followingsites'])) {
         $vals['followingsites'] = $huijiUser->getFollowingSites(true);
     }
     return $vals;
 }
开发者ID:HuijiWiki,项目名称:HuijiMiddleware,代码行数:101,代码来源:ApiQueryHuijiUserInfo.php


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