Beispiel #1
0
 /**
  * Replace DPS Insert Tags
  * @param $strTag
  * @return bool|mixed|string
  */
 public function replaceCustomizeInsertTags($strTag)
 {
     global $objPage;
     $return = false;
     $arrSplit = explode('::', $strTag);
     $db = \Database::getInstance();
     $strLanguage = $GLOBALS['TL_LANGUAGE'];
     switch (strtolower($arrSplit[0])) {
         case 'dps':
             switch ($arrSplit[1]) {
                 case "website":
                     $strReturn = "";
                     if ($arrSplit[2] == "addressBox") {
                         $arrFieldsPs = explode(";;", $arrSplit[3]);
                         $strReturn .= '<div vocab="http://schema.org/" typeof="Organization">';
                         foreach ($arrFieldsPs as $arrFieldsP) {
                             $strReturn .= '<p>';
                             $arrFieldsRows = explode(";", $arrFieldsP);
                             foreach ($arrFieldsRows as $arrFieldsRow) {
                                 $arrFields = explode(",", $arrFieldsRow);
                                 foreach ($arrFields as $strField) {
                                     $strFieldValue = trim(\Config::get('dps_website' . ucfirst($strField)));
                                     if ($strField == "company") {
                                         $strReturn .= '<span property="name"><strong>' . $strFieldValue . '</strong></span>';
                                     } else {
                                         $arrAttributes = array();
                                         if ($strField == "street") {
                                             $arrAttributes[] = 'property="streetAddress"';
                                         } elseif ($strField == "postal") {
                                             $arrAttributes[] = 'property="postalCode"';
                                         } elseif ($strField == "city") {
                                             $arrAttributes[] = 'property="addressLocality"';
                                         } elseif ($strField == "phone") {
                                             $arrAttributes[] = 'property="telephone"';
                                         } elseif ($strField == "email") {
                                             $arrAttributes[] = 'property="email"';
                                         }
                                         if (($strField == "phone" || $strField == "fax" || $strField == "mobile") && strlen($strFieldValue)) {
                                             if (!preg_match('/^[+]/', $strFieldValue) && !preg_match('/^00/', $strFieldValue)) {
                                                 $country = \Config::get('dps_websiteCountry');
                                                 switch ($country) {
                                                     case "at":
                                                         $strReturn .= '<span ' . implode(" ", $arrAttributes) . '>+43 . ' . preg_replace('/^0/', '', $strFieldValue) . '</span>';
                                                         break;
                                                 }
                                             }
                                         } elseif (($strField == "email" || $strField == "website") && strlen($strFieldValue)) {
                                             $strLink = $strFieldValue;
                                             $strAttributes = trim(implode(" ", $arrAttributes));
                                             if ($strField == "email") {
                                                 $strLink = 'mailto:' . $strLink;
                                             } else {
                                                 if (!preg_match('/^http/', $strLink)) {
                                                     $strLink = 'http://' . $strLink;
                                                 }
                                             }
                                             if (strlen($strAttributes)) {
                                                 $strAttributes = " " . trim($strAttributes);
                                             }
                                             $strReturn .= '<a href="' . $strLink . '"' . $strAttributes . '>' . $strFieldValue . '</a>';
                                         } else {
                                             $strReturn .= '<span ' . implode(" ", $arrAttributes) . '>' . $strFieldValue . '</span> ';
                                         }
                                     }
                                 }
                                 $strReturn .= '<br>';
                             }
                             $strReturn .= '</p>';
                         }
                         $strReturn .= '</div>';
                     } else {
                         $arrParts = explode(",", $arrSplit[2]);
                         $strField = $arrParts[0];
                         $strMode = $arrParts[1];
                         $strAttributes = $arrParts[2];
                         $strReturn = trim(\Config::get('dps_website' . ucfirst($strField)));
                         if ($strMode == "label") {
                             \System::loadLanguageFile("tl_dps_website");
                             $strReturn = $GLOBALS['TL_LANG']['tl_dps_website'][$strField][0];
                         } else {
                             if ($strMode == "link") {
                                 if (strlen($strReturn)) {
                                     $strLink = $strReturn;
                                     if ($strField == "email") {
                                         $strLink = 'mailto:' . $strLink;
                                     } else {
                                         if (!preg_match('/^http/', $strLink)) {
                                             $strLink = 'http://' . $strLink;
                                         }
                                     }
                                     if (strlen($strAttributes)) {
                                         $strAttributes = " " . trim($strAttributes);
                                     }
                                     $strReturn = '<a href="' . $strLink . '"' . $strAttributes . '>' . $strReturn . '</a>';
                                 }
                             }
                             if (($strField == "phone" || $strField == "fax" || $strField == "mobile") && strlen($strReturn)) {
                                 if (!preg_match('/^[+]/', $strReturn) && !preg_match('/^00/', $strReturn)) {
                                     $country = \Config::get('dps_websiteCountry');
                                     switch ($country) {
                                         case "at":
                                             $strReturn = '+43 . ' . preg_replace('/^0/', '', $strReturn);
                                             break;
                                     }
                                 }
                             }
                             if (($strField == "logo" || $strField == "sublogo") && $strReturn != "") {
                                 $namePrefix = $strField == "sublogo" ? "Sublogo" : "Logo";
                                 $objFile = \FilesModel::findByUuid($strReturn);
                                 if ($objFile === null) {
                                     if (!\Validator::isUuid($strReturn)) {
                                         $strReturn = '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
                                     }
                                 }
                                 if (is_file(TL_ROOT . '/' . $objFile->path)) {
                                     $singleSRC = $objFile->path;
                                     $size = deserialize(\Config::get('dps_website' . $namePrefix . 'Size'));
                                     $imgSize = getimagesize(TL_ROOT . '/' . $singleSRC);
                                     $intMaxWidth = \Config::get('maxImageWidth');
                                     // Adjust the image size
                                     if ($intMaxWidth > 0) {
                                         $arrMargin = deserialize(\Config::get('dps_website' . $namePrefix . 'Imagemargin'));
                                         // Subtract the margins before deciding whether to resize (see #6018)
                                         if (is_array($arrMargin) && $arrMargin['unit'] == 'px') {
                                             $intMaxWidth = $intMaxWidth - $arrMargin['left'] - $arrMargin['right'];
                                         }
                                         if ($size[0] > $intMaxWidth || !$size[0] && !$size[1] && $imgSize[0] > $intMaxWidth) {
                                             // See #2268 (thanks to Thyon)
                                             $ratio = $size[0] && $size[1] ? $size[1] / $size[0] : $imgSize[1] / $imgSize[0];
                                             $size[0] = $intMaxWidth;
                                             $size[1] = floor($intMaxWidth * $ratio);
                                         }
                                     }
                                     $src = \Image::get($singleSRC, $size[0], $size[1], $size[2]);
                                     // Image dimensions
                                     if (($imgSize = @getimagesize(TL_ROOT . '/' . rawurldecode($src))) !== false) {
                                         $arrSize = $imgSize;
                                         $imgSize = ' ' . $imgSize[3];
                                     }
                                     $strReturn = \Image::getHtml($src, \Config::get('dps_website' . $namePrefix . 'Alt'), $imgSize);
                                     // Image link
                                     $imageUrl = \Config::get('dps_website' . $namePrefix . 'ImageUrl');
                                     if ($imageUrl != '' && TL_MODE == 'FE') {
                                         $attributes = "";
                                         if (\Config::get('dps_website' . $namePrefix . 'ImageNewWindow')) {
                                             $attributes = $objPage->outputFormat == 'xhtml' ? ' onclick="return !window.open(this.href)"' : ' target="_blank"';
                                         }
                                         $strReturn = '<a href="' . $imageUrl . '"' . $attributes . '>' . $strReturn . '</a>';
                                     }
                                     $strReturn = $this->replaceInsertTags($strReturn);
                                 }
                             }
                         }
                     }
                     if (strlen($strReturn)) {
                         $return = $strReturn;
                     }
                     break;
                 case "platzhalter":
                 case "insert":
                 case "placeholder":
                     $return = \DPS\Customize\Frontend\Module\Placeholder::getPlaceholder($arrSplit[2]);
                     // Replace TL_JAVASCRIPT from other modules before!
                     Helper::replaceOtherDefaultScripts();
                     Helper::checkForUniqueScripts();
                     break;
                 case "article":
                     switch ($arrSplit[2]) {
                         case "topImage":
                         case "imageTop":
                             $objArticle = \ArticleModel::findOneBy(array('pid=?', 'inColumn=?'), array($objPage->id, "main"));
                             if ($objArticle) {
                                 if (!$objArticle->addTopImage) {
                                     $objParentPage = \PageModel::findByPk($objPage->pid);
                                     if ($objParentPage) {
                                         $objArticle = \ArticleModel::findOneBy(array('pid=?', 'inColumn=?'), array($objParentPage->id, "main"));
                                     }
                                 }
                                 if ($objArticle->addTopImage) {
                                     $imageSRC = $objArticle->topImageSRC;
                                     $objFile = \FilesModel::findByUuid($imageSRC);
                                     if ($objFile === null) {
                                         if (!\Validator::isUuid($imageSRC)) {
                                             $strReturn = '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
                                         }
                                     }
                                     if (is_file(TL_ROOT . '/' . $objFile->path)) {
                                         $singleSRC = $objFile->path;
                                         $imgSize = getimagesize(TL_ROOT . '/' . $singleSRC);
                                         //											$intMaxWidth = \Config::get( 'maxImageWidth' );
                                         //											$src = \Image::get($singleSRC, $imgSize[0], $imgSize[1], 'center_center');
                                         $src = \Image::get($singleSRC, 1050, 422, 'center_center');
                                         // Image dimensions
                                         if (($imgSize = @getimagesize(TL_ROOT . '/' . rawurldecode($src))) !== false) {
                                             $arrSize = $imgSize;
                                             $imgSize = ' ' . $imgSize[3];
                                         }
                                         $return = \Image::getHtml($src, '', $imgSize);
                                         // Image link
                                         //											$imageUrl = \Config::get('dps_website' . $namePrefix . 'ImageUrl');
                                         //
                                         //											if ($imageUrl != '' && TL_MODE == 'FE')
                                         //											{
                                         //												$attributes = "";
                                         //
                                         //												if( \Config::get('dps_website' . $namePrefix . 'ImageNewWindow') )
                                         //												{
                                         //													$attributes = ($objPage->outputFormat == 'xhtml') ? ' onclick="return !window.open(this.href)"' : ' target="_blank"';
                                         //												}
                                         //
                                         //												$strReturn = '<a href="' . $imageUrl . '"' . $attributes . '>' . $strReturn . '</a>';
                                         //											}
                                         $return = $this->replaceInsertTags($return);
                                     }
                                 }
                             }
                             break;
                         case "topImageText":
                         case "topImageTitle":
                             $objArticle = \ArticleModel::findOneBy(array('pid=?', 'inColumn=?'), array($objPage->id, "main"));
                             if ($objArticle) {
                                 if (strlen($objArticle->topImageTitle)) {
                                     $return = $this->replaceInsertTags($objArticle->topImageTitle);
                                 } else {
                                     $objParentPage = \PageModel::findByPk($objPage->pid);
                                     if ($objParentPage) {
                                         $objArticle = \ArticleModel::findOneBy(array('pid=?', 'inColumn=?'), array($objParentPage->id, "main"));
                                         if (strlen($objArticle->topImageTitle)) {
                                             $return = $this->replaceInsertTags($objArticle->topImageTitle);
                                         }
                                     }
                                 }
                             }
                             break;
                     }
                     break;
             }
             break;
     }
     return $return;
 }
Beispiel #2
0
 public function getCustomizeContentElement($objRow, $strBuffer, &$objElement)
 {
     global $objPage;
     if ($objRow->type == "text") {
         if ($objRow->addImage) {
             if (strlen($objRow->headlineImagePosition)) {
                 $arrHeadline = deserialize($objRow->headline, true);
                 $arrTopHeadline = deserialize($objRow->topHeadline, true);
                 $arrSubHeadline = deserialize($objRow->subHeadline, true);
                 $strHeadline = "";
                 $strTopHeadline = "";
                 $strSubHeadline = "";
                 $headlineUnit = $arrHeadline['unit'];
                 $headlineValue = $arrHeadline['value'];
                 $strHeadline = '<' . $headlineUnit . '>' . $headlineValue . '</' . $headlineUnit . '>';
                 if ($objRow->floating == "above" && $objRow->headlineImagePosition == "bottom") {
                     if ($arrHeadline['value'] != "") {
                         $strBuffer = str_replace($strHeadline, '', $strBuffer);
                     }
                     $strBuffer = str_replace('</figure>', '</figure>' . $strHeadline, $strBuffer);
                 } elseif ($objRow->floating == "left") {
                     if ($objRow->headlineImagePosition == "nextTo") {
                         if ($arrHeadline['value'] != "") {
                             $strBuffer = str_replace($strHeadline, '', $strBuffer);
                         }
                         $strBuffer = str_replace('</figure>', '</figure>' . $strHeadline, $strBuffer);
                     }
                 }
             }
         }
         $cssID = deserialize($objRow->cssID, true);
         if (preg_match('/header-ornament/', $cssID[1])) {
             $unit = "h1";
             $arrHeadline = deserialize($objRow->headline, true);
             if (strlen(trim($arrHeadline['value']))) {
                 $unit = $arrHeadline['unit'];
             }
             $strBuffer = preg_replace('/<' . $unit . '([A-Za-z0-9\\s\\-_="\\(\\)\\/\\,;.:\'#]{0,})>/', '<' . $unit . '$1><span class="text">', $strBuffer);
             $strBuffer = preg_replace('/<\\/' . $unit . '>/', '</span><span class="ornament"></span></' . $unit . '>', $strBuffer);
         }
     }
     $addImageOverlay = false;
     if ($objRow->type == "image") {
         if (strlen(trim($objRow->caption))) {
             $strBuffer = str_replace('class="ce_image', 'class="ce_image has-caption', $strBuffer);
         }
         $cssID = deserialize($objRow->cssID, true);
         if ($objRow->ptable == "tl_article") {
             $objArticle = \ArticleModel::findByPk($objRow->pid);
             if ($objArticle) {
                 if ($objArticle->inColumn == "BildOben") {
                     //						$strBuffer = preg_replace('<figure([A-Za-z0-9\s\-_.:,;="\'\(\)\[\]\{\}#]{0,})class="image_container([A-Za-z0-9\s\-_\{\}\[\]#]{0,})"([A-Za-z0-9\s\-_.:,;="\'\(\)\[\]\{\}#]{0,})><div class="image-inner">', '<figure$1class="image_container$2"$3>', $strBuffer);
                     $addImageOverlay = true;
                 }
             }
         }
         if (preg_match('/half-image/', $cssID[1])) {
             $addImageOverlay = true;
             if ($objRow->fullsize) {
                 preg_match_all('/href="([a-zA-Z0-9\\s\\-_.;\\/\\(\\)]{0,})"/', $strBuffer, $hrefMatches);
                 if (is_array($hrefMatches[0]) && count($hrefMatches[0]) > 0) {
                     $imgSRC = $hrefMatches[1][0];
                     $imgSRC = preg_replace('/klein.jpg/', 'gross.jpg', $imgSRC);
                     if (file_exists($imgSRC)) {
                         $strBuffer = preg_replace('/href="' . preg_quote($hrefMatches[1][0], '/') . '"/', 'href="' . $imgSRC . '"', $strBuffer);
                     }
                 }
             }
         }
         if ($objRow->addImageBorder) {
             $strBuffer = preg_replace('/class="ce_image/', 'class="ce_image has-border', $strBuffer);
         }
     }
     if ($addImageOverlay) {
         if (preg_match('/<\\/a>/', $strBuffer)) {
             $strBuffer = preg_replace('/<\\/a>/', '<div class="image-overlay"></div><div class="link-overlay"></div></a>', $strBuffer);
         } else {
             $strBuffer = preg_replace('/<\\/figure>/', '<div class="image-overlay"></div></figure>', $strBuffer);
         }
     }
     if ($objRow->typePrefix == "ce_") {
         $strBuffer = str_replace("\n", "", $strBuffer);
         $strBuffer = preg_replace("/>([\\s]{0,})/", ">", $strBuffer);
         $addWrapper = false;
         $wrapperClasses = "";
         $addTopHeadline = $objRow->addTopHeadline;
         $addSubHeadline = $objRow->addSubHeadline;
         $topHeadline = deserialize($objRow->topHeadline, true);
         $headline = deserialize($objRow->headline, true);
         $subHeadline = deserialize($objRow->subHeadline, true);
         $topHeadlineBorder = deserialize($objRow->addTopHeadlineBorder);
         $headlineBorder = deserialize($objRow->addHeadlineBorder);
         $subHeadlineBorder = deserialize($objRow->addSubHeadlineBorder);
         $topHeadlineFloating = deserialize($objRow->topHeadlineFloating);
         $headlineFloating = deserialize($objRow->headlineFloating);
         $subHeadlineFloating = deserialize($objRow->subHeadlineFloating);
         $topHeadlineColor = Helper::compileColor(deserialize($objRow->topHeadlineColor));
         $headlineColor = Helper::compileColor(deserialize($objRow->headlineColor));
         $subHeadlineColor = Helper::compileColor(deserialize($objRow->subHeadlineColor));
         if (!is_array($topHeadlineBorder)) {
             $topHeadlineBorder = array();
         }
         if (!is_array($headlineBorder)) {
             $headlineBorder = array();
         }
         if (!is_array($subHeadlineBorder)) {
             $subHeadlineBorder = array();
         }
         $topHeadlineClasses = array();
         $subHeadlineClasses = array();
         $headlineClasses = array();
         $topHeadlineTag = "";
         $headlineTag = "";
         $subHeadlineTag = "";
         $topHeadlineStyles = "";
         $headlineStyles = "";
         $subHeadlineStyles = "";
         if ($addTopHeadline && strlen($topHeadline['value'])) {
             //TODO: add border center span!!!
             $unit = "h1";
             if (strlen($topHeadline['unit'])) {
                 $unit = $topHeadline['unit'];
             }
             $headlineClasses[] = 'has-topheadline';
             if (in_array("top", $topHeadlineBorder)) {
                 $topHeadlineClasses[] = "border-top";
             }
             if (in_array("center", $topHeadlineBorder)) {
                 $topHeadlineClasses[] = "border-center";
             }
             if (in_array("bottom", $topHeadlineBorder)) {
                 $topHeadlineClasses[] = "border-bottom";
             }
             switch ($topHeadlineFloating) {
                 case "header_center":
                     $topHeadlineClasses[] = 'text-center';
                     break;
                 case "header_right":
                     $topHeadlineClasses[] = 'text-right';
                     break;
                 case "header_left":
                 default:
                     $topHeadlineClasses[] = 'text-left';
                     break;
             }
             $repalceTopTag = false;
             $addTopTag = "";
             if ((in_array("top", $topHeadlineBorder) || in_array("bottom", $topHeadlineBorder)) && $topHeadlineFloating == "header_center") {
                 $repalceTopTag = true;
                 $addTopTag = '<span class="inner">' . str_replace(";", "<br>", $topHeadline['value']) . '</span>';
             }
             $topHeadlineClasses = array_unique($topHeadlineClasses);
             if ($topHeadlineColor != "transparent" && strlen($topHeadlineColor)) {
                 $addSBorderStyles = "";
                 if (in_array("top", $topHeadlineBorder) || in_array("bottom", $topHeadlineBorder)) {
                     $addSBorderStyles = 'border-color:' . $topHeadlineColor . ';';
                 }
                 $topHeadlineStyles = ' style="color:' . $topHeadlineColor . ';' . $addSBorderStyles . '"';
             }
             $topHeadlineTag = '<' . $unit . ' class="topheadline ' . implode(" ", $topHeadlineClasses) . '"' . $topHeadlineStyles . '>' . ($repalceTopTag ? $addTopTag : str_replace(";", "<br>", $topHeadline['value'])) . '</' . $unit . '>' . "\n";
         }
         if ($addSubHeadline && strlen($subHeadline['value'])) {
             //TODO: add border center span!!!
             $headlineClasses[] = 'has-subheadline';
             $unit = "h1";
             if (strlen($subHeadline['unit'])) {
                 $unit = $subHeadline['unit'];
             }
             if (in_array("top", $subHeadlineBorder)) {
                 $subHeadlineClasses[] = "border-top";
             }
             if (in_array("center", $subHeadlineBorder)) {
                 $subHeadlineClasses[] = "border-center";
             }
             if (in_array("bottom", $subHeadlineBorder)) {
                 $subHeadlineClasses[] = "border-bottom";
             }
             switch ($subHeadlineFloating) {
                 case "header_center":
                     $subHeadlineClasses[] = 'text-center';
                     break;
                 case "header_right":
                     $subHeadlineClasses[] = 'text-right';
                     break;
                 case "header_left":
                 default:
                     $subHeadlineClasses[] = 'text-left';
                     break;
             }
             $repalceSubTag = false;
             $addSubTag = "";
             if ((in_array("top", $subHeadlineBorder) || in_array("bottom", $subHeadlineBorder)) && $objRow->subHeadlineFloating == "header_center") {
                 $repalceSubTag = true;
                 $addSubTag = '<span class="inner">' . str_replace(";", "<br>", $subHeadline['value']) . '</span>';
             }
             $subHeadlineClasses = array_unique($subHeadlineClasses);
             if ($subHeadlineColor != "transparent" && strlen($subHeadlineColor)) {
                 $addSBorderStyles = "";
                 if (in_array("top", $subHeadlineBorder) || in_array("bottom", $subHeadlineBorder)) {
                     $addSBorderStyles = 'border-color:' . $subHeadlineColor . ';';
                 }
                 $subHeadlineStyles = ' style="color:' . $subHeadlineColor . ';' . $addSBorderStyles . '"';
             }
             $subHeadlineTag = '<' . $unit . ' class="subheadline$2 ' . implode(" ", $subHeadlineClasses) . '"' . $subHeadlineStyles . '>' . ($repalceSubTag ? $addSubTag : str_replace(";", "<br>", $subHeadline['value'])) . '</' . $unit . '>';
         }
         if (strlen($headline['value'])) {
             $repalceTag = false;
             $cssID = deserialize($objRow->cssID);
             $addTag = "";
             if ($objRow->type == "headline" && !empty($headlineBorder)) {
                 if (in_array("top", $headlineBorder) || in_array("bottom", $headlineBorder)) {
                     $repalceTag = true;
                     $addTag = '<span class="inner">' . str_replace(";", "<br>", $headline['value']) . '</span>';
                 }
             }
             if (in_array("top", $headlineBorder)) {
                 $headlineClasses[] = "border-top";
             }
             if (in_array("center", $headlineBorder)) {
                 $headlineClasses[] = "border-center";
             }
             if (in_array("bottom", $headlineBorder)) {
                 $headlineClasses[] = "border-bottom";
             }
             switch ($headlineFloating) {
                 case "header_center":
                     $headlineClasses[] = 'text-center';
                     break;
                 case "header_right":
                     $headlineClasses[] = 'text-right';
                     break;
                 case "header_left":
                 default:
                     $headlineClasses[] = 'text-left';
                     break;
             }
             $headlineClasses = array_unique($headlineClasses);
             if ($headlineColor != "transparent" && strlen($headlineColor)) {
                 $addSBorderStyles = "";
                 if (in_array("top", $headlineBorder) || in_array("bottom", $headlineBorder)) {
                     $addSBorderStyles = 'border-color:' . $headlineColor . ';';
                 }
                 $headlineStyles = ' style="color:' . $headlineColor . ';' . $addSBorderStyles . '"';
             }
             $headlineTagSearch = '/<' . $headline['unit'] . ($objRow->type == "headline" ? ' class="(ce_|)headline([a-zA-Z0-9\\s\\-_]{0,})"' : '') . '>' . preg_quote($headline['value'], "/") . '<\\/' . $headline['unit'] . '>/';
             $headlineTag = '<' . $headline['unit'] . ($objRow->type == "headline" ? ' class="$1headline$2 ' . implode(" ", $headlineClasses) . '"' : ' class="headline ' . implode(" ", $headlineClasses) . '"') . $headlineStyles . '>' . ($repalceTag ? $addTag : str_replace(";", "<br>", $headline['value'])) . '</' . $headline['unit'] . '>';
             if (in_array("center", $headlineBorder)) {
                 if (!preg_match('/<' . $headline['unit'] . '([a-zA-Z0-9\\s\\-_.,;:="\\(\\)\'\\/$]{0,})><span class="headline-value">/', $headlineTag)) {
                     $lineLeft = "";
                     $lineRight = "";
                     if ($headlineFloating == "header_right" || $headlineFloating == "header_center") {
                         $lineLeft = '<span class="headline-line line-left"><span class="line"></span></span>';
                     }
                     if ($headlineFloating == "header_left" || $headlineFloating == "header_center") {
                         $lineRight = '<span class="headline-line line-right"><span class="line"></span></span>';
                     }
                     $headlineTag = preg_replace('/<' . $headline['unit'] . '([a-zA-Z0-9\\s\\-_.,;:="\\(\\)\'\\/$]{0,})>/', '<' . $headline['unit'] . '$1>' . $lineLeft . '<span class="headline-value">', $headlineTag);
                     $headlineTag = preg_replace('/<\\/' . $headline['unit'] . '>/', '</span>' . $lineRight . '</' . $headline['unit'] . '>', $headlineTag);
                 }
             }
             if (preg_match('/class="ce_headline/', $strBuffer)) {
                 $addWrapper = true;
                 if ($objRow->simple_columns && $objRow->simple_columns > 0) {
                     preg_match_all($headlineTagSearch, $strBuffer, $headlineMatches);
                     if (is_array($headlineMatches) && isset($headlineMatches[2])) {
                         if (is_array($headlineMatches[2]) && count($headlineMatches[2]) > 0) {
                             $wrapperClasses .= " " . trim($headlineMatches[2][0]);
                         }
                     }
                 }
                 //					$subHeadlineTag = str_replace('subheadline', 'ce_subheadline', $subHeadlineTag);
                 //					$topHeadlineTag = str_replace('topheadline', 'ce_topheadline', $topHeadlineTag);
             }
             $strBuffer = preg_replace($headlineTagSearch, $topHeadlineTag . "\n" . $headlineTag . "\n" . $subHeadlineTag, $strBuffer);
             if ($addWrapper) {
                 $addClearer = false;
                 if ($objRow->simple_columns && $objRow->simple_columns > 0) {
                     if (isset($headlineMatches) && is_array($headlineMatches)) {
                         $strBuffer = preg_replace('/' . $headlineMatches[2][0] . '/', '', $strBuffer);
                     }
                     if (preg_match('/class="sc-clear"/', $strBuffer)) {
                         $addClearer = true;
                         $strBuffer = preg_replace('/<div class="sc-clear"><\\/div>/', '', $strBuffer);
                     }
                 }
                 $strBuffer = '<div class="ce_headlines headline-wrapper' . $wrapperClasses . '">' . $strBuffer . '</div>';
                 if ($addClearer) {
                     $strBuffer = $strBuffer . '<div class="sc-clear"></div>';
                 }
             }
             $strBuffer = preg_replace(array('/\\[strong\\]/', '/\\[\\/strong\\]/'), array('<strong>', '</strong>'), $strBuffer);
         }
     }
     if ($objRow->elementIsBox) {
         $strBuffer = preg_replace('/class="' . $objRow->typePrefix . $objRow->type . '/', 'class="' . $objRow->typePrefix . $objRow->type . ' box-element border-box box-width-' . $objRow->boxWidth . ' box-height-' . $objRow->boxHeight, $strBuffer);
     }
     if ($objRow->simple_columns) {
         $GLOBALS['DPS']['COLUMNS']['OPEN'] = $GLOBALS['DPS']['COLUMNS']['OPEN'] || FALSE;
         $GLOBALS['DPS']['COLUMNS']['COUNT'] = $GLOBALS['DPS']['COLUMNS']['COUNT'] || 0;
         if (!$GLOBALS['DPS']['COLUMNS']['OPEN']) {
             $GLOBALS['DPS']['COLUMNS']['OPEN'] = TRUE;
             $GLOBALS['DPS']['COLUMNS']['COUNT'] = 1;
             $strBuffer = '<div class="ce_columns">' . $strBuffer;
         }
         if ($GLOBALS['DPS']['COLUMNS']['OPEN']) {
             $GLOBALS['DPS']['COLUMNS']['COUNT']++;
         }
         $isLastElement = $this->checkIfIsLastElement($objRow);
         //			echo "<pre>";
         //			print_r($isLastElement);
         //			echo "<br>";
         //			print_r($objRow);
         //			exit;
         if ($GLOBALS['DPS']['COLUMNS']['OPEN'] && ($objRow->simple_columns_close || $isLastElement)) {
             //				echo "<pre>";
             //				print_r($GLOBALS['DPS']['COLUMNS']['OPEN']);
             //				echo "<br>";
             //				print_r($objRow->simple_columns_close);
             //				echo "<br>";
             //				print_r($isLastElement);
             //				exit;
             $GLOBALS['DPS']['COLUMNS']['OPEN'] = FALSE;
             $GLOBALS['DPS']['COLUMNS']['COUNT'] = 0;
             $strBuffer = $strBuffer . '</div>';
         }
     }
     return $strBuffer;
 }
Beispiel #3
0
 protected function isFullPageEnabled(\PageModel $objPage = NULL, \LayoutModel $objLayout = NULL)
 {
     $fullpage = false;
     if ($objPage == NULL) {
         global $objPage;
     }
     if ($objPage->enableFullpage) {
         $fullpage = true;
     }
     if (!$fullpage) {
         $objLayout = $objLayout != NULL ? $objLayout : Helper::getPageLayout($objPage);
         $strClass = trim($objPage->cssClass) . " " . trim($objLayout->cssClass);
         if (preg_match("/enable-fullpage/", $strClass)) {
             $fullpage = true;
         }
     }
     return $fullpage;
 }