From: vincent@cubedesigners.com Date: Fri, 29 Oct 2021 09:48:05 +0000 (+0000) Subject: wait #4686 @1.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=c541f10b46ff83ec1b19e05e4e6331ad108fa1f6;p=cubeextranet.git wait #4686 @1.5 --- diff --git a/inc/ws/Util/html5/master/class.ws.html5.links.php b/inc/ws/Util/html5/master/class.ws.html5.links.php index 0a2ff9585..1c1a351e0 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.links.php +++ b/inc/ws/Util/html5/master/class.ws.html5.links.php @@ -91,7 +91,7 @@ class wsHTML5Link break; } if (isset($url)) { - $fname = commonTools::_youtubedl($url); + $fname = commonTools::_youtubedl($url, true); $file = '/data/extranet/www/cache/youtubedl/' . $fname; } if (isset($file) && file_exists($file)) { @@ -364,7 +364,7 @@ class wsHTML5Link $ext = mb_strtolower(files::getExtension($init['alternative'])); - if (in_array($ext, array('oam', 'zip', 'html')) || substr($init['alternative'], 0, 4) == 'http') { + if (in_array($ext, array('oam', 'zip', 'html', 'json')) || substr($init['alternative'], 0, 4) == 'http') { if ($init['inline'] === 'inline') { return new htmlMultimediaLink($id, $init, $compiler); } else { @@ -684,6 +684,24 @@ class wsHTML5Link return array_merge($res, $r); } + public function getConfigLottieJSON($d, $json) + { + $a = json_decode($json); + if (!file_exists($d)) { + mkdir($d, 0777, true); + } + + copy('https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js', $d . '/lottie-player.js'); + $htmlContent = ''; + file_put_contents($d . '/index.html', $htmlContent); + file_put_contents($d . '/animation.json', $json); + + $res = array('width' => $a->w, 'height' => $a->h); + $r = array('type' => 'html', 'html' => 'index.html', 'inject' => array(), 'injectcss' => array(), 'injectjs' => array()); + + return array_merge($res, $r); + } + public function getConfigOAM($d) { $x = simplexml_load_string(file_get_contents($d . '/config.xml')); @@ -1906,10 +1924,16 @@ class htmlMultimediaLink extends wsHTML5Link $dir = $fdir; $d = array('fdir' => $fdir, 'dir' => $dir); - $file = $this->compiler->wdir . '/' . $this->alternative; - $this->compiler->vdir->copy($this->compiler->wdir . '/' . $this->alternative, $d['dir'] . '/' . $this->alternative); $this->_config = $this->getConfigHTML($d['dir'], $this->alternative); + $this->compiler->vdir->copy($this->compiler->wdir . '/' . $this->alternative, $d['dir'] . '/' . $this->alternative); $this->copyExternalFile($d['dir'] . '/' . $this->alternative); + } else if ($ext === 'json') { + $basename = CubeIT_Text::str2URL(str_replace('.json', '', $this->alternative)); + $file = $this->compiler->wdir . '/' . $this->alternative; + $d = ['fdir' => 'data/links/' . $basename]; + $dir = $this->wdir . '/' . $basename; + $this->_config = $this->getConfigLottieJSON($dir, file_get_contents($file)); + $this->copyExternalDir($dir, $d['fdir']); } if (substr($this->alternative, 0, 4) == 'http') { $this->_url = $this->_externalIframe = $this->alternative;