Index: trunk/extensions/WikimediaIncubator/SpecialRandomByTest.php |
— | — | @@ -1,26 +1,29 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | -* Special page to go to a random page in your test wiki |
| 4 | + * Special page to go to a random page in your test wiki |
| 5 | + * (or a specific wiki if it is defined through &testwiki=Wx/xx) |
| 6 | + * |
5 | 7 | * @file |
| 8 | + * @ingroup SpecialPage |
| 9 | + * @author Robin Pepermans (SPQRobin) |
6 | 10 | */ |
7 | 11 | |
8 | | -class SpecialRandomByTest extends RandomPage |
9 | | -{ |
| 12 | +class SpecialRandomByTest extends RandomPage { |
10 | 13 | public function __construct() { |
11 | 14 | global $wgUser, $wgRequest, $wmincPref, $wmincProjectSite; |
12 | 15 | $target = $wgRequest->getVal( 'testwiki' ); |
13 | 16 | $target = IncubatorTest::analyzePrefix( $target ); |
14 | | - $project = ( isset( $target['project'] ) ? $target['project'] : '' ); |
15 | | - $lang = ( isset( $target['lang'] ) ? $target['lang'] : '' ); |
16 | | - if( IncubatorTest::isContentProject() || ($project && $lang) ) { |
| 17 | + $project = isset( $target['project'] ) ? $target['project'] : ''; |
| 18 | + $lang = isset( $target['lang'] ) ? $target['lang'] : ''; |
| 19 | + if( IncubatorTest::isContentProject() || ( $project && $lang ) ) { |
17 | 20 | $dbr = wfGetDB( DB_SLAVE ); |
18 | 21 | $this->extra[] = 'page_title' . |
19 | 22 | $dbr->buildLike( IncubatorTest::displayPrefix( $project, $lang ) . '/', $dbr->anyString() ); |
20 | | - } elseif($wgUser->getOption($wmincPref . '-project') == $wmincProjectSite['short'] ) { |
| 23 | + } elseif( $wgUser->getOption($wmincPref . '-project') == $wmincProjectSite['short'] ) { |
21 | 24 | global $wgVersion; |
22 | | - // only works above MW 1.17 |
| 25 | + # only works above MW 1.17 |
23 | 26 | if( version_compare($wgVersion, '1.17', '>') ) { |
24 | | - // project or help namespace |
| 27 | + # project or help namespace |
25 | 28 | $this->extra['page_namespace'] = array( 4, 12 ); |
26 | 29 | } |
27 | 30 | } |
Index: trunk/extensions/WikimediaIncubator/SpecialViewUserLang.php |
— | — | @@ -7,10 +7,11 @@ |
8 | 8 | * Based on code from extension LookupUser made by Tim Starling |
9 | 9 | * |
10 | 10 | * @file |
| 11 | + * @ingroup SpecialPage |
| 12 | + * @author Robin Pepermans (SPQRobin) |
11 | 13 | */ |
12 | 14 | |
13 | | -class SpecialViewUserLang extends SpecialPage |
14 | | -{ |
| 15 | +class SpecialViewUserLang extends SpecialPage { |
15 | 16 | public function __construct() { |
16 | 17 | parent::__construct( 'ViewUserLang', 'viewuserlang' ); |
17 | 18 | } |
— | — | @@ -23,7 +24,6 @@ |
24 | 25 | */ |
25 | 26 | public function execute( $subpage ) { |
26 | 27 | global $wgRequest, $wgUser; |
27 | | - |
28 | 28 | |
29 | 29 | $this->setHeaders(); |
30 | 30 | |
— | — | @@ -67,7 +67,7 @@ |
68 | 68 | * @param $target Mixed: user whose language and test wiki we're looking up |
69 | 69 | */ |
70 | 70 | function showInfo( $target ) { |
71 | | - global $wgOut, $wmincPref, $wmincProjectSite; |
| 71 | + global $wgOut, $wmincPref, $wmincProjectSite, $wgUser; |
72 | 72 | $user = User::newFromName( $target ); |
73 | 73 | $name = $user->getName(); |
74 | 74 | $id = $user->getId(); |
— | — | @@ -81,7 +81,7 @@ |
82 | 82 | $usercode = $user->getOption( $wmincPref . '-code' ); |
83 | 83 | $prefix = IncubatorTest::displayPrefix( $userproject, $usercode ); |
84 | 84 | if ( IncubatorTest::isContentProject( $userproject ) ) { |
85 | | - $testwiki = Linker::link( Title::newFromText( $prefix ) ); |
| 85 | + $testwiki = $wgUser->getSkin()->link( Title::newFromText( $prefix ) ); |
86 | 86 | } elseif ( $prefix == $wmincProjectSite['short'] ) { |
87 | 87 | $testwiki = htmlspecialchars( $wmincProjectSite['name'] ); |
88 | 88 | } else { |
— | — | @@ -90,7 +90,7 @@ |
91 | 91 | $wgOut->addHtml( |
92 | 92 | Xml::openElement( 'ul' ) . |
93 | 93 | '<li>' . wfMsgHtml( 'username' ) . ' ' . |
94 | | - Linker::userLink( $id, $name ) . Linker::userToolLinks( $id, $name, true ) . '</li>' . |
| 94 | + $wgUser->getSkin()->userLink( $id, $name ) . $wgUser->getSkin()->userToolLinks( $id, $name, true ) . '</li>' . |
95 | 95 | '<li>' . wfMsgHtml( 'loginlanguagelabel', $langNames[$user->getOption( 'language' )] . |
96 | 96 | ' (' . $user->getOption( 'language' ) . ')' ) . '</li>' . |
97 | 97 | '<li>' . wfMsgHtml( 'wminc-testwiki' ) . ' ' . $testwiki . '</li>' . |