/** * @param $raw_item * @param int $dborder * * @return \RokSprocket_Item */ protected function convertRawToItem($raw_item, $dborder = 0) { $item = new RokSprocket_Item(); $item->setProvider($this->provider_name); $item->setId($raw_item->post_id); $item->setAlias($raw_item->post_name); $item->setAuthor($raw_item->display_name ? $raw_item->display_name : $raw_item->user_nicename); $item->setTitle($raw_item->post_title); $item->setDate($raw_item->post_date); $item->setPublished($raw_item->post_status == "publish" ? true : false); $text = apply_filters('widget_text', empty($raw_item->post_content) ? '' : $raw_item->post_content); $item->setText(strip_shortcodes($text)); $item->setCategory($raw_item->categories); $item->setHits(null); $item->setRating(null); $item->setMetaKey(null); $item->setMetaDesc(null); $item->setMetaData(null); //Set up texts array $texts = array(); $texts['text_post_content'] = $raw_item->post_content; $texts['text_post_excerpt'] = $raw_item->post_excerpt; $texts['text_post_title'] = $raw_item->post_title; $texts = $this->processPlugins($texts); $item->setTextFields($texts); //set up images array $images = array(); if (isset($raw_item->thumbnail_id) && !empty($raw_item->thumbnail_id)) { $image = new RokSprocket_Item_Image(); $image->setSource(wp_get_attachment_url($raw_item->thumbnail_id)); $image->setIdentifier('image_thumbnail'); if (isset($raw_item->image_intro_caption)) { $image->setCaption($raw_item->image_intro_caption); } if (isset($raw_item->image_intro_alt)) { $image->setAlttext($raw_item->image_intro_alt); } $images[$image->getIdentifier()] = $image; } $item->setImages($images); if (isset($images['image_thumbnail'])) { $item->setPrimaryImage($images['image_thumbnail']); } //set up links array $links = array(); $item->setLinks($links); $primary_link = new RokSprocket_Item_Link(); $primary_link->setUrl(get_permalink($raw_item->post_id)); $primary_link->getIdentifier('article_link'); $item->setPrimaryLink($primary_link); $item->setCommentCount($raw_item->comment_count); if (!empty($raw_item->tags)) { $item->setTags($raw_item->tags); } $item->setDbOrder($dborder); return $item; }
/** * @param Element $element * * @return RokSprocket_Item_Image */ public function getAsSprocketImage(Element $element) { $image_field_data = $this->getValue($element, true); $image = new RokSprocket_Item_Image(); $image->setIdentifier('image_field_' . $element->identifier); if (isset($image_field_data['file']) && !is_array($image_field_data['file'])) { $image->setSource(JUri::base(false) . $image_field_data['file']); } $image->setCaption(isset($image_field_data['title']) && !is_array($image_field_data['title']) ? $image_field_data['title'] : ''); $image->setAlttext(isset($image_field_data['title']) && !is_array($image_field_data['title']) ? $image_field_data['title'] : ''); return $image; }
/** * @param $raw_item * @param int $dborder * * @return \RokSprocket_Item */ protected function convertRawToItem($raw_item, $dborder = 0) { $app_type = $this->params->get('zoo_application_type'); //$textfield = $this->params->get('zoo_articletext_field', ''); $item = new RokSprocket_Item(); $item->setProvider($this->provider_name); $item->setId($raw_item->id); $item->setAlias($raw_item->alias); $item->setAuthor($raw_item->author_name); $item->setTitle($raw_item->title); $item->setDate($raw_item->created); $item->setPublished($raw_item->published == 1 ? true : false); $item->setCategory($raw_item->category_title); $item->setHits($raw_item->hits); $item->setRating($raw_item->rating); $item->setMetaKey(''); $item->setMetaDesc(''); $item->setMetaData(''); require_once JPATH_ADMINISTRATOR . '/components/com_zoo/config.php'; $app = App::getInstance('zoo'); $applications = $app->application->getApplications(); $application = $applications[$raw_item->application_id]; $text_ids = array(); $image_ids = array(); $link_ids = array(); $types = $application->getTypes(); foreach ($types as $type) { $elements = $type->getElements(); foreach ($elements as $element) { if ($element->config->type == 'image') { $image_ids[] = $element->identifier; } if ($element->config->type == 'link') { $link_ids[] = $element->identifier; } if ($element->config->type == 'textarea' || $element->config->type == 'text') { $text_ids[] = $element->identifier; } } } $els = json_decode($raw_item->elements); $texts = array(); $images = array(); $links = array(); foreach ($els as $ident => $el) { if (in_array($ident, $image_ids)) { $image = new RokSprocket_Item_Image(); $image->setSource($el->file); $image->setIdentifier('image_field_' . $ident); $image->setCaption(isset($el->title) ? $el->title : ''); $image->setAlttext(isset($el->title) ? $el->title : ''); $images[$image->getIdentifier()] = $image; if (isset($images['image_field_' . $ident]) && !$item->getPrimaryImage()) { $item->setPrimaryImage($image); } } if (in_array($ident, $link_ids)) { $link = new RokSprocket_Item_Link(); $link->setUrl(isset($el->url) ? $el->url : (isset($el->value) ? $el->value : '')); $link->setText(''); $link->setIdentifier('link_field_' . $ident); $links[$link->getIdentifier()] = $link; if (isset($links['link_field_' . $ident]) && !$item->getPrimaryLink()) { $item->setPrimaryLink($link); } } if (in_array($ident, $text_ids) && is_object($el)) { foreach ($el as $val) { $texts['text_field_' . $ident] = $val->value; } } else { if (in_array($ident, $text_ids) && !is_object($el)) { $texts['text_field_' . $ident] = $el->value; } } } $item->setLinks($images); $item->setLinks($links); $params = RokCommon_JSON::decode($raw_item->params); $desc = "metadata.description"; $texts['text_field_metadesc'] = $params->{$desc}; $item->setTextFields($texts); $item->setText(array_shift(array_values($texts))); $primary_link = new RokSprocket_Item_Link(); $primary_link->setUrl(JRoute::_('index.php?option=com_zoo&task=item&item_id=' . $raw_item->id, true)); $primary_link->getIdentifier('article_link'); $item->setPrimaryLink($primary_link); $item->setCommentCount($raw_item->comment_count); $tags = explode(',', $raw_item->tags) ? explode(',', $raw_item->tags) : array(); $item->setTags($tags); $item->setDbOrder($dborder); return $item; }
/** * @param $raw_item * @param int $dborder * * @return \RokSprocket_Item */ protected function convertRawToItem($raw_item, $dborder = 0) { $item = new RokSprocket_Item(); $item->setProvider($this->provider_name); $item->setId($raw_item->post_id); $item->setAuthor($raw_item->display_name ? $raw_item->display_name : $raw_item->user_nicename); $item->setAuthor($raw_item->user_nicename); $item->setTitle($raw_item->post_title); $item->setDate($raw_item->post_date); $item->setPublished($raw_item->post_status == "publish" ? true : false); $item->setText(strip_shortcodes($raw_item->post_content)); $item->setCategory($raw_item->category_title); $item->setHits(null); $item->setRating(null); $item->setMetaKey(null); $item->setMetaDesc(null); $item->setMetaData(null); //Set up texts array $texts = array(); $text_fields = self::getFieldTypes(array("txt", "desc")); if (count($text_fields)) { $text = ''; foreach ($text_fields as $field) { $texts['text_' . $field->name] = getFieldValue($raw_item->post_id, $field->name, $field->table); } } $texts = $this->processPlugins($texts); $item->setTextFields($texts); //set up images array $images = array(); $image_fields = self::getFieldTypes("file"); if (count($image_fields)) { $image = ''; foreach ($image_fields as $field) { $image = new RokSprocket_Item_Image(); $image->setSource(getFieldValue($raw_item->post_id, $field->name, $field->table)); $image->setIdentifier('image_' . $field->name); $image->setCaption(''); $image->setAlttext(''); $images[$image->getIdentifier()] = $image; } } $item->setImages($images); $item->setPrimaryImage($images['image_thumbnail']); //set up links array $links = array(); $link_fields = self::getFieldTypes("txt"); if (count($text_fields)) { $link = ''; foreach ($link_fields as $field) { $link_field = new RokSprocket_Item_Link(); $link_field->setUrl(getFieldValue($raw_item->post_id, $field->name, $field->table)); $link_field->setText(''); $links['url_' . $field->name] = $link_field; } } $item->setLinks($links); $primary_link = null; // $primary_link = new RokSprocket_Item_Link(); // $primary_link->setUrl(get_permalink($raw_item->post_id)); // $primary_link->getIdentifier('article_link'); // $item->setPrimaryLink($primary_link); $item->setCommentCount($raw_item->comment_count); if (!empty($raw_item->tags)) { $item->setTags($raw_item->tags); } $item->setDbOrder($dborder); return $item; }
/** * @param $raw_item * @param int $dborder * * @return \RokSprocket_Item */ protected function convertRawToItem($raw_item, $dborder = 0) { require_once JPath::clean(JPATH_SITE . '/components/com_content/helpers/route.php'); if (file_exists(JPath::clean(JPATH_SITE . '/libraries/joomla/html/html/content.php'))) { require_once JPath::clean(JPATH_SITE . '/libraries/joomla/html/html/content.php'); } if (class_exists('JModelLegacy')) { JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_content/models', 'ContentModel'); } //$textfield = $this->params->get('joomla_articletext_field', ''); $item = new RokSprocket_Item(); $item->setProvider($this->provider_name); $item->setId($raw_item->id); $item->setAlias($raw_item->alias); $item->setAuthor($raw_item->created_by_alias ? $raw_item->created_by_alias : $raw_item->author_name); $item->setTitle($raw_item->title); $item->setDate($raw_item->created); $item->setPublished($raw_item->state == 1 ? true : false); $item->setCategory($raw_item->category_title); $item->setHits($raw_item->hits); $item->setRating($raw_item->rating); $item->setMetaKey($raw_item->metakey); $item->setMetaDesc($raw_item->metadesc); $item->setMetaData($raw_item->metadata); $item->setPublishUp($raw_item->publish_up); $item->setPublishDown($raw_item->publish_down); $images = array(); if (isset($raw_item->images) && !empty($raw_item->images)) { try { $raw_images = RokCommon_JSON::decode($raw_item->images); if (isset($raw_images->image_intro) && !empty($raw_images->image_intro)) { $image_intro = new RokSprocket_Item_Image(); $image_intro->setSource($raw_images->image_intro); $image_intro->setIdentifier('image_intro'); $image_intro->setCaption($raw_images->image_intro_caption); $image_intro->setAlttext($raw_images->image_intro_alt); $images[$image_intro->getIdentifier()] = $image_intro; } if (isset($raw_images->image_fulltext) && !empty($raw_images->image_fulltext)) { $image_fulltext = new RokSprocket_Item_Image(); $image_fulltext->setSource($raw_images->image_fulltext); $image_fulltext->setIdentifier('image_fulltext'); $image_fulltext->setCaption($raw_images->image_fulltext_caption); $image_fulltext->setAlttext($raw_images->image_fulltext_alt); $images[$image_fulltext->getIdentifier()] = $image_fulltext; $item->setPrimaryImage($image_fulltext); } } catch (RokCommon_JSON_Exception $jse) { $this->container->roksprocket_logger->warning('Unable to decode image JSON for article ' . $item->getArticleId()); } $item->setImages($images); } $primary_link = new RokSprocket_Item_Link(); $slug = !empty($raw_item->alias) ? $raw_item->id . ':' . $raw_item->alias : $raw_item->id; $catslug = !empty($raw_item->category_alias) ? $raw_item->catid . ':' . $raw_item->category_alias : $raw_item->catid; $primary_link->setUrl(JRoute::_(ContentHelperRoute::getArticleRoute($slug, $catslug), true)); $primary_link->getIdentifier('article_link'); $item->setPrimaryLink($primary_link); $links = array(); if (isset($raw_item->urls) && !empty($raw_item->urls)) { try { $raw_links = RokCommon_JSON::decode($raw_item->urls); if (isset($raw_links->urla)) { $linka = new RokSprocket_Item_Link(); $linka->setUrl($raw_links->urla); $linka->setText($raw_links->urlatext); $linka->setIdentifier('urla'); $links[$linka->getIdentifier()] = $linka; } if (isset($raw_links->urlb)) { $linkb = new RokSprocket_Item_Link(); $linkb->setUrl($raw_links->urlb); $linkb->setText($raw_links->urlbtext); $linkb->setIdentifier('urlb'); $links[$linkb->getIdentifier()] = $linkb; } if (isset($raw_links->urlc)) { $linkc = new RokSprocket_Item_Link(); $linkc->setUrl($raw_links->urlc); $linkc->setText($raw_links->urlctext); $linkc->setIdentifier('urlc'); $links[$linkc->getIdentifier()] = $linkc; } $item->setLinks($links); } catch (RokCommon_JSON_Exception $jse) { $this->container->roksprocket_logger->warning('Unable to decode link JSON for article ' . $item->getArticleId()); } } $texts = array(); $texts['text_introtext'] = $raw_item->introtext; $texts['text_fulltext'] = $raw_item->fulltext; $texts['text_metadesc'] = $raw_item->metadesc; $texts['text_title'] = $raw_item->title; $texts = $this->processPlugins($texts); $item->setTextFields($texts); $item->setText($texts['text_introtext']); $item->setDbOrder($dborder); // unknown joomla items $item->setCommentCount(0); if (isset($raw_item->tags) && !empty($raw_item->tags)) { $item->setTags($raw_item->tags); } else { $item->setTags(array()); } return $item; }
/** * @param $raw_item * @param int $dborder * * @return \RokSprocket_Item */ protected function convertRawToItem($raw_item, $dborder = 0) { //$textfield = $this->params->get('easyblog_articletext_field', ''); $provider_version = $this->providerVersion(); if ($provider_version < "5.0.0") { $helper_file = JPATH_ROOT . '/components/com_easyblog/helpers/helper.php'; $router_file = JPATH_ROOT . '/components/com_easyblog/helpers/router.php'; } elseif ($provider_version >= "5.0.0") { $helper_file = JPATH_ADMINISTRATOR . '/components/com_easyblog/includes/easyblog.php'; $router_file = JPATH_ADMINISTRATOR . '/components/com_easyblog/includes/router.php'; } if (file_exists($helper_file)) { require_once $helper_file; } if (file_exists($router_file)) { require_once $router_file; } /* isset(require_once(JPATH_ROOT . '/components/com_easyblog/helpers/helper.php')); isset(require_once(JPATH_ROOT . '/components/com_easyblog/helpers/router.php'));*/ //suppress easyblog code errors $cfg = @EasyBlogHelper::getConfig(); $item = new RokSprocket_Item(); $item->setProvider($this->provider_name); $item->setId($raw_item->id); $item->setAlias(JApplication::stringURLSafe($raw_item->title)); $item->setAuthor($raw_item->author_name); $item->setTitle($raw_item->title); $item->setDate($raw_item->created); $item->setPublished($raw_item->published == 1 ? true : false); $item->setText($raw_item->intro); $item->setCategory($raw_item->category_title); $item->setHits($raw_item->hits); $item->setRating($raw_item->rating); $item->setMetaKey($raw_item->metakey); $item->setMetaDesc($raw_item->metadesc); if ($provider_version < "5.0.0") { $item->setMetaData(array("robots" => "'.{$raw_item->robots}.'", "author" => "'.{$raw_item->source}.'", "rights" => "'.{$raw_item->copyrights}.'", "xreference" => "")); } elseif ($provider_version >= "5.0.0") { $item->setMetaData(array("robots" => "'.{$raw_item->robots}.'", "author" => "'.{$raw_item->posttype}.'", "rights" => "'.{$raw_item->copyrights}.'", "xreference" => "")); } $item->setPublishUp($raw_item->publish_up); $item->setPublishDown($raw_item->publish_down); $images = array(); if (isset($raw_item->image) && !empty($raw_item->image)) { try { if (isset($raw_item->doctype) && !empty($raw_item->doctype)) { // EB5 // normalize blog image $image = json_decode($raw_item->image); // @legacy fix // We only want to store the URI for blog images. if (is_object($image)) { $raw_item->image = $image->place . $image->path; } // Load up the media manager library $mm = EB::mediamanager(); $url = $mm->getUrl($raw_item->image); $path = $mm->getPath($raw_item->image); if (JFile::exists($path)) { $image = EB::blogimage($path, $url); $item_image = new RokSprocket_Item_Image(); $item_image->setSource($image->getSource('medium')); $item_image->setIdentifier('image_item'); $item_image->setCaption(null); $item_image->setAlttext(null); $images[$item_image->getIdentifier()] = $item_image; $item->setPrimaryImage($item_image); // full image $item_image = new RokSprocket_Item_Image(); $item_image->setSource($image->getSource('large')); $item_image->setIdentifier('image_full'); $item_image->setCaption(null); $item_image->setAlttext(null); $images[$item_image->getIdentifier()] = $item_image; //thumbnail $item_image = new RokSprocket_Item_Image(); $item_image->setSource($image->getSource('thumbnail')); $item_image->setIdentifier('image_thumb'); $item_image->setCaption(null); $item_image->setAlttext(null); $images[$item_image->getIdentifier()] = $item_image; //thumbnail $item_image = new RokSprocket_Item_Image(); $item_image->setSource($image->getSource('icon')); $item_image->setIdentifier('image_icon'); $item_image->setCaption(null); $item_image->setAlttext(null); $images[$item_image->getIdentifier()] = $item_image; } } else { $raw_image = RokCommon_JSON::decode($raw_item->image); if (isset($raw_image) && !empty($raw_image)) { $item_image = new RokSprocket_Item_Image(); if (isset($raw_image->place) && $raw_image->place == 'shared') { $item_image->setSource(JPath::clean(JURI::root(true) . '/' . $cfg->get('main_shared_path') . $raw_image->path)); } else { $folder = explode(':', $raw_image->place); $item_image->setSource(JPath::clean(JURI::root(true) . '/' . $cfg->get('main_image_path') . $folder[1] . $raw_image->path)); } $item_image->setIdentifier('image_item'); $item_image->setCaption(null); $item_image->setAlttext(null); $images[$item_image->getIdentifier()] = $item_image; $item->setPrimaryImage($item_image); //full image $item_image = new RokSprocket_Item_Image(); $item_image->setSource(JPath::clean(str_replace(JURI::root(), JURI::root(true) . '/', $raw_image->url))); $item_image->setIdentifier('image_full'); $item_image->setCaption(null); $item_image->setAlttext(null); $images[$item_image->getIdentifier()] = $item_image; //thumbnail $item_image = new RokSprocket_Item_Image(); $item_image->setSource(JPath::clean(str_replace(JURI::root(), JURI::root(true) . '/', $raw_image->thumbnail->url))); $item_image->setIdentifier('image_thumb'); $item_image->setCaption(null); $item_image->setAlttext(null); $images[$item_image->getIdentifier()] = $item_image; //icon $item_image = new RokSprocket_Item_Image(); $item_image->setSource(JPath::clean(str_replace(JURI::root(), JURI::root(true) . '/', $raw_image->icon->url))); $item_image->setIdentifier('image_icon'); $item_image->setCaption(null); $item_image->setAlttext(null); $images[$item_image->getIdentifier()] = $item_image; } } } catch (RokCommon_JSON_Exception $jse) { $this->container->roksprocket_logger->warning('Unable to decode image JSON for article ' . $item->getArticleId()); } $item->setImages($images); } $primary_link = new RokSprocket_Item_Link(); $itemId = EasyBlogRouter::getItemIdByCategories($raw_item->category_id); $primary_link->setUrl(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $raw_item->id . '&Itemid=' . $itemId)); $primary_link->getIdentifier('article_link'); $item->setPrimaryLink($primary_link); $item->setPrimaryLink($primary_link); $links = array(); $link = new RokSprocket_Item_Link(); $link->setUrl(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $raw_item->id . '&Itemid=' . $itemId)); $link->setText(''); $link->setIdentifier('article_link'); $links[$link->getIdentifier()] = $link; $item->setLinks($links); $texts = array(); $texts['text_content'] = $raw_item->content; $texts['text_intro'] = $raw_item->intro; $texts['text_excerpt'] = $raw_item->excerpt; $texts['text_title'] = $raw_item->title; $texts['text_metadesc'] = $raw_item->metadesc; $texts = $this->processPlugins($texts); $item->setTextFields($texts); if ($provider_version < "5.0.0") { $item->setText($texts['text_intro']); } elseif ($provider_version >= "5.0.0") { $item->setText($texts['text_content']); } $item->setDbOrder($dborder); // unknown joomla items $item->setCommentCount($raw_item->comment_count); if (isset($raw_item->tags)) { $tags = explode(',', $raw_item->tags) ? explode(',', $raw_item->tags) : array(); $item->setTags($tags); } return $item; }
/** * @param $raw_item * @param int $dborder * * @return \RokSprocket_Item */ protected function convertRawToItem($raw_item, $dborder = 0) { $item = new RokSprocket_Item(); $item->setProvider($this->provider_name); $item->setId($raw_item->post_id); $item->setAlias($raw_item->post_name); $item->setAuthor($raw_item->display_name ? $raw_item->display_name : $raw_item->user_nicename); $item->setTitle($raw_item->post_title); $item->setDate($raw_item->post_date); $item->setPublished($raw_item->post_status == "publish" ? true : false); $text = apply_filters('widget_text', empty($raw_item->post_content) ? '' : $raw_item->post_content); $item->setText(strip_shortcodes($text)); $item->setCategory($raw_item->category_title); $item->setHits(null); $item->setRating(null); $item->setMetaKey(null); $item->setMetaDesc(null); $item->setMetaData(null); //Set up texts array $texts = array(); $text_fields = self::getFieldTypes(array("textfield", "textarea", "wysiwyg", "checkbox", "numeric", "colorpicker", "email", "phone", "radio", "select")); if (count($text_fields)) { $text = ''; foreach ($text_fields as $key => $val) { $texts['text_' . $key] = get_post_meta($raw_item->post_id, $val['meta_key'], true); } } $texts['text_post_content'] = $raw_item->post_content; $texts['text_post_excerpt'] = $raw_item->post_excerpt; $texts['text_post_title'] = $raw_item->post_title; $texts = $this->processPlugins($texts); $item->setTextFields($texts); //set up images array $images = array(); $image_fields = self::getFieldTypes("image"); if (count($image_fields)) { $image = ''; foreach ($image_fields as $key => $val) { $image = new RokSprocket_Item_Image(); $image->setSource(get_post_meta($raw_item->post_id, $val['meta_key'], true)); $image->setIdentifier('image_' . $key); $image->setCaption(''); $image->setAlttext(''); $images[$image->getIdentifier()] = $image; } } if (isset($raw_item->thumbnail_id) && !empty($raw_item->thumbnail_id)) { $image = new RokSprocket_Item_Image(); $image->setSource(wp_get_attachment_url($raw_item->thumbnail_id)); $image->setIdentifier('image_thumbnail'); $image->setCaption($raw_item->image_intro_caption); $image->setAlttext($raw_item->image_intro_alt); $images[$image->getIdentifier()] = $image; } $item->setImages($images); $item->setPrimaryImage($images['image_thumbnail']); //set up links array $links = array(); $link_fields = self::getFieldTypes(array("url", "audio", "video", "file", "embed")); if (count($text_fields)) { $link = ''; foreach ($link_fields as $key => $val) { $link_field = new RokSprocket_Item_Link(); $link_field->setUrl(get_post_meta($raw_item->post_id, $val['meta_key'], true)); $link_field->setText(''); $links['url_' . $key] = $link_field; } } $item->setLinks($links); $primary_link = new RokSprocket_Item_Link(); $primary_link->setUrl(get_permalink($raw_item->post_id)); $primary_link->getIdentifier('article_link'); $item->setPrimaryLink($primary_link); $item->setCommentCount($raw_item->comment_count); if (!empty($raw_item->tags)) { $item->setTags($raw_item->tags); } $item->setDbOrder($dborder); return $item; }
/** * @param $raw_item * @param int $dborder * * @return \RokSprocket_Item */ protected function convertRawToItem($raw_item, $dborder = 0) { //$textfield = $this->params->get('k2_articletext_field', ''); $item = new RokSprocket_Item(); $item->setProvider($this->provider_name); $item->setId($raw_item->id); $item->setAlias($raw_item->alias); $item->setAuthor($raw_item->created_by_alias ? $raw_item->created_by_alias : $raw_item->author_name); $item->setTitle($raw_item->title); $item->setDate($raw_item->created); $item->setPublished($raw_item->published == 1 ? true : false); $item->setCategory($raw_item->category_title); $item->setHits($raw_item->hits); $item->setRating($raw_item->rating); $item->setMetaKey($raw_item->metakey); $item->setMetaDesc($raw_item->metadesc); $item->setMetaData($raw_item->metadata); $item->setPublishUp($raw_item->publish_up); $item->setPublishDown($raw_item->publish_down); $images = array(); $links = array(); $texts = array(); // Get the default images for item and category $image_sizes = array('_XS', '_S', '_M', '_L', '_XL', '_Generic'); foreach ($image_sizes as $image_size) { $image_uri = 'media/k2/items/cache/' . md5("Image" . $raw_item->id) . $image_size . '.jpg'; if (JFile::exists(JPATH_SITE . '/' . $image_uri)) { $image = new RokSprocket_Item_Image(); $image->setSource($image_uri); $image->setIdentifier('item_image' . $image_size); $image->setCaption(''); $image->setAlttext(''); $images[$image->getIdentifier()] = $image; } if (isset($images['item_image_S'])) { $item->setPrimaryImage($images['item_image_S']); } } if (isset($raw_item->category_image) && !empty($raw_item->category_image)) { $image = new RokSprocket_Item_Image(); $image->setSource('media/k2/categories/' . $raw_item->category_image); $image->setIdentifier('item_image_category'); $image->setCaption(''); $image->setAlttext(''); $images[$image->getIdentifier()] = $image; } // Get default Text fields for an item $texts['text_introtext'] = $raw_item->introtext; $texts['text_fulltext'] = $raw_item->fulltext; $texts['text_title'] = $raw_item->title; $texts['text_metadesc'] = $raw_item->metadesc; // get all extra fields for an item $item_extra_field_values = json_decode($raw_item->extra_fields); if (!empty($item_extra_field_values)) { foreach ($item_extra_field_values as $item_extra_field) { $field_info = self::getExtraFieldInfo($item_extra_field->id); if ($field_info !== false && isset($item_extra_field->value)) { switch ($field_info->type) { case 'image': $image = new RokSprocket_Item_Image(); $image->setSource($item_extra_field->value); $image->setIdentifier('item_image_' . $field_info->field_name); $image->setCaption(''); $image->setAlttext(''); $images[$image->getIdentifier()] = $image; break; case 'link': $link = new RokSprocket_Item_Link(); $link->setUrl($item_extra_field->value[1]); $link->setText($item_extra_field->value[0]); $link->setIdentifier('item_link_' . $item_extra_field->id); $links[$link->getIdentifier()] = $link; break; case 'textarea': case 'textfield': $texts['text_' . $item_extra_field->id] = $item_extra_field->value; break; } } } } // set the item fields $item->setImages($images); $item->setLinks($links); $texts = $this->processPlugins($texts); $item->setTextFields($texts); $item->setText($texts['text_introtext']); $item->setDbOrder($dborder); require_once JPATH_SITE . '/components/com_k2/helpers/route.php'; $primary_link = new RokSprocket_Item_Link(); $primary_link->setUrl(JRoute::_(K2HelperRoute::getItemRoute($raw_item->id . ':' . $raw_item->alias, $raw_item->catid . ':' . $raw_item->category_alias), true)); $primary_link->getIdentifier('article_link'); $item->setPrimaryLink($primary_link); // unknown joomla items $item->setCommentCount($raw_item->comment_count); if (isset($raw_item->tags)) { $tags = explode(',', $raw_item->tags) ? explode(',', $raw_item->tags) : array(); $item->setTags($tags); } return $item; }
/** * @param $raw_item * @param int $dborder * * @return \RokSprocket_Item */ protected function convertRawToItem($raw_item, $dborder = 0) { require_once JPath::clean(JPATH_SITE . '/components/com_content/helpers/route.php'); if (file_exists(JPath::clean(JPATH_SITE . '/libraries/joomla/html/html/content.php'))) { require_once JPath::clean(JPATH_SITE . '/libraries/joomla/html/html/content.php'); } require_once JPath::clean(JPATH_SITE . '/libraries/cck/content/content.php'); //$app_type = $this->params->get('seblod_application_type'); //$textfield = $this->params->get('seblod_articletext_field', ''); $item = new RokSprocket_Item(); $item->setProvider($this->provider_name); $item->setId($raw_item->id); $item->setAlias($raw_item->alias); $item->setAuthor($raw_item->created_by_alias ? $raw_item->created_by_alias : $raw_item->author_name); $item->setTitle($raw_item->title); $item->setDate($raw_item->created); $item->setPublished($raw_item->state == 1 ? true : false); $item->setCategory($raw_item->category_title); $item->setHits($raw_item->hits); $item->setRating($raw_item->rating); $item->setMetaKey($raw_item->metakey); $item->setMetaDesc($raw_item->metadesc); $item->setMetaData($raw_item->metadata); $item->setPublishUp($raw_item->publish_up); $item->setPublishDown($raw_item->publish_down); //Set up texts array $texts = array(); if ($text_fields = self::getFieldTypes(array("textarea", "wysiwyg_editor", "text"), false)) { $text = ''; foreach ($text_fields as $field) { if ($field->storage_table == '#__cck_core') { $text = isset($field->data) ? $field->data : ''; } elseif ($field->storage_table == '#__content' && $field->storage_field == 'introtext') { $text = CCK_Content::getValue($raw_item->introtext, $field->name); } elseif ($field->storage_table == '#__content' && $field->storage_field == 'fulltext') { $text = CCK_Content::getValue($raw_item->fulltext, $field->name); } else { $text = $this->getFieldValue($raw_item->id, $field->storage_field, $field->storage_table); } $texts['text_' . $field->id] = $text; } } if (isset($raw_item->introtext) && !empty($raw_item->introtext)) { $text = ''; $introtext = CCK_Content::getValue($raw_item->introtext, 'introtext'); $fulltext = CCK_Content::getValue($raw_item->introtext, 'fulltext'); if ($introtext || $fulltext) { if ($introtext && isset($introtext)) { $texts['text_introtext'] = $introtext; } if ($fulltext && isset($fulltext)) { $texts['text_fulltext'] = $fulltext; } } else { $texts['text_introtext'] = $raw_item->introtext; $texts['text_fulltext'] = $raw_item->fulltext; $texts['text_metadesc'] = $raw_item->metadesc; $texts['text_title'] = $raw_item->title; } } $texts = $this->processPlugins($texts); $item->setTextFields($texts); $item->setText($texts['text_introtext']); //set up images array $images = array(); if ($image_fields = self::getFieldTypes("upload_image", false)) { foreach ($image_fields as $field) { $image_uri = ''; if ($field->storage_table == '#__cck_core') { $image_uri = isset($field->data) ? $field->data : ''; } elseif ($field->storage_table == '#__content' && $field->storage_field == 'introtext') { $image_uri = CCK_Content::getValue($raw_item->introtext, $field->name); } elseif ($field->storage_table == '#__content' && $field->storage_field == 'fulltext') { $image_uri = CCK_Content::getValue($raw_item->fulltext, $field->name); } else { $image_uri = $this->getFieldValue($raw_item->id, $field->storage_field, $field->storage_table); } if (JFile::exists(JPath::clean(JPATH_SITE . '/' . $image_uri))) { $image_field = new RokSprocket_Item_Image(); $image_field->setSource(JPath::clean(JURI::root(true) . '/' . $image_uri)); $image_field->setIdentifier('image_' . $field->id); $image_field->setCaption(''); $image_field->setAlttext(''); $images['image_' . $field->id] = $image_field; } } } if (isset($raw_item->images) && !empty($raw_item->images)) { try { $raw_images = RokCommon_JSON::decode($raw_item->images); if (isset($raw_images->image_intro)) { $image_intro = new RokSprocket_Item_Image(); $image_intro->setSource(JPath::clean(JURI::root(true) . '/' . $raw_images->image_intro)); $image_intro->setIdentifier('image_intro'); $image_intro->setCaption($raw_images->image_intro_caption); $image_intro->setAlttext($raw_images->image_intro_alt); $images[$image_intro->getIdentifier()] = $image_intro; } if (isset($raw_images->image_fulltext)) { $image_fulltext = new RokSprocket_Item_Image(); $image_fulltext->setSource(JPath::clean(JURI::root(true) . '/' . $raw_images->image_fulltext)); $image_fulltext->setIdentifier('image_fulltext'); $image_fulltext->setCaption($raw_images->image_fulltext_caption); $image_fulltext->setAlttext($raw_images->image_fulltext_alt); $images[$image_fulltext->getIdentifier()] = $image_fulltext; } } catch (RokCommon_JSON_Exception $jse) { //TODO log unable to get image for article } } if (isset($images['image_fulltext']) && $images['image_fulltext']) { $image_primary = $images['image_fulltext']; } else { if (isset($images['image_intro']) && $images['image_intro']) { $image_primary = $images['image_intro']; } else { if (count($images)) { $image_primary = array_shift(array_values($images)); } else { $image_primary = array(); } } } $item->setPrimaryImage($image_primary); $item->setImages($images); //set up links array $links = array(); if ($link_fields = self::getFieldTypes("link", false)) { foreach ($link_fields as $field) { $link_url = ''; if ($field->storage_table == '#_cck_core') { $link_url = isset($field->data) ? $field->data : ''; } elseif ($field->storage_table == '#_content') { $link_url = CCK_Content::getValue($raw_item->introtext, $field->name); } $link_field = new RokSprocket_Item_Link(); $link_field->setUrl($link_url); $link_field->setText(''); $links['url_' . $field->id] = $link_field; } } if (isset($raw_item->urls) && !empty($raw_item->urls)) { try { $raw_links = RokCommon_JSON::decode($raw_item->urls); if (isset($raw_links->urla)) { $linka = new RokSprocket_Item_Link(); $linka->setUrl($raw_links->urla); $linka->setText($raw_links->urlatext); $linka->setIdentifier('urla'); $links[$linka->getIdentifier()] = $linka; $item->setPrimaryLink($linka); } if (isset($raw_links->urlb)) { $linkb = new RokSprocket_Item_Link(); $linkb->setUrl($raw_links->urlb); $linkb->setText($raw_links->urlbtext); $linkb->setIdentifier('urlb'); $links[$linkb->getIdentifier()] = $linkb; } if (isset($raw_links->urlc)) { $linkc = new RokSprocket_Item_Link(); $linkc->setUrl($raw_links->urlc); $linkc->setText($raw_links->urlctext); $linkc->setIdentifier('urlc'); $links[$linkc->getIdentifier()] = $linkc; } } catch (RokCommon_JSON_Exception $jse) { //TODO log unable to get links for article } } $item->setLinks($links); $primary_link = new RokSprocket_Item_Link(); $slug = !empty($raw_item->alias) ? $raw_item->id . ':' . $raw_item->alias : $raw_item->id; $catslug = !empty($raw_item->category_alias) ? $raw_item->catid . ':' . $raw_item->category_alias : $raw_item->catid; $primary_link->setUrl(JRoute::_(ContentHelperRoute::getArticleRoute($slug, $catslug), true)); $primary_link->getIdentifier('article_link'); $item->setPrimaryLink($primary_link); // unknown joomla items $item->setCommentCount(0); if (isset($raw_item->tags) && !empty($raw_item->tags)) { $item->setTags($raw_item->tags); } else { $item->setTags(array()); } $item->setDbOrder($dborder); return $item; }
/** * @param $raw_item * @param int $dborder * * @return \RokSprocket_Item */ protected function convertRawToItem($raw_item, $dborder = 0) { $item = new RokSprocket_Item(); $item->setProvider($this->provider_name); $item->setId($raw_item->post_id); $item->setAlias($raw_item->post_name); $item->setAuthor($raw_item->display_name ? $raw_item->display_name : $raw_item->user_nicename); $item->setTitle($raw_item->post_title); $item->setDate($raw_item->post_date); $item->setPublished($raw_item->post_status == "publish" ? true : false); $text = apply_filters('widget_text', empty($raw_item->post_content) ? '' : $raw_item->post_content); $item->setText(strip_shortcodes($text)); $item->setCategory($raw_item->category_title); $item->setHits(null); $item->setRating(null); $item->setMetaKey(null); $item->setMetaDesc(null); $item->setMetaData(null); //Set up texts array $texts = array(); if ($text_fields = self::getFieldTypes(array("text", "wysiwyg"))) { $text = ''; foreach ($text_fields as $field) { $texts['text_' . $field['id']] = self::getFieldValue($raw_item->post_id, $field['id']); } } $texts['text_post_content'] = $raw_item->post_content; $texts['text_post_excerpt'] = $raw_item->post_excerpt; $texts['text_post_title'] = $raw_item->post_title; $texts = $this->processPlugins($texts); $item->setTextFields($texts); //set up images array $images = array(); if ($image_fields = self::getFieldTypes("file")) { $image = ''; foreach ($image_fields as $field) { $image = new RokSprocket_Item_Image(); $image->setSource(wp_get_attachment_url(self::getFieldValue($raw_item->post_id, $field['id']))); $image->setIdentifier('image_' . $field['id']); $image->setCaption(''); $image->setAlttext(''); $images[$image->getIdentifier()] = $image; } } if (isset($raw_item->thumbnail_id) && !empty($raw_item->thumbnail_id)) { $image = new RokSprocket_Item_Image(); $image->setSource(wp_get_attachment_url($raw_item->thumbnail_id)); $image->setIdentifier('image_thumbnail'); $image->setCaption(''); $image->setAlttext(''); $images[$image->getIdentifier()] = $image; } $item->setImages($images); $item->setPrimaryImage($images['image_thumbnail']); //set up links array $links = array(); if ($link_fields = self::getFieldTypes("url")) { $link = ''; foreach ($link_fields as $field) { $link_field = new RokSprocket_Item_Link(); $link_field->setUrl(self::getFieldValue($raw_item->post_id, $field['id'])); $link_field->setText(''); $links['url_' . $field['id']] = $link_field; } } $item->setLinks($links); $primary_link = new RokSprocket_Item_Link(); $primary_link->setUrl(get_permalink($raw_item->post_id)); $primary_link->getIdentifier('article_link'); $item->setPrimaryLink($primary_link); $item->setCommentCount($raw_item->comment_count); if (isset($raw_item->tags)) { $tags = explode(',', $raw_item->tags) ? explode(',', $raw_item->tags) : array(); $item->setTags($tags); } $item->setDbOrder($dborder); return $item; }
/** * @param $raw_item * @param int $dborder * * @return \RokSprocket_Item */ protected function convertRawToItem($raw_item, $dborder = 0) { //$textfield = $this->params->get('k2_articletext_field', ''); $item = new RokSprocket_Item(); $item->setProvider($this->provider_name); $item->setId($raw_item->id); $item->setAlias($raw_item->alias); $item->setAuthor($raw_item->author_name); $item->setTitle($raw_item->title); $item->setDate($raw_item->created); $item->setPublished($raw_item->published == 1 ? true : false); $item->setCategory($raw_item->category_title); $item->setHits($raw_item->hits); $item->setRating($raw_item->rating); $item->setMetaKey($raw_item->metakey); $item->setMetaDesc($raw_item->metadesc); $item->setMetaData($raw_item->metadata); $item->setPublishUp($raw_item->publish_up); $item->setPublishDown($raw_item->publish_down); $image_sizes = array('_XS', '_S', '_M', '_L', '_XL', '_Generic'); $images = array(); foreach ($image_sizes as $image_size) { $image_uri = 'media/k2/items/cache/' . md5("Image" . $raw_item->id) . $image_size . '.jpg'; if (JFile::exists(JPATH_SITE . '/' . $image_uri)) { $image = new RokSprocket_Item_Image(); $image->setSource($image_uri); $image->setIdentifier('item_image' . $image_size); $image->setCaption(''); $image->setAlttext(''); $images[$image->getIdentifier()] = $image; } if (isset($images['item_image_S'])) { $item->setPrimaryImage($images['item_image_S']); } } if (isset($raw_item->category_image) && !empty($raw_item->category_image)) { $image = new RokSprocket_Item_Image(); $image->setSource('media/k2/categories/' . $raw_item->category_image); $image->setIdentifier('item_image_category'); $image->setCaption(''); $image->setAlttext(''); $images[$image->getIdentifier()] = $image; } $item->setImages($images); if (isset($raw_item->extra_fields)) { $link_fields = self::getFieldTypes("link"); $raw_links = array(); $extra_fields = json_decode($raw_item->extra_fields); foreach ($extra_fields as $field) { if (!in_array($field->id, $link_fields)) { $raw_links[] = $field; } } $links = array(); foreach ($raw_links as $raw_link) { if (isset($raw_link->value)) { $link = new RokSprocket_Item_Link(); $link->setUrl($raw_link->value); $link->setText(''); $link->setIdentifier('item_link_' . $raw_link->id); $links[$link->getIdentifier()] = $link; } $item->setLinks($links); } $text_fields = self::getFieldTypes(array("textarea", "textfield")); $raw_texts = array(); foreach ($extra_fields as $field) { if (!in_array($field->id, $text_fields)) { $raw_texts[] = $field; } } $texts = array(); foreach ($raw_links as $raw_link) { if (isset($raw_link->value)) { $texts['text_' . $raw_link->id] = $raw_link->value; } } } $texts['text_introtext'] = $raw_item->introtext; $texts['text_fulltext'] = $raw_item->fulltext; $texts['text_metadesc'] = $raw_item->metadesc; $item->setTextFields($texts); $item->setText($texts['text_introtext']); $item->setDbOrder($dborder); require_once JPATH_SITE . '/components/com_k2/helpers/route.php'; $primary_link = new RokSprocket_Item_Link(); $primary_link->setUrl(JRoute::_(K2HelperRoute::getItemRoute($raw_item->id . ':' . $raw_item->alias, $raw_item->catid . ':' . $raw_item->category_alias), true)); $primary_link->getIdentifier('article_link'); $item->setPrimaryLink($primary_link); // unknown joomla items $item->setCommentCount($raw_item->comment_count); if (isset($raw_item->tags)) { $tags = explode(',', $raw_item->tags) ? explode(',', $raw_item->tags) : array(); $item->setTags($tags); } return $item; }
/** * @param $raw_item * @param int $dborder * * @return \RokSprocket_Item */ protected function convertRawToItem($raw_item, $dborder = 0) { require_once JPath::clean(JPATH_SITE . '/components/com_content/helpers/route.php'); if (file_exists(JPath::clean(JPATH_SITE . '/libraries/joomla/html/html/content.php'))) { require_once JPath::clean(JPATH_SITE . '/libraries/joomla/html/html/content.php'); } if (class_exists('JModelLegacy')) { JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_content/models', 'ContentModel'); } //$textfield = $this->params->get('contentbuilder_articletext_field', ''); $item = new RokSprocket_Item(); $item->setProvider($this->provider_name); $item->setId($raw_item->id); $item->setAlias($raw_item->alias); $item->setAuthor($raw_item->created_by_alias ? $raw_item->created_by_alias : $raw_item->author_name); $item->setTitle($raw_item->title); $item->setDate($raw_item->created); $item->setPublished($raw_item->state == 1 ? true : false); $item->setCategory($raw_item->category_title); $item->setHits($raw_item->hits); $item->setRating($raw_item->rating); $item->setMetaKey($raw_item->metakey); $item->setMetaDesc($raw_item->metadesc); $item->setMetaData($raw_item->metadata); $item->setPublishUp($raw_item->publish_up); $item->setPublishDown($raw_item->publish_down); $texts = array(); if ($text_fields = self::getFieldTypes(array("textarea", "text"))) { foreach ($text_fields as $field) { $text = $this->getFieldValue($raw_item->id, $field->id); $texts['text_' . $field->id] = $text; } } $texts['text_introtext'] = $raw_item->introtext; $texts['text_fulltext'] = $raw_item->fulltext; $texts['text_metadesc'] = $raw_item->metadesc; $texts['text_title'] = $raw_item->title; $texts = $this->processPlugins($texts); $texts = $this->processPlugins($texts); $item->setTextFields($texts); $item->setText($texts['text_introtext']); $images = array(); if (isset($raw_item->images) && !empty($raw_item->images)) { try { $raw_images = RokCommon_JSON::decode($raw_item->images); if (isset($raw_images->image_intro) && !empty($raw_images->image_intro)) { $image_intro = new RokSprocket_Item_Image(); $image_intro->setSource($raw_images->image_intro); $image_intro->setIdentifier('image_intro'); $image_intro->setCaption($raw_images->image_intro_caption); $image_intro->setAlttext($raw_images->image_intro_alt); $images[$image_intro->getIdentifier()] = $image_intro; } if (isset($raw_images->image_fulltext) && !empty($raw_images->image_fulltext)) { $image_fulltext = new RokSprocket_Item_Image(); $image_fulltext->setSource($raw_images->image_fulltext); $image_fulltext->setIdentifier('image_fulltext'); $image_fulltext->setCaption($raw_images->image_fulltext_caption); $image_fulltext->setAlttext($raw_images->image_fulltext_alt); $images[$image_fulltext->getIdentifier()] = $image_fulltext; $item->setPrimaryImage($image_fulltext); } } catch (RokCommon_JSON_Exception $jse) { $this->container->roksprocket_logger->warning('Unable to decode image JSON for article ' . $item->getArticleId()); } } if ($image_fields = self::getFieldTypes("upload")) { foreach ($image_fields as $field) { $image_uri = $this->getFieldValue($raw_item->record_id, $field->storage_field, $field->storage_table); if (JFile::exists(JPath::clean(JPATH_SITE . '/' . $image_uri)) && is_file(JPath::clean(JPATH_SITE . '/' . $image_uri))) { $image_field = new RokSprocket_Item_Image(); $image_field->setSource(JPath::clean(JURI::root(true) . '/' . $image_uri)); $image_field->setIdentifier('image_' . $field->id); $image_field->setCaption(''); $image_field->setAlttext(''); $images['image_' . $field->id] = $image_field; } } } $item->setImages($images); $primary_link = new RokSprocket_Item_Link(); $primary_link->setUrl(JRoute::_('index.php?option=com_contentbuilder&title=list-view-easyblog&controller=details&id=' . $raw_item->form_id . '&record_id=' . $raw_item->record_id)); $primary_link->getIdentifier('article_link'); $item->setPrimaryLink($primary_link); $links = array(); if (isset($raw_item->urls) && !empty($raw_item->urls)) { try { $raw_links = RokCommon_JSON::decode($raw_item->urls); if (isset($raw_links->urla)) { $linka = new RokSprocket_Item_Link(); $linka->setUrl($raw_links->urla); $linka->setText($raw_links->urlatext); $linka->setIdentifier('urla'); $links[$linka->getIdentifier()] = $linka; } if (isset($raw_links->urlb)) { $linkb = new RokSprocket_Item_Link(); $linkb->setUrl($raw_links->urlb); $linkb->setText($raw_links->urlbtext); $linkb->setIdentifier('urlb'); $links[$linkb->getIdentifier()] = $linkb; } if (isset($raw_links->urlc)) { $linkc = new RokSprocket_Item_Link(); $linkc->setUrl($raw_links->urlc); $linkc->setText($raw_links->urlctext); $linkc->setIdentifier('urlc'); $links[$linkc->getIdentifier()] = $linkc; } } catch (RokCommon_JSON_Exception $jse) { $this->container->roksprocket_logger->warning('Unable to decode link JSON for article ' . $item->getArticleId()); } } if ($link_fields = self::getFieldTypes("text", false)) { foreach ($link_fields as $field) { $raw_link = $this->getFieldValue($raw_item->record_id, $field->storage_field, $field->storage_table); if (filter_var($raw_link, FILTER_VALIDATE_URL)) { $link_field = new RokSprocket_Item_Link(); $link_field->setUrl($raw_link); $link_field->setText(null); $link_field->setIdentifier('url_' . $field->id); $links[$link_field->getIdentifier()] = $link_field; } } } $item->setLinks($links); $item->setDbOrder($dborder); // unknown joomla items $item->setCommentCount(0); $item->setTags(array()); return $item; }
/** * @param $raw_item * @param int $dborder * * @return \RokSprocket_Item */ protected function convertRawToItem($raw_item, $dborder = 0) { //$textfield = $this->params->get('easyblog_articletext_field', ''); $item = new RokSprocket_Item(); $item->setProvider($this->provider_name); $item->setId($raw_item->id); $item->setAlias(JApplication::stringURLSafe($raw_item->title)); $item->setAuthor($raw_item->author_name); $item->setTitle($raw_item->title); $item->setDate($raw_item->created); $item->setPublished($raw_item->published == 1 ? true : false); $item->setText($raw_item->intro); $item->setCategory($raw_item->category_title); $item->setHits($raw_item->hits); $item->setRating($raw_item->rating); $item->setMetaKey($raw_item->metakey); $item->setMetaDesc($raw_item->metadesc); $item->setMetaData(array("robots" => "'.{$raw_item->robots}.'", "author" => "'.{$raw_item->source}.'", "rights" => "'.{$raw_item->copyrights}.'", "xreference" => "")); $item->setPublishUp($raw_item->publish_up); $item->setPublishDown($raw_item->publish_down); $images = array(); if (isset($raw_item->image) && !empty($raw_item->image)) { try { $raw_image = RokCommon_JSON::decode($raw_item->image); if (isset($raw_image) && !empty($raw_image)) { $item_image = new RokSprocket_Item_Image(); $folder = explode(':', $raw_image->place); $item_image->setSource(JPath::clean(JURI::root(true) . '/images/easyblog_images/' . $folder[1] . $raw_image->path)); $item_image->setIdentifier('image_item'); $item_image->setCaption(null); $item_image->setAlttext(null); $images[$item_image->getIdentifier()] = $item_image; $item->setPrimaryImage($item_image); //full image $item_image = new RokSprocket_Item_Image(); $item_image->setSource(JPath::clean(str_replace(JURI::root(), JURI::root(true) . '/', $raw_image->url))); $item_image->setIdentifier('image_full'); $item_image->setCaption(null); $item_image->setAlttext(null); $images[$item_image->getIdentifier()] = $item_image; //thumbnail $item_image = new RokSprocket_Item_Image(); $item_image->setSource(JPath::clean(str_replace(JURI::root(), JURI::root(true) . '/', $raw_image->thumbnail->url))); $item_image->setIdentifier('image_thumb'); $item_image->setCaption(null); $item_image->setAlttext(null); $images[$item_image->getIdentifier()] = $item_image; //icon $item_image = new RokSprocket_Item_Image(); $item_image->setSource(JPath::clean(str_replace(JURI::root(), JURI::root(true) . '/', $raw_image->icon->url))); $item_image->setIdentifier('image_icon'); $item_image->setCaption(null); $item_image->setAlttext(null); $images[$item_image->getIdentifier()] = $item_image; } } catch (RokCommon_JSON_Exception $jse) { $this->container->roksprocket_logger->warning('Unable to decode image JSON for article ' . $item->getArticleId()); } $item->setImages($images); } $primary_link = new RokSprocket_Item_Link(); $primary_link->setUrl(JRoute::_('index.php?option=com_easyblog&view=entry&id=' . $raw_item->id)); $primary_link->getIdentifier('article_link'); $item->setPrimaryLink($primary_link); $item->setPrimaryLink($primary_link); $links = array(); $link = new RokSprocket_Item_Link(); $link->setUrl(JRoute::_('index.php?option=com_easyblog&view=entry&id=' . $raw_item->id)); $link->setText(''); $link->setIdentifier('article_link'); $links[$link->getIdentifier()] = $link; $item->setLinks($links); $texts = array(); $texts['text_content'] = $raw_item->content; $texts['text_intro'] = $raw_item->intro; $texts['text_excerpt'] = $raw_item->excerpt; $texts['text_metadesc'] = $raw_item->metadesc; $item->setTextFields($texts); $item->setText($texts['text_intro']); $item->setDbOrder($dborder); // unknown joomla items $item->setCommentCount($raw_item->comment_count); if (isset($raw_item->tags)) { $tags = explode(',', $raw_item->tags) ? explode(',', $raw_item->tags) : array(); $item->setTags($tags); } return $item; }