]> source.dussan.org Git - nextcloud-server.git/commitdiff
no need to store the form factor in the session - it's computation is rather cheep
authorThomas Müller <thomas.mueller@tmit.eu>
Wed, 12 Nov 2014 15:16:02 +0000 (16:16 +0100)
committerThomas Müller <thomas.mueller@tmit.eu>
Fri, 9 Jan 2015 09:19:28 +0000 (10:19 +0100)
Conflicts:
lib/private/template.php

lib/private/template.php

index 173345cc001807b6219d3e78e1224764722c1dc0..983c0e3628d125de2965cface832568ffc1e8af1 100644 (file)
@@ -97,36 +97,28 @@ class OC_Template extends \OC\Template\Base {
        }
 
        /**
-        * Returns the formfactor extension for current formfactor
+        * Returns the form factor extension for current form factor
         */
        static public function getFormFactorExtension()
        {
-               if (!\OC::$session) {
-                       return '';
-               }
-               // if the formfactor is not yet autodetected do the
-               // autodetection now. For possible formfactors check the
-               // detectFormfactor documentation
-               if (!\OC::$session->exists('formfactor')) {
-                       \OC::$session->set('formfactor', self::detectFormfactor());
-               }
                // allow manual override via GET parameter
                if(isset($_GET['formfactor'])) {
-                       \OC::$session->set('formfactor', $_GET['formfactor']);
+                       $formFactor = $_GET['formfactor'];
+               } else {
+                       $formFactor = self::detectFormfactor();
                }
-               $formfactor = \OC::$session->get('formfactor');
-               if($formfactor==='default') {
-                       $fext='';
-               }elseif($formfactor==='mobile') {
-                       $fext='.mobile';
-               }elseif($formfactor==='tablet') {
-                       $fext='.tablet';
-               }elseif($formfactor==='standalone') {
-                       $fext='.standalone';
+               if($formFactor==='default') {
+                       $formFactorExt='';
+               }elseif($formFactor==='mobile') {
+                       $formFactorExt='.mobile';
+               }elseif($formFactor==='tablet') {
+                       $formFactorExt='.tablet';
+               }elseif($formFactor==='standalone') {
+                       $formFactorExt='.standalone';
                }else{
-                       $fext='';
+                       $formFactorExt='';
                }
-               return $fext;
+               return $formFactorExt;
        }
 
        /**