示例#1
0
文件: xslt.php 项目: Nolfneo/docvert
function xsltTransform($xmlString, $xsltPath, $xsltArguments = null)
{
    if (!file_exists($xsltPath)) {
        webserviceError('&error-xslt-path-not-found;', 500, array('path' => $xsltPath));
    }
    $result = null;
    $xsltEnabledStatus = getXsltEnabledStatus();
    switch ($xsltEnabledStatus) {
        case 'php5':
            $xslt = new XSLTProcessor();
            $xsltDocument = new DOMDocument();
            $xsltDocument->load($xsltPath);
            $xslt->importStyleSheet($xsltDocument);
            if (is_array($xsltArguments)) {
                foreach ($xsltArguments as $key => $value) {
                    $xslt->setParameter('', $key, $value);
                }
            }
            $errorLevelToDescribeMerelyDeprecatedWarnings = 999999;
            $xmlDocument = new DOMDocument();
            $xmlDocument->loadXML($xmlString);
            $result = $xslt->transformToXML($xmlDocument);
            break;
        case 'php4':
            $xsltproc = xslt_create();
            $xmlString = array('/_xml' => $xmlString);
            $xsltPath = 'file://' . $xsltPath;
            $result = @xslt_process($xsltproc, 'arg:/_xml', $xsltPath, NULL, $xmlString, $xsltArguments) or webServiceError('&error-xslt-processor-error;', 500, array('path' => $xsltPath, 'errorMessage' => xslt_error($xsltproc)));
            if (empty($result) or xslt_error($xsltproc) != null) {
                webServiceError('&error-xslt-processor-error;', 500, array('path' => $xsltPath, 'errorMessage' => xslt_error($xsltproc)));
            }
            xslt_free($xsltproc);
            break;
        default:
            $commandLineMessage = '';
            $phpVersion = getPhpVersion();
            if ($phpVersion >= 5) {
                webServiceError('&error-xslt-not-available;');
            } else {
                webServiceError('&error-php5-required;', 500, array('phpVersion' => $phpVersion));
            }
    }
    return $result;
}
示例#2
0
#!/usr/bin/env php
<?php 
include_once 'common.php';
runCommand('composer self-update');
if (isLatestPhp() && isLatestSymfony()) {
    // Make sure composer.json references all necessary components by having one
    // job run a `composer update`. Since `composer update` will install the
    // latest Symfony, this should be done for the job corresponding to the
    // latest symfony version.
    runCommand('composer update --prefer-dist');
} else {
    if (getPhpVersion() === '5.3' && getSymfonyVersion() === '2.3.*') {
        // Prevent Travis throwing an out of memory error
        runCommand('echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini');
    }
    runCommand('composer require --prefer-dist symfony/symfony:' . getSymfonyVersion());
}
示例#3
0
require LIVEZILLA_PATH . "_definitions/definitions.inc.php";
require LIVEZILLA_PATH . "_definitions/definitions.protocol.inc.php";
require LIVEZILLA_PATH . "_definitions/definitions.dynamic.inc.php";
require LIVEZILLA_PATH . "_lib/functions.index.inc.php";
languageSelect();
@set_error_handler("handleError");
$scheme = getScheme();
if (isset($_GET[GET_INDEX_SERVER_ACTION]) && $_GET[GET_INDEX_SERVER_ACTION] == "addserver") {
    $html = doReplacements(getFile(TEMPLATE_HTML_ADD_SERVER));
    $html = str_replace("<!--lz_add_url-->", getServerAddLink($scheme), $html);
    exit($html);
} else {
    $html = getFile(TEMPLATE_HTML_INDEX);
    $errorbox = null;
    $errors['write'] = getFolderPermissions();
    $errors['php_version'] = getPhpVersion();
    $errors['mysql'] = getMySQL();
    if (!empty($errors['write']) || !empty($errors['php_version']) || !empty($errors['mysql'])) {
        $errorbox = getFile(TEMPLATE_HTML_INDEX_ERRORS);
        $errorbox = str_replace("<!--write_access-->", $errors['write'], $errorbox);
        if (strlen($errors['write']) > 0 && !empty($errors['php_version'])) {
            $errors['php_version'] = "<br><br>" . $errors['php_version'];
        }
        if ((strlen($errors['write']) > 0 || !empty($errors['php_version'])) && !empty($errors['mysql'])) {
            $errors['mysql'] = "<br><br>" . $errors['mysql'];
        }
        $errorbox = str_replace("<!--mysql-->", $errors['mysql'], $errorbox);
        $errorbox = str_replace("<!--php_version-->", $errors['php_version'], $errorbox);
    }
    $html = str_replace("<!--index_errors-->", $errorbox, $html);
    $html = str_replace("<!--height-->", $CONFIG["wcl_window_height"], $html);
示例#4
0
function isLatestPhp()
{
    return getPhpVersion() === '7.0';
}