X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FMobileProfile%2FMobileProfilePlugin.php;h=35756cfe79e425d16f22585f03f066ea48dd9429;hb=7addccacaab5bf7510fbe537b512bc8d5c3f558f;hp=cd88a6f7b7383f7897bb06f8e55b659a3cb6492f;hpb=12d4ecd73c36bcb892b068c03346df5743bc9077;p=quix0rs-gnu-social.git diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index cd88a6f7b7..35756cfe79 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') @@ -131,9 +131,12 @@ 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')); + // FIXME: Redirect to equivalent page on mobile site instead + header("Location: ".$this->_common_path('')); exit(); } } @@ -155,10 +158,36 @@ 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) { - + if ($this->serveMobile) { + return false; + } } @@ -167,6 +196,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; + } }