Jdlrobson has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/348953 )

Change subject: Move Log
......................................................................

Move Log

* MFCustomLogos renamed to MinervaCustomLogos since it is Minerva
specific. For backwards compatibility we still support MFCustomLogos

Change-Id: I02470c5d3e1404656fb3a0d2de7103eb03e97110
---
M README.md
M extension.json
M includes/MobileFrontend.skin.hooks.php
M includes/skins/MinervaTemplate.php
M includes/skins/SkinMinerva.php
5 files changed, 54 insertions(+), 52 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/53/348953/1

diff --git a/README.md b/README.md
index a0c6ed4..d719bea 100644
--- a/README.md
+++ b/README.md
@@ -505,6 +505,10 @@
 
 #### $wgMFCustomLogos
 
+Use $wgMinervaCustomLogos instead.
+
+#### $wgMinervaCustomLogos
+
 Make the logos configurable.
 
 Currently, `copyright`, `copyright-width`, and `copyright-height` elements are
diff --git a/extension.json b/extension.json
index b5c7897..7255c8b 100644
--- a/extension.json
+++ b/extension.json
@@ -1809,6 +1809,7 @@
                "MFNoindexPages": true,
                "MFStopRedirectCookieHost": null,
                "MFCustomLogos": [],
+               "MinervaCustomLogos": [],
                "MobileFrontendLogo": false,
                "MFTrademarkSitename": false,
                "MFEnableBeta": false,
diff --git a/includes/MobileFrontend.skin.hooks.php 
b/includes/MobileFrontend.skin.hooks.php
index 0e5dc13..20a824b 100644
--- a/includes/MobileFrontend.skin.hooks.php
+++ b/includes/MobileFrontend.skin.hooks.php
@@ -247,7 +247,6 @@
                $desktop = $ctx->msg( 'mobile-frontend-view-desktop' 
)->escaped();
                $desktopToggler = Html::element( 'a',
                        [ 'id' => "mw-mf-display-toggle", "href" => $desktopUrl 
], $desktop );
-               $sitename = self::getSitename( true );
 
                // Generate the licensing text displayed in the footer of each 
page.
                // See Skin::getCopyright for desktop equivalent.
@@ -261,7 +260,6 @@
                // Enable extensions to add links to footer in Mobile view, too 
- bug 66350
                Hooks::run( 'MobileSiteOutputPageBeforeExec', [ &$sk, &$tpl ] );
 
-               $tpl->set( 'footer-site-heading-html', $sitename );
                $tpl->set( 'desktop-toggle', $desktopToggler );
                $tpl->set( 'mobile-license', $licenseText );
                $tpl->set( 'privacy', $sk->footerLink( 
'mobile-frontend-privacy-link-text', 'privacypage' ) );
@@ -277,53 +275,5 @@
                ];
                $tpl->set( 'footerlinks', $footerlinks );
                return $tpl;
-       }
-
-       /**
-        * Returns the site name for the footer, either as a text or <img> tag
-        * @param boolean $withPossibleTrademark If true and a trademark symbol 
is specified
-        *     by $wgMFTrademarkSitename, append that trademark symbol to the 
sitename/logo.
-        *     This param exists so that the trademark symbol can be appended 
in some
-        *     contexts, for example, the footer, but not in others. See bug 
T95007.
-        * @return string
-        */
-       public static function getSitename( $withPossibleTrademark = false ) {
-               $ctx = MobileContext::singleton();
-               $config = $ctx->getMFConfig();
-               $customLogos = $config->get( 'MFCustomLogos' );
-               $trademarkSymbol = $config->get( 'MFTrademarkSitename' );
-               $suffix = '';
-
-               $footerSitename = $ctx->msg( 'mobile-frontend-footer-sitename' 
)->text();
-
-               // Add a trademark symbol if needed
-               if ( $withPossibleTrademark ) {
-                       // Registered trademark
-                       if ( $trademarkSymbol === 'registered' ) {
-                               $suffix = Html::element( 'sup', [], '®' );
-                       // Unregistered (or unspecified) trademark
-                       } elseif ( $trademarkSymbol ) {
-                               $suffix = Html::element( 'sup', [], '™' );
-                       }
-               }
-
-               // If there's a custom site logo, use that instead of text
-               if ( isset( $customLogos['copyright'] ) ) {
-                       $attributes =  [
-                               'src' => $customLogos['copyright'],
-                               'alt' => $footerSitename,
-                       ];
-                       if ( isset( $customLogos['copyright-height'] ) ) {
-                               $attributes['height'] = 
$customLogos['copyright-height'];
-                       }
-                       if ( isset( $customLogos['copyright-width'] ) ) {
-                               $attributes['width'] = 
$customLogos['copyright-width'];
-                       }
-                       $sitename = Html::element( 'img', $attributes );
-               } else {
-                       $sitename = $footerSitename;
-               }
-
-               return $sitename . $suffix;
        }
 }
diff --git a/includes/skins/MinervaTemplate.php 
b/includes/skins/MinervaTemplate.php
index 2465e63..4772f02 100644
--- a/includes/skins/MinervaTemplate.php
+++ b/includes/skins/MinervaTemplate.php
@@ -67,7 +67,9 @@
                return [
                        'lastmodified' => $this->getHistoryLinkHtml( $data ),
                        'headinghtml' => $data['footer-site-heading-html'],
-                       'licensehtml' => $data['mobile-license'],
+                       // Note mobile-license is only available on the mobile 
skin. It is outputted as part of
+                       // footer-info on desktop hence the conditional check.
+                       'licensehtml' => isset( $data['mobile-license'] ) ? 
$data['mobile-license'] : '',
                        'lists' => $groups,
                ];
        }
diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php
index d3a87e0..e512e09 100644
--- a/includes/skins/SkinMinerva.php
+++ b/includes/skins/SkinMinerva.php
@@ -45,6 +45,51 @@
                return MediaWikiServices::getInstance()->getService( 
'MobileFrontend.Config' );
        }
 
+       /**
+        * Returns the site name for the footer, either as a text or <img> tag
+        * @param boolean $withPossibleTrademark If true and a trademark symbol 
is specified
+        *     by $wgMFTrademarkSitename, append that trademark symbol to the 
sitename/logo.
+        *     This param exists so that the trademark symbol can be appended 
in some
+        *     contexts, for example, the footer, but not in others. See bug 
T95007.
+        * @return string
+        */
+       public static function getSitename() {
+               $ctx = MobileContext::singleton();
+               $config = $ctx->getMFConfig();
+               $mfLogos = $config->get( 'MFCustomLogos' );
+               // use of MFCustomLogos is kept for backwards compatibility.
+               $customLogos = array_merge( $config->get( 'MinervaCustomLogos' 
),
+                       $mfLogos );
+
+               if ( $mfLogos && count( $mfLogos ) > 0 ) {
+                       \MediaWiki\Logger\LoggerFactory::getInstance( 'mobile' 
)->info(
+                               "MFCustomLogos config option is deprecated. 
Please use MinervaCustomLogos instead."
+                       );
+               }
+               $suffix = '';
+
+               $footerSitename = $ctx->msg( 'mobile-frontend-footer-sitename' 
)->text();
+
+               // If there's a custom site logo, use that instead of text
+               if ( isset( $customLogos['copyright'] ) ) {
+                       $attributes =  [
+                               'src' => $customLogos['copyright'],
+                               'alt' => $footerSitename,
+                       ];
+                       if ( isset( $customLogos['copyright-height'] ) ) {
+                               $attributes['height'] = 
$customLogos['copyright-height'];
+                       }
+                       if ( isset( $customLogos['copyright-width'] ) ) {
+                               $attributes['width'] = 
$customLogos['copyright-width'];
+                       }
+                       $sitename = Html::element( 'img', $attributes );
+               } else {
+                       $sitename = $footerSitename;
+               }
+
+               return $sitename . $suffix;
+       }
+
        /** @var array skin specific options */
        protected $skinOptions = [
                /**
@@ -831,7 +876,7 @@
                        }
                }
                $tpl->set( 'headinghtml', $this->getHeadingHtml() );
-
+               $tpl->set( 'footer-site-heading-html', $this->getSitename() );
                // set defaults
                if ( !isset( $tpl->data['postbodytext'] ) ) {
                        $tpl->set( 'postbodytext', '' ); // not currently set 
in desktop skin

-- 
To view, visit https://gerrit.wikimedia.org/r/348953
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I02470c5d3e1404656fb3a0d2de7103eb03e97110
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to