From: Vincent Vanwaelscappel Date: Fri, 25 Apr 2025 15:16:14 +0000 (+0200) Subject: #7259 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=01e25930b2543c7f113724f33a5ff8e6ee34804c;p=fluidbook_tools.git #7259 --- diff --git a/src/Compiler/Links.php b/src/Compiler/Links.php index 1dffa5a..fa00c00 100644 --- a/src/Compiler/Links.php +++ b/src/Compiler/Links.php @@ -10,11 +10,13 @@ use Fluidbook\Tools\Links\ContentLink; use Fluidbook\Tools\Links\Link; use Nette\Utils\Image; -trait Links { +trait Links +{ /** * @throws \SodiumException */ - public function compileLinks() { + public function compileLinks() + { /** @var Link[] $links */ $links = $this->getLinks(); @@ -234,12 +236,14 @@ trait Links { return $css; } - public function getLinks() { + public function getLinks() + { return []; } - protected function getLinksFromPDF() { - $booleans = ['video_loop', 'video_auto_start', 'video_controls', 'video_sound_on']; + protected function getLinksFromPDF() + { + $booleans = ['video_loop', 'video_auto_start', 'video_controls', 'video_sound_on', 'video_cc']; $numbers = ['left', 'top', 'width', 'height']; $links = []; @@ -264,7 +268,7 @@ trait Links { } $link = ['uid' => self::makeUID()]; - $cols = ['page' => '', 'left' => '', 'top' => '', 'width' => '', 'height' => '', 'type' => '', 'to' => '', 'target' => '_blank', 'video_loop' => true, 'video_auto_start' => true, 'video_controls' => true, 'video_sound_on' => true, 'tooltip' => '', 'image_rollover' => '', 'numerotation' => 'physical', "inline" => true]; + $cols = ['page' => '', 'left' => '', 'top' => '', 'width' => '', 'height' => '', 'type' => '', 'to' => '', 'target' => '_blank', 'video_loop' => true, 'video_auto_start' => true, 'video_controls' => true, 'video_sound_on' => true, 'video_cc' => true, 'tooltip' => '', 'image_rollover' => '', 'numerotation' => 'physical', "inline" => true]; $k = 0; @@ -297,11 +301,13 @@ trait Links { return $links; } - protected static function makeUID() { + protected static function makeUID() + { return substr(md5(uniqid('fblink_', true)), 2, 8) . '00'; } - protected function _htmlLinkList($list) { + protected function _htmlLinkList($list) + { if (!count($list)) { return []; } @@ -318,7 +324,8 @@ trait Links { } - protected function _sortLinksByDepth($a, $b) { + protected function _sortLinksByDepth($a, $b) + { $c = $a->getDepth() - $b->getDepth(); if ($c === 0) { $c = $b->getSurface() - $a->getSurface(); @@ -330,7 +337,8 @@ trait Links { return $c; } - public function _sortLinks($a, $b) { + public function _sortLinks($a, $b) + { $priorities = array(26 => -1, 35 => 1); @@ -339,7 +347,8 @@ trait Links { return $pb - $pa; } - protected static function base36($val) { + protected static function base36($val) + { $chars = '0123456789abcdefghijklmnopqrstuvwxyz'; $base = strlen($chars); $str = ''; @@ -354,21 +363,24 @@ trait Links { /** * @return number */ - public function getLinkScale() { + public function getLinkScale() + { return (float)$this->config->cssScale; } /** * @throws \Exception */ - public function copyLinkDir($source, $dest) { + public function copyLinkDir($source, $dest) + { $this->vdir->copyDirectory($source, $dest); } /** * @throws Exception */ - public function simpleCopyLinkFile($source, $dest, $addVdir = true) { + public function simpleCopyLinkFile($source, $dest, $addVdir = true) + { if ($addVdir) { $dest = $dest; } @@ -380,11 +392,13 @@ trait Links { $this->vdir->copy($source, $dest); } - public function getVideosFormats() { + public function getVideosFormats() + { return ['mp4', 'jpg']; } - public function copyLinkFile($source, $dest, $video = false) { + public function copyLinkFile($source, $dest, $video = false) + { $types = $this->getVideosFormats(); if ($video) { $e = explode('.', $source); @@ -412,7 +426,8 @@ trait Links { /** * @throws Exception */ - public function unzipFile($file, $moveAssets = false, $baseDir = null) { + public function unzipFile($file, $moveAssets = false, $baseDir = null) + { $fdir = is_null($baseDir) ? 'data/links/' . str_replace('.', '_', Files::getFilename($file)) : $baseDir; $dir = $this->wdir . $fdir; diff --git a/src/Links/VideoBackgroundLink.php b/src/Links/VideoBackgroundLink.php index d311d55..ba51302 100644 --- a/src/Links/VideoBackgroundLink.php +++ b/src/Links/VideoBackgroundLink.php @@ -19,6 +19,7 @@ class VideoBackgroundLink extends VideoLink $init['video_loop'] = true; $init['video_controls'] = false; $init['video_auto_start'] = true; + $init['video_cc'] = false; parent::__construct($id, $init, $compiler); } } diff --git a/src/Links/VideoLink.php b/src/Links/VideoLink.php index a7b89e8..6292e24 100644 --- a/src/Links/VideoLink.php +++ b/src/Links/VideoLink.php @@ -83,6 +83,7 @@ class VideoLink extends Link $attr['controls'] = ($data->video_controls ? '1' : '0'); $attr['loop'] = ($data->video_loop ? '1' : '0'); $attr['sound'] = ($data->video_sound_on ? '1' : '0'); + $attr['cc'] = (($data->video_cc ?? '1') ? '1' : '0'); $attr['hidelinksonplay'] = $data->hidelinksonplay; $attr['link-id'] = $data->uid; $attr['backgroundcolor'] = $data->backgroundColor ?? '#000000';