<?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 Text-Seite in dokuwiki- und xml-ähnlicher Syntax aufgerufen. */ //###### Lade die aktuelle Datei in eine Variable $pageContent = file_get_contents(phpConvertPageToFilesystemPath(htmlspecialchars($_GET["id"]))); $pageData[] = array(); //###### Setze den Pointer auf das letzte Array-Elelment end($pageData); $pageDataKey = key($pageData);
// ******************** // Variablen bestimmen // ******************** //###### URL zur Anzeige von Bildern über http/https $dokuwikiMediaUrl = 'https://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/lib/exe/fetch.php?media='; //###### Falls ein oder mehrere Bilder verwendet werden, muss der DIV benannt werden $imageCounter = 0;
// ******************** // Variablen auslesen // ******************** $pageData[$pageDataKey]['variables']=phpGetWrappedVariables(htmlspecialchars($_GET["id"]));
// ********************
// Fehlermeldung, falls keine CSS-Datei vorhanden ist
// ********************
if ( (empty($pageData[$pageDataKey]['variables']['pageCssStyle'])) || (!(file_exists(phpConvertPageToFilesystemPath($pageData[$pageDataKey]['variables']['pageCssStyle']))))) {
echo '<html>
<div style="width: 100%; height: 100px; padding-top:100px; 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($pageData[$pageDataKey]['variables']['pageCssStyle']));
// ********************
// Abschnitte auslesen
// ********************
//###### Extrahiere den relevanten Inhalt für die Bestimmung des Seiteninhalts
$substrStartPosition = strpos($pageContent, '<pagecontent>') + strlen('<pagecontent>');
$substrStopPosition = strpos($pageContent, '</pagecontent>');
$pageContent = ltrim(rtrim(substr($pageContent, $substrStartPosition, ($substrStopPosition - $substrStartPosition))));
//###### Teile den Inhaltsstring in einen Array und verwende den Endmarker der Contextbox als Trenner
$pageContentSplit = preg_split('/<\/contentbox>/i', $pageContent, 0, PREG_SPLIT_NO_EMPTY);
//###### Ermittle aus jedem gefundenen Inhaltsabschnitt den Titel und den Inhalt
foreach ($pageContentSplit as $currentContentBox) {
//###### Titel der ContentBox ermitteln
if (preg_match('/title="(.*?)"/i', $currentContentBox, $matchingContentboxTitles) == 1) {
$title = phpCleanUpVarString($matchingContentboxTitles[1]);
} else {
$title = '';
}
// ********************
//###### Fehlermeldung, falls mehr als eine ImageBox pro ContenBox existiert
// ********************
if ( substr_count($currentContentBox, '</imagebox>') > 1) {
echo '<html>
<div style="width: 100%; height: 200px; padding-top:100px; text-align: center; border: 2px solid black; font-weight: bold; font-size: 2vw;">
Fehler in Abschnitt ' . $title . ': Nur eine ImageBox pro Abschnitt!
</div>
</html>';
exit();
}
//###### Display-Status der ContentBox ermitteln
if (preg_match('/<contentbox.*?display="(.*?)"/i', $currentContentBox, $matchingContentboxTitles) == 1) {
$display = $matchingContentboxTitles[1];
} else {
$display = '';
}
//###### Style eines möglichen Bildes ermitteln der ContentBox ermitteln
$contentBoxValue = ltrim(preg_replace('/(^.*?<contentbox.*?>)/s','',$currentContentBox));
//###### Füge den gefundenen Abschnittstitel dem Abschnittsarray contentbox hinzu und ermittle den KEY des neuen Array-Wertes
$pageData[$pageDataKey]['contentboxes'][] = array(
'title' => $title,
'display' => $display
);
end($pageData[$pageDataKey]['contentboxes']);
$pageDataContentBoxesKey = key($pageData[$pageDataKey]['contentboxes']);
//###### Füge jeder Imagebox den Typ "image" hinzu
$contentBoxValue = preg_replace('/<imagebox/i', '<imagebox class="image"', $contentBoxValue);
//###### Ermittle Klasse (imagebox oder content), Typ und Style (später) der contentboxes
$contentBoxParagraphsSplitByImage = preg_split('/(<imagebox|<\/imagebox>)/i', $contentBoxValue, 0, PREG_SPLIT_NO_EMPTY);
foreach ($contentBoxParagraphsSplitByImage as $currentContentBoxParagraphContent) {
//###### Welchen Display-Typ soll der Abschnitt haben
if (preg_match('/display="(.*?)"/i', $currentContentBoxParagraphContent, $matchingDisplayTypes) == 1) {;
$paragraphDisplayType=$matchingDisplayTypes[1];
} else {
$paragraphDisplayType='';
}
//###### Welchen Style-Typ soll der Abschnitt haben
if (preg_match('/style="(.*?)"/i', $currentContentBoxParagraphContent, $matchingStyleTypes) == 1) {;
$paragraphStyleType=$matchingStyleTypes[1];
} else {
$paragraphStyleType='';
}
//###### Welche Ausrichtung soll der Abschnitt haben
if (preg_match('/align="(.*?)"/i', $currentContentBoxParagraphContent, $matchingAlign) == 1) {;
$paragraphAlign=$matchingAlign[1];
} else {
$paragraphAlign='';
}
//###### Falls es sich bei dem Abschnittsteil um ein Image handelt
if (strpos($currentContentBoxParagraphContent, 'class="image"')) {
//###### Welche Images sollen ausgeschlossen werden (derzeit relevant für Gallerien und nur bei der Anzeige aller Bilder eines Verzeichnisses)
if (preg_match('/exclude="(.*?)"/i', $currentContentBoxParagraphContent, $matchingImagesToExclude) == 1) {;
$imagesToExclude=$matchingImagesToExclude[1];
} else {
$imagesToExclude='';
}
if (preg_match('/filter="(.*?)"/i', $currentContentBoxParagraphContent, $matchingSearchPattern) == 1) {;
$searchPattern=$matchingSearchPattern[1];
} else {
$searchPattern='';
}
//###### Die Klasse der ContentBox festlegen (image)
$paragraphClass="image";
//###### String bereinigen, so dass nur noch <image></image>-Tags vorhanden sind
$currentContentBoxParagraphContent = ltrim(rtrim(preg_replace('/(style=".*?">)/s','',$currentContentBoxParagraphContent)));
//###### Den Inhalts-String der Images splitten (falls mehre Images übergeben wurden)
$paragraphImageSplit = preg_split('/(<\/image>)/i', $currentContentBoxParagraphContent, 0, PREG_SPLIT_NO_EMPTY);
//######Die Zwischenspeicher-Variable paragraphImages löschen
unset($paragraphImages);
//###### Das Array mit dem Image oder den Images durchlaufen
foreach ($paragraphImageSplit as $currentParagraphImage) {
//###### Eine eventuell vorhandene Beschreibung des Bildes (alt für alternate text) ermitteln
if (preg_match('/alt="(.*?)"/i', $currentParagraphImage, $matchingImageDescriptions) ==1 ) {
$imageDescription = $matchingImageDescriptions[1];
} else {
$imageDescription = "";
}
//###### Den Wert ermitteln, indem der Image-Tag entfernt wird
$imagePathValue = ltrim(rtrim(preg_replace('/(^.*?<image.*?>)/s','',$currentParagraphImage)));
$paragraphImages[] = array(
'imageDescription' => $imageDescription,
'imagePath' => $imagePathValue
);
}
$paragraphContent = $paragraphImages;
//###### Falls es sich bei dem Abschnittsteil um Text handelt
} else {
//###### Die Klasse der ContentBox festlegen (text)
$paragraphClass="text";
//###### Den Typ der ContentBox festlegen
$paragraphType="text";
//###### Den Inhalt unverändert übernehmen (da kein Image)
$paragraphContent = phpCleanUpVarString($currentContentBoxParagraphContent);
$matches = explode("\n",$paragraphContent); if (preg_match('/ \*/', end(array_values($matches)))) { echo 'Gefunden'; $paragraphContent .= "\r\n"; } } ###### Füge die Art und den Inhalt (Text oder Bilder) der Abschnittsbereiche hinzu
$pageData[$pageDataKey]['contentboxes'][$pageDataContentBoxesKey]['paragraph'][] = array(
'class' => $paragraphClass,
'style' => $paragraphStyleType,
'align' => $paragraphAlign,
'display' => $paragraphDisplayType,
'exclude' => $imagesToExclude,
'filter' => $searchPattern,
'content' => $paragraphContent
);
}
}
// ********************
// Bild-Daten sammeln und korrigieren
// ********************
//###### 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 (vereinfacht das Hochladen von Bildern über den MediaManager)
$filePathOfPageImagesSplit=explode('/', ltrim($filePathOfPageImages, '/'));
$pathOfPageImagesBreadcrumb = '';
foreach($filePathOfPageImagesSplit as $currentPathOfPageImagesSubfolder) {
$pathOfPageImagesBreadcrumb .= '/' . $currentPathOfPageImagesSubfolder;
if (!file_exists($pathOfPageImagesBreadcrumb)) {
mkdir($pathOfPageImagesBreadcrumb);
}
}
// ********************
// JavaScript-Funktionen für Slideshow und FullScreen/Lightbox
// ********************
//###### Lightbox-Funktionen-String erstellen (JavaScript)
$jsLightboxFunctions = '
<script language="javascript">
function rotateimages(givenImageDiv, givenimage){
document.getElementById("enlargedImage").setAttribute("src", "' . $dokuwikiMediaUrl . '" + givenimage);
document.getElementById(givenImageDiv).setAttribute("src", "' . $dokuwikiMediaUrl . '" + givenimage);
img = document.getElementById(givenImageDiv)
}
function fullscreen(givenImageDivId) {
imgDiv = document.getElementById("fullscreenimage");
imgDiv.style = "visibility: visible;";
imgGiven = document.getElementById(givenImageDivId);
document.getElementById("enlargedImage").setAttribute("src", imgGiven.src);
imgEnlarged = document.getElementById("enlargedImage");
if (imgEnlarged.naturalWidth > imgEnlarged.naturalHeight) {
imgEnlarged.style = "width: 100%; height: auto; top: 50%; transform: translateY(-50%);";
} else {
imgEnlarged.style = "width: auto; height: 100%; left: 50%; transform: translateX(-50%);";
}
}
function thumbnail() {
img = document.getElementById("fullscreenimage");
img.style = "visibility: hidden;";
}
function resizeImage( idName ) {
img = document.getElementById(idName);
if (img.naturalWidth > img.naturalHeight) {
img.style = "width: 100%; height: auto; top: 50%; transform: translateY(-50%);";
} else {
img.style = "width: auto; height: 100%; left: 50%; transform: translateX(-50%);";
}
}
</script>
';
//###### Variabeln bestimmen und korrigieren
//##################################################################################
// ###### Rechte Sidbar
$sidebarRight = phpConvertPageToFilesystemPath($pageData[$pageDataKey]['variables']['pageSidebarRight']);
// ###### URL zur Anzeige von Bildern über http/https
$dokuwikiMediaUrl = 'https://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/lib/exe/fetch.php?media=';
// ###### Daten zum Erstellungszeitpunkt
$pageData[$pageDataKey]['variables']['pageCreationDate'] = date("d.m.Y",strtotime($pageData[$pageDataKey]['variables']['pageCreationDate']));
$pageData[$pageDataKey]['variables']['pageCreationTimeStamp'] = strtotime("{$pageData[$pageDataKey]['variables']['pageCreationDate']} {$pageData[$pageDataKey]['variables']['pageCreationTime']}");
Standard-Bilder pruefen ###### Cover des Artikels suchen und korrigieren
if (file_exists($filePathOfPageImages . '/page_cover.png')) {
$imagePageCover = $_GET["id"] . ':page_cover.png';
} elseif (file_exists($filePathOfPageImages . '/page_cover.jpg')) {
$imagePageCover = $_GET["id"] . ':page_cover.jpg';
} elseif (file_exists($filePathOfParentPageImages . '/standard_page_cover.png')) {
$imagePageCover = $wikiPathOfParentPageImages . ':standard_page_cover.png';
} elseif (file_exists($filePathOfParentPageImages . '/standard_page_cover.jpg')) {
$imagePageCover = $wikiPathOfParentPageImages . ':standard_page_cover.jpg';
} else {
$imagePageCover = '';
}
//###### Banner des Artikels suchen und korrigieren
if (file_exists($filePathOfPageImages . '/page_banner.png')) {
$imagePageBanner = $_GET["id"] . ':page_banner.png';
} elseif (file_exists($filePathOfPageImages . '/page_banner.jpg')) {
$imagePageBanner = $_GET["id"] . ':page_banner.jpg';
} elseif (file_exists($filePathOfParentPageImages . '/standard_page_banner.png')) {
$imagePageBanner = $wikiPathOfParentPageImages . ':standard_page_banner.png';
} elseif (file_exists($filePathOfParentPageImages . '/standard_page_banner.jpg')) {
$imagePageBanner = $wikiPathOfParentPageImages . ':standard_page_banner.jpg';
} else {
$imagePageBanner = '';
}
//###### Vergleichsbild 1 suchen und korrigieren
if (file_exists($filePathOfPageImages . '/page_comp1.png')) {
$imagePageComp1 = $_GET["id"] . ':page_comp1.png';
} elseif (file_exists($filePathOfPageImages . '/page_comp1.jpg')) {
$imagePageComp1 = $_GET["id"] . ':page_comp1.jpg';
} elseif (file_exists($filePathOfParentPageImages . '/standard_page_comp1.png')) {
$imagePageComp1 = $wikiPathOfParentPageImages . ':standard_page_comp1.png';
} elseif (file_exists($filePathOfParentPageImages . '/standard_page_comp1.jpg')) {
$imagePageComp1 = $wikiPathOfParentPageImages . ':standard_page_comp1.jpg';
} else {
$imagePageComp1 = '';
}
//###### Vergleichsbild 2 suchen und korrigieren
if (file_exists($filePathOfPageImages . '/page_comp2.png')) {
$imagePageComp2 = $_GET["id"] . ':page_comp2.png';
} elseif (file_exists($filePathOfPageImages . '/page_comp2.jpg')) {
$imagePageComp2 = $_GET["id"] . ':page_comp2.jpg';
} elseif (file_exists($filePathOfParentPageImages . '/standard_page_comp2.png')) {
$imagePageComp2 = $wikiPathOfParentPageImages . ':standard_page_comp2.png';
} elseif (file_exists($filePathOfParentPageImages . '/standard_page_comp2.jpg')) {
$imagePageComp2 = $wikiPathOfParentPageImages . ':standard_page_comp2.jpg';
} else {
$imagePageComp2 = '';
}
namespace-abhängige Standard-Bilder pruefen ###### Zutatenbild suchen und korrigieren
if (file_exists($filePathOfPageImages . '/page_ingredients.png')) {
$imagePageIngredients = $_GET["id"] . ':page_ingredients.png';
} elseif (file_exists($filePathOfPageImages . '/page_ingredients.jpg')) {
$imagePageIngredients = $_GET["id"] . ':page_ingredients.jpg';
} elseif (file_exists($filePathOfParentPageImages . '/standard_page_ingredients.png')) {
$imagePageIngredients = $wikiPathOfParentPageImages . ':standard_page_ingredients.png';
} elseif (file_exists($filePathOfParentPageImages . '/standard_page_ingredients.jpg')) {
$imagePageIngredients = $wikiPathOfParentPageImages . ':standard_page_ingredients.jpg';
} else {
$imagePageIngredients = '';
}
//###### Generiere anhand der Contentboxes die Darstellung //##################################################################################
//###### HTML-Tag öffnen //################################################################################## echo '<html>';
//###### JavaScript-Funktionen einbinden, falls gesetzt
//##################################################################################
if (isset($jsLightboxFunctions)) { echo $jsLightboxFunctions; }
//###### Parent-Inhalts-Container und Fullscreen-Image-Container erzeugen
//##################################################################################
echo '
<div id="fullscreenimage" class="contentbox-content-image-full-overlay">
<div onclick="thumbnail()" class="contentbox-content-image-full-overlay-image">✗<img id="enlargedImage" src="' . $dokuwikiMediaUrl . $images[0] . '"></div>
</div>
<div class="parentbox"><!-- ###### parentbox umspannender Inhalts-Container (öffnen) -->
<div class="sectionbox-row"><!-- ###### Sectionbox für Spalten im umspannenden Inhalts-Container (öffnen) -->
';
//##################################################################################
//###### LINKE Spalte öffnen
//###############################
echo'
<div class="parentbox-contentbox-left"><!-- ###### Linke Spalte (öffnen) -->
';
//###### Erstellungsdatum und Autor anzeigen
echo'
<div class="dateBox">Beitrag vom ' . $pageData[$pageDataKey]['variables']['pageCreationDate'] . ' auf ' . $_SERVER['SERVER_NAME'] . ' von </html>[[user:' . $pageData[$pageDataKey]['variables']['pageCreationUser'] . ']]<html></div><br /><br />
';
//###### Titel, Subtitel und Kategorien anzeigen
echo'
<div class="titlebox"><!-- ###### titlebox (Produktname) (öffnen)-->
<div class="titlebox-title"></html>' . str_replace('\\\\', '\\\\ ', $pageData[$pageDataKey]['variables']['pageTitleRow1']) . '<html></div>
<div class="titlebox-content">' . $pageData[$pageDataKey]['variables']['pageTitleRow2'] . '</div>
</div><!-- ###### titlebox (Produktname) (schließen)-->
';
//###### ContentBox-Elemente anhand des Arrays dynamisch erzeugen
//###### Den Eycatcher anzeigen, falls die Variable nicht leer ist
if (!empty($pageData[$pageDataKey]['variables']['pageEyeCatcher'])) {
echo '
<div class="sectionbox-row"><!-- ###### sectionbox (Eyecatcher) (schließen) -->
<div class="contentbox">
<div class="contentbox-title">' . $pageData[$pageDataKey]['variables']['pageEyeCatcher'] . '</div>
</div>
</div><!-- ###### sectionbox (Eyecatcher) (schließen) -->
';
}
//###### Alle Abschnitte nacheinander listen und die entsprechenden DIVs einbinden
foreach ($pageData[$pageDataKey]['contentboxes'] as $currentContentBox) {
// ###### Gibt es in dem Abschnitt einen Unterabschnitt mit Bild (
$paragraphContainingImageKey = array_search('image', array_column($currentContentBox["paragraph"], 'class'));
unset($currentImageBoxStyle);
unset($currentImageBoxAlign);
unset($currentImageBoxDisplay);
if ($paragraphContainingImageKey !== false) {
$currentImageBoxStyle = $currentContentBox["paragraph"][$paragraphContainingImageKey]['style'];
$currentImageBoxAlign = $currentContentBox["paragraph"][$paragraphContainingImageKey]['align'];
$currentImageBoxDisplay = $currentContentBox["paragraph"][$paragraphContainingImageKey]['display'];
}
//###### Soll der Abschnitt ausgeblendet werden, dann überspringe diese ContentBox
if ($currentContentBox['display']=='none') {
continue;
}
//###### Öffne den nächsten Abschnitts-Block
echo '<div class="sectionbox-row"><!-- ###### sectionbox (öffnen) -->';
//###### Falls der Abschnitt ein Image des Typs Cover oder Banner enthält, blende Rahmen und Hintergrundfarbe aus
if ( (!($currentImageBoxStyle=='cover')) && (!($currentImageBoxStyle=='banner')) ) {
echo '<div class="contentbox">';
}
//###### Falls der Abschnitt einen Titel enthält, öffne den Titelbereich des Abschnitts
if ( !empty($currentContentBox['title']) ) {
echo '<div class="contentbox-title">' . $currentContentBox['title'] . '</div>';
}
//###### Öffnen den Inhaltsbereich des Abschnitts
echo '<div class="contentbox-content">';
//Alle Unterabschnitte listen und je nach Klasse und Style formatieren
foreach ($currentContentBox['paragraph'] as $currentContentBoxParagraph) {
//###### Handelt es sich um einen Bildabschnitt
if ($currentContentBoxParagraph['class']=='image') {
//###### Für eine COVERBOX notwendige Image-Korrekturen
//#######################################################
if ($currentContentBoxParagraph['style']=='cover') {
//###### Wurde kein Bild angegeben oder existiert das angegebene Bild nicht, so nutze das Standard-Image, falls dieses existiert
if ((empty($currentContentBoxParagraph['content'][0]['imagePath'])) || (!file_exists(str_replace('/pages/media/', '/media/', phpConvertNamespaceToFilesystemPath('media:' . $currentContentBoxParagraph['content'][0]['imagePath']))))) {
if (!empty($imagePageCover)) {
//###### Wenn nein, benutze das Standard-Cover (falls es existiert)
$currentContentBoxParagraph['content'][0]['imagePath'] = $imagePageCover;
} else {
//###### Existiert überhaupt kein Cover, so sezte den Wert auf leer
$currentContentBoxParagraph['content'][0]['imagePath'] = '';
}
}
}
//#######################################################
//###### Für eine COVERBOX notwendige Image-Korrekturen
//###### Für eine COMPARE notwendige Image-Korrekturen
//#######################################################
if ($currentContentBoxParagraph['style']=='compare') {
//###### Wurde ein Bild für Compare 1 angegeben und existiert es
if ((empty($currentContentBoxParagraph['content'][0]['imagePath'])) || (!file_exists(str_replace('/pages/media/', '/media/', phpConvertNamespaceToFilesystemPath('media:' . $currentContentBoxParagraph['content'][0]['imagePath']))))) {
//###### Wenn ja, benutze das angegebene Bild
if (!empty($imagePageComp1)) {
$currentContentBoxParagraph['content'][0]['imagePath'] = $imagePageComp1;
} else {
//###### Existiert überhaupt kein Cover, so sezte den Wert auf leer
$currentContentBoxParagraph['content'][0]['imagePath'] = '';
}
}
//###### Wurde ein Bild für Compare 2 angegeben und existiert es
if ((empty($currentContentBoxParagraph['content'][1]['imagePath'])) || (!file_exists(str_replace('/pages/media/', '/media/', phpConvertNamespaceToFilesystemPath('media:' . $currentContentBoxParagraph['content'][1]['imagePath']))))) {
//###### Wenn ja, benutze das angegebene Bild
if (!empty($imagePageComp2)) {
$currentContentBoxParagraph['content'][1]['imagePath'] = $imagePageComp2;
} else {
//###### Existiert überhaupt kein Cover, so sezte den Wert auf leer
$currentContentBoxParagraph['content'][1]['imagePath'] = '';
}
}
}
//#######################################################
//###### Für eine COMPARE notwendige Image-Korrekturen
//###### Für eine GALLERY notwendige Image-Korrekturen
//#######################################################
//###### Gallery: Eine Gallerie anzeigen, falls die Variable nicht leer ist
if ($currentContentBoxParagraph['style']=='gallery') {
//###### Alle Page-Images sammeln
$images = getAllImages($searchPath=strtolower($filePathOfPageImages), $currentContentBoxParagraph['filter'], $currentContentBoxParagraph['exclude']);
//###### Wurden Bilder gefunden
if (isset($images)) {
//###### Alle Bilder am angegebenen Pfad finden (hier Produkt-Mediendateien)
array_multisort($images, SORT_ASC, $images);
//###### Bilder des Arrays popElements entfernen
$popElements = array('page_banner',);
for ($counter=sizeof($images); $counter >=0; $counter--) {
foreach ($popElements as $popElement) {
if (strpos($images[$counter], $popElement)) {
unset($images[$counter]);
}
}
}
sort($images);
}
//###### Falls nur die angegebenen Bilder angezeigt werden sollen, das bisherige Array löschen
$currentGalleryImageArray = array();
if ($currentContentBoxParagraph['display'] != 'custom') {
$currentGalleryImageArray = $images;
}
//###### Die angegebenen Bilder dem Array hinzufügen (custom zeigt nur diese an, join zeigt alle Bilder an)
if (($currentContentBoxParagraph['display'] == 'custom') || ($currentContentBoxParagraph['display'] == 'join')) {
//###### Überprüfe alle angegebenen Images, ob sie existieren
foreach ($currentContentBoxParagraph['content'] as $currentGalleryImage) {
if (!empty($currentGalleryImage['imagePath']) && (file_exists(str_replace('/pages/media/', '/media/', phpConvertNamespaceToFilesystemPath('media:' . $currentGalleryImage['imagePath']))))) {
$currentGalleryImageArray[] = $currentGalleryImage['imagePath'];
}
}
}
$currentGalleryImageArray=array_unique($currentGalleryImageArray);
//###### Gallerie-Ribbon-String mit allen Bildern erstellen
$imageSuffixGallery=$imageCounter++;
$imageRibbonString = '';
foreach ($currentGalleryImageArray as $currentImage) {
$imageRibbonString .= '<img id="slideshow" onclick="rotateimages(\'previewImage' . $imageSuffixGallery . '\', \'' . $currentImage . '\'); return false;" onmouseover="rotateimages(\'previewImage' . $imageSuffixGallery . '\', \'' . $currentImage . '\'); return false;" src="' . $dokuwikiMediaUrl . $currentImage . '" />';
}
}
//#######################################################
//###### Für eine GALLERY notwendige Image-Korrekturen
//###### Für ein einfaches PREVIEW-Image notwendige Image-Korrekturen
//#######################################################
if ($currentContentBoxParagraph['style'] == 'image') {
}
//###### Handelt es sich um eine Image oder eine Coverbox
if (($currentContentBoxParagraph['style'] == 'image') || ($currentContentBoxParagraph['style'] == 'cover')){
if ((!empty($currentContentBoxParagraph['content'][0]['imagePath'])) && ($currentContentBoxParagraph['display'] != 'none') && (file_exists(str_replace('/pages/media/', '/media/', phpConvertNamespaceToFilesystemPath('media:' . $currentContentBoxParagraph['content'][0]['imagePath']))))) {
//###### PREVIEWBOX:
$imageSuffix=$imageCounter++;
echo '
<div class="contentbox-content-image-' . $currentContentBoxParagraph['align'] . '">
<img onclick="fullscreen(\'previewImage' . $imageSuffix . '\')" id="previewImage' . $imageSuffix . '" src="' . $dokuwikiMediaUrl . $currentContentBoxParagraph['content'][0]['imagePath'] . '">
<div class="contentbox-content-image-description">
<a href="' . $dokuwikiMediaUrl . $currentContentBoxParagraph['content'][0]['imagePath'] . '" target="_blank">↗ Abb: ' . ( (!empty($currentContentBoxParagraph['content'][0]['imageDescription'])) ? $currentContentBoxParagraph['content'][0]['imageDescription'] : 'Vollbild (ext.)' ). '</a>
</div>
</div>
';
}
//###### Handelt es sich um eine Comparebox
} elseif ($currentContentBoxParagraph['style'] == 'compare') {
if ((!empty($currentContentBoxParagraph['content'][0]['imagePath'])) && (!empty($currentContentBoxParagraph['content'][1]['imagePath'])) && ($currentContentBoxParagraph['display'] != 'none')) {
//###### COMPAREBOX:
$imageSuffixComp1=$imageCounter++;
$imageSuffixComp2=$imageCounter++;
echo '
<div class="sectionbox-row"><!-- ###### sectionbox (öffnen) -->
<div class="contentbox-content-image-center">
<img onclick="fullscreen(\'previewImage' . $imageSuffixComp1 . '\')" id="previewImage' . $imageSuffixComp1 . '" src="' . $dokuwikiMediaUrl . $currentContentBoxParagraph['content'][0]['imagePath'] . '">
<div class="contentbox-content-image-description">
<a href="' . $dokuwikiMediaUrl . $currentContentBoxParagraph['content'][0]['imagePath'] . '" target="_blank">↗ Abb.1: ' . ( (!empty($currentContentBoxParagraph['content'][0]['imageDescription'])) ? $currentContentBoxParagraph['content'][0]['imageDescription'] : 'Vollbild (ext.)' ). '</a>
</div>
</div>
<div class="contentbox-content-image-center">
<img onclick="fullscreen(\'previewImage' . $imageSuffixComp2 . '\')" id="previewImage' . $imageSuffixComp2 . '" src="' . $dokuwikiMediaUrl . $currentContentBoxParagraph['content'][1]['imagePath'] . '">
<div class="contentbox-content-image-description">
<a href="' . $dokuwikiMediaUrl . $currentContentBoxParagraph['content'][1]['imagePath'] . '" target="_blank">↗ Abb.2: ' . ( (!empty($currentContentBoxParagraph['content'][1]['imageDescription'])) ? $currentContentBoxParagraph['content'][1]['imageDescription'] : 'Vollbild (ext.)' ). '</a>
</div>
</div>
</div>
';
}
//###### Handelt es sich um eine Gallerie
} elseif ($currentContentBoxParagraph['style'] == 'gallery') {
if ((isset($currentGalleryImageArray)) && ($currentContentBoxParagraph['display'] != 'none')) {
//###### GALLERY
echo'
<div onclick="fullscreen(\'previewImage' . $imageSuffixGallery . '\')" class="contentbox-content-gallery">
<img id="previewImage' . $imageSuffixGallery . '" src="' . $dokuwikiMediaUrl . $currentGalleryImageArray[0] . '">
</div>
<div class="contentbox-content-gallery-ribbon"><!-- ###### Thumbnail-Ribbon aller Images (öffnen) -->
<div class="contentbox-content-gallery-ribbon-content">' . $imageRibbonString . '</div>
</div><!-- ###### Thumbnail-Ribbon aller Images (schließen) -->
';
}
} else {
}
}
//###### Handelt es sich um einen Textabschnitt
if ($currentContentBoxParagraph['class']=='text') {
if ($currentContentBoxParagraph['style']=='normpage') {
//###### Es handelt sich um eine Normseite:
} else {
//###### Es handelt sich um normalen Text:
echo '<div class="contentbox-content-text"></html>' . $currentContentBoxParagraph['content'] . '<html></div>';
}
}
}
//###### Falls es keine Stand-Alone-Cover-ContentBox ist, schließe einen umspannenden DIV
echo ' </div><!-- ###### content (schließen) -->';
if ( (!($currentImageBoxStyle=='cover')) && (!($currentImageBoxStyle=='banner')) ) {
echo '</div>';
}
echo '</div><!-- ###### sectionbox (schließen) -->';
}
echo'
</div><!-- ###### Linke Spalte (schließen) -->
';
//###############################
//###### LINKE Spalte schließen
//##################################################################################
//##################################################################################
//###### RECHTE Spalte öffnen
//###############################
echo '
<div class="parentbox-contentbox-right"><!-- ###### ###### Rechte Spalte (öffnen) -->
';
include($sidebarRight);
echo '
</div><!-- ###### ###### Rechte Spalte (schließen) -->
';
//###############################
//###### RECHTE Spalte schließen
//##################################################################################
echo '
</div><!-- ###### Sectionbox für Spalten im umspannenden Inhalts-Container (schließen) -->
</div><!-- ###### parentbox umspannender Inhalts-Container (schließen) -->
';
//###### 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>';
?>