public $zindex = 4;
public $rightClone = false;
public $iframeType = "none";
+ public $border = 0;
+ public $borderColor = '#ffffff';
protected $_init;
}
}
+ public static function parseExtras($extras)
+ {
+ $extras = trim($extras);
+ if ($extras === '') {
+ return [];
+ }
+ $res = [];
+ $lines = CubeIT_Text::splitLines($extras);
+ foreach ($lines as $line) {
+ $e = explode('=', $line);
+ if (count($e) < 2) {
+ continue;
+ }
+ $v = trim($e[1]);
+ // Handle values surronded by quotes
+ if (preg_match('|^\"([^\"]+)\"$|', $v, $matches)) {
+ $v = $matches[1];
+ }
+ $res[trim($e[0])] = $v;
+ }
+
+ return $res;
+ }
+
+ public static function parseAnimation($animation)
+ {
+ $extras = self::parseExtras($animation);
+ if (count($extras) > 0) {
+ if (!isset($extras['direction'])) {
+ $extras['direction'] = 'right';
+ }
+ if ($extras['direction'] === 'top') {
+ $extras['direction'] = 'up';
+ }
+ if ($extras['direction'] === 'bottom') {
+ $extras['direction'] = 'down';
+ }
+ }
+ return $extras;
+ }
+
public static function replaceCustomURL($url)
{
$url = trim($url);
if ($k == 'extra') {
if (CubeIT_Util_Json::isJson($v)) {
$v = CubeIT_Util_Json::decode($v);
- } else if (stristr($v, '=')) {
+ } else if (stristr($v, '=') && stristr($v, '&')) {
$vv = $v;
$v = [];
parse_str($vv, $v);
$v = CubeIT_Util_Object::asObject($v);
+ } else {
+ $extras = self::parseExtras($v);
+ foreach ($extras as $extrak => $extrav) {
+ $this->$extrak = $extrav;
+ }
+ continue;
}
}
$this->$k = $v;
return $res;
}
- public static function parseAnimation($animation)
- {
- $animation = trim($animation);
- $variables = [];
- if ($animation != '') {
- $lines = CubeIT_Text::splitLines($animation);
- foreach ($lines as $line) {
- $e = explode('=', $line);
- if (count($e) < 2) {
- continue;
- }
- $v = trim($e[1]);
- // Handle values surronded by quotes
- if (preg_match('|^\"([^\"]+)\"$|', $v, $matches)) {
- $v = $matches[1];
- }
- $variables[trim($e[0])] = $v;
- }
- if (!isset($variables['direction'])) {
- $variables['direction'] = 'right';
- }
- if ($variables['direction'] == 'top') {
- $variables['direction'] = 'up';
- }
- if ($variables['direction'] == 'bottom') {
- $variables['direction'] = 'down';
- }
- }
- return $variables;
- }
-
public function getCSSZIndex()
{
if ($this->zindex === 0) {
'x' => round($this->left),
'y' => round($this->top),
'pdf' => $pdf,
+ 'border' => $this->border,
+ 'borderColor' => $this->borderColor,
];
return $res;
}
'width' => round($this->width),
'height' => round($this->height),
'x' => round($this->left),
- 'y' => round($this->top)
+ 'y' => round($this->top),
+ 'border' => $this->border,
+ 'borderColor' => $this->borderColor,
];
}
// The Poppler::extractArea function accepts a resolution setting and uses that to determine the
// scale factor on the extracted images. It does so by dividing by 72, so we can pass our own scale
// factor by setting the resolution to 72 * $maxzoom
- 'resolution' => 72 * $maxzoom
+ 'resolution' => 150 * $maxzoom
];
// Round all link co-ordinates because there seems to be a problem with the the Workshop link editor
$both = $leftfile;
}
+ if ($attributes['border'] > 0) {
+ $tmp = CubeIT_Files::tempnam() . '.jpg';
+ CubeIT_CommandLine_Imagemagick::addBorder($both, $tmp, $attributes['border'], $attributes['borderColor']);
+ $compiler->vdir->addTemp($both);
+ $both = $tmp;
+ }
+
$compiler->simpleCopyLinkFile($both, 'data/links/' . $save . '_' . $attributes['id'] . '.jpg');
// Perform tidy up and delete temporary files if they exist