Ejemplo n.º 1
0
<?php

header('content-type:text/xml');
require_once '../../../so/autoload/so_autoload.php';
$xstyle = new so_XStyle();
$xstyle->pathXS = __DIR__ . '/test.xs';
$xsl = $xstyle->sync()->docXSL;
echo $xsl;
Ejemplo n.º 2
0
 function send($response)
 {
     $type = $response->type;
     $content = $response->content;
     if ($type === 'application/xml') {
         if (!preg_match('!\\b(Presto|Gecko|AppleWebKit|Trident)\\b!', $_SERVER['HTTP_USER_AGENT'])) {
             $type = 'text/html';
             $xs = new so_XStyle();
             $xs->pathXSL = 'so/-mix/index.xsl';
             foreach ($xs->docXSL as $key => $dom) {
                 if ($key != 'xsl:include') {
                     continue;
                 }
                 $dom['@href'] = preg_replace('!\\?[^?]*$!', '', $dom['@href']->value);
             }
             $content = $xs->process((string) $content);
             $type = 'text/html';
         }
     }
     $encoding = $response->encoding;
     $httpCode = static::$httpCodes[$response->status];
     header("Content-Type: {$type}", true, $httpCode);
     if ($location = $response->location) {
         header("Location: {$location}", true);
     }
     echo $content;
     return $this;
 }
Ejemplo n.º 3
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_front::make()->package['-mix']['index.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;
 }