dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Read full memcached response before manipulating data
[lhc/web/wiklou.git]
/
includes
/
actions
/
CreditsAction.php
diff --git
a/includes/actions/CreditsAction.php
b/includes/actions/CreditsAction.php
index
2792e25
..
d0bc22c
100644
(file)
--- a/
includes/actions/CreditsAction.php
+++ b/
includes/actions/CreditsAction.php
@@
-29,12
+29,8
@@
class CreditsAction extends FormlessAction {
return 'credits';
}
return 'credits';
}
- public function getRestriction() {
- return null;
- }
-
protected function getDescription() {
protected function getDescription() {
- return
wfMsg( 'creditspage'
);
+ return
$this->msg( 'creditspage' )->escaped(
);
}
/**
}
/**
@@
-46,14
+42,14
@@
class CreditsAction extends FormlessAction {
wfProfileIn( __METHOD__ );
if ( $this->page->getID() == 0 ) {
wfProfileIn( __METHOD__ );
if ( $this->page->getID() == 0 ) {
- $s =
wfMsg( 'nocredits'
);
+ $s =
$this->msg( 'nocredits' )->parse(
);
} else {
$s = $this->getCredits( -1 );
}
wfProfileOut( __METHOD__ );
} else {
$s = $this->getCredits( -1 );
}
wfProfileOut( __METHOD__ );
- return
$s
;
+ return
Html::rawElement( 'div', array( 'id' => 'mw-credits' ), $s )
;
}
/**
}
/**
@@
-67,8
+63,8
@@
class CreditsAction extends FormlessAction {
wfProfileIn( __METHOD__ );
$s = '';
wfProfileIn( __METHOD__ );
$s = '';
- if (
isset( $cnt ) &&
$cnt != 0 ) {
- $s =
self::
getAuthor( $this->page );
+ if ( $cnt != 0 ) {
+ $s =
$this->
getAuthor( $this->page );
if ( $cnt > 1 || $cnt < 0 ) {
$s .= ' ' . $this->getContributors( $cnt - 1, $showIfMax );
}
if ( $cnt > 1 || $cnt < 0 ) {
$s .= ' ' . $this->getContributors( $cnt - 1, $showIfMax );
}
@@
-83,20
+79,20
@@
class CreditsAction extends FormlessAction {
* @param $article Article object
* @return String HTML
*/
* @param $article Article object
* @return String HTML
*/
- protected static function getAuthor( Page $article ) {
- global $wgLang;
-
- $user = User::newFromId( $article->getUser() );
+ protected function getAuthor( Page $article ) {
+ $user = User::newFromName( $article->getUserText(), false );
$timestamp = $article->getTimestamp();
if ( $timestamp ) {
$timestamp = $article->getTimestamp();
if ( $timestamp ) {
- $d = $wgLang->date( $article->getTimestamp(), true );
- $t = $wgLang->time( $article->getTimestamp(), true );
+ $lang = $this->getLanguage();
+ $d = $lang->date( $article->getTimestamp(), true );
+ $t = $lang->time( $article->getTimestamp(), true );
} else {
$d = '';
$t = '';
}
} else {
$d = '';
$t = '';
}
- return wfMessage( 'lastmodifiedatby', $d, $t )->rawParams( self::userLink( $user ) )->params( $user->getName() )->escaped();
+ return $this->msg( 'lastmodifiedatby', $d, $t )->rawParams(
+ $this->userLink( $user ) )->params( $user->getName() )->escaped();
}
/**
}
/**
@@
-106,7
+102,7
@@
class CreditsAction extends FormlessAction {
* @return String: html
*/
protected function getContributors( $cnt, $showIfMax ) {
* @return String: html
*/
protected function getContributors( $cnt, $showIfMax ) {
- global $wg
Lang, $wg
HiddenPrefs;
+ global $wgHiddenPrefs;
$contributors = $this->page->getContributors();
$contributors = $this->page->getContributors();
@@
-116,7
+112,8
@@
class CreditsAction extends FormlessAction {
if ( $cnt > 0 && $contributors->count() > $cnt ) {
$others_link = $this->othersLink();
if ( !$showIfMax )
if ( $cnt > 0 && $contributors->count() > $cnt ) {
$others_link = $this->othersLink();
if ( !$showIfMax )
- return wfMessage( 'othercontribs' )->rawParams( $others_link )->params( $contributors->count() )->escaped();
+ return $this->msg( 'othercontribs' )->rawParams(
+ $others_link )->params( $contributors->count() )->escaped();
}
$real_names = array();
}
$real_names = array();
@@
-125,16
+122,16
@@
class CreditsAction extends FormlessAction {
# Sift for real versus user names
foreach ( $contributors as $user ) {
# Sift for real versus user names
foreach ( $contributors as $user ) {
- $cnt--;
+ $cnt--;
if ( $user->isLoggedIn() ) {
if ( $user->isLoggedIn() ) {
- $link =
self::
link( $user );
+ $link =
$this->
link( $user );
if ( !in_array( 'realname', $wgHiddenPrefs ) && $user->getRealName() ) {
$real_names[] = $link;
} else {
$user_names[] = $link;
}
} else {
if ( !in_array( 'realname', $wgHiddenPrefs ) && $user->getRealName() ) {
$real_names[] = $link;
} else {
$user_names[] = $link;
}
} else {
- $anon_ips[] =
self::
link( $user );
+ $anon_ips[] =
$this->
link( $user );
}
if ( $cnt == 0 ) {
}
if ( $cnt == 0 ) {
@@
-142,22
+139,24
@@
class CreditsAction extends FormlessAction {
}
}
}
}
+ $lang = $this->getLanguage();
+
if ( count( $real_names ) ) {
if ( count( $real_names ) ) {
- $real = $
wgL
ang->listToText( $real_names );
+ $real = $
l
ang->listToText( $real_names );
} else {
$real = false;
}
# "ThisSite user(s) A, B and C"
if ( count( $user_names ) ) {
} else {
$real = false;
}
# "ThisSite user(s) A, B and C"
if ( count( $user_names ) ) {
- $user =
wfMessage( 'siteusers' )->rawParams( $wgL
ang->listToText( $user_names ) )->params(
+ $user =
$this->msg( 'siteusers' )->rawParams( $l
ang->listToText( $user_names ) )->params(
count( $user_names ) )->escaped();
} else {
$user = false;
}
if ( count( $anon_ips ) ) {
count( $user_names ) )->escaped();
} else {
$user = false;
}
if ( count( $anon_ips ) ) {
- $anon =
wfMessage( 'anonusers' )->rawParams( $wgL
ang->listToText( $anon_ips ) )->params(
+ $anon =
$this->msg( 'anonusers' )->rawParams( $l
ang->listToText( $anon_ips ) )->params(
count( $anon_ips ) )->escaped();
} else {
$anon = false;
count( $anon_ips ) )->escaped();
} else {
$anon = false;
@@
-174,8
+173,8
@@
class CreditsAction extends FormlessAction {
$count = count( $fulllist );
# "Based on work by ..."
return $count
$count = count( $fulllist );
# "Based on work by ..."
return $count
- ?
wfMessage
( 'othercontribs' )->rawParams(
- $
wgL
ang->listToText( $fulllist ) )->params( $count )->escaped()
+ ?
$this->msg
( 'othercontribs' )->rawParams(
+ $
l
ang->listToText( $fulllist ) )->params( $count )->escaped()
: '';
}
: '';
}
@@
-184,7
+183,7
@@
class CreditsAction extends FormlessAction {
* @param $user User object
* @return String: html
*/
* @param $user User object
* @return String: html
*/
- protected
static
function link( User $user ) {
+ protected function link( User $user ) {
global $wgHiddenPrefs;
if ( !in_array( 'realname', $wgHiddenPrefs ) && !$user->isAnon() ) {
$real = $user->getRealName();
global $wgHiddenPrefs;
if ( !in_array( 'realname', $wgHiddenPrefs ) && !$user->isAnon() ) {
$real = $user->getRealName();
@@
-196,10
+195,7
@@
class CreditsAction extends FormlessAction {
? SpecialPage::getTitleFor( 'Contributions', $user->getName() )
: $user->getUserPage();
? SpecialPage::getTitleFor( 'Contributions', $user->getName() )
: $user->getUserPage();
- return Html::rawElement( 'span',
- array( 'class' => 'mw-link-nowrap' ),
- Linker::link( $page, htmlspecialchars( $real ? $real : $user->getName() ) )
- );
+ return Linker::link( $page, htmlspecialchars( $real ? $real : $user->getName() ) );
}
/**
}
/**
@@
-207,32
+203,30
@@
class CreditsAction extends FormlessAction {
* @param $user User object
* @return String: html
*/
* @param $user User object
* @return String: html
*/
- protected
static
function userLink( User $user ) {
- $link =
self::
link( $user );
+ protected function userLink( User $user ) {
+ $link =
$this->
link( $user );
if ( $user->isAnon() ) {
if ( $user->isAnon() ) {
- return
wfMsgExt( 'anonuser', array( 'parseinline', 'replaceafter' ), $link
);
+ return
$this->msg( 'anonuser' )->rawParams( $link )->parse(
);
} else {
global $wgHiddenPrefs;
if ( !in_array( 'realname', $wgHiddenPrefs ) && $user->getRealName() ) {
return $link;
} else {
} else {
global $wgHiddenPrefs;
if ( !in_array( 'realname', $wgHiddenPrefs ) && $user->getRealName() ) {
return $link;
} else {
- return
wfMessage
( 'siteuser' )->rawParams( $link )->params( $user->getName() )->escaped();
+ return
$this->msg
( 'siteuser' )->rawParams( $link )->params( $user->getName() )->escaped();
}
}
}
/**
* Get a link to action=credits of $article page
}
}
}
/**
* Get a link to action=credits of $article page
- * @param $article Article object
- * @return String: html
+ * @return String: HTML link
*/
protected function othersLink() {
*/
protected function othersLink() {
- return Linker::link(
+ return Linker::link
Known
(
$this->getTitle(),
$this->getTitle(),
-
wfMsgHtml( 'others'
),
+
$this->msg( 'others' )->escaped(
),
array(),
array(),
- array( 'action' => 'credits' ),
- array( 'known' )
+ array( 'action' => 'credits' )
);
}
}
);
}
}