]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/MobileProfile/MobileProfilePlugin.php
fix link for mobile profile when in singleuser mode
[quix0rs-gnu-social.git] / plugins / MobileProfile / MobileProfilePlugin.php
index 796bd3b529a61b1ffc498e75a705e3188e20b3d0..e6bc444ea489533172f7c5ad7a7d65225550050d 100644 (file)
@@ -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)
@@ -242,16 +251,14 @@ class MobileProfilePlugin extends WAP20Plugin
 
         $action->primaryCssLink();
 
+        $action->cssLink($this->path('mp-screen.css'),null,'screen');
         if (file_exists(Theme::file('css/mp-screen.css'))) {
             $action->cssLink('css/mp-screen.css', null, 'screen');
-        } else {
-            $action->cssLink($this->path('mp-screen.css'),null,'screen');
         }
 
+        $action->cssLink($this->path('mp-handheld.css'),null,'handheld');
         if (file_exists(Theme::file('css/mp-handheld.css'))) {
             $action->cssLink('css/mp-handheld.css', null, 'handheld');
-        } else {
-            $action->cssLink($this->path('mp-handheld.css'),null,'handheld');
         }
 
         // Allow other plugins to load their styles.
@@ -286,8 +293,16 @@ class MobileProfilePlugin extends WAP20Plugin
     function _showLogo($action)
     {
         $action->elementStart('address', 'vcard');
+        if (common_config('singleuser', 'enabled')) {
+            $user = User::singleUser();
+            $url = common_local_url('showstream', array('nickname' => $user->nickname));
+        } else {
+            $url = common_local_url('public');
+        }
+
         $action->elementStart('a', array('class' => 'url home bookmark',
-                                       'href' => common_local_url('public')));
+                                         'href' => $url));
+
         if (common_config('site', 'mobilelogo') ||
             file_exists(Theme::file('logo.png')) ||
             file_exists(Theme::file('mobilelogo.png'))) {
@@ -341,6 +356,16 @@ class MobileProfilePlugin extends WAP20Plugin
                 });
             });'
         );
+
+        if ($this->serveMobile) {
+            $action->inlineScript('
+                $(function() {
+                       $(".checkbox-wrapper").unbind("click");
+                });'
+            );
+        }
+
+
     }