/** * get all pages and cached by static::$pages */ protected static function getPages() { $result = \PageModel::findAll(); if ($result) { while ($result->next()) { $buffer = $result->current(); $trail = \PageModel::findBy('pid', $buffer->id); if ($trail) { $bufferTrail = array(); while ($trail->next()) { $bufferTrail[$trail->sorting] = $trail->current(); } $sort = array_keys($bufferTrail); array_multisort($sort); $arr = array(); foreach ($sort as $v) { $arr[$v] = $bufferTrail[$v]; } $buffer->__set('trail', $arr); } static::$pages[$result->pid][$result->sorting] = $buffer; } static::sortPages(); } }
public function getRootPages(\DataContainer $dc) { $arrOptions = array(); $objPages = \PageModel::findBy('type', 'root'); if ($objPages === null) { return $arrOptions; } return $objPages->fetchEach('title'); }
/** * Return if there are no files * @return string */ public function generate() { global $objPage; $pageGlossar = explode('|', $objPage->glossar); $Page = \PageModel::findBy(array("glossar LIKE '%|" . implode("|%' OR glossar LIKE '%|", $pageGlossar) . "|%'"), array()); if (empty($Page)) { return; } $countTerms = array(); $arrPages = array(); while ($Page->next()) { $ap = array('id' => $Page->id, 'weight' => 0, 'title' => $Page->title, 'description' => $Page->description, 'glossar' => explode('|', $Page->glossar), 'fallback_glossar' => explode('|', $Page->fallback_glossar), 'url' => $this->generateFrontendUrl($Page->row())); foreach ($ap['glossar'] as $term) { if ($term != '') { $countTerms[$term] = !empty($term) ? $countTerms[$term] + 1 : 1; } } if ($ap['id'] != $objPage->id) { $arrPages[] = $ap; } } asort($countTerms); $this->countTerms = $countTerms; $max = 0; foreach ($arrPages as &$p_page) { foreach ($countTerms as $term => $count) { if (in_array($term, $p_page['glossar'])) { $p_page['weight']++; } } if ($p_page['weight'] > $max) { $max = $p_page['weight']; } } $this->max = $max; foreach ($arrPages as &$p_page) { $x = $p_page['weight'] / $max; $p_page['weight'] = 1 + $x; } $this->pages = $arrPages; if (!isset($_GET['items']) && $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) { \Input::setGet('items', \Input::get('auto_item')); } if (!isset($_GET['alpha']) && $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) { \Input::setGet('alpha', \Input::get('auto_item')); } return parent::generate(); }
/** * prepare */ public function prepare() { // load backend user $this->import('BackendUser', 'User'); // check permission if ($this->User->isAdmin || $this->User->hasAccess('page', 'modules') && isset($this->User->pagemounts) && is_array($this->User->pagemounts)) { // check if table exists if (!$this->Database->tableExists('tl_page')) { return; } // get all existing root pages $objPages = \PageModel::findBy('type', 'root', array('order' => 'title')); // there are at minimum two pages if (!is_null($objPages) && $objPages->count() > 1) { // prepare directentry array $arrDirectEntry = array(); // set counter $intCounter = 1; // do this foreach page while ($objPages->next()) { // check page permission if ($this->User->isAdmin || in_array($objPages->id, $this->User->pagemounts)) { if (version_compare(VERSION, '3.5', '<')) { $strQuery = http_build_query(['do' => 'page', 'node' => $objPages->id]); } else { $strQuery = http_build_query(['do' => 'page', 'node' => $objPages->id, 'pn' => $objPages->id]); } // set the icon url and title $arrDirectEntry[$intCounter]['icons']['page']['url'] = 'contao/main.php?' . $strQuery; $arrDirectEntry[$intCounter]['icons']['page']['title'] = 'page'; $arrDirectEntry[$intCounter]['icons']['page']['icon'] = 'page'; // set the page url and title $arrDirectEntry[$intCounter]['name']['url'] = 'contao/main.php?' . $strQuery; $arrDirectEntry[$intCounter]['name']['title'] = $objPages->title; $arrDirectEntry[$intCounter]['name']['link'] = strlen($objPages->title) > 17 ? substr($objPages->title, 0, 15) . '...' : $objPages->title; // add one to counter $intCounter++; } } // add to direcentries service $this->import('DirectEntries'); $this->DirectEntries->addDirectEntry('design', 'page', $arrDirectEntry); } } }
public function languageLabels($row, $label, $dc = null, $imageAttribute = '', $blnReturnImage = false, $blnProtected = false) { // generate the default label $objDcaClass = null; if (in_array('cacheicon', ModuleLoader::getActive())) { $objDcaClass = new tl_page_cacheicon(); } elseif (in_array('Avisota', ModuleLoader::getActive())) { $objDcaClass = new tl_page_avisota(); } else { $objDcaClass = new tl_page(); } $label = $objDcaClass->addIcon($row, $label, $dc, $imageAttribute, $blnReturnImage, $blnProtected); // return the label for root or folder page if ($row['type'] == 'root' || $row['type'] == 'folder') { return $label; } // load the current page $objPage = PageModel::findWithDetails($row['id']); // prepare alternate pages $objAlternates = null; if ($objPage->languageMain) { // get all pages referencing the same fallback page $t = \PageModel::getTable(); $objAlternates = PageModel::findBy(array("{$t}.languageMain = ? OR {$t}.id = ?"), array($objPage->languageMain, $objPage->languageMain)); } else { // get all pages referencing the current page as its fallback $objAlternates = PageModel::findByLanguageMain($objPage->id); } // check if alternates were found if ($objAlternates !== null) { $label .= '<ul class="tl_page_language_alternates">'; // go through each page and add link while ($objAlternates->next()) { if ($objAlternates->id == $objPage->id) { continue; } $objAlternates->current()->loadDetails(); $label .= '<li><a href="contao/main.php?do=page&node=' . $objAlternates->id . '&ref=' . TL_REFERER_ID . '">' . $objAlternates->language . '</a></li>'; } $label .= '</ul>'; } return $label; }
public function collectItems(CollectItemsEvent $event) { $item = $event->getParentItem(); if ($item->getType() == 'page') { $table = \PageModel::getTable(); $columns = array("{$table}.pid=?"); if (!BE_USER_LOGGED_IN) { $time = time(); $columns[] = "({$table}.start='' OR {$table}.start<{$time}) AND ({$table}.stop='' OR {$table}.stop>{$time}) AND {$table}.published=1"; } $pages = \PageModel::findBy($columns, array($item->getExtra('id')), array('order' => 'sorting')); if ($pages) { $factory = $event->getFactory(); foreach ($pages as $page) { $factory->createItem('page', $page->id, $item); } } } if ($item->getType() == 'pages') { $ids = explode(',', $item->getName()); $ids = array_filter($ids); $table = \PageModel::getTable(); $columns = array('(' . implode(' OR ', array_fill(0, count($ids), "{$table}.id=?")) . ')'); $sorting = "FIELD({$table}.id, " . implode(', ', array_fill(0, count($ids), "?")) . ")"; if (!BE_USER_LOGGED_IN) { $time = time(); $columns[] = "({$table}.start='' OR {$table}.start<{$time}) AND ({$table}.stop='' OR {$table}.stop>{$time}) AND {$table}.published=1"; } $pages = \PageModel::findBy($columns, array_merge($ids, $ids), array('order' => $sorting)); if ($pages) { $factory = $event->getFactory(); foreach ($pages as $page) { $factory->createItem('page', $page->id, $item); } } } }
/** * Adds the product urls to the array so they get indexed when search index is rebuilt in the maintenance module * * @param array $arrPages Absolute page urls * @param int $intRoot Root page id * @param bool $blnIsSitemap True if it's a sitemap module call (= treat differently when page is protected etc.) * * @return array Extended array of absolute page urls */ public function addProductsToSearchIndex($arrPages, $intRoot = 0, $blnIsSitemap = false) { $t = \PageModel::getTable(); $time = \Date::floorToMinute(); $arrValue = array(); $arrColumn = array("{$t}.type='root'", "{$t}.published='1'", "({$t}.start='' OR {$t}.start<'{$time}')", "({$t}.stop='' OR {$t}.stop>'" . ($time + 60) . "')"); if ($intRoot > 0) { $arrColumn[] = "{$t}.id=?"; $arrValue[] = $intRoot; } $objRoots = \PageModel::findBy($arrColumn, $arrValue); if (null !== $objRoots) { foreach ($objRoots as $objRoot) { $arrPageIds = \Database::getInstance()->getChildRecords($objRoot->id, $t, false); $arrPageIds[] = $intRoot; $objProducts = Product::findPublishedByCategories($arrPageIds); if (null !== $objProducts) { foreach ($objProducts as $objProduct) { // Find the categories in the current root $arrCategories = array_intersect($objProduct->getCategories(), $arrPageIds); $intRemaining = count($arrCategories); foreach ($arrCategories as $intPage) { $objPage = \PageModel::findByPk($intPage); --$intRemaining; // The target page does not exist if ($objPage === null) { continue; } // The target page has not been published if (!$objPage->published || $objPage->start != '' && $objPage->start > $time || $objPage->stop != '' && $objPage->stop < $time + 60) { continue; } // The target page is exempt from the sitemap if ($blnIsSitemap && $objPage->sitemap == 'map_never') { continue; } // Do not generate a reader for the index page, except if it is the only one if ($intRemaining > 0 && $objPage->alias == 'index') { continue; } // Generate the domain $strDomain = $objRoot->useSSL ? 'https://' : 'http://'; $strDomain .= ($objRoot->dns ?: \Environment::get('host')) . TL_PATH . '/'; // Pass root language to page object $objPage->language = $objRoot->language; $arrPages[] = $strDomain . $objProduct->generateUrl($objPage); // Only take the first category because this is our primary one // Having multiple reader pages in the sitemap XML would mean duplicate content break; } } } } } return array_unique($arrPages); }
protected function buildPageTree(\stdClass $parent, Cache $cache) { $pageModels = \PageModel::findBy(['pid=? AND (start=? OR start<?) AND (stop=? OR stop>?) AND published=?'], [$parent->id, '', time(), '', time(), 1], ['order' => 'sorting']); if ($pageModels) { foreach ($pageModels as $pageModel) { $pageObject = new \stdClass(); $pageObject->id = $pageModel->id; $pageObject->title = $pageModel->title; $pageObject->children = new \ArrayObject(); if ($pageModel->theme_plus_disable_assets_cache || in_array($pageModel->type, ['root', 'forward', 'redirect'])) { $pageObject->hasCache = false; } else { $cachedCss = ($raw = $cache->fetch('css:' . $pageModel->id)) ? highlight_string('<?php' . $raw, true) : false; $cachedHeadJs = ($raw = $cache->fetch('js:head:' . $pageModel->id)) ? highlight_string('<?php' . $raw, true) : false; $cachedBodyJs = ($raw = $cache->fetch('js:body:' . $pageModel->id)) ? highlight_string('<?php' . $raw, true) : false; $pageObject->hasCache = true; $pageObject->cssCache = $cachedCss; $pageObject->headJsCache = $cachedHeadJs; $pageObject->bodyJsCache = $cachedBodyJs; } $parent->children->append($pageObject); $this->buildPageTree($pageObject, $cache); } } }
/** * Retreives all available domains in this installation (plus empty selection) * * @return array */ public function getDomains() { // options array $options = array('' => $GLOBALS['TL_LANG']['tl_short_urls']['noDomain']); // get the root pages and their dns settings if (version_compare(VERSION, '3.5', '>=')) { if (($objPages = \PageModel::findPublishedRootPages()) !== null) { while ($objPages->next()) { if ($objPages->dns) { $options[$objPages->id] = $objPages->dns; } } } } else { $t = \PageModel::getTable(); $arrColumns = array("{$t}.type=?"); if (!BE_USER_LOGGED_IN) { $time = time(); $arrColumns[] = "({$t}.start='' OR {$t}.start<='{$time}') AND ({$t}.stop='' OR {$t}.stop>'" . ($time + 60) . "') AND {$t}.published='1'"; } $objPages = \PageModel::findBy($arrColumns, 'root'); if ($objPages !== null) { while ($objPages->next()) { if ($objPages->dns) { $options[$objPages->id] = $objPages->dns; } } } } // return the options return $options; }
/** * The ids of all pages we take care of. This is what should later be used eg. for filter data. * * @return array */ protected function findCategories() { if (null === $this->arrCategories) { if ($this->defineRoot && $this->rootPage > 0) { $objPage = \PageModel::findWithDetails($this->rootPage); } else { global $objPage; } $t = \PageModel::getTable(); $arrCategories = null; $arrUnpublished = array(); $strWhere = "{$t}.type!='error_403' AND {$t}.type!='error_404'"; if (!BE_USER_LOGGED_IN) { $time = time(); $objUnpublished = \PageModel::findBy(array("({$t}.start!='' AND {$t}.start>{$time}) OR ({$t}.stop!='' AND {$t}.stop<{$time}) OR {$t}.published=?"), array('')); $arrUnpublished = $objUnpublished->fetchEach('id'); //$strWhere .= " AND ($t.start='' OR $t.start<$time) AND ($t.stop='' OR $t.stop>$time) AND $t.published='1'"; } switch ($this->iso_category_scope) { case 'global': $arrCategories = array($objPage->rootId); $arrCategories = \Database::getInstance()->getChildRecords($objPage->rootId, 'tl_page', false, $arrCategories, $strWhere); $arrCategories = array_diff($arrCategories, $arrUnpublished); break; case 'current_and_first_child': $arrCategories = \Database::getInstance()->execute("SELECT id FROM tl_page WHERE pid={$objPage->id} AND {$strWhere}")->fetchEach('id'); $arrCategories[] = $objPage->id; break; case 'current_and_all_children': $arrCategories = array($objPage->id); $arrCategories = \Database::getInstance()->getChildRecords($objPage->id, 'tl_page', false, $arrCategories, $strWhere); $arrCategories = array_diff($arrCategories, $arrUnpublished); break; case 'parent': $arrCategories = array($objPage->pid); break; case 'product': /** @var \Isotope\Model\Product\Standard $objProduct */ $objProduct = Product_Model::findAvailableByIdOrAlias(\Haste\Input\Input::getAutoItem('product')); if ($objProduct !== null) { $arrCategories = $objProduct->getCategories(true); } else { $arrCategories = array(0); } break; case 'article': $arrCategories = array($GLOBALS['ISO_CONFIG']['current_article']['pid'] ?: $objPage->id); break; case '': case 'current_category': $arrCategories = array($objPage->id); break; default: if (isset($GLOBALS['ISO_HOOKS']['findCategories']) && is_array($GLOBALS['ISO_HOOKS']['findCategories'])) { foreach ($GLOBALS['ISO_HOOKS']['findCategories'] as $callback) { $objCallback = \System::importStatic($callback[0]); $arrCategories = $objCallback->{$callback}[1]($this); if ($arrCategories !== false) { break; } } } break; } $this->arrCategories = empty($arrCategories) ? array(0) : $arrCategories; } return $this->arrCategories; }
/** * 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; }