]> _ Git - fluidbook_tools.git/commitdiff
#7259
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 25 Apr 2025 15:16:14 +0000 (17:16 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 25 Apr 2025 15:16:14 +0000 (17:16 +0200)
src/Compiler/Links.php
src/Links/VideoBackgroundLink.php
src/Links/VideoLink.php

index 1dffa5acce0adea139d3dd451653ff4f0607429f..fa00c00695aaeb4d3b107e3376d9178a118185ce 100644 (file)
@@ -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;
index d311d551d51ced1d85fc3bee917c695f3a6a67a6..ba513025fe4e14415d2503029bd3df56a115a56b 100644 (file)
@@ -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);
     }
 }
index a7b89e8afae911ae8c862ecc747ed2b562cfdb2d..6292e24bb5d15e06f25fcf32ffb8e2a9af133df9 100644 (file)
@@ -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';