function data_make() { switch ($this->method) { case 'get': case 'head': return null; case 'post': $data = $_POST; foreach ($_FILES as $key => $info) { $data[$key] = so_file::make($info['tmp_name']); } return so_query::make($data); default: $raw = ''; $input = fopen('php://input', 'r'); while ($chunk = fread($input, 1024)) { $raw .= $chunk; } fclose($input); $type = preg_replace('~;.*$~', '', so_value::make($_SERVER['CONTENT_TYPE']) ?: ''); switch ($type) { case 'application/x-www-form-urlencoded': return so_query::make($raw); break; case 'text/xml': case 'application/xml': return so_dom::make($raw); case 'text/json': case 'application/json': return json_decode($raw); default: return $raw; } } }
static function make($data) { $page = array(); $moduleMix = so_package::make()['-mix']->dir; $page[] = array('?xml-stylesheet' => array('href' => (string) $moduleMix[static::$mode . '.xsl']->uriVersioned, 'type' => 'text/xsl')); $page[] = array('so_page' => array('@so_page_styles' => (string) $moduleMix[static::$mode . '.css']->uriVersioned, '@so_page_script' => (string) $moduleMix[static::$mode . '.js']->uriVersioned, '@so_page_icon' => (string) so_file::make('icon.png')->uriVersioned, $data)); return so_dom::make($page)->doc; }
function dir_make() { $pair = explode('=', $this->id, 2); $key = strtr($pair[0], array('?' => '=')); $val =& $pair[1]; $val = md5($val); $val = substr($val, 0, 3) . '/' . substr($val, 4, 7); $path = $key . '/' . $val; return so_file::make('-so_storage')->go($path); }
function offsetGet($key) { if (is_int($key)) { return $this->list_value[$key] = so_file::make($this->list[$key]); } $list = array(); foreach ($this as $item) { if ($item->name != $key) { continue; } $list[] = $item; } return so_dom_collection::make($list); }
static function start($package, $mode = 'dev') { register_shutdown_function(array(get_class(), 'finalize')); ob_start(); so_error::monitor(); foreach (parse_ini_file(so_file::make('php.ini')) as $key => $value) { ini_set($key, $value); } so_page::$mode = $mode; so_package::$defaultName = $package; so_query::$resourcePrefix = $package; $front = so_front::make(); $query = $front->uri->query; $resource = $query->resource; $uriStandard = $resource->uri; if ($query->uri != $uriStandard) { return static::$response = so_output::moved((string) $uriStandard); } static::$response = $resource->execute($front->method, $front->data); }
function dir_store($data) { return so_file::make($data); }
function get_dir($dir) { if (isset($dir)) { return $dir; } $key = md5($this->key); $key = chunk_split(substr($key, 0, 6), 3, '/') . substr($key, 6); #$key= strtr( $this->key, array( '?' => '', '=' => '/=', '+' => '/+' ) ); return so_file::make('so/storage/data/')->go($key . '/'); }
function dir_make() { return so_file::make(getcwd()); }
function go($path) { return so_file::make(rtrim($this->path, '/') . '/' . $path); }
function dir_store($data) { if (isset($data)) { return so_file::make($data); } }
function docXSL_make() { $docXSL = so_dom::make(so_file::make($this->pathXSL)); return $docXSL; }