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


PHP wAvatar::getAvatarImage方法代码示例

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


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

示例1: 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 != "&lt;topusersheader&gt;") {
         $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

示例2: 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

示例3: 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

示例4: 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>&nbsp;</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

示例5: 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

示例6: 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

示例7: 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

示例8: footer

    /**
     * Returns the footer for a page
     *
     * @return $footer The generated footer, including recent editors
     */
    function footer()
    {
        global $wgMemc, $wgTitle, $wgUploadPath;
        $title = Title::makeTitle($wgTitle->getNamespace(), $wgTitle->getText());
        $pageTitleId = $wgTitle->getArticleID();
        $main_page = Title::newMainPage();
        $about = Title::makeTitle(wfMsgForContent('aboutpage'));
        $special = SpecialPage::getTitleFor('Specialpages');
        $help = SpecialPage::getTitleFor('Userlogin', 'signup');
        $disclaimerPage = Title::newFromText(wfMsgForContent('disclaimerpage'));
        $footerShow = array(NS_MAIN, NS_FILE);
        if (defined('NS_VIDEO')) {
            $footerShow[] = NS_VIDEO;
        }
        $footer = '';
        // Show the list of recent editors and their avatars if the page is in
        // one of the allowed namespaces and it is not the main page
        if (in_array($wgTitle->getNamespace(), $footerShow) && $pageTitleId != $main_page->getArticleID()) {
            $key = wfMemcKey('recenteditors', 'list', $pageTitleId);
            $data = $wgMemc->get($key);
            $editors = array();
            if (!$data) {
                wfDebug(__METHOD__ . ": Loading recent editors for page {$pageTitleId} from DB\n");
                $dbw = wfGetDB(DB_MASTER);
                $res = $dbw->select('revision', array('DISTINCT rev_user', 'rev_user_text'), array('rev_page' => $pageTitleId, 'rev_user <> 0', "rev_user_text <> 'MediaWiki default'"), __METHOD__, array('ORDER BY' => 'rev_user_text ASC', 'LIMIT' => 8));
                foreach ($res as $row) {
                    // Prevent blocked users from appearing
                    $user = User::newFromId($row->rev_user);
                    if (!$user->isBlocked()) {
                        $editors[] = array('user_id' => $row->rev_user, 'user_name' => $row->rev_user_text);
                    }
                }
                $wgMemc->set($key, $editors, 60 * 5);
            } else {
                wfDebug(__METHOD__ . ": Loading recent editors for page {$pageTitleId} from cache\n");
                $editors = $data;
            }
            $x = 1;
            $per_row = 4;
            if (count($editors) > 0) {
                $footer .= '<div id="footer-container">
					<div id="footer-actions">
						<h2>' . wfMsg('nimbus-contribute') . '</h2>' . wfMsgExt('nimbus-pages-can-be-edited', 'parsemag') . '<a href="' . $title->escapeFullURL($this->skin->editUrlOptions()) . '" rel="nofollow" class="edit-action">' . wfMsg('editthispage') . '</a>
						<a href="' . $title->getTalkPage()->escapeFullURL() . '" rel="nofollow" class="discuss-action">' . wfMsg('talkpage') . '</a>
						<a href="' . $title->escapeFullURL('action=history') . '" rel="nofollow" class="page-history-action">' . wfMsg('pagehist') . '</a>';
                $footer .= '</div>';
                // Only load the page editors' avatars if wAvatar class exists and $wgUserLevels is an array
                global $wgUserLevels;
                if (class_exists('wAvatar') && is_array($wgUserLevels)) {
                    $footer .= '<div id="footer-contributors">
						<h2>' . wfMsg('nimbus-recent-contributors') . '</h2>' . wfMsg('nimbus-recent-contributors-info');
                    foreach ($editors as $editor) {
                        $avatar = new wAvatar($editor['user_id'], 'm');
                        $user_title = Title::makeTitle(NS_USER, $editor['user_name']);
                        $footer .= '<a href="' . $user_title->escapeFullURL() . '" rel="nofollow">
							<img src="' . $wgUploadPath . '/avatars/' . $avatar->getAvatarImage() . '" alt="' . htmlspecialchars($editor['user_name']) . '" title="' . htmlspecialchars($editor['user_name']) . '" />
						</a>';
                        if ($x == count($editors) || $x != 1 && $x % $per_row == 0) {
                            $footer .= '<br />';
                        }
                        $x++;
                    }
                    $footer .= '</div>';
                }
                $footer .= '</div>';
            }
        }
        $footer .= '<div id="footer-bottom">
			<a href="' . $main_page->escapeLocalURL() . '" rel="nofollow">' . wfMsg('mainpage') . '</a>
			<a href="' . $about->escapeLocalURL() . '" rel="nofollow">' . wfMsg('about') . '</a>
			<a href="' . $special->escapeLocalURL() . '" rel="nofollow">' . wfMsg('specialpages') . '</a>
			<a href="' . $help->escapeLocalURL() . '" rel="nofollow">' . wfMsg('help') . '</a>
			<a href="' . $disclaimerPage->escapeLocalURL() . '" rel="nofollow">' . wfMsg('disclaimers') . '</a>';
        // "Advertise" link on the footer, but only if a URL has been specified
        // in the MediaWiki:Nimbus-advertise-url system message
        $adURL = trim(wfMsgForContent('nimbus-advertise-url'));
        if (!wfEmptyMsg('nimbus-advertise-url', $adURL)) {
            $footer .= '<a href="' . $adURL . '" rel="nofollow">' . wfMsg('nimbus-advertise') . '</a>';
        }
        $footer .= '</div>' . "\n";
        return $footer;
    }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:87,代码来源:Nimbus.skin.php

示例9: execute

    /**
     * Show the special page
     *
     * @param $par Mixed: parameter passed to the page or null
     */
    public function execute($par)
    {
        global $wgRequest, $wgUser, $wgOut, $wgMemc, $wgUserStatsTrackWeekly, $wgUserStatsTrackMonthly, $wgUserLevels, $wgUploadPath, $wgScriptPath;
        // Load CSS
        $wgOut->addExtensionStyle($wgScriptPath . '/extensions/SocialProfile/UserStats/TopList.css');
        $periodFromRequest = $wgRequest->getVal('period');
        if ($periodFromRequest == 'weekly') {
            $period = 'weekly';
        } elseif ($periodFromRequest == 'monthly') {
            $period = 'monthly';
        }
        if (!isset($period)) {
            $period = 'weekly';
        }
        if ($period == 'weekly') {
            $wgOut->setPageTitle(wfMsg('user-stats-weekly-title'));
        } else {
            $wgOut->setPageTitle(wfMsg('user-stats-monthly-title'));
        }
        $count = 50;
        $user_list = array();
        // Try cache
        $key = wfMemcKey('user_stats', $period, 'points', $count);
        $data = $wgMemc->get($key);
        if ($data != '') {
            wfDebug("Got top users by {$period} points ({$count}) from cache\n");
            $user_list = $data;
        } else {
            wfDebug("Got top users by {$period} points ({$count}) from DB\n");
            $params['ORDER BY'] = 'up_points DESC';
            $params['LIMIT'] = $count;
            $dbr = wfGetDB(DB_SLAVE);
            $res = $dbr->select("user_points_{$period}", array('up_user_id', 'up_user_name', 'up_points'), array('up_user_id <> 0'), __METHOD__, $params);
            foreach ($res as $row) {
                $user_list[] = array('user_id' => $row->up_user_id, 'user_name' => $row->up_user_name, 'points' => $row->up_points);
            }
            $wgMemc->set($key, $user_list, 60 * 5);
        }
        // Top nav bar
        $top_title = SpecialPage::getTitleFor('TopUsers');
        $recent_title = SpecialPage::getTitleFor('TopUsersRecent');
        $out = '<div class="top-fan-nav">
			<h1>' . wfMsg('top-fans-by-points-nav-header') . '</h1>
			<p><a href="' . $top_title->escapeFullURL() . '">' . wfMsg('top-fans-total-points-link') . '</a></p>';
        if ($period == 'weekly') {
            $out .= '<p><a href="' . $recent_title->escapeFullURL('period=monthly') . '">' . wfMsg('top-fans-monthly-points-link') . '</a><p>
			<p><b>' . wfMsg('top-fans-weekly-points-link') . '</b></p>';
        } else {
            $out .= '<p><b>' . wfMsg('top-fans-monthly-points-link') . '</b><p>
			<p><a href="' . $recent_title->escapeFullURL('period=weekly') . '">' . wfMsg('top-fans-weekly-points-link') . '</a></p>';
        }
        // Build nav of stats by category based on MediaWiki:Topfans-by-category
        $by_category_title = SpecialPage::getTitleFor('TopFansByStatistic');
        $nav = array();
        $lines = explode("\n", wfMsgForContent('topfans-by-category'));
        if (count($lines) > 0) {
            $out .= '<h1 style="margin-top:15px !important;">' . wfMsg('top-fans-by-category-nav-header') . '</h1>';
        }
        foreach ($lines as $line) {
            if (strpos($line, '*') !== 0) {
                continue;
            } else {
                $line = explode('|', trim($line, '* '), 2);
                $stat = $line[0];
                $link_text = $line[1];
                $out .= '<p><a href="' . $by_category_title->escapeFullURL("stat={$stat}") . '">' . $link_text . '</a></p>';
            }
        }
        $out .= '</div>';
        $x = 1;
        $out .= '<div class="top-users">';
        foreach ($user_list as $user) {
            $user_title = Title::makeTitle(NS_USER, $user['user_name']);
            $avatar = new wAvatar($user['user_id'], 'm');
            $commentIcon = $avatar->getAvatarImage();
            $out .= '<div class="top-fan-row">
				<span class="top-fan-num">' . $x . '.</span>
				<span class="top-fan">
					<img src="' . $wgUploadPath . '/avatars/' . $commentIcon . '" alt="" border="" />
					<a href="' . $user_title->escapeFullURL() . '" >' . $user['user_name'] . '</a>
				</span>';
            $out .= '<span class="top-fan-points"><b>' . number_format($user['points']) . '</b> ' . wfMsg('top-fans-points') . '</span>';
            $out .= '<div class="cleared"></div>';
            $out .= '</div>';
            $x++;
        }
        $out .= '</div><div class="cleared"></div>';
        $wgOut->addHTML($out);
    }
开发者ID:kghbln,项目名称:semantic-social-profile,代码行数:94,代码来源:TopFansRecent.php

示例10: recentEditors

    /**
     * Get the avatars of the people who recently edited this blog post, if
     * this feature is enabled in BlogPage config.
     *
     * @return String: HTML or nothing
     */
    function recentEditors()
    {
        global $wgUploadPath, $wgBlogPageDisplay;
        if ($wgBlogPageDisplay['recent_editors'] == false) {
            return '';
        }
        $editors = $this->getEditorsList();
        $output = '';
        if (count($editors) > 0) {
            $output .= '<div class="recent-container">
			<h2>' . wfMsg('blog-recent-editors') . '</h2>
			<div>' . wfMsg('blog-recent-editors-message') . '</div>';
            foreach ($editors as $editor) {
                $avatar = new wAvatar($editor['user_id'], 'm');
                $userTitle = Title::makeTitle(NS_USER, $editor['user_name']);
                $output .= '<a href="' . $userTitle->escapeFullURL() . "\"><img src=\"{$wgUploadPath}/avatars/{$avatar->getAvatarImage()}\" alt=\"" . $userTitle->getText() . '" border="0" /></a>';
            }
            $output .= '</div>';
        }
        return $output;
    }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:27,代码来源:BlogPage.php

示例11: printGuyPicture

 /**
  * search for avatar of the username $editorName.
  *
  * If the avatar is in jpg and the option $wgCollaborationDiagramConvertToPNG set to true then
  * all avatars that are not in PNG will be converted to PNG with ImageMagick program set in $wgImageMagickConvertCommand variable
  * @param  $editorName
  * @return string
  */
 private function printGuyPicture($editorName)
 {
     $user = User::newFromName($editorName);
     if ($user == false) {
         return '';
     } else {
         global $IP, $wgCollaborationDiagramConvertToPNG, $wgImageMagickConvertCommand, $wgUseImageMagick;
         $avatar = new wAvatar($user->getId(), 'l');
         $tmpArr = explode('?r=', $avatar->getAvatarImage());
         $avatarImage = $tmpArr[0];
         $avatarWithPath = "{$IP}/images/avatars/{$avatarImage}";
         if ($wgCollaborationDiagramConvertToPNG == true && $wgUseImageMagick == true && isset($wgImageMagickConvertCommand)) {
             exec($wgImageMagickConvertCommand . " " . $avatarWithPath . " " . substr_replace($avatarWithPath, 'png', -3));
             ///probably code injection possible here!!!
             $avatarWithPath = substr_replace($avatarWithPath, 'png', -3);
         }
         $pictureWithLabel = "[label=<\n<table border=\"0\">\n <tr>\n  <td><img src=\"{$avatarWithPath}\" /></td>\n </tr>\n <tr>\n  <td>{$editorName}</td>\n </tr>\n</table>>]";
         return $this->drawUserNode($editorName) . $pictureWithLabel;
     }
 }
开发者ID:mediawiki-extensions,项目名称:collaborationgraph,代码行数:28,代码来源:CollaborationDiagram.php

示例12: setFile

 private function setFile($file)
 {
     global $wgUploadDirectory, $wgAvatarKey, $wgMemc, $wgUser, $wgSiteAvatarKey, $wgHuijiPrefix;
     if (!$this->isUserAvatar) {
         $uid = $wgHuijiPrefix;
         $avatarKey = $wgSiteAvatarKey;
         $avatar = new wSiteAvatar($uid, 'l');
     } else {
         $uid = $wgUser->getId();
         $avatarKey = $wgAvatarKey;
         $avatar = new wAvatar($uid, 'l');
     }
     // $dest = $this->avatarUploadDirectory;
     $imageInfo = getimagesize($file->getTempName());
     $errorCode = $file->getError();
     if ($errorCode === UPLOAD_ERR_OK) {
         $type = exif_imagetype($file->getTempName());
         if ($type) {
             $extension = image_type_to_extension($type);
             $src = $this->avatarUploadDirectory . '/' . date('YmdHis') . '.original' . $extension;
             if ($type == IMAGETYPE_GIF || $type == IMAGETYPE_JPEG || $type == IMAGETYPE_PNG) {
                 if (file_exists($src)) {
                     unlink($src);
                 }
                 // If this is the user's first custom avatar, update statistics (in
                 // case if we want to give out some points to the user for uploading
                 // their first avatar)
                 if ($this->isUserAvatar && strpos($avatar->getAvatarImage(), 'default_') !== false) {
                     $stats = new UserStatsTrack($uid, $wgUser->getName());
                     $stats->incStatField('user_image');
                 }
                 $this->createThumbnail($file->getTempName(), $imageInfo, $avatarKey . '_' . $uid . '_l', 200);
                 $this->createThumbnail($file->getTempName(), $imageInfo, $avatarKey . '_' . $uid . '_ml', 50);
                 $this->createThumbnail($file->getTempName(), $imageInfo, $avatarKey . '_' . $uid . '_m', 30);
                 $this->createThumbnail($file->getTempName(), $imageInfo, $avatarKey . '_' . $uid . '_s', 16);
                 switch ($imageInfo[2]) {
                     case 1:
                         $ext = 'gif';
                         break;
                     case 2:
                         $ext = 'jpg';
                         break;
                     case 3:
                         $ext = 'png';
                         break;
                     default:
                         return $this->msg = '请上传如下类型的图片: JPG, PNG, GIF(错误代码:14)';
                 }
                 $this->cleanUp($ext, $avatarKey, $uid);
                 /* I know this is bad but whatever */
                 $result = true;
                 if ($result) {
                     $this->src = $src;
                     $this->type = $type;
                     $this->extension = $extension;
                     //$this -> setDst();
                 } else {
                     $this->msg = '无法保存文件(错误代码:13)';
                 }
             } else {
                 $this->msg = '请上传如下类型的图片: JPG, PNG, GIF(错误代码:12)';
             }
         } else {
             $this->msg = '请上传一个图片文件(错误代码:11)';
         }
     } else {
         $this->msg = $this->codeToMessage($errorCode);
     }
 }
开发者ID:volvor,项目名称:SocialProfile,代码行数:69,代码来源:crop.php

示例13: performUpload

	/**
	 * Create the thumbnails and delete old files
	 */
	public function performUpload( $comment, $pageText, $watch, $user ) {
		global $wgUploadDirectory, $wgUser, $wgDBname, $wgMemc;

		$this->avatarUploadDirectory = $wgUploadDirectory . '/avatars';

		$imageInfo = getimagesize( $this->mTempPath );
		switch ( $imageInfo[2] ) {
			case 1:
				$ext = 'gif';
				break;
			case 2:
				$ext = 'jpg';
				break;
			case 3:
				$ext = 'png';
				break;
			default:
				return Status::newFatal( 'filetype-banned-type' );
		}

		$dest = $this->avatarUploadDirectory;

		$uid = $wgUser->getId();
		$avatar = new wAvatar( $uid, 'l' );
		// If this is the user's first custom avatar, update statistics (in
		// case if we want to give out some points to the user for uploading
		// their first avatar)
		if ( strpos( $avatar->getAvatarImage(), 'default_' ) !== false ) {
			$stats = new UserStatsTrack( $uid, $wgUser->getName() );
			$stats->incStatField( 'user_image' );
		}

		$this->createThumbnail( $this->mTempPath, $imageInfo, $wgDBname . '_' . $uid . '_l', 75 );
		$this->createThumbnail( $this->mTempPath, $imageInfo, $wgDBname . '_' . $uid . '_ml', 50 );
		$this->createThumbnail( $this->mTempPath, $imageInfo, $wgDBname . '_' . $uid . '_m', 30 );
		$this->createThumbnail( $this->mTempPath, $imageInfo, $wgDBname . '_' . $uid . '_s', 16 );

		if ( $ext != 'jpg' ) {
			if ( is_file( $this->avatarUploadDirectory . '/' . $wgDBname . '_' . $uid . '_s.jpg' ) ) {
				unlink( $this->avatarUploadDirectory . '/' . $wgDBname . '_' . $uid . '_s.jpg' );
			}
			if ( is_file( $this->avatarUploadDirectory . '/' . $wgDBname . '_' . $uid . '_m.jpg' ) ) {
				unlink( $this->avatarUploadDirectory . '/' . $wgDBname . '_' . $uid . '_m.jpg' );
			}
			if ( is_file( $this->avatarUploadDirectory . '/' . $wgDBname . '_' . $uid . '_l.jpg' ) ) {
				unlink( $this->avatarUploadDirectory . '/' . $wgDBname . '_' . $uid . '_l.jpg' );
			}
			if ( is_file( $this->avatarUploadDirectory . '/' . $wgDBname . '_' . $uid . '_ml.jpg' ) ) {
				unlink( $this->avatarUploadDirectory . '/' . $wgDBname . '_' . $uid . '_ml.jpg' );
			}
		}
		if ( $ext != 'gif' ) {
			if ( is_file( $this->avatarUploadDirectory . '/' . $wgDBname . '_' . $uid . '_s.gif' ) ) {
				unlink( $this->avatarUploadDirectory . '/' . $wgDBname . '_' . $uid . '_s.gif' );
			}
			if ( is_file( $this->avatarUploadDirectory . '/' . $wgDBname . '_' . $uid . '_m.gif' ) ) {
				unlink( $this->avatarUploadDirectory . '/' . $wgDBname . '_' . $uid . '_m.gif' );
			}
			if ( is_file( $this->avatarUploadDirectory . '/' . $wgDBname . '_' . $uid . '_l.gif' ) ) {
				unlink( $this->avatarUploadDirectory . '/' . $wgDBname . '_' . $uid . '_l.gif' );
			}
			if ( is_file( $this->avatarUploadDirectory . '/' . $wgDBname . '_' . $uid . '_ml.gif' ) ) {
				unlink( $this->avatarUploadDirectory . '/' . $wgDBname . '_' . $uid . '_ml.gif' );
			}
		}
		if ( $ext != 'png' ) {
			if ( is_file( $this->avatarUploadDirectory . '/' . $wgDBname . '_' . $uid . '_s.png' ) ) {
				unlink( $this->avatarUploadDirectory . '/' . $wgDBname . '_' . $uid . '_s.png' );
			}
			if ( is_file( $this->avatarUploadDirectory . '/' . $wgDBname . '_' . $uid . '_m.png' ) ) {
				unlink( $this->avatarUploadDirectory . '/' . $wgDBname . '_' . $uid . '_m.png' );
			}
			if ( is_file( $this->avatarUploadDirectory . '/' . $wgDBname . '_' . $uid . '_l.png' ) ) {
				unlink( $this->avatarUploadDirectory . '/' . $wgDBname . '_' . $uid . '_l.png' );
			}
			if ( is_file( $this->avatarUploadDirectory . '/' . $wgDBname . '_' . $uid . '_ml.png' ) ) {
				unlink( $this->avatarUploadDirectory . '/' . $wgDBname . '_' . $uid . '_ml.png' );
			}
		}

		$key = wfMemcKey( 'user', 'profile', 'avatar', $uid, 's' );
		$data = $wgMemc->delete( $key );

		$key = wfMemcKey( 'user', 'profile', 'avatar', $uid, 'm' );
		$data = $wgMemc->delete( $key );

		$key = wfMemcKey( 'user', 'profile', 'avatar', $uid , 'l' );
		$data = $wgMemc->delete( $key );

		$key = wfMemcKey( 'user', 'profile', 'avatar', $uid, 'ml' );
		$data = $wgMemc->delete( $key );

		$this->mExtension = $ext;
		return Status::newGood();
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:98,代码来源:SpecialUploadAvatar.php

示例14: getProfileComplete

	/**
	 * How many % of this user's profile is complete?
	 * Currently unused, I think that this might've been used in some older
	 * ArmchairGM code, but this looks useful enough to be kept around.
	 *
	 * @return Integer
	 */
	public function getProfileComplete() {
		global $wgUser;

		$complete_count = 0;

		// Check all profile fields
		$profile = $this->getProfile();
		foreach ( $this->profile_fields as $field ) {
			if ( $profile[$field] ) {
				$complete_count++;
			}
			$this->profile_fields_count++;
		}

		// Check if the user has a non-default avatar
		$this->profile_fields_count++;
		$avatar = new wAvatar( $wgUser->getID(), 'l' );
		if ( strpos( $avatar->getAvatarImage(), 'default_' ) === false ) {
			$complete_count++;
		}

		return round( $complete_count / $this->profile_fields_count * 100 );
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:30,代码来源:UserProfileClass.php

示例15: getProfileImage

    /**
     * This is currently unused, seems to be a leftover from the ArmchairGM
     * days.
     *
     * @param $user_name String: user name
     * @return String: HTML
     */
    function getProfileImage($user_name)
    {
        global $wgUser;
        $avatar = new wAvatar($this->user_id, 'l');
        $avatarTitle = SpecialPage::getTitleFor('UploadAvatar');
        $output = '<div class="profile-image">';
        if ($wgUser->getName() == $this->user_name) {
            if (strpos($avatar->getAvatarImage(), 'default_') != false) {
                $caption = 'upload image';
            } else {
                $caption = 'new image';
            }
            $output .= '<a href="' . htmlspecialchars($avatarTitle->getFullURL()) . '" rel="nofollow">' . $avatar->getAvatarURL() . '<br />
					(' . $caption . ')
				</a>';
        } else {
            $output .= $avatar->getAvatarURL();
        }
        $output .= '</div></div>';
        return $output;
    }
开发者ID:volvor,项目名称:SocialProfile,代码行数:28,代码来源:UserProfilePage.php


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