Ejemplo n.º 1
0
 static function makeInstance()
 {
     if (so_value::make($_SERVER['SESSIONNAME']) == 'Console') {
         return so_front_console::makeAdapter();
     }
     return so_front_http::makeAdapter();
 }
Ejemplo n.º 2
0
 function string_store($val)
 {
     $chunkList = explode(static::$separatorOfChunks, $val);
     $struct = array();
     $lastKeyList = array();
     foreach ($chunkList as $chunk) {
         $pair = explode(static::$separatorOfPair, $chunk, 2);
         $keyList = explode(static::$indentationToken, $pair[0]);
         $keyListTail = array_pop($keyList);
         if ($keyListTail) {
             $keyListTail = explode(static::$separatorOfKeys, $keyListTail);
             $keyList = array_merge($keyList, $keyListTail);
         }
         foreach ($keyList as $index => &$key) {
             if (!$key) {
                 $key = $lastKeyList[$index];
             }
         }
         $lastKeyList = $keyList;
         $keyList[] = so_value::make($pair[1]);
         $struct[] = $keyList;
     }
     $this->struct = $struct;
     return null;
 }
Ejemplo n.º 3
0
 function uses_make()
 {
     $root = $this->root;
     $package = $this->package;
     preg_match_all('/\\$([a-zA-Z][a-zA-Z0-9]+)(?:[._]([a-zA-Z0-9]+))?(?![a-zA-Z0-9$])/', $this->file->content, $matches, PREG_SET_ORDER);
     $uses = array();
     $mainModule = $package[$package->name];
     if ($mainModule->exists) {
         $uses += $mainModule->modules->list;
     }
     if ($matches) {
         foreach ($matches as $item) {
             list($str, $packName) = $item;
             $moduleName = so_value::make($item[2]);
             if (!$moduleName) {
                 $moduleName = $packName;
             }
             $module = $root[$packName][$moduleName];
             if ($module === $this->module) {
                 continue;
             }
             if (!$module->exists) {
                 throw new \Exception("Module [{$module->dir}] not found for [{$this->file}]");
             }
             $uses += $module->modules->list;
         }
     }
     $uses += $this->module->modules->list;
     return so_module_collection::make($uses);
 }
Ejemplo n.º 4
0
 function string_store($string)
 {
     preg_match('~^(?:(\\w*):)?(?://(?:([^/:]*)(?:\\:([^/]*))?@)?([^/:]*)(?:\\:(\\d*))?)?([^?#]*)(?:\\?([^#]*))?(?:#(.*)|)?$~', $string, $found);
     $this->scheme = so_value::make($found[1]);
     $this->login = so_value::make($found[2]);
     $this->password = so_value::make($found[3]);
     $this->host = so_value::make($found[4]);
     $this->port = so_value::make($found[5]);
     $this->path = so_value::make($found[6]);
     $this->queryString = so_value::make($found[7]);
     $this->anchor = so_value::make($found[8]);
 }
Ejemplo n.º 5
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;
 }
Ejemplo n.º 6
0
<?php

require_once __DIR__ . '/../so/autoload/so_autoload.php';
if (!so_value::make($_SERVER['HTTP_ORIGIN'])) {
    so_compiler::start();
}
so_application::start('so', 'dev');
Ejemplo n.º 7
0
 function offsetGet($key)
 {
     $struct = $this->struct;
     return so_value::make($struct[$key]);
 }
Ejemplo n.º 8
0
 function value_make()
 {
     return so_value::make($_COOKIE[$this->name]);
 }