From d09444309f80fe1f274ec2dda4975a96506fcca9 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Fri, 2 Oct 2009 11:46:14 +0000 Subject: Init for WAP 2.0 and XHTML Mobile Profile support. WAP20Plugin is a superclass for various WAP 2.0 document types. MobileProfilePlugin extends WAP20Plugin and it is intended for serving XHTML Mobile Profile 1.0. Feature support for document types like WML 2.0 or WAP Push should be created as seperate plugins and quite possibly extend WAP20Plugin. --- plugins/MobileProfile/MobileProfilePlugin.php | 129 ++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 plugins/MobileProfile/MobileProfilePlugin.php (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php new file mode 100644 index 000000000..5ee2d9097 --- /dev/null +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -0,0 +1,129 @@ +. + * + * @category Plugin + * @package StatusNet + * @author Sarven Capadisli + * @copyright 2009 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET') && !defined('LACONICA')) { + exit(1); +} + +define('PAGE_TYPE_PREFS', + 'application/vnd.wap.xhtml+xml, application/xhtml+xml, text/xml;q=0.9'. + ', text/html;q=0.3' + ); + +require_once INSTALLDIR.'/plugins/Mobile/WAP20Plugin.php'; + + +/** + * Superclass for plugin to output XHTML Mobile Profile + * + * @category Plugin + * @package StatusNet + * @author Sarven Capadisli + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +class MobileProfilePlugin extends WAP20Plugin +{ + public $DTDversion = null; + public $serveMobile = false; + + function __construct($DTD='http://www.wapforum.org/DTD/xhtml-mobile10.dtd') + { + $this->DTD = $DTD; + + parent::__construct(); + } + + + function onStartShowHTML($action) + { + if (!$type) { + $httpaccept = isset($_SERVER['HTTP_ACCEPT']) ? + $_SERVER['HTTP_ACCEPT'] : null; + + $cp = common_accept_to_prefs($httpaccept); + $sp = common_accept_to_prefs(PAGE_TYPE_PREFS); + + $type = common_negotiate_type($cp, $sp); + + if (!$type) { + throw new ClientException(_('This page is not available in a '. + 'media type you accept'), 406); + } + } + + // XXX: If user is on the mobile site e.g., m.siteserver.com + // or they really want it, serve the mobile version + + // FIXME: This is dirty and probably not accurate of doing it + if ((common_config('site', 'mobileserver').'/'.common_config('site', 'path').'/' == + $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']) || + preg_match("/.*\/.*wap.*xml/", $type)) { + + $this->serveMobile = true; + } + else { + $this->serveMobile = false; + return true; + } + + header('Content-Type: '.$type); + + $action->extraHeaders(); + + $action->startXML('html', + '-//WAPFORUM//DTD XHTML Mobile 1.0//EN', + $this->DTD); + + $language = $action->getLanguage(); + + $action->elementStart('html', array('xmlns' => 'http://www.w3.org/1999/xhtml', + 'xml:lang' => $language)); + + return false; + } + + + + function onStartShowAside($action) + { + + } + + + function onStartShowScripts($action) + { + + } + +} + + +?> -- cgit v1.2.3-54-g00ecf From 43cd0f87190e55c0973350265fffd2e6c3e5caa2 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Fri, 2 Oct 2009 12:46:26 +0000 Subject: Don't need text/xml until further evidence --- plugins/MobileProfile/MobileProfilePlugin.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index 5ee2d9097..dd67ffcc9 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -32,9 +32,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { } define('PAGE_TYPE_PREFS', - 'application/vnd.wap.xhtml+xml, application/xhtml+xml, text/xml;q=0.9'. - ', text/html;q=0.3' - ); + 'application/vnd.wap.xhtml+xml, application/xhtml+xml, text/html;q=0.9'); require_once INSTALLDIR.'/plugins/Mobile/WAP20Plugin.php'; -- cgit v1.2.3-54-g00ecf From c2046a9ab6539669f8fdfe24798b124246e7807c Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Fri, 2 Oct 2009 15:38:20 +0000 Subject: Better logic to determine what to do with the visitor. Whether to serve them the Mobile Profile or not, and possibly redirect. --- plugins/MobileProfile/MobileProfilePlugin.php | 54 +++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 8 deletions(-) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index dd67ffcc9..cce8f8081 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -77,19 +77,57 @@ class MobileProfilePlugin extends WAP20Plugin } } - // XXX: If user is on the mobile site e.g., m.siteserver.com - // or they really want it, serve the mobile version + // XXX: This should probably graduate to WAP20Plugin - // FIXME: This is dirty and probably not accurate of doing it - if ((common_config('site', 'mobileserver').'/'.common_config('site', 'path').'/' == - $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']) || - preg_match("/.*\/.*wap.*xml/", $type)) { + // If they are on the mobile site, serve them MP + if ((common_config('site', 'mobileserver').'/'. + common_config('site', 'path').'/' == + $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'])) { $this->serveMobile = true; } else { - $this->serveMobile = false; - return true; + // If they like the WAP 2.0 mimetype, serve them MP + 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 + + // XXX: Browser sniffing sucks + // I really don't like going through this every page, + // find a better way + $this->mobiledevices = + array('alcatel', 'android', 'audiovox', 'au-mic,', + 'avantgo', 'blackberry', 'blazer', 'cldc-', 'danger', + 'epoc', 'ericsson', 'ericy', 'ipone', 'ipaq', 'j2me', + 'lg', 'midp-', 'mobile', 'mot', 'netfront', 'nitro', + 'nokia', 'opera mini', 'palm', 'palmsource', + 'panasonic', 'philips', 'pocketpc', 'portalmmm', + 'rover', 'samsung', 'sanyo', 'series60', 'sharp', + 'sie-', 'smartphone', 'sony', 'symbian', + 'up.browser', 'up.link', 'up.link', 'vodafone', + 'wap1', 'wap2', 'windows ce'); + + $httpuseragent = strtolower($_SERVER['HTTP_USER_AGENT']); + + foreach($this->mobiledevices as $mb) { + if (strstr($httpuseragent, $mb) !== false) { + $this->serveMobile = true; + break; + } + } + } + + // If they are okay with MP, and the site has a mobile server, + // redirect there + if ($this->serveMobile && + common_config('site', 'mobileserver') !== false) { + + header("Location: ".common_config('site', 'mobileserver')); + exit(); + } } header('Content-Type: '.$type); -- cgit v1.2.3-54-g00ecf From 604cfd8b116886cac04a8d062c66f11fb601318f Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sat, 3 Oct 2009 20:17:26 +0000 Subject: Updated comment about browser sniffing --- plugins/MobileProfile/MobileProfilePlugin.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index cce8f8081..f594f3c0e 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -96,8 +96,16 @@ class MobileProfilePlugin extends WAP20Plugin // serve them MP // XXX: Browser sniffing sucks + // I really don't like going through this every page, // find a better way + + // May be better to categorize the devices in terms of + // low,mid,high-end + + // Or, detect the mobile devices based on their support for + // MP 1.0, 1.1, or 1.2 may be ideal. Possible? + $this->mobiledevices = array('alcatel', 'android', 'audiovox', 'au-mic,', 'avantgo', 'blackberry', 'blazer', 'cldc-', 'danger', @@ -112,8 +120,8 @@ class MobileProfilePlugin extends WAP20Plugin $httpuseragent = strtolower($_SERVER['HTTP_USER_AGENT']); - foreach($this->mobiledevices as $mb) { - if (strstr($httpuseragent, $mb) !== false) { + foreach($this->mobiledevices as $md) { + if (strstr($httpuseragent, $md) !== false) { $this->serveMobile = true; break; } -- cgit v1.2.3-54-g00ecf From 63700f79588ded641645bc5eaf9265ea837bfff6 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sat, 3 Oct 2009 20:22:40 +0000 Subject: Minor correction to public variable name --- plugins/MobileProfile/MobileProfilePlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index f594f3c0e..cd88a6f7b 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -49,7 +49,7 @@ require_once INSTALLDIR.'/plugins/Mobile/WAP20Plugin.php'; class MobileProfilePlugin extends WAP20Plugin { - public $DTDversion = null; + public $DTD = null; public $serveMobile = false; function __construct($DTD='http://www.wapforum.org/DTD/xhtml-mobile10.dtd') -- cgit v1.2.3-54-g00ecf From f344a49b11607d4dbb64ab6935237cd5185a06b4 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sat, 3 Oct 2009 21:29:14 +0000 Subject: Don't show .aside --- plugins/MobileProfile/MobileProfilePlugin.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index cd88a6f7b..932550189 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -49,7 +49,7 @@ require_once INSTALLDIR.'/plugins/Mobile/WAP20Plugin.php'; class MobileProfilePlugin extends WAP20Plugin { - public $DTD = null; + public $DTD = null; public $serveMobile = false; function __construct($DTD='http://www.wapforum.org/DTD/xhtml-mobile10.dtd') @@ -158,7 +158,9 @@ class MobileProfilePlugin extends WAP20Plugin function onStartShowAside($action) { - + if ($this->serveMobile) { + return false; + } } -- cgit v1.2.3-54-g00ecf From 960207c81eb9f420f916c6889f2f4b4c09a5a480 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 4 Oct 2009 13:27:46 +0000 Subject: Don't redirect if mobile server is same as site server --- plugins/MobileProfile/MobileProfilePlugin.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index 932550189..d854b6e5e 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -131,7 +131,9 @@ class MobileProfilePlugin extends WAP20Plugin // If they are okay with MP, and the site has a mobile server, // redirect there if ($this->serveMobile && - common_config('site', 'mobileserver') !== false) { + common_config('site', 'mobileserver') !== false && + common_config('site', 'mobileserver') != + common_config('site', 'server')) { header("Location: ".common_config('site', 'mobileserver')); exit(); -- cgit v1.2.3-54-g00ecf From c64e1792bf108961c288ffa91667be34d9e6ca6a Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 4 Oct 2009 13:58:29 +0000 Subject: Fixed redirect. Added common_path for mobileserver --- plugins/MobileProfile/MobileProfilePlugin.php | 28 ++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index d854b6e5e..02a732493 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -132,10 +132,11 @@ class MobileProfilePlugin extends WAP20Plugin // redirect there if ($this->serveMobile && common_config('site', 'mobileserver') !== false && - common_config('site', 'mobileserver') != - common_config('site', 'server')) { + (common_config('site', 'mobileserver') != + common_config('site', 'server'))) { - header("Location: ".common_config('site', 'mobileserver')); + // FIXME: Redirect to equivalent page on mobile site instead + header("Location: ".$this->_common_path('')); exit(); } } @@ -171,6 +172,27 @@ class MobileProfilePlugin extends WAP20Plugin } + + function _common_path($relative, $ssl=false) + { + $pathpart = (common_config('site', 'path')) ? common_config('site', 'path')."/" : ''; + + if (($ssl && (common_config('site', 'ssl') === 'sometimes')) + || common_config('site', 'ssl') === 'always') { + $proto = 'https'; + if (is_string(common_config('site', 'sslserver')) && + mb_strlen(common_config('site', 'sslserver')) > 0) { + $serverpart = common_config('site', 'sslserver'); + } else { + $serverpart = common_config('site', 'mobileserver'); + } + } else { + $proto = 'http'; + $serverpart = common_config('site', 'mobileserver'); + } + + return $proto.'://'.$serverpart.'/'.$pathpart.$relative; + } } -- cgit v1.2.3-54-g00ecf From 7addccacaab5bf7510fbe537b512bc8d5c3f558f Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 4 Oct 2009 16:26:04 +0000 Subject: Added ability to define mobile stylesheets (handheld, screen) at the theme level. If there are no mobile stylesheets in the theme directory, it will use the ones that come with the plugin. --- plugins/MobileProfile/MobileProfilePlugin.php | 24 ++++++++++++++++++++++++ plugins/MobileProfile/mp-handheld.css | 0 plugins/MobileProfile/mp-screen.css | 1 + 3 files changed, 25 insertions(+) create mode 100644 plugins/MobileProfile/mp-handheld.css create mode 100644 plugins/MobileProfile/mp-screen.css (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index 02a732493..35756cfe7 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -158,6 +158,30 @@ class MobileProfilePlugin extends WAP20Plugin } + function onStartShowStatusNetStyles($action) { + if (file_exists(theme_file('css/mp-screen.css'))) { + $action->cssLink('css/mp-screen.css', null, 'screen'); + } + else { + $action->element('link', array('rel' => 'stylesheet', + 'type' => 'text/css', + 'href' => common_path('plugins/MobileProfile/mp-screen.css') . '?version=' . STATUSNET_VERSION, + 'media' => 'screen')); + } + + if (file_exists(theme_file('css/mp-handheld.css'))) { + $action->cssLink('css/mp-handheld.css', null, 'handheld'); + } + else { + $action->element('link', array('rel' => 'stylesheet', + 'type' => 'text/css', + 'href' => common_path('plugins/MobileProfile/mp-handheld.css') . '?version=' . STATUSNET_VERSION, + 'media' => 'handheld')); + } + + return false; + } + function onStartShowAside($action) { diff --git a/plugins/MobileProfile/mp-handheld.css b/plugins/MobileProfile/mp-handheld.css new file mode 100644 index 000000000..e69de29bb diff --git a/plugins/MobileProfile/mp-screen.css b/plugins/MobileProfile/mp-screen.css new file mode 100644 index 000000000..31986eef0 --- /dev/null +++ b/plugins/MobileProfile/mp-screen.css @@ -0,0 +1 @@ +@import url(../../theme/base/css/display.css); -- cgit v1.2.3-54-g00ecf From a7bed6f7d90098a16ec6da743ac34f0983e6afe3 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 4 Oct 2009 16:50:53 +0000 Subject: Added custom showHead --- plugins/MobileProfile/MobileProfilePlugin.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index 35756cfe7..e7db09f15 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -158,6 +158,20 @@ 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 (file_exists(theme_file('css/mp-screen.css'))) { $action->cssLink('css/mp-screen.css', null, 'screen'); -- cgit v1.2.3-54-g00ecf From ef7e4cb72d12b714215317635e1de4badf340529 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 4 Oct 2009 20:42:03 +0000 Subject: If not meant to serveMobile, show the default styles --- plugins/MobileProfile/MobileProfilePlugin.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index e7db09f15..117e0aae6 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -173,6 +173,10 @@ class MobileProfilePlugin extends WAP20Plugin function onStartShowStatusNetStyles($action) { + if (!$action->serveMobile) { + return true; + } + if (file_exists(theme_file('css/mp-screen.css'))) { $action->cssLink('css/mp-screen.css', null, 'screen'); } -- cgit v1.2.3-54-g00ecf From 3ee1af9aaa3a7e69a97f36498e6fe9617f708581 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 4 Oct 2009 20:43:52 +0000 Subject: Minor adjustment to indenting --- plugins/MobileProfile/MobileProfilePlugin.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index 117e0aae6..3f3d10261 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -158,7 +158,8 @@ class MobileProfilePlugin extends WAP20Plugin } - function onStartShowHeadElements($action) { + function onStartShowHeadElements($action) + { if (!$action->serveMobile) { return true; } @@ -172,7 +173,8 @@ class MobileProfilePlugin extends WAP20Plugin } - function onStartShowStatusNetStyles($action) { + function onStartShowStatusNetStyles($action) + { if (!$action->serveMobile) { return true; } -- cgit v1.2.3-54-g00ecf From fe4a49d4a5cc728d6ee0484ceecba796af29fc42 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 4 Oct 2009 20:53:30 +0000 Subject: If they are not on the mobile site or not interested in getting the mobile profile, then give them the regular output. --- plugins/MobileProfile/MobileProfilePlugin.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index 3f3d10261..28a2eb0c1 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -141,6 +141,10 @@ class MobileProfilePlugin extends WAP20Plugin } } + if (!$this->serveMobile) { + return true; + } + header('Content-Type: '.$type); $action->extraHeaders(); -- cgit v1.2.3-54-g00ecf From 5087a24c487891f4c5bc9fe2ff65be12fa74b930 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 4 Oct 2009 21:09:16 +0000 Subject: Init showHeader --- plugins/MobileProfile/MobileProfilePlugin.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index 28a2eb0c1..90ec8129d 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -207,6 +207,25 @@ class MobileProfilePlugin extends WAP20Plugin } + function onStartShowHeader($action) + { + if (!$this->serveMobile) { + return true; + } + + $action->elementStart('div', array('id' => 'header')); + $action->showLogo(); + $action->showPrimaryNav(); + $action->showSiteNotice(); + if (common_logged_in()) { + $action->showNoticeForm(); + } else { + $action->showAnonymousMessage(); + } + $action->elementEnd('div'); + } + + function onStartShowAside($action) { if ($this->serveMobile) { -- cgit v1.2.3-54-g00ecf From d001c5f4b1ebfd2a28baba3138eae4902598618c Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 4 Oct 2009 21:37:05 +0000 Subject: Init showLogo --- plugins/MobileProfile/MobileProfilePlugin.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index 90ec8129d..4e9bfd6c8 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -214,7 +214,7 @@ class MobileProfilePlugin extends WAP20Plugin } $action->elementStart('div', array('id' => 'header')); - $action->showLogo(); + $this->_showLogo($action); $action->showPrimaryNav(); $action->showSiteNotice(); if (common_logged_in()) { @@ -226,6 +226,26 @@ class MobileProfilePlugin extends WAP20Plugin } + function _showLogo($action) + { + $action->elementStart('address', 'vcard'); + $action->elementStart('a', array('class' => 'url home bookmark', + 'href' => common_local_url('public'))); + if (common_config('site', 'mobilelogo') || + file_exists(theme_file('logo.png')) || + file_exists(theme_file('mobilelogo.gif'))) { + + $action->element('img', array('class' => 'photo', + 'src' => (common_config('site', 'mobilelogo')) ? common_config('site', 'mobilelogo') : + ((file_exists(theme_file('mobilelogo.gif'))) ? (theme_path('mobilelogo.gif')): theme_path('logo.png')), + 'alt' => common_config('site', 'name'))); + } + $action->element('span', array('class' => 'fn org'), common_config('site', 'name')); + $action->elementEnd('a'); + $action->elementEnd('address'); + } + + function onStartShowAside($action) { if ($this->serveMobile) { -- cgit v1.2.3-54-g00ecf From 3c9f177c03f631cdbc8f0a440fd2dc84d6252419 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 4 Oct 2009 21:37:24 +0000 Subject: Stop output after showing header --- plugins/MobileProfile/MobileProfilePlugin.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index 4e9bfd6c8..c28d61cbe 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -223,6 +223,8 @@ class MobileProfilePlugin extends WAP20Plugin $action->showAnonymousMessage(); } $action->elementEnd('div'); + + return false; } -- cgit v1.2.3-54-g00ecf From 479a5e74a3cdc70c1e69c96d04c505c8efa00eb9 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 4 Oct 2009 21:42:38 +0000 Subject: Removed site_notice and anon_notice from output because this information is not particularly crucial for the mobile user. --- plugins/MobileProfile/MobileProfilePlugin.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index c28d61cbe..37aeeee87 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -216,11 +216,8 @@ class MobileProfilePlugin extends WAP20Plugin $action->elementStart('div', array('id' => 'header')); $this->_showLogo($action); $action->showPrimaryNav(); - $action->showSiteNotice(); if (common_logged_in()) { $action->showNoticeForm(); - } else { - $action->showAnonymousMessage(); } $action->elementEnd('div'); -- cgit v1.2.3-54-g00ecf From acda8d4c7914b0bcea974c34d72c8b93ba731c17 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 4 Oct 2009 22:16:59 +0000 Subject: Init showPrimaryNav --- plugins/MobileProfile/MobileProfilePlugin.php | 48 ++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index 37aeeee87..7a36522f1 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -215,7 +215,7 @@ class MobileProfilePlugin extends WAP20Plugin $action->elementStart('div', array('id' => 'header')); $this->_showLogo($action); - $action->showPrimaryNav(); + $this->_showPrimaryNav($action); if (common_logged_in()) { $action->showNoticeForm(); } @@ -245,6 +245,52 @@ class MobileProfilePlugin extends WAP20Plugin } + function _showPrimaryNav($action) { + $user = common_current_user(); + $connect = ''; + if (common_config('xmpp', 'enabled')) { + $connect = 'imsettings'; + } else if (common_config('sms', 'enabled')) { + $connect = 'smssettings'; + } else if (common_config('twitter', 'enabled')) { + $connect = 'twittersettings'; + } + + $action->elementStart('ul', array('id' => 'site_nav_global_primary')); + if ($user) { + $action->menuItem(common_local_url('all', array('nickname' => $user->nickname)), + _('Home')); + $action->menuItem(common_local_url('profilesettings'), + _('Account')); + if ($connect) { + $action->menuItem(common_local_url($connect), + _('Connect')); + } + if (common_config('invite', 'enabled')) { + $action->menuItem(common_local_url('invite'), + _('Invite')); + } + $action->menuItem(common_local_url('logout'), + _('Logout')); + } + else { + if (!common_config('site', 'closed')) { + $action->menuItem(common_local_url('register'), + _('Register')); + } + $action->menuItem(common_local_url('login'), + _('Login')); + } + $action->menuItem(common_local_url('doc', array('title' => 'help')), + _('Help')); + if ($user || !common_config('site', 'private')) { + $action->menuItem(common_local_url('peoplesearch'), + _('Search')); + } + $action->elementEnd('ul'); + } + + function onStartShowAside($action) { if ($this->serveMobile) { -- cgit v1.2.3-54-g00ecf From 5c01501f5534fed7d0ec32ac4a33396bd99f508d Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 5 Oct 2009 10:29:34 +0000 Subject: Minor correction --- plugins/MobileProfile/MobileProfilePlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index 7a36522f1..79b080b03 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -179,7 +179,7 @@ class MobileProfilePlugin extends WAP20Plugin function onStartShowStatusNetStyles($action) { - if (!$action->serveMobile) { + if (!$this->serveMobile) { return true; } -- cgit v1.2.3-54-g00ecf From 7b4d138946d76200ce1c7c20e85e67538be5bf10 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 5 Oct 2009 14:42:11 +0000 Subject: Init showNoticeFormData --- plugins/MobileProfile/MobileProfilePlugin.php | 39 +++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index 79b080b03..21eaa124e 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -291,6 +291,45 @@ class MobileProfilePlugin extends WAP20Plugin } + function onStartShowNoticeFormData($form) + { + if (!$this->serveMobile) { + return true; + } + + $form->out->element('textarea', array('id' => 'notice_data-text', + 'cols' => 35, + 'rows' => 4, + 'name' => 'status_textarea'), + ($form->content) ? $form->content : ''); + + $contentLimit = Notice::maxContent(); + + $form->out->element('script', array('type' => 'text/javascript'), + 'maxLength = ' . $contentLimit . ';'); + + if ($contentLimit > 0) { + $form->out->element('div', array('id' => 'notice_text-count'), + $contentLimit); + } + + if (common_config('attachments', 'uploads')) { + $form->out->element('label', array('for' => 'notice_data-attach'),_('Attach')); + $form->out->element('input', array('id' => 'notice_data-attach', + 'type' => 'file', + 'name' => 'attach', + 'title' => _('Attach a file'))); + $form->out->hidden('MAX_FILE_SIZE', common_config('attachments', 'file_quota')); + } + if ($form->action) { + $form->out->hidden('notice_return-to', $form->action, 'returnto'); + } + $form->out->hidden('notice_in-reply-to', $form->inreplyto, 'inreplyto'); + + return false; + } + + function onStartShowAside($action) { if ($this->serveMobile) { -- cgit v1.2.3-54-g00ecf From 0799f48197c67dbbbd1b613f1fc9c66d9250f2ae Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Fri, 9 Oct 2009 14:48:14 +0000 Subject: Updated mobilelogo extension --- plugins/MobileProfile/MobileProfilePlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index 21eaa124e..1164974b9 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -236,7 +236,7 @@ class MobileProfilePlugin extends WAP20Plugin $action->element('img', array('class' => 'photo', 'src' => (common_config('site', 'mobilelogo')) ? common_config('site', 'mobilelogo') : - ((file_exists(theme_file('mobilelogo.gif'))) ? (theme_path('mobilelogo.gif')): theme_path('logo.png')), + ((file_exists(theme_file('mobilelogo.png'))) ? (theme_path('mobilelogo.png')) : theme_path('logo.png')), 'alt' => common_config('site', 'name'))); } $action->element('span', array('class' => 'fn org'), common_config('site', 'name')); -- cgit v1.2.3-54-g00ecf From 0b741f15c2519103240fcdc9e74651a5c584724f Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Fri, 9 Oct 2009 15:32:56 +0000 Subject: Removed the Help item from global primary navigation in the header since it is also used in the footer area. Frees up 'precious'space. --- plugins/MobileProfile/MobileProfilePlugin.php | 2 -- 1 file changed, 2 deletions(-) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index 1164974b9..ecaea29c0 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -281,8 +281,6 @@ class MobileProfilePlugin extends WAP20Plugin $action->menuItem(common_local_url('login'), _('Login')); } - $action->menuItem(common_local_url('doc', array('title' => 'help')), - _('Help')); if ($user || !common_config('site', 'private')) { $action->menuItem(common_local_url('peoplesearch'), _('Search')); -- cgit v1.2.3-54-g00ecf From 7af1c83f4e8d66e2f70006bf6568c5b8410a2311 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 12 Oct 2009 12:30:00 +0000 Subject: Fixed typo, added ipod --- plugins/MobileProfile/MobileProfilePlugin.php | 58 ++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 10 deletions(-) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index ecaea29c0..3785feeec 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -107,16 +107,54 @@ class MobileProfilePlugin extends WAP20Plugin // MP 1.0, 1.1, or 1.2 may be ideal. Possible? $this->mobiledevices = - array('alcatel', 'android', 'audiovox', 'au-mic,', - 'avantgo', 'blackberry', 'blazer', 'cldc-', 'danger', - 'epoc', 'ericsson', 'ericy', 'ipone', 'ipaq', 'j2me', - 'lg', 'midp-', 'mobile', 'mot', 'netfront', 'nitro', - 'nokia', 'opera mini', 'palm', 'palmsource', - 'panasonic', 'philips', 'pocketpc', 'portalmmm', - 'rover', 'samsung', 'sanyo', 'series60', 'sharp', - 'sie-', 'smartphone', 'sony', 'symbian', - 'up.browser', 'up.link', 'up.link', 'vodafone', - 'wap1', 'wap2', 'windows ce'); + array( + 'alcatel', + 'android', + 'audiovox', + 'au-mic,', + 'avantgo', + 'blackberry', + 'blazer', + 'cldc-', + 'danger', + 'epoc', + 'ericsson', + 'ericy', + 'iphone', + 'ipaq', + 'ipod', + 'j2me', + 'lg', + 'midp-', + 'mobile', + 'mot', + 'netfront', + 'nitro', + 'nokia', + 'opera mini', + 'palm', + 'palmsource', + 'panasonic', + 'philips', + 'pocketpc', + 'portalmmm', + 'rover', + 'samsung', + 'sanyo', + 'series60', + 'sharp', + 'sie-', + 'smartphone', + 'sony', + 'symbian', + 'up.browser', + 'up.link', + 'up.link', + 'vodafone', + 'wap1', + 'wap2', + 'windows ce' + ); $httpuseragent = strtolower($_SERVER['HTTP_USER_AGENT']); -- cgit v1.2.3-54-g00ecf From 44a5cd28050fa732c32943a8193664f44a4cfad1 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 12 Oct 2009 12:46:53 +0000 Subject: Added function to set a list of features the mobile device supports and output accordingly e.g., if device is not known to have an open file system or unable to make use of input type="file" don't output that feature --- plugins/MobileProfile/MobileProfilePlugin.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index 3785feeec..f36d97ad9 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -51,6 +51,7 @@ class MobileProfilePlugin extends WAP20Plugin { public $DTD = null; public $serveMobile = false; + public $mobileFeatures = array(); function __construct($DTD='http://www.wapforum.org/DTD/xhtml-mobile10.dtd') { @@ -106,8 +107,7 @@ class MobileProfilePlugin extends WAP20Plugin // Or, detect the mobile devices based on their support for // MP 1.0, 1.1, or 1.2 may be ideal. Possible? - $this->mobiledevices = - array( + $this->mobiledevices = array( 'alcatel', 'android', 'audiovox', @@ -160,6 +160,8 @@ class MobileProfilePlugin extends WAP20Plugin foreach($this->mobiledevices as $md) { if (strstr($httpuseragent, $md) !== false) { + setMobileFeatures($httpuseragent); + $this->serveMobile = true; break; } @@ -200,6 +202,24 @@ class MobileProfilePlugin extends WAP20Plugin } + function setMobileFeatures($useragent) + { + /* List of devices that support input type="file" */ + $mobiledeviceInputFileType = array( + 'nokia' + ); + + $this->mobileFeatures['inputfiletype'] = false; + + foreach($mobiledeviceInputFileType as $md) { + if (strstr($useragent, $md) !== false) { + $this->mobileFeatures['inputfiletype'] = true; + break; + } + } + } + + function onStartShowHeadElements($action) { if (!$action->serveMobile) { -- cgit v1.2.3-54-g00ecf From 410883d146282a0a416181f8ca0dae817597593b Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 12 Oct 2009 12:58:51 +0000 Subject: Ran phpcs and fixed a few errors and warnings --- plugins/MobileProfile/MobileProfilePlugin.php | 37 ++++++++++++--------------- 1 file changed, 16 insertions(+), 21 deletions(-) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index f36d97ad9..dada1948f 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -49,13 +49,13 @@ require_once INSTALLDIR.'/plugins/Mobile/WAP20Plugin.php'; class MobileProfilePlugin extends WAP20Plugin { - public $DTD = null; - public $serveMobile = false; - public $mobileFeatures = array(); + public $DTD = null; + public $serveMobile = false; + public $mobileFeatures = array(); function __construct($DTD='http://www.wapforum.org/DTD/xhtml-mobile10.dtd') { - $this->DTD = $DTD; + $this->DTD = $DTD; parent::__construct(); } @@ -86,13 +86,11 @@ class MobileProfilePlugin extends WAP20Plugin $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'])) { $this->serveMobile = true; - } - else { + } 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 { + } else { // If they are a mobile device that supports WAP 2.0, // serve them MP @@ -158,7 +156,7 @@ class MobileProfilePlugin extends WAP20Plugin $httpuseragent = strtolower($_SERVER['HTTP_USER_AGENT']); - foreach($this->mobiledevices as $md) { + foreach ($this->mobiledevices as $md) { if (strstr($httpuseragent, $md) !== false) { setMobileFeatures($httpuseragent); @@ -204,14 +202,13 @@ class MobileProfilePlugin extends WAP20Plugin function setMobileFeatures($useragent) { - /* List of devices that support input type="file" */ $mobiledeviceInputFileType = array( 'nokia' ); $this->mobileFeatures['inputfiletype'] = false; - foreach($mobiledeviceInputFileType as $md) { + foreach ($mobiledeviceInputFileType as $md) { if (strstr($useragent, $md) !== false) { $this->mobileFeatures['inputfiletype'] = true; break; @@ -243,8 +240,7 @@ class MobileProfilePlugin extends WAP20Plugin if (file_exists(theme_file('css/mp-screen.css'))) { $action->cssLink('css/mp-screen.css', null, 'screen'); - } - else { + } else { $action->element('link', array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => common_path('plugins/MobileProfile/mp-screen.css') . '?version=' . STATUSNET_VERSION, @@ -253,8 +249,7 @@ class MobileProfilePlugin extends WAP20Plugin if (file_exists(theme_file('css/mp-handheld.css'))) { $action->cssLink('css/mp-handheld.css', null, 'handheld'); - } - else { + } else { $action->element('link', array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => common_path('plugins/MobileProfile/mp-handheld.css') . '?version=' . STATUSNET_VERSION, @@ -303,8 +298,9 @@ class MobileProfilePlugin extends WAP20Plugin } - function _showPrimaryNav($action) { - $user = common_current_user(); + function _showPrimaryNav($action) + { + $user = common_current_user(); $connect = ''; if (common_config('xmpp', 'enabled')) { $connect = 'imsettings'; @@ -330,8 +326,7 @@ class MobileProfilePlugin extends WAP20Plugin } $action->menuItem(common_local_url('logout'), _('Logout')); - } - else { + } else { if (!common_config('site', 'closed')) { $action->menuItem(common_local_url('register'), _('Register')); @@ -370,7 +365,7 @@ class MobileProfilePlugin extends WAP20Plugin } if (common_config('attachments', 'uploads')) { - $form->out->element('label', array('for' => 'notice_data-attach'),_('Attach')); + $form->out->element('label', array('for' => 'notice_data-attach'), _('Attach')); $form->out->element('input', array('id' => 'notice_data-attach', 'type' => 'file', 'name' => 'attach', @@ -414,7 +409,7 @@ class MobileProfilePlugin extends WAP20Plugin $serverpart = common_config('site', 'mobileserver'); } } else { - $proto = 'http'; + $proto = 'http'; $serverpart = common_config('site', 'mobileserver'); } -- cgit v1.2.3-54-g00ecf From d65702b301a15b9255e9cdb89d3a31c5c6bc355f Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 12 Oct 2009 13:05:19 +0000 Subject: Only output attachment if the mobile device is interested --- plugins/MobileProfile/MobileProfilePlugin.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index dada1948f..2b1ccf520 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -365,12 +365,14 @@ class MobileProfilePlugin extends WAP20Plugin } if (common_config('attachments', 'uploads')) { - $form->out->element('label', array('for' => 'notice_data-attach'), _('Attach')); - $form->out->element('input', array('id' => 'notice_data-attach', - 'type' => 'file', - 'name' => 'attach', - 'title' => _('Attach a file'))); - $form->out->hidden('MAX_FILE_SIZE', common_config('attachments', 'file_quota')); + if ($this->mobileFeatures['inputfiletype']) { + $form->out->element('label', array('for' => 'notice_data-attach'), _('Attach')); + $form->out->element('input', array('id' => 'notice_data-attach', + 'type' => 'file', + 'name' => 'attach', + 'title' => _('Attach a file'))); + $form->out->hidden('MAX_FILE_SIZE', common_config('attachments', 'file_quota')); + } } if ($form->action) { $form->out->hidden('notice_return-to', $form->action, 'returnto'); -- cgit v1.2.3-54-g00ecf From 0e333200a45402c7e040cf1e8c36808c93052b9f Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 12 Oct 2009 13:06:16 +0000 Subject: Added missing $this --- plugins/MobileProfile/MobileProfilePlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index 2b1ccf520..518ceb758 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -158,7 +158,7 @@ class MobileProfilePlugin extends WAP20Plugin foreach ($this->mobiledevices as $md) { if (strstr($httpuseragent, $md) !== false) { - setMobileFeatures($httpuseragent); + $this->setMobileFeatures($httpuseragent); $this->serveMobile = true; break; -- cgit v1.2.3-54-g00ecf From ed85dc2700eb664c98ca74fef2db2e548cf1a104 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 15 Oct 2009 11:25:38 +0000 Subject: Updated comments --- plugins/MobileProfile/MobileProfilePlugin.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index 518ceb758..eba460ed6 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -63,6 +63,7 @@ class MobileProfilePlugin extends WAP20Plugin function onStartShowHTML($action) { + if (!$type) { $httpaccept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : null; @@ -97,9 +98,9 @@ class MobileProfilePlugin extends WAP20Plugin // XXX: Browser sniffing sucks // I really don't like going through this every page, - // find a better way + // perhaps use $_SESSION or cookies - // May be better to categorize the devices in terms of + // May be better to group the devices in terms of // low,mid,high-end // Or, detect the mobile devices based on their support for -- cgit v1.2.3-54-g00ecf From 94c7b2b43ab04c94e85bc276e6ee9bd59d424984 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 15 Oct 2009 12:47:59 +0000 Subject: Changed textarea @cols value for smaller screens --- plugins/MobileProfile/MobileProfilePlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/MobileProfile/MobileProfilePlugin.php') diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index eba460ed6..4bbdb3541 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -350,7 +350,7 @@ class MobileProfilePlugin extends WAP20Plugin } $form->out->element('textarea', array('id' => 'notice_data-text', - 'cols' => 35, + 'cols' => 15, 'rows' => 4, 'name' => 'status_textarea'), ($form->content) ? $form->content : ''); -- cgit v1.2.3-54-g00ecf