本文整理汇总了PHP中wAvatar类的典型用法代码示例。如果您正苦于以下问题:PHP wAvatar类的具体用法?PHP wAvatar怎么用?PHP wAvatar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wAvatar类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$user = $this->getUser();
// Blocked users cannot submit new comments, and neither can those users
// without the necessary privileges. Also prevent obvious cross-site request
// forgeries (CSRF)
$id = $this->getMain()->getVal('userid');
$name = $this->getMain()->getVal('username');
$size = $this->getMain()->getVal('size');
if ($id == '') {
if ($name != '') {
$id = User::idFromName($name);
} else {
$id = 0;
}
}
if ($size = '') {
$size = 'l';
}
$avatar = new wAvatar($id, $size);
$responseBody = array('state' => 200, 'message' => '', 'html' => $avatar->getAvatarHtml(), 'url' => $avatar->getAvatarUrlPath());
$result = $this->getResult();
$result->addValue($this->getModuleName(), 'res', $responseBody);
return true;
}
开发者ID:Reasno,项目名称:SocialProfile,代码行数:25,代码来源:AvatarShow.api.php
示例2: execute
/**
* Show the special page
*
* @param $params Mixed: parameter(s) passed to the page or null
*/
public function execute($params)
{
$out = $this->getOutput();
$user = $this->getUser();
// Set the page title, robot policies, etc.
$this->setHeaders();
/**
* Redirect anonymous users to the login page
* It will automatically return them to the ViewRelationshipRequests page
*/
if (!$user->isLoggedIn()) {
$out->setPageTitle($this->msg('ur-error-page-title')->plain());
$login = SpecialPage::getTitleFor('Userlogin');
$out->redirect($login->getFullURL('returnto=Special:ViewRelationshipRequests'));
return false;
}
// Add CSS & JS
$out->addModuleStyles('ext.socialprofile.userrelationship.css');
$out->addModules('ext.socialprofile.userrelationship.js');
$rel = new UserRelationship($user->getName());
$friend_request_count = $rel->getOpenRequestCount($user->getID(), 1);
$foe_request_count = $rel->getOpenRequestCount($user->getID(), 2);
if ($this->getRequest()->wasPosted() && $_SESSION['alreadysubmitted'] == false) {
$_SESSION['alreadysubmitted'] = true;
$rel->addRelationshipRequest($this->user_name_to, $this->relationship_type, $_POST['message']);
$output = '<br /><span class="title">' . $this->msg('ur-already-submitted')->plain() . '</span><br /><br />';
$out->addHTML($output);
} else {
$_SESSION['alreadysubmitted'] = false;
$output = '';
$out->setPageTitle($this->msg('ur-requests-title')->plain());
$requests = $rel->getRequestList(0);
if ($requests) {
foreach ($requests as $request) {
$user_from = Title::makeTitle(NS_USER, $request['user_name_from']);
$avatar = new wAvatar($request['user_id_from'], 'l');
$avatar_img = $avatar->getAvatarURL();
if ($request['type'] == 'Foe') {
$msg = $this->msg('ur-requests-message-foe', htmlspecialchars($user_from->getFullURL()), $request['user_name_from'])->text();
} else {
$msg = $this->msg('ur-requests-message-friend', htmlspecialchars($user_from->getFullURL()), $request['user_name_from'])->text();
}
$message = $out->parse(trim($request['message']), false);
$output .= "<div class=\"relationship-action black-text\" id=\"request_action_{$request['id']}\">\n\t\t\t\t\t \t{$avatar_img}" . $msg;
if ($request['message']) {
$output .= '<div class="relationship-message">' . $message . '</div>';
}
$output .= '<div class="cleared"></div>
<div class="relationship-buttons">
<input type="button" class="site-button" value="' . $this->msg('ur-accept')->plain() . '" data-response="1" />
<input type="button" class="site-button" value="' . $this->msg('ur-reject')->plain() . '" data-response="-1" />
</div>
</div>';
}
} else {
$output = $this->msg('ur-no-requests-message')->parse();
}
$out->addHTML($output);
}
}
开发者ID:Reasno,项目名称:SocialProfile,代码行数:65,代码来源:SpecialViewRelationshipRequests.php
示例3: wfRelationshipRequestResponse
function wfRelationshipRequestResponse($response, $requestId)
{
global $wgUser;
$out = '';
$rel = new UserRelationship($wgUser->getName());
if ($rel->verifyRelationshipRequest($requestId) == true) {
$request = $rel->getRequest($requestId);
$user_name_from = $request[0]['user_name_from'];
$user_id_from = User::idFromName($user_name_from);
$rel_type = strtolower($request[0]['type']);
$response = isset($_POST['response']) ? $_POST['response'] : $response;
$rel->updateRelationshipRequestStatus($requestId, intval($response));
$avatar = new wAvatar($user_id_from, 'l');
$avatar_img = $avatar->getAvatarURL();
if ($response == 1) {
$rel->addRelationship($requestId);
$out .= "<div class=\"relationship-action red-text\">\n\t\t\t\t{$avatar_img}" . wfMessage("ur-requests-added-message-{$rel_type}", $user_name_from)->escaped() . '<div class="cleared"></div>
</div>';
} else {
$out .= "<div class=\"relationship-action red-text\">\n\t\t\t\t{$avatar_img}" . wfMessage("ur-requests-reject-message-{$rel_type}", $user_name_from)->escaped() . '<div class="cleared"></div>
</div>';
}
$rel->deleteRequest($requestId);
}
return $out;
}
开发者ID:Reasno,项目名称:SocialProfile,代码行数:26,代码来源:Relationship_AjaxFunctions.php
示例4: getTopUsersForTag
/**
* Get the given amount of top users for the given timeframe.
*
* @return String: HTML
*/
function getTopUsersForTag($input, $args, $parser)
{
global $wgLang;
// Don't allow showing OVER 9000...I mean, over 50 users, duh.
// Performance and all that stuff.
if (!empty($args['limit']) && is_numeric($args['limit']) && $args['limit'] < 50) {
$limit = intval($args['limit']);
} else {
$limit = 5;
}
if (!empty($args['period']) && strtolower($args['period']) == 'monthly') {
$period = 'monthly';
} else {
// "period" argument not supplied/it's not "monthly", so assume weekly
$period = 'weekly';
}
$fans = UserStats::getTopFansListPeriod($limit, $period);
$x = 1;
$topfans = '';
foreach ($fans as $fan) {
$avatar = new wAvatar($fan['user_id'], 'm');
$user = Title::makeTitle(NS_USER, $fan['user_name']);
$topfans .= "<div class=\"top-fan\">\n\t\t\t\t<span class=\"top-fan-number\">{$x}.</span>\n\t\t\t\t<a href=\"{$user->getFullURL()}\">{$avatar->getAvatarURL()}</a>\n\t\t\t\t<span class=\"top-fans-user\"><a href=\"{$user->getFullURL()}\">{$fan['user_name']}</a></span>\n\t\t\t\t<span class=\"top-fans-points\"><b>+" . $wgLang->formatNum($fan['points']) . '</b> ' . wfMessage('top-fans-points')->plain() . '</span>
</div>';
$x++;
}
return $topfans;
}
开发者ID:Reasno,项目名称:SocialProfile,代码行数:33,代码来源:TopUsersTag.php
示例5: execute
function execute()
{
global $wgUser, $wgOut;
$wgOut->setPagetitle("Top Users");
$dbr =& wfGetDB(DB_MASTER);
$sql = "SELECT stats_user_id,stats_user_name, stats_total_points from user_stats where stats_year_id = 1 and stats_user_id <> 0 ORDER BY stats_total_points DESC LIMIT 0,50";
$res = $dbr->query($sql);
$header = wfMsg("topusersheader");
if ($header != "<topusersheader>") {
$out = $header;
}
// $out = "<span style='font-size:11px;color:#666666;'>Here are the top users since the new \"season\" started on March 7th, 2007. Points are based on a super secret formula.<p><a href=\"index.php?title=ArmchairGM Top Users: Year 1\">Click here for the Top Users of the Inaugural Year</a></span><p>";
$x = 1;
$out .= "<div class=\"top-users\">\n <div class=\"top-user-header\"><span class=\"top-user-num\">#</span><span class=\"top-user\">User</span><span class=\"top-user-points\">Points</span></div>";
while ($row = $dbr->fetchObject($res)) {
$user_name = $row->stats_user_name;
$user_title = Title::makeTitle(NS_USER, $row->stats_user_name);
$avatar = new wAvatar($row->stats_user_id, "s");
$CommentIcon = $avatar->getAvatarImage();
$out .= "<div class=\"top-user-row\">\n\t \t\t<span class=\"top-user-num\">{$x}</span><span class=\"top-user\"><img src='images/avatars/" . $CommentIcon . "' alt='' border=''> <a href='" . $user_title->getFullURL() . "' class=\"top-user-link\">" . $row->stats_user_name . "</a><a href='" . $user_title->getTalkPage()->getFullURL() . "' class=\"top-user-talk\"><img src=\"images/commentIcon.gif\" border=\"0\" hspace=\"3\" align=\"middle\" alt=\"\" /></a>\n\t\t\t</span>";
$out .= "<span class=\"top-user-points\">" . $row->stats_total_points . "</span>\n\t \t</div>";
$x++;
}
$out .= "</div>";
$wgOut->addHTML($out);
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:26,代码来源:TopCommenters.php
示例6: getCommentsOfTheDay
/**
* Get comments of the day -- five newest comments within the last 24 hours
*
* @return String: HTML
*/
function getCommentsOfTheDay($input, $args, $parser)
{
global $wgMemc, $wgUploadPath;
$oneDay = 60 * 60 * 24;
// Try memcached first
$key = wfMemcKey('comments-of-the-day', 'standalone-hook');
$data = $wgMemc->get($key);
if ($data) {
// success, got it from memcached!
$commentsOfTheDay = $data;
} elseif (!$data || $args['nocache']) {
// just query the DB
$dbr = wfGetDB(DB_SLAVE);
$res = $dbr->select(array('Comments', 'page'), array('Comment_Username', 'comment_ip', 'comment_text', 'comment_date', 'Comment_user_id', 'CommentID', 'IFNULL(Comment_Plus_Count - Comment_Minus_Count,0) AS Comment_Score', 'Comment_Plus_Count AS CommentVotePlus', 'Comment_Minus_Count AS CommentVoteMinus', 'Comment_Parent_ID', 'page_title', 'page_namespace'), array('comment_page_id = page_id', 'UNIX_TIMESTAMP(comment_date) > ' . (time() - $oneDay)), __METHOD__, array('ORDER BY' => '(Comment_Plus_Count) DESC', 'LIMIT' => 5));
$commentsOfTheDay = array();
foreach ($res as $row) {
$commentsOfTheDay[] = array('username' => $row->Comment_Username, 'userid' => $row->Comment_user_id, 'score' => $row->CommentVotePlus, 'text' => $row->comment_text, 'id' => $row->CommentID, 'pagens' => $row->page_namespace, 'pagetitle' => $row->page_title);
}
$wgMemc->set($key, $commentsOfTheDay, $oneDay);
}
$comments = '';
foreach ($commentsOfTheDay as $commentOfTheDay) {
$title2 = Title::makeTitle($commentOfTheDay['pagens'], $commentOfTheDay['pagetitle']);
if ($commentOfTheDay['userid'] != 0) {
$title = Title::makeTitle(NS_USER, $commentOfTheDay['username']);
$commentPoster_Display = $commentOfTheDay['username'];
$commentPoster = '<a href="' . $title->getFullURL() . '" title="' . $title->getText() . '" rel="nofollow">' . $commentOfTheDay['username'] . '</a>';
$avatar = new wAvatar($commentOfTheDay['userid'], 's');
$commentIcon = $avatar->getAvatarImage();
} else {
$commentPoster_Display = wfMsg('comment-anon-name');
$commentPoster = wfMsg('comment-anon-name');
$commentIcon = 'default_s.gif';
}
$comment_text = substr($commentOfTheDay['text'], 0, 50 - strlen($commentPoster_Display));
if ($comment_text != $commentOfTheDay['text']) {
$comment_text .= wfMsg('ellipsis');
}
$comments .= '<div class="cod">';
$sign = '';
if ($commentOfTheDay['score'] > 0) {
$sign = '+';
} elseif ($commentOfTheDay['score'] < 0) {
$sign = '-';
// this *really* shouldn't be happening...
}
$comments .= '<span class="cod-score">' . $sign . $commentOfTheDay['score'] . '</span> <img src="' . $wgUploadPath . '/avatars/' . $commentIcon . '" alt="" align="middle" style="margin-bottom:8px;" border="0"/>
<span class="cod-poster">' . $commentPoster . '</span>';
$comments .= '<span class="cod-comment"><a href="' . $title2->getFullURL() . '#comment-' . $commentOfTheDay['id'] . '" title="' . $title2->getText() . '">' . $comment_text . '</a></span>';
$comments .= '</div>';
}
$output = '';
if (!empty($comments)) {
$output .= $comments;
} else {
$output .= wfMsg('comments-no-comments-of-day');
}
return $output;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:64,代码来源:CommentsOfTheDay.php
示例7: execute
/**
* Show the special page
*
* @param $params Mixed: parameter(s) passed to the page or null
*/
public function execute($params)
{
global $wgUser, $wgOut, $wgRequest, $wgUserRelationshipScripts;
/**
* Redirect Non-logged in users to Login Page
* It will automatically return them to the ViewRelationshipRequests page
*/
if ($wgUser->getID() == 0) {
$wgOut->setPageTitle(wfMsg('ur-error-page-title'));
$login = SpecialPage::getTitleFor('Userlogin');
$wgOut->redirect($login->getFullURL('returnto=Special:ViewRelationshipRequests'));
return false;
}
$wgOut->addScriptFile($wgUserRelationshipScripts . '/UserRelationship.js');
$wgOut->addExtensionStyle($wgUserRelationshipScripts . '/UserRelationship.css');
$rel = new UserRelationship($wgUser->getName());
$friend_request_count = $rel->getOpenRequestCount($wgUser->getID(), 1);
$foe_request_count = $rel->getOpenRequestCount($wgUser->getID(), 2);
if (count($_POST) && $_SESSION['alreadysubmitted'] == false) {
$_SESSION['alreadysubmitted'] = true;
$rel->addRelationshipRequest($this->user_name_to, $this->relationship_type, $_POST['message']);
$out = '<br /><span class="title">' . wfMsg('ur-already-submitted') . '</span><br /><br />';
$wgOut->addHTML($out);
} else {
$_SESSION['alreadysubmitted'] = false;
$output = '';
$wgOut->setPageTitle(wfMsg('ur-requests-title'));
$requests = $rel->getRequestList(0);
if ($requests) {
foreach ($requests as $request) {
$user_from = Title::makeTitle(NS_USER, $request['user_name_from']);
$avatar = new wAvatar($request['user_id_from'], 'l');
$avatar_img = $avatar->getAvatarURL();
if ($request['type'] == 'Foe') {
$msg = wfMsg('ur-requests-message-foe', $user_from->escapeFullURL(), $request['user_name_from']);
} else {
$msg = wfMsg('ur-requests-message-friend', $user_from->escapeFullURL(), $request['user_name_from']);
}
$message = $wgOut->parse(trim($request['message']), false);
$output .= "<div class=\"relationship-action black-text\" id=\"request_action_{$request['id']}\">\r\n\t\t\t\t\t \t{$avatar_img}" . $msg;
if ($request['message']) {
$output .= '<div class="relationship-message">' . $message . '</div>';
}
$output .= '<div class="cleared"></div>
<div class="relationship-buttons">
<input type="button" class="site-button" value="' . wfMsg('ur-accept') . '" onclick="javascript:requestResponse(1,' . $request['id'] . ')" />
<input type="button" class="site-button" value="' . wfMsg('ur-reject') . '" onclick="javascript:requestResponse(-1,' . $request['id'] . ')" />
</div>
</div>';
}
} else {
$inviteLink = SpecialPage::getTitleFor('InviteContacts');
$output = wfMsg('ur-no-requests-message', $inviteLink->escapeFullURL());
}
$wgOut->addHTML($output);
}
}
开发者ID:kghbln,项目名称:semantic-social-profile,代码行数:62,代码来源:SpecialViewRelationshipRequests.php
示例8: execute
/**
* Show the special page
*
* @param $par Mixed: parameter passed to the page or null
*/
public function execute($par)
{
global $wgRequest, $wgOut, $wgUser, $wgUploadPath, $wgScriptPath, $wgSystemGiftsScripts;
// Variables
$gift_name_check = '';
$x = 0;
$category_number = $wgRequest->getInt('category');
// System gift class array
$categories = array(array('category_name' => 'Edit', 'category_threshold' => '500', 'category_id' => 1), array('category_name' => 'Vote', 'category_threshold' => '2000', 'category_id' => 2), array('category_name' => 'Comment', 'category_threshold' => '1000', 'category_id' => 3), array('category_name' => 'Recruit', 'category_threshold' => '0', 'category_id' => 7), array('category_name' => 'Friend', 'category_threshold' => '25', 'category_id' => 8));
// Set title
if (!$category_number || $category_number > 4) {
$category_number = 0;
$page_category = $categories[$category_number]['category_name'];
} else {
$page_category = $categories[$category_number]['category_name'];
}
// Database calls
$dbr = wfGetDB(DB_SLAVE);
$res = $dbr->select(array('user_system_gift', 'system_gift'), array('sg_user_name', 'sg_user_id', 'gift_category', 'MAX(gift_threshold) AS top_gift'), array("gift_category = {$categories[$category_number]['category_id']}", "gift_threshold > {$categories[$category_number]['category_threshold']}"), __METHOD__, array('GROUP BY' => 'sg_user_name', 'ORDER BY' => 'top_gift DESC'), array('system_gift' => array('INNER JOIN', 'gift_id=sg_gift_id')));
// Page title
$wgOut->setPageTitle("Top Awards - {$page_category} Milestones");
// Add CSS
$wgOut->addExtensionStyle($wgSystemGiftsScripts . '/SystemGift.css');
$output = '<div class="top-awards-navigation">
<h1>Award Categories</h1>';
$nav_x = 0;
foreach ($categories as $award_type) {
if ($nav_x == $category_number) {
$output .= "<p><b>{$award_type['category_name']}s</b></p>";
} else {
$output .= "<p><a href=\"" . $wgScriptPath . "/index.php?title=Special:TopAwards&category={$nav_x}\">{$award_type['category_name']}s</a></p>";
}
$nav_x++;
}
$output .= '</div>';
$output .= '<div class="top-awards">';
foreach ($res as $row) {
$user_name = $row->sg_user_name;
$user_id = $row->sg_user_id;
$avatar = new wAvatar($user_id, 'm');
$top_gift = $row->top_gift;
$gift_name = number_format($top_gift) . " {$categories[$category_number][category_name]}" . ($top_gift > 1 ? 's' : '') . " Milestone";
if ($gift_name !== $gift_name_check) {
$x = 1;
$output .= "<div class=\"top-award-title\">\r\n\t\t\t\t\t{$gift_name}\r\n\t\t\t\t</div>";
} else {
$x++;
}
$userLink = $wgUser->getSkin()->link(Title::makeTitle(NS_USER, $row->sg_user_name), $user_name);
$output .= "<div class=\"top-award\">\r\n\t\t\t\t\t<span class=\"top-award-number\">{$x}.</span>\r\n\t\t\t\t\t{$avatar->getAvatarURL()}\r\n\t\t\t\t\t{$userLink}\r\n\t\t\t\t</div>";
$gift_name_check = $gift_name;
}
$output .= '</div>
<div class="cleared"></div>';
$wgOut->addHTML($output);
}
开发者ID:kghbln,项目名称:semantic-social-profile,代码行数:61,代码来源:TopAwards.php
示例9: wfGetUserAvatar
function wfGetUserAvatar($username)
{
if ($username == true) {
$user_id = User::idFromName($username);
$avatar = new wAvatar($user_id, 'm');
$useravatar = $avatar->getAvatarURL();
$ret = array('success' => true, 'result' => $useravatar);
$out = json_encode($ret);
return $out;
}
}
开发者ID:Reasno,项目名称:SocialProfile,代码行数:11,代码来源:UserStatus_AjaxFunctions.php
示例10: execute
/**
* Show the special page
*
* @param $par Mixed: parameter passed to the page or null
*/
public function execute($par)
{
global $wgUser, $wgOut, $wgRequest, $wgUploadPath, $wgSystemGiftsScripts;
$wgOut->addExtensionStyle($wgSystemGiftsScripts . '/SystemGift.css');
$output = '';
// Prevent E_NOTICE
// If gift ID wasn't passed in the URL parameters or if it's not
// numeric, display an error message
$giftId = $wgRequest->getInt('gift_id');
if (!$giftId || !is_numeric($giftId)) {
$wgOut->setPageTitle(wfMsg('ga-error-title'));
$wgOut->addHTML(wfMsg('ga-error-message-invalid-link'));
return false;
}
$gift = UserSystemGifts::getUserGift($giftId);
if ($gift) {
if ($gift['status'] == 1) {
if ($gift['user_name'] == $wgUser->getName()) {
$g = new UserSystemGifts($gift['user_name']);
$g->clearUserGiftStatus($gift['id']);
$g->decNewSystemGiftCount($wgUser->getID());
}
}
// DB stuff
$dbr = wfGetDB(DB_MASTER);
$res = $dbr->select('user_system_gift', array('DISTINCT sg_user_name', 'sg_user_id', 'sg_gift_id', 'sg_date'), array("sg_gift_id = {$gift['gift_id']}", "sg_user_name <> '" . $dbr->strencode($gift['user_name']) . "'"), __METHOD__, array('GROUP BY' => 'sg_user_name', 'ORDER BY' => 'sg_date DESC', 'OFFSET' => 0, 'LIMIT' => 6));
$wgOut->setPageTitle(wfMsg('ga-gift-title', $gift['user_name'], $gift['name']));
$profileURL = Title::makeTitle(NS_USER, $gift['user_name'])->escapeFullURL();
$output .= '<div class="back-links">' . wfMsg('ga-back-link', $profileURL, $gift['user_name']) . '</div>';
$message = $wgOut->parse(trim($gift['description']), false);
$output .= '<div class="ga-description-container">';
$giftImage = "<img src=\"{$wgUploadPath}/awards/" . SystemGifts::getGiftImage($gift['gift_id'], 'l') . '" border="0" alt=""/>';
$output .= "<div class=\"ga-description\">\r\n\t\t\t\t\t{$giftImage}\r\n\t\t\t\t\t<div class=\"ga-name\">{$gift['name']}</div>\r\n\t\t\t\t\t<div class=\"ga-timestamp\">({$gift['timestamp']})</div>\r\n\t\t\t\t\t<div class=\"ga-description-message\">\"{$message}\"</div>";
$output .= '<div class="cleared"></div>
</div>';
$output .= '<div class="ga-recent">
<div class="ga-recent-title">' . wfMsg('ga-recent-recipients-award') . '</div>
<div class="ga-gift-count">' . wfMsgExt('ga-gift-given-count', 'parsemag', $gift['gift_count']) . '</div>';
foreach ($res as $row) {
$userToId = $row->sg_user_id;
$avatar = new wAvatar($userToId, 'ml');
$userNameLink = Title::makeTitle(NS_USER, $row->sg_user_name);
$output .= '<a href="' . $userNameLink->escapeFullURL() . "\">\r\n\t\t\t\t\t{$avatar->getAvatarURL()}\r\n\t\t\t\t</a>";
}
$output .= '<div class="cleared"></div>
</div>
</div>';
$wgOut->addHTML($output);
} else {
$wgOut->setPageTitle(wfMsg('ga-error-title'));
$wgOut->addHTML(wfMsg('ga-error-message-invalid-link'));
}
}
开发者ID:kghbln,项目名称:semantic-social-profile,代码行数:58,代码来源:SpecialViewSystemGift.php
示例11: getNewUsers
/**
* Callback function for the <newusers> tag.
* Queries the user_register_track database table for new users and renders
* the list of newest users and their avatars, wrapped in a div with the class
* "new-users".
* Disables parser cache and caches the database query results in memcached.
*/
function getNewUsers($input, $args, $parser)
{
global $wgMemc;
$parser->disableCache();
$count = 10;
$per_row = 5;
if (isset($args['count']) && is_numeric($args['count'])) {
$count = intval($args['count']);
}
if (isset($args['row']) && is_numeric($args['row'])) {
$per_row = intval($args['row']);
}
// Try cache
$key = wfMemcKey('users', 'new', $count);
$data = $wgMemc->get($key);
if (!$data) {
$dbr = wfGetDB(DB_SLAVE);
if ($dbr->tableExists('user_register_track')) {
$res = $dbr->select('user_register_track', array('ur_user_id', 'ur_user_name'), array(), __METHOD__, array('ORDER BY' => 'ur_date', 'LIMIT' => $count));
} else {
// If user_register_track table doesn't exist, use the core logging
// table
$res = $dbr->select('logging', array('log_user AS ur_user_id', 'log_user_text AS ur_user_name'), array('log_type' => 'newusers'), __METHOD__, array('ORDER BY' => 'log_timestamp DESC', 'LIMIT' => $count));
}
$list = array();
foreach ($res as $row) {
$list[] = array('user_id' => $row->ur_user_id, 'user_name' => $row->ur_user_name);
}
// Cache in memcached for 10 minutes
$wgMemc->set($key, $list, 60 * 10);
} else {
wfDebugLog('NewUsersList', 'Got new users from cache');
$list = $data;
}
$output = '<div class="new-users">';
if (!empty($list)) {
$x = 1;
foreach ($list as $user) {
$avatar = new wAvatar($user['user_id'], 'ml');
$userLink = Title::makeTitle(NS_USER, $user['user_name']);
$output .= '<a href="' . $userLink->escapeFullURL() . '" rel="nofollow">' . $avatar->getAvatarURL() . '</a>';
if ($x == $count || $x != 1 && $x % $per_row == 0) {
$output .= '<div class="cleared"></div>';
}
$x++;
}
}
$output .= '<div class="cleared"></div></div>';
return $output;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:57,代码来源:NewUsersList.php
示例12: displayChallenge
function displayChallenge()
{
global $wgUser;
$out = "<br><span class=pagetitle>ArmchairGM Challenge Info</span><br><br>";
$avatar1 = new wAvatar($this->challenge_username1, "l");
$avatar2 = new wAvatar($this->challenge_username2, "l");
$title1 = Title::makeTitle(NS_USER, $this->challenge_username1);
$title2 = Title::makeTitle(NS_USER, $this->challenge_username2);
$out .= "<table cellpadding=8 bgcolor=#eeeeee cellspacing=0 style='border:1px solid #666666'><tr><td>\n\t\t\t<img src='images/avatars/" . $avatar1->getAvatarImage() . "alt='' border=''>\n\t\t\t</td>";
$out .= "<td><span class=challenge-user-title><a href=" . $title1->getFullURL() . " class=challenge-user-title>" . $title1->getText() . "</a></span> (" . $this->getRecord($this->challenge_user_id_1) . ")\n\t\t\t\t<b>vs.</b> ";
$out .= "</td><td><img src='images/avatars/" . $avatar2->getAvatarImage() . "alt='' border=''></td><td><span class=challenge-user-title>";
$out .= "<a href=" . $title2->getFullURL() . " class=challenge-user-title>" . $title2->getText() . "</a> </span> (" . $this->getRecord($this->challenge_user_id_2) . ")</td></tr></table><br>";
$out .= "<table ><tr><td><b>Event:</b> <span class=challenge-event>" . $this->challenge_info . " [" . $this->challenge_event_date . "]</span>";
$out .= "<br><b>" . $this->challenge_username1 . "'s description: </b><span class=challenge-description>" . $this->challenge_description . "</span></td></tr></table>";
$out .= "</td></tr></table><br><table cellpadding=0 cellspacing=0 ><tr><td valign=top><span class=title>if " . $this->challenge_username1 . " wins, " . $this->challenge_username2 . " has to . . . </span>";
$out .= "<table cellpadding=0 cellspacing=0 class=challenge-terms width=300><tr><td>" . $this->challenge_win_terms . "</td></tr></table><br>";
$out .= "</td><td width=20> </td><td valign=top><span class=title>if " . $this->challenge_username2 . " wins, " . $this->challenge_username1 . " has to . . . </span>";
$out .= "<table cellpadding=0 cellspacing=0 class=challenge-terms width=300><tr><td>" . $this->challenge_lose_terms . "</td></tr></table>";
$out .= "</td></tr></table>";
if ($wgUser->isAllowed('protect') && $this->challenge_user_id_2 != $wgUser->mId && $this->challenge_user_id_1 != $wgUser->mId) {
$out .= "<a href=javascript:challengeCancel(" . $this->challenge_id . ") style='color:#990000'>Admin Cancel Challenge Due to Abuse</a>";
}
$out .= "<hr><span class=challenge-status>\n\t\t\t\t<span class=title>Challenge Status</span><br><span id=challange-status>\n\t\t\t";
switch ($this->challenge_status) {
case 0:
$out .= $this->getStatusOpen();
break;
case 1:
if (1 == 2) {
$out .= $this->getStatusAccepted();
} else {
$out .= $this->getStatusAwaitingApproval();
}
break;
case -1:
$out .= $this->getStatusRejected();
break;
case -2:
$out .= "<span class=challenge-rejected>Removed due to violation of rules</span>";
break;
case 3:
$out .= $this->getStatusCompleted();
break;
}
$out .= "</span></span><span id=status2></span>";
return $out;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:47,代码来源:ChallengeView.php
示例13: getNYAvatar
function getNYAvatar($user_id) {
global $wgUploadDirectory;
$avatar = new wAvatar($user_id, 'l');
$img = $avatar->getAvatarImage();
if ( $img ) {
if ( substr(trim($img), 0, 7) != 'default' ) {
$img = preg_replace("/\?(.*)/", '', $img);
$img = $wgUploadDirectory . "/avatars/" . trim($img);
} else {
$img = '-';
}
} else {
$img = '-';
}
echo $img;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:17,代码来源:avatarToMasthead.php
示例14: getWelcome
function getWelcome()
{
global $wgUser, $wgOut, $wgLang;
// Add CSS
$wgOut->addModuleStyles('ext.socialprofile.userwelcome.css');
// Get stats and user level
$stats = new UserStats($wgUser->getID(), $wgUser->getName());
$stats_data = $stats->getUserStats();
$user_level = new UserLevel($stats_data['points']);
// Safe links
$level_link = Title::makeTitle(NS_HELP, wfMessage('mp-userlevels-link')->inContentLanguage()->plain());
$avatar_link = SpecialPage::getTitleFor('UploadAvatar');
// Make an avatar
$avatar = new wAvatar($wgUser->getID(), 'l');
// Profile top images/points
$output = '<div class="mp-welcome-logged-in">
<h2>' . wfMessage('mp-welcome-logged-in', $wgUser->getName())->parse() . '</h2>
<div class="mp-welcome-image">
<a href="' . htmlspecialchars($wgUser->getUserPage()->getFullURL()) . '" rel="nofollow">' . $avatar->getAvatarURL() . '</a>';
if (strpos($avatar->getAvatarImage(), 'default_') !== false) {
$uploadOrEditMsg = 'mp-welcome-upload';
} else {
$uploadOrEditMsg = 'mp-welcome-edit';
}
$output .= '<div><a href="' . htmlspecialchars($avatar_link->getFullURL()) . '" rel="nofollow">' . wfMessage($uploadOrEditMsg)->plain() . '</a></div>';
$output .= '</div>';
global $wgUserLevels;
if ($wgUserLevels) {
$output .= '<div class="mp-welcome-points">
<div class="points-and-level">
<div class="total-points">' . wfMessage('mp-welcome-points', $wgLang->formatNum($stats_data['points']))->parse() . '</div>
<div class="honorific-level"><a href="' . htmlspecialchars($level_link->getFullURL()) . '">(' . $user_level->getLevelName() . ')</a></div>
</div>
<div class="cleared"></div>
<div class="needed-points">
<br />' . wfMessage('mp-welcome-needed-points', htmlspecialchars($level_link->getFullURL()), $user_level->getNextLevelName(), $user_level->getPointsNeededToAdvance())->text() . '</div>
</div>';
}
$output .= '<div class="cleared"></div>';
$output .= getRequests();
$output .= '</div>';
return $output;
}
开发者ID:Reasno,项目名称:SocialProfile,代码行数:43,代码来源:UserWelcome.php
示例15: getWelcome
function getWelcome()
{
global $wgUser, $wgOut, $wgScriptPath, $wgUploadPath;
// Add CSS
$wgOut->addExtensionStyle($wgScriptPath . '/extensions/SocialProfile/UserWelcome/UserWelcome.css');
// Get stats and user level
$stats = new UserStats($wgUser->getID(), $wgUser->getName());
$stats_data = $stats->getUserStats();
$user_level = new UserLevel($stats_data['points']);
// Safe links
$level_link = Title::makeTitle(NS_HELP, wfMsgForContent('mp-userlevels-link'));
$avatar_link = SpecialPage::getTitleFor('UploadAvatar');
// Make an avatar
$avatar = new wAvatar($wgUser->getID(), 'l');
// Profile top images/points
$output = '<div class="mp-welcome-logged-in">
<h2>' . wfMsg('mp-welcome-logged-in', $wgUser->getName()) . '</h2>
<div class="mp-welcome-image">
<a href="' . $wgUser->getUserPage()->escapeFullURL() . '" rel="nofollow"><img src="' . $wgUploadPath . '/avatars/' . $avatar->getAvatarImage() . '" alt="" border="0"/></a>';
if (strpos($avatar->getAvatarImage(), 'default_') !== false) {
$output .= '<div><a href="' . $avatar_link->escapeFullURL() . '" rel="nofollow">' . wfMsg('mp-welcome-upload') . '</a></div>';
} else {
$output .= '<div><a href="' . $avatar_link->escapeFullURL() . '" rel="nofollow">' . wfMsg('mp-welcome-edit') . '</a></div>';
}
$output .= '</div>';
global $wgUserLevels;
if ($wgUserLevels) {
$output .= '<div class="mp-welcome-points">
<div class="points-and-level">
<div class="total-points">' . wfMsgExt('mp-welcome-points', 'parsemag', $stats_data['points']) . '</div>
<div class="honorific-level"><a href="' . $level_link->escapeFullURL() . '">(' . $user_level->getLevelName() . ')</a></div>
</div>
<div class="cleared"></div>
<div class="needed-points">
<br />' . wfMsgExt('mp-welcome-needed-points', 'parsemag', $level_link->escapeFullURL(), $user_level->getNextLevelName(), $user_level->getPointsNeededToAdvance()) . '</div>
</div>';
}
$output .= '<div class="cleared"></div>';
$output .= getRequests();
$output .= '</div>';
return $output;
}
开发者ID:kghbln,项目名称:semantic-social-profile,代码行数:42,代码来源:UserWelcome.php
示例16: execute
function execute()
{
global $wgUser, $wgOut, $wgRequest;
//$wgOut->addHTML("Coming Soon");
$out = "";
$out .= "<br><span class=pagetitle>ArmchairGM Challenge Standings</span><br><br>";
$out .= "<table cellpadding=3 cellspacing=0 border=0><tr>\n\t\t\t<td class=challenge-standings-title>#</td>\n\t\t\t<td class=challenge-standings-title>user</td>\n\t\t\t<td class=challenge-standings-title>W</td>\n\t\t\t<td class=challenge-standings-title>L</td>\n\t\t\t<td class=challenge-standings-title>T</td>\n\t\t\t<td class=challenge-standings-title>%</td>\n\t\t\t<td class=challenge-standings-title></td>\n\t\t\t</tr>";
$dbr =& wfGetDB(DB_SLAVE);
$sql = "SELECT challenge_record_username, challenge_wins, challenge_losses, challenge_ties, (challenge_wins / (challenge_wins + challenge_losses + challenge_ties) ) as winning_percentage FROM challenge_user_record ORDER BY (challenge_wins / (challenge_wins + challenge_losses + challenge_ties) ) DESC, challenge_wins DESC LIMIT 0,25";
$res = $dbr->query($sql);
$x = 1;
while ($row = $dbr->fetchObject($res)) {
$avatar1 = new wAvatar($row->challenge_record_username, "s");
$out .= "<tr>\n\t\t\t\t\t\t\t<td class=challenge-standings>" . $x . "</td>\n\t\t\t\t\t\t\t<td class=challenge-standings><img src='images/avatars/" . $avatar1->getAvatarImage() . "' align=absmiddle><a href=index.php?title=Special:ChallengeHistory&user=" . $row->challenge_record_username . " style='font-weight:bold;font-size:13px'>" . $row->challenge_record_username . "</a> " . $user1Icon . "</td>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<td class=challenge-standings>" . $row->challenge_wins . "</td>\n\t\t\t\t\t\t\t<td class=challenge-standings>" . $row->challenge_losses . "</td>\n\t\t\t\t\t\t\t<td class=challenge-standings>" . $row->challenge_ties . "</td>\n\t\t\t\t\t\t\t<td class=challenge-standings>" . str_replace(".0", ".", number_format($row->winning_percentage, 3)) . "</td>";
if ($row->challenge_record_username != $wgUser->mName) {
$out .= "<td class=challenge-standings><a href=index.php?title=Special:ChallengeUser&user=" . $row->challenge_record_username . " style='color:#666666'>challenge user</a></td>";
}
$out .= "</td>\n\t\t\t\t</tr>";
$x++;
}
$wgOut->addHTML($out);
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:22,代码来源:ChallengeStandings.php
|
请发表评论