namespace Fluidbook\Tools\Links;
+use Cubist\Util\CSS;
use Cubist\Util\Files\Files;
+use Cubist\Util\Json;
class HTMLMultimediaLink extends Link
{
$infos = ['path' => 'data/links/' . str_replace('.', '_', $this->alternative) . '/'];
$i = str_replace('$id', '"#l_' . $this->id . '"', $i);
$i = str_replace('$path', '"' . $infos['path'] . '"', $i);
- $i = str_replace('$init', CubeIT_Util_Json::encode($infos), $i);
+ $i = str_replace('$init', Json::encode($infos), $i);
// Key the array with the ID so we don't get duplicates even when this function is called multiple times
$this->compiler->HTMLMultimedia[$this->id] = $i;
}
$css .= $this->getCSS();
$css .= '}';
if ($this->_externalIframe !== false && $this->in_popup) {
- $css .= '#l_' . $this->id . '>iframe{' . wsHTML5::writeCSSUA('transform', 'scale(' . $this->getCssScale() . ')') . '}';
+ $css .= '#l_' . $this->id . '>iframe{' . CSS::writeCSSUA('transform', 'scale(' . $this->getCssScale() . ')') . '}';
}
if ($this->_config['type'] === 'oam') {
if ($this->compiler->book->parametres->OAMChromeFactor != 1) {
$css .= '.chrome #l_' . $this->id . '{';
$css .= 'width:' . ($this->_config['width'] * $this->compiler->book->parametres->OAMChromeFactor) . 'px;height:' . ($this->_config['height'] * $this->compiler->book->parametres->OAMChromeFactor) . 'px;';
- $css .= wsHTML5::writeCSSUA('transform', 'scale(' . ($sx / $this->compiler->book->parametres->OAMChromeFactor) . ',' . ($sy / $this->compiler->book->parametres->OAMChromeFactor) . ')');
+ $css .= CSS::writeCSSUA('transform', 'scale(' . ($sx / $this->compiler->book->parametres->OAMChromeFactor) . ',' . ($sy / $this->compiler->book->parametres->OAMChromeFactor) . ')');
$css .= '}';
}
if ($this->compiler->book->parametres->OAMIEFactor != 1) {
$css .= '.msie #l_' . $this->id . '{';
$css .= 'width:' . ($this->_config['width'] * $this->compiler->book->parametres->OAMIEFactor) . 'px;height:' . ($this->_config['height'] * $this->compiler->book->parametres->OAMIEFactor) . 'px;';
- $css .= wsHTML5::writeCSSUA('transform', 'scale(' . ($sx / $this->compiler->book->parametres->OAMIEFactor) . ',' . ($sy / $this->compiler->book->parametres->OAMIEFactor) . ')');
+ $css .= CSS::writeCSSUA('transform', 'scale(' . ($sx / $this->compiler->book->parametres->OAMIEFactor) . ',' . ($sy / $this->compiler->book->parametres->OAMIEFactor) . ')');
$css .= '}';
}
$sx = ($this->width / ($this->_config['width'])) * $this->getCssScale();
$sy = ($this->height / ($this->_config['height'])) * $this->getCssScale();
- $res = wsHTML5::writeCSSUA('transform', 'scale(' . $sx . ',' . $sy . ')');
- $res .= wsHTML5::writeCSSUA('transform-origin', '0% 0%');
+ $res = CSS::writeCSSUA('transform', 'scale(' . $sx . ',' . $sy . ')');
+ $res .= CSS::writeCSSUA('transform-origin', '0% 0%');
if (!$this->_config['html']) {
return '';
namespace Fluidbook\Tools\Links;
use Cubist\Util\ArrayUtil;
+use Cubist\Util\CSS;
+use Cubist\Util\Json;
+use Cubist\Util\ObjectUtil;
+use Cubist\Util\Text;
+use Cubist\Util\Xml;
class Link
{
switch ($init['type']) {
case 1:
case 2:
- return new webLink($id, $init, $compiler);
+ return new WebLink($id, $init, $compiler);
case 3:
- return new mailLink($id, $init, $compiler);
+ return new MailLink($id, $init, $compiler);
case 5:
- return new internalLink($id, $init, $compiler);
+ return new InternalLink($id, $init, $compiler);
case 4:
$init['inline'] = self::normalizeInlineIntegration($init['inline']);
if ($init['inline'] === 'inline') {
$init['inline'] = 'inline';
- return new videoLink($id, $init, $compiler);
+ return new VideoLink($id, $init, $compiler);
} else if ($init['inline'] === 'popup') {
$init['inline'] = 'popup';
- return new videoPopupLink($id, $init, $compiler);
+ return new VideoPopupLink($id, $init, $compiler);
} else if ($init['inline'] === 'background_texts') {
$init['inline'] = 'background_texts';
- return new videoBackgroundLink($id, $init, $compiler);
+ return new VideoBackgroundLink($id, $init, $compiler);
}
- case 7:
- if ($compiler->book->parametres->basketManager === 'Puma') {
- return new pumaCartLink($id, $init, $compiler);
- }
- if ($compiler->book->parametres->basketManager === 'MIF') {
- return new cartLink($id, $init, $compiler);
- }
- switch ($compiler->book->parametres->customLinkClass) {
- case 'WescoLink':
- return new wescoLink($id, $init, $compiler);
- case 'HaguenauManifLink':
- return new haguenauManifLink($id, $init, $compiler);
- case 'FLFLink':
- return new flfLink($id, $init, $compiler);
- case 'InpesPopinLink':
- return new inpesPopinLink($id, $init, $compiler);
- case 'PierronLink':
- return new pierronLink($id, $init, $compiler);
- case 'WescoSalesLink':
- return new wescoSalesLink($id, $init, $compiler);
- case 'AtlanticDownloadLink':
- return new atlanticDownloadLink($id, $init, $compiler);
- case 'MiraklEaster2021':
- return new miraklEaster2021Link($id, $init, $compiler);
- default :
- return customLink::getCustomInstance($id, $init, $compiler);
- }
- case 8:
- case 9:
- return null;
case 10:
$init['inline'] = self::normalizeInlineIntegration($init['inline']);
if ($init['inline'] === 'popup') {
- return new webVideoPopupLink($id, $init, $compiler);
+ return new WebVideoPopupLink($id, $init, $compiler);
}
- return new webVideoLink($id, $init, $compiler);
+ return new WebVideoLink($id, $init, $compiler);
case 11:
- return new actionLink($id, $init, $compiler);
- case 12:
- if ($compiler->book->parametres->basketManager === 'Puma' || $compiler->book->parametres->basketManager === 'MIF' || $compiler->book->parametres->basketManager === 'Flexipan') {
- return new zoomProductLink($id, $init, $compiler);
- }
- if ($compiler->book->parametres->product_zoom_references !== '') {
- return new zoomProductLink($id, $init, $compiler);
- }
- switch ($compiler->book->parametres->basketManager) {
- case 'GrandVision':
- return new grandVisionCartLink($id, $init, $compiler);
- case 'JoueclubWishlist':
- return new JoueclubWishlistLink($id, $init, $compiler);
- case 'Remarkable':
- return new remarkableCartLink($id, $init, $compiler);
- case 'ZoomProductLink':
- return new zoomProductLink($id, $init, $compiler);
- default :
- return new cartLink($id, $init, $compiler);
- }
+ return new ActionLink($id, $init, $compiler);
case 13: // zoom area
- return new zoomLink($id, $init, $compiler);
+ return new ZoomLink($id, $init, $compiler);
case 14:
- return new colorLink($id, $init, $compiler);
+ return new ColorLink($id, $init, $compiler);
case 15:
if (stristr($init['to'], '.zip')) {
- return new inlineSlideshowLink($id, $init, $compiler);
+ return new InlineSlideshowLink($id, $init, $compiler);
}
- return new imageLink($id, $init, $compiler);
+ return new ImageLink($id, $init, $compiler);
case 16:
- return new fileLink($id, $init, $compiler);
+ return new FileLink($id, $init, $compiler);
case 17:
$init['inline'] = self::normalizeInlineIntegration($init['inline']);
if ($init['inline'] === 'inline') {
- return new audioLink($id, $init, $compiler);
+ return new AudioLink($id, $init, $compiler);
}
- return new audioPopupLink($id, $init, $compiler);
+ return new AudioPopupLink($id, $init, $compiler);
case 18:
$init['inline'] = self::normalizeInlineIntegration($init['inline']);
if ($init['inline'] === 'inline') {
- return new tooltipLink($id, $init, $compiler);
+ return new TooltipLink($id, $init, $compiler);
}
- return new textPopupLink($id, $init, $compiler);
+ return new TextPopupLink($id, $init, $compiler);
case 19:
break;
case 20:
case 6:
return self::getMultimediaInstance($id, $init, $compiler);
case 23:
- return new statsTagLink($id, $init, $compiler);
+ return new StatsTagLink($id, $init, $compiler);
case 24:
- return new phoneLink($id, $init, $compiler);
+ return new PhoneLink($id, $init, $compiler);
case 25:
$compiler->addAudiodescription($init);
break;
case 26:
case 40:
- return new anchorLink($id, $init, $compiler);
+ return new AnchorLink($id, $init, $compiler);
case 27:
- return new eventOverlayLink($id, $init, $compiler);
+ return new EventOverlayLink($id, $init, $compiler);
case 29:
- return new facebookLikeLink($id, $init, $compiler);
+ return new FacebookLikeLink($id, $init, $compiler);
case 30:
- return new slideshowLink($id, $init, $compiler);
+ return new SlideshowLink($id, $init, $compiler);
case 31:
$init['inline'] = self::normalizeInlineIntegration($init['inline']);
if ($init['inline'] === 'inline') {
- return new iframeLink($id, $init, $compiler);
+ return new IFrameLink($id, $init, $compiler);
}
- return new iframePopupLink($id, $init, $compiler);
+ return new IFramePopupLink($id, $init, $compiler);
case 32:
- return new showLinkLink($id, $init, $compiler);
+ return new ShowLinkLink($id, $init, $compiler);
case 33:
- return new zoomhdLink($id, $init, $compiler);
+ return new ZoomHDLink($id, $init, $compiler);
case 34:
$compiler->addContentLock($init['page'], $init['to']);
break;
case 35:
- return new textLink($id, $init, $compiler);
+ return new TextLink($id, $init, $compiler);
case 36:
- return new articleLink($id, $init, $compiler);
+ return new ArticleLink($id, $init, $compiler);
case 37:
- return new downloadPortionLink($id, $init, $compiler);
+ return new DownloadPortionLink($id, $init, $compiler);
case 38:
if ($init['target'] != 'click') {
$compiler->addTriggersLink($init['page'], $init['to']);
} else {
- return new triggerLink($id, $init, $compiler);
+ return new TriggerLink($id, $init, $compiler);
}
break;
case 39:
- return new layerLink($id, $init, $compiler);
+ return new LayerLink($id, $init, $compiler);
default:
return null;
}
return [];
}
$res = [];
- $lines = CubeIT_Text::splitLines($extras);
+ $lines = Text::splitLines($extras);
foreach ($lines as $line) {
$e = explode('=', $line);
if (count($e) < 2) {
$this->_init = $init;
foreach ($init as $k => $v) {
if ($k == 'extra') {
- if (CubeIT_Util_Json::isJson($v)) {
- $v = CubeIT_Util_Json::decode($v);
- } else if (strpos($v, '=') !== false && strpos($v, '&') !== false) {
+ if (Json::isJson($v)) {
+ $v = Json::decode($v);
+ } else if (str_contains($v, '=') && str_contains($v, '&')) {
$vv = $v;
$v = [];
parse_str($vv, $v);
- $v = CubeIT_Util_Object::asObject($v);
+ $v = ObjectUtil::asObject($v);
} else if (strpos($v, '=') !== false) {
$extras = self::parseExtras($v);
foreach ($extras as $extrak => $extrav) {
$css .= $this->getCSSZIndex();
$origin = false;
if ($this->rot) {
- $css .= wsHTML5::writeCSSUA('transform', 'rotate(' . $this->rot . 'deg)');
+ $css .= CSS::writeCSSUA('transform', 'rotate(' . $this->rot . 'deg)');
$origin = true;
}
if (isset($this->skewX)) {
- $css .= wsHTML5::writeCSSUA('transform', 'skewX(' . $this->skewX . 'deg)');
+ $css .= CSS::writeCSSUA('transform', 'skewX(' . $this->skewX . 'deg)');
$origin = true;
}
if (isset($this->skew)) {
- $css .= wsHTML5::writeCSSUA('transform', 'skew(' . $this->skew . ')');
+ $css .= CSS::writeCSSUA('transform', 'skew(' . $this->skew . ')');
$origin = true;
}
$config = (string)$x->oamfile['src'];
$config = str_replace('/Assets', '', $d . '/' . $config);
$x = simplexml_load_string(file_get_contents($config), 'SimpleXMLElement', LIBXML_NOCDATA);
- $c = CubeIT_Util_Xml::toObject($x);
+ $c = Xml::toObject($x);
$props = array('default-width' => 'width', 'default-height' => 'height', 'html-page' => 'html');
namespace Fluidbook\Tools\Links;
+use Cubist\Util\CommandLine\Imagemagick;
use Cubist\Util\Files\Files;
+use Cubist\Util\Graphics\PDF;
use Cubist\Util\Text;
class ZoomLink extends NormalLink
$this->_groups = [];
$groups = explode(',', $this->group);
foreach ($groups as $group) {
- $this->_groups[] = CubeIT_Text::str2URL(trim($group));
+ $this->_groups[] = Text::str2URL(trim($group));
}
}
return $this->_groups;
$extractPage = $attributes['page'];
}
- $left = CubeIT_Files::tempnam();
- $leftfile = CubeIT_CommandLine_Poppler::extractArea($pdfpath,
+ $left = Files::tempnam();
+ $leftfile = PDF::extractArea($pdfpath,
$extractPage,
array('x' => $x, 'y' => $y, 'width' => $w, 'height' => $h),
- $left, $extractOptions, WS_CACHE . '/' . $cachedir . '/' . $compiler->book_id . '/');
+ $left, $extractOptions, storage_path('cache/' . $cachedir . '/' . $compiler->book_id . '/'));
if (($x + $w) > $bookwidth) {
if (!isset($attributes['pdf']) || !$attributes['pdf']) {
}
$diff = ($w + $x) - $bookwidth;
- $right = CubeIT_Files::tempnam();
- $rightfile = CubeIT_CommandLine_Poppler::extractArea($pdfpath,
+ $right = Files::tempnam();
+ $rightfile = PDF::extractArea($pdfpath,
$extractPage,
array('x' => 0, 'y' => $y, 'width' => $diff, 'height' => $h),
- $right, $extractOptions, WS_CACHE . '/' . $cachedir . '/' . $compiler->book_id . '/');
+ $right, $extractOptions, storage_path('cache/' . $cachedir . '/' . $compiler->book_id . '/'));
if (!file_exists($rightfile)) {
die('Error generating right part ' . $rightfile);
}
- $both = CubeIT_Files::tempnam() . '.jpg';
- CubeIT_CommandLine_Imagemagick::append(array($leftfile, $rightfile), $both, 'horizontal');
+ $both = Files::tempnam() . '.jpg';
+ Imagemagick::append(array($leftfile, $rightfile), $both, 'horizontal');
if (!file_exists($both)) {
die('Error glueing ' . $leftfile . ' and ' . $rightfile);
}
if (isset($attributes['border']) && $attributes['border'] > 0) {
$tmp = Files::tempnam() . '.jpg';
- CubeIT_CommandLine_Imagemagick::addBorder($both, $tmp, $attributes['border'], $attributes['borderColor']);
+ Imagemagick::addBorder($both, $tmp, $attributes['border'], $attributes['borderColor']);
$compiler->vdir->addTemp($both);
$both = $tmp;
}