本文整理汇总了PHP中Avatar::getDefaultPicture方法的典型用法代码示例。如果您正苦于以下问题:PHP Avatar::getDefaultPicture方法的具体用法?PHP Avatar::getDefaultPicture怎么用?PHP Avatar::getDefaultPicture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Avatar
的用法示例。
在下文中一共展示了Avatar::getDefaultPicture方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLeaderboard
public function getLeaderboard(&$dbr)
{
global $wgUser;
$sk = $wgUser->getSkin();
$startdate = strtotime('7 days ago');
$starttimestamp = date('YmdG', $startdate) . floor(date('i', $startdate) / 10) . '00000';
$data = $this->getLeaderboardData($dbr, $starttimestamp);
$count = 0;
$leaderboardData = array();
foreach ($data as $key => $value) {
$u = new User();
$u->setName($key);
if ($value > 0 && $key != '' && $u->getName() != "WRM") {
$leaderboardData[$count] = array();
$img = Avatar::getPicture($u->getName(), true);
if ($img == '') {
$img = Avatar::getDefaultPicture();
}
$leaderboardData[$count]['img'] = $img;
$leaderboardData[$count]['user'] = $sk->makeLinkObj($u->getUserPage(), $u->getName());
$leaderboardData[$count]['count'] = $value;
$data[$key] = $value * -1;
$count++;
if ($count >= 6) {
break;
}
}
}
$html = "";
$count = 0;
foreach ($leaderboardData as $leader) {
if ($count == 0) {
$html .= "<tr class='first'>";
} else {
$html .= "<tr>";
}
$html .= "<td class='cd-avatar'>" . $leader['img'] . "</td>";
$html .= "<td class='cd-user'>" . $leader['user'] . "</td>";
$html .= "<td class='cd-count'>" . $leader['count'] . "</td>";
$html .= "</tr>";
$count++;
}
$jsondata = array();
$jsondata['leaderboard'] = $html;
return json_encode($jsondata);
}
示例2: getTopAuthorWidget
function getTopAuthorWidget()
{
global $wgUser;
$startdate = strtotime('7 days ago');
$starttimestamp = date('Ymd-G', $startdate) . '!' . floor(date('i', $startdate) / 10) . '00000';
$data = LeaderBoard::getArticlesWritten($starttimestamp);
arsort($data);
$html = "<h3>Top Authors - Last 7 Days</h3><table class='stleaders'>";
$index = 1;
$sk = $wgUser->getSkin();
foreach ($data as $key => $value) {
$u = new User();
$value = number_format($value, 0, "", ',');
$u->setName($key);
if ($value > 0 && $key != '') {
$class = "";
if ($index % 2 == 1) {
$class = 'class="odd"';
}
$img = Avatar::getPicture($u->getName(), true);
if ($img == '') {
$img = Avatar::getDefaultPicture();
}
$html .= "<tr {$class}>\n\t\t\t\t\t<td class='leader_image'>" . $img . "</td>\n\t\t\t\t\t<td class='leader_user'>" . $sk->makeLinkObj($u->getUserPage(), $u->getName()) . "</td>\n\t\t\t\t\t<td class='leader_count'><a href='/Special:Leaderboard/{$target}?action=articlelist&period={$period}&lb_name=" . $u->getName() . "' >{$value}</a> </td>\n\t\t\t\t</tr> ";
$data[$key] = $value * -1;
$index++;
}
if ($index > 6) {
break;
}
}
$html .= "</table>";
return $html;
}
示例3: execute
//.........这里部分代码省略.........
$data = $this->getThumbsUp($starttimestamp);
break;
case 'spellchecked':
$section = 'Writing';
$learnlink = '/wikiHow:Spellchecker';
$columnHeader = 'Articles Spell Checked';
$data = $this->getSpellchecked($starttimestamp);
break;
case 'methodguardian':
$section = 'Other';
$learnlink = '/wikiHow:LB-Method-Guardian';
$columnHeader = 'Methods Guarded';
$data = $this->getMethodGuardian($starttimestamp);
break;
case 'methodeditor':
$section = 'Other';
$learnlink = '/wikiHow:LB-Method-Editor';
$columnHeader = 'Methods Edited';
$data = $this->getMethodEditor($starttimestamp);
break;
case 'welcomewagon':
$section = 'Other';
$learnlink = '/wikiHow:LB-Welcome-Wagon';
$columnHeader = 'Welcome Wagon';
$data = $this->getWelcomeWagon($starttimestamp);
break;
default:
$wgOut->redirect($wgServer . "/Special:Leaderboard/articles_written");
return;
}
switch ($section) {
case 'Other':
$sectionStyleOther = "class='on'";
break;
case 'RCNAB':
$sectionStyleRCNAB = "class='on'";
break;
case 'Writing':
$sectionStyleWriting = "class='on'";
break;
case 'Greenhouse':
$sectionStyleGreenhouse = "class='on'";
break;
case "Imagevideo":
$sectionStyleImagevideo = "class='on'";
break;
}
// Vu Note: Due to the reskin adding elements above the articl_tab_line, I had use javascript to inject the tabs above the article_inner. hacky i know, but otherwise it would have to go into the skin which is worse.
$dropdown = " <span style='float:right;'>In the last <select id='period' onChange='changePeriod(this);'> <option {$period24selected} value='24'>24 hours</option> <option {$period7selected} value='7'>7 days</option> <option {$period31selected} value='31'>31 days</option> </select> </span>";
$tabs_main = "<ul id='tabs'><li><a href='/Special:Leaderboard/articles_written' {$sectionStyleWriting} >Writing</a></li><li><a href='/Special:Leaderboard/articles_nabed' {$sectionStyleRCNAB} >RC and NAB</a></li><li><a href='/Special:Leaderboard/repair_format' {$sectionStyleGreenhouse} >Greenhouse</a></li><li><a href='/Special:Leaderboard/images_added' {$sectionStyleImagevideo} >Images/Videos</a></li><li><a href='/Special:Leaderboard/total_edits' {$sectionStyleOther} >Other</a></li></ul>";
$tabs_sub = $this->getTabs($section, $target);
if ($action != 'articlelist') {
$tabs_sub .= "<div class='clearall'></div>";
}
$tab_sub .= "<div style='clear:both;'></div>";
$wgOut->addHTML("<div id='leaderboard_tabs'>{$dropdown}{$tabs_main}{$tabs_sub}</div>");
$wgOut->addHTML(" <style type='text/css' media='all'>/*<![CDATA[*/ @import '" . wfGetPad('/extensions/min/f/extensions/wikihow/winpop.css?rev=') . WH_SITEREV . "'; /*]]>*/</style>\n\t\t\t<script type='text/javascript' language='javascript' src='" . wfGetPad('/extensions/min/f/extensions/wikihow/winpop.js?rev=') . WH_SITEREV . "'></script>");
$wgOut->addHTML(" <script type='text/javascript'>\n\t\t\t\tvar lb_page = '{$target}';\n\t\t\t\tvar lb_period = '{$period}';\n\t\t\t</script>\n");
//
//MAIN PAGE SECTION
//
if ($action == 'articlelist') {
$u = User::newFromName($wgRequest->getVal('lb_name'));
if (isset($u)) {
$this->showArticlesPage($target, $period, $starttimestamp, $u->getName());
} else {
echo wfMsg('leaderboard-invalid-user');
}
return;
}
$wgOut->addHTML("<div id='Leaderboard' class='section_text'>\n\t\t\t<p class='leader_head'>Leaders: {$columnHeader}</p> <span class='leader_learn'><img src='" . wfGetPad('/skins/WikiHow/images/icon_help.jpg') . "'><a href='{$learnlink}'>Learn about this activity</a></span>\n\t\t");
$wgOut->addHTML("\n\t\t\t<table class='leader_table'>\n\t\t\t\t<tr> <td colspan='3' class='leader_title'>{$columnHeader}:</td> </tr> ");
$index = 1;
//display difference in only new articles
//don't sort nfd b/c numbers can be big and include "," so don't sort nicely
if ($target != 'rc_edits' && $target != 'nfd') {
arsort($data);
}
foreach ($data as $key => $value) {
$u = new User();
$u->setName($key);
if ($value > 0 && $key != '' && $u->getName() != "WRM") {
$class = "";
if ($index % 2 == 1) {
$class = 'class="odd"';
}
$img = Avatar::getPicture($u->getName(), true);
if ($img == '') {
$img = Avatar::getDefaultPicture();
}
$wgOut->addHTML("\n\t\t\t\t<tr {$class}>\n\t\t\t\t\t<td class='leader_image'>" . $img . "</td>\n\t\t\t\t\t<td class='leader_user'>" . $sk->makeLinkObj($u->getUserPage(), $u->getName()) . "</td>\n\t\t\t\t\t<td class='leader_count'><a href='/Special:Leaderboard/{$target}?action=articlelist&period={$period}&lb_name=" . $u->getName() . "' >{$value}</a> </td>\n\t\t\t\t</tr> ");
$data[$key] = $value * -1;
$index++;
}
if ($index > 20) {
break;
}
}
$wgOut->addHTML("</table></div>");
}
示例4: getUserInfo
/**
*
* For a given user id, returns the html
* for an avatar to be displayed on the right
* rail or in the info box
*
*/
static function getUserInfo($user_id)
{
if ($user_id) {
$u = new User();
$u->setID($user_id);
$img = Avatar::getAvatarURL($u->getName());
if ($img == '') {
$img = Avatar::getDefaultPicture();
} else {
$img = "<img src='{$img}' />";
}
$avatar = "<span><a href='{$u->getUserPage()->getFullURL()}' target='_blank' class='tooltip'>{$img}</a>";
$avatar .= "<span class='tooltip_span'>Hi, I'm {$u->getName()}</span></span>";
$avatar .= "<a target='new' href='{$u->getUserPage()->getFullURL()}'>{$u->getName()}</a>";
}
return $avatar;
}
示例5: displayContainer
/**
* Display the HTML for this special page with all the widgets in it
*/
private function displayContainer()
{
global $wgWidgetList, $wgUser, $wgWidgetShortCodes;
$containerJS = array('community-dashboard.js', 'dashboard-widget.js', 'jquery.ui.sortable.min.js', 'jquery.json-2.2.min.js');
$containerCSS = array('community-dashboard.css');
$jsTags = $this->makeUrlTags('js', $containerJS);
$cssTags = $this->makeUrlTags('css', $containerCSS);
// get all commonly updating stats, to see the initial widget
// displays with
$this->refreshData = $this->dashboardData->getStatsData();
// get all data such as wikihow-defined structure goals, dynamic
// global data, and user-specific data
$staticData = $this->dashboardData->loadStaticGlobalOpts();
$priorities = json_decode($staticData['cdo_priorities_json'], true);
if (!is_array($priorities)) {
$priorities = array();
}
$thresholds = json_decode($staticData['cdo_thresholds_json'], true);
DashboardWidget::setThresholds($thresholds);
$baselines = (array) json_decode($staticData['cdo_baselines_json']);
DashboardWidget::setBaselines($baselines);
DashboardWidget::setMaxUsernameLength(CommunityDashboard::USERNAME_MAX_LENGTH);
// display the user-defined ordering of widgets inside an outside
// container
$userData = $this->dashboardData->loadUserData();
$prefs = !empty($userData['prefs']) ? $userData['prefs'] : array();
$userOrdering = isset($prefs['ordering']) ? $prefs['ordering'] : array();
$completion = !empty($userData['completion']) ? $userData['completion'] : array();
DashboardWidget::setCompletion($completion);
// add any new widgets that have been added since the user last
// customized
foreach ($wgWidgetList as $name) {
$found = false;
foreach ($userOrdering as $arr) {
if ($arr['wid'] == $name) {
$found = true;
break;
}
}
if (!$found) {
$userOrdering[] = array('wid' => $name, 'show' => 1);
}
}
// create the user-defined ordering list, removing any community
// priority widgets from the list so their not displayed twice
$userWidgets = array();
foreach ($userOrdering as $arr) {
$found = false;
foreach ($priorities as $name) {
if ($arr['wid'] == $name) {
$found = true;
break;
}
}
if (!$found && $arr['show']) {
$userWidgets[] = $arr['wid'];
}
}
$func = array($this, 'displayWidgets');
$out = call_user_func($func, array('test'));
$langKeys = array('howto', 'cd-pause-updates', 'cd-resume-updates', 'cd-current-priority', 'cd-network-error');
$langScript = Wikihow_i18n::genJSMsgs($langKeys);
//TODO: Likely should move this somewhere else
//but not sure where yet
//load user specific info that only needs to be loaded
//once
if ($wgUser->getID() > 0) {
$u = new User();
$u->setID($wgUser->getID());
$img = Avatar::getPicture($u->getName(), true);
if ($img == '') {
$img = Avatar::getDefaultPicture();
}
$sk = $wgUser->getSkin();
$userName = $sk->makeLinkObj($u->getUserPage(), $u->getName());
$tipsLink = "/Special:TipsPatrol";
} else {
$tipsLink = "/Special:Userlogin?returnto=Special:TipsPatrol";
}
$tmpl = new EasyTemplate(dirname(__FILE__));
$tmpl->set_vars(array('jsTags' => $jsTags, 'cssTags' => $cssTags, 'thresholds' => $staticData['cdo_thresholds_json'], 'GLOBAL_DATA_REFRESH_TIME_SECS' => self::GLOBAL_DATA_REFRESH_TIME_SECS, 'USER_DATA_REFRESH_TIME_SECS' => self::USER_DATA_REFRESH_TIME_SECS, 'USERNAME_MAX_LENGTH' => self::USERNAME_MAX_LENGTH, 'widgetTitles' => DashboardData::getTitles(), 'priorityWidgets' => $priorities, 'userWidgets' => $userWidgets, 'prefsOrdering' => $userOrdering, 'userCounts' => $userData['counts'], 'userImage' => $img, 'userName' => $userName, 'displayWidgetsFunc' => array($this, 'displayWidgets'), 'appShortCodes' => $wgWidgetShortCodes, 'tipsLink' => $tipsLink));
$html = $tmpl->execute('dashboard-container.tmpl.php');
return $langScript . $html;
}
示例6: getUserAvatar
private function getUserAvatar($user, $guestId)
{
if ($user->isAnon()) {
// look for the guest_id cookie value to
// give them the right avatar image
$userAvatar = Avatar::getAnonAvatar($guestId);
return $userAvatar;
}
$avatar = Avatar::getPicture($user->getName(), false);
if ($avatar == '') {
$avatar = Avatar::getDefaultPicture();
}
$userName = Linker::linkKnown($user->getUserPage(), $user->getName());
$userAvatar = array("name" => $userName, "image" => $avatar);
return $userAvatar;
}
示例7: getReviewersTable
function getReviewersTable()
{
$rankings = self::getWeekRankings();
$table = "<table>";
$index = 0;
if (isset($rankings) && is_array($rankings)) {
foreach ($rankings as $u => $c) {
$u = User::newFromID($u);
$u->load();
$img = Avatar::getPicture($u->getName(), true);
if ($img == '') {
$img = Avatar::getDefaultPicture();
}
$table .= "<tr><td class='va_image'>{$img}</td><td class='va_reviewer'><a href='{$u->getUserPage()->getFullURL()}' target='new'>{$u->getName()}</a></td><td class='va_stat'>{$c}</td></tr>";
$index++;
if ($index == 5) {
break;
}
}
}
$table .= "</table>";
return $table;
}
示例8: getStandingsTable
/**
* getStandingsTable
* returns just the raw table for the standings, useful for ajax calls
**/
function getStandingsTable()
{
global $wgUser;
$fname = "StandingsGroup::getStandingsTable";
wfProfileIn($fname);
$display = "<table>";
$startdate = strtotime('7 days ago');
$starttimestamp = date('YmdG', $startdate) . floor(date('i', $startdate) / 10) . '00000';
$data = $this->getStandingsFromCache();
$count = 0;
foreach ($data as $key => $value) {
$u = new User();
$u->setName($key);
if ($value > 0 && $key != '') {
$img = Avatar::getPicture($u->getName(), true);
if ($img == '') {
$img = Avatar::getDefaultPicture();
}
$id = "";
if ($wgUser->getName() == $u->getName()) {
$id = "id='iia_stats_group'";
}
$display .= "<tr><td class='leader_image'>{$img}</td><td class='leader_name'>" . Linker::link($u->getUserPage(), $u->getName()) . "</td><td class='leader_count' {$id}>{$value}</td></tr>";
$count++;
}
if ($count > 5) {
break;
}
}
$display .= "\n\t\t</table>";
wfProfileOut($fname);
return $display;
}