<?php include(dirname(FILE) . '/func_phpCleanUpVariableString.txt'); include(dirname(FILE) . '/func_phpBookGetWrappedContent.txt'); include(dirname(FILE) . '/func_phpGetWrappedVariables.txt'); include(dirname(FILE) . '/func_phpBookGetStructureRecursive.txt'); include(dirname(FILE) . '/func_phpCreateProjectIndex.txt'); include(dirname(FILE) . '/func_phpSplitgivenContentByChars.txt'); / * Converts a given dokuwiki-path into the filesystem-path * * @param string $pageToConvert path to the php-wiki-page * @return returns the filesystem-path */ function phpConvertPageToFilesystemPath( $pageToConvert ) { if 1) { $pageToConvert = realpath(dirname(FILE).'/..') . '/' . preg_replace('/:/','/', $pageToConvert) . '.txt'; } return $pageToConvert; } / * Converts a given dokuwiki-path into the filesystem-path * * @param string $namespaceToConvert path to the php-wiki-namespace * @return returns the filesystem-path */ function phpConvertNamespaceToFilesystemPath( $namespaceToConvert ) { if 2) { $namespaceToConvert = realpath(dirname(FILE).'/..') . '/' . preg_replace('/:/','/', $namespaceToConvert); } return $namespaceToConvert; } /** * Converts a given string into a dokuwiki-path * * @param string $string path to the php-wiki-namespace * @return returns the dokuwiki-path */ function phpCreateDokuWikiConformName($string) { $search = array("Ä", "Ö", "Ü", "ä", "ö", "ü", "ß", "´", "`", " ", "/", "\\", 'data:media:', 'data:pages:', ".txt"); $replace = array("Ae", "Oe", "Ue", "ae", "oe", "ue", "ss", "", "", "_", ":", ":", "", "", ""); return strtolower(str_replace($search, $replace, $string)); } ################################################################################## ###### Funktion: Rekursives durchsuchen nach Blog-Eintraegen ###### Hinweis: Wird durch die Funktion getAndValidateBlogEntries() aufgerufen ################################################################################## function recursiveScanBlogEntries($dir) { ###### Wenn Uebergabewert In DokuWiki-Pfad-Syntax, dann konvertiere zu File-System-Pfad-Syntax
if ((strpos($dir,':'))) {
//###### String enthält :
$tree = glob(rtrim(phpConvertNamespaceToFilesystemPath($dir), '/') . '/*');
} elseif (strpos($dir,'/') !== false ) {
//###### String enthält /
$tree = glob(rtrim($dir, '/') . '/*');
} else {
//###### String enthält weder : noch /
$tree = glob(rtrim(phpConvertNamespaceToFilesystemPath($dir), '/') . '/*');
}
global $includedFile;
//###### Exclude-Liste (Verzeichnisse und Dateien) in Array umwandeln
if (is_array($tree)) {
foreach($tree as $file) {
//echo "Gefunden: $file <br />";
//###### Falls ein Verzeichnis gefunden wird, auch dieses rekursiv durchsuchen
if (is_dir($file)) {
//echo "Verzeichnis gefunden: $file <br />";
recursiveScanBlogEntries($file);
//###### Falls eine Datei gefunden wird, weitere Schritte vornehmen
} elseif (is_file($file)) {
if (((strpos($file, 'pagedata'))) && (!(strpos($file, '_template')))) {
//###### Diese Datei einschliessen
//echo "Datei $file einschliessen <br /> ";
//###### 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");
}
$dokuWikiConformPagePath= phpCreateDokuWikiConformName(substr(str_replace(realpath(dirname(__FILE__) . '/../../..'), '', $file),1));
echo "Test: " . $_SERVER["SCRIPT_NAME"] . " – " . realpath(dirname(FILE)) . " – " . str_replace(realpath(dirname(FILE) . '/../../..'), , $file). "<br />";
echo $dokuWikiConformPagePath . "<br />";
###### Datei dem Blog-Page-Array hinzufuegen
$includedFile[] = $dokuWikiConformPagePath;
}
}
}
}
###### globales Array uebergeben
return $includedFile;
}
##################################################################################
###### Funktion: Validierung der Seiten-Paare
##################################################################################
function getAndValidateBlogEntries($dir) {
$includedFile = recursiveScanBlogEntries($dir);
foreach ($includedFile as $file) {
###### alle zu pagedata uebergeordneten Namespaces finden (noch mit Doppelungen) und in Array schreiben
###### Erforderlich, um Blog-Initialeiten und Blog-Inhaltsseiten abzugleichen
$allNamespacesAbovePagedata[] = str_replace(':pagedata:' . end(explode(':', $file)), , $file);
###### Falls kein zugehoeriges Medien-Verzeichnis existiert, erstelle es
$search = array('/data/pages/','.txt');
$replace = array('/data/media/','');
if (!(file_exists(str_replace($search, $replace, phpConvertPageToFilesystemPath($file))))) {
mkdir(strtolower(str_replace($search, $replace, phpConvertPageToFilesystemPath($file))));
}
//###### Entferne das pagedata und pruefe ob die Paar-Datei im uebergeordneten Verzeichnis existiert
$cutPagedataFromCurrentFile = phpConvertPageToFilesystemPath(str_replace('pagedata:', '' , $file));
//###### Falls die Datei nicht existiert, erstelle sie mit dem Verweis auf die Inhaltsseite unter pagedate
if (!(file_exists($cutPagedataFromCurrentFile))) {
//###### Template fuer fehlende Wiki-Pages zu Produkttest
$currentNamespaceTemplate = $dir . ':vorlagen:nsp_tpl_' . str_replace(':' , '_', $dir . str_replace($dir , '' , str_replace(':pagedata:' . end(explode(':', $file)), '' , $file)));
$pageFileContent = '
~~NOCACHE~~
<phpwikify>
include(phpConvertPageToFilesystemPath("' . $currentNamespaceTemplate . '"));
</phpwikify>
';
file_put_contents( $cutPagedataFromCurrentFile, str_replace(' ', '', $pageFileContent) );
} else {
}
}
//##### pruefe, ob zu der Wiki-Page eine pagedata-Page existiert
$allNamespacesAbovePagedata = array_unique($allNamespacesAbovePagedata);
foreach ($allNamespacesAbovePagedata as $singleNamespaceAbovePagedata) {
$filesInNamespace = glob(phpConvertNamespaceToFilesystemPath($singleNamespaceAbovePagedata) . '/*.txt');
foreach ($filesInNamespace as $singleFileInNamespace) {
$connectedPagedataFile = str_replace('/'. end(explode('/', $singleFileInNamespace)),'',$singleFileInNamespace) . '/pagedata/' . end(explode('/', $singleFileInNamespace));
if ( (!(strpos('_template', $connectedPagedataFile))) && (!(file_exists($connectedPagedataFile))) ){
unlink($singleFileInNamespace);
}
}
}
//###### globales Array uebergeben return $includedFile; }
##################################################################################
###### Funktion: Rekursives durchsuchen nach Bildern
##################################################################################
function getAllImages($dir, $filter, $excludeArray) {
if ( (empty($filter)) || ($filter == ) || (!isset($filter))) {
$filter = '*';
}
###### Wenn Uebergabewert In DokuWiki-Pfad-Syntax, dann konvertiere zu File-System-Pfad-Syntax
if 3)) {
###### 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);
}
global $includedImages;
if (is_array($tree)) {
foreach($tree as $file) {
echo "Gefunden: $file \\, $file),1));
$includedImages[] = $dokuWikiConformPagePath;
}
}
}
}
###### globales Array uebergeben
return $blogPageData;
return $includedImages;
}
##################################################################################
###### Funktion: Rekursives durchsuchen nach Blog-Eintraegen
##################################################################################
";
###### Falls ein Verzeichnis gefunden wird, auch dieses rekursiv durchsuchen
if (is_dir($file)) {
echo "Verzeichnis gefunden: $file \\
";
getAllImages($file);
###### Falls eine Datei gefunden wird, weitere Schritte vornehmen
} elseif (is_file($file)) {
echo "Datei gefunden: $file <br />";
###### Falls Datei verarbeitet werden soll, inkludieren und in ganzheitliches Array fuellen
if ( (strpos($file, '.jpg')) || (strpos($file, '.png')) ) {
echo "Datei $file einschliessen <br />";
###### 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");
}
$dokuWikiConformPagePath= phpCreateDokuWikiConformName(substr(str_replace(realpath(dirname(FILE) . '/../../..'),
function recursiveScan($dir, $excludeArray) {
global $includedFile;
//###### Exclude-Liste (Verzeichnisse und Dateien) in Array umwandeln
$tree = glob(rtrim($dir, '/') . '/*.txt');
if (is_array($tree)) {
foreach($tree as $file) {
echo "Gefunden: $file \\
";
###### Falls ein Verzeichnis gefunden wird, auch dieses rekursiv durchsuchen
if (is_dir($file)) {
echo "Verzeichnis gefunden: $file \\
";
recursiveScan($file, $excludeArray);
###### Falls eine Datei gefunden wird, weitere Schritte vornehmen
} elseif (is_file($file)) {
echo "Datei gefunden: $file \\
";
$includeThisFile = 0;
###### Pruefen, ob die Datei auf der Exclude-Liste steht
$excludeThisFile = 0;
foreach($excludeArray as $excludeStringElement) {
if ( ((!(strpos($file, 'pagedata'))) && (!(strpos($file, '/data/media/')))) || (strpos($file, $excludeStringElement))) { $excludeThisFile = 1; }
}
if ( $excludeThisFile == 1 ) {
echo "Datei $file ausschliessen \\
";
} else {
echo "Datei $file einschliessen \\
";
}
//###### Falls Datei verarbeitet werden soll, inkludieren und in ganzheitliches Array fuellen
if ($excludeThisFile == 0) {
//###### 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");
}
$dokuWikiConformPagePath= phpCreateDokuWikiConformName(substr(str_replace(realpath(dirname(__FILE__) . '/../../..'), '', $file),1));
echo "Test: " . $_SERVER["SCRIPT_NAME"] . " – " . realpath(dirname(FILE)) . " – " . str_replace(realpath(dirname(FILE) . '/../../..'), '', $file). " \\
";
echo $dokuWikiConformPagePath . " \\
";
$includedFile[] = $dokuWikiConformPagePath;
}
}
}
}
###### globales Array uebergeben return $blogPageData;
return $includedFile; }
################################################################################## ###### Funktion: Volle Browser-URL zu angegebenem Bild ermitteln ################################################################################## function getUrlOfImage ( $givenImageWikiPath ) { if( isset($_SERVER['HTTPS'] ) ) { $dokuwikiMediaUrl = 'https:' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/lib/exe/fetch.php?media=' . $givenImageWikiPath;
} else {
$dokuwikiMediaUrl = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/lib/exe/fetch.php?media=' . $givenImageWikiPath;
}
return $dokuwikiMediaUrl;
}
###################################################################################################### JavaScript-Functions ###################################################################################################### ?>