Index: trunk/extensions/MobileFrontend/FooterTemplate.php |
— | — | @@ -27,7 +27,8 @@ |
28 | 28 | $imagesURL = $this->data['enableImagesURL']; |
29 | 29 | } |
30 | 30 | |
31 | | - $logoutLink = ( !empty( $this->data['logoutHtml'] ) ) ? ' | ' . $this->data['logoutHtml'] : ''; |
| 31 | + $logoutLink = ( $this->data['logoutHtml'] ) ? ' | ' . $this->data['logoutHtml'] : ''; |
| 32 | + $logoutLink = ( $this->data['loginHtml'] ) ? ' | ' . $this->data['loginHtml'] : $logoutLink; |
32 | 33 | |
33 | 34 | $feedbackLink = ( $this->data['code'] == 'en' && $this->data['isBetaGroupMember'] ) ? "| <a href=\"{$leaveFeedbackURL}\">{$leaveFeedback}</a>" : ''; |
34 | 35 | |
Index: trunk/extensions/MobileFrontend/MobileFrontend.php |
— | — | @@ -105,7 +105,7 @@ |
106 | 106 | } |
107 | 107 | |
108 | 108 | class ExtMobileFrontend { |
109 | | - const VERSION = '0.6.0'; |
| 109 | + const VERSION = '0.6.1'; |
110 | 110 | |
111 | 111 | /** |
112 | 112 | * @var DOMDocument |
— | — | @@ -151,6 +151,7 @@ |
152 | 152 | public static $wsLoginFormAction = ''; |
153 | 153 | public static $isFilePage; |
154 | 154 | public static $logoutHtml; |
| 155 | + public static $loginHtml; |
155 | 156 | |
156 | 157 | public static $messageKeys = array( |
157 | 158 | 'mobile-frontend-show-button', |
— | — | @@ -435,8 +436,13 @@ |
436 | 437 | } |
437 | 438 | $fragmentDelimiter = ( !empty( $parsedUrl['fragment'] ) ) ? '#' : ''; |
438 | 439 | $queryDelimiter = ( !empty( $parsedUrl['query'] ) ) ? '?' : ''; |
439 | | - $redirect = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . $parsedUrl['path'] |
440 | | - . $queryDelimiter . $parsedUrl['query'] . $fragmentDelimiter . $parsedUrl['fragment']; |
| 440 | + $redirect = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . $parsedUrl['path']; |
| 441 | + if ( isset( $parsedUrl['query'] ) ) { |
| 442 | + $redirect .= $queryDelimiter . $parsedUrl['query']; |
| 443 | + } |
| 444 | + if ( isset( $parsedUrl['fragment'] ) ) { |
| 445 | + $redirect .= $fragmentDelimiter . $parsedUrl['fragment']; |
| 446 | + } |
441 | 447 | } |
442 | 448 | } |
443 | 449 | return true; |
— | — | @@ -1316,11 +1322,34 @@ |
1317 | 1323 | |
1318 | 1324 | $itemToRemoveRecords = $this->parseItemsToRemove(); |
1319 | 1325 | |
1320 | | - $ptLogout = $this->doc->getElementById( 'pt-logout' ); |
| 1326 | + if ( self::$isBetaGroupMember ) { |
| 1327 | + $ptLogout = $this->doc->getElementById( 'pt-logout' ); |
1321 | 1328 | |
1322 | | - if ( $ptLogout ) { |
1323 | | - $ptLogoutLink = $ptLogout->firstChild; |
1324 | | - self::$logoutHtml = $this->doc->saveXML( $ptLogoutLink, LIBXML_NOEMPTYTAG ); |
| 1329 | + if ( $ptLogout ) { |
| 1330 | + $ptLogoutLink = $ptLogout->firstChild; |
| 1331 | + self::$logoutHtml = $this->doc->saveXML( $ptLogoutLink, LIBXML_NOEMPTYTAG ); |
| 1332 | + } |
| 1333 | + |
| 1334 | + $ptAnonLogin = $this->doc->getElementById( 'pt-anonlogin' ); |
| 1335 | + |
| 1336 | + if ( $ptAnonLogin ) { |
| 1337 | + $ptAnonLoginLink = $ptAnonLogin->firstChild; |
| 1338 | + if ( $ptAnonLoginLink && $ptAnonLoginLink->hasAttributes() ) { |
| 1339 | + $ptAnonLoginLinkHref = $ptAnonLoginLink->getAttributeNode( 'href' ); |
| 1340 | + $ptAnonLoginLinkTitle = $ptAnonLoginLink->getAttributeNode( 'title' ); |
| 1341 | + if ( $ptAnonLoginLinkTitle ) { |
| 1342 | + $ptAnonLoginLinkTitle->nodeValue = self::$messages['mobile-frontend-login']; |
| 1343 | + } |
| 1344 | + if ( $ptAnonLoginLinkHref ) { |
| 1345 | + $ptAnonLoginLinkHref->nodeValue = str_replace( "&", "&", $ptAnonLoginLinkHref->nodeValue ) . '&useformat=mobile'; |
| 1346 | + } |
| 1347 | + $ptAnonLoginLinkText = $ptAnonLoginLink->firstChild; |
| 1348 | + if ( $ptAnonLoginLinkText ) { |
| 1349 | + $ptAnonLoginLinkText->nodeValue = self::$messages['mobile-frontend-login']; |
| 1350 | + } |
| 1351 | + } |
| 1352 | + self::$loginHtml = $this->doc->saveXML( $ptAnonLoginLink, LIBXML_NOEMPTYTAG ); |
| 1353 | + } |
1325 | 1354 | } |
1326 | 1355 | |
1327 | 1356 | if ( self::$title->isSpecial( 'Userlogin' ) && self::$isBetaGroupMember ) { |
— | — | @@ -1328,7 +1357,7 @@ |
1329 | 1358 | |
1330 | 1359 | if ( $userlogin && get_class( $userlogin ) === 'DOMElement' ) { |
1331 | 1360 | $firstHeading = $this->doc->getElementById( 'firstHeading' ); |
1332 | | - if ( !empty( $firstHeading ) ) { |
| 1361 | + if ( $firstHeading ) { |
1333 | 1362 | $firstHeading->nodeValue = ''; |
1334 | 1363 | } |
1335 | 1364 | } |
— | — | @@ -1521,7 +1550,8 @@ |
1522 | 1551 | public function getFooterTemplate() { |
1523 | 1552 | wfProfileIn( __METHOD__ ); |
1524 | 1553 | $footerTemplate = new FooterTemplate(); |
1525 | | - $logoutHtml = ( !empty( self::$logoutHtml ) ) ? self::$logoutHtml : ''; |
| 1554 | + $logoutHtml = ( self::$logoutHtml ) ? self::$logoutHtml : ''; |
| 1555 | + $loginHtml = ( self::$loginHtml ) ? self::$loginHtml : ''; |
1526 | 1556 | $options = array( |
1527 | 1557 | 'messages' => self::$messages, |
1528 | 1558 | 'leaveFeedbackURL' => self::$leaveFeedbackURL, |
— | — | @@ -1531,6 +1561,7 @@ |
1532 | 1562 | 'disableImagesURL' => self::$disableImagesURL, |
1533 | 1563 | 'enableImagesURL' => self::$enableImagesURL, |
1534 | 1564 | 'logoutHtml' => $logoutHtml, |
| 1565 | + 'loginHtml' => $loginHtml, |
1535 | 1566 | 'code' => self::$code, |
1536 | 1567 | 'isBetaGroupMember' => self::$isBetaGroupMember, |
1537 | 1568 | ); |