From: Vincent Vanwaelscappel Date: Thu, 16 Sep 2021 14:10:45 +0000 (+0200) Subject: wip #4666 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=786b98509c44194e3e872cf87965a0b0d7cd06a5;p=fluidbook_tools.git wip #4666 @1 --- diff --git a/.idea/fluidbook_tools.iml b/.idea/fluidbook_tools.iml index 192d012..0ad947c 100644 --- a/.idea/fluidbook_tools.iml +++ b/.idea/fluidbook_tools.iml @@ -5,8 +5,6 @@ - - diff --git a/resources/tools/fwstk/bin/com/fluidbook/fwstk/CustomStripper.class b/resources/tools/fwstk/bin/com/fluidbook/fwstk/CustomStripper.class index 2046775..5448b33 100644 Binary files a/resources/tools/fwstk/bin/com/fluidbook/fwstk/CustomStripper.class and b/resources/tools/fwstk/bin/com/fluidbook/fwstk/CustomStripper.class differ diff --git a/resources/tools/fwstk/bin/com/fluidbook/fwstk/Link.class b/resources/tools/fwstk/bin/com/fluidbook/fwstk/Link.class index 774dc6d..b29d1b3 100644 Binary files a/resources/tools/fwstk/bin/com/fluidbook/fwstk/Link.class and b/resources/tools/fwstk/bin/com/fluidbook/fwstk/Link.class differ diff --git a/resources/tools/fwstk/bin/com/fluidbook/fwstk/Main.class b/resources/tools/fwstk/bin/com/fluidbook/fwstk/Main.class index 6a32137..b720a9c 100644 Binary files a/resources/tools/fwstk/bin/com/fluidbook/fwstk/Main.class and b/resources/tools/fwstk/bin/com/fluidbook/fwstk/Main.class differ diff --git a/resources/tools/fwstk/bin/com/fluidbook/fwstk/TextsThread.class b/resources/tools/fwstk/bin/com/fluidbook/fwstk/TextsThread.class index eda65a1..d207548 100644 Binary files a/resources/tools/fwstk/bin/com/fluidbook/fwstk/TextsThread.class and b/resources/tools/fwstk/bin/com/fluidbook/fwstk/TextsThread.class differ diff --git a/resources/tools/fwstk/bin/com/fluidbook/fwstk/Word.class b/resources/tools/fwstk/bin/com/fluidbook/fwstk/Word.class index 28597e7..7bcca85 100644 Binary files a/resources/tools/fwstk/bin/com/fluidbook/fwstk/Word.class and b/resources/tools/fwstk/bin/com/fluidbook/fwstk/Word.class differ diff --git a/resources/tools/fwstk/bin/com/fluidbook/fwstk/geom/CubeMatrix.class b/resources/tools/fwstk/bin/com/fluidbook/fwstk/geom/CubeMatrix.class index 36caf87..736ddf8 100644 Binary files a/resources/tools/fwstk/bin/com/fluidbook/fwstk/geom/CubeMatrix.class and b/resources/tools/fwstk/bin/com/fluidbook/fwstk/geom/CubeMatrix.class differ diff --git a/resources/tools/fwstk/bin/com/fluidbook/fwstk/geom/CubeRectangle.class b/resources/tools/fwstk/bin/com/fluidbook/fwstk/geom/CubeRectangle.class index d6f95c5..cb1138c 100644 Binary files a/resources/tools/fwstk/bin/com/fluidbook/fwstk/geom/CubeRectangle.class and b/resources/tools/fwstk/bin/com/fluidbook/fwstk/geom/CubeRectangle.class differ diff --git a/resources/tools/fwstk/bin/com/fluidbook/fwstk/geom/Point.class b/resources/tools/fwstk/bin/com/fluidbook/fwstk/geom/Point.class index a83392a..8d28e76 100644 Binary files a/resources/tools/fwstk/bin/com/fluidbook/fwstk/geom/Point.class and b/resources/tools/fwstk/bin/com/fluidbook/fwstk/geom/Point.class differ diff --git a/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Group.class b/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Group.class index a44092d..3437b08 100644 Binary files a/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Group.class and b/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Group.class differ diff --git a/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/LayoutElement.class b/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/LayoutElement.class index aa32469..1fbfee2 100644 Binary files a/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/LayoutElement.class and b/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/LayoutElement.class differ diff --git a/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/LayoutStripper.class b/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/LayoutStripper.class index 98e65a3..02bb84b 100644 Binary files a/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/LayoutStripper.class and b/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/LayoutStripper.class differ diff --git a/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Letter.class b/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Letter.class index 6258134..75841fa 100644 Binary files a/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Letter.class and b/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Letter.class differ diff --git a/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Line.class b/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Line.class index 4415f5c..b2b8dfb 100644 Binary files a/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Line.class and b/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Line.class differ diff --git a/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Page.class b/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Page.class index 054c1c3..8e89fe6 100644 Binary files a/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Page.class and b/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Page.class differ diff --git a/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Separator.class b/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Separator.class index 18ace2b..48e3a22 100644 Binary files a/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Separator.class and b/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Separator.class differ diff --git a/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Space.class b/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Space.class index e5a0d84..c05fd7c 100644 Binary files a/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Space.class and b/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Space.class differ diff --git a/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Word.class b/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Word.class index 4539d3b..06983f2 100644 Binary files a/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Word.class and b/resources/tools/fwstk/bin/com/fluidbook/fwstk/layout/Word.class differ diff --git a/resources/tools/fwstk/bin/cube/files/FileIO.class b/resources/tools/fwstk/bin/cube/files/FileIO.class index 85452f9..c2a4aaa 100644 Binary files a/resources/tools/fwstk/bin/cube/files/FileIO.class and b/resources/tools/fwstk/bin/cube/files/FileIO.class differ diff --git a/resources/tools/fwstk/bin/cube/util/Array.class b/resources/tools/fwstk/bin/cube/util/Array.class index 1d67ea6..0c55de6 100644 Binary files a/resources/tools/fwstk/bin/cube/util/Array.class and b/resources/tools/fwstk/bin/cube/util/Array.class differ diff --git a/resources/tools/fwstk/bin/cube/util/AsciiUtils.class b/resources/tools/fwstk/bin/cube/util/AsciiUtils.class index 21c8b7a..c28b8b3 100644 Binary files a/resources/tools/fwstk/bin/cube/util/AsciiUtils.class and b/resources/tools/fwstk/bin/cube/util/AsciiUtils.class differ diff --git a/resources/tools/fwstk/bin/cube/util/StringUtil.class b/resources/tools/fwstk/bin/cube/util/StringUtil.class index 16a9c9e..6f4f3df 100644 Binary files a/resources/tools/fwstk/bin/cube/util/StringUtil.class and b/resources/tools/fwstk/bin/cube/util/StringUtil.class differ diff --git a/resources/tools/fwstk/out/artifacts/fwstk_jar/fwstk.jar b/resources/tools/fwstk/out/artifacts/fwstk_jar/fwstk.jar index d7a9ba2..4f3447a 100644 Binary files a/resources/tools/fwstk/out/artifacts/fwstk_jar/fwstk.jar and b/resources/tools/fwstk/out/artifacts/fwstk_jar/fwstk.jar differ diff --git a/src/Compiler/Compiler.php b/src/Compiler/Compiler.php new file mode 100644 index 0000000..06478d3 --- /dev/null +++ b/src/Compiler/Compiler.php @@ -0,0 +1,79 @@ +job instanceof SyncJob); + if ($sync) { + PHP::neverStop(false); + } + + start_measure('Process Fluidbook'); + $this->processPages($sync); + $this->getTexts(); + $this->getLinks(); + $this->compileFluidbook(); + stop_measure('Process Fluidbook'); + } + + public function processPages($sync = false) + { + start_measure('Process Pages'); + $out = $this->getConvertPath(); + Files::mkdir($out); + $this->in->processPages($out, $this->getProcessFiles(), $sync); + stop_measure('Process Pages'); + } + + public function getConvertPath() + { + return storage_path('fluidbook/convert/' . $this->in->getHash() . '/'); + } + + public function getTexts() + { + start_measure('Process texts'); + $this->in->processTexts($this->getConvertPath()); + start_measure('Process texts'); + } + + +} diff --git a/src/Links/Link.php b/src/Links/Link.php new file mode 100644 index 0000000..7950bc9 --- /dev/null +++ b/src/Links/Link.php @@ -0,0 +1,675 @@ +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 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); + } + case 13: // zoom area + return new zoomLink($id, $init, $compiler); + case 14: + return new colorLink($id, $init, $compiler); + case 15: + if (stristr($init['to'], '.zip')) { + return new inlineSlideshowLink($id, $init, $compiler); + } + return new imageLink($id, $init, $compiler); + case 16: + 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 audioPopupLink($id, $init, $compiler); + case 18: + $init['inline'] = self::normalizeInlineIntegration($init['inline']); + if ($init['inline'] === 'inline') { + return new tooltipLink($id, $init, $compiler); + } + return new textPopupLink($id, $init, $compiler); + case 19: + break; + case 20: + $compiler->addBookmarkGroup($init); + break; + case 21: + case 6: + return self::getMultimediaInstance($id, $init, $compiler); + case 23: + return new statsTagLink($id, $init, $compiler); + case 24: + return new phoneLink($id, $init, $compiler); + case 25: + $compiler->addAudiodescription($init); + break; + case 26: + case 40: + return new anchorLink($id, $init, $compiler); + case 27: + return new eventOverlayLink($id, $init, $compiler); + case 29: + return new facebookLikeLink($id, $init, $compiler); + case 30: + 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 iframePopupLink($id, $init, $compiler); + case 32: + return new showLinkLink($id, $init, $compiler); + case 33: + return new zoomhdLink($id, $init, $compiler); + case 34: + $compiler->addContentLock($init['page'], $init['to']); + break; + case 35: + return new textLink($id, $init, $compiler); + case 36: + return new articleLink($id, $init, $compiler); + case 37: + 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); + } + break; + case 39: + return new layerLink($id, $init, $compiler); + default: + return null; + } + + + } + + public function getSurface() + { + return $this->width * $this->height; + } + + public static function normalizeInlineIntegration($inline) + { + if ($inline == '1' || $inline === 'true') { + return 'inline'; + + } else if (!$inline || $inline === 'false') { + return 'popup'; + } + return $inline; + } + + public static function parseExtras($extras, $normalizeKey = false) + { + $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]; + } + $k = trim($e[0]); + if ($normalizeKey) { + $k = mb_strtolower($k); + } + $res[$k] = $v; + } + + return $res; + } + + public static function parseAnimations($animations) + { + $anims = explode('---', $animations); + $res = []; + + foreach ($anims as $animation) { + $animation = trim($animation); + if (!$animation) { + continue; + } + $extras = self::parseExtras($animation, true); + 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'; + } + } + $res[] = $extras; + } + return $res; + } + + public static function replaceCustomURL($url) + { + $url = trim($url); + if (strpos($url, 'custom:') === 0) { + $e = explode(':', $url, 2); + return customLink::_getURL($e[1]); + } + + return $url; + } + + public static function getMultimediaInstance($id, $init, &$compiler) + { + if ($init['alternative'] == '') { + return null; + } + $init['inline'] = self::normalizeInlineIntegration($init['inline']); + + $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') { + return new htmlMultimediaLink($id, $init, $compiler); + } else { + return new htmlMultimediaPopupLink($id, $init, $compiler); + } + } else if (in_array($ext, array('gif', 'jpeg', 'jpg', 'png', 'svg'))) { + if ($init['inline'] === 'inline') { + return new htmlMultimediaImage($id, $init, $compiler); + } else { + return new htmlMultimediaPopupImage($id, $init, $compiler); + } + } + return null; + } + + public static function isScorm($linkData) + { + return (isset($linkData['scorm']) && $linkData['scorm']) || (self::_isScormLink($linkData['to']) || (isset($linkData['alternative']) && self::_isScormLink($linkData['alternative']))); + } + + protected static function _isScormLink($url) + { + if (strpos($url, 'http://') >= 0 || strpos($url, 'https://') > 0) { + return false; + } + return stristr($url, 'scorm'); + } + + public function __construct($id, $init, &$compiler) + { + $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) { + $vv = $v; + $v = []; + parse_str($vv, $v); + $v = CubeIT_Util_Object::asObject($v); + } else if (strpos($v, '=') !== false) { + $extras = self::parseExtras($v); + foreach ($extras as $extrak => $extrav) { + $this->$extrak = $extrav; + } + continue; + } + } + $this->$k = $v; + } + if (!$this->video_width) { + $this->video_width = $this->width; + } + if (!$this->video_height) { + $this->video_height = $this->height; + } + if ($this->target == '') { + $this->target = '_blank'; + } + + $this->id = $id; + $this->compiler = $compiler; + $this->wdir = $this->compiler->wdir; + $this->init(); + } + + /** + * @param int $initialOrder + */ + public function setInitialOrder(int $initialOrder): void + { + $this->initialOrder = $initialOrder; + } + + /** + * @return int + */ + public function getInitialOrder(): int + { + return $this->initialOrder; + } + + public function getDepth() + { + if ($this->zindex == -1 || null === $this->zindex || !$this->zindex) { + return $this->defaultZIndex; + } + if ($this->zindex < 10) { + return $this->zindex + $this->defaultZIndex; + } + return $this->zindex; + } + + public function getTooltipAttribute($t = null) + { + if (null === $t) { + $t = $this->getTooltip(); + } + if ($t !== false) { + $escaped = htmlspecialchars($t, ENT_QUOTES); + $tooltip = ' data-tooltip="' . $escaped . '"'; + $tooltip .= ' aria-label="' . $escaped . '"'; + return $tooltip; + } else { + return ''; + } + } + + public function overlapDoublePage() + { + // $this->page is normally an integer but it can also be a string (eg. background / aftersearch) + if (!is_int($this->page)) return false; + + return ($this->page % 2 == 0 && $this->left + $this->width > $this->compiler->width); + } + + public function getRightClone() + { + $res = clone $this; + $res->page++; + $res->left -= $this->compiler->width; + $res->rightClone = true; + $res->id .= '_c'; + $res->init(); + return $res; + } + + public function init() + { + + } + + public function getDefaultTooltip() + { + return false; + } + + public function getTooltip() + { + if ($this->infobulle === null || !$this->infobulle) { + if ($this->getDefaultTooltip() === false) { + return; + } + return '~' . $this->getDefaultTooltip(); + } + return $this->infobulle; + } + + public function getHTMLContainer() + { + $addContent = $this->getAdditionnalContent(); + return '
' . $this->getHTMLContent() . '
'; + } + + public function getHTMLContainerClass() + { + $res = trim('link ' . $this->class); + if ((int)$this->page % 2 == 1) { + $res .= ' odd'; + } + if ($this->rightClone) { + $res .= ' rightclone'; + } + + return $res; + } + + public function getHTMLContent() + { + return ''; + } + + public function getAdditionnalContent() + { + $res = ''; + if ($this->role !== '') { + $res .= ' role="' . $this->role . '"'; + } + if ($this->maxWidth > 0) { + $res .= ' data-max-width="' . $this->maxWidth . '"'; + } + if (!isset($this->popupClose)) { + $this->popupClose = 1; + } + $res .= ' data-popup-close="' . $this->popupClose . '"'; + if ($this->tooltipBackgroundColor) { + $res .= 'data-tooltip-background="' . $this->tooltipBackgroundColor . '" '; + } + if ($this->tooltipColor) { + $res .= 'data-tooltip-color="' . $this->tooltipColor . '" '; + } + + return $res; + + } + + public function getClasses() + { + + $res = array(); + if (isset($this->image_rollover) && $this->image_rollover != 'none') { + $res[] = 'image_rollover'; + } + return $res; + } + + public function copyExternalFile($file, $video = false) + { + $this->compiler->copyLinkFile($file, 'data/links/', $video); + } + + public function copyExternalDir($dir, $dest = 'data/links') + { + $this->compiler->copyLinkDir($dir, $dest); + } + + public function unzipFile($file, $moveAssets = false) + { + return $this->compiler->unzipFile($file, $moveAssets); + } + + public function getCssScale() + { + if (is_int($this->page)) { + return $this->compiler->getLinkScale(); + } else { + return 1; + } + } + + public function getCSSZIndex() + { + $zindex = $this->getAddZIndex() + (($this->getDepth() + 1) * 10000) - min(9999, max(1, round(9999 * (($this->width * $this->height) / $this->compiler->getBookSurface())))); + return 'z-index:' . $zindex . ';'; + } + + public function getAddZIndex() + { + return $this->addzindex; + } + + public function moveOnEvenPage() + { + return false; + } + + public function getCSSContainer() + { + if ($this->moveOnEvenPage()) { + $this->page--; + $this->left += $this->compiler->width; + } + + $css = '#l_' . $this->id . '{'; + $css .= 'left:' . round($this->left * $this->getCssScale()) . 'px;top:' . round($this->top * $this->getCssScale()) . 'px;'; + $css .= 'width:' . round($this->width * $this->getCssScale()) . 'px;height:' . round($this->height * $this->getCssScale()) . 'px;'; + $css .= $this->getCSSZIndex(); + $origin = false; + if ($this->rot) { + $css .= wsHTML5::writeCSSUA('transform', 'rotate(' . $this->rot . 'deg)'); + $origin = true; + } + if (isset($this->skewX)) { + $css .= wsHTML5::writeCSSUA('transform', 'skewX(' . $this->skewX . 'deg)'); + $origin = true; + } + if (isset($this->skew)) { + $css .= wsHTML5::writeCSSUA('transform', 'skew(' . $this->skew . ')'); + $origin = true; + } + + $css .= $this->getCSS(); + $css .= '}'; + return $css; + } + + public function getCSS() + { + return ''; + } + + public function keep() + { + return false; + } + + public static function getUniversalLocation($loc, $css = false) + { + $datas = parse_url($loc); + + if ((isset($datas['scheme']) && !is_null($datas['scheme'])) || strpos($loc, '#') === 0) { + + return $loc; + } else { + if ($css) { + return '../links/' . $loc; + } else { + return 'data/links/' . $loc; + } + } + } + + public function getConfigZIP($d) + { + return $this->compiler->getConfigZIP($d); + } + + public function getConfigHTML($d, $html) + { + $res = array('width' => $this->video_width, 'height' => $this->video_height); + $r = array('type' => 'html', 'html' => $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')); + $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); + + $props = array('default-width' => 'width', 'default-height' => 'height', 'html-page' => 'html'); + + + $res = array('type' => 'oam', 'inject' => array(), 'injectcss' => array(), 'injectjs' => array(), 'content' => trim($c->content), 'name' => $c->_name, 'assets' => array()); + foreach ($c->properties->property as $p) { + if (isset($props[$p->_name])) { + $res[$props[$p->_name]] = $p->_defaultValue; + } + } + foreach ($c->require as $r) { + if ($r->_type == 'folder') { + continue; + } + $res['assets'][] = $r->_src; + } + return $res; + } + +}