]> _ Git - fluidbook_tools.git/commitdiff
wait #6084 @0.75
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 27 Jun 2023 08:46:32 +0000 (10:46 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 27 Jun 2023 08:46:32 +0000 (10:46 +0200)
src/Links/Link.php
src/Links/TextPopupLink.php

index 0540e5105cada03014bd1968eae478638db2fd95..1e6543bd40a567c4723f797896aaee2d2398282c 100644 (file)
@@ -64,6 +64,7 @@ class Link {
     const ANCHOR = 40;
     const FLIPCARD = 41;
     const PDF = 42;
+    const TEXT_POPUP = 43;
 
 
     protected static string|false|null $_linksKey = null;
@@ -152,14 +153,14 @@ class Link {
         $init['to'] = self::replaceCustomURL($init['to']);
 
         switch ($init['type']) {
-            case 1:
-            case 2:
+            case static::WEB:
+            case static::WEB_INFOS:
                 return new WebLink($id, $init, $compiler);
-            case 3:
+            case static::EMAIL:
                 return new MailLink($id, $init, $compiler);
-            case 5:
+            case static::INTERNAL:
                 return new InternalLink($id, $init, $compiler);
-            case 4:
+            case static::VIDEO:
                 $init['inline'] = self::normalizeInlineIntegration($init['inline']);
                 if ($init['inline'] === 'inline') {
                     $init['inline'] = 'inline';
@@ -171,62 +172,60 @@ class Link {
                     $init['inline'] = 'background_texts';
                     return new VideoBackgroundLink($id, $init, $compiler);
                 }
-            case 7:
+            case static::CUSTOM:
                 return CustomLink::getCustomInstance($id, $init, $compiler);
-            case 10:
+            case static::WEBVIDEO:
                 $init['inline'] = self::normalizeInlineIntegration($init['inline']);
                 if ($init['inline'] === 'popup') {
                     return new WebVideoPopupLink($id, $init, $compiler);
                 }
                 return new WebVideoLink($id, $init, $compiler);
-            case 11:
+            case static::ACTION:
                 return new ActionLink($id, $init, $compiler);
-            case 12: // Basket / Cart links
+            case static::CART: // Basket / Cart links
                 return new CartLink($id, $init, $compiler);
-            case 13: // zoom area
+            case static::ZOOM: // zoom area
                 return new ZoomLink($id, $init, $compiler);
-            case 14:
+            case static::COLOR:
                 return new ColorLink($id, $init, $compiler);
-            case 15:
+            case static::IMAGE:
                 if (stristr($init['to'], '.zip')) {
                     return new InlineSlideshowLink($id, $init, $compiler);
                 }
                 return new ImageLink($id, $init, $compiler);
-            case 16:
+            case static::FILE:
                 return new FileLink($id, $init, $compiler);
-            case 17:
+            case static::AUDIO:
                 $init['inline'] = self::normalizeInlineIntegration($init['inline']);
                 if ($init['inline'] === 'inline') {
                     return new AudioLink($id, $init, $compiler);
                 }
                 return new AudioPopupLink($id, $init, $compiler);
-            case 18:
-                $init['inline'] = self::normalizeInlineIntegration($init['inline']);
-                if ($init['inline'] === 'inline') {
-                    return new TooltipLink($id, $init, $compiler);
-                }
+            case static::TOOLTIP:
+                return new TooltipLink($id, $init, $compiler);
+            case static::TEXT_POPUP:
                 return new TextPopupLink($id, $init, $compiler);
-            case 20:
+            case static::BOOKMARKGROUP:
                 $compiler->addBookmarkGroup($init);
                 break;
-            case 21:
-            case 6:
+            case static::HTML5MULTIMEDIA:
+            case static::MULTIMEDIA:
                 return self::getMultimediaInstance($id, $init, $compiler);
-            case 23:
+            case static::STATSTAG:
                 return new StatsTagLink($id, $init, $compiler);
-            case 24:
+            case static::PHONE:
                 return new PhoneLink($id, $init, $compiler);
-            case 25:
+            case static::AUDIODESCRIPTION:
                 $compiler->addAudiodescription($init);
                 break;
-            case 26:
-            case 40:
+            case static::PAGE_LABEL:
+            case static::ANCHOR:
                 return new AnchorLink($id, $init, $compiler);
-            case 27:
+            case static::EVENT_OVERLAY:
                 return new EventOverlayLink($id, $init, $compiler);
-            case 29:
+            case static::LIKE:
                 return new FacebookLikeLink($id, $init, $compiler);
-            case 30:
+            case static::SLIDESHOW:
                 if (stristr($init['to'], '.zip')) {
                     $d = $compiler->unzipFile($init['to'], false, null, true);
                     if (Files::count($d['dir']) === 1) {
@@ -243,30 +242,30 @@ class Link {
                 } else {
                     return new HTMLMultimediaPopupImage($id, $init, $compiler);
                 }
-            case 31:
+            case static::IFRAME:
                 $init['inline'] = self::normalizeInlineIntegration($init['inline']);
                 if ($init['inline'] === 'inline') {
                     return new IFrameLink($id, $init, $compiler);
                 }
                 return new IFramePopupLink($id, $init, $compiler);
-            case 32:
+            case static::SHOWLINK:
                 return new ShowLinkLink($id, $init, $compiler);
-            case 33:
+            case static::ZOOMHD:
                 return new ZoomHDLink($id, $init, $compiler);
-            case 34:
+            case static::LOCK_CONTENTS:
                 $compiler->addContentLock($init['page'], $init['to']);
                 break;
-            case 35:
+            case static::TEXT:
                 return new TextLink($id, $init, $compiler);
-            case 36:
+            case static::ARTICLE_OPEN:
                 if (stripos($init['to'], '.pdf') !== false) {
                     return new ArticlePDFLink($id, $init, $compiler);
                 } else {
                     return new ArticleLink($id, $init, $compiler);
                 }
-            case 37:
+            case static::DOWNLOAD_PORTION:
                 return new DownloadPortionLink($id, $init, $compiler);
-            case 38:
+            case static::TRIGGERSLINK:
                 if ($init['target'] != 'click') {
 
                     $extras = isset($init['extra']) ? self::parseExtras($init['extra']) : [];
@@ -276,11 +275,11 @@ class Link {
                     return new TriggerLink($id, $init, $compiler);
                 }
                 break;
-            case 39:
+            case static::LAYER:
                 return new LayerLink($id, $init, $compiler);
-            case 41:
+            case static::FLIPCARD:
                 return new FlipcardLink($id, $init, $compiler);
-            case 42:
+            case static::PDF:
                 return new PDFPopupLink($id, $init, $compiler);
             default:
                 return null;
index 3f7fe07b0cb5fc7410d1e927d7e9944ea36c326b..df6e594316367ad5a44d5d48f9ca154d4fea25c3 100644 (file)
@@ -2,27 +2,18 @@
 
 namespace Fluidbook\Tools\Links;
 
-class TextPopupLink extends NormalLink
-{
-    public function getClasses()
-    {
+class TextPopupLink extends NormalLink {
+    public function getClasses() {
         return array_merge(array('lazy', 'textpopup'), parent::getClasses());
     }
 
-    public function getAdditionnalContent()
-    {
+    public function getAdditionnalContent() {
         $res = parent::getAdditionnalContent();
-        $res .= ' data-text="' . htmlspecialchars($this->tooltip, ENT_QUOTES) . '" ';
+        $res .= ' data-text="' . htmlspecialchars($this->to, ENT_QUOTES) . '" ';
         return $res;
     }
 
-    public function getURL()
-    {
+    public function getURL() {
         return '#';
     }
-
-    public function getTooltip()
-    {
-        return '';
-    }
 }