示例#1
0
function replaceCustomFilenamePlaceholders($filename, $depthArray)
{
    if (stripos($filename, '{custom') !== false) {
        $customFilesnames = getCustomFilenames();
        $custom_filename_index = $customFilesnames[0];
        $custom_filename_section = $customFilesnames[1];
        if (stripos($filename, '{customIndex}') !== false) {
            $filename = str_replace('{customIndex}', $custom_filename_index, $filename);
        } elseif (stripos($filename, '{customSection}') !== false) {
            $sectionString = "";
            for ($i = count($depthArray); $i > 0; $i--) {
                if ($sectionString != "") {
                    $sectionString .= "-()-";
                }
                $sectionString .= "{";
                $numberOfLevels = $i;
                while ($i > 1) {
                    $sectionString .= "../";
                }
                $sectionString .= "LoopIndex}";
            }
            $custom_filename_section = str_replace("#", $sectionString, $custom_filename_section);
            //die($custom_filename_section );
            $filename = str_replace('{customSection}', $custom_filename_section, $filename);
        }
    }
    return $filename;
}
示例#2
0
 function process($currentXml)
 {
     $configFilenamesPath = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'custom-filenames.php';
     include_once $configFilenamesPath;
     $customFileNames = getCustomFilenames();
     $xslAttributes = array('loopdepth' => $this->loopDepth, 'process' => $this->elementAttributes['process'], 'customFilenameIndex' => $customFileNames[0], 'customFilenameSection' => $customFileNames[1]);
     $currentXml = xsltTransform($currentXml, $this->docvertTransformDirectory . 'each-page.xsl', $xslAttributes);
     return $currentXml;
 }
示例#3
0
<?php

if (!isset($_GET['path'])) {
    die('This script is for displaying an HTML frameset and must be called with a URL parameter. It\'s not for direct access, it\'s called on document previews.');
}
$pathToUse = ensureOnlyValidCharacters(urlDecode($_GET['path']));
$pathToUse = str_replace('\\', '/', $pathToUse) . '/';
$pathToUse = str_replace('/', DIRECTORY_SEPARATOR, $pathToUse);
$thereIsAPreview = file_exists($pathToUse . 'test.html');
$configFilenamesPath = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'custom-filenames.php';
include_once $configFilenamesPath;
$customFileNames = getCustomFilenames();
$chosenFile = null;
$filesToDisplay = array($customFileNames[0], 'index.*', 'default.*', '*.odt');
foreach ($filesToDisplay as $fileToDisplay) {
    $possibleFile = getFirstByPattern($pathToUse . $fileToDisplay);
    if ($possibleFile) {
        $chosenFile = $possibleFile;
        break;
    }
}
if (!$chosenFile) {
    $filesToDisplayAsString = null;
    foreach ($filesToDisplay as $fileToDisplay) {
        $filesToDisplayAsString .= '"' . $fileToDisplay . '", ';
    }
    $filesToDisplayAsString = trim($filesToDisplayAsString);
    $filesToDisplayAsString = substr($filesToDisplayAsString, 0, strlen($filesToDisplayAsString) - 1);
    $filesInPreviewDirectory = glob($pathToUse . '*');
    die('Docvert or pipeline error: Unable to determine the file to preview. I searched for the filename patterns ' . $filesToDisplayAsString . ' were tested but do not exist. Was given pathToUse of <tt>"' . $pathToUse . '"</tt> which contained <pre>' . revealXml(print_r($filesInPreviewDirectory, true)) . '</pre>');
}