Esempio n. 1
0
 /**
  * Generate the module
  */
 protected function compile()
 {
     /** @var \PageModel $objPage */
     global $objPage;
     if (!strlen($this->inColumn)) {
         $this->inColumn = 'main';
     }
     $intCount = 0;
     $articles = array();
     $id = $objPage->id;
     $this->Template->request = \Environment::get('request');
     // Show the articles of a different page
     if ($this->defineRoot && $this->rootPage > 0) {
         if (($objTarget = $this->objModel->getRelated('rootPage')) !== null) {
             $id = $objTarget->id;
             /** @var \PageModel $objTarget */
             $this->Template->request = $objTarget->getFrontendUrl();
         }
     }
     // Get published articles
     $objArticles = \ArticleModel::findPublishedByPidAndColumn($id, $this->inColumn);
     if ($objArticles === null) {
         return;
     }
     while ($objArticles->next()) {
         // Skip first article
         if (++$intCount <= intval($this->skipFirst)) {
             continue;
         }
         $cssID = deserialize($objArticles->cssID, true);
         $alias = $objArticles->alias ?: $objArticles->title;
         $articles[] = array('link' => $objArticles->title, 'title' => specialchars($objArticles->title), 'id' => $cssID[0] ?: standardize($alias), 'articleId' => $objArticles->id);
     }
     $this->Template->articles = $articles;
 }
 /**
  * Parse an item and return it as string
  * @param object
  * @param boolean
  * @param string
  * @param integer
  * @return string
  */
 protected function parseArticle($objArticle, $blnAddArchive = false, $strClass = '', $intCount = 0)
 {
     global $objPage;
     $arrCategories = deserialize($objArticle->categories, true);
     $objTemplate = new \FrontendTemplate($this->news_template);
     $objTemplate->setData($objArticle->row());
     $objTemplate->class = ($objArticle->cssClass != '' ? ' ' . $objArticle->cssClass : '') . $strClass;
     $objTemplate->newsHeadline = $objArticle->headline;
     $objTemplate->subHeadline = $objArticle->subheadline;
     $objTemplate->hasSubHeadline = $objArticle->subheadline ? true : false;
     $objTemplate->linkHeadline = $this->generateLink($objArticle->headline, $objArticle, $blnAddArchive);
     $objTemplate->more = $this->generateLink($GLOBALS['TL_LANG']['MSC']['more'], $objArticle, $blnAddArchive, true);
     $objTemplate->link = $this->generateNewsUrl($objArticle, $blnAddArchive);
     $objTemplate->linkTarget = $objArticle->target ? $objPage->outputFormat == 'xhtml' ? ' onclick="return !window.open(this.href)"' : ' target="_blank"' : '';
     $objTemplate->linkTitle = specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['readMore'], $objArticle->headline), true);
     $objTemplate->count = $intCount;
     // see #5708
     $objTemplate->text = '';
     $objTemplate->hasText = false;
     $objTemplate->hasTeaser = false;
     // print pdf
     if ($this->news_pdfJumpTo) {
         $objTemplate->showPdfButton = true;
         $pdfPage = \PageModel::findByPk($this->news_pdfJumpTo);
         $pdfArticle = \ArticleModel::findPublishedByPidAndColumn($this->news_pdfJumpTo, 'main');
         $options = deserialize($pdfArticle->printable);
         if (in_array('pdf', $options)) {
             $objTemplate->pdfArticleId = $pdfArticle->id;
         }
         $strUrl = \Controller::generateFrontendUrl($pdfPage->row());
         $objTemplate->pdfJumpTo = $strUrl;
     }
     $objArchive = \NewsArchiveModel::findByPk($objArticle->pid);
     $objTemplate->archive = $objArchive;
     $objTemplate->archive->title = $objTemplate->archive->displayTitle ? $objTemplate->archive->displayTitle : $objTemplate->archive->title;
     $objTemplate->archive->class = ModuleNewsListPlus::getArchiveClassFromTitle($objTemplate->archive->title, true);
     $objTemplate->archiveTitle = $objTemplate->archive->title;
     $arrCategoryTitles = array();
     if ($this->news_archiveTitleAppendCategories && !empty($arrCategories)) {
         $arrTitleCategories = array_intersect($arrCategories, deserialize($this->news_archiveTitleCategories, true));
         if (!empty($arrTitleCategories)) {
             $objTitleCategories = NewsCategoryModel::findPublishedByIds($arrTitleCategories);
             if ($objTitleCategories !== null) {
                 while ($objTitleCategories->next()) {
                     if ($objTitleCategories->frontendTitle) {
                         $arrCategoryTitles[$objTitleCategories->id] = $objTitleCategories->frontendTitle;
                         continue;
                     }
                     $arrCategoryTitles[$objTitleCategories->id] = $objTitleCategories->title;
                 }
                 $objTemplate->archiveTitle .= ' : ' . implode(' : ', $arrCategoryTitles);
             }
         }
     }
     // add tags
     $objTemplate->showTags = $this->news_showtags;
     if ($this->news_showtags && $this->news_template_modal && $this->Environment->isAjaxRequest) {
         $helper = new NewsPlusTagHelper();
         $tagsandlist = $helper->getTagsAndTaglistForIdAndTable($objArticle->id, 'tl_news', $this->tag_jumpTo);
         $tags = $tagsandlist['tags'];
         $taglist = $tagsandlist['taglist'];
         $objTemplate->showTagClass = $this->tag_named_class;
         $objTemplate->tags = $tags;
         $objTemplate->taglist = $taglist;
         $objTemplate->news = 'IN';
     }
     // nav
     $strUrl = '';
     $objArchive = \NewsArchiveModel::findByPk($objArticle->pid);
     if ($objArchive !== null && $objArchive->jumpTo && ($objTarget = $objArchive->getRelated('jumpTo')) !== null) {
         $strUrl = $this->generateFrontendUrl($objTarget->row(), \Config::get('useAutoItem') && !\Config::get('disableAlias') ? '/%s' : '/news/%s');
     }
     $objTemplate->nav = static::generateArrowNavigation($objArticle, $strUrl, $this->news_readerModule);
     // Clean the RTE output
     if ($objArticle->teaser != '') {
         $objTemplate->hasTeaser = true;
         if ($objPage->outputFormat == 'xhtml') {
             $objTemplate->teaser = \String::toXhtml($objArticle->teaser);
         } else {
             $objTemplate->teaser = \String::toHtml5($objArticle->teaser);
         }
         $objTemplate->teaser = \String::encodeEmail($objTemplate->teaser);
     }
     // Display the "read more" button for external/article links
     if ($objArticle->source != 'default') {
         $objTemplate->text = true;
         $objTemplate->hasText = true;
     } else {
         $id = $objArticle->id;
         $objTemplate->text = function () use($id) {
             $strText = '';
             $objElement = \ContentModel::findPublishedByPidAndTable($id, 'tl_news');
             if ($objElement !== null) {
                 while ($objElement->next()) {
                     $strText .= $this->getContentElement($objElement->current());
                 }
             }
             return $strText;
         };
         $objTemplate->hasText = \ContentModel::findPublishedByPidAndTable($objArticle->id, 'tl_news') !== null;
     }
     $arrMeta = $this->getMetaFields($objArticle);
     // Add the meta information
     $objTemplate->date = $arrMeta['date'];
     $objTemplate->hasMetaFields = !empty($arrMeta);
     $objTemplate->numberOfComments = $arrMeta['ccount'];
     $objTemplate->commentCount = $arrMeta['comments'];
     $objTemplate->timestamp = $objArticle->date;
     $objTemplate->author = $arrMeta['author'];
     $objTemplate->datetime = date('Y-m-d\\TH:i:sP', $objArticle->date);
     $objTemplate->addImage = false;
     // Add an image
     if ($objArticle->addImage && $objArticle->singleSRC != '') {
         $objModel = \FilesModel::findByUuid($objArticle->singleSRC);
         if ($objModel === null) {
             if (!\Validator::isUuid($objArticle->singleSRC)) {
                 $objTemplate->text = '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
             }
         } elseif (is_file(TL_ROOT . '/' . $objModel->path)) {
             // Do not override the field now that we have a model registry (see #6303)
             $arrArticle = $objArticle->row();
             // Override the default image size
             if ($this->imgSize != '') {
                 $size = deserialize($this->imgSize);
                 if ($size[0] > 0 || $size[1] > 0 || is_numeric($size[2])) {
                     $arrArticle['size'] = $this->imgSize;
                 }
             }
             $arrArticle['singleSRC'] = $objModel->path;
             $this->addImageToTemplate($objTemplate, $arrArticle);
         }
     }
     $objTemplate->enclosure = array();
     // Add enclosures
     if ($objArticle->addEnclosure) {
         $this->addEnclosuresToTemplate($objTemplate, $objArticle->row());
     }
     if (in_array('share', \ModuleLoader::getActive())) {
         $objArticle->title = $objArticle->headline;
         $objShare = new \HeimrichHannot\Share\Share($this->objModel, $objArticle);
         $objTemplate->share = $objShare->generate();
     }
     // Modal
     if ($this->news_showInModal && $objArticle->source == 'default' && $this->news_readerModule) {
         $objTemplate->modal = true;
         $objTemplate->modalTarget = '#' . NewsPlusHelper::getCSSModalID($this->news_readerModule);
     }
     // HOOK: add custom logic
     if (isset($GLOBALS['TL_HOOKS']['parseArticles']) && is_array($GLOBALS['TL_HOOKS']['parseArticles'])) {
         foreach ($GLOBALS['TL_HOOKS']['parseArticles'] as $callback) {
             $this->import($callback[0]);
             $this->{$callback}[0]->{$callback}[1]($objTemplate, $objArticle->row(), $this);
         }
     }
     return $objTemplate->parse();
 }
Esempio n. 3
0
 /**
  * Generate a front end module and return it as string
  * 
  * @param mixed  $intId     A module ID or a Model object
  * @param string $strColumn The name of the column
  * 
  * @return string The module HTML markup
  */
 protected function getFrontendModule($intId, $strColumn = 'main')
 {
     if (!is_object($intId) && !strlen($intId)) {
         return '';
     }
     global $objPage;
     // Articles
     if ($intId == 0) {
         // Show a particular article only
         if (\Input::get('articles') && $objPage->type == 'regular') {
             list($strSection, $strArticle) = explode(':', \Input::get('articles'));
             if ($strArticle === null) {
                 $strArticle = $strSection;
                 $strSection = 'main';
             }
             if ($strSection == $strColumn) {
                 $strBuffer = $this->getArticle($strArticle);
                 // Send a 404 header if the article does not exist
                 if ($strBuffer === false) {
                     // Do not index the page
                     $objPage->noSearch = 1;
                     $objPage->cache = 0;
                     header('HTTP/1.1 404 Not Found');
                     return '<p class="error">' . sprintf($GLOBALS['TL_LANG']['MSC']['invalidPage'], $strArticle) . '</p>';
                 }
                 return $strBuffer;
             }
         } elseif (in_array('article_raster_designer', $this->Config->getActiveModules())) {
             return \RasterDesigner::load($objPage->id, $strColumn);
         } else {
             $objArticles = \ArticleModel::findPublishedByPidAndColumn($objPage->id, $strColumn);
             if ($objArticles === null) {
                 return '';
             }
             $return = '';
             $blnMultiMode = $objArticles->count() > 1;
             while ($objArticles->next()) {
                 $return .= $this->getArticle($objArticles, $blnMultiMode, false, $strColumn);
             }
             return $return;
         }
     } else {
         if (is_object($intId)) {
             $objRow = $intId;
         } else {
             $objRow = \ModuleModel::findByPk($intId);
         }
         if ($objRow === null) {
             return '';
         }
         // Show to guests only
         if ($objRow->guests && FE_USER_LOGGED_IN && !BE_USER_LOGGED_IN && !$objRow->protected) {
             return '';
         }
         // Protected element
         if (!BE_USER_LOGGED_IN && $objRow->protected) {
             if (!FE_USER_LOGGED_IN) {
                 return '';
             }
             $this->import('FrontendUser', 'User');
             $groups = deserialize($objRow->groups);
             if (!is_array($groups) || empty($groups) || !count(array_intersect($groups, $this->User->groups))) {
                 return '';
             }
         }
         $strClass = $this->findFrontendModule($objRow->type);
         // Return if the class does not exist
         if (!$this->classFileExists($strClass)) {
             $this->log('Module class "' . $GLOBALS['FE_MOD'][$objRow->type] . '" (module "' . $objRow->type . '") does not exist', 'Controller getFrontendModule()', TL_ERROR);
             return '';
         }
         $objRow->typePrefix = 'mod_';
         $objModule = new $strClass($objRow, $strColumn);
         $strBuffer = $objModule->generate();
         // HOOK: add custom logic
         if (isset($GLOBALS['TL_HOOKS']['getFrontendModule']) && is_array($GLOBALS['TL_HOOKS']['getFrontendModule'])) {
             foreach ($GLOBALS['TL_HOOKS']['getFrontendModule'] as $callback) {
                 $this->import($callback[0]);
                 $strBuffer = $this->{$callback}[0]->{$callback}[1]($objRow, $strBuffer);
             }
         }
         // Disable indexing if protected
         if ($objModule->protected && !preg_match('/^\\s*<!-- indexer::stop/i', $strBuffer)) {
             $strBuffer = "\n<!-- indexer::stop -->" . $strBuffer . "<!-- indexer::continue -->\n";
         }
         return $strBuffer;
     }
     return '';
 }
 /**
  * Generate a front end module and return it as string
  *
  * @param mixed  $intId     A module ID or a Model object
  * @param string $strColumn The name of the column
  *
  * @return string The module HTML markup
  */
 public static function getFrontendModule($intId, $strColumn = 'main')
 {
     if (!is_object($intId) && !strlen($intId)) {
         return '';
     }
     /** @var \PageModel $objPage */
     global $objPage;
     // Articles
     if (!is_object($intId) && $intId == 0) {
         // Show a particular article only
         if ($objPage->type == 'regular' && \Input::get('articles')) {
             list($strSection, $strArticle) = explode(':', \Input::get('articles'));
             if ($strArticle === null) {
                 $strArticle = $strSection;
                 $strSection = 'main';
             }
             if ($strSection == $strColumn) {
                 $objArticle = \ArticleModel::findByIdOrAliasAndPid($strArticle, $objPage->id);
                 // Send a 404 header if the article does not exist
                 if (null === $objArticle) {
                     /** @var \PageError404 $objHandler */
                     $objHandler = new $GLOBALS['TL_PTY']['error_404']();
                     $objHandler->generate($objPage->id);
                 }
                 // Add the "first" and "last" classes (see #2583)
                 $objArticle->classes = array('first', 'last');
                 return static::getArticle($objArticle);
             }
         }
         // HOOK: trigger the article_raster_designer extension
         if (in_array('article_raster_designer', \ModuleLoader::getActive())) {
             return \RasterDesigner::load($objPage->id, $strColumn);
         }
         // Show all articles (no else block here, see #4740)
         $objArticles = \ArticleModel::findPublishedByPidAndColumn($objPage->id, $strColumn);
         if ($objArticles === null) {
             return '';
         }
         $return = '';
         $intCount = 0;
         $blnMultiMode = $objArticles->count() > 1;
         $intLast = $objArticles->count() - 1;
         while ($objArticles->next()) {
             /** @var \ArticleModel $objRow */
             $objRow = $objArticles->current();
             // Add the "first" and "last" classes (see #2583)
             if ($intCount == 0 || $intCount == $intLast) {
                 $arrCss = array();
                 if ($intCount == 0) {
                     $arrCss[] = 'first';
                 }
                 if ($intCount == $intLast) {
                     $arrCss[] = 'last';
                 }
                 $objRow->classes = $arrCss;
             }
             $return .= static::getArticle($objRow, $blnMultiMode, false, $strColumn);
             ++$intCount;
         }
         return $return;
     } else {
         if (is_object($intId)) {
             $objRow = $intId;
         } else {
             $objRow = \ModuleModel::findByPk($intId);
             if ($objRow === null) {
                 return '';
             }
         }
         // Check the visibility (see #6311)
         if (!static::isVisibleElement($objRow)) {
             return '';
         }
         $strClass = \Module::findClass($objRow->type);
         // Return if the class does not exist
         if (!class_exists($strClass)) {
             static::log('Module class "' . $strClass . '" (module "' . $objRow->type . '") does not exist', __METHOD__, TL_ERROR);
             return '';
         }
         $objRow->typePrefix = 'mod_';
         /** @var \Module $objModule */
         $objModule = new $strClass($objRow, $strColumn);
         $strBuffer = $objModule->generate();
         // HOOK: add custom logic
         if (isset($GLOBALS['TL_HOOKS']['getFrontendModule']) && is_array($GLOBALS['TL_HOOKS']['getFrontendModule'])) {
             foreach ($GLOBALS['TL_HOOKS']['getFrontendModule'] as $callback) {
                 $strBuffer = static::importStatic($callback[0])->{$callback[1]}($objRow, $strBuffer, $objModule);
             }
         }
         // Disable indexing if protected
         if ($objModule->protected && !preg_match('/^\\s*<!-- indexer::stop/', $strBuffer)) {
             $strBuffer = "\n<!-- indexer::stop -->" . $strBuffer . "<!-- indexer::continue -->\n";
         }
         return $strBuffer;
     }
 }
Esempio n. 5
0
 /**
  * Generate a front end module and return it as HTML string.
  *
  * @param int
  * @param string
  *
  * @return string
  */
 protected function getPageFrontendModule($page, $moduleId, $columnName = 'main', $inheritableOnly = false)
 {
     if (!is_object($moduleId) && !strlen($moduleId)) {
         return '';
     }
     // Articles
     if ($moduleId == 0) {
         // Show a particular article only
         if ($page->type == 'regular' && \Input::get('articles')) {
             list($sectionName, $articleName) = explode(':', \Input::get('articles'));
             if ($articleName === null) {
                 $articleName = $sectionName;
                 $sectionName = 'main';
             }
             if ($sectionName == $columnName) {
                 $article = \ArticleModel::findByIdOrAliasAndPid($articleName, $page->id);
                 // Send a 404 header if the article does not exist
                 if ($article === null) {
                     // Do not index the page
                     $page->noSearch = 1;
                     $page->cache = 0;
                     header('HTTP/1.1 404 Not Found');
                     return '<p class="error">' . sprintf($GLOBALS['TL_LANG']['MSC']['invalidPage'], $articleName) . '</p>';
                 }
                 if (!$inheritableOnly || $article->inheritable) {
                     // Add the "first" and "last" classes (see #2583)
                     $article->classes = array('first', 'last');
                     return $this->getArticle($article);
                 }
                 return '';
             }
         }
         // HOOK: trigger the article_raster_designer extension
         if (in_array('article_raster_designer', \ModuleLoader::getActive())) {
             return \RasterDesigner::load($page->id, $columnName);
         }
         // Show all articles (no else block here, see #4740)
         $articleCollection = \ArticleModel::findPublishedByPidAndColumn($page->id, $columnName);
         if ($articleCollection === null) {
             return '';
         }
         $return = '';
         $intCount = 0;
         $blnMultiMode = $articleCollection->count() > 1;
         $intLast = $articleCollection->count() - 1;
         while ($articleCollection->next()) {
             if ($inheritableOnly && !$articleCollection->inheritable) {
                 continue;
             }
             $articleRow = $articleCollection->current();
             // Add the "first" and "last" classes (see #2583)
             if ($intCount == 0 || $intCount == $intLast) {
                 $cssClasses = array();
                 if ($intCount == 0) {
                     $cssClasses[] = 'first';
                 }
                 if ($intCount == $intLast) {
                     $cssClasses[] = 'last';
                 }
                 $articleRow->classes = $cssClasses;
             }
             $return .= $this->getArticle($articleRow, $blnMultiMode, false, $columnName);
             ++$intCount;
         }
         return $return;
     } else {
         if (is_object($moduleId)) {
             $articleRow = $moduleId;
         } else {
             $articleRow = \ModuleModel::findByPk($moduleId);
             if ($articleRow === null) {
                 return '';
             }
         }
         // Check the visibility (see #6311)
         if (!static::isVisibleElement($articleRow)) {
             return '';
         }
         $moduleClassName = \Module::findClass($articleRow->type);
         // Return if the class does not exist
         if (!class_exists($moduleClassName)) {
             $this->log('Module class "' . $moduleClassName . '" (module "' . $articleRow->type . '") does not exist', __METHOD__, TL_ERROR);
             return '';
         }
         $articleRow->typePrefix = 'mod_';
         /** @var \Module $module */
         $module = new $moduleClassName($articleRow, $columnName);
         $buffer = $module->generate();
         // HOOK: add custom logic
         if (isset($GLOBALS['TL_HOOKS']['getFrontendModule']) && is_array($GLOBALS['TL_HOOKS']['getFrontendModule'])) {
             foreach ($GLOBALS['TL_HOOKS']['getFrontendModule'] as $callback) {
                 $this->import($callback[0]);
                 $buffer = $this->{$callback}[0]->{$callback}[1]($articleRow, $buffer, $module);
             }
         }
         // Disable indexing if protected
         if ($module->protected && !preg_match('/^\\s*<!-- indexer::stop/', $buffer)) {
             $buffer = "\n<!-- indexer::stop -->" . $buffer . "<!-- indexer::continue -->\n";
         }
         return $buffer;
     }
 }
Esempio n. 6
0
 /**
  * Edit the Frontend Template
  */
 public function parseCustomizeFrontendTemplate($strContent, $strTemplate)
 {
     global $objPage;
     $isFullpage = $this->isFullPageEnabled($objPage);
     if ($strTemplate == "mod_article") {
         $sectionHeaderID = 3;
         // TODO: verwaltbar machen!!!
         $sectionFooterID = 4;
         $objArticle = NULL;
         $articleClass = array();
         $articlePattern = '/<div([A-Za-z0-9\\s\\-_=;",:\\.\\(\\)\'#\\/%]{0,})class="mod_article([A-Za-z0-9\\s\\-_]{0,})"([A-Za-z0-9\\s\\-_=;",:\\.\\(\\)\'#\\/%]{0,})>/';
         preg_match_all('/id="([A-Za-z0-9\\-_]{0,})"/', $strContent, $idMatches);
         if (is_array($idMatches) && count($idMatches[0]) > 0) {
             $objArticle = \ArticleModel::findByIdOrAlias($idMatches[1][0]);
         }
         if ($isFullpage) {
             if ($objArticle) {
                 if ($objArticle->enableSectionHeader) {
                     $sectionHeaderID = $objArticle->sectionHeaderModule;
                     $strContent = preg_replace($articlePattern, '<div$1class="mod_article$2"$3><div class="header section-header">{{insert_module::' . $sectionHeaderID . '}}</div>', $strContent);
                 }
                 if ($objArticle->enableSectionFooter) {
                     $sectionFooterID = $objArticle->sectionFooterModule;
                     $strContent = preg_replace('/<\\/div>$/', '<div class="footer section-footer">{{insert_module::' . $sectionFooterID . '}}</div></div>', $strContent);
                 }
                 if ($objArticle->enableOverlay) {
                     $strOverlayContent = '';
                     if ($objArticle->showTitleInOverlay) {
                         $strArticleTitle = $objArticle->title;
                         if (strlen($objArticle->alt_title)) {
                             $strArticleTitle = $objArticle->alt_title;
                         }
                         $strOverlayContent = '<div class="overlay-title"><div class="title-inner">' . $strArticleTitle . '</div></div>';
                     }
                     $strClass = "";
                     if ($objArticle->overlayTransparent) {
                         $strClass = " overlay-trans";
                     }
                     $strOverlayTags = '<div class="show-overlay"></div><div class="overlay article-overlay' . $strClass . ' shown"><div class="close"></div>' . $strOverlayContent . '</div>';
                     $strContent = preg_replace($articlePattern, '<div$1class="mod_article has-overlay$2"$3>', $strContent);
                     $strContent = preg_replace('/<\\/div>$/', $strOverlayTags . '</div>', $strContent);
                 }
                 if ($objArticle->enableFullpageNavigation) {
                     $navNext = "";
                     $navPrev = "";
                     if ($objPage->fullpageDirection == "horizontal") {
                         // TODO NAVI RIGHT UND LEFT!!
                     } else {
                         $navNext = '<div class="navigation-top" onClick="DPS.Fullpage.sectionBack(this);"></div>';
                         $navPrev = '<div class="navigation-bottom" onClick="DPS.Fullpage.sectionForward(this);"></div>';
                     }
                     $navigationTags = '<div class="fullpage-navigation">' . $navNext . $navPrev . '</div>';
                     //						$strContent			= preg_replace($articlePattern, '', $strContent);
                     $strContent = preg_replace('/<\\/div>$/', $navigationTags . '</div>', $strContent);
                 }
             }
             if ($objPage->fullpageDirection == "horizontal") {
                 $articleClass[] = 'slide';
             } else {
                 $articleClass[] = 'section';
             }
             //				$strContent = preg_replace('/<div([A-Za-z0-9\s\-_=;",:\\.\(\)\'#\/%]{0,})class="mod_article([A-Za-z0-9\s\-_]{0,})"([A-Za-z0-9\s\-_=;",:\\.\(\)\'#\/%]{0,})>/', '<div$1class="mod_article$2"$3><div class="article-inner">', $strContent);
             //				$strContent = $strContent . '</div>';
         }
         if ($objArticle) {
             if ($objArticle->enableBackgroundImage && $objArticle->singleSRC != "") {
                 $objFile = \FilesModel::findByUuid($objArticle->singleSRC);
                 if ($objFile === null && !\Validator::isUuid($objArticle->singleSRC)) {
                     $strContent = '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>' . $strContent;
                 }
                 if ($objFile && is_file(TL_ROOT . '/' . $objFile->path)) {
                     preg_match_all($articlePattern, $strContent, $arrArticleMatches);
                     if (is_array($arrArticleMatches[0]) && count($arrArticleMatches[0]) > 0) {
                         $bgPosition = str_replace('_', ' ', $objArticle->backgroundImagePosition);
                         if (!$bgPosition) {
                             $bgPosition = "center center";
                         }
                         if (preg_match('/style="/', $arrArticleMatches[0][0])) {
                             $styles = 'background-image:url(\'' . $objFile->path . '\');background-position:' . $bgPosition . ';';
                             $replStyles = '';
                             if (preg_match('/style="/', $arrArticleMatches[1][0])) {
                                 $replStyles = str_replace('style="', 'style="' . $styles, $arrArticleMatches[1][0]);
                             } elseif (preg_match('/style="/', $arrArticleMatches[3][0])) {
                                 $replStyles = str_replace('style="', 'style="' . $styles, $arrArticleMatches[3][0]);
                             }
                             $strContent = preg_replace($articlePattern, '<div' . $replStyles . 'class="mod_article$2"$3>', $strContent);
                         } else {
                             $strContent = preg_replace($articlePattern, '<div$1class="mod_article$2" style="background-image:url(\'' . $objFile->path . '\');background-position:' . $bgPosition . ';"$3>', $strContent);
                         }
                         $strContent = preg_replace($articlePattern, '<div$1class="mod_article has-background-image bg-fixed bg-image bg-cover$2"$3">', $strContent);
                     }
                 }
             }
             if ($objArticle->enableNavigation) {
                 $articleNavigationTag = '<div class="navigation-container">';
                 $objAllArticles = \ArticleModel::findBy(array("pid=?", "inColumn=?", "published=?"), array($objArticle->pid, "main", "1"), array("order" => "sorting"));
                 $nextArticle = false;
                 $prevArticle = false;
                 if ($objAllArticles) {
                     $isActive = false;
                     $setNext = false;
                     while ($objAllArticles->next()) {
                         $objCurrentArticle = $objAllArticles->current();
                         if ($objCurrentArticle->id == $objArticle->id) {
                             $isActive = true;
                         } else {
                             if (!$isActive) {
                                 $prevArticle = $objCurrentArticle;
                             } else {
                                 if (!$setNext) {
                                     $nextArticle = $objCurrentArticle;
                                     $setNext = true;
                                     break;
                                 }
                             }
                         }
                     }
                 }
                 //					if( $objArticle->navNext && $nextArticle )
                 if ($objArticle->navNext) {
                     //						$nextAlias = $nextArticle->alias;
                     $nextAlias = $objArticle->alias;
                     $articleNavigationTag .= '<div class="nav-item nav-next"><a href="javascript:void(0);" data-anker="' . $nextAlias . '" onclick="DPS.Content.scrollTo(this)"></a></div>';
                 }
                 if ($objArticle->navPrev && $prevArticle) {
                     $prevAlias = $prevArticle->alias;
                     $articleNavigationTag .= '<div class="nav-item nav-prev"><a href="javascript:void(0);" data-anker="' . $prevAlias . '" onclick="DPS.Content.scrollTo(this)"></a></div>';
                 }
                 $articleNavigationTag .= '</div>';
                 $strContent = preg_replace('/<\\/div>$/', $articleNavigationTag . '</div>', $strContent);
             }
             $objArticles = \ArticleModel::findPublishedByPidAndColumn($objPage->id, "main");
             if ($objArticles) {
                 $index = 0;
                 while ($objArticles->next()) {
                     if ($objArticle->id == $objArticles->id) {
                         break;
                     }
                     $index++;
                 }
                 if ($index == 1) {
                     $articleClass[] = 'secondArticle';
                 }
                 $articleClass[] = 'article-' . ($index + 1);
                 if ($objArticles->count() > 1) {
                     $strContent = preg_replace($articlePattern, '<div$1class="mod_article$2"$3 data-index="' . $index . '">', $strContent);
                 }
             }
         }
         if (is_array($articleClass) && count($articleClass) > 0) {
             $strContent = preg_replace('/class="mod_article/', 'class="mod_article ' . implode(" ", $articleClass), $strContent);
         }
         $addAroundDivStart = "";
         $addAroundDivEnd = "";
         $articleClasses = deserialize($objArticle->cssID, true);
         if (preg_match('/add-bg/', $articleClasses[1])) {
             $addAroundDivStart = '<div class="background-outer bg-image bg-cover bg-scroll" data-0="background-position:0px 0px;"><div class="background-inner bg-image bg-cover bg-scroll" data-0="background-position:0px 0px;">';
             $addAroundDivEnd = '</div></div>';
         }
         $strContent = preg_replace('/<div([A-Za-z0-9\\s\\-_="\'.,;:\\(\\)\\/#]{0,})class="mod_article([A-Za-z0-9\\s\\-_\\{\\}\\(\\)\']{0,})"([A-Za-z0-9\\s\\-_="\'.,;:\\(\\)\\/#%]{0,})>/', '<div$1class="mod_article$2"$3>' . $addAroundDivStart . '<div class="article-inside">', $strContent);
         $strContent = preg_replace('/<\\/div>$/', '</div></div>' . $addAroundDivEnd, $strContent);
     } elseif ($strTemplate == "ce_image") {
         preg_match_all('/class="ce_image([a-zA-Z0-9\\s\\-_]{0,})"/', $strContent, $classMatches);
         if (is_array($classMatches) && count($classMatches[0]) > 0) {
             if (preg_match("/start-logo/", $classMatches[1][0])) {
                 preg_match_all('/<img([a-zA-Z0-9\\s\\-_=:;"\'\\(\\).\\/,\\%#]{0,})height="([0-9\\s\\-_]{0,4})"/', $strContent, $imgMatches);
                 if (is_array($imgMatches) && count($imgMatches[0]) > 0) {
                     $marginTop = ceil((int) $imgMatches[2][0] / 2);
                     if (preg_match('/margint-top/', $strContent)) {
                         $strContent = preg_replace('/margin-top:(\\s)([0-9\\-]{0,5})px;/', 'margin-top:-' . $marginTop . 'px"', $strContent);
                     } else {
                         $strContent = preg_replace('/<figure class="image_container"/', '<figure class="image_container" style="margin-top:-' . $marginTop . 'px"', $strContent);
                     }
                 }
             }
         }
     } elseif ($strTemplate == "ce_hyperlink") {
         if (preg_match("/link-arrow/", $strContent)) {
             preg_match_all('/href="([0-9]{0,})"/', $strContent, $hrefMatches);
             if (is_array($hrefMatches) && count($hrefMatches[0]) > 0) {
                 $indexID = $hrefMatches[1][0];
                 $strContent = preg_replace('/class="hyperlink_txt/', 'data-index="' . $indexID . '" class="hyperlink_txt', $strContent);
                 $strContent = preg_replace('/href="' . $indexID . '"/', 'href="javascript:void(0);"', $strContent);
             }
             $strContent = preg_replace('/class="hyperlink_txt/', 'class="hyperlink_txt toSlide', $strContent);
         }
     } elseif ($strTemplate == "mod_navigation") {
         preg_match_all('/id="skipNavigation([0-9]{0,})"/', $strContent, $navMatches);
         if (is_array($navMatches[0]) && count($navMatches[0]) > 0) {
             $objModule = \ModuleModel::findByPk($navMatches[1][0]);
             if ($objModule) {
                 if (!$objModule->hideSubtitles) {
                     preg_match_all('/<li([A-Za-z0-9\\s\\-_:;.,\\(\\)#"\'=\\/]{0,})><(a|span)([A-Za-z0-9\\s\\-_:;.,\\/\\(\\)#"\'=]{0,})>([A-Za-z0-9\\s\\-.:;,#+&\\[\\]\\(\\)=ßöäüÖÄÜ?!%$"\']{0,})<\\/(a|span)><\\/li>/', $strContent, $navListMatches);
                     if (is_array($navListMatches[0]) && count($navListMatches[0]) > 0) {
                         foreach ($navListMatches[3] as $index => $strLink) {
                             if ($navListMatches[2][$index] == "span") {
                                 $linkTitle = $navListMatches[4][$index];
                                 $objLinkPage = \PageModel::findBy("title", $linkTitle);
                                 if ($objLinkPage) {
                                     if ($objLinkPage->count() > 1) {
                                         $objLinkPage = \PageModel::findByPk($this->getPageIdFromUrl());
                                     }
                                     $subtitle = '<span class="subtitle">' . ($objLinkPage->subtitlePosition == "after" ? ' ' : '') . trim($objLinkPage->subtitle) . ($objLinkPage->subtitlePosition == "before" ? ' ' : '') . '</span>';
                                     if (strlen(trim($objLinkPage->subtitle))) {
                                         if ($objLinkPage->subtitlePosition == "before") {
                                             $strContent = preg_replace('/' . preg_quote($navListMatches[0][$index], "/") . '/', '<li' . $navListMatches[1][$index] . '><' . $navListMatches[2][$index] . $navListMatches[3][$index] . '>' . $subtitle . $navListMatches[4][$index] . '</' . $navListMatches[5][$index] . '></li>', $strContent);
                                         } elseif ($objLinkPage->subtitlePosition == "after") {
                                             $strContent = preg_replace('/' . preg_quote($navListMatches[0][$index], "/") . '/', '<li' . $navListMatches[1][$index] . '><' . $navListMatches[2][$index] . $navListMatches[3][$index] . '>' . $navListMatches[4][$index] . $subtitle . '</' . $navListMatches[5][$index] . '></li>', $strContent);
                                         }
                                     }
                                 }
                             } else {
                                 preg_match_all('/href="([A-Za-z0-9\\-\\/._#&]{0,})"/', $strLink, $linkMatches);
                                 if (is_array($linkMatches[0]) && count($linkMatches[0]) > 0) {
                                     $linkParts = explode("/", $linkMatches[1][0]);
                                     $linkPart = str_replace('.html', '', array_pop($linkParts));
                                     $objLinkPage = \PageModel::findByIdOrAlias($linkPart);
                                     $subtitle = '<span class="subtitle">' . ($objLinkPage->subtitlePosition == "after" ? ' ' : '') . trim($objLinkPage->subtitle) . ($objLinkPage->subtitlePosition == "before" ? ' ' : '') . '</span>';
                                     if ($objLinkPage) {
                                         if (strlen(trim($objLinkPage->subtitle))) {
                                             if ($objLinkPage->subtitlePosition == "before") {
                                                 $strContent = preg_replace('/' . preg_quote($navListMatches[0][$index], "/") . '/', '<li' . $navListMatches[1][$index] . '><' . $navListMatches[2][$index] . $navListMatches[3][$index] . '>' . $subtitle . $navListMatches[4][$index] . '</' . $navListMatches[5][$index] . '></li>', $strContent);
                                             } elseif ($objLinkPage->subtitlePosition == "after") {
                                                 $strContent = preg_replace('/' . preg_quote($navListMatches[0][$index], "/") . '/', '<li' . $navListMatches[1][$index] . '><' . $navListMatches[2][$index] . $navListMatches[3][$index] . '>' . $navListMatches[4][$index] . $subtitle . '</' . $navListMatches[5][$index] . '></li>', $strContent);
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $strContent;
 }