]> _ Git - fluidbook_tools.git/commitdiff
wip #4697 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 22 Sep 2021 07:37:11 +0000 (09:37 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 22 Sep 2021 07:37:11 +0000 (09:37 +0200)
12 files changed:
composer.lock
src/Links/ColorLink.php
src/Links/FileLink.php
src/Links/HTMLMultimediaLink.php
src/Links/IFrameLink.php
src/Links/InlineSlideshowLink.php
src/Links/TextLink.php
src/Links/VideoLink.php
src/Links/VideoPopupLink.php
src/Links/WebLink.php
src/Links/WebVideoLink.php
src/Links/ZoomLink.php

index b4604f2a2bf33c3c3f551e080a1e8fbf92cb99f2..be869e6db0741d1ff393ff3b7fe93cafc4054886 100644 (file)
             "source": {
                 "type": "git",
                 "url": "git://git.cubedesigners.com/cubist_util.git",
-                "reference": "ca9f1c2f7c8e729a1b6ff64ece1e1c1ab1ef4228"
+                "reference": "3d0d8337bd9e4b3ccf3d99ab7070ede27b1475bb"
             },
             "dist": {
                 "type": "tar",
-                "url": "https://composer.cubedesigners.com/dist/cubist/util/cubist-util-dev-master-e2358f.tar",
-                "reference": "ca9f1c2f7c8e729a1b6ff64ece1e1c1ab1ef4228",
-                "shasum": "c0c32959b037843d1d053b60223a3e13e0693278"
+                "url": "https://composer.cubedesigners.com/dist/cubist/util/cubist-util-dev-master-b28a8b.tar",
+                "reference": "3d0d8337bd9e4b3ccf3d99ab7070ede27b1475bb",
+                "shasum": "b60f0a943faf5ff520e7bab322d71b124705e744"
             },
             "require": {
                 "cubist/net": "dev-master",
                 }
             ],
             "description": "Utilities class",
-            "time": "2021-09-15T15:24:17+00:00"
+            "time": "2021-09-22T07:22:01+00:00"
         },
         {
             "name": "dflydev/dot-access-data",
             "source": {
                 "type": "git",
                 "url": "https://github.com/laravel/framework.git",
-                "reference": "f267d7cb9b159805d3e6ca805210d85f40c27209"
+                "reference": "3d1ead403e05ee0b9aa93a6ff720704970aec9c8"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/laravel/framework/zipball/f267d7cb9b159805d3e6ca805210d85f40c27209",
-                "reference": "f267d7cb9b159805d3e6ca805210d85f40c27209",
+                "url": "https://api.github.com/repos/laravel/framework/zipball/3d1ead403e05ee0b9aa93a6ff720704970aec9c8",
+                "reference": "3d1ead403e05ee0b9aa93a6ff720704970aec9c8",
                 "shasum": ""
             },
             "require": {
                 "issues": "https://github.com/laravel/framework/issues",
                 "source": "https://github.com/laravel/framework"
             },
-            "time": "2021-09-21T13:41:09+00:00"
+            "time": "2021-09-21T18:36:59+00:00"
         },
         {
             "name": "laravel/serializable-closure",
             "source": {
                 "type": "git",
                 "url": "https://github.com/nette/utils.git",
-                "reference": "d0d9bff8b7a496961c28877346be2e348fe5e6d6"
+                "reference": "25d75271d2d88f211d4684638cbc938a75868b12"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/nette/utils/zipball/d0d9bff8b7a496961c28877346be2e348fe5e6d6",
-                "reference": "d0d9bff8b7a496961c28877346be2e348fe5e6d6",
+                "url": "https://api.github.com/repos/nette/utils/zipball/25d75271d2d88f211d4684638cbc938a75868b12",
+                "reference": "25d75271d2d88f211d4684638cbc938a75868b12",
                 "shasum": ""
             },
             "require": {
                 "issues": "https://github.com/nette/utils/issues",
                 "source": "https://github.com/nette/utils/tree/master"
             },
-            "time": "2021-09-20T10:52:29+00:00"
+            "time": "2021-09-22T00:14:13+00:00"
         },
         {
             "name": "opis/closure",
index c5365d2db01752df9ae8a86006cdabe1d78325bc..5f35e5f69f442579ab0809e55edce64000762053 100644 (file)
@@ -2,6 +2,8 @@
 
 namespace Fluidbook\Tools\Links;
 
+use Cubist\Util\Graphics\Color;
+
 class ColorLink extends ContentLink
 {
     protected $role = '';
@@ -9,14 +11,14 @@ class ColorLink extends ContentLink
     public function getCSS()
     {
         $res = parent::getCSS();
-        $res .= 'background-color:' . wsHTML5::colorToCSS($this->to, 1) . ';';
+        $res .= 'background-color:' . Color::colorToCSS($this->to, 1) . ';';
         return $res;
     }
 
     public function getAdditionnalContent()
     {
         $res = parent::getAdditionnalContent();
-        $res .= ' data-color="' . wsHTML5::colorToCSS($this->to, 1) . '"';
+        $res .= ' data-color="' . Color::colorToCSS($this->to, 1) . '"';
         return $res;
     }
 }
index 91bf92c6d86ef3ae21a282e19279c809552663f5..6c6a626ac6073949c5224d9a6c5496ec13ec6695 100644 (file)
@@ -2,6 +2,8 @@
 
 namespace Fluidbook\Tools\Links;
 
+use Cubist\Util\Url;
+
 class FileLink extends NormalLink
 {
     protected $role = 'link';
@@ -10,7 +12,7 @@ class FileLink extends NormalLink
     {
         $this->copyExternalFile($this->to);
 
-        if ($this->compiler->book->parametres->linkFilePrefix && !CubeIT_Util_Url::isDistant($this->to)) {
+        if ($this->compiler->book->parametres->linkFilePrefix && !Url::isDistant($this->to)) {
             return $this->compiler->book->parametres->linkFilePrefix . $this->to;
         }
 
index 23583895230ef4f0275bd8737a8cfbe43de8f6b2..c23d8f6bf0bef06c940830d46697846862ee5f92 100644 (file)
@@ -2,6 +2,8 @@
 
 namespace Fluidbook\Tools\Links;
 
+use Cubist\Util\Files\Files;
+
 class HTMLMultimediaLink extends Link
 {
 
@@ -126,10 +128,10 @@ class HTMLMultimediaLink extends Link
 
     protected function _correctFiles($dir)
     {
-        $files = CubeIT_Files::getRecursiveDirectoryIterator($dir);
+        $files = Files::getRecursiveDirectoryIterator($dir);
         foreach ($files as $f) {
             /* @var $f SplFileInfo */
-            if ($f->getExtension() == 'js') {
+            if ($f->getExtension() === 'js') {
                 $this->_correctFile($f);
             }
         }
index 36c07e849cdc975535a9b4b85b795317b91fbad3..64e1ca0e3a191c37933660fa8d6e06fcdf32c323 100644 (file)
@@ -2,6 +2,8 @@
 
 namespace Fluidbook\Tools\Links;
 
+use Cubist\Util\Url;
+
 class IFrameLink extends Link
 {
     protected $_defaultTooltip;
@@ -24,7 +26,7 @@ class IFrameLink extends Link
     public static function _handleFile($link)
     {
         $to = preg_replace('/^data\/links\//', '', $link->to);
-        if (!CubeIT_Util_Url::isDistant($to)) {
+        if (!Url::isDistant($to)) {
             $e = explode('.', $to);
             $ext = array_pop($e);
             if ($ext === 'oam' || $ext === 'zip') {
index 442e1388c79e64ea37aded0309fb55550275669b..45781af9ebe17cb8bb8ce2571c45baebb7fc31cf 100644 (file)
@@ -2,7 +2,7 @@
 
 namespace Fluidbook\Tools\Links;
 
-class inlineSlideshowLink extends slideshowLink
+class InlineSlideshowLink extends SlideshowLink
 {
     public function getDepth()
     {
index 8b82c41b26f836a85de7b575e345845aab3dbaf7..9b1d2a1b0fb14e44162e143deced6d226278f317 100644 (file)
@@ -2,6 +2,8 @@
 
 namespace Fluidbook\Tools\Links;
 
+use Cubist\Util\Graphics\Color;
+
 class TextLink extends ContentLink
 {
     public function getCSS()
@@ -13,7 +15,7 @@ class TextLink extends ContentLink
         $fz = $this->height * $this->getCssScale();
         $fz = round($fz / $font['capHeight'], 2);
         $res = parent::getCSS();
-        $res .= 'line-height:' . $font['capHeight'] . ';font-size:' . $fz . 'px;font-family:' . $font['family'] . ';color:' . wsHTML5::colorToCSS($this->extra, 1) . ';';
+        $res .= 'line-height:' . $font['capHeight'] . ';font-size:' . $fz . 'px;font-family:' . $font['family'] . ';color:' . Color::colorToCSS($this->extra, 1) . ';';
         return $res;
     }
 
@@ -22,14 +24,6 @@ class TextLink extends ContentLink
         return parent::getHTMLContainerClass() . ' textLink';
     }
 
-
-    public function getAdditionnalContent()
-    {
-        $res = parent::getAdditionnalContent();
-
-        return $res;
-    }
-
     public function getHTMLContent()
     {
         return $this->to;
index 6a3152290492d6d65e6e61d2af15d242edc11e58..1cd64f2f2efb1e721f213ad8f80654d73fdcbaf1 100644 (file)
@@ -2,6 +2,8 @@
 
 namespace Fluidbook\Tools\Links;
 
+use Cubist\Util\Url;
+
 class VideoLink extends Link
 {
     public $defaultZIndex = 50;
@@ -27,7 +29,7 @@ class VideoLink extends Link
 
     public function getHTMLContent()
     {
-        if (!CubeIT_Util_Url::isDistant($this->to)) {
+        if (!Url::isDistant($this->to)) {
             $this->copyExternalFile($this->to, true);
         }
 
@@ -61,7 +63,7 @@ class VideoLink extends Link
     {
 
         $attr['name'] = videoPopupLink::getBasename($data->to);
-        if (CubeIT_Util_Url::isDistant($data->to)) {
+        if (Url::isDistant($data->to)) {
             $attr['url'] = $data->to;
         }
         $attr['id'] = 'video_' . $data->id;
@@ -76,7 +78,7 @@ class VideoLink extends Link
         if (!is_null($w) && !is_null($h)) {
             $attr['width'] = $w;
             $attr['height'] = $h;
-        } else if (!is_null($compiler) && CubeIT_Util_Url::isLocal($data->to)) {
+        } else if (!is_null($compiler) && Url::isLocal($data->to)) {
             // Get video dimensions from thumbnail if possible (locally uploaded files)
             $path = $compiler->wdir . '/' . $data->to;
             $e = explode(',', `ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=p=0 $path`);
index 6232b7251f4962496820aedfa3d27026049404fe..43a610a6e9fef187163946df6a5ee81726a60b4a 100644 (file)
@@ -2,13 +2,15 @@
 
 namespace Fluidbook\Tools\Links;
 
+use Cubist\Util\Url;
+
 class VideoPopupLink extends NormalLink
 {
 
     public static function getBasename($f)
     {
         $prefix = '';
-        if (CubeIT_Util_Url::isDistant($f)) {
+        if (Url::isDistant($f)) {
             $prefix = mb_substr(sha1($f), 0, 10) . '-';
             $e = explode('/', $f);
             $f = array_pop($e);
@@ -20,7 +22,7 @@ class VideoPopupLink extends NormalLink
 
     public function getURL()
     {
-        if (!CubeIT_Util_Url::isDistant($this->to)) {
+        if (!Url::isDistant($this->to)) {
             $this->copyExternalFile($this->to, true);
         }
         return '#/video/' . self::getBasename($this->to);
@@ -31,7 +33,7 @@ class VideoPopupLink extends NormalLink
         $this->video_auto_start = true; // Videos should always autoplay
         $this->video_sound_on = true;
         $this->video_controls = true;
-        return ' data-video="' . rawurlencode(videoLink::makeVideoTag($this, null, null, $this->compiler)) . '" ';
+        return ' data-video="' . rawurlencode(VideoLink::makeVideoTag($this, null, null, $this->compiler)) . '" ';
     }
 
     public function keep()
index 9f74e55c06aacbb42313aedf3e3d06483995440f..44ad9311a05bef78fe08e3132932d7b9db23f1d7 100644 (file)
@@ -9,13 +9,12 @@ class WebLink extends NormalLink
 
     public function getURL()
     {
-        $res = str_replace('"', '\'', Link::getUniversalLocation($this->to));
-        return $res;
+        return str_replace('"', '\'', Link::getUniversalLocation($this->to));
     }
 
     public function getTarget()
     {
-        if (strpos($this->getURL(), 'javascript:') === 0) {
+        if (str_starts_with($this->getURL(), 'javascript:')) {
             return '_self';
         }
         return $this->target;
index c7199da97a7f703ec1045e6cda8b19e2d158ea40..d93dec6117368d97f07fac9472d5bb3d553a564d 100644 (file)
@@ -17,6 +17,9 @@ class WebVideoLink extends videoLink
         return $attributes;
     }
 
+    /**
+     * @throws \JsonException
+     */
     public static function getVideoSetup($data, $compiler)
     {
         static::addVideoJS($compiler); // Ensure videoJS core is included first
@@ -67,7 +70,7 @@ class WebVideoLink extends videoLink
                 $setup = [];
         }
 
-        return json_encode($setup, JSON_UNESCAPED_SLASHES);
+        return json_encode($setup, JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES);
 
     }
 
@@ -109,7 +112,7 @@ class WebVideoLink extends videoLink
         }
     }
 
-    public static function makeVideoTag($link, $width, $height, $compiler = null)
+    public static function makeVideoTag($link, $width=null, $height=null, $compiler = null)
     {
         if ($link->video_service == 0) {
             return parent::makeVideoTag($link, $width, $height, $compiler);
index 1d2b81488e1817ba09aba85ca81f351a994d625f..592f7193a2515c7206d2ae07480a153b2a03df1a 100644 (file)
@@ -2,6 +2,9 @@
 
 namespace Fluidbook\Tools\Links;
 
+use Cubist\Util\Files\Files;
+use Cubist\Util\Text;
+
 class ZoomLink extends NormalLink
 {
     protected $maxzoom_default = 2;
@@ -158,7 +161,7 @@ class ZoomLink extends NormalLink
         }
 
         if (isset($attributes['border']) && $attributes['border'] > 0) {
-            $tmp = CubeIT_Files::tempnam() . '.jpg';
+            $tmp = Files::tempnam() . '.jpg';
             CubeIT_CommandLine_Imagemagick::addBorder($both, $tmp, $attributes['border'], $attributes['borderColor']);
             $compiler->vdir->addTemp($both);
             $both = $tmp;
@@ -185,7 +188,7 @@ class ZoomLink extends NormalLink
         foreach ($groups as $group) {
             if (empty($group)) continue;
 
-            $group_classes[] = 'zoom-group-' . trim(CubeIT_Text::str2URL($group));
+            $group_classes[] = 'zoom-group-' . trim(Text::str2URL($group));
         }
 
         return array_merge($group_classes, ['zoomPopup'], parent::getClasses());