Index: trunk/extensions/MobileFrontend/MobileFrontend.php |
— | — | @@ -258,7 +258,8 @@ |
259 | 259 | } |
260 | 260 | $fragmentDelimiter = ( !empty( $parsedUrl['fragment'] ) ) ? '#' : ''; |
261 | 261 | $queryDelimiter = ( !empty( $parsedUrl['query'] ) ) ? '?' : ''; |
262 | | - $targetUrl = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . $parsedUrl['path'] . $queryDelimiter . $parsedUrl['query'] . $fragmentDelimiter . $parsedUrl['fragment']; |
| 262 | + $targetUrl = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . $parsedUrl['path'] |
| 263 | + . $queryDelimiter . $parsedUrl['query'] . $fragmentDelimiter . $parsedUrl['fragment']; |
263 | 264 | $output->setSquidMaxage( 1200 ); |
264 | 265 | $output->redirect( $targetUrl, '301' ); |
265 | 266 | } |
— | — | @@ -338,9 +339,9 @@ |
339 | 340 | |
340 | 341 | self::$dir = $wgContLang->getDir(); |
341 | 342 | self::$code = $wgContLang->getCode(); |
342 | | - |
| 343 | + |
343 | 344 | $languageUrls = array(); |
344 | | - |
| 345 | + |
345 | 346 | $languageUrls[] = array( |
346 | 347 | 'href' => self::$currentURL, |
347 | 348 | 'text' => self::$htmlTitle, |
— | — | @@ -348,12 +349,12 @@ |
349 | 350 | 'class' => 'interwiki-' . $wgLanguageCode, |
350 | 351 | 'lang' => $wgLanguageCode, |
351 | 352 | ); |
352 | | - |
353 | | - foreach( $wgOut->getLanguageLinks() as $l ) { |
| 353 | + |
| 354 | + foreach( $wgOut->getLanguageLinks() as $l ) { |
354 | 355 | $tmp = explode( ':', $l, 2 ); |
355 | 356 | $class = 'interwiki-' . $tmp[0]; |
356 | 357 | $lang = $tmp[0]; |
357 | | - unset( $tmp ); |
| 358 | + unset( $tmp ); |
358 | 359 | $nt = Title::newFromText( $l ); |
359 | 360 | if ( $nt ) { |
360 | 361 | $parsedUrl = wfParseUrl( $nt->getFullURL() ); |
— | — | @@ -363,11 +364,15 @@ |
364 | 365 | } |
365 | 366 | $fragmentDelimiter = ( isset( $parsedUrl['fragment'] ) && $parsedUrl['fragment'] !== null ) ? '#' : ''; |
366 | 367 | $queryDelimiter = ( isset( $parsedUrl['query'] ) && $parsedUrl['query'] !== null ) ? '?' : ''; |
367 | | - $languageUrl = $parsedUrl['scheme'] . $parsedUrl['delimiter'] . $parsedUrl['host'] . $parsedUrl['path'] . $queryDelimiter . $parsedUrl['query'] . $fragmentDelimiter . $parsedUrl['fragment']; |
| 368 | + $languageUrl = $parsedUrl['scheme'] . $parsedUrl['delimiter'] . $parsedUrl['host'] |
| 369 | + . $parsedUrl['path'] . $queryDelimiter . $parsedUrl['query'] |
| 370 | + . $fragmentDelimiter . $parsedUrl['fragment']; |
368 | 371 | |
369 | 372 | $languageUrls[] = array( |
370 | 373 | 'href' => $languageUrl, |
371 | | - 'text' => ( $wgContLang->getLanguageName( $nt->getInterwiki() ) != '' ? $wgContLang->getLanguageName( $nt->getInterwiki() ) : $l ), |
| 374 | + 'text' => ( $wgContLang->getLanguageName( $nt->getInterwiki() ) != '' |
| 375 | + ? $wgContLang->getLanguageName( $nt->getInterwiki() ) |
| 376 | + : $l ), |
372 | 377 | 'language' => $wgContLang->getLanguageName( $lang ), |
373 | 378 | 'class' => $class, |
374 | 379 | 'lang' => $lang, |
— | — | @@ -378,7 +383,9 @@ |
379 | 384 | self::$languageUrls = $languageUrls; |
380 | 385 | |
381 | 386 | $nonMobileServerBaseURL = str_replace( $wgMobileDomain, '.', $wgServer ); |
382 | | - self::$mobileRedirectFormAction = ( $wgMobileRedirectFormAction !== false ) ? $wgMobileRedirectFormAction : "{$nonMobileServerBaseURL}/w/mobileRedirect.php"; |
| 387 | + self::$mobileRedirectFormAction = ( $wgMobileRedirectFormAction !== false ) |
| 388 | + ? $wgMobileRedirectFormAction |
| 389 | + : "{$nonMobileServerBaseURL}/w/mobileRedirect.php"; |
383 | 390 | |
384 | 391 | self::$mainPageUrl = Title::newMainPage()->getLocalUrl(); |
385 | 392 | self::$randomPageUrl = $this->getRelativeURL( SpecialPage::getTitleFor( 'Randompage' )->getLocalUrl() ); |
— | — | @@ -1065,7 +1072,7 @@ |
1066 | 1073 | wfProfileOut( __METHOD__ ); |
1067 | 1074 | return $contentHtml; |
1068 | 1075 | } |
1069 | | - |
| 1076 | + |
1070 | 1077 | /** |
1071 | 1078 | * @param $token string |
1072 | 1079 | * @param $action string |
— | — | @@ -1076,19 +1083,19 @@ |
1077 | 1084 | $password = self::$messages['mobile-frontend-password']; |
1078 | 1085 | $login = self::$messages['mobile-frontend-login']; |
1079 | 1086 | $loginHtml = Html::input( 'wpName', null, 'text', array( |
1080 | | - 'class' => 'loginText', |
1081 | | - 'id' => 'wpName1', |
1082 | | - 'tabindex' => '1', |
1083 | | - 'size' => '20', |
1084 | | - 'required') ); |
| 1087 | + 'class' => 'loginText', |
| 1088 | + 'id' => 'wpName1', |
| 1089 | + 'tabindex' => '1', |
| 1090 | + 'size' => '20', |
| 1091 | + 'required') ); |
1085 | 1092 | $passwordHtml = Html::input( 'wpPassword', null, 'password', array( |
1086 | | - 'class' => 'loginPassword', |
1087 | | - 'id' => 'wpPassword1', |
1088 | | - 'tabindex' => '2', |
1089 | | - 'size' => '20') ); |
| 1093 | + 'class' => 'loginPassword', |
| 1094 | + 'id' => 'wpPassword1', |
| 1095 | + 'tabindex' => '2', |
| 1096 | + 'size' => '20') ); |
1090 | 1097 | $buttonHtml = Html::input( 'wpLoginAttempt', $login, 'submit', array( |
1091 | | - 'id' => 'wpLoginAttempt', |
1092 | | - 'tabindex' => '3') ); |
| 1098 | + 'id' => 'wpLoginAttempt', |
| 1099 | + 'tabindex' => '3') ); |
1093 | 1100 | $form = <<<EOT |
1094 | 1101 | <form name="userlogin" method="post" action="{$action}"> |
1095 | 1102 | <table class="user-login"> |
— | — | @@ -1118,7 +1125,7 @@ |
1119 | 1126 | EOT; |
1120 | 1127 | return $this->getDomDocumentNodeByTagName( $form, 'form' ); |
1121 | 1128 | } |
1122 | | - |
| 1129 | + |
1123 | 1130 | /** |
1124 | 1131 | * @param $html string |
1125 | 1132 | * @param $tagName string |
— | — | @@ -1126,7 +1133,7 @@ |
1127 | 1134 | */ |
1128 | 1135 | private function getDomDocumentNodeByTagName( $html, $tagName ) { |
1129 | 1136 | libxml_use_internal_errors( true ); |
1130 | | - $dom = new DOMDocument(); |
| 1137 | + $dom = new DOMDocument(); |
1131 | 1138 | $dom->loadHTML( $html ); |
1132 | 1139 | libxml_use_internal_errors( false ); |
1133 | 1140 | $dom->preserveWhiteSpace = false; |
— | — | @@ -1153,9 +1160,9 @@ |
1154 | 1161 | $this->doc->encoding = 'UTF-8'; |
1155 | 1162 | |
1156 | 1163 | $itemToRemoveRecords = $this->parseItemsToRemove(); |
1157 | | - |
| 1164 | + |
1158 | 1165 | $ptLogout = $this->doc->getElementById( 'pt-logout' ); |
1159 | | - |
| 1166 | + |
1160 | 1167 | if ( $ptLogout ) { |
1161 | 1168 | $ptLogoutLink = $ptLogout->firstChild; |
1162 | 1169 | $logoutHtml = $this->doc->saveXML( $ptLogoutLink, LIBXML_NOEMPTYTAG ); |
— | — | @@ -1268,7 +1275,7 @@ |
1269 | 1276 | |
1270 | 1277 | $redLink->parentNode->replaceChild( $spanNode, $redLink ); |
1271 | 1278 | } |
1272 | | - |
| 1279 | + |
1273 | 1280 | if ( self::$title == 'Special:UserLogin' ) { |
1274 | 1281 | if ( isset( $wpLoginToken ) && isset( $action ) && isset( $userlogin ) ) { |
1275 | 1282 | $login = $this->renderLogin( $wpLoginToken, $action ); |
— | — | @@ -1276,7 +1283,7 @@ |
1277 | 1284 | $userlogin->appendChild( $loginNode ); |
1278 | 1285 | } |
1279 | 1286 | } |
1280 | | - |
| 1287 | + |
1281 | 1288 | $content = $this->doc->getElementById( 'content' ); |
1282 | 1289 | |
1283 | 1290 | $contentHtml = $this->doc->saveXML( $content, LIBXML_NOEMPTYTAG ); |
— | — | @@ -1359,17 +1366,17 @@ |
1360 | 1367 | wfProfileOut( __METHOD__ ); |
1361 | 1368 | return $applicationHtml; |
1362 | 1369 | } |
1363 | | - |
| 1370 | + |
1364 | 1371 | public static function buildLanguageSelection() { |
1365 | 1372 | global $wgLanguageCode; |
1366 | | - $output = Html::openElement( 'select', |
1367 | | - array( 'id' => 'languageselection', |
| 1373 | + $output = Html::openElement( 'select', |
| 1374 | + array( 'id' => 'languageselection', |
1368 | 1375 | 'onchange' => 'javascript:navigateToLanguageSelection();' ) ); |
1369 | 1376 | foreach (self::$languageUrls as $languageUrl) { |
1370 | 1377 | if ( $languageUrl['lang'] == $wgLanguageCode ) { |
1371 | 1378 | $output .= Html::element( 'option', |
1372 | 1379 | array( 'value' => $languageUrl['href'], 'selected' => 'selected' ), |
1373 | | - $languageUrl['language'] ); |
| 1380 | + $languageUrl['language'] ); |
1374 | 1381 | } else { |
1375 | 1382 | $output .= Html::element( 'option', |
1376 | 1383 | array( 'value' => $languageUrl['href'] ), |