]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 10 Oct 2012 15:26:36 +0000 (15:26 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 10 Oct 2012 15:26:36 +0000 (15:26 +0000)
inc/ws/Util/html5/class.ws.html5.compiler.php

index 923fe82b1512c150fad5dee6ab7e83c4b5ee35dc..6dbb1cd85320c28b99ede11e4c4bff1face690e2 100644 (file)
@@ -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[] = '<script type="text/javascript" src="' . $js . '"></script>';
                }
-               foreach (self::$jsFiles as $js) {
+               foreach ($this->jsFiles as $js) {
                        $scripts[] = '<script type="text/javascript" src="' . $js . '"></script>';
                }
 
@@ -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[] = '<script type="text/javascript" src="' . $js . '"></script>';
                }
                $scripts[] = '<script type="text/javascript" src="data/datas.js"></script>';
@@ -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);