Exemple #1
0
 function send($response)
 {
     $content = $response->content;
     $mime = $content->mime;
     $cache = $response->cache;
     $private = $response->private;
     if ($mime === 'application/xml') {
         $accept = preg_split('~[,;] ?~', strtolower(so_value::make($_SERVER['HTTP_ACCEPT']) ?: ''));
         if (!in_array('application/xhtml+xml', $accept)) {
             $xs = new so_xstyle();
             $xs->pathXSL = (string) so_package::make()['-mix']['release.xsl']->file;
             $xsl = $xs->docXSL;
             foreach ($xsl->childs['xsl:include'] as $dom) {
                 $dom['@href'] = preg_replace('!\\?[^?]*$!', '', $dom['@href']);
             }
             $content = (string) $xs->process((string) $content);
             $content = preg_replace('~^<\\?xml .+?\\?>\\n?~', '', $content);
             $mime = 'text/html';
         }
     }
     $encoding = $response->encoding;
     $code = static::$codeMap[$response->status];
     header("Content-Type: {$mime}", true, $code);
     if (!$private) {
         header("Access-Control-Allow-Origin: *", true);
     }
     if ($cache) {
         header("Cache-Control: " . ($private ? 'private' : 'public'), true);
     } else {
         header("Cache-Control: no-cache", true);
     }
     if ($location = $response->location) {
         header("Location: {$location}", true);
     }
     echo str_pad($content, 512, ' ', STR_PAD_RIGHT);
     return $this;
 }
Exemple #2
0
<?php

header('content-type:application/xml');
require_once '../../../so/autoload/so_autoload.php';
$xstyle = new so_xstyle();
$xstyle->pathXS = __DIR__ . '/test.xs';
$xsl = $xstyle->sync()->docXSL;
echo $xsl;
 function makeInstance()
 {
     return so_xstyle::make()->pathXSL(__DIR__ . '/so_xstyle_compiler/so_xstyle_xs2xsl.xsl');
 }