jenkins-bot has submitted this change and it was merged.
Change subject: Move ExtMobileFrontend::parseContentFormat() to MobileContext
......................................................................
Move ExtMobileFrontend::parseContentFormat() to MobileContext
Change-Id: I2cbf1020ecf1190289daa686df01e558e974f742
---
M includes/MobileContext.php
M includes/MobileFrontend.body.php
M includes/api/ApiParseExtender.php
3 files changed, 22 insertions(+), 16 deletions(-)
Approvals:
awjrichards: Verified; Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/MobileContext.php b/includes/MobileContext.php
index 1b67389..d2adf8c 100644
--- a/includes/MobileContext.php
+++ b/includes/MobileContext.php
@@ -90,13 +90,31 @@
if ( $this->contentFormat ) {
return $this->contentFormat;
}
- // honor useformat=mobile-wap if it's set, otherwise determine
by device
+ // honor useformat if it's set, otherwise determine by device
$device = $this->getDevice();
- $viewFormat = ( $this->getUseFormat() == 'mobile-wap' ) ?
'mobile-wap' : $device->format();
- $this->contentFormat = ExtMobileFrontend::parseContentFormat(
$viewFormat );
+ $viewFormat = ( $this->getUseFormat() != '' ) ?
$this->getUseFormat() : $device->format();
+ $this->contentFormat = static::parseContentFormat( $viewFormat
);
return $this->contentFormat;
}
+ /**
+ * Converts a multitude of format strings to 'HTML' or 'WML'
+ * @param string $format
+ *
+ * @return string
+ */
+ public static function parseContentFormat( $format ) {
+ if ( $format === 'wml' ) {
+ return 'WML';
+ } elseif ( $format === 'html' ) {
+ return 'HTML';
+ }
+ if ( $format === 'mobile-wap' ) {
+ return 'WML';
+ }
+ return 'HTML';
+ }
+
public function imagesDisabled() {
if ( is_null( $this->disableImages ) ) {
$this->disableImages =
(bool)$this->getRequest()->getCookie( 'disableImages' );
diff --git a/includes/MobileFrontend.body.php b/includes/MobileFrontend.body.php
index dbadf3c..9d822e0 100644
--- a/includes/MobileFrontend.body.php
+++ b/includes/MobileFrontend.body.php
@@ -37,18 +37,6 @@
wfProfileOut( __METHOD__ );
}
- public static function parseContentFormat( $format ) {
- if ( $format === 'wml' ) {
- return 'WML';
- } elseif ( $format === 'html' ) {
- return 'HTML';
- }
- if ( $format === 'mobile-wap' ) {
- return 'WML';
- }
- return 'HTML';
- }
-
/**
* Disables caching if the request is coming from a trusted proxy
*/
diff --git a/includes/api/ApiParseExtender.php
b/includes/api/ApiParseExtender.php
index 9d45a05..c3dbf81 100644
--- a/includes/api/ApiParseExtender.php
+++ b/includes/api/ApiParseExtender.php
@@ -80,7 +80,7 @@
$context->setOnlyThisSegment( isset(
$params['section'] ) );
$mf = new MobileFormatter(
MobileFormatter::wrapHTML( $data['parse']['text']['*'] ),
$title,
- ExtMobileFrontend::parseContentFormat(
$params['mobileformat'] ),
+ MobileContext::parseContentFormat(
$params['mobileformat'] ),
$context
);
$mf->removeImages( $params['noimages'] );
--
To view, visit https://gerrit.wikimedia.org/r/67549
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I2cbf1020ecf1190289daa686df01e558e974f742
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>
Gerrit-Reviewer: awjrichards <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits