]> _ Git - cubeextranet.git/commitdiff
wip #3751 @1
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 1 Jul 2020 12:53:09 +0000 (12:53 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 1 Jul 2020 12:53:09 +0000 (12:53 +0000)
fluidbook/compile/hybrid/index.html
inc/ws/DAO/class.ws.dao.book.php
inc/ws/Util/html5/master/class.ws.html5.compiler.php
inc/ws/Util/html5/master/class.ws.html5.seo.php
inc/ws/Util/packager/class.ws.packager.html.php

index a5e457fade69803e7782001211a4d92e04ab6310..5b705d066d7cb6dadac6c21a133455e8c89c5523 100644 (file)
@@ -1,7 +1,26 @@
 <!doctype html>\r
 <html>\r
 <head>\r
+    <title>$titre</title>\r
+    <meta charset="utf-8">\r
     <meta name="viewport" content="width=device-width">\r
+    $description\r
+    $opengraph\r
+    $twittercard\r
+    <style type="text/css">\r
+        * {\r
+            padding: 0;\r
+            margin: 0;\r
+        }\r
+        body, html {\r
+            background-color: #$bgcolor;\r
+            width: 100%;\r
+            height: 100%;\r
+        }\r
+        footer {\r
+            visibility: hidden;\r
+        }\r
+    </style>\r
     <script>\r
         var redirect;\r
         var locationWithoutHash = window.location.href.split('#')[0];\r
@@ -14,6 +33,7 @@
         window.location = './' + redirect + '/index.html?hybrid=1&from=' + encodeURIComponent(locationWithoutHash) + hash;\r
     </script>\r
 </head>\r
-<body style="background-color: #$bgcolor;">\r
+<body>\r
+    <footer id="credits">$credits</footer>\r
 </body>\r
 </html>
\ No newline at end of file
index 426baa2138fadc525ed6ad78dc8b1aea41798788..fe298914413b6be5288984964e78ae623ebefd22 100644 (file)
@@ -5,6 +5,9 @@ class wsDAOBook extends commonDAO
 
     public static $pagesOfBookCache = array();
 
+    /** @var wsHTML5Compiler */
+    public static $lastHTML5Compiler = null;
+
     /**
      * wsDAOBook::singleton()
      *
@@ -880,7 +883,7 @@ class wsDAOBook extends commonDAO
         $numerotation = array();
         $nb_pages = 0;
         foreach ($pages as $p) {
-            if($setNumerotation) {
+            if ($setNumerotation) {
                 $numerotation[] = $p->virtual;
             }
             $nb_pages++;
@@ -892,7 +895,7 @@ class wsDAOBook extends commonDAO
 
         $c = $this->con->openCursor('books');
         $c->parametres = serialize($parametres);
-        if($setNumerotation) {
+        if ($setNumerotation) {
             $c->numerotation = implode(',', $numerotation);
         }
         $c->changedate = TIME;
@@ -1789,6 +1792,9 @@ class wsDAOBook extends commonDAO
 
         $htmlCompiler = wsHTML5::compilerFactory($book_id, $version, false, 'latest', null, false, false, false, $book);
         $htmlCompiler->compile($delete);
+
+        self::$lastHTML5Compiler = $htmlCompiler;
+
     }
 
     /* public function indexPDF($book, $pages) {
index b67d731961af7d24a3ef0f9691462d0740294f4d..eee4f8efc10e632f0323b89eb0fb0a028f4a4edb 100644 (file)
@@ -731,7 +731,7 @@ class wsHTML5Compiler
 
             $text = str_replace(array_keys($replace), array_values($replace), $text);
 
-            if$this->book->parametres->audiodescriptionVoice) {
+            if ($this->book->parametres->audiodescriptionVoice) {
                 $hash = hash('sha256', $this->book->parametres->audiodescriptionVoice . '_^_' . $text);
                 $fname = $hash . '.mp3';
                 $dir = WS_BOOKS . '/audiodescription/';
@@ -892,6 +892,10 @@ class wsHTML5Compiler
             $socialImageWidth = $dim[0];
             $socialImageHeight = $dim[1];
 
+            $titre = $this->book->parametres->title;
+
+            $description = '<meta name="description" content="' . $this->seo->pages[1]->description . '">';
+
             $twittercard = '<meta name="twitter:title" content="' . $socialTitle . '">
        <meta name="twitter:description" content="' . $socialDescription . '">
        <meta name="twitter:image" content="' . $socialImage . '">
@@ -973,7 +977,7 @@ class wsHTML5Compiler
             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', 'splashstyles', 'cache', 'bgcolor', 'message', 'favicon', 'svg', 'beginbody', 'csp', 'opengraph', 'twittercard');
+            $vars = array('titre', 'credits', 'style', 'script', 'pagesContents', 'print', 'hiddenContents', 'splash', 'splashstyles', 'cache', 'bgcolor', 'message', 'favicon', 'svg', 'beginbody', 'csp', 'opengraph', 'twittercard', 'description');
 
             $res = [];
             foreach ($vars as $v) {
index de9a7caab2c774c5eee81e71db183118df674991..a682ec7ffcd845092a1b3c5233d1bbd62ae3dad7 100644 (file)
@@ -6,6 +6,9 @@ class wsHTML5Seo
      * @var wsHTML5Compiler\r
      */\r
     public $compiler;\r
+    /**\r
+     * @var wsHTML5SeoPage[]\r
+     */\r
     public $pages;\r
     public $html;\r
     protected $_nav = null;\r
index c19c81eee8ff58baa052f99a20542f8c846d4ebf..dd6fbb5d1f0be4601f55749ebf1c28f028637946 100644 (file)
@@ -252,12 +252,18 @@ class wsPackagerHTML extends wsPackager
         if ($mfid != '' && (int)$mfid > 0) {
             $mfbook = $this->daoBook->selectById($mfid);
             $this->_compileHTML5($this->book_id, $this->book, $dest . '/d');
+            $vars = wsDAOBook::$lastHTML5Compiler->getIndexVars();
             $this->_compileHTML5($mfid, $mfbook, $dest . '/mf');
 
             $hybrid = file_get_contents(WS_COMPILE_ASSETS . '/hybrid/index.html');
             $replace = [
+                'titre' => $vars['<!-- $titre -->'],
                 'breakpoint' => $this->book->parametres->mobilefirstBreakpoint . 'px',
-                'bgcolor' => $this->theme->parametres->loadingBackColor
+                'bgcolor' => $this->theme->parametres->loadingBackColor,
+                'description' => $vars['<!-- $description -->'],
+                'twittercard' => $vars['<!-- $twittercard -->'],
+                'opengraph' => $vars['<!-- $opengraph -->'],
+                'credits' => $vars['<!-- $credits -->'],
             ];
             foreach ($replace as $var => $value) {
                 $hybrid = str_replace('$' . $var, $value, $hybrid);