コード例 #1
0
ファイル: so_front_http.php プロジェクト: nin-jin/hyoo.ru
 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;
             }
     }
 }
コード例 #2
0
ファイル: so_page.php プロジェクト: nin-jin/hyoo.ru
 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;
 }
コード例 #3
0
ファイル: so_storage.php プロジェクト: nin-jin/hyoo.ru
 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);
 }
コード例 #4
0
 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);
 }
コード例 #5
0
ファイル: so_application.php プロジェクト: nin-jin/hyoo.ru
 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);
 }
コード例 #6
0
ファイル: so_root.php プロジェクト: nin-jin/hyoo.ru
 function dir_store($data)
 {
     return so_file::make($data);
 }
コード例 #7
0
ファイル: index.php プロジェクト: nin-jin/nin-jin.github.com
 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 . '/');
 }
コード例 #8
0
ファイル: so_front.php プロジェクト: nin-jin/hyoo.ru
 function dir_make()
 {
     return so_file::make(getcwd());
 }
コード例 #9
0
ファイル: so_file.php プロジェクト: nin-jin/hyoo.ru
 function copy($target)
 {
     if (!$this->exists) {
         return $this;
     }
     so_file::ensure($target);
     switch ($this->type) {
         case 'dir':
             foreach ($this->childs as $child) {
                 $child->copy($target[$child->name]);
             }
             break;
         case 'file':
             $target->parent->exists = true;
             if (false === copy((string) $this, (string) $target)) {
                 throw new \Exception("Can not copy [{$this}] to [{$target}]");
             }
             unset($target->version);
             unset($target->exists);
             unset($target->content);
             break;
     }
     return $target;
 }
コード例 #10
0
ファイル: so_package.php プロジェクト: nin-jin/hyoo.ru
 function dir_store($data)
 {
     if (isset($data)) {
         return so_file::make($data);
     }
 }
コード例 #11
0
ファイル: so_xstyle.php プロジェクト: nin-jin/hyoo.ru
 function docXSL_make()
 {
     $docXSL = so_dom::make(so_file::make($this->pathXSL));
     return $docXSL;
 }