From 6552fec1134785e9a669f40820c2679f8e8c96c6 Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Wed, 12 Nov 2014 16:16:02 +0100 Subject: no need to store the form factor in the session - it's computation is rather cheep Conflicts: lib/private/template.php --- lib/private/template.php | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/lib/private/template.php b/lib/private/template.php index 173345cc001..983c0e3628d 100644 --- a/lib/private/template.php +++ b/lib/private/template.php @@ -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; } /** -- cgit v1.2.3