本文整理汇总了PHP中wAvatar::getAvatarURL方法的典型用法代码示例。如果您正苦于以下问题:PHP wAvatar::getAvatarURL方法的具体用法?PHP wAvatar::getAvatarURL怎么用?PHP wAvatar::getAvatarURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wAvatar
的用法示例。
在下文中一共展示了wAvatar::getAvatarURL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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);
}
}
示例4: 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);
}
}
示例5: 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);
}
示例6: 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;
}
}
示例7: 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'));
}
}
示例8: 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;
}
示例9: 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;
}
示例10: display
//.........这里部分代码省略.........
$replyRow .= " | <a href=\"#end\" rel=\"nofollow\" class=\"comments-reply-to\" data-comment-id=\"{$comment['CommentID']}\" data-comments-safe-username=\"" . htmlspecialchars($CommentReplyTo, ENT_QUOTES) . '">' . wfMsg('comment-reply') . '</a>';
}
}
if ($comment['Comment_Parent_ID'] == 0) {
$container_class = 'full';
$comment_class = 'f-message';
} else {
$container_class = 'reply';
$comment_class = 'r-message';
}
// Display Block icon for logged in users for comments of users
// that are already not in your block list
$block_link = '';
if ($wgUser->getID() != 0 && $wgUser->getID() != $comment['Comment_user_id'] && !in_array($comment['Comment_Username'], $block_list)) {
$block_link = '<a href="javascript:void(0);" rel="nofollow" class="comments-block-user" data-comments-safe-username="' . htmlspecialchars($comment['Comment_Username'], ENT_QUOTES) . '" data-comments-comment-id="' . $comment['CommentID'] . '" data-comments-user-id="' . $comment['Comment_user_id'] . "\">\n\t\t\t\t\t<img src=\"{$wgScriptPath}/extensions/Comments/images/block.png\" border=\"0\" alt=\"\"/>\n\t\t\t\t</a>";
}
// If you are ignoring the author of the comment, display message in comment box,
// along with a link to show the individual comment
$hide_comment_style = '';
if (in_array($comment['Comment_Username'], $block_list)) {
$hide_comment_style = 'display:none;';
$blockListTitle = SpecialPage::getTitleFor('CommentIgnoreList');
$output .= "<div id=\"ignore-{$comment['CommentID']}\" class=\"c-ignored {$container_class}\">\n";
$output .= wfMsgExt('comment-ignore-message', 'parsemag');
$output .= '<div class="c-ignored-links">' . "\n";
$output .= "<a href=\"javascript:void(0);\" data-comment-id=\"{$comment['CommentID']}\">" . wfMsg('comment-show-comment-link') . '</a> | ';
$output .= "<a href=\"{$blockListTitle->escapeFullURL()}\">" . wfMsg('comment-manage-blocklist-link') . '</a>';
$output .= '</div>' . "\n";
$output .= '</div>' . "\n";
}
// Default avatar image, if SocialProfile extension isn't
// enabled
global $wgCommentsDefaultAvatar;
$avatar_img = '<img src="' . $wgCommentsDefaultAvatar . '" alt="" border="0" />';
// If SocialProfile *is* enabled, then use its wAvatar class
// to get the avatars for each commenter
if (class_exists('wAvatar')) {
$avatar = new wAvatar($comment['Comment_user_id'], 'ml');
$avatar_img = $avatar->getAvatarURL() . "\n";
}
$output .= "<div id=\"comment-{$comment['CommentID']}\" class=\"c-item {$container_class}\" style=\"{$hide_comment_style}\">" . "\n";
$output .= "<div class=\"c-avatar\">{$avatar_img}</div>" . "\n";
$output .= '<div class="c-container">' . "\n";
$output .= '<div class="c-user">' . "\n";
$output .= "{$CommentPoster}";
$output .= "<span class=\"c-user-level\">{$CommentPosterLevel}</span> {$block_link}" . "\n";
wfSuppressWarnings();
// E_STRICT bitches about strtotime()
$output .= '<div class="c-time">' . wfMsg('comments-time-ago', self::getTimeAgo(strtotime($comment['Comment_Date']))) . '</div>' . "\n";
wfRestoreWarnings();
$output .= '<div class="c-score">' . "\n";
if ($this->AllowMinus == true || $this->AllowPlus == true) {
$output .= '<span class="c-score-title">' . wfMsg('comment-score-text') . " <span id=\"Comment{$comment['CommentID']}\">{$CommentScore}</span></span>";
// Voting is possible only when database is unlocked
if (!wfReadOnly()) {
if (!in_array($comment['CommentID'], $voted)) {
// You can only vote for other people's comments,
// not for your own
if ($wgUser->getName() != $comment['Comment_Username']) {
$output .= "<span id=\"CommentBtn{$comment['CommentID']}\">";
if ($this->AllowPlus == true) {
$output .= $this->getVoteLink($comment['CommentID'], 1);
}
if ($this->AllowMinus == true) {
$output .= $this->getVoteLink($comment['CommentID'], -1);
}
$output .= '</span>';
} else {
$output .= wfMsg('comment-you');
}
} else {
// Already voted?
$output .= '<img src="' . $wgScriptPath . '/extensions/Comments/images/voted.gif" border="0" alt="" />' . wfMsg('comment-voted-label');
}
}
}
$output .= '</div>' . "\n";
// $wgTitle points to Special:CommentListGet...and that special
// page shouldn't even exist, so we certainly don't want to
// advertise it...let's point the permalink to the current page
// instead :)
$title = Title::newFromID($this->PageID);
$output .= '</div>' . "\n";
$output .= "<div class=\"c-comment {$comment_class}\">" . "\n";
$output .= $this->getCommentText($comment['Comment_Text']);
$output .= '</div>' . "\n";
$output .= '<div class="c-actions">' . "\n";
$output .= '<a href="' . $title->escapeFullURL() . "#comment-{$comment['CommentID']}\" rel=\"nofollow\">" . wfMsg('comment-permalink') . '</a> ';
if ($replyRow || $dlt) {
$output .= "{$replyRow} {$dlt}" . "\n";
}
$output .= '</div>' . "\n";
$output .= '</div>' . "\n";
$output .= '<div class="cleared"></div>' . "\n";
$output .= '</div>' . "\n";
}
}
$output .= '<a id="end" name="end" rel="nofollow"></a>';
return $output;
}
示例11: displayForm
/**
* Displays the form for removing a friend or a foe
* @return $form Mixed: HTML code for the form
*/
function displayForm() {
global $wgOut;
$avatar = new wAvatar( $this->user_id_to, 'l' );
if ( $this->relationship_type == 1 ) {
$title = wfMsg( 'ur-remove-relationship-title-friend', $this->user_name_to );
$remove = wfMsg( 'ur-remove-relationship-message-friend', $this->user_name_to, wfMsg( 'ur-remove' ) );
} else {
$title = wfMsg( 'ur-remove-relationship-title-foe', $this->user_name_to );
$remove = wfMsg( 'ur-remove-relationship-message-foe', $this->user_name_to, wfMsg( 'ur-remove' ) );
}
$wgOut->setPageTitle( $title );
$form = "<form action=\"\" method=\"post\" enctype=\"multipart/form-data\" name=\"form1\">
<div class=\"relationship-action\">
{$avatar->getAvatarURL()}" .
$remove .
'<div class="relationship-buttons">
<input type="hidden" name="user" value="' . addslashes( $this->user_name_to ) . '" />
<input type="button" class="site-button" value="' . wfMsg( 'ur-remove' ) . '" size="20" onclick="document.form1.submit()" />
<input type="button" class="site-button" value="' . wfMsg( 'ur-cancel' ) . '" size="20" onclick="history.go(-1)" />
</div>
<div class="cleared"></div>
</div>
</form>';
return $form;
}
示例12: wfUpdateStatus
function wfUpdateStatus( $user_id, $user_name, $text, $date, $next_row ) {
$user = User::newFromId( $user_id );
// Don't do anything if the user is blocked or the DB is read-only
if ( $user->isBlocked() || wfReadOnly() ) {
return '';
}
// Get a database handler
$dbw = wfGetDB( DB_MASTER );
// Write new data to user_status
$dbw->insert(
'user_status',
array(
'us_user_id' => $user_id,
'us_user_name' => $user_name,
'us_text' => $text,
'us_date' => $date,
),
__METHOD__
);
// Grab all rows from user_status
$res = $dbw->select(
'user_status',
array(
'us_user_id', 'us_user_name', 'us_text',
'UNIX_TIMESTAMP(us_date) AS unix_time'
),
array( 'us_id' => intval( $next_row ) ),
__METHOD__
);
$x = 1;
foreach ( $res as $row ) {
$db_user_id = $row->us_user_id;
$db_user_name = $row->us_user_name;
$db_status_text = $row->us_text;
$user_status_date = $row->unix_time;
$avatar = new wAvatar( $db_user_id, 'ml' );
$userTitle = Title::makeTitle( NS_USER, $db_user_name );
$output .= "<div class=\"user-status-row\">
{$avatar->getAvatarURL()}
<a href=\"{$userTitle->escapeFullURL()}\"><b>{$db_user_name}</b></a> {$db_status_text}
<span class=\"user-status-date\">" .
wfMsg( 'userstatus-just-added' ) .
'</span>
</div>';
$x++;
}
return $output;
}
示例13: showHeader
//.........这里部分代码省略.........
<ul class="hub-selection anime-link">
<li><a href="http://cardcaptorsakura.huiji.wiki/">小樱的封印之书</a></li>
<li><a href="http://kaiji.huiji.wiki">逆境无赖</a></li>
<li><a href="http://gundam.huiji.wiki">高达</a></li>
</ul>
<ul class="hub-selection game-link">
<li><a href="http://gjqt.huiji.wiki">古剑奇谭</a></li>
<li><a href="http://hearthstone.huiji.wiki">炉石传说</a></li>
<li><a href="http://assassinscreed.huiji.wiki">刺客信条</a></li>
<li><a href="http://3pz.huiji.wiki">三国志puzzle大战</a></li>
<li><a href="http://pvz.huiji.wiki">植物大战僵尸</a></li>
<li><a href="http://bravely.huiji.wiki">勇气默示录中文百科</a></li>
</ul>
<ul class="hub-selection star-link">
<li><a href="http://tfboys.huiji.wiki">TFBOYS</a></li>
<li><a href="http://mfassbender.huiji.wiki">迈克尔·法斯宾德</a></li>
</ul>
<ul class="hub-selection more-link">
<li><a href="http://kaixinmahua.huiji.wiki">开心麻花</a></li>
<li><a href="http://mahjong.huiji.wiki">麻将</a></li>
<li><a href="http://arsenal.huiji.wiki">阿森纳</a></li>
<li><a href="http://www.huiji.wiki/wiki/%E7%89%B9%E6%AE%8A:%E7%AB%99%E7%82%B9%E6%8E%92%E8%A1%8C">站点排行榜</a></li>
<a rel="nofollow" href="/wiki/Special:Randomwiki" class="wiki-random">
随机一下试试
</a>
</ul>
</li>
</ul>
</li>
<li>
<a rel="nofollow" href="http://www.huiji.wiki/wiki/创建新wiki">创建wiki</a>
</li>
<li class="hidden-xs hidden-sm">
<a rel="nofollow" href="http://www.huiji.wiki/wiki/%E5%B8%AE%E5%8A%A9:%E7%BC%96%E8%BE%91%E6%89%8B%E5%86%8C">帮助文档</a>
</li>
</ul>';
if ($wgUser->isLoggedIn()) {
if (count($this->data['personal_urls']) > 0) {
$avatar = new wAvatar($wgUser->getID(), 'l');
// $user_icon = '<span class="user-icon"><img src="https://secure.gravatar.com/avatar/'.md5(strtolower( $wgUser->getEmail())).'.jpg?s=20&r=g"/></span>';
$user_icon = '<i class="fa fa-cog"></i>';
$name = $wgUser->getName();
$personal_urls = $this->data['personal_urls'];
unset($personal_urls['uls']);
unset($personal_urls['notifications-alert']);
unset($personal_urls['notifications-message']);
unset($personal_urls['userpage']);
$user_nav = $this->dropdownAdapter($personal_urls, $user_icon, 'user');
$user_notify = $this->nav_notification($this->notificationAdapter($this->data['personal_urls']));
}
$userPage = Title::makeTitle(NS_USER, $wgUser->getName());
$userPageURL = htmlspecialchars($userPage->getFullURL());
/*$avatar = new wAvatar( $wgUser->getID(), 'l' );*/
$output .= '<ul' . $this->html('userlangattributes') . ' class="nav navbar-nav navbar-right navbar-user">';
$output .= '<li><a href="' . $userPageURL . '"><span class="user-icon" style="border: 0px;">' . $avatar->getAvatarURL() . '</span><span class="hidden-xs">' . $wgUser->getName() . '</span></a></li>';
$output .= $user_notify;
$output .= '<li class="dropdown collect"><a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-heart-o"></i></i></a><ul class="dropdown-menu collect-menu">';
$sites = UserSiteFollow::getFullFollowedSitesWithDetails($wgUser->getId(), $wgUser->getId());
$count = count($sites);
if ($count > 0) {
$num = $count > 8 ? 8 : $count;
foreach ($sites as $user) {
$site_name[] = $user['val'];
$domain_name[] = $user['key'];
}
for ($i = 0; $i < $num; $i++) {
$output .= '<li><a href=http://' . $domain_name[$i] . '.huiji.wiki>' . $site_name[$i] . '</a></li>';
}
if ($count > 3) {
$output .= '<li><a rel="nofollow" href="/index.php?title=Special:ShowFollowedSites&user_id=' . $wgUser->getID() . '&target_user_id=' . $wgUser->getID() . '">我关注的全部维基</a></li>';
}
} else {
$output .= '<li><a>暂无</a></li>';
}
$output .= '</ul></li>';
$output .= $user_nav;
$output .= '</ul>';
} else {
// else if is logged in
//old login
$output .= '<ul class="nav navbar-nav navbar-right navbar-login">
<li id= "pt-login" data-toggle="modal" data-target=".user-login">
<a rel="nofollow" class="login-in">登录</a>
</li>
<li>' . Linker::linkKnown(SpecialPage::getTitleFor('Userlogin'), '注册', array('id' => 'pt-createaccount'), array('type' => 'signup')) . '
</li>
</ul>';
}
$output .= '<form class="navbar-search navbar-form table-cell hidden-xs" action="/index.php" id="searchform" role="search">
<div>
<span class="fa fa-search navbar-search"></span>
<input class="form-control" type="search" name="search" placeholder="在' . $wgSitename . '内搜索" title="Search ' . $wgSitename . ' [ctrl-option-f]" accesskey="f" id="searchInput" autocomplete="off">
<input type="hidden" name="title" value="Special:Search">
</div>
</form>
</div>
</div>
</header>';
return $output;
}
示例14: execute
//.........这里部分代码省略.........
$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
// for grep: topawards-edit-title, topawards-vote-title,
// topawards-comment-title, topawards-recruit-title,
// topawards-friend-title
$wgOut->setPageTitle(
wfMsg( 'topawards-' . strtolower( $page_category ) . '-title' )
);
// Add CSS
$wgOut->addExtensionStyle( $wgSystemGiftsScripts . '/SystemGift.css' );
$output = '<div class="top-awards-navigation">
<h1>' . wfMsg( 'topawards-award-categories' ) . '</h1>';
$nav_x = 0;
// Build the award categories menu on the right side of the page
foreach ( $categories as $awardType ) {
// for grep: topawards-edits, topawards-votes,
// topawards-comments, topawards-recruits, topawards-friends
$msg = wfMsg(
'topawards-' .
strtolower( $awardType['category_name'] ) . 's'
);
if ( $nav_x == $category_number ) {
$output .= "<p><b>{$msg}</b></p>";
} else {
$output .= '<p><a href="' . $this->getTitle()->escapeFullURL(
"category={$nav_x}" ) . "\">{$msg}</a></p>";
}
$nav_x++;
}
$output .= '</div>';
$output .= '<div class="top-awards">';
// Display a "no results" message if we got no results -- because it's
// a lot nicer to display something rather than a half-empty page
if ( $dbr->numRows( $res ) <= 0 ) {
$output .= wfMsg( 'topawards-empty' );
} else {
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;
$lower = strtolower( $categories[$category_number]['category_name'] );
// for grep: topawards-edit-milestone, topawards-vote-milestone,
// topawards-comment-milestone, topawards-recruit-milestone,
// topawards-friend-milestone
$gift_name = wfMsgExt(
'topawards-' . $lower . '-milestone',
'parsemag',
$top_gift
);
if ( $gift_name !== $gift_name_check ) {
$x = 1;
$output .= "<div class=\"top-award-title\">
{$gift_name}
</div>";
} else {
$x++;
}
$userLink = $wgUser->getSkin()->link(
Title::makeTitle( NS_USER, $row->sg_user_name ),
$user_name
);
$output .= "<div class=\"top-award\">
<span class=\"top-award-number\">{$x}.</span>
{$avatar->getAvatarURL()}
{$userLink}
</div>";
$gift_name_check = $gift_name;
}
}
$output .= '</div>
<div class="cleared"></div>';
$wgOut->addHTML( $output );
}
示例15: execute
//.........这里部分代码省略.........
if ( $gift['status'] == 1 ) {
if ( $gift['user_name_to'] == $wgUser->getName() ) {
$g = new UserGifts( $gift['user_name_to'] );
$g->clearUserGiftStatus( $gift['id'] );
$g->decNewGiftCount( $wgUser->getID() );
}
}
// DB stuff
$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select(
'user_gift',
array( 'DISTINCT ug_user_name_to', 'ug_user_id_to', 'ug_date' ),
array(
'ug_gift_id' => $gift['gift_id'],
"ug_user_name_to <> '" . addslashes( $gift['user_name_to'] ) . "'"
),
__METHOD__,
array(
'GROUP BY' => 'ug_user_name_to',
'ORDER BY' => 'ug_date DESC',
'LIMIT' => 6
)
);
$wgOut->setPageTitle( wfMsgExt(
'g-description-title',
'parsemag',
$gift['user_name_to'],
$gift['name']
) );
$output = '<div class="back-links">
<a href="' . Title::makeTitle( NS_USER, $gift['user_name_to'] )->escapeFullURL() . '">'
. wfMsg( 'g-back-link', $gift['user_name_to'] ) . '</a>
</div>';
$user = Title::makeTitle( NS_USER, $gift['user_name_from'] );
$removeGiftLink = SpecialPage::getTitleFor( 'RemoveGift' );
$giveGiftLink = SpecialPage::getTitleFor( 'GiveGift' );
$giftImage = '<img src="' . $wgUploadPath . '/awards/' .
Gifts::getGiftImage( $gift['gift_id'], 'l' ) .
'" border="0" alt="" />';
$message = $wgOut->parse( trim( $gift['message'] ), false );
$output .= '<div class="g-description-container">';
$output .= '<div class="g-description">' .
$giftImage .
'<div class="g-name">' . $gift['name'] . '</div>
<div class="g-timestamp">(' . $gift['timestamp'] . ')</div>
<div class="g-from">' . wfMsg(
'g-from',
$user->escapeFullURL(),
$gift['user_name_from']
) . '</div>';
if ( $message ) {
$output .= '<div class="g-user-message">' . $message . '</div>';
}
$output .= '<div class="cleared"></div>
<div class="g-describe">' . $gift['description'] . '</div>
<div class="g-actions">
<a href="' . $giveGiftLink->escapeFullURL( 'gift_id=' . $gift['gift_id'] ) . '">' .
wfMsg( 'g-to-another' ) . '</a>';
if ( $gift['user_name_to'] == $wgUser->getName() ) {
$output .= wfMsgExt( 'pipe-separator', 'escapenoentities' );
$output .= '<a href="' . $removeGiftLink->escapeFullURL( 'gift_id=' . $gift['id'] ) . '">' .
wfMsg( 'g-remove-gift' ) . '</a>';
}
$output .= '</div>
</div>';
$output .= '<div class="g-recent">
<div class="g-recent-title">' .
wfMsg( 'g-recent-recipients' ) .
'</div>
<div class="g-gift-count">' .
wfMsgExt( 'g-given', 'parsemag', $gift['gift_count'] ) .
'</div>';
foreach ( $res as $row ) {
$userToId = $row->ug_user_id_to;
$avatar = new wAvatar( $userToId, 'ml' );
$userNameLink = Title::makeTitle( NS_USER, $row->ug_user_name_to );
$output .= '<a href="' . $userNameLink->escapeFullURL() . "\">
{$avatar->getAvatarURL()}
</a>";
}
$output .= '<div class="cleared"></div>
</div>
</div>';
$wgOut->addHTML( $output );
} else {
$wgOut->setPageTitle( wfMsg( 'g-error-title' ) );
$wgOut->addHTML( wfMsg( 'g-error-message-invalid-link' ) );
}
}