]> _ Git - fluidbook-toolbox.git/commitdiff
wip #5408 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 22 Aug 2022 16:13:51 +0000 (18:13 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 22 Aug 2022 16:13:51 +0000 (18:13 +0200)
18 files changed:
app/Fluidbook/Link/Cart/BastideCartLink.php [new file with mode: 0644]
app/Fluidbook/Link/Cart/CFOCCartLink.php [new file with mode: 0644]
app/Fluidbook/Link/Cart/GrandPavoisCartLink.php [new file with mode: 0644]
app/Fluidbook/Link/Cart/GrandVisionCartLink.php [new file with mode: 0644]
app/Fluidbook/Link/Cart/Joueclub2021CartLink.php [new file with mode: 0644]
app/Fluidbook/Link/Cart/JoueclubWishlistLink.php [new file with mode: 0644]
app/Fluidbook/Link/Custom/AtlanticDownloadLink.php [new file with mode: 0644]
app/Fluidbook/Link/Custom/FLFLink.php [new file with mode: 0644]
app/Fluidbook/Link/Custom/HaguenauManifLink.php [new file with mode: 0644]
app/Fluidbook/Link/Custom/InpesPopinLink.php [new file with mode: 0644]
app/Fluidbook/Link/Custom/IntexLink.php
app/Fluidbook/Link/Custom/MiraklEaster2021Link.php [new file with mode: 0644]
app/Fluidbook/Link/Custom/PierronLink.php [new file with mode: 0644]
app/Fluidbook/Link/Custom/WescoLink.php [new file with mode: 0644]
app/Fluidbook/Link/Custom/WescoSalesLink.php [new file with mode: 0644]
app/Fluidbook/Link/Link.php
app/Jobs/FluidbookCompiler.php
composer.lock

diff --git a/app/Fluidbook/Link/Cart/BastideCartLink.php b/app/Fluidbook/Link/Cart/BastideCartLink.php
new file mode 100644 (file)
index 0000000..411a638
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+
+namespace App\Fluidbook\Link\Cart;
+
+use Fluidbook\Tools\Links\NormalLink;
+
+class BastideCartLink extends NormalLink
+{
+    public function getUrl()
+    {
+        return '#/cart/add/' . $this->to;
+    }
+
+    public function getTooltip()
+    {
+        return 'Ajouter à ma sélection';
+    }
+}
diff --git a/app/Fluidbook/Link/Cart/CFOCCartLink.php b/app/Fluidbook/Link/Cart/CFOCCartLink.php
new file mode 100644 (file)
index 0000000..ff08ce2
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+
+namespace App\Fluidbook\Link\Cart;
+
+use Fluidbook\Tools\Links\NormalLink;
+
+class CFOCCartLink extends NormalLink
+{
+    public function getUrl()
+    {
+        return '#/cart/add/' . $this->to;
+    }
+
+    // public function getAdditionnalContent()
+    // {
+    //     return parent::getAdditionnalContent() . ' data-cfoc-ref="' . $this->to . '" ';
+    // }
+
+    public function getTooltip()
+    {
+        return 'Ajouter à ma sélection';
+    }
+}
diff --git a/app/Fluidbook/Link/Cart/GrandPavoisCartLink.php b/app/Fluidbook/Link/Cart/GrandPavoisCartLink.php
new file mode 100644 (file)
index 0000000..ab98d59
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+
+namespace App\Fluidbook\Link\Cart;
+
+use Fluidbook\Tools\Links\CartLink;
+
+class GrandPavoisCartLink extends CartLink
+{
+    public function getDefaultTooltip()
+    {
+        return 'Ajouter à ma visite';
+    }
+}
diff --git a/app/Fluidbook/Link/Cart/GrandVisionCartLink.php b/app/Fluidbook/Link/Cart/GrandVisionCartLink.php
new file mode 100644 (file)
index 0000000..1cef231
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+
+namespace App\Fluidbook\Link\Cart;
+
+use Fluidbook\Tools\Links\NormalLink;
+
+class GrandVisionCartLink extends NormalLink
+{
+    public function getDefaultTooltip()
+    {
+        return 'More details';
+    }
+
+    public function getURL()
+    {
+        return '#/cart/details/' . $this->to;
+    }
+}
diff --git a/app/Fluidbook/Link/Cart/Joueclub2021CartLink.php b/app/Fluidbook/Link/Cart/Joueclub2021CartLink.php
new file mode 100644 (file)
index 0000000..d5e83bd
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+
+namespace App\Fluidbook\Link\Cart;
+
+use Fluidbook\Tools\Links\CartLink;
+
+class Joueclub2021CartLink extends CartLink
+{
+    public function getDefaultTooltip()
+    {
+        return 'Ajouter à ma liste de cadeaux';
+    }
+
+    public function getInnerContent()
+    {
+        return '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+        viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
+<style type="text/css">
+       .st0{fill:url(#SVGID_1_);stroke:#F0EEEA;stroke-width:3.3;stroke-miterlimit:10;}
+       .st1{fill:#FFFFFF;}
+       .st2{opacity:0.4;enable-background:new    ;}
+
+               .st3{fill:url(#SVGID_00000091725099145697549030000002656161899138345614_);stroke:#F0EEEA;stroke-width:3.3;stroke-miterlimit:10;}
+</style>
+<g class="on">
+       <g id="on_00000067198718027100822470000000858312170120319118_">
+
+                       <radialGradient id="SVGID_1_" cx="12.5" cy="43" r="21.783" gradientTransform="matrix(1 0 0 -1 0 52)" gradientUnits="userSpaceOnUse">
+                       <stop  offset="0" style="stop-color:#F9152B"/>
+                       <stop  offset="1" style="stop-color:#CC0014"/>
+               </radialGradient>
+               <circle class="st0" cx="24.8" cy="24.8" r="22"/>
+               <path id="_x3C_Tracé_x3E_" class="st1" d="M33.2,24.5c-4,0-7.2,3.2-7.2,7.2s3.2,7.2,7.2,7.2s7.2-3.2,7.2-7.2
+                       C40.3,27.7,37.1,24.5,33.2,24.5z M37.8,30.2l-4.4,4.6c-0.2,0.2-0.5,0.3-0.8,0.3l0,0c-0.3,0-0.6-0.1-0.8-0.3L29,31.9
+                       c-0.4-0.4-0.4-1.2,0-1.6s1.2-0.4,1.6,0l2,2.1l3.6-3.8c0.4-0.4,1.1-0.5,1.6,0C38.2,29,38.2,29.7,37.8,30.2z"/>
+               <path class="st1" d="M23.7,31.8c0-5.3,4.3-9.5,9.5-9.5c0.8,0,1.6,0.1,2.4,0.3c0.1-1-0.1-2-0.6-2.9c-1.4-3-5-4-8-2.6
+                       c-0.4,0.2-1,0.6-1.4,1l-0.8,0.8L24,18.1c-1.4-1.4-3.2-2-5.2-1.6c-1.8,0.4-3.4,1.6-4.2,3.2c-1.2,2.2-0.8,5,1,6.8l8.4,8.6
+                       c0.1,0.1,0.2,0.2,0.4,0.2C23.9,34.2,23.7,33,23.7,31.8z"/>
+       </g>
+</g>
+<g class="off">
+       <g id="off_00000158745150850562103200000013702113717099787924_">
+               <circle class="st2" cx="26.5" cy="26.5" r="23.3"/>
+
+                       <radialGradient id="SVGID_00000173873247631391758930000004458483244722507439_" cx="12.5" cy="43" r="21.783" gradientTransform="matrix(1 0 0 -1 0 52)" gradientUnits="userSpaceOnUse">
+                       <stop  offset="0" style="stop-color:#F9152B"/>
+                       <stop  offset="1" style="stop-color:#CC0014"/>
+               </radialGradient>
+
+                       <circle style="fill:url(#SVGID_00000173873247631391758930000004458483244722507439_);stroke:#F0EEEA;stroke-width:3.3;stroke-miterlimit:10;" cx="24.8" cy="24.8" r="22"/>
+               <path class="st1" d="M35,19.6c-1.4-3-5-4-8-2.6c-0.4,0.2-1,0.6-1.4,1l-0.8,0.8L24,18c-1.4-1.4-3.2-2-5.2-1.6
+                       c-1.8,0.4-3.4,1.6-4.2,3.2c-1.2,2.2-0.8,5,1,6.8L24,35c0.4,0.4,1,0.4,1.2,0l0,0l8.4-8.6C35.6,24.6,36.2,21.8,35,19.6z"/>
+       </g>
+</g>
+</svg>';
+    }
+
+    public function getAdditionnalContent()
+    {
+        $res = parent::getAdditionnalContent();
+        $res .= ' data-tooltip-conditional="' . htmlspecialchars(json_encode(['.active' => 'Retirer de ma liste de cadeaux'])) . '" ';
+        return $res;
+    }
+}
diff --git a/app/Fluidbook/Link/Cart/JoueclubWishlistLink.php b/app/Fluidbook/Link/Cart/JoueclubWishlistLink.php
new file mode 100644 (file)
index 0000000..9b0951c
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+
+namespace App\Fluidbook\Link\Cart;
+
+use Fluidbook\Tools\Links\NormalLink;
+
+class JoueclubWishlistLink extends NormalLink
+{
+    protected $role = 'link';
+
+    public function getURL()
+    {
+        return 'https://listedecadeau.joueclub.fr/scan?device_id=$uuid&id_from_asset_name=' . $this->to;
+    }
+
+    public function getTarget()
+    {
+        return '_popupiframe';
+    }
+
+    public function getDefaultTooltip()
+    {
+        return 'Ajouter à la wishlist';
+    }
+}
diff --git a/app/Fluidbook/Link/Custom/AtlanticDownloadLink.php b/app/Fluidbook/Link/Custom/AtlanticDownloadLink.php
new file mode 100644 (file)
index 0000000..cdfa27c
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+
+namespace App\Fluidbook\Link\Custom;
+
+use Fluidbook\Tools\Links\NormalLink;
+
+class AtlanticDownloadLink extends NormalLink
+{
+    public function getUrl()
+    {
+        return '#';
+    }
+
+    public function getAdditionnalContent()
+    {
+        return parent::getAdditionnalContent() . ' data-atlanticdownload-ref="' . $this->to . '" ';
+    }
+
+    public function getTooltip()
+    {
+        return 'Télécharger les documents';
+    }
+}
diff --git a/app/Fluidbook/Link/Custom/FLFLink.php b/app/Fluidbook/Link/Custom/FLFLink.php
new file mode 100644 (file)
index 0000000..f3f4869
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+
+namespace App\Fluidbook\Link\Custom;
+
+use Fluidbook\Tools\Links\CustomLink;
+
+class FLFLink extends CustomLink
+{
+    protected $role = 'link';
+
+    public function getURL()
+    {
+        return 'https://workshop.fluidbook.com/services/flfRef?ref=' . $this->to;
+    }
+
+    public function getTarget()
+    {
+        return '_blank';
+    }
+
+    public function getTooltip()
+    {
+        return 'Accéder à la fiche du stage sur notre site flf.fr';
+    }
+}
diff --git a/app/Fluidbook/Link/Custom/HaguenauManifLink.php b/app/Fluidbook/Link/Custom/HaguenauManifLink.php
new file mode 100644 (file)
index 0000000..6b300be
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+
+namespace App\Fluidbook\Link\Custom;
+
+use Fluidbook\Tools\Links\InternalLink;
+
+class HaguenauManifLink extends InternalLink
+{
+    public function getPage()
+    {
+        $fiches = array(
+            "1" => 7, "2" => 8, "3" => 14, "4" => 16, "5" => 17, "6" => 18, "7" => 19, "8" => 20, "9" => 22, "10" => 23, "11" => 24, "12" => 27
+        , "13" => 29, "14" => 32, "15" => 34, "16" => 37, "17" => 38, "18" => 41, "19" => 43,
+            "20" => 45, "21" => 46, "22" => 52, "23" => 53, "24" => 54, "25" => 56, "26" => 59, "27" => 60
+        );
+        return $fiches[$this->to];
+    }
+}
diff --git a/app/Fluidbook/Link/Custom/InpesPopinLink.php b/app/Fluidbook/Link/Custom/InpesPopinLink.php
new file mode 100644 (file)
index 0000000..9027091
--- /dev/null
@@ -0,0 +1,65 @@
+<?php
+
+namespace App\Fluidbook\Link\Custom;
+
+use Fluidbook\Tools\Links\HTMLMultimediaLink;
+
+class InpesPopinLink extends HTMLMultimediaLink
+{
+    public function getHTMLContent()
+    {
+        $this->alternative = $this->to;
+        $c = parent::getHTMLContent();
+
+        $class = $this->getClasses();
+        if ($this->display_area) {
+            $class[] = 'displayArea';
+        }
+        $c = '';
+        if (count($class)) {
+            $c = ' class="' . implode(' ', $class) . '"';
+        }
+        $tooltip = $this->getTooltipAttribute();
+
+        return '<a href="#" ' . $tooltip . $c . $this->getAdditionnalContent() . '></a>';
+    }
+
+    public function getCSSContainer()
+    {
+        if ($this->moveOnEvenPage()) {
+            $this->page--;
+            $this->left += $this->compiler->width;
+        }
+
+        $css = '#l_' . $this->id . '{';
+        $css .= 'left:' . $this->left * $this->getCssScale() . 'px;top:' . $this->top * $this->getCssScale() . 'px;';
+        $css .= 'width:' . $this->width * $this->getCssScale() . 'px;height:' . $this->height * $this->getCssScale() . 'px;';
+        $css .= $this->getCSSZIndex();
+        if ($this->rot) {
+            $css .= wsHTML5::writeCSSUA('transform', 'rotate(' . $this->rot . 'deg)');
+            $css .= wsHTML5::writeCSSUA('transform-origin', '0% 0%');
+        }
+        $css .= $this->getCSS();
+        $css .= '}';
+        return $css;
+    }
+
+    public function getCSS()
+    {
+        return "";
+    }
+
+    public function getClasses()
+    {
+        $res = parent::getClasses();
+        $res[] = 'popin';
+        return $res;
+    }
+
+    public function getAdditionnalContent()
+    {
+        $res = parent::getAdditionnalContent();
+        $res .= ' data-src="' . $this->_url . '" data-width="900" data-height="650"';
+        return $res;
+    }
+}
index eec4a6adba4f6d18e9b4425d2e42793102a0cfb6..eb0c6ff748718d143806bfdda95efdd46ac2b9fe 100644 (file)
@@ -2,6 +2,8 @@
 
 namespace App\Fluidbook\Link\Custom;
 
+use Fluidbook\Tools\Links\CustomLink;
+
 class IntexLink extends CustomLink
 {
     public static function _getURL($to)
diff --git a/app/Fluidbook/Link/Custom/MiraklEaster2021Link.php b/app/Fluidbook/Link/Custom/MiraklEaster2021Link.php
new file mode 100644 (file)
index 0000000..be4c270
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+
+namespace App\Fluidbook\Link\Custom;
+
+use Fluidbook\Tools\Links\NormalLink;
+
+class MiraklEaster2021Link extends NormalLink
+{
+    public function getURL()
+    {
+        return '#';
+    }
+
+    public function getAdditionnalContent()
+    {
+        return parent::getAdditionnalContent() . ' data-answers="' . $this->to . '" ';
+    }
+}
diff --git a/app/Fluidbook/Link/Custom/PierronLink.php b/app/Fluidbook/Link/Custom/PierronLink.php
new file mode 100644 (file)
index 0000000..70f18ae
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+
+namespace App\Fluidbook\Link\Custom;
+
+use Fluidbook\Tools\Links\CustomLink;
+
+class PierronLink extends CustomLink
+{
+    public static function _getURL($to)
+    {
+        return 'https://workshop.fluidbook.com/services/pierronRef?ref=' . $to;
+    }
+}
diff --git a/app/Fluidbook/Link/Custom/WescoLink.php b/app/Fluidbook/Link/Custom/WescoLink.php
new file mode 100644 (file)
index 0000000..3d1d1d0
--- /dev/null
@@ -0,0 +1,14 @@
+<?php
+
+namespace App\Fluidbook\Link\Custom;
+
+use Fluidbook\Tools\Links\CustomLink;
+
+class WescoLink extends CustomLink
+{
+    public static function _getURL($to)
+    {
+        return self::_getURLOfType('wesco', $to);
+    }
+
+}
diff --git a/app/Fluidbook/Link/Custom/WescoSalesLink.php b/app/Fluidbook/Link/Custom/WescoSalesLink.php
new file mode 100644 (file)
index 0000000..676eedb
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+
+namespace App\Fluidbook\Link\Custom;
+
+use Fluidbook\Tools\Links\NormalLink;
+
+class WescoSalesLink extends NormalLink
+{
+    public function __construct($id, $init, $compiler)
+    {
+        $e = explode(':', $init['to']);
+        if (count($e) > 1) {
+            $init['to'] = $e[1];
+        }
+        parent::__construct($id, $init, $compiler);
+    }
+
+    public function getUrl()
+    {
+        return '#';
+    }
+
+    public function getAdditionnalContent()
+    {
+        $e = explode(':', $this->to);
+        if (count($e) > 1) {
+            $this->to = $e[1];
+        }
+        return parent::getAdditionnalContent() . ' data-wescosales-ref="' . $this->to . '" ';
+    }
+
+    public function getTooltip()
+    {
+        return 'Consulter les ventes de ce produit';
+    }
+}
index abb057ec1e110b8b4d69273f20b57fd3b1748ba0..71bfa13f3d369d2a28dc33f80dd4cda14d89a275 100644 (file)
@@ -2,10 +2,24 @@
 
 namespace App\Fluidbook\Link;
 
+use App\Fluidbook\Link\Cart\BastideCartLink;
+use App\Fluidbook\Link\Cart\CFOCCartLink;
+use App\Fluidbook\Link\Cart\GrandPavoisCartLink;
+use App\Fluidbook\Link\Cart\GrandVisionCartLink;
+use App\Fluidbook\Link\Cart\Joueclub2021CartLink;
+use App\Fluidbook\Link\Cart\JoueclubWishlistLink;
 use App\Fluidbook\Link\Cart\PumaCartLink;
+use App\Fluidbook\Link\Custom\AtlanticDownloadLink;
+use App\Fluidbook\Link\Custom\FLFLink;
+use App\Fluidbook\Link\Custom\HaguenauManifLink;
+use App\Fluidbook\Link\Custom\InpesPopinLink;
+use App\Fluidbook\Link\Custom\IntexLink;
+use App\Fluidbook\Link\Custom\MiraklEaster2021Link;
+use App\Fluidbook\Link\Custom\PierronLink;
+use App\Fluidbook\Link\Custom\WescoLink;
+use App\Fluidbook\Link\Custom\WescoSalesLink;
 use Cubist\Util\ArrayUtil;
 use Fluidbook\Tools\Links\CartLink;
-use Fluidbook\Tools\Links\CustomLink;
 use Fluidbook\Tools\Links\ZoomProductLink;
 
 class Link extends \Fluidbook\Tools\Links\Link
@@ -19,53 +33,51 @@ class Link extends \Fluidbook\Tools\Links\Link
 
         switch ($init['type']) {
             case 7:
-                if ($compiler->book->parametres->basketManager === 'Puma') {
-                    return new PumaCartLink($id, $init, $compiler);
-                }
-                if ($compiler->book->parametres->basketManager === 'MIF') {
-                    return new CartLink($id, $init, $compiler);
+                switch ($compiler->getSetting('basketManager')) {
+                    case 'Puma':
+                        return new PumaCartLink($id, $init, $compiler);
+                    case 'MIF':
+                        return new CartLink($id, $init, $compiler);
                 }
-                switch ($compiler->book->parametres->customLinkClass) {
+                switch ($compiler->getSetting('customLinkClass')) {
                     case 'IntexLink':
-                        return new intexLink($id, $init, $compiler);
+                        return new IntexLink($id, $init, $compiler);
                     case 'WescoLink':
-                        return new wescoLink($id, $init, $compiler);
+                        return new WescoLink($id, $init, $compiler);
                     case 'HaguenauManifLink':
-                        return new haguenauManifLink($id, $init, $compiler);
+                        return new HaguenauManifLink($id, $init, $compiler);
                     case 'FLFLink':
-                        return new flfLink($id, $init, $compiler);
+                        return new FLFLink($id, $init, $compiler);
                     case 'InpesPopinLink':
-                        return new inpesPopinLink($id, $init, $compiler);
+                        return new InpesPopinLink($id, $init, $compiler);
                     case 'PierronLink':
-                        return new pierronLink($id, $init, $compiler);
+                        return new PierronLink($id, $init, $compiler);
                     case 'WescoSalesLink':
-                        return new wescoSalesLink($id, $init, $compiler);
+                        return new WescoSalesLink($id, $init, $compiler);
                     case 'AtlanticDownloadLink':
-                        return new atlanticDownloadLink($id, $init, $compiler);
+                        return new AtlanticDownloadLink($id, $init, $compiler);
                     case 'MiraklEaster2021':
-                        return new miraklEaster2021Link($id, $init, $compiler);
+                        return new MiraklEaster2021Link($id, $init, $compiler);
                     default :
                         break;
                 }
             case 12: // Basket / Cart links
-                if ($compiler->book->parametres->product_zoom_references !== '') {
+                if ($compiler->getSetting('product_zoom_references', '') !== '') {
                     return new zoomProductLink($id, $init, $compiler);
                 }
-                switch ($compiler->book->parametres->basketManager) {
+                switch ($compiler->getSetting('basketManager')) {
                     case 'Bastide':
                         return new BastideCartLink($id, $init, $compiler);
                     case 'CFOC':
                         return new CFOCCartLink($id, $init, $compiler);
                     case 'GrandVision':
-                        return new grandVisionCartLink($id, $init, $compiler);
+                        return new GrandVisionCartLink($id, $init, $compiler);
                     case 'GrandPavois':
-                        return new grandPavoisCartLink($id, $init, $compiler);
+                        return new GrandPavoisCartLink($id, $init, $compiler);
                     case 'JoueclubWishlist2021':
-                        return new joueclub2021CartLink($id, $init, $compiler);
+                        return new Joueclub2021CartLink($id, $init, $compiler);
                     case 'JoueclubWishlist':
                         return new JoueclubWishlistLink($id, $init, $compiler);
-                    case 'Remarkable':
-                        return new remarkableCartLink($id, $init, $compiler);
                     case 'ZoomProductLink':
                     case 'Flexipan':
                     case 'Puma':
index 574ad2209a22ae2505b942dcd10701254e8a9ecf..8936fe0ee785a100b41f4ff088e6de2205b83a6c 100644 (file)
@@ -8,10 +8,12 @@ use App\Models\Traits\FluidbookPlayerBranches;
 use App\Util\FluidbookLinks;
 use Cubist\Util\ArrayUtil;
 use Cubist\Util\CommandLine;
+use Cubist\Util\Data;
 use Cubist\Util\Files\Files;
 use Cubist\Util\Files\VirtualDirectory;
 use Cubist\Util\Graphics\Color;
 use Cubist\Util\Graphics\Image;
+use Cubist\Util\Graphics\Resizer;
 use Cubist\Util\ObjectUtil;
 use Cubist\Util\PHP;
 use Cubist\Util\Text;
@@ -19,15 +21,18 @@ use Cubist\Util\Url;
 use DOMDocument;
 use DOMElement;
 use DOMXPath;
+use Fluidbook\Tools\Compiler\CompilerInterface;
 use Fluidbook\Tools\Links\AnchorLink;
 use Fluidbook\Tools\Links\ContentLink;
 use App\Fluidbook\Link\Link;
 use Illuminate\Console\Command;
 use SimpleXMLElement;
+use SplFileInfo;
 
-class FluidbookCompiler extends Base
+class FluidbookCompiler extends Base implements CompilerInterface
 {
     use FluidbookPlayerBranches;
+    use \Fluidbook\Tools\Compiler\FluidbookCompiler;
 
     protected static $uaPrefixes = array('-moz-', '-webkit-', '-o-', '-ms-', '');
 
@@ -176,8 +181,6 @@ class FluidbookCompiler extends Base
     public $fontDocs = array();
     public $dir;
     public $z = 3;
-    public $vdir;
-    public $wdir;
     protected $_lottieIDByHash = [];
     public $book;
     public $pages;
@@ -202,7 +205,6 @@ class FluidbookCompiler extends Base
     public $cache = array();
     public $backgroundsPrefix = array();
     public $svg = true;
-    public $config = array();
     public $assets = '';
     public $phonegap = false;
     public $phonegapVersion;
@@ -363,6 +365,27 @@ class FluidbookCompiler extends Base
         $this->log('Defined dimensions');
     }
 
+
+    public function getSetting($key, $default = null)
+    {
+        if ($this->fluidbookSettings->has($key)) {
+            return $this->fluidbookSettings->get($key, $default);
+        }
+        if ($this->themeSettings->has($key)) {
+            return $this->themeSettings->get($key, $default);
+        }
+        return $default;
+    }
+
+    public function setSetting($key, $value)
+    {
+        if ($this->themeSettings->has($key)) {
+            $this->themeSettings->set($key, $value);
+            return;
+        }
+        $this->fluidbookSettings->set($key, $value);
+    }
+
     public function themeAsset($key, $default = null)
     {
         $collection = $this->theme->{$key};
@@ -421,19 +444,22 @@ class FluidbookCompiler extends Base
 
     public function initConfig()
     {
-        $this->config = ObjectUtil::merge($this->fluidbookSettings->getRawData()['settings'], $this->themeSettings->getRawData());
+        $this->config = new Data(array_merge($this->fluidbookSettings->getRawData()['settings'], $this->themeSettings->getRawData()));
         $this->config->bookmarkDisablePages = ArrayUtil::parseRange($this->config->bookmarkDisablePages);
         $this->config->rasterizePages = ArrayUtil::parseRange($this->config->rasterizePages);
         $this->config->vectorPages = array_diff(ArrayUtil::parseRange($this->config->vectorPages), $this->config->rasterizePages);
-        $this->config->tabsHideOnPages = ArrayUtil::parseRange($this->config->tabsHideOnPages);
+
+        $hideOnPages = ArrayUtil::parseRange($this->config->tabsHideOnPages);
         $this->config->tabsDisabledOnPages = ArrayUtil::parseRange($this->config->tabsDisabledOnPages);
+
         if ($this->config->tabsHideOnCover) {
-            $this->config->tabsHideOnPages[] = 0;
-            $this->config->tabsHideOnPages[] = 1;
+            $hideOnPages[] = 0;
+            $hideOnPages[] = 1;
         }
         if ($this->config->tabsHideOnLastPage) {
-            $this->config->tabsHideOnPages[] = count($this->pages);
+            $hideOnPages[] = count($this->pages);
         }
+        $this->config->tabsHideOnPages = $hideOnPages;
         $this->config->triggersLinks = [];
         $this->config->hasContentLock = false;
     }
@@ -573,7 +599,7 @@ class FluidbookCompiler extends Base
                 $opt = $odir . '/' . $n;
                 if (!file_exists($opt) || !filesize($opt) || filemtime($opt) < filemtime($f)) {
                     // Optimize original image
-                    $convert = new Image_Resizer_ImageMagick();
+                    $convert = new Resizer();
                     $convert->loadImage($f);
                     $convert->resize(1080, null, 'ratio', false, 'C', 'M', 'white');
                     $convert->output('jpg', $opt, 75);
@@ -582,7 +608,6 @@ class FluidbookCompiler extends Base
             }
             $this->vdir->copy($opt, 'data/commerce/' . $n);
         }
-
     }
 
     public function findEAN($array)
@@ -2040,7 +2065,7 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
         $lang = $daoLang->selectById($this->getFluidbook()->lang);
         $langs = $daoLang->selectAll();
 
-        $t = CubeIT_Util_Object::toArray($this->getFluidbook()->traductions);
+        $t = ObjectUtil::toArray($this->getFluidbook()->traductions);
 
         $traductions = (!is_countable($t) || !count($t)) ? $lang->traductions : $t;
 
@@ -2481,9 +2506,9 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
         }
 
         foreach ($allpages as $i) {
-            $this->config->links[$i] = $this->_htmlLinkList($pages[$i] ?? []);
-            $this->config->clinks[$i] = $this->_htmlLinkList($cpages[$i] ?? []);
-            $this->config->ctlinks[$i] = $this->_htmlLinkList($ctpages[$i] ?? []);
+            $this->config->set('links.' . $i, $this->_htmlLinkList($pages[$i] ?? []));
+            $this->config->set('clinks.' . $i, $this->_htmlLinkList($cpages[$i] ?? []));
+            $this->config->set('ctlinks.' . $i, $this->_htmlLinkList($ctpages[$i] ?? []));
         }
 
         if ($this->writeLinksData) {
@@ -2920,12 +2945,33 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
     }
 
 
+    /**
+     * @param $page
+     * @return array
+     */
     protected function getPageDimension($page)
     {
-        $d = $this->getFluidbook()->getDocumentSize($page);
-        $this->config->pagesDimensions[$page] = array($this->cssWidth, $d[1] * ($this->cssWidth / $d[0]));
+        $k = 'pagesDimensions.' . $page;
+        if (!$this->config->has($k)) {
+            $d = $this->getFluidbook()->getDocumentSize($page);
+            $res = [$this->cssWidth, $d[1] * ($this->cssWidth / $d[0])];
+            $this->config->set($k, $res);
+            return $res;
+        }
+        return $this->config->get($k);
+    }
+
+    public function getWidth()
+    {
+        return $this->getPageDimension(1)[0];
+    }
+
+    public function getHeight()
+    {
+        return $this->getPageDimension(1)[1];
     }
 
+
     protected function _makeCover($orig)
     {
         $cached = $this->wdir . '/_cover.jpg';
index e5adcd34d85695534e2810ef2a2287918a0f24ba..ec420ff48e83df2d02959c52410fde6f5f5c28a4 100644 (file)
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "6bf7dc70ab8577e11a99bba012989f5e",
+    "content-hash": "e6570a7a1b3b53182de40f6e0ce4f5e2",
     "packages": [
         {
             "name": "ahmadshah/lucy",
             "source": {
                 "type": "git",
                 "url": "git://git.cubedesigners.com/cubist_cms-back.git",
-                "reference": "cecb3fa12c91e88d9cd866e52fc8e44d2fdad48b"
+                "reference": "ac8952128ec46fa8b82fb7220edb6e4aff92a55f"
             },
             "dist": {
                 "type": "tar",
-                "url": "https://composer.cubedesigners.com/dist/cubist/cms-back/cubist-cms-back-dev-master-a5b709.tar",
-                "reference": "cecb3fa12c91e88d9cd866e52fc8e44d2fdad48b",
-                "shasum": "324108a8a96933b9fb578e7637f714c1e488d362"
+                "url": "https://composer.cubedesigners.com/dist/cubist/cms-back/cubist-cms-back-dev-master-609888.tar",
+                "reference": "ac8952128ec46fa8b82fb7220edb6e4aff92a55f",
+                "shasum": "5f5503bcc723bc2ec8a15b3556ae5202a898fe69"
             },
             "require": {
                 "backpack/backupmanager": "^3.0",
                 }
             ],
             "description": "Cubist Backpack extension",
-            "time": "2022-08-16T18:09:47+00:00"
+            "time": "2022-08-22T14:35:17+00:00"
         },
         {
             "name": "cubist/cms-front",
             "source": {
                 "type": "git",
                 "url": "git://git.cubedesigners.com/cubist_pdf.git",
-                "reference": "b93a3841c212ca8bf9793da611d90497b4f9a6de"
+                "reference": "a9776fd1cf4698352dfe7421aafc53ed0b4c1d6e"
             },
             "dist": {
                 "type": "tar",
-                "url": "https://composer.cubedesigners.com/dist/cubist/pdf/cubist-pdf-dev-master-876ad1.tar",
-                "reference": "b93a3841c212ca8bf9793da611d90497b4f9a6de",
-                "shasum": "7c956335d1f230f7f7bd313e72dd04115f2fea1f"
+                "url": "https://composer.cubedesigners.com/dist/cubist/pdf/cubist-pdf-dev-master-7c7ca6.tar",
+                "reference": "a9776fd1cf4698352dfe7421aafc53ed0b4c1d6e",
+                "shasum": "af35bdf43a35c2b9ca7420d0672289b586f5593b"
             },
             "require": {
                 "cubist/util": "dev-master",
                 "ext-json": "*",
                 "ext-libxml": "*",
                 "laravel/framework": "~5.8|^6.0|^7.0|^8.0",
-                "php": ">=7.3.0"
+                "php": ">=8.0"
             },
             "default-branch": true,
             "type": "library",
                 "cubist",
                 "pdf"
             ],
-            "time": "2022-07-21T18:23:40+00:00"
+            "time": "2022-08-22T14:43:58+00:00"
         },
         {
             "name": "cubist/scorm",
             "source": {
                 "type": "git",
                 "url": "git://git.cubedesigners.com/cubist_util.git",
-                "reference": "01408416b4bd244224d5cf8ab22d15acc00d088f"
+                "reference": "5f746d46b5892cf178f25ad8a2ba1e3d2cba0568"
             },
             "dist": {
                 "type": "tar",
-                "url": "https://composer.cubedesigners.com/dist/cubist/util/cubist-util-dev-master-6b76a2.tar",
-                "reference": "01408416b4bd244224d5cf8ab22d15acc00d088f",
-                "shasum": "0e5bda028ed33cfd7d443cf068d21832737ad7b3"
+                "url": "https://composer.cubedesigners.com/dist/cubist/util/cubist-util-dev-master-19118f.tar",
+                "reference": "5f746d46b5892cf178f25ad8a2ba1e3d2cba0568",
+                "shasum": "930fe6d64099ab08dd7a1950d2c1ec20647ef9fb"
             },
             "require": {
                 "cubist/net": "dev-master",
                 }
             ],
             "description": "Utilities class",
-            "time": "2022-08-18T12:23:22+00:00"
+            "time": "2022-08-22T14:49:19+00:00"
         },
         {
             "name": "cviebrock/eloquent-sluggable",
         },
         {
             "name": "doctrine/dbal",
-            "version": "3.4.1",
+            "version": "3.4.2",
             "source": {
                 "type": "git",
                 "url": "https://github.com/doctrine/dbal.git",
-                "reference": "94e016428884227245fb1219e0de7d8b86ca16d7"
+                "reference": "22de295f10edbe00df74f517612f1fbd711131e2"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/doctrine/dbal/zipball/94e016428884227245fb1219e0de7d8b86ca16d7",
-                "reference": "94e016428884227245fb1219e0de7d8b86ca16d7",
+                "url": "https://api.github.com/repos/doctrine/dbal/zipball/22de295f10edbe00df74f517612f1fbd711131e2",
+                "reference": "22de295f10edbe00df74f517612f1fbd711131e2",
                 "shasum": ""
             },
             "require": {
             ],
             "support": {
                 "issues": "https://github.com/doctrine/dbal/issues",
-                "source": "https://github.com/doctrine/dbal/tree/3.4.1"
+                "source": "https://github.com/doctrine/dbal/tree/3.4.2"
             },
             "funding": [
                 {
                     "type": "tidelift"
                 }
             ],
-            "time": "2022-08-16T18:37:46+00:00"
+            "time": "2022-08-21T14:21:06+00:00"
         },
         {
             "name": "doctrine/deprecations",
             "source": {
                 "type": "git",
                 "url": "git://git.cubedesigners.com/fluidbook_tools.git",
-                "reference": "42b0cc5eb306f6548e4ccb80419edcb02e701381"
+                "reference": "d5e3e0fc0176fdb7764669032f02ad1bf638a9d2"
             },
             "dist": {
                 "type": "tar",
-                "url": "https://composer.cubedesigners.com/dist/fluidbook/tools/fluidbook-tools-dev-master-15675b.tar",
-                "reference": "42b0cc5eb306f6548e4ccb80419edcb02e701381",
-                "shasum": "e77e8ac9a4eb34cff9d0cfda77aa9c4a2b1da4f6"
+                "url": "https://composer.cubedesigners.com/dist/fluidbook/tools/fluidbook-tools-dev-master-1651ab.tar",
+                "reference": "d5e3e0fc0176fdb7764669032f02ad1bf638a9d2",
+                "shasum": "82602466fb73e0eb1ab91a3a70e44c62c0bb6ef8"
             },
             "require": {
                 "barryvdh/laravel-debugbar": "^3.6",
                 }
             ],
             "description": "Fluidbook Tools",
-            "time": "2022-05-17T15:41:12+00:00"
+            "time": "2022-08-22T15:58:45+00:00"
         },
         {
             "name": "genealabs/laravel-model-caching",
         },
         {
             "name": "jane-php/json-schema-runtime",
-            "version": "v7.3.0",
+            "version": "v7.3.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/janephp/json-schema-runtime.git",
             ],
             "description": "Jane runtime Library",
             "support": {
-                "source": "https://github.com/janephp/json-schema-runtime/tree/v7.3.0"
+                "source": "https://github.com/janephp/json-schema-runtime/tree/v7.3.1"
             },
             "time": "2021-12-16T13:26:58+00:00"
         },
         {
             "name": "jane-php/open-api-runtime",
-            "version": "v7.3.0",
+            "version": "v7.3.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/janephp/open-api-runtime.git",
             ],
             "description": "Jane OpenAPI Runtime Library, dependencies and utility class for a library generated by jane/openapi",
             "support": {
-                "source": "https://github.com/janephp/open-api-runtime/tree/v7.3.0"
+                "source": "https://github.com/janephp/open-api-runtime/tree/v7.3.1"
             },
             "time": "2021-12-16T13:26:58+00:00"
         },
             },
             "time": "2020-06-27T09:03:43+00:00"
         },
-        {
-            "name": "phpdocumentor/reflection-docblock",
-            "version": "5.3.0",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
-                "reference": "622548b623e81ca6d78b721c5e029f4ce664f170"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170",
-                "reference": "622548b623e81ca6d78b721c5e029f4ce664f170",
-                "shasum": ""
-            },
-            "require": {
-                "ext-filter": "*",
-                "php": "^7.2 || ^8.0",
-                "phpdocumentor/reflection-common": "^2.2",
-                "phpdocumentor/type-resolver": "^1.3",
-                "webmozart/assert": "^1.9.1"
-            },
-            "require-dev": {
-                "mockery/mockery": "~1.3.2",
-                "psalm/phar": "^4.8"
-            },
-            "type": "library",
-            "extra": {
-                "branch-alias": {
-                    "dev-master": "5.x-dev"
-                }
-            },
-            "autoload": {
-                "psr-4": {
-                    "phpDocumentor\\Reflection\\": "src"
-                }
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "MIT"
-            ],
-            "authors": [
-                {
-                    "name": "Mike van Riel",
-                    "email": "me@mikevanriel.com"
-                },
-                {
-                    "name": "Jaap van Otterdijk",
-                    "email": "account@ijaap.nl"
-                }
-            ],
-            "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
-            "support": {
-                "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues",
-                "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0"
-            },
-            "time": "2021-10-19T17:43:47+00:00"
-        },
         {
             "name": "phpdocumentor/type-resolver",
             "version": "1.6.1",
             },
             "time": "2022-03-15T21:29:03+00:00"
         },
-        {
-            "name": "phpspec/prophecy",
-            "version": "v1.15.0",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/phpspec/prophecy.git",
-                "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13",
-                "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13",
-                "shasum": ""
-            },
-            "require": {
-                "doctrine/instantiator": "^1.2",
-                "php": "^7.2 || ~8.0, <8.2",
-                "phpdocumentor/reflection-docblock": "^5.2",
-                "sebastian/comparator": "^3.0 || ^4.0",
-                "sebastian/recursion-context": "^3.0 || ^4.0"
-            },
-            "require-dev": {
-                "phpspec/phpspec": "^6.0 || ^7.0",
-                "phpunit/phpunit": "^8.0 || ^9.0"
-            },
-            "type": "library",
-            "extra": {
-                "branch-alias": {
-                    "dev-master": "1.x-dev"
-                }
-            },
-            "autoload": {
-                "psr-4": {
-                    "Prophecy\\": "src/Prophecy"
-                }
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "MIT"
-            ],
-            "authors": [
-                {
-                    "name": "Konstantin Kudryashov",
-                    "email": "ever.zet@gmail.com",
-                    "homepage": "http://everzet.com"
-                },
-                {
-                    "name": "Marcello Duarte",
-                    "email": "marcello.duarte@gmail.com"
-                }
-            ],
-            "description": "Highly opinionated mocking framework for PHP 5.3+",
-            "homepage": "https://github.com/phpspec/prophecy",
-            "keywords": [
-                "Double",
-                "Dummy",
-                "fake",
-                "mock",
-                "spy",
-                "stub"
-            ],
-            "support": {
-                "issues": "https://github.com/phpspec/prophecy/issues",
-                "source": "https://github.com/phpspec/prophecy/tree/v1.15.0"
-            },
-            "time": "2021-12-08T12:19:24+00:00"
-        },
         {
             "name": "phpunit/php-code-coverage",
             "version": "7.0.15",
         },
         {
             "name": "phpunit/phpunit",
-            "version": "8.5.28",
+            "version": "8.5.29",
             "source": {
                 "type": "git",
                 "url": "https://github.com/sebastianbergmann/phpunit.git",
-                "reference": "8f2d1c9c7b30382459c871467853da1a6e44fbd4"
+                "reference": "e8c563c47a9a303662955518ca532b022b337f4d"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/8f2d1c9c7b30382459c871467853da1a6e44fbd4",
-                "reference": "8f2d1c9c7b30382459c871467853da1a6e44fbd4",
+                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e8c563c47a9a303662955518ca532b022b337f4d",
+                "reference": "e8c563c47a9a303662955518ca532b022b337f4d",
                 "shasum": ""
             },
             "require": {
                 "phar-io/manifest": "^2.0.3",
                 "phar-io/version": "^3.0.2",
                 "php": ">=7.2",
-                "phpspec/prophecy": "^1.10.3",
                 "phpunit/php-code-coverage": "^7.0.12",
                 "phpunit/php-file-iterator": "^2.0.4",
                 "phpunit/php-text-template": "^1.2.1",
             ],
             "support": {
                 "issues": "https://github.com/sebastianbergmann/phpunit/issues",
-                "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.28"
+                "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.29"
             },
             "funding": [
                 {
                     "type": "github"
                 }
             ],
-            "time": "2022-07-29T09:20:50+00:00"
+            "time": "2022-08-22T13:59:39+00:00"
         },
         {
             "name": "psy/psysh",