diff options
author | Brion Vibber <brion@status.net> | 2010-08-10 15:01:29 -0700 |
---|---|---|
committer | Brion Vibber <brion@status.net> | 2010-08-10 15:01:29 -0700 |
commit | 819d33210d298de74b64dc7ead79e9d9b223b12e (patch) | |
tree | 902d42087e633b96e12bef699f6c80e7342c9312 /plugins/MobileProfile/MobileProfilePlugin.php | |
parent | 8f071b2818e8321ea910df612016175f65093402 (diff) | |
parent | 08fc6053ec55e911b842fd05dafc5e0c99c4e992 (diff) |
Merge branch '0.9.x' into tinymce
Diffstat (limited to 'plugins/MobileProfile/MobileProfilePlugin.php')
-rw-r--r-- | plugins/MobileProfile/MobileProfilePlugin.php | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index 0b37734b7..6076bbde0 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -73,9 +73,11 @@ class MobileProfilePlugin extends WAP20Plugin $this->serveMobile = true; } else { // If they like the WAP 2.0 mimetype, serve them MP - if (strstr('application/vnd.wap.xhtml+xml', $type) !== false) { - $this->serveMobile = true; - } else { + // @fixme $type is undefined, making this if case useless and spewing errors. + // What's the intent? + //if (strstr('application/vnd.wap.xhtml+xml', $type) !== false) { + // $this->serveMobile = true; + //} else { // If they are a mobile device that supports WAP 2.0, // serve them MP @@ -136,11 +138,23 @@ class MobileProfilePlugin extends WAP20Plugin 'vodafone', 'wap1', 'wap2', + 'webos', 'windows ce' ); + $blacklist = array( + 'ipad', // Larger screen handles the full theme fairly well. + ); + $httpuseragent = strtolower($_SERVER['HTTP_USER_AGENT']); + foreach ($blacklist as $md) { + if (strstr($httpuseragent, $md) !== false) { + $this->serveMobile = false; + return true; + } + } + foreach ($this->mobiledevices as $md) { if (strstr($httpuseragent, $md) !== false) { $this->setMobileFeatures($httpuseragent); @@ -149,7 +163,7 @@ class MobileProfilePlugin extends WAP20Plugin break; } } - } + //} // If they are okay with MP, and the site has a mobile server, // redirect there @@ -167,7 +181,9 @@ class MobileProfilePlugin extends WAP20Plugin return true; } - if (!$type) { + // @fixme $type is undefined, making this if case useless and spewing errors. + // What's the intent? + //if (!$type) { $httpaccept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : null; @@ -180,7 +196,7 @@ class MobileProfilePlugin extends WAP20Plugin throw new ClientException(_('This page is not available in a '. 'media type you accept'), 406); } - } + //} header('Content-Type: '.$type); @@ -219,21 +235,6 @@ class MobileProfilePlugin extends WAP20Plugin } - function onStartShowHeadElements($action) - { - if (!$action->serveMobile) { - return true; - } - - $action->showTitle(); - $action->showShortcutIcon(); - $action->showStylesheets(); - $action->showFeeds(); - $action->showDescription(); - $action->extraHead(); - } - - function onStartShowStatusNetStyles($action) { if (!$this->serveMobile) { @@ -254,6 +255,10 @@ class MobileProfilePlugin extends WAP20Plugin $action->cssLink('plugins/MobileProfile/mp-handheld.css',null,'handheld'); } + // Allow other plugins to load their styles. + Event::handle('EndShowStatusNetStyles', array($action)); + Event::handle('EndShowLaconicaStyles', array($action)); + return false; } |