本文整理汇总了PHP中UserStatus::getStatusMessages方法的典型用法代码示例。如果您正苦于以下问题:PHP UserStatus::getStatusMessages方法的具体用法?PHP UserStatus::getStatusMessages怎么用?PHP UserStatus::getStatusMessages使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserStatus
的用法示例。
在下文中一共展示了UserStatus::getStatusMessages方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wfGetUserStatusProfile
/**
* This function appears to be unused...I think it was used in ancient history.
*/
function wfGetUserStatusProfile( $user_id, $num ) {
global $wgScriptPath;
$s = new UserStatus();
$update = $s->getStatusMessages( $user_id, 0, 0, 1, $num );
$update = $update[0];
return SportsTeams::getLogo( $update['sport_id'], $update['team_id'], 's' ) .
"<img src=\"{$wgScriptPath}/extensions/UserStatus/quoteIcon.png\" border=\"0\" style=\"margin-left:5px;\" alt=\"\" />
{$update['text']}
<img src=\"{$wgScriptPath}/extensions/UserStatus/endQuoteIcon.png\" border=\"0\" alt=\"\" />
<span class=\"user-status-date\">" .
wfMsg( 'userstatus-ago', UserStatus::getTimeAgo( $update['timestamp'] ) ) .
'</span>';
}
示例2: execute
/**
* Show the special page
*
* @param $par Mixed: parameter passed to the special page or null
*/
public function execute( $par ) {
global $wgRequest, $wgOut, $wgUser, $wgScriptPath;
$messages_show = 25;
$updates_show = 25; // just an arbitrary value to stop PHP from complaining on 12 August 2011 --ashley
$output = '';
$sport_id = $wgRequest->getInt( 'sport_id' );
$team_id = $wgRequest->getInt( 'team_id' );
$page = $wgRequest->getInt( 'page', 1 );
if ( $team_id ) {
$team = SportsTeams::getTeam( $team_id );
$network_name = $team['name'];
} elseif ( $sport_id ) {
$sport = SportsTeams::getSport( $sport_id );
$network_name = $sport['name'];
} else {
// No sports ID nor team ID...bail out or we'll get a database
// error...
$wgOut->setPageTitle( wfMsg( 'userstatus-woops' ) );
$out = '<div class="relationship-request-message">' .
wfMsg( 'userstatus-invalid-link' ) . '</div>';
$out .= '<div class="relationship-request-buttons">';
$out .= '<input type="button" class="site-button" value="' .
wfMsg( 'mainpage' ) .
"\" onclick=\"window.location='" .
Title::newMainPage()->escapeFullURL() . "'\"/>";
/* removed because I was too lazy to port the error message over :P
if ( $wgUser->isLoggedIn() ) {
$out .= ' <input type="button" class="site-button" value="' .
wfMsg( 'st_network_your_profile' ) .
"\" onclick=\"window.location='" .
Title::makeTitle( NS_USER, $wgUser->getName() )->escapeFullURL() . "'\"/>";
}
*/
$out .= '</div>';
$wgOut->addHTML( $out );
return true;
}
$wgOut->setPageTitle( wfMsg( 'userstatus-network-thoughts', $network_name ) );
/**
* Config for the page
*/
$per_page = $messages_show;
$s = new UserStatus();
$total = $s->getNetworkUpdatesCount( $sport_id, $team_id );
$messages = $s->getStatusMessages(
0,
$sport_id,
$team_id,
$messages_show,
$page
);
$output .= '<div class="gift-links">';
$output .= '<a href="' .
SportsTeams::getNetworkURL( $sport_id, $team_id ) . '">' .
wfMsg( 'userstatus-back-to-network' ) . '</a>';
$output .= '</div>';
if( $page == 1 ) {
$start = 1;
} else {
$start = ( $page - 1 ) * $per_page + 1;
}
$end = $start + ( count( $messages ) ) - 1;
if( $total ) {
$output .= '<div class="user-page-message-top">
<span class="user-page-message-count" style="font-size: 11px; color: #666666;">' .
wfMsgExt( 'userstatus-showing-thoughts', 'parsemag', $start, $end, $total ) .
'</span>
</div>';
}
/**
* Build next/prev navigation
*/
$numofpages = $total / $per_page;
if( $numofpages > 1 ) {
$output .= '<div class="page-nav">';
if( $page > 1 ) {
$output .= '<a href="' .
SportsTeams::getFanUpdatesURL( $sport_id, $team_id ) .
'&page=' . ( $page - 1 ) . '">' . wfMsg( 'userstatus-prev' ) .
'</a> ';
}
if( ( $total % $per_page ) != 0 ) {
$numofpages++;
}
//.........这里部分代码省略.........
示例3: execute
/**
* Show the special page
*
* @param $par Mixed: parameter passed to the special page or null
*/
public function execute( $par ) {
global $wgRequest, $wgOut, $wgUser, $wgScriptPath;
$messages_show = 25;
$output = '';
$user_name = $wgRequest->getVal( 'user', $par );
$page = $wgRequest->getInt( 'page', 1 );
/**
* Redirect Non-logged in users to Login Page
* It will automatically return them to their Status page
*/
if( $wgUser->getID() == 0 && $user_name == '' ) {
$wgOut->setPageTitle( wfMsg( 'userstatus-woops' ) );
$login = SpecialPage::getTitleFor( 'Userlogin' );
$wgOut->redirect( $login->getFullURL( 'returnto=Special:UserStatus' ) );
return false;
}
/**
* If no user is set in the URL, we assume its the current user
*/
if( !$user_name ) {
$user_name = $wgUser->getName();
}
$user_id = User::idFromName( $user_name );
$user = Title::makeTitle( NS_USER, $user_name );
/**
* Error message for username that does not exist (from URL)
*/
if( $user_id == 0 ) {
$wgOut->setPageTitle( wfMsg( 'userstatus-woops' ) );
$wgOut->addHTML( wfMsg( 'userstatus-no-user' ) );
return false;
}
/**
* Config for the page
*/
$per_page = $messages_show;
$stats = new UserStats( $user_id, $user_name );
$stats_data = $stats->getUserStats();
$total = $stats_data['user_status_count'];
$s = new UserStatus();
$messages = $s->getStatusMessages( $user_id, 0, 0, $messages_show, $page );
if ( !( $wgUser->getName() == $user_name ) ) {
$wgOut->setPageTitle( wfMsg( 'userstatus-user-thoughts', $user_name ) );
} else {
$wgOut->setPageTitle( wfMsg( 'userstatus-your-thoughts' ) );
}
$output .= '<div class="gift-links">';
if ( !( $wgUser->getName() == $user_name ) ) {
$output .= "<a href=\"{$user->getFullURL()}\">" .
wfMsg( 'userstatus-back-user-profile', $user_name ) . '</a>';
} else {
$output .= '<a href="' . $wgUser->getUserPage()->getFullURL() . '">' .
wfMsg( 'userstatus-back-your-profile' ) . '</a>';
}
$output .= '</div>';
if( $page == 1 ) {
$start = 1;
} else {
$start = ( $page - 1 ) * $per_page + 1;
}
$end = $start + ( count( $messages ) ) - 1;
wfDebug( "total = {$total}" );
if( $total ) {
$output .= '<div class="user-page-message-top">
<span class="user-page-message-count" style="font-size: 11px; color: #666666;">' .
wfMsgExt( 'userstatus-showing-thoughts', 'parsemag', $start, $end, $total ) .
'</span>
</div>';
}
/**
* Build next/prev navigation
*/
$numofpages = $total / $per_page;
if( $numofpages > 1 ) {
$output .= '<div class="page-nav">';
if( $page > 1 ) {
$output .= '<a href="' . $this->getTitle()->getFullURL( array(
'user' => $user_name, 'page' => ( $page - 1 ) ) ) . '">' .
wfMsg( 'userstatus-prev' ) . '</a> ';
}
//.........这里部分代码省略.........
示例4: wfUserProfileLatestThought
function wfUserProfileLatestThought( $user_profile ) {
global $wgUser, $wgOut;
$user_id = $user_profile->user_id;
$s = new UserStatus();
$user_update = $s->getStatusMessages( $user_id, 0, 0, 1, 1 );
$user_update = ( !empty( $user_update[0] ) ? $user_update[0] : array() );
// Safe URLs
$more_thoughts_link = SpecialPage::getTitleFor( 'UserStatus' );
$thought_link = SpecialPage::getTitleFor( 'ViewThought' );
$output = '';
if ( $user_update ) {
$output .= '<div class="user-section-heading">
<div class="user-section-title">' .
wfMsg( 'sportsteams-profile-latest-thought' ) .
'</div>
<div class="user-section-actions">
<div class="action-right">
<a href="' . $more_thoughts_link->escapeFullURL( 'user=' . $user_profile->user_name ) .
'" rel="nofollow">' . wfMsg( 'sportsteams-profile-view-all' ) . '</a>
</div>
<div class="cleared"></div>
</div>
</div>';
$vote_count = $vote_link = '';
// If someone agrees with the most recent status update, show the count
// next to the timestamp to the owner of the status update
// After all, there's no point in showing "0 people agree with this"...
if(
$wgUser->getName() == $user_update['user_name'] &&
$user_update['plus_count'] > 0
)
{
$vote_count = wfMsgExt(
'sportsteams-profile-num-agree',
'parsemag',
$user_update['plus_count']
);
}
$view_thought_link = '<a href="' . $thought_link->escapeFullURL( "id={$user_update['id']}" ) .
"\" rel=\"nofollow\">{$vote_count}</a>";
// Allow registered users who are not owners of this status update to
// vote for it unless they've already voted; if they have voted, show
// the amount of people who agree with the status update
if( $wgUser->isLoggedIn() && $wgUser->getName() != $user_update['user_name'] ) {
if( !$user_update['voted'] ) {
$vote_link = "<a href=\"javascript:void(0);\" onclick=\"SportsTeamsUserProfile.voteStatus({$user_update['id']},1)\" rel=\"nofollow\">" .
wfMsg( 'sportsteams-profile-do-you-agree' ) . '</a>';
} else {
$vote_count = wfMsgExt(
'sportsteams-profile-num-agree',
'parsemag',
$user_update['plus_count']
);
}
}
$output .= '<div class="status-container" id="status-update">
<div id="status-update" class="status-message">' .
SportsTeams::getLogo( $user_update['sport_id'], $user_update['team_id'], 's' ) .
"{$user_update['text']}
</div>
<div class=\"user-status-profile-vote\">
<span class=\"user-status-date\">" .
wfMsg( 'sportsteams-profile-ago', SportsTeams::getTimeAgo( $user_update['timestamp'] ) ) .
"</span>
{$vote_link} {$view_thought_link}
</div>
</div>";
} else {
$output .= "<script type=\"text/javascript\">var __thoughts_text__ = \"" .
wfMsg( 'sportsteams-profile-latest-thought' ) . '";
var __view_all__ = "' . wfMsg( 'sportsteams-profile-view-all' ) . '";
var __more_thoughts_url__ = "' . $more_thoughts_link->escapeFullURL( 'user=' . $user_profile->user_name ) .
'";</script>';
}
$wgOut->addHTML( $output );
return true;
}