/** * */ protected function cleanItemParams() { foreach ($this->items as $item_id => &$item) { $item->setPrimaryImage($this->setupImage($item, 'features_image_default', 'features_image_default_custom', 'features_item_image')); $item->setPrimaryLink($this->setupLink($item, 'features_link_default', 'features_link_default_custom', 'features_item_link')); $item->setTitle($this->setupText($item, 'features_title_default', false, 'features_item_title')); $item->setText($this->setupText($item, 'features_description_default', false, 'features_item_description')); // clean from tags and limit words amount $desc = $item->getText(); if ($this->parameters->get('features_strip_html_tags', true)) { $desc = strip_tags($desc); } $words_amount = $this->parameters->get('features_previews_length', false); if ($words_amount === '∞' || $words_amount == '0') { $words_amount = false; } $htmlmanip = new RokSprocket_Util_HTMLManipulator(); $preview = $htmlmanip->truncateHTML($desc, $words_amount); $append = strlen($desc) != strlen($preview) ? '<span class="roksprocket-ellipsis">…</span>' : ""; $item->setText($preview . $append); // resizing images if needed if ($item->getPrimaryImage() && $this->parameters->get('features_resize_enable', false)) { $width = $this->parameters->get('features_resize_width', 0); $height = $this->parameters->get('features_resize_height', 0); $item->getPrimaryImage()->resize($width, $height); } } }
/** * */ protected function cleanItemParams() { foreach ($this->items as $item_id => &$item) { $item->setPrimaryImage($this->setupImage($item, 'mosaic_image_default', 'mosaic_image_default_custom', 'mosaic_item_image')); $item->setPrimaryLink($this->setupLink($item, 'mosaic_link_default', 'mosaic_link_default_custom', 'mosaic_item_link')); $item->setTitle($this->setupText($item, 'mosaic_title_default', 'mosaic_title_default_custom', 'mosaic_item_title')); $item->setText($this->setupText($item, 'mosaic_description_default', 'mosaic_description_default_custom', 'mosaic_item_description')); $item->setTags($this->filterTags($this->setupTags($item, 'mosaic_item_tags'))); // clean from tags and limit words amount $desc = $item->getText(); if ($this->parameters->get('mosaic_strip_html_tags', true)) { $desc = strip_tags($desc); } $words_amount = $this->parameters->get('mosaic_previews_length', 20); if ($words_amount === '∞' || $words_amount == '0') { $words_amount = false; } $htmlmanip = new RokSprocket_Util_HTMLManipulator(); $preview = $htmlmanip->truncateHTML($desc, $words_amount); $append = strlen($desc) != strlen($preview) ? '<span class="roksprocket-ellipsis">…</span>' : ""; $item->setText($preview . $append); // resizing images if needed if ($item->getPrimaryImage()) { if ($this->parameters->get('mosaic_resize_enable', false)) { $width = $this->parameters->get('mosaic_resize_width', 0); $height = $this->parameters->get('mosaic_resize_height', 0); $item->getPrimaryImage()->resize($width, $height); } /** @var RokCommon_PlatformInfo $platforminfo */ $platforminfo = $this->container->platforminfo; $urlbase = $platforminfo->getUrlBase() ? $platforminfo->getUrlBase() : '/'; if (!$platforminfo->isLinkexternal($item->getPrimaryImage()->getSource()) && strpos($item->getPrimaryImage()->getSource(), '/') !== 0 && strpos($item->getPrimaryImage()->getSource(), $urlbase) !== 0) { $source = rtrim($urlbase, '/') . '/' . $item->getPrimaryImage()->getSource(); $item->getPrimaryImage()->setSource($source); } } // ordering $item->custom_ordering_items = '<div style="display: none;" data-mosaic-order-title="' . $item->getTitle() . '" data-mosaic-order-date="' . $item->getDate() . '"></div>'; // tagging $item->custom_tags = ""; $item->custom_tags_list = array(); foreach ($this->filterTags($item->getTags()) as $key => $name) { $item->custom_tags .= " sprocket-tags-" . $key; $item->custom_tags_list[$key] = $name; if (!array_key_exists($key, $this->tagging)) { $this->tagging[$key] = $name; } } $item->custom_tags = trim($item->custom_tags); natcasesort($item->custom_tags_list); } // sort the tags for display natcasesort($this->tagging); // add the all $this->tagging = array('all' => rc__('ALL')) + $this->tagging; }
/** * */ protected function cleanItemParams() { foreach ($this->items as $item_id => &$item) { $item->setPrimaryImage($this->setupImage($item, 'lists_image_default', 'lists_image_default_custom', 'lists_item_image')); $item->setPrimaryLink($this->setupLink($item, 'lists_link_default', 'lists_link_default_custom', 'lists_item_link')); $item->setTitle($this->setupText($item, 'lists_title_default', false, 'lists_item_title')); $item->setText($this->setupText($item, 'lists_description_default', false, 'lists_item_description')); // clean for accordion/non-accordion mode $empty_title = !$item->getTitle() || !strlen($item->getTitle()); if ($empty_title) { $item->setTitle(' '); } $item->custom_can_show_title = 1; $item->custom_can_have_link = 0; if (!$this->parameters->get('lists_enable_accordion')) { if ($empty_title) { $item->custom_can_show_title = 0; } } if (!$this->parameters->get('lists_enable_accordion') && $item->getPrimaryLink()) { $item->custom_can_have_link = 1; } // clean from tags and limit words amount $desc = $item->getText(); if ($this->parameters->get('lists_strip_html_tags', true)) { $desc = strip_tags($desc); } $words_amount = $this->parameters->get('lists_previews_length', 20); if ($words_amount === '∞' || $words_amount == '0') { $words_amount = false; } $htmlmanip = new RokSprocket_Util_HTMLManipulator(); $preview = $htmlmanip->truncateHTML($desc, $words_amount); $append = strlen($desc) != strlen($preview) ? '<span class="roksprocket-ellipsis">…</span>' : ""; $item->setText($preview . $append); // resizing images if needed if ($item->getPrimaryImage()) { if ($this->parameters->get('lists_resize_enable', false)) { $width = $this->parameters->get('lists_resize_width', 0); $height = $this->parameters->get('lists_resize_height', 0); $item->getPrimaryImage()->resize($width, $height); } /** @var RokCommon_PlatformInfo $platforminfo */ $platforminfo = $this->container->platforminfo; $urlbase = $platforminfo->getUrlBase() ? $platforminfo->getUrlBase() : '/'; if (!$platforminfo->isLinkexternal($item->getPrimaryImage()->getSource()) && strpos($item->getPrimaryImage()->getSource(), '/') !== 0 && strpos($item->getPrimaryImage()->getSource(), $urlbase) !== 0) { $source = rtrim($urlbase, '/') . '/' . $item->getPrimaryImage()->getSource(); $item->getPrimaryImage()->setSource($source); } } } }
/** * */ protected function cleanItemParams() { $this->tagging['all'] = rc__('ALL'); foreach ($this->items as $item_id => &$item) { $item->setPrimaryImage($this->setupImage($item, 'mosaic_image_default', 'mosaic_image_default_custom', 'mosaic_item_image')); $item->setPrimaryLink($this->setupLink($item, 'mosaic_link_default', 'mosaic_link_default_custom', 'mosaic_item_link')); $item->setTitle($this->setupText($item, 'mosaic_title_default', 'mosaic_title_default_custom', 'mosaic_item_title')); $item->setText($this->setupText($item, 'mosaic_description_default', 'mosaic_description_default_custom', 'mosaic_item_description')); // clean from tags and limit words amount $desc = $item->getText(); if ($this->parameters->get('mosaic_strip_html_tags', true)) { $desc = strip_tags($desc); } $words_amount = $this->parameters->get('mosaic_previews_length', 20); if ($words_amount === '∞' || $words_amount == '0') { $words_amount = false; } $htmlmanip = new RokSprocket_Util_HTMLManipulator(); $preview = $htmlmanip->truncateHTML($desc, $words_amount); $append = strlen($desc) != strlen($preview) ? '<span class="roksprocket-ellipsis">…</span>' : ""; $item->setText($preview . $append); // resizing images if needed if ($item->getPrimaryImage() && $this->parameters->get('mosaic_resize_enable', false)) { $width = $this->parameters->get('mosaic_resize_width', 0); $height = $this->parameters->get('mosaic_resize_height', 0); $item->getPrimaryImage()->resize($width, $height); } // ordering $item->custom_ordering_items = '<div style="display: none;" data-mosaic-order-title="' . $item->getTitle() . '" data-mosaic-order-date="' . $item->getDate() . '"></div>'; // tagging $tags = $item->getParam('mosaic_item_tags', false); $tags = $tags ? explode(",", $tags) : array(); $item->custom_tags = ""; $item->custom_tags_list = array(); foreach ($tags as $tag) { $cleanName = trim($tag); $key = str_replace(' ', '-', str_replace(array("'", '"'), '', $cleanName)); $name = $this->_camelize($cleanName, true, true); $item->custom_tags .= " sprocket-tags-" . $key; $item->custom_tags_list[$key] = $name; if (!array_key_exists($key, $this->tagging)) { $this->tagging[$key] = $name; } } $item->custom_tags = trim($item->custom_tags); } }