当前位置: 首页>>代码示例>>PHP>>正文


PHP Thin\File类代码示例

本文整理汇总了PHP中Thin\File的典型用法代码示例。如果您正苦于以下问题:PHP File类的具体用法?PHP File怎么用?PHP File使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了File类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __destruct

 public function __destruct()
 {
     /* On efface le model de la base tampon et on vide la base */
     $modelFile = APPLICATION_PATH . DS . 'models' . DS . 'Bigdata' . DS . 'models' . DS . Inflector::lower($this->to->db) . DS . ucfirst(Inflector::lower($this->to->table)) . '.php';
     File::delete($modelFile);
     $this->to->drop();
 }
开发者ID:schpill,项目名称:standalone,代码行数:7,代码来源:Transaction.php

示例2: __construct

 public function __construct($db)
 {
     $this->orm = $db;
     $this->db = $db->db();
     $this->table = $db->table();
     $dir = Config::get('dir.blizz.store', session_save_path());
     if (!is_dir($dir)) {
         File::mkdir($dir);
     }
     $dir .= DS . Inflector::urlize(Inflector::uncamelize($this->db));
     if (!is_dir($dir)) {
         File::mkdir($dir);
     }
     $this->dir = $dir . DS . Inflector::urlize(Inflector::uncamelize($this->table));
     if (!is_dir($this->dir)) {
         File::mkdir($this->dir);
     }
     $file = $this->dir . DS . 'data.db';
     $new = false;
     if (!is_file($file)) {
         File::create($file);
         $new = true;
         File::put($this->dir . DS . 'age.blizz', '');
     }
     $link = new SQLite3($file);
     Now::set("blizz.link.{$this->db}.{$this->table}", $link);
     if ($new) {
         $this->init();
     }
 }
开发者ID:schpill,项目名称:standalone,代码行数:30,代码来源:blizzstore.php

示例3: model

 public function model($data = [])
 {
     $view = false;
     $db = $this->db;
     $table = $this->table;
     $modelFile = APPLICATION_PATH . DS . 'models' . DS . 'Mysql' . DS . 'models' . DS . Inflector::lower($db) . DS . ucfirst(Inflector::lower($table)) . '.php';
     if (!is_dir(APPLICATION_PATH . DS . 'models' . DS . 'Mysql')) {
         File::mkdir(APPLICATION_PATH . DS . 'models' . DS . 'Mysql');
     }
     if (!is_dir(APPLICATION_PATH . DS . 'models' . DS . 'Mysql' . DS . 'models')) {
         File::mkdir(APPLICATION_PATH . DS . 'models' . DS . 'Mysql' . DS . 'models');
     }
     if (!is_dir(APPLICATION_PATH . DS . 'models' . DS . 'Mysql' . DS . 'models' . DS . Inflector::lower($db))) {
         File::mkdir(APPLICATION_PATH . DS . 'models' . DS . 'Mysql' . DS . 'models' . DS . Inflector::lower($db));
     }
     if (!File::exists($modelFile)) {
         File::put($modelFile, str_replace('##class##', ucfirst(Inflector::lower($db)) . ucfirst(Inflector::lower($table)) . 'SQLModel', File::read(__DIR__ . DS . 'dbModel.tpl')));
     }
     $class = '\\Thin\\' . ucfirst(Inflector::lower($db)) . ucfirst(Inflector::lower($table)) . 'SQLModel';
     if (!class_exists($class)) {
         require_once $modelFile;
     }
     $model = $this;
     if (true === $view) {
         $model = self::instance($db, $table);
     }
     return new $class($model, $data);
 }
开发者ID:schpill,项目名称:standalone,代码行数:28,代码来源:Db.php

示例4: background

 public function background()
 {
     $file = realpath(APPLICATION_PATH . DS . '..' . DS . 'public' . DS . 'scripts' . DS . 'schedule.php');
     if (File::exists($file)) {
         $cmd = 'php ' . $file;
         lib('utils')->backgroundTask($cmd);
     }
 }
开发者ID:schpill,项目名称:standalone,代码行数:8,代码来源:schedule.php

示例5: __construct

 public function __construct($ns = 'core.cache')
 {
     if (!is_dir(STORAGE_PATH . DS . 'kit')) {
         File::mkdir(STORAGE_PATH . DS . 'kit');
     }
     $file = STORAGE_PATH . DS . 'kit' . DS . $ns . '.db';
     $this->lite = new SQLite3($file);
     $q = "CREATE TABLE IF NOT EXISTS content (k VARCHAR PRIMARY KEY, v, ts);";
     $this->raw($q);
 }
开发者ID:schpill,项目名称:standalone,代码行数:10,代码来源:Store.php

示例6: getOptionsFromMarket

 public function getOptionsFromMarket($market_id)
 {
     if (!is_integer($market_id)) {
         throw new Exception("market_id must be an integer id.");
     }
     $file = APPLICATION_PATH . DS . 'models' . DS . 'options' . DS . $market_id . '.php';
     if (File::exists($file)) {
         $options = (include $file);
         return $options;
     }
     return [];
 }
开发者ID:schpill,项目名称:standalone,代码行数:12,代码来源:forms.php

示例7: __construct

 public function __construct($db, $table)
 {
     $file = Config::get('mlite.dir.' . $db, STORAGE_PATH . DS . $db . '.db');
     $new = !is_file($file);
     if (!is_file($file)) {
         File::create($file);
     }
     $link = new SQLite3($file);
     Now::set("lite.link.{$db}.{$table}", $link);
     if ($new) {
         $q = "CREATE TABLE IF NOT EXISTS infosdb (data_key VARCHAR PRIMARY KEY, data_value);";
         $res = $link->exec($q);
     }
     $this->table = $table;
     $this->database = $db;
 }
开发者ID:schpill,项目名称:standalone,代码行数:16,代码来源:Motor.php

示例8: __construct

 /**
  *
  * @method __construct
  *
  * @param  string
  * @param  array
  */
 public function __construct(array $data = [])
 {
     $ns = $this->ns = $this->forever();
     $file = Config::get('cachemelite.dir.' . $ns, STORAGE_PATH . DS . $ns . '_cache.db');
     $new = !is_file($file);
     if (!is_file($file)) {
         File::create($file);
     }
     $db = new SQLite3($file);
     Now::set("cachemelite.link.{$ns}", $db);
     $q = "CREATE TABLE IF NOT EXISTS cachedb (data_key VARCHAR PRIMARY KEY, data_value);";
     $res = $this->db->exec($q);
     if (!empty($data)) {
         foreach ($data as $k => $v) {
             $this->set($k, $v);
         }
     }
 }
开发者ID:schpill,项目名称:standalone,代码行数:25,代码来源:melite.php

示例9: read

 public function read($id, $default = null)
 {
     $key = $this->key . '::' . $id;
     try {
         $result = $this->client->getObject(array('Bucket' => $this->bucket, 'Key' => $key));
     } catch (NoSuchKeyException $e) {
         if (!strstr($id, 'file::')) {
             $data = File::read($this->findFile($id));
         } else {
             $data = File::read(str_replace('thinseparator', '', str_replace('file::', '', $id)));
         }
         if (strlen($data)) {
             $this->write($id, $data);
             return $data;
         } else {
             return $default;
         }
     }
     return $result['Body'];
 }
开发者ID:schpill,项目名称:standalone,代码行数:20,代码来源:S3.php

示例10: dispatch

 public static function dispatch()
 {
     static::$method = Request::method();
     $uri = substr(str_replace('/ws/', '/', $_SERVER['REQUEST_URI']), 1);
     $tab = explode('/', $uri);
     if (count($tab) < 3) {
         Api::forbidden();
     }
     $namespace = current($tab);
     $controller = $tab[1];
     $action = $tab[2];
     $tab = array_slice($tab, 3);
     $count = count($tab);
     if (0 < $count && $count % 2 == 0) {
         for ($i = 0; $i < $count; $i += 2) {
             $_REQUEST[$tab[$i]] = $tab[$i + 1];
         }
     }
     $file = APPLICATION_PATH . DS . 'webservices' . DS . $namespace . DS . $controller . '.php';
     if (!File::exists($file)) {
         Api::NotFound();
     }
     require_once $file;
     $class = 'Thin\\' . ucfirst($controller) . 'Ws';
     $i = new $class();
     $methods = get_class_methods($i);
     $call = strtolower(static::$method) . ucfirst($action);
     if (!Arrays::in($call, $methods)) {
         Api::NotFound();
     }
     if (Arrays::in('init', $methods)) {
         $i->init($call);
     }
     $i->{$call}();
     if (Arrays::in('after', $methods)) {
         $i->after();
     }
 }
开发者ID:schpill,项目名称:standalone,代码行数:38,代码来源:Rest.php

示例11: read

 public function read($id, $default = null)
 {
     $key = $this->key . '::' . $id;
     $row = $this->collection->findOne(function ($query) use($key) {
         $query->where('key', $key);
     });
     if ($row) {
         return isAke($row, 'value', $default);
     } else {
         if (!strstr($id, 'file::')) {
             $data = File::read($this->findFile($id));
         } else {
             $data = File::read(str_replace('thinseparator', '', str_replace('file::', '', $id)));
         }
         if (strlen($data)) {
             $this->write($id, $data);
             return $data;
         } else {
             return $default;
         }
     }
     return $default;
 }
开发者ID:schpill,项目名称:standalone,代码行数:23,代码来源:Mongo.php

示例12: csvByZone

 public function csvByZone($address)
 {
     ini_set('memory_limit', '1024M');
     set_time_limit(0);
     $file = '/home/gerald/Bureau/' . Inflector::urlize($address) . '_' . date('dmYHis') . '.csv';
     touch($file);
     $zone = rdb('geo', 'zone')->where(['address', '=i', $address])->first(true);
     if ($zone) {
         File::append($file, implode(';', ['category', 'name', 'address', 'lat', 'lng', 'altitude', 'zip', 'city', 'phone', 'mail', 'url']) . "\n");
         $pivots = $zone->pivots(rdb('geo', 'etablissement')->model())->exec(true);
         foreach ($pivots as $pivot) {
             $etab = $pivot->etablissement(true);
             if ($zone) {
                 $relations = $etab->pivots(rdb('geo', 'service'))->exec(true);
                 foreach ($relations as $relation) {
                     $sp = $relation->service(true);
                     if ($sp) {
                         $item = [];
                         $item['category'] = str_replace([', ', ','], '-', $sp->label);
                         $item['name'] = str_replace([', ', ','], '-', $etab->name);
                         $item['address'] = str_replace([', ', ','], '-', $etab->address);
                         $item['lat'] = str_replace([', ', ','], '.', $etab->lat);
                         $item['lng'] = str_replace([', ', ','], '.', $etab->lng);
                         $item['altitude'] = str_replace([', ', ','], '.', $etab->altitude);
                         $item['zip'] = str_replace([', ', ','], '-', $etab->zip);
                         $item['city'] = str_replace([', ', ','], '-', $etab->city);
                         $item['phone'] = str_replace([', ', ','], '-', $etab->phone);
                         $item['mail'] = str_replace([', ', ','], '-', $etab->mail);
                         $item['url'] = str_replace([', ', ','], '-', $etab->url);
                         File::append($file, implode(';', $item) . "\n");
                     }
                 }
             }
         }
     }
 }
开发者ID:schpill,项目名称:standalone,代码行数:36,代码来源:crawl.php

示例13: parse

 private function parse($pageConfig, $htmlTemplate, $htmlPage)
 {
     eval($pageConfig);
     $code = str_replace('@@content', $htmlPage, $htmlTemplate);
     $code = str_replace(array('{{', '}}'), array('<?php', '?>'), $code);
     if (strstr($code, '@@partial')) {
         $partials = $this->getPartials($code);
         if (count($partials)) {
             foreach ($partials as $partial) {
                 $partialFile = $this->dir . DS . 'partials' . DS . $partial . '.html';
                 if (File::exists($partialFile)) {
                     $code = str_replace("@@partial({$partial})", fgc($partialFile), $code);
                 }
             }
         }
     }
     $vars = $this->getVars($code);
     $url = container()->getUrlsite();
     $assets = '/content/' . SITE_NAME . '/themes/' . $this->theme . '/assets';
     if (count($vars)) {
         foreach ($vars as $var) {
             if (!isset(${$var})) {
                 $value = CmsConfig::get($var, false);
                 if (false === $value) {
                     $value = isAke($_REQUEST, $var, false);
                     if (false === $value) {
                         $value = '';
                     }
                 }
             } else {
                 $value = ${$var};
             }
             $code = str_replace("%({$var})%", $value, $code);
         }
     }
     return $code;
 }
开发者ID:noikiy,项目名称:inovi,代码行数:37,代码来源:Controller.php

示例14: export


//.........这里部分代码省略.........
                    $headers[] = \Thin\Html\Helper::display($label);
                }
            }
            $xlsHeader = '';
            foreach ($headers as $header) {
                $xlsHeader .= str_replace('##value##', $header, $tplHeader);
            }
            $excel = str_replace('##headers##', $xlsHeader, $excel);
            $xlsContent = '';
            foreach ($rows as $item) {
                $xlsContent .= '<tr>';
                foreach ($fields as $field) {
                    $fieldSettings = isAke($fieldInfos, $field);
                    $exportable = isAke($fieldSettings, 'is_exportable', true);
                    if (true === $exportable) {
                        $value = isAke($item, $field, '&nbsp;');
                        if (Arrays::exists('content_list', $fieldSettings)) {
                            $closure = $fieldSettings['content_list'];
                            if (is_callable($closure)) {
                                $value = call_user_func_array($closure, array($item));
                            }
                        }
                        if (empty($value)) {
                            $value = '&nbsp;';
                        }
                        $xlsContent .= str_replace('##value##', \Thin\Html\Helper::display($value), $tplData);
                    }
                }
                $xlsContent .= '</tr>';
            }
            $excel = str_replace('##content##', $xlsContent, $excel);
            $name = 'extraction_' . $this->model->db . '_' . $this->model->table . '_' . date('d_m_Y_H_i_s') . '.xlsx';
            $file = TMP_PUBLIC_PATH . DS . $name;
            File::delete($file);
            File::put($file, $excel);
            Utils::go(URLSITE . '/tmp/' . $name);
        } elseif ('pdf' == $type) {
            $pdf = '<html>
            <head>
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                <link href="//fonts.googleapis.com/css?family=Abel" rel="stylesheet" type="text/css" />
                <title>Extraction ' . $this->model->db . ' - ' . $this->model->table . '</title>
                <style>
                    *
                    {
                        font-family: Abel, ubuntu, verdana, tahoma, arial, sans serif;
                        font-size: 11px;
                    }
                    h1
                    {
                        text-transform: uppercase;
                        font-size: 135%;
                    }
                    th
                    {
                        font-size: 120%;
                        color: #fff;
                        background-color: #394755;
                        text-transform: uppercase;
                    }
                    td
                    {
                        border: solid 1px #394755;
                    }

                    a, a:visited, a:hover
开发者ID:schpill,项目名称:standalone,代码行数:67,代码来源:Crud.php

示例15: run

 public static function run()
 {
     Request::$route = $route = Utils::get('appDispatch');
     container()->setRoute($route);
     $render = $route->getRender();
     $tplDir = $route->getTemplateDir();
     $module = $route->getModule();
     $controller = $route->getController();
     $action = $route->getAction();
     $alert = $route->getAlert();
     $page = container()->getPage();
     $isCms = !empty($page);
     if (!empty($render)) {
         $tplMotor = $route->getTemplateMotor();
         $tplDir = empty($tplDir) ? APPLICATION_PATH . DS . SITE_NAME . DS . 'app' . DS . 'views' : $tplDir;
         $tpl = $tplDir . DS . $render . '.phtml';
         if (File::exists($tpl)) {
             if ('Twig' == $tplMotor) {
                 if (!class_exists('Twig_Autoloader')) {
                     require_once 'Twig/Autoloader.php';
                 }
                 $tab = explode(DS, $tpl);
                 $file = Arrays::last($tab);
                 $path = repl(DS . $file, '', $tpl);
                 $loader = new \Twig_Loader_Filesystem($path);
                 $view = new \Twig_Environment($loader, array('cache' => CACHE_PATH, 'debug' => false, 'charset' => 'utf-8', 'strict_variables' => false));
                 container()->setView($view);
                 if ($action instanceof Closure) {
                     $action($view);
                 }
                 $params = null === container()->getViewParams() ? array() : container()->getViewParams();
                 echo $view->render($file, $params);
                 /* stats */
                 if (null === container()->getNoShowStats() && null === $route->getNoShowStats()) {
                     echo View::showStats();
                 }
             } else {
                 $view = new View($tpl);
                 container()->setView($view);
                 if ($action instanceof Closure) {
                     $action($view);
                 }
                 $view->render();
                 /* stats */
                 if (null === container()->getNoShowStats() && null === $route->getNoShowStats()) {
                     echo View::showStats();
                 }
             }
             return;
         }
     }
     $module = Inflector::lower($module);
     $controller = Inflector::lower($controller);
     $action = Inflector::lower($action);
     if (true === container()->getMultiSite()) {
         $moduleDir = APPLICATION_PATH . DS . SITE_NAME . DS . 'modules' . DS . $module;
     } else {
         $moduleDir = APPLICATION_PATH . DS . 'modules' . DS . $module;
     }
     if (!is_dir($moduleDir)) {
         throw new Exception("The module '{$module}' does not exist.");
     }
     $controllerDir = $moduleDir . DS . 'controllers';
     if (!is_dir($controllerDir)) {
         throw new Exception("The controller '{$controller}' does not exist.");
     }
     $controllerFile = $controllerDir . DS . $controller . 'Controller.php';
     if (!File::exists($controllerFile)) {
         throw new Exception("The controller '{$controllerFile}' does not exist.");
     }
     require_once $controllerFile;
     $controllerClass = 'Thin\\' . $controller . 'Controller';
     $controller = new $controllerClass();
     $controller->view = new View($route->getView());
     if (null !== $alert) {
         $controller->view->alert($alert);
     }
     container()->setController($controller);
     $actions = get_class_methods($controllerClass);
     if (true === $isCms) {
         if (!Arrays::inArray($action, $actions)) {
             $action = 'page';
         }
     }
     container()->setAction($action);
     if (strstr($action, '-')) {
         $words = explode('-', $action);
         $newAction = '';
         for ($i = 0; $i < count($words); $i++) {
             $word = trim($words[$i]);
             if ($i > 0) {
                 $word = ucfirst($word);
             }
             $newAction .= $word;
         }
         $action = $newAction;
     }
     $actionName = $action . 'Action';
     if (Arrays::in('init', $actions)) {
         $controller->init();
//.........这里部分代码省略.........
开发者ID:schpill,项目名称:thin,代码行数:101,代码来源:Router.php


注:本文中的Thin\File类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。