From 1321bea19745ffaf0d0944085dd7900ab8426e46 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 22 Mar 2023 18:17:02 +0100 Subject: [PATCH] wip #5817 --- src/Links/Link.php | 14 +++++++++++++- src/Links/SlideshowLink.php | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Links/Link.php b/src/Links/Link.php index 344f055..1e92693 100644 --- a/src/Links/Link.php +++ b/src/Links/Link.php @@ -6,6 +6,7 @@ use Cubist\Util\ArrayUtil; use Cubist\Util\Crypt; use Cubist\Util\CSS; use Cubist\Util\Files\Files; +use Cubist\Util\Files\RecursiveDirectoryIterator; use Cubist\Util\Json; use Cubist\Util\ObjectUtil; use Cubist\Util\Text; @@ -170,8 +171,19 @@ class Link { return new FacebookLikeLink($id, $init, $compiler); case 30: if (stristr($init['to'], '.zip')) { + $d = $compiler->unzipFile($init['to'], false, null, true); + if (Files::count($d['dir']) === 1) { + $it = new RecursiveDirectoryIterator($d['dir']); + foreach ($it as $item) { + /** @var $item \SplFileInfo */ + copy($item->getPathname(), $compiler->getWorkingDir() . '/' . $item->getFilename()); + $init['to'] = $item->getFilename(); + return new HTMLMultimediaPopupImage($id, $init, $compiler); + } + + } return new SlideshowLink($id, $init, $compiler); - }else{ + } else { return new HTMLMultimediaPopupImage($id, $init, $compiler); } case 31: diff --git a/src/Links/SlideshowLink.php b/src/Links/SlideshowLink.php index 58886d2..cf13da9 100644 --- a/src/Links/SlideshowLink.php +++ b/src/Links/SlideshowLink.php @@ -137,6 +137,8 @@ class SlideshowLink extends NormalLink { return $slides; } + + protected function _slides($slides, $options = []) { $default_options = [ 'show_captions' => true, -- 2.39.5