From a0266089538e9f07528210a7d1ab39028e8558c3 Mon Sep 17 00:00:00 2001 From: Samantha Doherty Date: Tue, 31 May 2011 12:14:26 -0400 Subject: [PATCH] Only use mobile doctype on actual mobile devices. --- plugins/MobileProfile/MobileProfilePlugin.php | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index 196a262095..e149573e88 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -49,6 +49,7 @@ class MobileProfilePlugin extends WAP20Plugin { public $DTD = null; public $serveMobile = false; + public $reallyMobile = false; public $mobileFeatures = array(); function __construct($DTD='http://www.wapforum.org/DTD/xhtml-mobile10.dtd') @@ -160,6 +161,7 @@ class MobileProfilePlugin extends WAP20Plugin $this->setMobileFeatures($httpuseragent); $this->serveMobile = true; + $this->reallyMobile = true; break; } } @@ -201,21 +203,28 @@ class MobileProfilePlugin extends WAP20Plugin header('Content-Type: '.$type); - $action->extraHeaders(); - if (preg_match("/.*\/.*xml/", $type)) { - // Required for XML documents - $action->xw->startDocument('1.0', 'UTF-8'); - } - $action->xw->writeDTD('html', - '-//WAPFORUM//DTD XHTML Mobile 1.0//EN', - $this->DTD); + if ($this->reallyMobile) { + + $action->extraHeaders(); + if (preg_match("/.*\/.*xml/", $type)) { + // Required for XML documents + $action->xw->startDocument('1.0', 'UTF-8'); + } + $action->xw->writeDTD('html', + '-//WAPFORUM//DTD XHTML Mobile 1.0//EN', + $this->DTD); - $language = $action->getLanguage(); + $language = $action->getLanguage(); - $action->elementStart('html', array('xmlns' => 'http://www.w3.org/1999/xhtml', + $action->elementStart('html', array('xmlns' => 'http://www.w3.org/1999/xhtml', 'xml:lang' => $language)); - return false; + return false; + + } else { + return true; + } + } function setMobileFeatures($useragent) -- 2.39.5