From: vincent@cubedesigners.com Date: Wed, 10 Oct 2012 15:26:36 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=e3d3ddc7c8ce3fe8762a65c81c973b222c17da06;p=cubeextranet.git --- diff --git a/inc/ws/Util/html5/class.ws.html5.compiler.php b/inc/ws/Util/html5/class.ws.html5.compiler.php index 923fe82b1..6dbb1cd85 100644 --- a/inc/ws/Util/html5/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/class.ws.html5.compiler.php @@ -19,7 +19,7 @@ class wsHTML5Compiler { protected static $resolutions = array(150, 36); protected static $uaPrefixes = array('-moz-', '-webkit-', '-o-', '-ms-', ''); - protected static $jsFiles = array( + public $jsFiles = array( 'js/libs/fix/ios-orientation.js', 'js/libs/fix/detect-zoom.js', 'js/libs/cube/fb.js', @@ -47,11 +47,11 @@ class wsHTML5Compiler { 'js/libs/fluidbook/fluidbook.stats.js', 'js/libs/fluidbook/fluidbook.js', 'js/main.js'); - protected static $debugJsFiles = array( + public $debugJsFiles = array( 'js/libs/Three.js', 'data/search.js' ); - protected static $testJsFiles = array( + public $testJsFiles = array( 'js/libs/cube/fb.js', 'js/libs/modernizr.js', 'js/libs/jquery/jquery.js', @@ -60,7 +60,7 @@ class wsHTML5Compiler { 'js/libs/jquery/jquery.hashchange.js', 'js/tester.js' ); - protected static $widgetJsFiles = array( + public $widgetJsFiles = array( 'js/libs/cube/fb.js', 'js/libs/modernizr.js', 'js/libs/jquery/jquery.js', @@ -227,6 +227,7 @@ class wsHTML5Compiler { // Copy swf copy($this->assets . '/swf/video.swf', $this->vdir . '/swf/video.swf'); + $this->loadPlugins(); $this->writeImages(); $linksCSS = $this->writeLinks(); $numCSS = $this->writeCSS($this->vdir . '/data/style/style_%d.css', $linksCSS); @@ -238,6 +239,31 @@ class wsHTML5Compiler { $this->writeCache(); } + protected function loadPlugins() { + $e = explode("\n", $this->book->parametres->mobilePlugins); + + $main = array_pop($this->jsFiles); + + foreach ($e as $plugin) { + $plugin = trim($plugin); + if ($plugin == '') { + continue; + } + + $d = '/plugins/' . str_replace('.', '/', $plugin); + $dir = $this->assets . $d; + if (!file_exists($dir)) { + continue; + } + + if (file_exists($dir . '/plugin.js')) { + $this->jsFiles[] = $d . '/plugin.js'; + } + } + + array_push($this->jsFiles, $main); + } + protected function writeCache() { $videosExtensions = array('flv', 'ogv', 'webm', 'mp4'); $videos = array('flv' => array(), 'ogv' => array(), 'webm' => array(), 'mp4' => array()); @@ -381,10 +407,10 @@ class wsHTML5Compiler { } $scripts = array(); - foreach (self::$debugJsFiles as $js) { + foreach ($this->debugJsFiles as $js) { $scripts[] = ''; } - foreach (self::$jsFiles as $js) { + foreach ($this->jsFiles as $js) { $scripts[] = ''; } @@ -392,7 +418,7 @@ class wsHTML5Compiler { $script = implode("\n\t\t", $scripts); $scripts = array(); - foreach (self::$testJsFiles as $js) { + foreach ($this->testJsFiles as $js) { $scripts[] = ''; } $scripts[] = ''; @@ -500,7 +526,7 @@ class wsHTML5Compiler { protected function writeJs() { $config = $this->writeConfig(); - $finals = array('fluidbook' => self::$jsFiles, 'widget' => self::$widgetJsFiles); + $finals = array('fluidbook' => $this->jsFiles, 'widget' => $this->widgetJsFiles); foreach ($finals as $jsfinal => $files) { $mintime = 0; @@ -583,7 +609,8 @@ class wsHTML5Compiler { // Set the icon list with the color $icons = array('nav-bookmark' => $couleurI, 'nav-friend' => $couleurI, 'nav-help' => $couleurI, 'nav-index' => $couleurI, 'nav-sommaire' => $couleurI, 'next' => $arrowsColor, 'previous' => $arrowsColor, 'search' => $couleurI, 'nav-facebook' => $couleurI, 'nav-twitter' => $couleurI, - 'help-fingers' => $couleurI, 'help-mouse' => $couleurI, 'nav-home' => $couleurI, 'nav-archives' => $couleurI); + 'help-fingers' => $couleurI, 'help-mouse' => $couleurI, 'nav-home' => $couleurI, 'nav-archives' => $couleurI, 'nav-map' => $couleurI, + 'nav-tag' => $couleurI); foreach ($icons as $icon => $color) { wsTools::colorizeAndRasterizeIcon($this->theme->parametres->iconSet, $icon, $color, $this->vdir . '/data/images/', 4, $w, $h);