From b78a730f82f22af1fed91dab7ba72b1aadbd7b32 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 9 Jan 2017 10:57:07 +0100 Subject: [PATCH] add method footerjs() which deliveres a temp. js file --- views/bootstrap/class.Bootstrap.php | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index c3484bf7c..957e5fdb9 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -124,22 +124,32 @@ background-image: linear-gradient(to bottom, #882222, #111111);; echo ''."\n"; echo ''."\n"; if($this->footerjs) { - echo ""; + $jscode .= "});\n"; + $hashjs = md5($jscode); + if(!is_dir($this->params['cachedir'].'/js')) { + SeedDMS_Core_File::makeDir($this->params['cachedir'].'/js'); + } + if(is_dir($this->params['cachedir'].'/js')) { + file_put_contents($this->params['cachedir'].'/js/'.$hashjs.'.js', $jscode); + } + echo ''."\n"; } if(method_exists($this, 'js')) echo ''."\n"; echo "\n\n"; } /* }}} */ + function footerjs() { /* {{{ */ + header('Content-Type: application/javascript'); + if(file_exists($this->params['cachedir'].'/js/'.$_GET['hash'].'.js')) { + readfile($this->params['cachedir'].'/js/'.$_GET['hash'].'.js'); + } + } /* }}} */ + function missingḺanguageKeys() { /* {{{ */ global $MISSING_LANG, $LANG; if($MISSING_LANG) {