MaxSem has uploaded a new change for review.
https://gerrit.wikimedia.org/r/92994
Change subject: Don't force WMF terms of use upon everyone
......................................................................
Don't force WMF terms of use upon everyone
Depends on Iadba5c65b90913e30fe41ae0f751ce6642f37501 from WikimediaMessages
Bug: 53902
Change-Id: I8093be3043ac5046e28858205efbc715e8370bd5
---
M MobileFrontend.i18n.php
M includes/skins/MinervaTemplate.php
M includes/skins/SkinMobile.php
3 files changed, 29 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/94/92994/1
diff --git a/MobileFrontend.i18n.php b/MobileFrontend.i18n.php
index b8b2519..c20147a 100644
--- a/MobileFrontend.i18n.php
+++ b/MobileFrontend.i18n.php
@@ -114,9 +114,10 @@
'mobile-frontend-footer-sitename' => '{{SITENAME}}',
'mobile-frontend-footer-license' => 'Text is available under
[//en.m.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License?useformat=mobile
CC BY-SA 3.0]; additional terms may apply.',
'mobile-frontend-copyright' => 'Content is available under $1 unless
otherwise noted.',
- 'mobile-frontend-terms-use-text' =>
'[//wikimediafoundation.org/wiki/Terms_of_use?useformat=mobile Terms of Use]',
'mobile-frontend-footer-contact' => 'Contact',
'mobile-frontend-search-noresults' => 'No page titles match your
search. Change your search, or press the keyboard search button to search
inside pages.',
+ 'mobile-frontend-terms-text' => 'Terms of use',
+ 'mobile-frontend-terms-url' => '',
// Site navigation menu
'mobile-frontend-main-menu-button-tooltip' => 'Open main menu',
@@ -587,9 +588,10 @@
* $1 - license name
'''See also'''
* {{msg-mw|Copyright}}",
- 'mobile-frontend-terms-use-text' => 'Label for terms of use link',
'mobile-frontend-footer-contact' => 'Label for contact in footer',
'mobile-frontend-search-noresults' => 'Text that appears when a search
returns no results',
+ 'mobile-frontend-terms-text' => '"Terms of use" link text at the bottom
of every page',
+ 'mobile-frontend-terms-url' => 'Terms of use URL. Do not localise',
'mobile-frontend-main-menu-button-tooltip' => 'Tooltip for menu button',
'mobile-frontend-main-menu-page-title' =>
'{{doc-special|MobileMenu|unlisted=1}}',
'mobile-frontend-main-menu-featured' => 'Featured link text in main menu
diff --git a/includes/skins/MinervaTemplate.php
b/includes/skins/MinervaTemplate.php
index 2e4bedd..970606d 100644
--- a/includes/skins/MinervaTemplate.php
+++ b/includes/skins/MinervaTemplate.php
@@ -88,7 +88,7 @@
foreach( $this->getFooterLinks() as $category
=> $links ):
?>
<ul class="footer-<?php echo $category; ?>">
- <?php foreach( $links as $link ):
?><li><?php $this->html( $link ) ?></li><?php endforeach; ?>
+ <?php foreach( $links as $link ): if (
isset( $this->data[$link] ) ): ?><li><?php $this->html( $link ) ?></li><?php
endif; endforeach; ?>
</ul>
<?php endforeach; ?>
</div>
diff --git a/includes/skins/SkinMobile.php b/includes/skins/SkinMobile.php
index 0f0e184..74f6219 100644
--- a/includes/skins/SkinMobile.php
+++ b/includes/skins/SkinMobile.php
@@ -373,7 +373,30 @@
$tpl->set( 'mobile-switcher', $switcherHtml );
$tpl->set( 'mobile-license', $licenseText );
$tpl->set( 'privacy', $this->footerLink(
'mobile-frontend-privacy-link-text', 'privacypage' ) );
- $tpl->set( 'terms-use', wfMessage(
'mobile-frontend-terms-use-text' )->parse() );
+ $tpl->set( 'terms-use', $this->getTermsLink(
'mobile-frontend-terms-url' ) );
+ }
+
+ /**
+ * Returns HTML of terms of use link or null if it shouldn't be
displayed
+ *
+ * @param $messageKey
+ *
+ * @return null|string
+ */
+ public function getTermsLink( $messageKey ) {
+ $urlMsg = $this->msg( $messageKey )->inContentLanguage();
+ if ( $urlMsg->isDisabled() ) {
+ return null;
+ }
+ $url = $urlMsg->plain();
+ if ( !preg_match( '#^(https?:)?//#', $url ) ) {
+ $title = Title::newFromText( $url );
+ if ( !$title ) {
+ return null;
+ }
+ $url = $title->getLocalURL();
+ }
+ return Html::element( 'a', array( 'href' => $url ), $this->msg(
'mobile-frontend-terms-text' )->text() );
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/92994
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8093be3043ac5046e28858205efbc715e8370bd5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits