From 82bd5d65aeef22d6a903b841725bd12a3a94d54c Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Mon, 15 Nov 2021 11:51:30 +0000 Subject: [PATCH] wait #4866 @1 --- .../html5/master/class.ws.html5.compiler.php | 57 ++++++++++--------- .../html5/master/class.ws.html5.links.php | 2 +- 2 files changed, 31 insertions(+), 28 deletions(-) diff --git a/inc/ws/Util/html5/master/class.ws.html5.compiler.php b/inc/ws/Util/html5/master/class.ws.html5.compiler.php index 0736704fc..63e2b31bf 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/master/class.ws.html5.compiler.php @@ -704,9 +704,9 @@ class wsHTML5Compiler public function writeCartConfig() { - if($this->book->parametres->cartLinkAppearance=='overlay'){ - $this->svgfiles[]=$this->assets . '/images/symbols/cart-overlay.svg'; - } + if ($this->book->parametres->cartLinkAppearance == 'overlay') { + $this->svgfiles[] = $this->assets . '/images/symbols/cart-overlay.svg'; + } if ($this->config->basket) { $this->addJsLib('cart', 'js/libs/fluidbook/fluidbook.cart.js'); @@ -1843,6 +1843,7 @@ height="0" width="0" style="display:none;visibility:hidden"> foreach ($linksCopy as $k => $linkData) { if ($linkData['type'] == 26 || $linkData == 40) { + $linkData['to']=anchorLink::normalizeAnchor($linkData['to']); $anchorExists[$linkData['to']] = $linkData; } if ($linkData['type'] == 35 || $linkData['type'] == 15 || $linkData['type'] == 39) { @@ -1920,32 +1921,34 @@ height="0" width="0" style="display:none;visibility:hidden"> if ($this->book->parametres->anchorsAliases && file_exists($this->book->parametres->anchorsAliases)) { $aliases = []; $anchors = []; - $lines = CubeIT_Util_Text::explodeNewLines(file_get_contents($this->book->parametres->anchorsAliases)); - foreach ($lines as $line) { - $e = explode("\t", $line); - $from = trim($e[0]); - $to = trim($e[1]); - $aliases[$from] = $to; - if (is_numeric($to) && !isset($anchorExists[$from])) { - $anchor = [ - 'page' => $to, - 'top' => 0, - 'left' => 0, - 'width' => 100, - 'height' => 100, - 'type' => 26, - 'to' => $from, - 'uid' => wsHTML5Link::generateUID() - ]; - $anchorExists[$from] = $anchor; - $links[] = $anchor; - } else { - if (!isset($anchorExists[$from]) && isset($anchorExists[$to])) { - $anchor = $anchorExists[$to]; - $anchor['to'] = $from; - $anchor['uid'] = wsHTML5Link::generateUID(); + for ($i = 0; $i <= 2; $i++) { + $lines = CubeIT_Util_Text::explodeNewLines(file_get_contents($this->book->parametres->anchorsAliases)); + foreach ($lines as $line) { + $e = explode("\t", $line); + $from = anchorLink::normalizeAnchor($e[0]); + $to = anchorLink::normalizeAnchor($e[1]); + $aliases[$from] = $to; + if (is_numeric($to) && !isset($anchorExists[$from])) { + $anchor = [ + 'page' => $to, + 'top' => 0, + 'left' => 0, + 'width' => 100, + 'height' => 100, + 'type' => 26, + 'to' => $from, + 'uid' => wsHTML5Link::generateUID() + ]; $anchorExists[$from] = $anchor; $links[] = $anchor; + } else { + if (!isset($anchorExists[$from]) && isset($anchorExists[$to])) { + $anchor = $anchorExists[$to]; + $anchor['to'] = $from; + $anchor['uid'] = wsHTML5Link::generateUID(); + $anchorExists[$from] = $anchor; + $links[] = $anchor; + } } } } diff --git a/inc/ws/Util/html5/master/class.ws.html5.links.php b/inc/ws/Util/html5/master/class.ws.html5.links.php index 68dc938f5..f3c4db9f1 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.links.php +++ b/inc/ws/Util/html5/master/class.ws.html5.links.php @@ -799,7 +799,7 @@ class anchorLink extends wsHTML5Link public static function normalizeAnchor($anchor) { - return mb_strtolower(CubeIT_Text::str2URL($anchor)); + return str_replace('-', '', mb_strtolower(CubeIT_Text::str2URL(trim($anchor)))); } } -- 2.39.5