]> _ Git - cubeextranet.git/commitdiff
done #2166 @1.5
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 26 Jul 2018 16:15:21 +0000 (16:15 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 26 Jul 2018 16:15:21 +0000 (16:15 +0000)
inc/ws/Util/class.ws.links.php
inc/ws/Util/html5/3dflip/class.ws.html5.compiler.php
inc/ws/Util/html5/master/class.ws.html5.compiler.php
inc/ws/Util/html5/master/class.ws.html5.links.php
inc/ws/Util/html5/master/class.ws.html5.seo.php

index f75fac90915166e9e613f1cd3edd7da1b805ad26..b11eecde8828eb2d555f343e17da195f7c841e8e 100644 (file)
@@ -30,7 +30,9 @@ class wsLinks
                        'display_area' => __('Afficher le lien au rollover'),
                        'extra' => __('Paramètre supplĂ©mentaire'),
                        'alternative' => __('Alternative'),
-                       'image' => __('Image')
+                       'read_mode' => __('Mode de lecture'),
+                       'image' => __('Image'),
+                       'group' => __('Groupe'),
                );
 
                new PHPExcel();
index 80cda6617e6e404cf9fa29dc1a18efd4be0fa32b..5b26b904253cde4d695c12f594be91c3f5dc6467 100644 (file)
@@ -168,6 +168,7 @@ class wsHTML5Compiler
        public $beginBody = array();
        public $seoArticles = [];
        public $securityPolicyWhitelist = ['*.google-analytics.com', '*.youtube.com', '*.ytimg.com'];
+       protected $_indexVars = null;
 
        public $_signature;
        /**
@@ -358,6 +359,10 @@ class wsHTML5Compiler
                        $this->vdir->copyDirectory($from, $directory);
                }
 
+               if ($this->book->parametres->scorm_enable) {
+                       $this->book->parametres->seoVersion = false;
+               }
+
                $this->log('Copied assets');
                $this->loadPlugins();
                $this->log('Plugins loaded');
@@ -485,163 +490,184 @@ class wsHTML5Compiler
 
        protected function _writeIndex($page)
        {
-               global $core;
 
                $seo = $this->seo->pages[$page];
                $html = $seo->getHTML();
 
-               $titre = $this->book->parametres->title;
+               $iv = $this->getIndexVars();
 
-
-               if (null === $this->_signature) {
-               $daoSignature = new wsDAOSignature($core->con);
-                       $this->_signature = $daoSignature->selectById($this->book->parametres->signature);
+               foreach ($iv as $k => $v) {
+                       $html = str_replace($k, $v, $html);
                }
 
-               $credits = '';
-               if ($this->_signature->partner != '') {
-                       $credits = '<a href="' . $this->_signature->partnerLink . '" target="_blank">' . $this->_signature->partner . '</a> ';
+               if ($this->book->parametres->seoVersion) {
+                       $seo->writePage($html, $this->vdir);
+               }
+               if ($page == 1) {
+                       $seo->writePage($html, $this->vdir, 'index.html');
                }
-               $credits .= '<a href="' . $this->_signature->mainLink . '" target="_blank">' . $this->_signature->main . '</a>';
+       }
 
-               $hiddenContents = implode("\n", $this->hiddenContents);
+       public function getIndexVars()
+       {
+               if (null === $this->_indexVars) {
+                       global $core;
+                       $titre = $this->book->parametres->title;
 
-               $bgcolor = $this->theme->parametres->loadingBackColor;
+                       if (null === $this->_signature) {
+                               $daoSignature = new wsDAOSignature($core->con);
+                               $this->_signature = $daoSignature->selectById($this->book->parametres->signature);
+                       }
 
-               // Feuilles de style
-               $sheets = array_merge($this->stylesheets, $this->specialCSS);
+                       $credits = '';
+                       if ($this->_signature->partner != '') {
+                               $credits = '<a href="' . $this->_signature->partnerLink . '" target="_blank">' . $this->_signature->partner . '</a> ';
+                       }
+                       $credits .= '<a href="' . $this->_signature->mainLink . '" target="_blank">' . $this->_signature->main . '</a>';
 
-               $style = array();
-               foreach ($sheets as $sheet) {
-                       $style[] = '<link type="text/css" rel="stylesheet" media="screen" href="' . $sheet . '">';
-               }
-               $style = implode("\n\t\t", $style);
+                       $hiddenContents = implode("\n", $this->hiddenContents);
 
-               $pagesContents = '';
+                       $bgcolor = $this->theme->parametres->loadingBackColor;
 
-               $cache = '';
+                       // Feuilles de style
+                       $sheets = array_merge($this->stylesheets, $this->specialCSS);
 
-               $beginbody = implode("\n", array_unique($this->beginBody));
+                       $style = array();
+                       foreach ($sheets as $sheet) {
+                               $style[] = '<link type="text/css" rel="stylesheet" media="screen" href="' . $sheet . '">';
+                       }
+                       $style = implode("\n\t\t", $style);
 
-               $iscript = '';
-               if (count($this->htmlmultimedia)) {
-                       $iscript .= '<script type="text/javascript">' . "\n";
-                       $iscript .= implode("\n", $this->htmlmultimedia);
-                       $iscript .= '</script>' . "\n";
-               }
+                       $pagesContents = '';
 
-               $script = '<script type="text/javascript">var FLUIDBOOK_START_PAGE="' . $page . '";</script>' . "\n";
-               $script .= '<script type="text/javascript" charset="utf-8" src="data/datas.js"></script>' . "\n";
-               $script .= '<script type="text/javascript" charset="utf-8" src="data/fluidbook.js"></script>' . "\n";
-               if ($this->book->parametres->scorm_enable) {
-                       $script .= '<script type="text/javascript" charset="utf-8" src="data/scorm.js"></script>' . "\n";
-               }
-               if (count($this->specialJsFiles)) {
-                       $script .= '<script type="text/javascript" charset="utf-8" src="data/special.js"></script>' . "\n";
-               }
-               foreach ($this->pluginJs as $p) {
-                       $script .= '<script type="text/javascript" charset="utf-8" src="' . $p . '"></script>' . "\n";
-               }
-               $script .= $iscript;
+                       $cache = '';
+
+                       $beginbody = implode("\n", array_unique($this->beginBody));
 
-               $socialTitle = $this->book->parametres->facebook_title ? $this->book->parametres->facebook_title : $titre;
-               $socialDescription = $this->book->parametres->seoDescription ? $this->book->parametres->seoDescription : $this->book->parametres->seoDescription;
-               $socialImage = 'https://workshop.fluidbook.com/services/facebook_thumbnail?id=' . $this->book_id . '&j=' . TIME;
-               $dim = CubeIT_Image::getimagesize($socialImage);
-               $socialImageWidth = $dim[0];
-               $socialImageHeight = $dim[1];
+                       $iscript = '';
+                       if (count($this->htmlmultimedia)) {
+                               $iscript .= '<script type="text/javascript">' . "\n";
+                               $iscript .= implode("\n", $this->htmlmultimedia);
+                               $iscript .= '</script>' . "\n";
+                       }
 
-               $twittercard = '<meta name="twitter:title" content="' . html::escapeHTML($socialTitle) . '">
+                       $script = '<script type="text/javascript">var FLUIDBOOK_START_PAGE="' . $page . '";</script>' . "\n";
+                       $script = '<script type="text/javascript" charset="utf-8" src="data/datas.js"></script>' . "\n";
+                       $script .= '<script type="text/javascript" charset="utf-8" src="data/fluidbook.js"></script>' . "\n";
+                       if ($this->book->parametres->scorm_enable) {
+                               $script .= '<script type="text/javascript" charset="utf-8" src="data/scorm.js"></script>' . "\n";
+                       }
+                       if (count($this->specialJsFiles)) {
+                               $script .= '<script type="text/javascript" charset="utf-8" src="data/special.js"></script>' . "\n";
+                       }
+                       foreach ($this->pluginJs as $p) {
+                               $script .= '<script type="text/javascript" charset="utf-8" src="' . $p . '"></script>' . "\n";
+                       }
+                       $script .= $iscript;
+
+                       $socialTitle = $this->book->parametres->facebook_title ? $this->book->parametres->facebook_title : $titre;
+                       $socialDescription = $this->book->parametres->seoDescription ? $this->book->parametres->seoDescription : $this->book->parametres->seoDescription;
+                       $socialImage = 'https://workshop.fluidbook.com/services/facebook_thumbnail?id=' . $this->book_id . '&j=' . TIME;
+                       $dim = CubeIT_Image::getimagesize($socialImage);
+                       $socialImageWidth = $dim[0];
+                       $socialImageHeight = $dim[1];
+
+                       $twittercard = '<meta name="twitter:title" content="' . html::escapeHTML($socialTitle) . '">
        <meta name="twitter:description" content="' . html::escapeHTML($socialDescription) . '">
        <meta name="twitter:image" content="' . $socialImage . '">
        <meta name="twitter:site" content="@Fluidbook">
        <meta name="twitter:card" content="summary_large_image">';
-               $opengraph = '<meta property="og:title" content="' . html::escapeHTML($socialTitle) . '"/>
+                       $opengraph = '<meta property="og:title" content="' . html::escapeHTML($socialTitle) . '"/>
        <meta property="og:description" content="' . html::escapeHTML($socialDescription) . '"/>
        <meta property="og:image" content="' . $socialImage . '"/>
        <meta property="og:image:width" content="' . $socialImageWidth . '"/>
        <meta property="og:image:height" content="' . $socialImageHeight . '"/>';
 
-               $favicon = '';
-               $hasIos = false;
-               if ($this->theme->parametres->iosicon != '') {
-                       $hasIos = true;
-                       $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->iosicon, 'data/apple-touch-icon.png');
-                       $favicon .= '<link rel="apple-touch-icon" href="data/apple-touch-icon.png" />';
-               }
-               if ($this->theme->parametres->favicon != '') {
-
-                       $pngFile = $this->themeRoot . '/' . $this->theme->parametres->favicon;
-                       $icoFile = $this->themeRoot . '/favicon.ico';
-                       if (!file_exists($icoFile) || filemtime($icoFile) < filemtime($pngFile) || filemtime(__FILE__) > filemtime($icoFile)) {
-                               $tmp = CubeIT_Files::tempnam() . '.png';
-                               $convert = "convert $pngFile -resize 64x64^ -gravity center $tmp";
-                               `$convert`;
-
-                               $icotool = new cubeCommandLine('icotool');
-                               $icotool->setArg('c');
-                               $icotool->setArg('o', $icoFile);
-                               $icotool->setArg(null, $tmp);
-                               $icotool->execute();
-
-                               unlink($tmp);
+                       $favicon = '';
+                       $hasIos = false;
+                       if ($this->theme->parametres->iosicon != '') {
+                               $hasIos = true;
+                               $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->iosicon, 'data/apple-touch-icon.png');
+                               $favicon .= '<link rel="apple-touch-icon" href="data/apple-touch-icon.png" />';
                        }
-                       $this->vdir->copy($pngFile, 'data/favicon.png');
-                       $this->vdir->copy($icoFile, 'data/favicon.ico');
-                       $favicon .= '<link rel="shortcut icon" href="data/favicon.ico" />';
-                       $favicon .= '<link rel="icon" type="image/vnd.microsoft.icon" href="data/favicon.ico" />';
-                       $favicon .= '<link rel="icon" type="image/png" href="data/favicon.png" />';
-                       if (!$hasIos) {
-                               $favicon .= '<link rel="apple-touch-icon" href="data/favicon.png" />';
+                       if ($this->theme->parametres->favicon != '') {
+
+                               $pngFile = $this->themeRoot . '/' . $this->theme->parametres->favicon;
+                               $icoFile = $this->themeRoot . '/favicon.ico';
+                               if (!file_exists($icoFile) || filemtime($icoFile) < filemtime($pngFile) || filemtime(__FILE__) > filemtime($icoFile)) {
+                                       $tmp = CubeIT_Files::tempnam() . '.png';
+                                       $convert = "convert $pngFile -resize 64x64^ -gravity center $tmp";
+                                       `$convert`;
+
+                                       $icotool = new cubeCommandLine('icotool');
+                                       $icotool->setArg('c');
+                                       $icotool->setArg('o', $icoFile);
+                                       $icotool->setArg(null, $tmp);
+                                       $icotool->execute();
+
+                                       unlink($tmp);
+                               }
+                               $this->vdir->copy($pngFile, 'data/favicon.png');
+                               $this->vdir->copy($icoFile, 'data/favicon.ico');
+                               $favicon .= '<link rel="shortcut icon" href="data/favicon.ico" />';
+                               $favicon .= '<link rel="icon" type="image/vnd.microsoft.icon" href="data/favicon.ico" />';
+                               $favicon .= '<link rel="icon" type="image/png" href="data/favicon.png" />';
+                               if (!$hasIos) {
+                                       $favicon .= '<link rel="apple-touch-icon" href="data/favicon.png" />';
+                               }
                        }
-               }
 
-               $print = $this->writePrint();
-               $message = sprintf($this->__('Your browser is not up to date and is not able to run this publication. %sLearn more%s'), '<br /><a href="http://www.whatbrowser.org/intl/' . $this->config->defaultLang . '/" target="_blank">', '</a>');
+                       $print = $this->writePrint();
+                       $message = sprintf($this->__('Your browser is not up to date and is not able to run this publication. %sLearn more%s'), '<br /><a href="http://www.whatbrowser.org/intl/' . $this->config->defaultLang . '/" target="_blank">', '</a>');
 
-               $splash = '';
-               if ($this->theme->parametres->logoLoader && file_exists($this->themeRoot . $this->theme->parametres->logoLoader)) {
-                       $dim = CubeIT_Image::getimagesize($this->themeRoot . $this->theme->parametres->logoLoader);
-                       if ($dim !== false) {
-                               $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->logoLoader, 'data/images/' . $this->theme->parametres->logoLoader);
-                               $splash .= '<div class="logo"><img src="data/images/' . $this->theme->parametres->logoLoader . '" width="' . $dim[0] . '" height="' . $dim[1] . '" alt="" /></div>';
+                       $splash = '';
+                       if ($this->theme->parametres->logoLoader && file_exists($this->themeRoot . $this->theme->parametres->logoLoader)) {
+                               $dim = CubeIT_Image::getimagesize($this->themeRoot . $this->theme->parametres->logoLoader);
+                               if ($dim !== false) {
+                                       $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->logoLoader, 'data/images/' . $this->theme->parametres->logoLoader);
+                                       $splash .= '<div class="logo"><img src="data/images/' . $this->theme->parametres->logoLoader . '" width="' . $dim[0] . '" height="' . $dim[1] . '" alt="" /></div>';
+                               }
                        }
-               }
 
-               $svgfiles = array($this->assets . '/images/interface.svg', WS_ICONS . '/' . $this->theme->parametres->iconSet . '/interface.svg');
-               $svg = '';
-               foreach ($svgfiles as $svgfile) {
-                       if (file_exists($svgfile)) {
-                               $svg .= file_get_contents($svgfile);
-                       } else {
-                               die($svgfile . ' does not exist');
+                       $svgfiles = array($this->assets . '/images/interface.svg', WS_ICONS . '/' . $this->theme->parametres->iconSet . '/interface.svg');
+                       $svg = '';
+                       foreach ($svgfiles as $svgfile) {
+                               if (file_exists($svgfile)) {
+                                       $svg .= file_get_contents($svgfile);
+                               } else {
+                                       die($svgfile . ' does not exist');
+                               }
                        }
-               }
 
-               if ($this->phonegap) {
-                       $csp = "<meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'self' data: gap: 'unsafe-inline' *; style-src 'self' 'unsafe-inline'; font-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' " . implode(' ', array_unique($this->securityPolicyWhitelist)) . "; img-src * data:\">";
-               }
-               $vars = array('credits', 'style', 'script', 'pagesContents', 'print', 'hiddenContents', 'splash', 'cache', 'bgcolor', 'message', 'favicon', 'svg', 'beginbody', 'csp', 'opengraph', 'twittercard');
-               foreach ($vars as $v) {
-                       if (isset($$v)) {
-                               $html = str_replace('<!-- $' . $v . ' -->', $$v, $html);
-                       } else {
-                               $html = str_replace('<!-- $' . $v . ' -->', '', $html);
+                       if ($this->phonegap) {
+                               $csp = "<meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'self' data: gap: 'unsafe-inline' *; style-src 'self' 'unsafe-inline'; font-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' " . implode(' ', array_unique($this->securityPolicyWhitelist)) . "; img-src * data:\">";
                        }
-               }
 
-               $seo->writePage($html, $this->vdir);
-               if ($page == 1) {
-                       $seo->writePage($html, $this->vdir, 'index.html');
-               }
+                       $vars = array('credits', 'style', 'script', 'pagesContents', 'print', 'hiddenContents', 'splash', 'cache', 'bgcolor', 'message', 'favicon', 'svg', 'beginbody', 'csp', 'opengraph', 'twittercard');
+
+                       $res = [];
+                       foreach ($vars as $v) {
+                               if (isset($$v)) {
+                                       $res['<!-- $' . $v . ' -->'] = $$v;
+                               } else {
+                                       $res['<!-- $' . $v . ' -->'] = '';
+                               }
+                       }
+                       $this->_indexVars = $res;
                }
+               return $this->_indexVars;
+       }
 
        protected function writeIndex()
        {
-               foreach ($this->pages as $page => $infos) {
-                       $this->_writeIndex($page);
-               }
+               if ($this->book->parametres->seoVersion) {
+                       foreach ($this->pages as $page => $infos) {
+                               $this->_writeIndex($page);
+                       }
+               } else {
+                       $this->_writeIndex(1);
                }
+       }
 
        protected function writeWidget()
        {
@@ -1760,14 +1786,13 @@ class wsHTML5Compiler
 
                }
                $origDir = $this->wdir;
-
+               $types = $this->getVideosFormats();
                if ($video) {
                        wsTools::encodeWebVideos($origDir . $source, null, true);
                        $e = explode('.', $source);
                        array_pop($e);
                        $base = implode('.', $e);
                        $source = array();
-                       $types = $this->getVideosFormats();
                        foreach ($types as $type) {
                                $source[] = $base . '.' . $type;
                        }
index 853b1651fa9726afae3b38a794a5bc3970a6595b..da513a1c255ea4abefd3b57b5f279433976a0709 100644 (file)
@@ -162,6 +162,7 @@ class wsHTML5Compiler
        public $beginBody = array();
        public $seoArticles = [];
        public $securityPolicyWhitelist = ['*.google-analytics.com', '*.youtube.com', '*.ytimg.com'];
+       protected $_indexVars = null;
 
        public $_signature;
        /**
@@ -352,6 +353,10 @@ class wsHTML5Compiler
                        $this->vdir->copyDirectory($from, $directory);
                }
 
+               if ($this->book->parametres->scorm_enable) {
+                       $this->book->parametres->seoVersion = false;
+               }
+
                $this->log('Copied assets');
                $this->loadPlugins();
                $this->log('Plugins loaded');
@@ -479,161 +484,182 @@ class wsHTML5Compiler
 
        protected function _writeIndex($page)
        {
-               global $core;
 
                $seo = $this->seo->pages[$page];
                $html = $seo->getHTML();
 
-               $titre = $this->book->parametres->title;
+               $iv = $this->getIndexVars();
 
-
-               if (null === $this->_signature) {
-                       $daoSignature = new wsDAOSignature($core->con);
-                       $this->_signature = $daoSignature->selectById($this->book->parametres->signature);
+               foreach ($iv as $k => $v) {
+                       $html = str_replace($k, $v, $html);
                }
 
-               $credits = '';
-               if ($this->_signature->partner != '') {
-                       $credits = '<a href="' . $this->_signature->partnerLink . '" target="_blank">' . $this->_signature->partner . '</a> ';
+               if ($this->book->parametres->seoVersion) {
+                       $seo->writePage($html, $this->vdir);
+               }
+               if ($page == 1) {
+                       $seo->writePage($html, $this->vdir, 'index.html');
                }
-               $credits .= '<a href="' . $this->_signature->mainLink . '" target="_blank">' . $this->_signature->main . '</a>';
+       }
 
-               $hiddenContents = implode("\n", $this->hiddenContents);
+       public function getIndexVars()
+       {
+               if (null === $this->_indexVars) {
+                       global $core;
+                       $titre = $this->book->parametres->title;
 
-               $bgcolor = $this->theme->parametres->loadingBackColor;
 
-               // Feuilles de style
-               $sheets = array_merge($this->stylesheets, $this->specialCSS);
+                       if (null === $this->_signature) {
+                               $daoSignature = new wsDAOSignature($core->con);
+                               $this->_signature = $daoSignature->selectById($this->book->parametres->signature);
+                       }
 
-               $style = array();
-               foreach ($sheets as $sheet) {
-                       $style[] = '<link type="text/css" rel="stylesheet" media="screen" href="' . $sheet . '">';
-               }
-               $style = implode("\n\t\t", $style);
+                       $credits = '';
+                       if ($this->_signature->partner != '') {
+                               $credits = '<a href="' . $this->_signature->partnerLink . '" target="_blank">' . $this->_signature->partner . '</a> ';
+                       }
+                       $credits .= '<a href="' . $this->_signature->mainLink . '" target="_blank">' . $this->_signature->main . '</a>';
 
-               $pagesContents = '';
+                       $hiddenContents = implode("\n", $this->hiddenContents);
 
-               $cache = '';
+                       $bgcolor = $this->theme->parametres->loadingBackColor;
 
-               $beginbody = implode("\n", array_unique($this->beginBody));
+                       // Feuilles de style
+                       $sheets = array_merge($this->stylesheets, $this->specialCSS);
 
-               $iscript = '';
-               if (count($this->htmlmultimedia)) {
-                       $iscript .= '<script type="text/javascript">' . "\n";
-                       $iscript .= implode("\n", $this->htmlmultimedia);
-                       $iscript .= '</script>' . "\n";
-               }
+                       $style = array();
+                       foreach ($sheets as $sheet) {
+                               $style[] = '<link type="text/css" rel="stylesheet" media="screen" href="' . $sheet . '">';
+                       }
+                       $style = implode("\n\t\t", $style);
 
-               $script = '<script type="text/javascript">var FLUIDBOOK_START_PAGE="' . $page . '";</script>' . "\n";
-               $script .= '<script type="text/javascript" charset="utf-8" src="data/datas.js"></script>' . "\n";
-               $script .= '<script type="text/javascript" charset="utf-8" src="data/fluidbook.js"></script>' . "\n";
-               if ($this->book->parametres->scorm_enable) {
-                       $script .= '<script type="text/javascript" charset="utf-8" src="data/scorm.js"></script>' . "\n";
-               }
-               if (count($this->specialJsFiles)) {
-                       $script .= '<script type="text/javascript" charset="utf-8" src="data/special.js"></script>' . "\n";
-               }
-               foreach ($this->pluginJs as $p) {
-                       $script .= '<script type="text/javascript" charset="utf-8" src="' . $p . '"></script>' . "\n";
-               }
-               $script .= $iscript;
+                       $pagesContents = '';
+
+                       $cache = '';
+
+                       $beginbody = implode("\n", array_unique($this->beginBody));
+
+                       $iscript = '';
+                       if (count($this->htmlmultimedia)) {
+                               $iscript .= '<script type="text/javascript">' . "\n";
+                               $iscript .= implode("\n", $this->htmlmultimedia);
+                               $iscript .= '</script>' . "\n";
+                       }
+
+
+                       $script = '<script type="text/javascript" charset="utf-8" src="data/datas.js"></script>' . "\n";
+                       $script .= '<script type="text/javascript" charset="utf-8" src="data/fluidbook.js"></script>' . "\n";
+                       if ($this->book->parametres->scorm_enable) {
+                               $script .= '<script type="text/javascript" charset="utf-8" src="data/scorm.js"></script>' . "\n";
+                       }
+                       if (count($this->specialJsFiles)) {
+                               $script .= '<script type="text/javascript" charset="utf-8" src="data/special.js"></script>' . "\n";
+                       }
+                       foreach ($this->pluginJs as $p) {
+                               $script .= '<script type="text/javascript" charset="utf-8" src="' . $p . '"></script>' . "\n";
+                       }
+                       $script .= $iscript;
 
-               $socialTitle = $this->book->parametres->facebook_title ? $this->book->parametres->facebook_title : $titre;
-               $socialDescription = $this->book->parametres->seoDescription ? $this->book->parametres->seoDescription : $this->book->parametres->seoDescription;
-               $socialImage = 'https://workshop.fluidbook.com/services/facebook_thumbnail?id=' . $this->book_id . '&j=' . TIME;
-               $dim = CubeIT_Image::getimagesize($socialImage);
-               $socialImageWidth = $dim[0];
-               $socialImageHeight = $dim[1];
+                       $socialTitle = $this->book->parametres->facebook_title ? $this->book->parametres->facebook_title : $titre;
+                       $socialDescription = $this->book->parametres->seoDescription ? $this->book->parametres->seoDescription : $this->book->parametres->seoDescription;
+                       $socialImage = 'https://workshop.fluidbook.com/services/facebook_thumbnail?id=' . $this->book_id . '&j=' . TIME;
+                       $dim = CubeIT_Image::getimagesize($socialImage);
+                       $socialImageWidth = $dim[0];
+                       $socialImageHeight = $dim[1];
 
-               $twittercard = '<meta name="twitter:title" content="' . html::escapeHTML($socialTitle) . '">
+                       $twittercard = '<meta name="twitter:title" content="' . html::escapeHTML($socialTitle) . '">
        <meta name="twitter:description" content="' . html::escapeHTML($socialDescription) . '">
        <meta name="twitter:image" content="' . $socialImage . '">
        <meta name="twitter:site" content="@Fluidbook">
        <meta name="twitter:card" content="summary_large_image">';
-               $opengraph = '<meta property="og:title" content="' . html::escapeHTML($socialTitle) . '"/>
+                       $opengraph = '<meta property="og:title" content="' . html::escapeHTML($socialTitle) . '"/>
        <meta property="og:description" content="' . html::escapeHTML($socialDescription) . '"/>
        <meta property="og:image" content="' . $socialImage . '"/>
        <meta property="og:image:width" content="' . $socialImageWidth . '"/>
        <meta property="og:image:height" content="' . $socialImageHeight . '"/>';
 
-               $favicon = '';
-               $hasIos = false;
-               if ($this->theme->parametres->iosicon != '') {
-                       $hasIos = true;
-                       $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->iosicon, 'data/apple-touch-icon.png');
-                       $favicon .= '<link rel="apple-touch-icon" href="data/apple-touch-icon.png" />';
-               }
-               if ($this->theme->parametres->favicon != '') {
-
-                       $pngFile = $this->themeRoot . '/' . $this->theme->parametres->favicon;
-                       $icoFile = $this->themeRoot . '/favicon.ico';
-                       if (!file_exists($icoFile) || filemtime($icoFile) < filemtime($pngFile) || filemtime(__FILE__) > filemtime($icoFile)) {
-                               $tmp = CubeIT_Files::tempnam() . '.png';
-                               $convert = "convert $pngFile -resize 64x64^ -gravity center $tmp";
-                               `$convert`;
-
-                               $icotool = new cubeCommandLine('icotool');
-                               $icotool->setArg('c');
-                               $icotool->setArg('o', $icoFile);
-                               $icotool->setArg(null, $tmp);
-                               $icotool->execute();
-
-                               unlink($tmp);
+                       $favicon = '';
+                       $hasIos = false;
+                       if ($this->theme->parametres->iosicon != '') {
+                               $hasIos = true;
+                               $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->iosicon, 'data/apple-touch-icon.png');
+                               $favicon .= '<link rel="apple-touch-icon" href="data/apple-touch-icon.png" />';
                        }
-                       $this->vdir->copy($pngFile, 'data/favicon.png');
-                       $this->vdir->copy($icoFile, 'data/favicon.ico');
-                       $favicon .= '<link rel="shortcut icon" href="data/favicon.ico" />';
-                       $favicon .= '<link rel="icon" type="image/vnd.microsoft.icon" href="data/favicon.ico" />';
-                       $favicon .= '<link rel="icon" type="image/png" href="data/favicon.png" />';
-                       if (!$hasIos) {
-                               $favicon .= '<link rel="apple-touch-icon" href="data/favicon.png" />';
+                       if ($this->theme->parametres->favicon != '') {
+
+                               $pngFile = $this->themeRoot . '/' . $this->theme->parametres->favicon;
+                               $icoFile = $this->themeRoot . '/favicon.ico';
+                               if (!file_exists($icoFile) || filemtime($icoFile) < filemtime($pngFile) || filemtime(__FILE__) > filemtime($icoFile)) {
+                                       $tmp = CubeIT_Files::tempnam() . '.png';
+                                       $convert = "convert $pngFile -resize 64x64^ -gravity center $tmp";
+                                       `$convert`;
+
+                                       $icotool = new cubeCommandLine('icotool');
+                                       $icotool->setArg('c');
+                                       $icotool->setArg('o', $icoFile);
+                                       $icotool->setArg(null, $tmp);
+                                       $icotool->execute();
+
+                                       unlink($tmp);
+                               }
+                               $this->vdir->copy($pngFile, 'data/favicon.png');
+                               $this->vdir->copy($icoFile, 'data/favicon.ico');
+                               $favicon .= '<link rel="shortcut icon" href="data/favicon.ico" />';
+                               $favicon .= '<link rel="icon" type="image/vnd.microsoft.icon" href="data/favicon.ico" />';
+                               $favicon .= '<link rel="icon" type="image/png" href="data/favicon.png" />';
+                               if (!$hasIos) {
+                                       $favicon .= '<link rel="apple-touch-icon" href="data/favicon.png" />';
+                               }
                        }
-               }
 
-               $print = $this->writePrint();
-               $message = sprintf($this->__('Your browser is not up to date and is not able to run this publication. %sLearn more%s'), '<br /><a href="http://www.whatbrowser.org/intl/' . $this->config->defaultLang . '/" target="_blank">', '</a>');
+                       $print = $this->writePrint();
+                       $message = sprintf($this->__('Your browser is not up to date and is not able to run this publication. %sLearn more%s'), '<br /><a href="http://www.whatbrowser.org/intl/' . $this->config->defaultLang . '/" target="_blank">', '</a>');
 
-               $splash = '';
-               if ($this->theme->parametres->logoLoader && file_exists($this->themeRoot . $this->theme->parametres->logoLoader)) {
-                       $dim = CubeIT_Image::getimagesize($this->themeRoot . $this->theme->parametres->logoLoader);
-                       if ($dim !== false) {
-                               $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->logoLoader, 'data/images/' . $this->theme->parametres->logoLoader);
-                               $splash .= '<div class="logo"><img src="data/images/' . $this->theme->parametres->logoLoader . '" width="' . $dim[0] . '" height="' . $dim[1] . '" alt="" /></div>';
+                       $splash = '';
+                       if ($this->theme->parametres->logoLoader && file_exists($this->themeRoot . $this->theme->parametres->logoLoader)) {
+                               $dim = CubeIT_Image::getimagesize($this->themeRoot . $this->theme->parametres->logoLoader);
+                               if ($dim !== false) {
+                                       $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->logoLoader, 'data/images/' . $this->theme->parametres->logoLoader);
+                                       $splash .= '<div class="logo"><img src="data/images/' . $this->theme->parametres->logoLoader . '" width="' . $dim[0] . '" height="' . $dim[1] . '" alt="" /></div>';
+                               }
                        }
-               }
 
-               $svgfiles = array($this->assets . '/images/interface.svg', WS_ICONS . '/' . $this->theme->parametres->iconSet . '/interface.svg');
-               $svg = '';
-               foreach ($svgfiles as $svgfile) {
-                       if (file_exists($svgfile)) {
-                               $svg .= file_get_contents($svgfile);
-                       } else {
-                               die($svgfile . ' does not exist');
+                       $svgfiles = array($this->assets . '/images/interface.svg', WS_ICONS . '/' . $this->theme->parametres->iconSet . '/interface.svg');
+                       $svg = '';
+                       foreach ($svgfiles as $svgfile) {
+                               if (file_exists($svgfile)) {
+                                       $svg .= file_get_contents($svgfile);
+                               } else {
+                                       die($svgfile . ' does not exist');
+                               }
                        }
-               }
 
-               if ($this->phonegap) {
-                       $csp = "<meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'self' data: gap: 'unsafe-inline' *; style-src 'self' 'unsafe-inline'; font-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' " . implode(' ', array_unique($this->securityPolicyWhitelist)) . "; img-src * data:\">";
-               }
-               $vars = array('credits', 'style', 'script', 'pagesContents', 'print', 'hiddenContents', 'splash', 'cache', 'bgcolor', 'message', 'favicon', 'svg', 'beginbody', 'csp', 'opengraph', 'twittercard');
-               foreach ($vars as $v) {
-                       if (isset($$v)) {
-                               $html = str_replace('<!-- $' . $v . ' -->', $$v, $html);
-                       } else {
-                               $html = str_replace('<!-- $' . $v . ' -->', '', $html);
+                       if ($this->phonegap) {
+                               $csp = "<meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'self' data: gap: 'unsafe-inline' *; style-src 'self' 'unsafe-inline'; font-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' " . implode(' ', array_unique($this->securityPolicyWhitelist)) . "; img-src * data:\">";
                        }
-               }
+                       $vars = array('credits', 'style', 'script', 'pagesContents', 'print', 'hiddenContents', 'splash', 'cache', 'bgcolor', 'message', 'favicon', 'svg', 'beginbody', 'csp', 'opengraph', 'twittercard');
 
-               $seo->writePage($html, $this->vdir);
-               if ($page == 1) {
-                       $seo->writePage($html, $this->vdir, 'index.html');
+                       $res = [];
+                       foreach ($vars as $v) {
+                               if (isset($$v)) {
+                                       $res['<!-- $' . $v . ' -->'] = $$v;
+                               } else {
+                                       $res['<!-- $' . $v . ' -->'] = '';
+                               }
+                       }
+                       $this->_indexVars = $res;
                }
+               return $this->_indexVars;
        }
 
        protected function writeIndex()
        {
-               foreach ($this->pages as $page => $infos) {
-                       $this->_writeIndex($page);
+               if ($this->book->parametres->seoVersion) {
+                       foreach ($this->pages as $page => $infos) {
+                               $this->_writeIndex($page);
+                       }
+               } else {
+                       $this->_writeIndex(1);
                }
        }
 
@@ -648,7 +674,11 @@ class wsHTML5Compiler
                        $style = '<link type="text/css" rel="stylesheet" href="style/widget.css">';
                        $vars = array('titre', 'style', 'script');
                        foreach ($vars as $v) {
-                               $whtml = str_replace('<!-- $' . $v . ' -->', $$v, $whtml);
+                               if (isset($$v)) {
+                                       $whtml = str_replace('<!-- $' . $v . ' -->', $$v, $whtml);
+                               } else {
+                                       $whtml = str_replace('<!-- $' . $v . ' -->', '', $whtml);
+                               }
                        }
                        $this->vdir->file_put_contents('widget.html', $whtml);
                }
index ce364a27c0b133f3bf0c7ead3f45077d47293c74..58eee0cd952884ca970610472b1f62676424e2ea 100644 (file)
@@ -25,6 +25,7 @@ class wsHTML5Link
        public $in_popup = false;
        public $display_area;
        public $read_mode;
+       public $group;
        public $infobulle;
        public $extra;
        public $id;
index 4f7c724242ef1e2d8e181a40972e1761cfdbbfab..d9cb36c68ef9d8a5a602bdbcf6d814de9d0df2f0 100644 (file)
@@ -158,7 +158,8 @@ class wsHTML5SeoPage
                        'robots' => $this->robots ? '<meta name="robots" content="' . $this->robots . '">' : '',\r
                        'statsfooter' => $this->footer,\r
                        'ga' => $this->ua,\r
-                       'seoContent' => $this->getSEOContent()];\r
+                       'seoContent' => $this->getSEOContent(),\r
+                       'startpage' => '<script type="text/javascript">var FLUIDBOOK_START_PAGE="' . $this->page . '";</script>' . "\n"];\r
 \r
                foreach ($vars as $k => $var) {\r
                        $html = str_replace('<!-- $' . $k . ' -->', $var, $html);\r