protected function compile()
 {
     // create local event dispatcher and provider
     $eventDispatcher = new EventDispatcher();
     $eventDispatcher->addSubscriber(new ArticleProvider());
     $eventDispatcher->addSubscriber(new ContentProvider());
     // create the event driven menu
     $eventDrivenItemFactory = new EventDrivenItemFactory($eventDispatcher, XNavigationEvents::CREATE_ITEM, XNavigationEvents::COLLECT_ITEMS);
     $item = new Item();
     $items = $item->getChildren();
     if ($this->toc_source == 'sections') {
         global $objPage;
         $sections = deserialize($this->toc_sections, true);
         $where = array();
         $where[] = '(' . implode(' OR ', array_fill(0, count($sections), 'inColumn=?')) . ')';
         $where[] = 'pid=?';
         $args = array_merge($sections, array($objPage->id), $sections);
         $order = 'FIELD(tl_article.inColumn,' . implode(',', array_fill(0, count($sections), '?')) . ')';
         $articles = \ArticleModel::findBy($where, $args, array('order' => $order));
         if ($articles) {
             foreach ($articles as $article) {
                 /** @var \ArticleModel $article */
                 $item = $eventDrivenItemFactory->createItem('article', $article->id);
                 if ($this->toc_include_articles) {
                     $items->add($item);
                 } else {
                     $items->addAll($item->getChildren()->toArray());
                 }
             }
         }
     }
     if ($this->toc_source == 'articles') {
         $articleIds = deserialize($this->toc_articles, true);
         foreach ($articleIds as $articleId) {
             $item = $eventDrivenItemFactory->createItem('article', $articleId);
             if ($this->toc_include_articles) {
                 $items->add($item);
             } else {
                 $items->addAll($item->getChildren()->toArray());
             }
         }
     }
     $this->Template->xnav_template = $this->xnavigation_template;
     $this->Template->items = $items;
     $this->Template->item_condition = $this->createItemCondition();
     $this->Template->link_condition = $this->createLinkCondition();
 }
 public function collectItems(CollectItemsEvent $event)
 {
     $item = $event->getParentItem();
     if ($item->getType() == 'page') {
         if (empty($this->columns)) {
             return;
         }
         $columnWildcards = array_fill(0, count($this->columns), '?');
         $columnWildcards = implode(',', $columnWildcards);
         $t = \ArticleModel::getTable();
         $arrColumns = array("{$t}.pid=?", "{$t}.inColumn IN ({$columnWildcards})");
         if (!BE_USER_LOGGED_IN) {
             $time = time();
             $arrColumns[] = "({$t}.start='' OR {$t}.start<{$time}) AND ({$t}.stop='' OR {$t}.stop>{$time}) AND {$t}.published=1";
         }
         $articles = \ArticleModel::findBy($arrColumns, array_merge(array($item->getName()), $this->columns), array('order' => 'sorting'));
         if ($articles) {
             $factory = $event->getFactory();
             foreach ($articles as $article) {
                 $factory->createItem('article', $article->id, $item);
             }
         }
     }
 }
Esempio n. 3
0
 public function generateUrl($arrPages)
 {
     $arrPages = array();
     $News = \NewsModel::findAll();
     if (empty($News)) {
         return array();
     }
     $arrNews = array();
     while ($News->next()) {
         if (!empty($News)) {
             $arrNews[$News->pid][] = $this->generateNewsUrl($News);
         }
     }
     $InactiveArchives = \GlossarNewsArchiveModel::findByPidsAndInactiveGlossar(array_keys($arrNews));
     if (!empty($InactiveArchives)) {
         while ($InactiveArchives->next()) {
             unset($arrNews[$InactiveArchives->id]);
         }
     }
     if (empty($arrNews)) {
         return array();
     }
     $NewsReader = \ModuleModel::findByType('newsreader');
     if (empty($NewsReader)) {
         return array();
     }
     $arrReader = array();
     while ($NewsReader->next()) {
         $arrReader[$NewsReader->id] = deserialize($NewsReader->news_archives);
     }
     $Content = \ContentModel::findBy(array("module IN ('" . implode("','", array_keys($arrReader)) . "')"), array());
     if (empty($Content)) {
         return array();
     }
     $arrContent = array();
     while ($Content->next()) {
         $arrContent[$Content->module] = $Content->pid;
     }
     $Article = \ArticleModel::findBy(array("tl_article.id IN ('" . implode("','", $arrContent) . "')"), array());
     if (empty($Article)) {
         return array();
     }
     $finishedIDs = $arrPages = array();
     while ($Article->next()) {
         // $root = $this->getRootPage($Article->pid);
         $domain = \Environment::get('base');
         $strLanguage = 'de';
         $objPages = $Article->getRelated('pid');
         $ReaderId = false;
         foreach ($arrContent as $module => $mid) {
             if ($mid == $Article->id) {
                 $ReaderId = $module;
             }
         }
         foreach ($arrReader[$ReaderId] as $news_id) {
             if (in_array($news_id, $finishedIDs)) {
                 continue;
             }
             if (!empty($arrNews[$news_id])) {
                 foreach ($arrNews[$news_id] as $news_domain) {
                     $news_domain = str_replace('.html', '', $news_domain);
                     $arrPages['de'][] = $domain . static::generateFrontendUrl($objPages->row(), substr($news_domain, strpos($news_domain, '/')), $strLanguage);
                 }
             }
             $finishedIDs[] = $news_id;
         }
     }
     return $arrPages;
 }
Esempio n. 4
0
 public function generateUrl($arrPages)
 {
     $arrPages = array();
     $Event = \CalendarEventsModel::findAll();
     if (empty($Event)) {
         return array();
     }
     $arrEvent = array();
     while ($Event->next()) {
         $objCalendar = \CalendarModel::findByPk($Event->pid);
         if ($objCalendar !== null && $objCalendar->jumpTo && ($objTarget = $objCalendar->getRelated('jumpTo')) !== null) {
             $arrEvent[$Event->pid][] = $this->generateEventUrl($Event, $this->generateFrontendUrl($objTarget->row(), \Config::get('useAutoItem') && !\Config::get('disableAlias') ? '/%s' : '/events/%s'));
         }
     }
     $InactiveArchives = \GlossarCalendarModel::findByPidsAndInactiveGlossar(array_keys($arrEvent));
     if (!empty($InactiveArchives)) {
         while ($InactiveArchives->next()) {
             unset($arrEvent[$InactiveArchives->id]);
         }
     }
     if (empty($arrEvent)) {
         return array();
     }
     $EventReader = \ModuleModel::findByType('eventreader');
     if (empty($EventReader)) {
         return array();
     }
     $arrReader = array();
     while ($EventReader->next()) {
         $arrReader[$EventReader->id] = deserialize($EventReader->cal_calendar);
     }
     $Content = \ContentModel::findBy(array("module IN ('" . implode("','", array_keys($arrReader)) . "')"), array());
     if (empty($Content)) {
         return array();
     }
     $arrContent = array();
     while ($Content->next()) {
         $arrContent[$Content->module] = $Content->pid;
     }
     $Article = \ArticleModel::findBy(array("tl_article.id IN ('" . implode("','", $arrContent) . "')"), array());
     if (empty($Article)) {
         return array();
     }
     $finishedIDs = $arrPages = array();
     while ($Article->next()) {
         // $root = $this->getRootPage($Article->pid);
         $domain = \Environment::get('base');
         $strLanguage = 'de';
         $objPages = $Article->getRelated('pid');
         $ReaderId = false;
         foreach ($arrContent as $module => $mid) {
             if ($mid == $Article->id) {
                 $ReaderId = $module;
             }
         }
         foreach ($arrReader[$ReaderId] as $event_id) {
             if (in_array($event_id, $finishedIDs)) {
                 continue;
             }
             if (!empty($arrEvent[$event_id])) {
                 foreach ($arrEvent[$event_id] as $event_domain) {
                     $event_domain = str_replace('.html', '', $event_domain);
                     $arrPages['de'][] = $domain . static::generateFrontendUrl($objPages->row(), substr($event_domain, strpos($event_domain, '/')), $strLanguage);
                 }
             }
             $finishedIDs[] = $event_id;
         }
     }
     return $arrPages;
 }
 public function getArticleLabel($row, $label)
 {
     $page = \PageModel::findWithDetails($row['pid']);
     $layout = $page->getRelated('layout');
     $callback = $GLOBALS['TL_DCA']['tl_article']['list']['label']['reveal_original_label_callback'];
     if (is_array($callback)) {
         $callback[0] = \System::importStatic($callback[0]);
     }
     $label = call_user_func($callback, $row, $label);
     if ($layout->useRevealJs) {
         if ($row['revealVerticalSlide'] == 'start') {
             $label = '&boxhd; ' . $label;
         } else {
             if ($row['revealVerticalSlide'] == 'stop') {
                 $label = '&boxhu; ' . $label;
             } else {
                 $predecessors = \ArticleModel::findBy(array('pid = ?', 'sorting < ?', 'revealVerticalSlide != ?'), array($row['pid'], $row['sorting'], ''), array('order' => 'sorting DESC', 'limit' => 1));
                 if ($predecessors && $predecessors->revealVerticalSlide == 'start') {
                     $successor = \ArticleModel::findOneBy(array('pid = ?', 'sorting > ?'), array($row['pid'], $row['sorting']), array('order' => 'sorting', 'limit' => 1));
                     if ($successor && $successor->revealVerticalSlide == 'start') {
                         $label = '&boxhu; ' . $label;
                     } else {
                         $label = '&boxv; ' . $label;
                     }
                 }
             }
         }
         $predecessors = \ArticleModel::findBy(array('pid = ?', 'sorting < ?'), array($row['pid'], $row['sorting']), array('order' => 'sorting'));
         if ($predecessors) {
             $slide = $predecessors->count();
             $page = -1;
             $inVertical = false;
             foreach ($predecessors as $predecessor) {
                 if ($predecessor->revealVerticalSlide == 'start') {
                     $inVertical = true;
                 }
                 if ($inVertical && $predecessor->revealVerticalSlide != 'start') {
                     $page += 0.001;
                 } else {
                     $page = (int) ($page + 1);
                 }
                 if ($predecessor->revealVerticalSlide == 'stop') {
                     $inVertical = false;
                 }
             }
             if ($inVertical && $row['revealVerticalSlide'] != 'start') {
                 $page += 0.001;
             } else {
                 $page = (int) ($page + 1);
             }
             if ($inVertical) {
                 $pageMain = (int) $page;
                 $pageSub = (int) (($page - $pageMain) * 1000);
                 $page = sprintf('%d-%d', $pageMain, $pageSub);
             } else {
                 $page = (int) $page;
             }
         } else {
             $slide = 0;
             $page = 0;
         }
         $label .= ' ' . sprintf($GLOBALS['TL_LANG']['tl_article']['revealSlideNumber'], $slide, $page);
     }
     return $label;
 }
Esempio n. 6
0
 protected function findGlossarPages()
 {
     $time = time();
     $arrPages = array();
     $objPages = \GlossarPageModel::findActiveAndEnabledGlossarPages();
     if (!empty($objPages)) {
         while ($objPages->next()) {
             if ($objPages->type == 'root') {
                 $strLanguage = $objPages->language;
             }
             $domain = \Environment::get('base');
             if ((!$objPages->start || $objPages->start < $time) && (!$objPages->stop || $objPages->stop > $time)) {
                 $arrPages[$strLanguage][] = $domain . static::generateFrontendUrl($objPages->row(), null, $strLanguage);
                 $objArticle = \ArticleModel::findBy(array("tl_article.pid=? AND (tl_article.start='' OR tl_article.start<{$time}) AND (tl_article.stop='' OR tl_article.stop>{$time}) AND tl_article.published=1 AND tl_article.showTeaser=1"), array($objPages->id), array('order' => 'sorting'));
                 if (!empty($objArticle)) {
                     while ($objArticle->next()) {
                         $arrPages[$strLanguage][] = $domain . static::generateFrontendUrl($objPages->row(), '/articles/' . ($objArticle->alias != '' && !\Config::get('disableAlias') ? $objArticle->alias : $objArticle->id), $strLanguage);
                     }
                 }
             }
         }
     }
     return $arrPages;
 }
 public function templates($obj)
 {
     $template = $obj->getName();
     switch ($template) {
         case 'fe_page':
         case 'fe_page_multitoggle':
             //custom
             $obj->setName($template . '_gc');
             //gc = grid controll only
             $obj->__get("layout")->__set("gridCSS", (array) $this->getGridArr($obj->layout));
             break;
         case 'form':
             $obj->setName($template . '_' . \Config::get('co_grid_prefix'));
             break;
         default:
     }
     // `-,-´ ContentElements
     if ($obj->__get('typePrefix') == 'ce_' && strpos($template, 'ce_row_start') === FALSE) {
         $strClass = $this->findContentElement($obj->__get('type'));
         if ($strClass !== NULL && $strClass != '') {
             $objModel = \ContentModel::findBy('id', $obj->__get('id'));
             if ($objModel !== NULL) {
                 $objEl = new $strClass($objModel);
                 $objEl = $this->design_elements($objEl);
                 $obj->__set('ftc_classes', $objEl->ftc_classes);
                 $obj->__set('ftcID', $objEl->ftcID);
                 $obj->__set('data_attr', $this->splitArr($objEl->data_attr));
                 $obj->__set('class', $objEl->ftc_classes);
                 $obj->__set('cssID', $objEl->ftcID);
             }
         }
     }
     if (strpos($template, 'ce_row_start') !== FALSE) {
         $obj->__set('row_data_attr_ftc', $this->splitArr($obj->row_data_attr_ftc));
     }
     // `-,-´ Article
     if (strpos($template, 'mod_article') !== FALSE) {
         $objModel = \ArticleModel::findBy('id', $obj->__get('id'));
         if ($objModel !== NULL) {
             $objEl = new \ModuleArticle($objModel);
             $objEl = $this->design_articles($objEl);
             $obj->__set('class', '' . $objEl->ftc_classes);
             $obj->__set('cssID', $objEl->ftcID . ' ');
             //.$objEl->data_attr.' '
         }
     }
     // `-,-´ Module
     if ($obj->__get('typePrefix') == 'mod_') {
         $strClass = \Module::findClass($obj->__get('type'));
         if ($strClass !== NULL && $strClass != '') {
             $objModel = \ModuleModel::findBy('id', $obj->__get('id'));
             if ($objModel !== NULL) {
                 $objEl = new $strClass($objModel);
                 $co_grid = $this->design_modules($objEl);
                 $obj->__set('class', $co_grid['class'] . ' ' . $co_grid['co_grid_classes']);
                 // $obj->__set('cssID',$co_grid['ftcID'].' '.$co_grid['data_attr'].' ');
                 $obj->__set('ftc_classes', $co_grid['class'] . ' ' . $co_grid['co_grid_classes']);
                 $obj->__set('ftcID', $co_grid['ftcID'] . ' ');
                 $obj->__set('ftc_data_attr', $co_grid['data_attr']);
             }
         }
     }
 }
Esempio n. 8
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;
 }