use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
-use Illuminate\Queue\Jobs\Job;
use Illuminate\Queue\Jobs\SyncJob;
use Illuminate\Queue\SerializesModels;
use JsonException;
use stdClass;
-class Compiler implements ShouldQueue, ShouldBeUnique
+class Compiler implements ShouldQueue, ShouldBeUnique, CompilerInterface
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
}
+ public function addTriggersLink($page, $link)
+ {
+ // TODO: Implement addTriggersLink() method.
+ }
+
+ public function addAudiodescription($link)
+ {
+ // TODO: Implement addAudiodescription() method.
+ }
+
+ public function addBookmarkGroup($link)
+ {
+ // TODO: Implement addBookmarkGroup() method.
+ }
+
+ public function getConfigZIP($d)
+ {
+ // TODO: Implement getConfigZIP() method.
+ }
+
+ public function addContentLock($page, $unlockConditions = '')
+ {
+ // TODO: Implement addContentLock() method.
+ }
}
--- /dev/null
+<?php
+
+namespace Fluidbook\Tools\Compiler;
+
+interface CompilerInterface
+{
+ public function addContentLock($page, $unlockConditions = '');
+
+ public function addTriggersLink($page, $link);
+
+ public function addAudiodescription($link);
+
+ public function addBookmarkGroup($link);
+
+ public function getConfigZIP($d);
+}
--- /dev/null
+<?php
+
+namespace Fluidbook\Tools\Links;
+
+class CustomLink extends NormalLink
+{
+ protected $role = 'link';
+
+ public function getURL()
+ {
+ return static::_getURL($this->to);
+ }
+
+ protected static function _getURLOfType($type, $ref)
+ {
+ global $core;
+ $nospaceref = str_replace(' ', '', $ref);
+ $r = $core->con->select("SELECT * FROM wsref WHERE (ref='" . $core->con->escape($ref) . "' OR ref='" . $core->con->escape($nospaceref) . "') AND type='" . $core->con->escape($type) . "'");
+ if ($r->count()) {
+ return $r->url;
+ }
+ return 'https://workshop.fluidbook.com/services/wsref?ref=' . urlencode($type . '|' . $ref);
+ }
+
+
+ public function getTarget()
+ {
+ return '_blank';
+ }
+
+ public function getDefaultTooltip()
+ {
+ return 'click to open the link';
+ }
+
+ public static function getCustomInstance($id, $init, &$compiler)
+ {
+ $e = explode(':', $init['to']);
+ if ($e[0] == '10doigts') {
+ $init['to'] = self::_getURL($init['to']);
+ $init['iframeType'] = '10doigts';
+ $init['infobulle'] = 'Voir le produit';
+ return new IFramePopupLink($id, $init, $compiler);
+ }
+ return new CustomLink($id, $init, $compiler);
+ }
+
+ public static function _getURL($to)
+ {
+ $e = explode(':', $to, 2);
+ if (!count($e) == 1) {
+ return 'https://workshop.fluidbook.com/services/wsref?ref=' . urlencode($to);
+ }
+ $type = trim($e[0]);
+ $ref = trim($e[1]);
+ return self::_getURLOfType($type, $ref);
+ }
+}
use Cubist\Util\ArrayUtil;
use Cubist\Util\Crypt;
use Cubist\Util\CSS;
+use Cubist\Util\Files\Files;
use Cubist\Util\Json;
use Cubist\Util\ObjectUtil;
use Cubist\Util\Text;
use Cubist\Util\Xml;
use Fluidbook\Tools\Compiler\Compiler;
+use Fluidbook\Tools\Compiler\CompilerInterface;
use stdClass;
class Link
{
+ protected static string|false $_linksKey;
public $left;
public $top;
public $width;
*
* @param integer $id
* @param stdClass|array $init
- * @param Compiler $compiler
+ * @param CompilerInterface $compiler
* @return Link
*/
public static function getInstance($id, $init, &$compiler)
case 5:
return new InternalLink($id, $init, $compiler);
case 4:
-
$init['inline'] = self::normalizeInlineIntegration($init['inline']);
if ($init['inline'] === 'inline') {
$init['inline'] = 'inline';
$init['inline'] = 'background_texts';
return new VideoBackgroundLink($id, $init, $compiler);
}
-
+ case 7:
+ return CustomLink::getCustomInstance($id, $init, $compiler);
case 10:
$init['inline'] = self::normalizeInlineIntegration($init['inline']);
if ($init['inline'] === 'popup') {
return new WebVideoLink($id, $init, $compiler);
case 11:
return new ActionLink($id, $init, $compiler);
+ case 12: // Basket / Cart links
+ return new CartLink($id, $init, $compiler);
case 13: // zoom area
return new ZoomLink($id, $init, $compiler);
case 14:
}
$init['inline'] = self::normalizeInlineIntegration($init['inline']);
- $ext = mb_strtolower(files::getExtension($init['alternative']));
+ $ext = mb_strtolower(Files::getExtension($init['alternative']));
if (in_array($ext, array('oam', 'zip', 'html')) || substr($init['alternative'], 0, 4) == 'http') {
if ($init['inline'] === 'inline') {
$v = [];
parse_str($vv, $v);
$v = ObjectUtil::asObject($v);
- } else if (strpos($v, '=') !== false) {
+ } else if (str_contains($v, '=')) {
$extras = self::parseExtras($v);
foreach ($extras as $extrak => $extrav) {
$this->$extrak = $extrav;
{
if ($this->infobulle === null || !$this->infobulle) {
if ($this->getDefaultTooltip() === false) {
- return;
+ return '';
}
return '~' . $this->getDefaultTooltip();
}