Esempio n. 1
0
 private function _replaceContent(&$tag)
 {
     $oldFormat = empty($tag->format);
     if (!ACYMAILING_J16) {
         $query = 'SELECT a.*,b.name as authorname, c.alias as catalias, c.title as cattitle, c.image AS catpict, s.alias as secalias, s.title as sectitle FROM ' . acymailing_table('content', false) . ' as a ';
         $query .= 'LEFT JOIN ' . acymailing_table('users', false) . ' as b ON a.created_by = b.id ';
         $query .= ' LEFT JOIN ' . acymailing_table('categories', false) . ' AS c ON c.id = a.catid ';
         $query .= ' LEFT JOIN ' . acymailing_table('sections', false) . ' AS s ON s.id = a.sectionid ';
         $query .= 'WHERE a.id = ' . $tag->id . ' LIMIT 1';
     } else {
         $query = 'SELECT a.*,b.name as authorname, c.alias as catalias, c.title as cattitle, c.params AS catparams FROM ' . acymailing_table('content', false) . ' as a ';
         $query .= 'LEFT JOIN ' . acymailing_table('users', false) . ' as b ON a.created_by = b.id ';
         $query .= ' LEFT JOIN ' . acymailing_table('categories', false) . ' AS c ON c.id = a.catid ';
         $query .= 'WHERE a.id = ' . $tag->id . ' LIMIT 1';
     }
     $this->db->setQuery($query);
     $article = $this->db->loadObject();
     if (empty($article)) {
         $app = JFactory::getApplication();
         if ($app->isAdmin()) {
             $app->enqueueMessage('The article "' . $tag->id . '" could not be loaded', 'notice');
         }
         return '';
     }
     if (empty($tag->lang) && !empty($this->newslanguage) && !empty($this->newslanguage->lang_code)) {
         $tag->lang = $this->newslanguage->lang_code . ',' . $this->newslanguage->lang_id;
     }
     $this->acypluginsHelper->translateItem($article, $tag, 'content');
     $varFields = array();
     foreach ($article as $fieldName => $oneField) {
         $varFields['{' . $fieldName . '}'] = $oneField;
     }
     $this->acypluginsHelper->cleanHtml($article->introtext);
     $this->acypluginsHelper->cleanHtml($article->fulltext);
     if ($this->params->get('integration') == 'jreviews' && !empty($article->images)) {
         $firstpict = explode('|', trim(reset(explode("\n", $article->images))) . '|||||||');
         if (!empty($firstpict[0])) {
             $picturePath = file_exists(ACYMAILING_ROOT . 'images' . DS . 'stories' . DS . str_replace('/', DS, $firstpict[0])) ? ACYMAILING_LIVE . 'images/stories/' . $firstpict[0] : ACYMAILING_LIVE . 'images/' . $firstpict[0];
             $myPict = '<img src="' . $picturePath . '" alt="" hspace="5" style="margin:5px" align="left" border="' . intval($firstpict[5]) . '" />';
             $article->introtext = $myPict . $article->introtext;
         }
     }
     $completeId = $article->id;
     $completeCat = $article->catid;
     if (!empty($article->alias)) {
         $completeId .= ':' . $article->alias;
     }
     if (!empty($article->catalias)) {
         $completeCat .= ':' . $article->catalias;
     }
     if (empty($tag->itemid)) {
         if (!ACYMAILING_J16) {
             $completeSec = $article->sectionid;
             if (!empty($article->secalias)) {
                 $completeSec .= ':' . $article->secalias;
             }
             if ($this->params->get('integration') == 'flexicontent' && class_exists('FlexicontentHelperRoute')) {
                 $link = FlexicontentHelperRoute::getItemRoute($completeId, $completeCat, $completeSec);
             } else {
                 $link = ContentHelperRoute::getArticleRoute($completeId, $completeCat, $completeSec);
             }
         } else {
             if ($this->params->get('integration') == 'flexicontent' && class_exists('FlexicontentHelperRoute')) {
                 $link = FlexicontentHelperRoute::getItemRoute($completeId, $completeCat);
             } else {
                 $link = ContentHelperRoute::getArticleRoute($completeId, $completeCat);
             }
         }
     } else {
         $link = 'index.php?option=com_content&view=article&id=' . $completeId . '&catid=' . $completeCat;
     }
     if ($this->params->get('integration') == 'flexicontent' && !class_exists('FlexicontentHelperRoute')) {
         $link = 'index.php?option=com_flexicontent&view=items&id=' . $completeId;
     } elseif ($this->params->get('integration') == 'jaggyblog') {
         $link = 'index.php?option=com_jaggyblog&task=viewpost&id=' . $completeId;
     }
     if (!empty($tag->itemid)) {
         $link .= '&Itemid=' . $tag->itemid;
     }
     if (!empty($tag->lang)) {
         $link .= (strpos($link, '?') ? '&' : '?') . 'lang=' . substr($tag->lang, 0, strpos($tag->lang, ','));
     }
     if (!empty($tag->autologin)) {
         $link .= (strpos($link, '?') ? '&' : '?') . 'user={usertag:username|urlencode}&passw={usertag:password|urlencode}';
     }
     if (empty($tag->lang) && !empty($article->language) && $article->language != '*') {
         if (!isset($this->langcodes[$article->language])) {
             $this->db->setQuery('SELECT sef FROM #__languages WHERE lang_code = ' . $this->db->Quote($article->language) . ' ORDER BY `published` DESC LIMIT 1');
             $this->langcodes[$article->language] = $this->db->loadResult();
             if (empty($this->langcodes[$article->language])) {
                 $this->langcodes[$article->language] = $article->language;
             }
         }
         $link .= (strpos($link, '?') ? '&' : '?') . 'lang=' . $this->langcodes[$article->language];
     }
     $link = acymailing_frontendLink($link);
     $varFields['{link}'] = $link;
     $afterTitle = '';
     $afterArticle = '';
     $contentText = '';
     $pictPath = '';
     if (!empty($tag->author)) {
         $authorName = empty($article->created_by_alias) ? $article->authorname : $article->created_by_alias;
         if ($tag->type == 'title') {
             $afterTitle .= '<br />';
         }
         $afterTitle .= '<span class="authorname">' . $authorName . '</span><br />';
     }
     $dateFormat = empty($tag->dateformat) ? JText::_('DATE_FORMAT_LC2') : $tag->dateformat;
     if (!empty($tag->created)) {
         if ($tag->type == 'title') {
             $afterTitle .= '<br />';
         }
         $varFields['{createddate}'] = JHTML::_('date', $article->created, $dateFormat);
         $afterTitle .= '<span class="createddate">' . $varFields['{createddate}'] . '</span><br />';
     }
     if (!empty($tag->modified)) {
         if ($tag->type == 'title') {
             $afterTitle .= '<br />';
         }
         $varFields['{modifieddate}'] = JHTML::_('date', $article->modified, $dateFormat);
         $afterTitle .= '<span class="modifieddate">' . $varFields['{modifieddate}'] . '</span><br />';
     }
     if (!isset($tag->pict) && $tag->type != 'title') {
         if ($this->params->get('removepictures', 'never') == 'always' || $this->params->get('removepictures', 'never') == 'intro' && $tag->type == "intro") {
             $tag->pict = 0;
         } else {
             $tag->pict = 1;
         }
     }
     if (strpos($article->introtext, 'jseblod') !== false && file_exists(ACYMAILING_ROOT . 'plugins' . DS . 'content' . DS . 'cckjseblod.php')) {
         global $mainframe;
         include_once ACYMAILING_ROOT . 'plugins' . DS . 'content' . DS . 'cckjseblod.php';
         if (function_exists('plgContentCCKjSeblod')) {
             $paramsContent = JComponentHelper::getParams('com_content');
             $article->text = $article->introtext . $article->fulltext;
             plgContentCCKjSeblod($article, $paramsContent);
             $article->introtext = $article->text;
             $article->fulltext = '';
         }
     }
     if ($tag->type != "title") {
         if ($tag->type == "intro") {
             $forceReadMore = false;
             $mytag = new stdClass();
             $mytag->wrap = $this->params->get('wordwrap', 0);
             if (empty($article->fulltext)) {
                 $article->introtext = $this->acypluginsHelper->wrapText($article->introtext, $mytag);
                 if (!empty($this->acypluginsHelper->wraped)) {
                     $forceReadMore = true;
                 }
             }
         }
         if (empty($article->fulltext) || $tag->type != "text") {
             $contentText .= $article->introtext;
         }
         if ($tag->type != "intro" && !empty($article->fulltext)) {
             if ($tag->type != "text" && !empty($article->introtext) && !preg_match('#^<[div|p]#i', trim($article->fulltext))) {
                 $contentText .= '<br />';
             }
             $contentText .= $article->fulltext;
         }
         $contentText = $this->acypluginsHelper->wrapText($contentText, $tag);
         if (!empty($this->acypluginsHelper->wraped)) {
             $forceReadMore = true;
         }
         if (!empty($tag->clean)) {
             $contentText = strip_tags($contentText, '<p><br><span><ul><li><h1><h2><h3><h4><a>');
         }
         if (ACYMAILING_J16 && !empty($article->images) && !empty($tag->pict)) {
             $picthtml = '';
             $images = json_decode($article->images);
             $pictVar = $tag->type == 'intro' ? 'image_intro' : 'image_fulltext';
             $floatVar = $tag->type == 'intro' ? 'float_intro' : 'float_fulltext';
             if (!empty($images->{$pictVar})) {
                 if ($images->{$floatVar} != 'right') {
                     if (empty($tag->format)) {
                         $tag->format = 'TOP_LEFT';
                     }
                     $images->{$floatVar} = 'left';
                 } elseif (empty($tag->format)) {
                     $tag->format = 'TOP_RIGHT';
                 }
                 $style = 'float:' . $images->{$floatVar} . ';padding-' . ($images->{$floatVar} == 'right' ? 'left' : 'right') . ':10px;padding-bottom:10px;';
                 if (!empty($tag->link) && empty($tag->nopictlink)) {
                     $picthtml .= '<a href="' . $link . '" style="text-decoration:none" >';
                 }
                 $alt = '';
                 $altVar = $pictVar . '_alt';
                 if (!empty($images->{$altVar})) {
                     $alt = $images->{$altVar};
                 }
                 $picthtml .= '<img' . (empty($tag->nopictstyle) ? ' style="' . $style . '"' : '') . ' alt="' . $alt . '" border="0" src="' . JURI::root() . $images->{$pictVar} . '" />';
                 $pictPath = JURI::root() . $images->{$pictVar};
                 if (!empty($tag->link) && empty($tag->nopictlink)) {
                     $picthtml .= '</a>';
                 }
                 $varFields['{picthtml}'] = $picthtml;
             }
         }
         $contentText = preg_replace('/^\\s*(<img[^>]*>)\\s*(?:<br[^>]*>\\s*)*/i', '$1', $contentText);
         if (file_exists(JPATH_SITE . DS . 'plugins' . DS . 'attachments') && empty($tag->noattach)) {
             try {
                 $query = 'SELECT display_name, url, filename ' . 'FROM #__attachments ' . 'WHERE (parent_entity = "article" ' . 'AND parent_id = ' . intval($tag->id) . ')';
                 if (ACYMAILING_J16) {
                     $query .= ' OR (parent_entity = "category" ' . 'AND parent_id = ' . intval($article->catid) . ')';
                 }
                 $this->db->setQuery($query);
                 $attachments = $this->db->loadObjectList();
             } catch (Exception $e) {
                 $attachments = array();
             }
             if (!empty($attachments)) {
                 $afterArticle .= '<br />' . JText::_('ATTACHED_FILES') . ' :';
                 foreach ($attachments as $oneAttachment) {
                     $afterArticle .= '<br /><a href="' . $oneAttachment->url . '">' . (empty($oneAttachment->display_name) ? $oneAttachment->filename : $oneAttachment->display_name) . '</a>';
                 }
             }
         }
         $readMoreText = empty($tag->readmore) ? $this->readmore : $tag->readmore;
         $varFields['{readmore}'] = '<a style="text-decoration:none;" target="_blank" href="' . $link . '"><span class="acymailing_readmore">' . $readMoreText . '</span></a>';
         if ($tag->type == "intro" && empty($tag->noreadmore) && (!empty($article->fulltext) || $forceReadMore)) {
             $contentText .= ' ' . $varFields['{readmore}'];
         }
         if (!empty($tag->share)) {
             $links = array();
             $shareOpt = explode(',', $tag->share);
             foreach ($shareOpt as $socialNetwork) {
                 $knownNetwork = true;
                 $socialNetwork = strtolower(trim($socialNetwork));
                 if ($socialNetwork == 'facebook') {
                     $linkShare = 'http://www.facebook.com/sharer.php?u=' . urlencode($link) . '&t=' . urlencode($article->title);
                     $picSrc = file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'facebook.png') ? 'media/com_acymailing/plugins/facebook.png' : 'media/com_acymailing/images/facebookshare.png';
                     $altText = 'Facebook';
                 } elseif ($socialNetwork == 'twitter') {
                     $text = JText::sprintf('SHARE_TEXT', $link);
                     $linkShare = 'http://twitter.com/home?status=' . urlencode($text);
                     $picSrc = file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'twitter.png') ? 'media/com_acymailing/plugins/twitter.png' : 'media/com_acymailing/images/twittershare.png';
                     $altText = 'Twitter';
                 } elseif ($socialNetwork == 'linkedin') {
                     $linkShare = 'http://www.linkedin.com/shareArticle?mini=true&url=' . urlencode($link) . '&title=' . urlencode($article->title);
                     $picSrc = file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'linkedin.png') ? 'media/com_acymailing/plugins/linkedin.png' : 'media/com_acymailing/images/linkedin.png';
                     $altText = 'LinkedIn';
                 } elseif ($socialNetwork == 'hyves') {
                     $linkShare = 'http://www.hyves-share.nl/button/respect/?hc_hint=1&url=' . urlencode($link) . '&title=' . urlencode($article->title);
                     $picSrc = file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'hyves.png') ? 'media/com_acymailing/plugins/hyves.png' : 'media/com_acymailing/images/hyvesshare.png';
                     $altText = 'Hyves';
                 } elseif ($socialNetwork == 'google') {
                     $linkShare = 'https://plus.google.com/share?url=' . urlencode($link);
                     $picSrc = file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'google.png') ? 'media/com_acymailing/plugins/google.png' : 'media/com_acymailing/images/google_plusshare.png';
                     $altText = 'Google+';
                 } elseif ($socialNetwork == 'mailto') {
                     $linkShare = 'mailto:?subject=' . urlencode($article->title) . '&body=' . urlencode($article->title . ' (' . $link . ')');
                     $picSrc = file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'mailto.png') ? 'media/com_acymailing/plugins/mailto.png' : 'media/com_acymailing/images/mailto.png';
                     $altText = 'MailTo';
                 } else {
                     $knownNetwork = false;
                     acymailing_display('Network not found: ' . $socialNetwork . '. Availables networks are facebook, twitter, linkedin, hyves, google and mailto.', 'warning');
                 }
                 if ($knownNetwork) {
                     array_push($links, '<a target="_blank" href="' . $linkShare . '" title="' . JText::sprintf('SOCIAL_SHARE', $altText) . '"><img alt="' . $altText . '" src="' . $picSrc . '" /></a>');
                 }
             }
             $afterArticle .= '<br />' . (!empty($tag->sharetxt) ? $tag->sharetxt . ' ' : '') . implode(' ', $links);
         }
     }
     if (!empty($tag->jtags) && version_compare(JVERSION, '3.1.0', '>=')) {
         $this->db->setQuery('SELECT t.id, t.alias, t.title FROM #__tags AS t JOIN #__contentitem_tag_map AS m ON t.id = m.tag_id WHERE t.published = 1 AND m.type_alias = "com_content.article" AND m.content_item_id = ' . intval($tag->id));
         $tags = $this->db->loadObjectList();
         if (!empty($tags)) {
             $afterArticle .= '<br />';
             foreach ($tags as $oneTag) {
                 $afterArticle .= ' <a href="index.php?option=com_tags&view=tag&id=' . $oneTag->id . '-' . $oneTag->alias . '">' . $oneTag->title . '</a> ';
             }
         }
     }
     $format = new stdClass();
     $format->tag = $tag;
     $format->title = empty($tag->notitle) ? $article->title : '';
     $format->afterTitle = $afterTitle;
     $format->afterArticle = $afterArticle;
     $format->imagePath = $pictPath;
     $format->description = $contentText;
     $format->link = empty($tag->link) ? '' : $link;
     $format->cols = 2;
     $result = $this->acypluginsHelper->getStandardDisplay($format);
     if (!empty($tag->theme)) {
         if (preg_match('#<img[^>]*>#Uis', $article->introtext . $article->fulltext, $pregresult)) {
             $cleanContent = strip_tags($result, '<p><br><span><ul><li><h1><h2><h3><h4><a>');
             $tdwidth = (empty($tag->maxwidth) ? $this->params->get('maxwidth', 150) : $tag->maxwidth) + 20;
             $result = '<table cellspacing="0" width="500" cellpadding="0" border="0" ><tr><td class="contentpicture" width="' . $tdwidth . '" valign="top" align="center"><a href="' . $link . '" target="_blank" style="border:0px;text-decoration:none">' . $pregresult[0] . '</a></td><td class="contenttext">' . $cleanContent . '</td></tr></table>';
         }
     }
     if ($tag->type != 'title') {
         $result = '<div class="acymailing_content">' . $result . '</div>';
     }
     if (!(empty($tag->cattitle) && empty($tag->catpict)) && (!strpos($article->catid, ',') && $this->currentcatid != $article->catid || strpos($article->catid, ',') && !in_array($this->currentcatid, explode(',', $article->catid)))) {
         if (strpos($article->catid, ',')) {
             $catids = explode(',', $article->catid);
             $this->currentcatid = $catids[0];
         } else {
             $this->currentcatid = $article->catid;
         }
         if (ACYMAILING_J16) {
             $params = json_decode($article->catparams);
             $article->catpict = $params->image;
         }
         $resultTitle = $article->cattitle;
         if (!empty($tag->catpict) && !empty($article->catpict)) {
             $style = '';
             if (!empty($tag->catmaxwidth)) {
                 $style .= 'max-width:' . intval($tag->catmaxwidth) . 'px;';
             }
             if (!empty($tag->catmaxheight)) {
                 $style .= 'max-height:' . intval($tag->catmaxheight) . 'px;';
             }
             $resultTitle = '<img' . (empty($style) ? '' : ' style="' . $style . '"') . ' alt="" src="' . $article->catpict . '" />';
             if (!empty($tag->cattitlelink)) {
                 $resultTitle = '<a href="index.php?option=com_content&view=category&id=' . $this->currentcatid . '">' . $resultTitle . '</a>';
             }
         } else {
             if (!empty($tag->cattitlelink)) {
                 $resultTitle = '<a href="index.php?option=com_content&view=category&id=' . $this->currentcatid . '">' . $resultTitle . '</a>';
             }
             $resultTitle = '<h3 class="cattitle">' . $resultTitle . '</h3>';
         }
         $result = $resultTitle . $result;
     }
     if ($oldFormat) {
         if (file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent_html.php')) {
             ob_start();
             require ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent_html.php';
             $result = ob_get_clean();
         } elseif (file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent.php')) {
             ob_start();
             require ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent.php';
             $result = ob_get_clean();
         }
     } elseif (!empty($tag->template) && file_exists(ACYMAILING_MEDIA . 'plugins' . DS . $tag->template)) {
         ob_start();
         require ACYMAILING_MEDIA . 'plugins' . DS . $tag->template;
         $result = ob_get_clean();
     }
     $result = str_replace(array_keys($varFields), $varFields, $result);
     $result = $this->acypluginsHelper->removeJS($result);
     $result = $this->acypluginsHelper->replaceVideos($result);
     $tag->maxheight = empty($tag->maxheight) ? $this->params->get('maxheight', 150) : $tag->maxheight;
     $tag->maxwidth = empty($tag->maxwidth) ? $this->params->get('maxwidth', 150) : $tag->maxwidth;
     $result = $this->acypluginsHelper->managePicts($tag, $result);
     if (!empty($tag->maxchar) && strlen(strip_tags($result)) > $tag->maxchar) {
         $result = strip_tags($result);
         for ($i = $tag->maxchar; $i > 0; $i--) {
             if ($result[$i] == ' ') {
                 break;
             }
         }
         if (!empty($i)) {
             $result = substr($result, 0, $i) . @$tag->textafter;
         }
     }
     return $result;
 }
Esempio n. 2
0
 function _replaceContent(&$results, $i)
 {
     $arguments = explode('|', strip_tags($results[1][$i]));
     $tag = null;
     $tag->id = (int) $arguments[0];
     for ($i = 1, $a = count($arguments); $i < $a; $i++) {
         $args = explode(':', $arguments[$i]);
         if (isset($args[1])) {
             $tag->{$args}[0] = $args[1];
         } else {
             $tag->{$args}[0] = true;
         }
     }
     if (version_compare(JVERSION, '1.6.0', '<')) {
         $query = 'SELECT a.*,b.name as authorname, c.alias as catalias, c.title as cattitle, s.alias as secalias, s.title as sectitle FROM ' . acymailing::table('content', false) . ' as a ';
         $query .= 'LEFT JOIN ' . acymailing::table('users', false) . ' as b ON a.created_by = b.id ';
         $query .= ' LEFT JOIN ' . acymailing::table('categories', false) . ' AS c ON c.id = a.catid ';
         $query .= ' LEFT JOIN ' . acymailing::table('sections', false) . ' AS s ON s.id = a.sectionid ';
         $query .= 'WHERE a.id = ' . $tag->id . ' LIMIT 1';
     } else {
         $query = 'SELECT a.*,b.name as authorname, c.alias as catalias, c.title as cattitle FROM ' . acymailing::table('content', false) . ' as a ';
         $query .= 'LEFT JOIN ' . acymailing::table('users', false) . ' as b ON a.created_by = b.id ';
         $query .= ' LEFT JOIN ' . acymailing::table('categories', false) . ' AS c ON c.id = a.catid ';
         $query .= 'WHERE a.id = ' . $tag->id . ' LIMIT 1';
     }
     $db =& JFactory::getDBO();
     $db->setQuery($query);
     $article = $db->loadObject();
     $result = '';
     if (empty($article)) {
         $app =& JFactory::getApplication();
         if ($app->isAdmin()) {
             $app->enqueueMessage('The article "' . $tag->id . '" could not be loaded', 'notice');
         }
         return $result;
     }
     if (!empty($tag->lang)) {
         $langid = (int) substr($tag->lang, strpos($tag->lang, ',') + 1);
         if (!empty($langid)) {
             $query = "SELECT reference_field, value FROM `#__jf_content` WHERE `published` = 1 AND `reference_table` = 'content' AND `language_id` = {$langid} AND `reference_id` = " . $tag->id;
             $db->setQuery($query);
             $translations = $db->loadObjectList();
             if (!empty($translations)) {
                 foreach ($translations as $oneTranslation) {
                     if (!empty($oneTranslation->value)) {
                         $translatedfield = $oneTranslation->reference_field;
                         $article->{$translatedfield} = $oneTranslation->value;
                     }
                 }
             }
         }
     }
     if ($this->params->get('integration') == 'jreviews' and !empty($article->images)) {
         $firstpict = explode('|', trim(reset(explode("\n", $article->images))) . '|||||||');
         if (!empty($firstpict[0])) {
             $myPict = '<img src="' . ACYMAILING_LIVE . 'images/stories/' . $firstpict[0] . '" hspace="5" style="margin:5px" align="left" border="' . intval($firstpict[5]) . '" />';
             $article->introtext = $myPict . $article->introtext;
         }
     }
     $completeId = $article->id;
     $completeCat = $article->catid;
     if (!empty($article->alias)) {
         $completeId .= ':' . $article->alias;
     }
     if (!empty($article->catalias)) {
         $completeCat .= ':' . $article->catalias;
     }
     if (version_compare(JVERSION, '1.6.0', '<')) {
         $completeSec = $article->sectionid;
         if (!empty($article->secalias)) {
             $completeSec .= ':' . $article->secalias;
         }
         $link = ContentHelperRoute::getArticleRoute($completeId, $completeCat, $completeSec);
     } else {
         $link = ContentHelperRoute::getArticleRoute($completeId, $completeCat);
     }
     if ($this->params->get('integration') == 'flexicontent') {
         $link = 'index.php?option=com_flexicontent&view=items&id=' . $completeId;
     }
     if (!empty($tag->lang)) {
         $link .= (strpos($link, '?') ? '&' : '?') . 'lang=' . substr($tag->lang, 0, strpos($tag->lang, ','));
     }
     $link = acymailing::frontendLink($link);
     $styleTitle = '';
     $styleTitleEnd = '';
     if ($tag->type != "title") {
         $styleTitle = '<h2 class="acymailing_title">';
         $styleTitleEnd = '</h2>';
     }
     if (empty($tag->notitle)) {
         if (!empty($tag->link)) {
             $result .= '<a href="' . $link . '" ';
             if ($tag->type != "title") {
                 $result .= 'style="text-decoration:none" name="content-' . $article->id . '" ';
             }
             $result .= 'target="_blank" >' . $styleTitle . $article->title . $styleTitleEnd . '</a>';
         } else {
             $result .= $styleTitle . $article->title . $styleTitleEnd;
         }
     }
     if (!empty($tag->author)) {
         $authorName = empty($article->created_by_alias) ? $article->authorname : $article->created_by_alias;
         if ($tag->type == 'title') {
             $result .= '<br/>';
         }
         $result .= $authorName . '<br/>';
     }
     if (!empty($tag->created)) {
         $result .= '<span class="createddate">' . JHTML::_('date', $article->created, JText::_('DATE_FORMAT_LC2')) . '</span>';
     }
     if (!isset($tag->pict) and $tag->type != 'title') {
         if ($this->params->get('removepictures', 'never') == 'always' || ($this->params->get('removepictures', 'never') == 'intro' and $tag->type == "intro")) {
             $tag->pict = 0;
         } else {
             $tag->pict = 1;
         }
     }
     if ($tag->type != "title") {
         $contentText = '';
         if ($tag->type == "intro") {
             $forceReadMore = false;
             $wordwrap = $this->params->get('wordwrap', 0);
             if (!empty($wordwrap) and empty($article->fulltext)) {
                 $newintrotext = strip_tags($article->introtext, '<br><img>');
                 $numChar = strlen($newintrotext);
                 if ($numChar > $wordwrap) {
                     $stop = strlen($newintrotext);
                     for ($i = $wordwrap; $i < $numChar; $i++) {
                         if ($newintrotext[$i] == " ") {
                             $stop = $i;
                             $forceReadMore = true;
                             break;
                         }
                     }
                     $article->introtext = substr($newintrotext, 0, $stop) . '...';
                 }
             }
         }
         if (empty($article->fulltext) or $tag->type != "text") {
             $contentText .= $article->introtext;
         }
         if ($tag->type != "intro" and !empty($article->fulltext)) {
             if ($tag->type != "text" && !empty($article->introtext)) {
                 $contentText .= '<br />';
             }
             $contentText .= $article->fulltext;
         }
         if (strpos($contentText, 'jseblod') !== false and file_exists(ACYMAILING_ROOT . 'plugins' . DS . 'content' . DS . 'cckjseblod.php')) {
             global $mainframe;
             include_once ACYMAILING_ROOT . 'plugins' . DS . 'content' . DS . 'cckjseblod.php';
             if (function_exists('plgContentCCKjSeblod')) {
                 $paramsContent =& JComponentHelper::getParams('com_content');
                 $article->text = $contentText;
                 plgContentCCKjSeblod($article, $paramsContent);
                 $contentText = $article->text;
             }
         }
         if (!empty($tag->wrap)) {
             $newtext = strip_tags($contentText, '<br><img>');
             $numChar = strlen($newtext);
             if ($numChar > $tag->wrap) {
                 $stop = strlen($newtext);
                 for ($i = $tag->wrap; $i < $numChar; $i++) {
                     if ($newtext[$i] == " ") {
                         $stop = $i;
                         $forceReadMore = true;
                         break;
                     }
                 }
                 $contentText = substr($newtext, 0, $stop) . '...';
             }
         }
         $result .= $contentText;
         if ($tag->type == "intro") {
             if (empty($tag->noreadmore) and (!empty($article->fulltext) or $forceReadMore)) {
                 $readMoreText = empty($tag->readmore) ? JText::_('JOOMEXT_READ_MORE') : $tag->readmore;
                 $result .= '<a style="text-decoration:none;" target="_blank" href="' . $link . '"><span class="acymailing_readmore">' . $readMoreText . '</span></a>';
             }
         }
         $result = '<div class="acymailing_content">' . $result . '</div>';
     }
     if (file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent_html.php')) {
         ob_start();
         require ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent_html.php';
         $result = ob_get_clean();
     } elseif (file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent.php')) {
         ob_start();
         require ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent.php';
         $result = ob_get_clean();
     }
     if ($tag->type != 'title' and $this->params->get('removejs', 'yes') == 'yes') {
         $result = $this->_removeJS($result);
     }
     if (isset($tag->pict)) {
         $pictureHelper = acymailing::get('helper.acypict');
         $pictureHelper->maxHeight = empty($tag->maxheight) ? $this->params->get('maxheight', 150) : $tag->maxheight;
         $pictureHelper->maxWidth = empty($tag->maxwidth) ? $this->params->get('maxwidth', 150) : $tag->maxwidth;
         if ($tag->pict == '0') {
             $result = $pictureHelper->removePictures($result);
         } elseif ($tag->pict == 'resized') {
             if ($pictureHelper->available()) {
                 $result = $pictureHelper->resizePictures($result);
             } elseif ($app->isAdmin()) {
                 $app->enqueueMessage($pictureHelper->error, 'notice');
             }
         }
     }
     return $result;
 }
Esempio n. 3
0
 private function _replaceContent(&$results, $i)
 {
     $acypluginsHelper = acymailing_get('helper.acyplugins');
     $tag = $acypluginsHelper->extractTag($results[1][$i]);
     $tag->id = intval($tag->id);
     if (!ACYMAILING_J16) {
         $query = 'SELECT a.*,b.name as authorname, c.alias as catalias, c.title as cattitle, s.alias as secalias, s.title as sectitle FROM ' . acymailing_table('content', false) . ' as a ';
         $query .= 'LEFT JOIN ' . acymailing_table('users', false) . ' as b ON a.created_by = b.id ';
         $query .= ' LEFT JOIN ' . acymailing_table('categories', false) . ' AS c ON c.id = a.catid ';
         $query .= ' LEFT JOIN ' . acymailing_table('sections', false) . ' AS s ON s.id = a.sectionid ';
         $query .= 'WHERE a.id = ' . $tag->id . ' LIMIT 1';
     } else {
         $query = 'SELECT a.*,b.name as authorname, c.alias as catalias, c.title as cattitle FROM ' . acymailing_table('content', false) . ' as a ';
         $query .= 'LEFT JOIN ' . acymailing_table('users', false) . ' as b ON a.created_by = b.id ';
         $query .= ' LEFT JOIN ' . acymailing_table('categories', false) . ' AS c ON c.id = a.catid ';
         $query .= 'WHERE a.id = ' . $tag->id . ' LIMIT 1';
     }
     $db = JFactory::getDBO();
     $db->setQuery($query);
     $article = $db->loadObject();
     $result = '';
     if (empty($article)) {
         $app = JFactory::getApplication();
         if ($app->isAdmin()) {
             $app->enqueueMessage('The article "' . $tag->id . '" could not be loaded', 'notice');
         }
         return $result;
     }
     if (!empty($tag->lang)) {
         $langid = (int) substr($tag->lang, strpos($tag->lang, ',') + 1);
         if (!empty($langid)) {
             $query = "SELECT reference_field, value FROM " . (ACYMAILING_J16 && file_exists(JPATH_SITE . DS . 'components' . DS . 'com_falang') ? '`#__falang_content`' : '`#__jf_content`') . " WHERE `published` = 1 AND `reference_table` = 'content' AND `language_id` = {$langid} AND `reference_id` = " . $tag->id;
             $db->setQuery($query);
             $translations = $db->loadObjectList();
             if (!empty($translations)) {
                 foreach ($translations as $oneTranslation) {
                     if (!empty($oneTranslation->value)) {
                         $translatedfield = $oneTranslation->reference_field;
                         $article->{$translatedfield} = $oneTranslation->value;
                     }
                 }
             }
         }
     }
     $acypluginsHelper = acymailing_get('helper.acyplugins');
     $acypluginsHelper->cleanHtml($article->introtext);
     $acypluginsHelper->cleanHtml($article->fulltext);
     if ($this->params->get('integration') == 'jreviews' and !empty($article->images)) {
         $firstpict = explode('|', trim(reset(explode("\n", $article->images))) . '|||||||');
         if (!empty($firstpict[0])) {
             $picturePath = file_exists(ACYMAILING_ROOT . 'images' . DS . 'stories' . DS . str_replace('/', DS, $firstpict[0])) ? ACYMAILING_LIVE . 'images/stories/' . $firstpict[0] : ACYMAILING_LIVE . 'images/' . $firstpict[0];
             $myPict = '<img src="' . $picturePath . '" alt="" hspace="5" style="margin:5px" align="left" border="' . intval($firstpict[5]) . '" />';
             $article->introtext = $myPict . $article->introtext;
         }
     }
     $completeId = $article->id;
     $completeCat = $article->catid;
     if (!empty($article->alias)) {
         $completeId .= ':' . $article->alias;
     }
     if (!empty($article->catalias)) {
         $completeCat .= ':' . $article->catalias;
     }
     if (empty($tag->itemid)) {
         if (!ACYMAILING_J16) {
             $completeSec = $article->sectionid;
             if (!empty($article->secalias)) {
                 $completeSec .= ':' . $article->secalias;
             }
             if ($this->params->get('integration') == 'flexicontent' && class_exists('FlexicontentHelperRoute')) {
                 $link = FlexicontentHelperRoute::getItemRoute($completeId, $completeCat, $completeSec);
             } else {
                 $link = ContentHelperRoute::getArticleRoute($completeId, $completeCat, $completeSec);
             }
         } else {
             if ($this->params->get('integration') == 'flexicontent' && class_exists('FlexicontentHelperRoute')) {
                 $link = FlexicontentHelperRoute::getItemRoute($completeId, $completeCat);
             } else {
                 $link = ContentHelperRoute::getArticleRoute($completeId, $completeCat);
             }
         }
     } else {
         $link = 'index.php?option=com_content&view=article&id=' . $completeId . '&catid=' . $completeCat;
     }
     if ($this->params->get('integration') == 'flexicontent' && !class_exists('FlexicontentHelperRoute')) {
         $link = 'index.php?option=com_flexicontent&view=items&id=' . $completeId;
     } elseif ($this->params->get('integration') == 'jaggyblog') {
         $link = 'index.php?option=com_jaggyblog&task=viewpost&id=' . $completeId;
     }
     if (!empty($tag->itemid)) {
         $link .= '&Itemid=' . $tag->itemid;
     }
     if (!empty($tag->lang)) {
         $link .= (strpos($link, '?') ? '&' : '?') . 'lang=' . substr($tag->lang, 0, strpos($tag->lang, ','));
     }
     if (!empty($tag->autologin)) {
         $link .= (strpos($link, '?') ? '&' : '?') . 'user={usertag:username|urlencode}&passw={usertag:password|urlencode}';
     }
     if (empty($tag->lang) && !empty($article->language) && $article->language != '*') {
         if (!isset($this->langcodes[$article->language])) {
             $db->setQuery('SELECT sef FROM #__languages WHERE lang_code = ' . $db->Quote($article->language) . ' ORDER BY `published` DESC LIMIT 1');
             $this->langcodes[$article->language] = $db->loadResult();
             if (empty($this->langcodes[$article->language])) {
                 $this->langcodes[$article->language] = $article->language;
             }
         }
         $link .= (strpos($link, '?') ? '&' : '?') . 'lang=' . $this->langcodes[$article->language];
     }
     $link = acymailing_frontendLink($link);
     $styleTitle = '';
     $styleTitleEnd = '';
     if ($tag->type != "title") {
         $styleTitle = '<h2 class="acymailing_title">';
         $styleTitleEnd = '</h2>';
     }
     if (empty($tag->notitle)) {
         if (!empty($tag->link)) {
             $result .= '<a href="' . $link . '" ';
             if ($tag->type != "title") {
                 $result .= 'style="text-decoration:none" name="content-' . $article->id . '" ';
             }
             $result .= 'target="_blank" >' . $styleTitle . $article->title . $styleTitleEnd . '</a>';
         } else {
             $result .= $styleTitle . $article->title . $styleTitleEnd;
         }
     }
     if (!empty($tag->author)) {
         $authorName = empty($article->created_by_alias) ? $article->authorname : $article->created_by_alias;
         if ($tag->type == 'title') {
             $result .= '<br/>';
         }
         $result .= '<span class="authorname">' . $authorName . '</span><br/>';
     }
     if (!empty($tag->created)) {
         if ($tag->type == 'title') {
             $result .= '<br/>';
         }
         $dateFormat = empty($tag->dateformat) ? JText::_('DATE_FORMAT_LC2') : $tag->dateformat;
         $result .= '<span class="createddate">' . JHTML::_('date', $article->created, $dateFormat) . '</span><br/>';
     }
     if (!isset($tag->pict) and $tag->type != 'title') {
         if ($this->params->get('removepictures', 'never') == 'always' || ($this->params->get('removepictures', 'never') == 'intro' and $tag->type == "intro")) {
             $tag->pict = 0;
         } else {
             $tag->pict = 1;
         }
     }
     if (strpos($article->introtext, 'jseblod') !== false and file_exists(ACYMAILING_ROOT . 'plugins' . DS . 'content' . DS . 'cckjseblod.php')) {
         global $mainframe;
         include_once ACYMAILING_ROOT . 'plugins' . DS . 'content' . DS . 'cckjseblod.php';
         if (function_exists('plgContentCCKjSeblod')) {
             $paramsContent = JComponentHelper::getParams('com_content');
             $article->text = $article->introtext . $article->fulltext;
             plgContentCCKjSeblod($article, $paramsContent);
             $article->introtext = $article->text;
             $article->fulltext = '';
         }
     }
     if ($tag->type != "title") {
         $contentText = '';
         if ($tag->type == "intro") {
             $forceReadMore = false;
             $wordwrap = $this->params->get('wordwrap', 0);
             if (!empty($wordwrap) and empty($article->fulltext)) {
                 $tagToKeep = '<br>';
                 if (!isset($tag->pict) || $tag->pict != '0') {
                     $tagToKeep .= '<img>';
                 }
                 $newintrotext = strip_tags($article->introtext, $tagToKeep);
                 $numChar = strlen($newintrotext);
                 if ($numChar > $wordwrap) {
                     $stop = strlen($newintrotext);
                     for ($i = $wordwrap; $i < $numChar; $i++) {
                         if ($newintrotext[$i] == " ") {
                             $stop = $i;
                             $forceReadMore = true;
                             break;
                         }
                     }
                     $article->introtext = substr($newintrotext, 0, $stop) . '...';
                 }
             }
         }
         if (empty($article->fulltext) or $tag->type != "text") {
             $contentText .= $article->introtext;
         }
         if ($tag->type != "intro" and !empty($article->fulltext)) {
             if ($tag->type != "text" && !empty($article->introtext) && !preg_match('#^<[div|p]#i', trim($article->fulltext))) {
                 $contentText .= '<br />';
             }
             $contentText .= $article->fulltext;
         }
         $contentText = $acypluginsHelper->wrapText($contentText, $tag);
         if (!empty($tag->clean)) {
             $contentText = strip_tags($contentText, '<p><br><span><ul><li><h1><h2><h3><h4><a>');
         }
         if (ACYMAILING_J16 && !empty($article->images) && !empty($tag->pict)) {
             $picthtml = '';
             $images = json_decode($article->images);
             $pictVar = $tag->type == 'intro' ? 'image_intro' : 'image_fulltext';
             $floatVar = $tag->type == 'intro' ? 'float_intro' : 'float_fulltext';
             if (!empty($images->{$pictVar})) {
                 if ($images->{$floatVar} != 'right') {
                     $images->{$floatVar} = 'left';
                 }
                 $style = 'float:' . $images->{$floatVar} . ';padding-' . ($images->{$floatVar} == 'right' ? 'left' : 'right') . ':10px;padding-bottom:10px;';
                 if (!empty($tag->link)) {
                     $picthtml .= '<a href="' . $link . '" style="text-decoration:none" >';
                 }
                 $alt = '';
                 $altVar = $pictVar . '_alt';
                 if (!empty($images->{$altVar})) {
                     $alt = $images->{$altVar};
                 }
                 $picthtml .= '<img style="' . $style . '" alt="' . $alt . '" border="0" src="' . JURI::root() . $images->{$pictVar} . '" />';
                 if (!empty($tag->link)) {
                     $picthtml .= '</a>';
                 }
                 $contentText = $picthtml . $contentText;
             }
         }
         $result .= $contentText;
         if (file_exists(JPATH_SITE . DS . 'plugins' . DS . 'attachments') && empty($tag->noattach)) {
             $db->setQuery('SELECT display_name, url, filename FROM #__attachments WHERE parent_id = ' . intval($tag->id));
             $attachments = $db->loadObjectList();
             if (!empty($attachments)) {
                 $result .= '<br/>' . JText::_('ATTACHED_FILES') . ' :';
                 foreach ($attachments as $oneAttachment) {
                     $result .= '<br/><a href="' . $oneAttachment->url . '">' . (empty($oneAttachment->display_name) ? $oneAttachment->filename : $oneAttachment->display_name) . '</a>';
                 }
             }
         }
         if ($tag->type == "intro") {
             if (empty($tag->noreadmore) and (!empty($article->fulltext) or $forceReadMore)) {
                 $readMoreText = empty($tag->readmore) ? $this->readmore : $tag->readmore;
                 $result .= '<a style="text-decoration:none;" target="_blank" href="' . $link . '"><span class="acymailing_readmore">' . $readMoreText . '</span></a>';
             }
         }
         if (!empty($tag->share)) {
             $links = array();
             $shareOpt = explode(',', $tag->share);
             foreach ($shareOpt as $socialNetwork) {
                 $knownNetwork = true;
                 $socialNetwork = strtolower(trim($socialNetwork));
                 if ($socialNetwork == 'facebook') {
                     $linkShare = 'http://www.facebook.com/sharer.php?u=' . urlencode($link) . '&t=' . urlencode($article->title);
                     $picSrc = file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'facebook.png') ? 'media/com_acymailing/plugins/facebook.png' : 'media/com_acymailing/images/facebookshare.png';
                     $altText = 'Facebook';
                 } elseif ($socialNetwork == 'twitter') {
                     $text = JText::sprintf('SHARE_TEXT', $link);
                     $linkShare = 'http://twitter.com/home?status=' . urlencode($text);
                     $picSrc = file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'twitter.png') ? 'media/com_acymailing/plugins/twitter.png' : 'media/com_acymailing/images/twittershare.png';
                     $altText = 'Twitter';
                 } elseif ($socialNetwork == 'linkedin') {
                     $linkShare = 'http://www.linkedin.com/shareArticle?mini=true&url=' . urlencode($link) . '&title=' . urlencode($article->title);
                     $picSrc = file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'linkedin.png') ? 'media/com_acymailing/plugins/linkedin.png' : 'media/com_acymailing/images/linkedin.png';
                     $altText = 'LinkedIn';
                 } elseif ($socialNetwork == 'hyves') {
                     $linkShare = 'http://www.hyves-share.nl/button/respect/?hc_hint=1&url=' . urlencode($link) . '&title=' . urlencode($article->title);
                     $picSrc = file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'hyves.png') ? 'media/com_acymailing/plugins/hyves.png' : 'media/com_acymailing/images/hyvesshare.png';
                     $altText = 'Hyves';
                 } elseif ($socialNetwork == 'google') {
                     $linkShare = 'https://plus.google.com/share?url=' . urlencode($link);
                     $picSrc = file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'google.png') ? 'media/com_acymailing/plugins/google.png' : 'media/com_acymailing/images/google_plusshare.png';
                     $altText = 'Google+';
                 } elseif ($socialNetwork == 'mailto') {
                     $linkShare = 'mailto:?subject=' . urlencode($article->title) . '&body=' . urlencode($article->title . ' (' . $link . ')');
                     $picSrc = file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'mailto.png') ? 'media/com_acymailing/plugins/mailto.png' : 'media/com_acymailing/images/mailto.png';
                     $altText = 'MailTo';
                 } else {
                     $knownNetwork = false;
                     acymailing_display('Network not found: ' . $socialNetwork . '. Availables networks are facebook, twitter, linkedin, hyves, google and mailto.', 'warning');
                 }
                 if ($knownNetwork) {
                     array_push($links, '<a target="_blank" href="' . $linkShare . '" title="' . JText::sprintf('SOCIAL_SHARE', $altText) . '"><img alt="' . $altText . '" src="' . $picSrc . '" /></a>');
                 }
             }
             $result .= '<br/>' . (!empty($tag->sharetxt) ? $tag->sharetxt . ' ' : '') . implode(' ', $links);
         }
         $result = '<table cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td class="cat_' . @$article->catid . '" ><div class="acymailing_content" style="clear:both" >' . $result . '</div></td></tr></table>';
     }
     if (!empty($tag->theme)) {
         if (preg_match('#<img[^>]*>#Uis', $article->introtext . $article->fulltext, $pregresult)) {
             $cleanContent = strip_tags($result, '<p><br><span><ul><li><h1><h2><h3><h4><a>');
             $tdwidth = (empty($tag->maxwidth) ? $this->params->get('maxwidth', 150) : $tag->maxwidth) + 20;
             $result = '<div class="acymailing_content" style="clear:both"><table cellspacing="0" width="500" cellpadding="0" border="0" ><tr><td class="contentpicture" width="' . $tdwidth . '" valign="top" align="center"><a href="' . $link . '" target="_blank" style="border:0px;text-decoration:none">' . $pregresult[0] . '</a></td><td class="contenttext">' . $cleanContent . '</td></tr></table></div>';
         }
     }
     if (!empty($tag->cattitle) && $this->currentcatid != $article->catid) {
         $this->currentcatid = $article->catid;
         $result = '<h3 class="cattitle">' . $article->cattitle . '</h3>' . $result;
     }
     if (file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent_html.php')) {
         ob_start();
         require ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent_html.php';
         $result = ob_get_clean();
     } elseif (file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent.php')) {
         ob_start();
         require ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent.php';
         $result = ob_get_clean();
     }
     $result = $acypluginsHelper->removeJS($result);
     if (isset($tag->pict)) {
         $pictureHelper = acymailing_get('helper.acypict');
         $pictureHelper->maxHeight = empty($tag->maxheight) ? $this->params->get('maxheight', 150) : $tag->maxheight;
         $pictureHelper->maxWidth = empty($tag->maxwidth) ? $this->params->get('maxwidth', 150) : $tag->maxwidth;
         if ($tag->pict == '0') {
             $result = $pictureHelper->removePictures($result);
         } elseif ($tag->pict == 'resized') {
             if ($pictureHelper->available()) {
                 $result = $pictureHelper->resizePictures($result);
             } elseif ($app->isAdmin()) {
                 $app->enqueueMessage($pictureHelper->error, 'notice');
             }
         }
     }
     if (!empty($tag->maxchar) && strlen(strip_tags($result)) > $tag->maxchar) {
         $result = strip_tags($result);
         for ($i = $tag->maxchar; $i > 0; $i--) {
             if ($result[$i] == ' ') {
                 break;
             }
         }
         if (!empty($i)) {
             $result = substr($result, 0, $i) . @$tag->textafter;
         }
     }
     return $result;
 }
Esempio n. 4
0
 function _replaceContent(&$results, $i)
 {
     $acypluginsHelper = acymailing_get('helper.acyplugins');
     $arguments = explode('|', strip_tags($results[1][$i]));
     $tag = new stdClass();
     $tag->id = (int) $arguments[0];
     for ($i = 1, $a = count($arguments); $i < $a; $i++) {
         $args = explode(':', $arguments[$i]);
         $arg0 = trim($args[0]);
         if (empty($arg0)) {
             continue;
         }
         if (isset($args[1])) {
             $tag->{$arg0} = $args[1];
         } else {
             $tag->{$arg0} = true;
         }
     }
     if (!ACYMAILING_J16) {
         $query = 'SELECT a.*,b.name as authorname, c.alias as catalias, c.title as cattitle, s.alias as secalias, s.title as sectitle FROM ' . acymailing_table('content', false) . ' as a ';
         $query .= 'LEFT JOIN ' . acymailing_table('users', false) . ' as b ON a.created_by = b.id ';
         $query .= ' LEFT JOIN ' . acymailing_table('categories', false) . ' AS c ON c.id = a.catid ';
         $query .= ' LEFT JOIN ' . acymailing_table('sections', false) . ' AS s ON s.id = a.sectionid ';
         $query .= 'WHERE a.id = ' . $tag->id . ' LIMIT 1';
     } else {
         $query = 'SELECT a.*,b.name as authorname, c.alias as catalias, c.title as cattitle FROM ' . acymailing_table('content', false) . ' as a ';
         $query .= 'LEFT JOIN ' . acymailing_table('users', false) . ' as b ON a.created_by = b.id ';
         $query .= ' LEFT JOIN ' . acymailing_table('categories', false) . ' AS c ON c.id = a.catid ';
         $query .= 'WHERE a.id = ' . $tag->id . ' LIMIT 1';
     }
     $db = JFactory::getDBO();
     $db->setQuery($query);
     $article = $db->loadObject();
     $result = '';
     if (empty($article)) {
         $app = JFactory::getApplication();
         if ($app->isAdmin()) {
             $app->enqueueMessage('The article "' . $tag->id . '" could not be loaded', 'notice');
         }
         return $result;
     }
     if (!empty($tag->lang)) {
         $langid = (int) substr($tag->lang, strpos($tag->lang, ',') + 1);
         if (!empty($langid)) {
             $query = "SELECT reference_field, value FROM `#__jf_content` WHERE `published` = 1 AND `reference_table` = 'content' AND `language_id` = {$langid} AND `reference_id` = " . $tag->id;
             $db->setQuery($query);
             $translations = $db->loadObjectList();
             if (!empty($translations)) {
                 foreach ($translations as $oneTranslation) {
                     if (!empty($oneTranslation->value)) {
                         $translatedfield = $oneTranslation->reference_field;
                         $article->{$translatedfield} = $oneTranslation->value;
                     }
                 }
             }
         }
     }
     $acypluginsHelper = acymailing_get('helper.acyplugins');
     $acypluginsHelper->cleanHtml($article->introtext);
     $acypluginsHelper->cleanHtml($article->fulltext);
     if ($this->params->get('integration') == 'jreviews' and !empty($article->images)) {
         $firstpict = explode('|', trim(reset(explode("\n", $article->images))) . '|||||||');
         if (!empty($firstpict[0])) {
             $picturePath = file_exists(ACYMAILING_ROOT . 'images' . DS . 'stories' . DS . str_replace('/', DS, $firstpict[0])) ? ACYMAILING_LIVE . 'images/stories/' . $firstpict[0] : ACYMAILING_LIVE . 'images/' . $firstpict[0];
             $myPict = '<img src="' . $picturePath . '" alt="" hspace="5" style="margin:5px" align="left" border="' . intval($firstpict[5]) . '" />';
             $article->introtext = $myPict . $article->introtext;
         }
     }
     $completeId = $article->id;
     $completeCat = $article->catid;
     if (!empty($article->alias)) {
         $completeId .= ':' . $article->alias;
     }
     if (!empty($article->catalias)) {
         $completeCat .= ':' . $article->catalias;
     }
     if (empty($tag->itemid)) {
         if (!ACYMAILING_J16) {
             $completeSec = $article->sectionid;
             if (!empty($article->secalias)) {
                 $completeSec .= ':' . $article->secalias;
             }
             if ($this->params->get('integration') == 'flexicontent' && class_exists('FlexicontentHelperRoute')) {
                 $link = FlexicontentHelperRoute::getItemRoute($completeId, $completeCat, $completeSec);
             } else {
                 $link = ContentHelperRoute::getArticleRoute($completeId, $completeCat, $completeSec);
             }
         } else {
             if ($this->params->get('integration') == 'flexicontent' && class_exists('FlexicontentHelperRoute')) {
                 $link = FlexicontentHelperRoute::getItemRoute($completeId, $completeCat);
             } else {
                 $link = ContentHelperRoute::getArticleRoute($completeId, $completeCat);
             }
         }
     } else {
         $link = 'index.php?option=com_content&view=article&id=' . $completeId . '&catid=' . $completeCat;
     }
     if ($this->params->get('integration') == 'flexicontent' && !class_exists('FlexicontentHelperRoute')) {
         $link = 'index.php?option=com_flexicontent&view=items&id=' . $completeId;
     } elseif ($this->params->get('integration') == 'jaggyblog') {
         $link = 'index.php?option=com_jaggyblog&task=viewpost&id=' . $completeId;
     }
     if (!empty($tag->itemid)) {
         $link .= '&Itemid=' . $tag->itemid;
     }
     if (!empty($tag->lang)) {
         $link .= (strpos($link, '?') ? '&' : '?') . 'lang=' . substr($tag->lang, 0, strpos($tag->lang, ','));
     }
     if (!empty($tag->autologin)) {
         $link .= (strpos($link, '?') ? '&' : '?') . 'user={usertag:username|urlencode}&passw={usertag:password|urlencode}';
     }
     $link = acymailing_frontendLink($link);
     $styleTitle = '';
     $styleTitleEnd = '';
     if ($tag->type != "title") {
         $styleTitle = '<h2 class="acymailing_title">';
         $styleTitleEnd = '</h2>';
     }
     if (empty($tag->notitle)) {
         if (!empty($tag->link)) {
             $result .= '<a href="' . $link . '" ';
             if ($tag->type != "title") {
                 $result .= 'style="text-decoration:none" name="content-' . $article->id . '" ';
             }
             $result .= 'target="_blank" >' . $styleTitle . $article->title . $styleTitleEnd . '</a>';
         } else {
             $result .= $styleTitle . $article->title . $styleTitleEnd;
         }
     }
     if (!empty($tag->author)) {
         $authorName = empty($article->created_by_alias) ? $article->authorname : $article->created_by_alias;
         if ($tag->type == 'title') {
             $result .= '<br/>';
         }
         $result .= '<span class="authorname">' . $authorName . '</span><br/>';
     }
     if (!empty($tag->created)) {
         if ($tag->type == 'title') {
             $result .= '<br/>';
         }
         $dateFormat = empty($tag->dateformat) ? JText::_('DATE_FORMAT_LC2') : $tag->dateformat;
         $result .= '<span class="createddate">' . JHTML::_('date', $article->created, $dateFormat) . '</span><br/>';
     }
     if (!isset($tag->pict) and $tag->type != 'title') {
         if ($this->params->get('removepictures', 'never') == 'always' || ($this->params->get('removepictures', 'never') == 'intro' and $tag->type == "intro")) {
             $tag->pict = 0;
         } else {
             $tag->pict = 1;
         }
     }
     if (strpos($article->introtext, 'jseblod') !== false and file_exists(ACYMAILING_ROOT . 'plugins' . DS . 'content' . DS . 'cckjseblod.php')) {
         global $mainframe;
         include_once ACYMAILING_ROOT . 'plugins' . DS . 'content' . DS . 'cckjseblod.php';
         if (function_exists('plgContentCCKjSeblod')) {
             $paramsContent = JComponentHelper::getParams('com_content');
             $article->text = $article->introtext . $article->fulltext;
             plgContentCCKjSeblod($article, $paramsContent);
             $article->introtext = $article->text;
             $article->fulltext = '';
         }
     }
     if ($tag->type != "title") {
         $contentText = '';
         if ($tag->type == "intro") {
             $forceReadMore = false;
             $wordwrap = $this->params->get('wordwrap', 0);
             if (!empty($wordwrap) and empty($article->fulltext)) {
                 $newintrotext = strip_tags($article->introtext, '<br><img>');
                 $numChar = strlen($newintrotext);
                 if ($numChar > $wordwrap) {
                     $stop = strlen($newintrotext);
                     for ($i = $wordwrap; $i < $numChar; $i++) {
                         if ($newintrotext[$i] == " ") {
                             $stop = $i;
                             $forceReadMore = true;
                             break;
                         }
                     }
                     $article->introtext = substr($newintrotext, 0, $stop) . '...';
                 }
             }
         }
         if (ACYMAILING_J16 && !empty($article->images) && !empty($tag->pict)) {
             $images = json_decode($article->images);
             $pictVar = $tag->type == 'intro' ? 'image_intro' : 'image_fulltext';
             $floatVar = $tag->type == 'intro' ? 'float_intro' : 'float_fulltext';
             if (!empty($images->{$pictVar})) {
                 if ($images->{$floatVar} != 'right') {
                     $images->{$floatVar} = 'left';
                 }
                 $style = 'float:' . $images->{$floatVar} . ';padding-' . ($images->{$floatVar} == 'right' ? 'left' : 'right') . ':10px;padding-bottom:10px;';
                 if (!empty($tag->link)) {
                     $contentText .= '<a href="' . $link . '" style="text-decoration:none" >';
                 }
                 $contentText .= '<img style="' . $style . '" alt="" border="0" src="' . JURI::root() . $images->{$pictVar} . '" />';
                 if (!empty($tag->link)) {
                     $contentText .= '</a>';
                 }
             }
         }
         if (empty($article->fulltext) or $tag->type != "text") {
             $contentText .= $article->introtext;
         }
         if ($tag->type != "intro" and !empty($article->fulltext)) {
             if ($tag->type != "text" && !empty($article->introtext)) {
                 $contentText .= '<br />';
             }
             $contentText .= $article->fulltext;
         }
         if (!empty($tag->wrap)) {
             $newtext = strip_tags($contentText, '<br><img>');
             $numChar = strlen($newtext);
             if ($numChar > $tag->wrap) {
                 $stop = strlen($newtext);
                 for ($i = $tag->wrap; $i < $numChar; $i++) {
                     if ($newtext[$i] == " ") {
                         $stop = $i;
                         $forceReadMore = true;
                         break;
                     }
                 }
                 $contentText = substr($newtext, 0, $stop) . '...';
             }
         }
         if (!empty($tag->clean)) {
             $contentText = strip_tags($contentText, '<p><br><span><ul><li><h1><h2><h3><h4><a>');
         }
         $result .= $contentText;
         if ($tag->type == "intro") {
             if (empty($tag->noreadmore) and (!empty($article->fulltext) or $forceReadMore)) {
                 $readMoreText = empty($tag->readmore) ? JText::_('JOOMEXT_READ_MORE') : $tag->readmore;
                 $result .= '<a style="text-decoration:none;" target="_blank" href="' . $link . '"><span class="acymailing_readmore">' . $readMoreText . '</span></a>';
             }
         }
         $result = '<table cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td class="cat_' . @$article->catid . '" ><div class="acymailing_content" >' . $result . '</div></td></tr></table>';
     }
     if (!empty($tag->theme)) {
         if (preg_match('#<img[^>]*>#Uis', $article->introtext . $article->fulltext, $pregresult)) {
             $cleanContent = strip_tags($result, '<p><br><span><ul><li><h1><h2><h3><h4><a>');
             $tdwidth = (empty($tag->maxwidth) ? $this->params->get('maxwidth', 150) : $tag->maxwidth) + 20;
             $result = '<div class="acymailing_content"><table cellspacing="0" width="500" cellpadding="0" border="0" ><tr><td class="contentpicture" width="' . $tdwidth . '" valign="top" align="center"><a href="' . $link . '" target="_blank" style="border:0px;text-decoration:none">' . $pregresult[0] . '</a></td><td class="contenttext">' . $cleanContent . '</td></tr></table></div>';
         }
     }
     if (!empty($tag->cattitle) && $this->currentcatid != $article->catid) {
         $this->currentcatid = $article->catid;
         $result = '<h3 class="cattitle">' . $article->cattitle . '</h3>' . $result;
     }
     if (file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent_html.php')) {
         ob_start();
         require ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent_html.php';
         $result = ob_get_clean();
     } elseif (file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent.php')) {
         ob_start();
         require ACYMAILING_MEDIA . 'plugins' . DS . 'tagcontent.php';
         $result = ob_get_clean();
     }
     if ($tag->type != 'title' and $this->params->get('removejs', 'yes') == 'yes') {
         $result = $acypluginsHelper->removeJS($result);
     }
     if (isset($tag->pict)) {
         $pictureHelper = acymailing_get('helper.acypict');
         $pictureHelper->maxHeight = empty($tag->maxheight) ? $this->params->get('maxheight', 150) : $tag->maxheight;
         $pictureHelper->maxWidth = empty($tag->maxwidth) ? $this->params->get('maxwidth', 150) : $tag->maxwidth;
         if ($tag->pict == '0') {
             $result = $pictureHelper->removePictures($result);
         } elseif ($tag->pict == 'resized') {
             if ($pictureHelper->available()) {
                 $result = $pictureHelper->resizePictures($result);
             } elseif ($app->isAdmin()) {
                 $app->enqueueMessage($pictureHelper->error, 'notice');
             }
         }
     }
     return $result;
 }