<?php

/*
  Vorlagenseite für Standard-Artikel.
  Diese Seite erzeugt anhand diverser Variablen und Text- bzw. Grafikabschnitte eine standardisierte Darstellung.
  Diese Seite ist eine reine php-Seite und wird durch eine reine PHP-Variablen-Seite aufgerufen.
*/

Zusätzliche Variablen ermitteln /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ ###### Lade die aktuelle Datei in eine Variable

$pageContent = file_get_contents(phpConvertPageToFilesystemPath(htmlspecialchars($_GET["id"])));
// ********************
// Variablen bestimmen
// ********************
//###### URL zur Anzeige von Bildern über http/https
$dokuwikiMediaUrl = 'https://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/lib/exe/fetch.php?media=';
// ###### Rechte Sidbar
$sidebarRight = phpConvertPageToFilesystemPath($pageVarArray['variables']['default']['sidebarRight']);
// ###### Daten zum Erstellungszeitpunkt
$pageVarArray['variables']['default']['authorCreationDate'] = date("d.m.Y",strtotime($pageVarArray['variables']['default']['authorCreationDate']));
$pageVarArray['variables']['default']['authorCreationTimeStamp'] = strtotime("{$pageVarArray['variables']['default']['authorCreationDate']} {$pageVarArray['variables']['default']['authorCreationTime']}");
//###### Falls ein oder mehrere Bilder verwendet werden, muss der DIV benannt werden
$imageCounter = 0;
//Führende und endende Leerzeichen und Zeilenumbrüche entfernen
$pageVarArray['variables']['default']['pageEyeCatcher'] = trim($pageVarArray['variables']['default']['pageEyeCatcher']);
// ********************
// Fehlermeldung, falls keine CSS-Datei vorhanden ist
// ********************
  if ( (empty($pageVarArray['variables']['default']['styleSchema'])) || (!(file_exists(phpConvertPageToFilesystemPath($pageVarArray['variables']['default']['styleSchema']))))) {
    echo '<html>
      <div style="width: 100%; height: 100px; padding-top:25px; text-align: center; border: 2px solid black; font-weight: bold; font-size: 2vw;">
        Es existiert keine Style-Sheet-Datei
      </div>
    </html>';
    exit();
  }

CSS-Datei inkludieren /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ include(phpConvertPageToFilesystemPath('includes:css:css_transform_page')); include(phpConvertPageToFilesystemPath($pageVarArray['variables']['default']['styleSchema'])); Funktionen

  //##################################################################################
  //###### Funktion: Durchsuche angegebenen Pfad nach Bildern (nicht rekursiv)
  //##################################################################################
    function func_getAllImagesFromDir($dir, $filter, $excludeArray, $title, $description) {
      //CONDITION: Falls kein oder ein falscher Exclude-Filter gesetzt wurde, setze Asterisk als Filter
      if ( (empty($excludeArray)) || (!(isset($excludeArray))) || (!is_array($excludeArray)) ) {
        $excludeArray = NULL;
      }
      if (!(is_null($excludeArray))) {
        $excludeRegExString = ( (count($excludeArray) > 1) ? '(' . implode('|',$excludeArray) . ')' : $excludeArray[0] );
      }
          
      //###### Wenn Uebergabewert In DokuWiki-Pfad-Syntax, dann konvertiere zu File-System-Pfad-Syntax
      if ((strpos($dir,':'))) {
      //###### String enthält :
        $tree = glob(rtrim(phpConvertNamespaceToFilesystemPath($dir), '/') . '/' . $filter);
      } elseif (strpos($dir,'/') !== false ) {
      //###### String enthält /
        $tree = glob(rtrim($dir, '/') . '/' . $filter);
      } else {
      //###### String enthält weder : noch /
        $tree = glob(rtrim(phpConvertNamespaceToFilesystemPath($dir), '/') . '/' . $filter);
      }
      
      if (is_array($tree)) {
        foreach ($tree as $file) {
          if (is_file($file)) {
            //###### Falls Datei verarbeitet werden soll, inkludieren und in ganzheitliches Array fuellen
            if ( (strpos($file, '.jpg')) || (strpos($file, '.png')) || (strpos($file, '.svg')) ) {
              //###### UpperCase zu LowerCase umbenennen
              $filePathSplitArray = explode('/', $file);
              $fileName = end($filePathSplitArray);
              if (preg_match("/[A-Z]/", $fileName)) {
                $fileNameLower = strtolower($fileName);
                array_pop($filePathSplitArray);
                $filePath = implode('/', $filePathSplitArray);
                echo $filePath  . '-' . $fileNameLower. '<><><><>  ////  ';
                copy("$filePath/$fileName","$filePath/$fileNameLower");
                unlink("$filePath/$fileName");
              }
              if (!(preg_match($excludeRegExString, $file) === 1)) {
                $includedImages[] = [
                  'image'       => str_replace('media:', '', phpCreateDokuWikiConformName(substr(str_replace(realpath(dirname(__FILE__) . '/../../..'), '', $file),1))),
                  'title'       => $title,
                  'description' => $description
                ];
              }
              
            }
          }
        }
      }
  //###### globales Array uebergeben
      return $includedImages;
    }
  //##################################################################################
  //###### Funktion 1v2: Erstelle das Repo einer Gallerie
  //###### Funktion 2v2: Erstelle das zum Repo zugehörige Ribbon
  //##################################################################################
    function func_buildGalleryRepo($givenGallerySectionData) {
      //CONDITION: Falls kein oder ein falscher Include-Filter gesetzt wurde, setze Asterisk als Filter
      if ( (empty($givenGallerySectionData['sectionContIncl'])) || (!(isset($givenGallerySectionData['sectionContIncl']))) || (!is_array($givenGallerySectionData['sectionContIncl'])) ) {
        $givenGallerySectionData['sectionContIncl'] = ['*'];
      }
      $currentGalleryImageArray = array();
      foreach ($givenGallerySectionData['sectionContent'] as $currentImageSource) {
        if (strpos($currentImageSource[0], '.')) {
          $currentImageSourceFile = preg_replace(['/\/data\/pages\//i', '/.txt$/i'], ['/data/media/',''], phpConvertPageToFilesystemPath($currentImageSource[0]));
          unset($currentImageSourceDir);
        } else {
          $currentImageSourceDir = str_replace('/data/pages/', '/data/media/', phpConvertNamespaceToFilesystemPath($currentImageSource[0]));
          unset($currentImageSourceFile);
        }
        $currentImageTitle = $currentImageSource[1];
        $currentImageDescription = $currentImageSource[2];
        // CONDITION: Handelt es bei der aktuellen Bildquelle um ein Bild oder einen Ordner
        if (isset($currentImageSourceDir) && (file_exists($currentImageSourceDir))) {
          foreach($givenGallerySectionData['sectionContIncl'] as $curentImageFilter) {
            $foundImages = func_getAllImagesFromDir($currentImageSourceDir, $curentImageFilter, $givenGallerySectionData['sectionContExcl'], $currentImageTitle, $currentImageDescription);
            if (!(is_null($foundImages))) {
              $currentGalleryImageArray = array_merge($currentGalleryImageArray, $foundImages);
            }
          }
        } elseif (isset($currentImageSourceFile) && (file_exists($currentImageSourceFile))) {
          $currentGalleryImageArray[] = [
            'image'       => str_replace('media:', '', phpCreateDokuWikiConformName(substr(str_replace(realpath(dirname(__FILE__) . '/../../..'), '', $currentImageSourceFile),1))),
            'title'       => $currentImageTitle,
            'description' => $currentImageDescription
          ];
        }
      }
      array_unique($currentGalleryImageArray);
      sort($currentGalleryImageArray);
      return $currentGalleryImageArray;
    }
    function func_buildGalleryRibbon($dokuwikiMediaUrl, $keyCurrentParagraph, $keyCurrentSection, $currentGalleryImageArrayRaw) {
      //###### Gallerie-Ribbon-String mit allen Bildern erstellen
      $imageRibbonString = '';
      foreach ($currentGalleryImageArrayRaw as $key => $currentGalleryImage) {
        $currentGalleryImageArray['image'][$key] = $currentGalleryImage['image'];
        $currentGalleryImageArray['title'][$key] = phpCleanUpVarString($currentGalleryImage['title']);
        $currentGalleryImageArray['description'][$key] = phpCleanUpVarString($currentGalleryImage['description']);
      }
      echo '
        <script language="javaScript">
          var jsGalleryImageArrayImage_' . $keyCurrentParagraph . '_' . $keyCurrentSection . ' = [\'' . implode('\', \'', $currentGalleryImageArray['image']) . '\'];
          var jsGalleryImageArrayTitle_' . $keyCurrentParagraph . '_' . $keyCurrentSection . ' = [\'' . implode('\', \'', $currentGalleryImageArray['title']) . '\'];
          var jsGalleryImageArrayDesc_' . $keyCurrentParagraph . '_' . $keyCurrentSection . ' = [\'' . implode('\', \'', $currentGalleryImageArray['description']) . '\'];
          initPreviewImage(\'previewImage-' . $keyCurrentParagraph . '-' . $keyCurrentSection . '\', jsGalleryImageArrayImage_' . $keyCurrentParagraph . '_' . $keyCurrentSection . ', jsGalleryImageArrayTitle_' . $keyCurrentParagraph . '_' . $keyCurrentSection . ', jsGalleryImageArrayDesc_' . $keyCurrentParagraph . '_' . $keyCurrentSection . ', 0);
        </script>
      ';
    foreach ($currentGalleryImageArray['image'] as $currentImageKey => $imageCurrent) {
        $imageRibbonString .= '<img id="slideshow" onclick="rotateimages(\'previewImage-' . $keyCurrentParagraph . '-' . $keyCurrentSection . '\', ' . $currentImageKey . '); return false;" onmouseover="rotateimages(\'previewImage-' . $keyCurrentParagraph . '-' . $keyCurrentSection . '\', ' . $currentImageKey . '); return false;" src="' . $dokuwikiMediaUrl . $imageCurrent . '" />';
      }
      return $imageRibbonString;
    }
// ********************
// Funktion zum Anzeigen von Bildern
// ********************
  function func_showImage( $dokuwikiMediaUrl, $imagePath, $imageTitle, $imageDescription, $imageType, $keyCurrentParagraph, $keyCurrentSection) {
     return '<div class="ct-image-' . $imageType . '" onclick="fullscreen(\'previewImage-' . $keyCurrentParagraph . '-' . $keyCurrentSection . '\')"><img id="previewImage-' . $keyCurrentParagraph . '-' . $keyCurrentSection . '" src="' . $dokuwikiMediaUrl . $imagePath . '"></div><script language="javaScript">initPreviewImage(\'previewImage-' . $keyCurrentParagraph . '-' . $keyCurrentSection . '\', \'' . $imagePath . '\', \'' . $imageTitle . '\', \'' . $imageDescription . '\', 0);</script>';
  }
// ********************
// JavaScript-Funktionen für Slideshow und FullScreen/Lightbox
// ********************
  //###### Lightbox-Funktionen-String erstellen (JavaScript)
  $jsLightboxFunctions = '
    <script language="javascript">
      function initPreviewImage(givenImageDiv, givenImageArray = null, givenTitleArray = null, givenDescArray = null, givenImageKey = 0) {
        imgFromGivenDiv =             document.getElementById(givenImageDiv);
        if (Array.isArray(givenImageArray)) {
          imgFromGivenDiv.arrayKey =    givenImageKey;
          imgFromGivenDiv.array =       givenImageArray.slice(0);
          imgFromGivenDiv.arrayTitle =  givenTitleArray.slice(0);
          imgFromGivenDiv.arrayDesc =   givenDescArray.slice(0);
          imgFromGivenDiv.src =         "' . $dokuwikiMediaUrl . '" + imgFromGivenDiv.array[givenImageKey];
        } else {
          imgFromGivenDiv.src =         "' . $dokuwikiMediaUrl . '" + givenImageArray;
          imgFromGivenDiv.title =       givenTitleArray;
          imgFromGivenDiv.description = givenDescArray;
        }
      }
      function rotateimages(givenImageDiv, givenImageKey){
        imgFromGivenDiv =             document.getElementById(givenImageDiv)
        imgFromGivenDiv.arrayKey =    givenImageKey;
        imgFromGivenDiv.src =         "' . $dokuwikiMediaUrl . '" + imgFromGivenDiv.array[givenImageKey];
        imgFromGivenDiv.title =       imgFromGivenDiv.arrayTitle[givenImageKey]
      }
      function fullscreen(givenImageDivId) {
        ctFullscreen =                document.getElementById("fullscreenContainer");
        ctFullscreenImage =           document.getElementById("fullscreenImage");
        ctFullscreenInfo =            document.getElementById("fullscreenInfo");
        ctFullscreenInfoTitle =       document.getElementById("fullscreenTitle");
        ctFullscreenInfoDescription = document.getElementById("fullscreenDescription");
        ctFullscreenInfoNav =         document.getElementById("fullscreenNav");
        ctFullscreenInfoPrev =        document.getElementById("fullscreenPrev");
        ctFullscreenInfoCount =       document.getElementById("fullscreenCount");
        ctFullscreenInfoNext =        document.getElementById("fullscreenNext");
        imgFromGivenDiv =             document.getElementById(givenImageDivId);
        if (typeof imgFromGivenDiv.array == "undefined") {
          ctFullscreenImage.src =             imgFromGivenDiv.src;
          ctFullscreenImage.title =           imgFromGivenDiv.title;
          ctFullscreenImage.description =     imgFromGivenDiv.description;
          ctFullscreenInfoNav.style.display = "none";
        } else {
          ctFullscreenImage.arrayKey =    imgFromGivenDiv.arrayKey;
          ctFullscreenImage.array =       imgFromGivenDiv.array;
          ctFullscreenImage.arrayTitle =  imgFromGivenDiv.arrayTitle;
          ctFullscreenImage.arrayDesc =   imgFromGivenDiv.arrayDesc;
          ctFullscreenImage.src =         "' . $dokuwikiMediaUrl . '" + ctFullscreenImage.array[ctFullscreenImage.arrayKey];
          ctFullscreenImage.title =       ctFullscreenImage.arrayTitle[ctFullscreenImage.arrayKey];
          ctFullscreenImage.description = ctFullscreenImage.arrayDesc[ctFullscreenImage.arrayKey];
          ctFullscreenInfoNav.style.display = "flex";
          ctFullscreenInfoCount.innerHTML = (parseInt(ctFullscreenImage.arrayKey) + 1) + "/" + ctFullscreenImage.array.length;
          if ((parseInt(ctFullscreenImage.arrayKey) + 1) == ctFullscreenImage.array.length) {
            ctFullscreenInfoNext.style.visibility = "hidden";
          } else {
            ctFullscreenInfoNext.style.visibility = "visible";
          }
          if (parseInt(ctFullscreenImage.arrayKey) == 0) {
            ctFullscreenInfoPrev.style.visibility = "hidden";
          } else {
            ctFullscreenInfoPrev.style.visibility = "visible";
          }
        }
        if ((typeof ctFullscreenImage.title == "undefined") || (ctFullscreenImage.title == "")) {
          ctFullscreenInfoTitle.innerHTML = "keine Beschreibung vorhanden";
        } else {
          ctFullscreenInfoTitle.innerHTML = ctFullscreenImage.title;
        }
        ctFullscreen.style.display = "flex";
      }
      function fullscreenClose() {
        ctFullscreen = document.getElementById("fullscreenContainer");
        ctFullscreen.style.display = "none";
      }
      function fullscreenPrev() {
        ctFullscreen = document.getElementById("fullscreenImage");
        ctFullscreen.arrayKey = parseInt(ctFullscreen.arrayKey) - 1;
        fullscreen("fullscreenImage");
      }
      function fullscreenNext() {
        ctFullscreen = document.getElementById("fullscreenImage");
        ctFullscreen.arrayKey = parseInt(ctFullscreen.arrayKey) + 1;
        fullscreen("fullscreenImage");
      }
    </script>
  ';

Medienverzeichnis prüfen und ggfs. anlegen (vereinfacht das Hochladen von Bildern über den MediaManager) /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ ###### Alle Bilder am angegebenen Pfad finden (hier Blog-Mediendateien)

  //###### zugehoeriges Medien-Verzeichnis ermitteln
  $filePathOfPageImages = str_replace('/pages/media/', '/media/', phpConvertNamespaceToFilesystemPath('media:' . $_GET["id"]));
  //###### das übergeordnete (Parent)-Verzeichnis des Medien-Verzeichnises ermitteln
  $filePathOfPageImagesSplit = explode(':', $_GET["id"]);
  end($filePathOfPageImagesSplit);
  array_pop($filePathOfPageImagesSplit);
  $wikiPathOfParentPageImages = implode(':', $filePathOfPageImagesSplit);
  $filePathOfParentPageImages = str_replace('/pages/media/', '/media/', phpConvertNamespaceToFilesystemPath('media:' . $wikiPathOfParentPageImages));
  //###### Erstelle den Pfad, falls er nicht existiert
  $filePathOfPageImagesSplit=explode('/', ltrim($filePathOfPageImages, '/'));
  $pathOfPageImagesBreadcrumb = '';
  foreach($filePathOfPageImagesSplit as $currentPathOfPageImagesSubfolder) {
    $pathOfPageImagesBreadcrumb .= '/' . $currentPathOfPageImagesSubfolder;
    if (!file_exists($pathOfPageImagesBreadcrumb)) {
        mkdir($pathOfPageImagesBreadcrumb);
    }
  }

Generiere die eigentliche Seite /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ ###### HTML-Tag öffnen

//##################################################################################
  echo '<html>';
//###### JavaScript-Funktionen einbinden, falls gesetzt
//##################################################################################
  if (isset($jsLightboxFunctions)) { echo $jsLightboxFunctions; }
//###### Fullscreen-Image-Container erzeugen
//##################################################################################
  echo '
    <div id="fullscreenContainer" class="ctr-fullscreen-outer-frame">
      <div class="ctr-fullscreen-inner-frame">
        <div class="ctr-fullscreen-img-outer-frame">
          <div onclick="fullscreenClose()" class="ctr-fullscreen-img-inner-frame">' . ( (!empty($pageVarArray['variables']['default']['pageImageCover'])) ? '<img id="fullscreenImage" src="' . $dokuwikiMediaUrl . $pageVarArray['variables']['default']['pageImageCover'] . '">' : '' ) . '</div>
        </div>
        <div id="fullscreenInfo" class="ctr-fullscreen-info">
          <div class="ctr-fullscreen-description-outer-frame">
            <div id="fullscreenTitle" class="ctr-fullscreen-desc-title">keine Beschreibung vorhanden</div>
            <div id="fullscreenDescription" class="ctr-fullscreen-desc-content"></div>
          </div>
          <div id="fullscreenNav" class="ctr-fullscreen-nav">
            <div id="fullscreenPrev" onclick="fullscreenPrev()" class="elem-fullscreen-overlay-nav-btn">&#x25c0;</div>
            <div id="fullscreenCount" class="elem-fullscreen-overlay-nav-count">1/1</div>
            <div id="fullscreenNext" onclick="fullscreenNext()" class="elem-fullscreen-overlay-nav-btn">&#x25b6;</div>
          </div>
        </div>
      </div>
    </div>
  ';
//###### Parent-Inhalts-Container
//##################################################################################
  //###### BEGIN: parent-container: umspannender Inhalts-Container
  echo "

";

    //###### BEGIN: parent-container-linke-spalte: umspannender Inhalts-Container
    echo "
<div class='" . ( ((isset($pageVarArray['variables']['default']['sidebarRight'])) && (file_exists(phpConvertPageToFilesystemPath($pageVarArray['variables']['default']['sidebarRight'])))) ? 'ct-parent-column-left' : 'ct-parent-column-full' ) . "'>";
      //CONDITION: Falls ein Top-Banner der Seite angezeigt werden soll
      if ( ($pageVarArray['variables']['default']['pageImageBannerDisplay']) && (!empty($pageVarArray['variables']['default']['pageImageBanner'])) ) {
        echo "
  <div class='ct-paragraph' style='border: none; background: none; border-radius: 0;'>
    <div class='ct-paragraph-section-content-image-banner' style='background: none;'>" . func_showImage($dokuwikiMediaUrl, $pageVarArray['variables']['default']['pageImageBanner'], '', '', 'stretch-top', '0', '0') . "</div>
  </div>
        ";
      }
      //Informationen zu Datum, Webpage und Autor
      echo "
  <div style='margin-bottom: var(--global-font-size);'>Beitrag" . ( (!empty($pageVarArray['variables']['default']['authorCreationDate'])) ? " vom {$pageVarArray['variables']['default']['authorCreationDate']}" : "" ) . " auf {$_SERVER['SERVER_NAME']}" . ( (!empty($pageVarArray['variables']['default']['authorCreationUser'])) ? "  von </html>[[user:{$pageVarArray['variables']['default']['authorCreationUser']}]]<html>" : "" ) . "</div>
      ";
      //CONDITION: Falls der Titel der Seite angezeigt werden soll
      if ($pageVarArray['variables']['default']['pageTitleDisplay']) {
        echo "
  <div class='ct-paragraph'>
    <div class='ct-page-title-top'>" . str_replace('\\\\', '<br />', $pageVarArray['variables']['default']['pageTitleRow1']) . "</div>" . ( (!empty($pageVarArray['variables']['default']['pageTitleRow2'])) ? "<div class='ct-page-title-bottom'>{$pageVarArray['variables']['default']['pageTitleRow2']}</div>" : "" ) . "
  </div>
        ";
      }
      //CONDITION: Falls der Eyecatcher der Seite angezeigt werden soll
      if ( ($pageVarArray['variables']['default']['pageEyeCatcherDisplay']) && (!empty($pageVarArray['variables']['default']['pageEyeCatcher'])) ) {
        echo "
  <div class='ct-paragraph'" . ( ($pageVarArray['variables']['default']['pageEyeCatcherStyled']) ? "" : " style='border: none; border-radius: none; background: none;'" ). ">
    <div class='ct-paragraph-eyecatcher'" . ( ($pageVarArray['variables']['default']['pageEyeCatcherStyled']) ? "" : " style='background: none;'" ). ">{$pageVarArray['variables']['default']['pageEyeCatcher']}</div>
  </div>
        ";
      }
      //LOOP: Finde alle Content-Bereiche
      foreach($pageVarArray['paragraphs'] as $keyCurrentParagraph=>$currentParagraph) {
        unset($currentInlineSection);
        if ($currentParagraph['paragraphDisplay']) {
          echo "
  <div class='ct-paragraph'" . ( ($currentParagraph['paragraphStyled']) ? "" : " style='border: none; border-radius: 0; background: none;'" ). ">";
            echo ( (($currentParagraph['paragraphTitleDisplay']) && (!empty($currentParagraph['paragraphTitle']))) ? "<div class='ct-paragraph-title'>" . trim($currentParagraph['paragraphTitle']) . "</div>" : "" );
            foreach($currentParagraph['paragraphSections'] as $keyCurrentSection=>$currentParagraphSection) {
              //CONDITION: Handelt es sich beim aktuellen Abschnitt um einen Abschnitt mit einem "Nachbarn"?
              if ((isset($currentInlineSection['left'])) || ($currentParagraphSection['sectionAlignment'][0] == 'inline') || ($currentParagraphSection['sectionAlignment'][0] == 'column')) {
                //CONDITION: Der linke Nachbar ist schon gesetzt, setze den rechten Nachbarn
                if (isset($currentInlineSection['left'])) {
                  //CONDITION: Fall es keinen zweiten (rechten) Nachbarn gibt, beende die Verarbeitung
                  if (($currentParagraphSection['sectionAlignment'][0] != 'inline') && ($currentParagraphSection['sectionAlignment'][0] != 'column')) {
                    echo '<html>
                      <div style="width: 100%; height: 100px; padding-top:25px; text-align: center; border: 2px solid black; font-weight: bold; font-size: 2vw;">
                        FEHLER: Es wurde nur einer von zwei Inline- oder Spalten-Bereichen angegeben
                      </div>
                    </html>';
                    exit();
                  } else {
                    $currentInlineSection['right'] = $currentParagraphSection;
                    //CONDITION: Falls zwei Nachbar-Bereiche korrekt angegeben wurden, stelle diese dar; Sollte einer von beiden als Spalte angegeben sein, deaktiviere den Fließtext
                    if (($currentInlineSection['left']['sectionAlignment'][0] == 'column') || ($currentInlineSection['right']['sectionAlignment'][0] == 'column') || (($currentInlineSection['left']['sectionType'][0] != 'image') && ($currentInlineSection['right']['sectionType'][0] != 'image'))) {

" . ( 1)) ? "

" . trim($currentInlineSection['left']['sectionTitle']) . "

" : "" ) . " echo "

" . ( 2)) ? "

" . trim($currentInlineSection['left']['sectionTitle']) . "

" : "" ) . ( ($currentInlineSection['left']['sectionType'][0] == 'image') ? func_showImage($dokuwikiMediaUrl, $currentInlineSection['left']['sectionContent'], $currentInlineSection['left']['sectionTitle'], $currentInlineSection['left']['sectionDescription'], $currentInlineSection['left']['sectionAlignment'][0] . '-left', $keyCurrentParagraph, $keyCurrentSection . '-left') : trim($currentInlineSection['left']['sectionContent']) ) . "

" . ( 3)) ? "

" . trim($currentInlineSection['right']['sectionTitle']) . "

" : "" ) . ( ($currentInlineSection['right']['sectionType'][0] == 'image') ? func_showImage($dokuwikiMediaUrl, $currentInlineSection['right']['sectionContent'], $currentInlineSection['right']['sectionTitle'], $currentInlineSection['right']['sectionDescription'], $currentInlineSection['right']['sectionAlignment'][0] . '-right', $keyCurrentParagraph, $keyCurrentSection . '-right') : trim($currentInlineSection['right']['sectionContent']) ) . "

"; } else { if 4) { $currentInlineSection['temp'] = $currentInlineSection['left']; $currentInlineSection['left'] = $currentInlineSection['right']; $currentInlineSection['right'] = $currentInlineSection['temp']; unset($currentInlineSection['temp']); echo ( 5)) ? "

" . trim($currentInlineSection['left']['sectionTitle']) . "

" : "" ) ."

" . ( ($currentInlineSection['right']['sectionType'][0] == 'image') ? func_showImage($dokuwikiMediaUrl, $currentInlineSection['right']['sectionContent'], $currentInlineSection['right']['sectionTitle'], $currentInlineSection['right']['sectionDescription'], $currentInlineSection['right']['sectionAlignment'][0] . '-right', $keyCurrentParagraph, $keyCurrentSection . '-right') : trim($currentInlineSection['right']['sectionContent']) ) . "

" . ( ($currentInlineSection['left']['sectionType'][0] == 'image') ? func_showImage($dokuwikiMediaUrl, $currentInlineSection['left']['sectionContent'], $currentInlineSection['left']['sectionTitle'], $currentInlineSection['left']['sectionDescription'], $currentInlineSection['left']['sectionAlignment'][0] . '-left', $keyCurrentParagraph, $keyCurrentSection . '-left') : trim($currentInlineSection['left']['sectionContent']) ) . "

"; } else { echo ( 6)) ? "

" . trim($currentInlineSection['left']['sectionTitle']) . "

" : "" ) ."

" . ( ($currentInlineSection['right']['sectionType'][0] == 'image') ? func_showImage($dokuwikiMediaUrl, $currentInlineSection['right']['sectionContent'], $currentInlineSection['right']['sectionTitle'], $currentInlineSection['right']['sectionDescription'], $currentInlineSection['right']['sectionAlignment'][0] . '-right', $keyCurrentParagraph, $keyCurrentSection . '-right') : trim($currentInlineSection['right']['sectionContent']) ) . "

" . ( ($currentInlineSection['left']['sectionType'][0] == 'image') ? func_showImage($dokuwikiMediaUrl, $currentInlineSection['left']['sectionContent'], $currentInlineSection['left']['sectionTitle'], $currentInlineSection['left']['sectionDescription'], $currentInlineSection['left']['sectionAlignment'][0] . '-left', $keyCurrentParagraph, $keyCurrentSection . '-left') : trim($currentInlineSection['left']['sectionContent']) ) . "

"; } } } } else { $currentInlineSection['left'] = $currentParagraphSection; continue; } unset($currentInlineSection); CONDITION: Handelt es sich beim angegebenen Abschnitt um eine Gallerie

              } elseif ($currentParagraphSection['sectionType'][0] == 'gallery') {
                $currentGalleryImageArray = func_buildGalleryRepo($currentParagraphSection);
                echo func_showImage($dokuwikiMediaUrl, $currentGalleryImageArray[0]['image'], $currentGalleryImageArray[0]['title'], $currentGalleryImageArray[0]['description'], $currentParagraphSection['sectionType'][0], $keyCurrentParagraph, $keyCurrentSection);
                $imageRibbonString = func_buildGalleryRibbon($dokuwikiMediaUrl, $keyCurrentParagraph, $keyCurrentSection, $currentGalleryImageArray);
                echo '
    <div class="ct-image-gallery-ribbon">
      <div class="ct-image-gallery-ribbon-content">' . $imageRibbonString . '</div>
    </div>
                ';
              } else {
                echo ( (($currentParagraphSection['sectionTitleDisplay']) && (!empty($currentParagraphSection['sectionTitle']))) ? "<div class='ct-paragraph-section-title'>" . trim($currentParagraphSection['sectionTitle']) . "</div>" : "" );
                echo "
    <div class='ct-paragraph-section-content'" . ( ($currentParagraph['paragraphStyled']) ? "" : " style='background: none;'" ). ">" . ( ($currentParagraphSection['sectionType'][0] == 'image') ? func_showImage($dokuwikiMediaUrl, $currentParagraphSection['sectionContent'], $currentParagraphSection['sectionTitle'], $currentParagraphSection['sectionDescription'], $currentParagraphSection['sectionAlignment'][0], $keyCurrentParagraph, $keyCurrentSection) : trim($currentParagraphSection['sectionContent']) ) . "</div>
                ";
              }
            }
          echo "
  </div>
          ";
        }
      }
    //###### CLOSE: parent-container-linke-spalte: umspannender Inhalts-Container
    echo "  </div>";
    // CONDITION: Falls eine Seitenleiste eingeblendet werden soll, füge diese Hinzu
    if ((isset($pageVarArray['variables']['default']['sidebarRight'])) && (file_exists(phpConvertPageToFilesystemPath($pageVarArray['variables']['default']['sidebarRight'])))) {
      //###### BEGIN: parent-container-rechte-spalte: umspannender Inhalts-Container
      echo "<div class='ct-parent-column-right'>";
      include($sidebarRight);
      //###### CLOSE: parent-container-rechte-spalte
      echo "    </div>";
    };
  //###### CLOSE: parent-container: umspannender Inhalts-Container
  echo "</div>";
//###### JavaScript - tatsächliche Größe der ParentBox bestimmen und festlegen
//##################################################################################
  echo '  
    <script language="javascript">
      var biggestHeight = 0;
      // Loop through elements children to find & set the biggest height
      $(".parentbox*").each(function(){
        // If this elements height is bigger than the biggestHeight
        if ($(this).height() > biggestHeight ) {
         // Set the biggestHeight to this Height
         biggestHeight = $(this).height();
        }
      });
      // Set the container height
      $(".parentbox").height(biggestHeight);
    </script>
  ';
  
//###### HTML-Tag schließen
//##################################################################################
  echo '</html>';

?>

1) , 2) , 5) , 6)
$currentInlineSection['left']['sectionTitleDisplay']) && (!empty($currentInlineSection['left']['sectionTitle']
3)
$currentInlineSection['right']['sectionTitleDisplay']) && (!empty($currentInlineSection['right']['sectionTitle']
4)
$currentInlineSection['left']['sectionType'][0] == 'image') && ($currentInlineSection['right']['sectionType'][0] != 'image'