• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP f类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: set_cache

 public function set_cache($type, $result)
 {
     $cache_path = __DIR__ . '/../cache/' . $type . '.json';
     $period = c::get('kg.cache_period') ? c::get('kg.cache_period') : '30 Minutes';
     $cache = array('to' => strtotime($period), 'payload' => $result);
     \f::write($cache_path, json_encode($cache));
 }
开发者ID:sethmcleod,项目名称:patsymcenroe.com,代码行数:7,代码来源:Instagram.php


示例2: view

 function view()
 {
     events::observe('save', 'feedback');
     events::observer();
     $settings = settings::get('feedback');
     f::set($settings);
 }
开发者ID:rigidus,项目名称:ea,代码行数:7,代码来源:main.module.php


示例3: save

 public static function save()
 {
     if (!security::isLogged() || !USER_IS_ADMIN) {
         return;
     }
     $status = f::getParam("status");
     $clientId = f::getParam("client_id");
     $name = f::getParam("name");
     if ($status != 1 && $status != 0) {
         f::setError(400, "Invalid Client Status");
     }
     if (!$clientId && !$name) {
         f::setError(400, "Invalid Client Name");
     }
     $clientExists = f::dbRes("select 1 from fm_clients where id = {p:client_id}") == 1;
     if ($clientId && !$clientExists) {
         f::setError(400, "Invalid Client Id");
     }
     if (!f::hasErrors()) {
         if ($clientId) {
             f::dbQuery("update fm_clients set status = {p:status} where id = {p:client_id}");
         } else {
             f::dbQuery("insert into fm_clients set name = {p:name}, status = {p:status}");
         }
         f::setResponseJson(array("ok" => 1));
     }
 }
开发者ID:jumper9,项目名称:test,代码行数:27,代码来源:clients.php


示例4: validateFields

 private static function validateFields($fields)
 {
     // validate fields
     $dataFields = array();
     foreach ($fields as $field) {
         if ($field["name"]) {
             if (!isset($field["type"])) {
                 $field["type"] = "string";
             }
             $validations = array();
             $validations[0] = $field["type"];
             if (isset($field["minlength"]) && $field["minlength"]) {
                 $validations[] = "minlength:{$field["minlength"]}";
             }
             if (isset($field["maxlength"]) && $field["maxlength"]) {
                 $validations[] = "maxlength:{$field["maxlength"]}";
             }
             if (isset($field["minvalue"]) && $field["minvalue"]) {
                 $validations[] = "minvalue:{$field["minvalue"]}";
             }
             if (isset($field["maxvalue"]) && $field["maxvalue"]) {
                 $validations[] = "maxvalue:{$field["maxvalue"]}";
             }
             if (!isset($field["errorMessage"])) {
                 $field["errorMessage"] = "Invalid {$field["name"]}";
             }
             f::validateParam($field["name"], $validations, $field["errorMessage"]);
             $dataFields[$field["name"]] = f::getParam($field["name"]);
         }
     }
     return $dataFields;
 }
开发者ID:jumper9,项目名称:test,代码行数:32,代码来源:post.php


示例5: combine

 public static function combine($type, $files, $compress = false)
 {
     $root = panel::instance()->roots()->assets() . DS . $type;
     $cache = new Media($root . DS . 'panel.' . $type);
     $media = new Collection(array_map(function ($file) use($root) {
         return new Media($root . DS . str_replace('/', DS, $file));
     }, $files));
     // get the max modification date
     $modified = max($media->pluck('modified'));
     if (is_writable($root) and (!$cache->exists() or $cache->modified() < $modified)) {
         $cache->remove();
         $content = '';
         foreach ($media as $asset) {
             $content .= $asset->read() . PHP_EOL;
         }
         if ($compress) {
             $content = static::compress($content);
         }
         f::write($root . DS . 'panel.' . $type, $content);
     }
     if ($cache->exists()) {
         return $type(panel()->urls()->{$type}() . '/panel.' . $type . '?v=' . panel()->version());
     }
     return $type(array_map(function ($item) use($type) {
         return 'panel/assets/' . $type . '/' . $item;
     }, $files));
 }
开发者ID:LucasFyl,项目名称:korakia,代码行数:27,代码来源:assets.php


示例6: routes

 private static function routes()
 {
     kirby()->routes(array(array('pattern' => self::$route, 'action' => function () {
         echo SplitviewTool::html();
     }), array('pattern' => self::$route . '/assets/css/tool.css', 'action' => function () {
         $path = self::$assets . 'css' . DS . 'tool.css';
         return new Response(f::read($path), 'css');
     }), array('pattern' => self::$route . '/assets/css/tool.min.css', 'action' => function () {
         $path = self::$assets . 'css' . DS . 'tool.min.css';
         return new Response(f::read($path), 'css');
     }), array('pattern' => self::$route . '/assets/js/dist/tool.js', 'action' => function () {
         $path = self::$assets . 'js' . DS . 'dist/tool.js';
         return new Response(f::read($path), 'js');
     }), array('pattern' => self::$route . '/assets/js/dist/tool.min.js', 'action' => function () {
         $path = self::$assets . 'js' . DS . 'dist/tool.min.js';
         return new Response(f::read($path), 'js');
     }), array('pattern' => self::$route . '/assets/js/src/site.js', 'action' => function () {
         $path = self::$assets . 'js' . DS . 'src/site/site.js';
         return new Response(f::read($path), 'js');
     }), array('pattern' => self::$route . '/assets/js/dist/site.min.js', 'action' => function () {
         $path = self::$assets . 'js' . DS . 'dist/site.min.js';
         return new Response(f::read($path), 'js');
     }), array('pattern' => self::$route . '/assets/fonts/font-awesome.woff', 'action' => function () {
         $path = self::$assets . 'fonts' . DS . 'font-awesome-4.5.0' . DS . 'fontawesome-webfont.woff';
         return new Response(f::read($path), 'woff');
     }), array('pattern' => self::$route . '/assets/fonts/source-sans-pro.woff', 'action' => function () {
         $path = self::$assets . 'fonts' . DS . 'source-sans-pro' . DS . 'SourceSansPro-Regular.otf.woff';
         return new Response(f::read($path), 'woff');
     })));
 }
开发者ID:creichel,项目名称:splitview,代码行数:30,代码来源:routes.php


示例7: crawl

 function crawl()
 {
     $path = url::strip_query($this->raw);
     $path = (array) str::split($path, '/');
     if (a::first($path) == 'index.php') {
         array_shift($path);
     }
     // parse params
     foreach ($path as $p) {
         if (str::contains($p, ':')) {
             $parts = explode(':', $p);
             if (count($parts) < 2) {
                 continue;
             }
             $this->params->{$parts}[0] = $parts[1];
         } else {
             $this->path->_[] = $p;
         }
     }
     // get the extension from the last part of the path
     $this->extension = f::extension($this->path->last());
     if ($this->extension != false) {
         // remove the last part of the path
         $last = array_pop($this->path->_);
         $this->path->_[] = f::name($last);
     }
     return $this->path;
 }
开发者ID:narrenfrei,项目名称:kirbycms,代码行数:28,代码来源:uri.php


示例8: edit

 function edit()
 {
     events::observe('save', 'templates', 'apps', '_save');
     events::observer();
     $tmpl_file = events::get('tmpl_file');
     $app = events::get('app');
     if (events::detect('restore')) {
         self::restoreVersion($app, $tmpl_file, events::get('restore'));
     }
     admin::components('tabs', 'validator');
     f::set('app', $app);
     f::set('tmpl_file', $tmpl_file);
     s::set('app', $app);
     s::set('tmpl_file', $tmpl_file);
     $file = SYS_ROOT . 'tmpls/' . ADMIN_SITE . '/' . $app . '/' . $tmpl_file;
     $code = files::get($file);
     f::set('tmpl_code', $code);
     self::getApps();
     /*
     	Load versions
     */
     db::table('templates_versions');
     db::where('app', $app);
     db::where('tmpl_file', $tmpl_file);
     db::order('version_date', 'DESC');
     $res = db::select();
     while ($row = mysql_fetch_assoc($res)) {
         $row['version_date'] = dt::date2print('%H:%i %d.%m.%Y', $row['version_date']);
         $row['version_code'] = '{non}' . htmlspecialchars($row['version_code']) . '{/non}';
         s::roll('versions', $row);
     }
 }
开发者ID:rigidus,项目名称:ea,代码行数:32,代码来源:apps.module.php


示例9: extract

 public static function extract($file, $line)
 {
     $content = f::read($file);
     $lines = preg_split('/\\r\\n|\\n|\\r/', $content);
     $begin = $line - 5;
     if ($begin < 0) {
         $begin = 0;
     }
     $end = 10;
     $lines = array_slice($lines, $begin, $end);
     $html = '';
     $n = $begin + 1;
     foreach ($lines as $l) {
         if (empty($l)) {
             $l = ' ';
         }
         $num = '<span class="code-line-number">' . $n . '</span>';
         if ($n == $line) {
             $html .= '<span class="code-line code-line-highlighted">' . $num . htmlspecialchars($l) . '</span>';
         } else {
             $html .= '<span class="code-line">' . $num . htmlspecialchars($l) . '</span>';
         }
         $n++;
     }
     return $html;
 }
开发者ID:chrishiam,项目名称:LVSL,代码行数:26,代码来源:terror.php


示例10: edit

 public static function edit()
 {
     if (!security::isLogged() || !USER_IS_ADMIN) {
         return;
     }
     $name = f::getParam("name");
     $availableFrom = f::date2sql(f::getParam("available_from"));
     $availableTo = f::date2sql(f::getParam("available_to"));
     $status = f::getParam("status");
     if ($status != 1 && $status != 0 && $status != 2) {
         f::setError(400, "Wrong Status");
     }
     if (!$name) {
         f::setError(400, "Invalid form name");
     }
     $clientExists = f::dbRes("select 1 from fm_clients where id = {p:client_id}");
     if (!$clientExists) {
         f::setError(400, "Client does not Exist");
     }
     if (!f::hasErrors()) {
         if (f::getParam("form_id")) {
             f::dbQuery("insert into fm_forms_log (created_date, form_id, client_id, name, enabled_domains, detail, available_from, available_to, status, description)\n\t\t\t\t\tselect now(), id, client_id, name, enabled_domains, detail, available_from, available_to, status, description from fm_forms where id = {p:form_id}");
             f::dbQuery("update fm_forms set name = {p:name}, detail = {p:detail}, available_from = {availableFrom}, available_to = {availableTo}, status = {p:status} where id = {p:form_id}", array("availableFrom" => $availableFrom, "availableTo" => $availableTo));
         } else {
             f::dbQuery("insert into fm_forms set client_id = {p:client_id}, name = {p:name}, detail = {p:detail}, available_from = {availableFrom}, available_to = {availableTo}, status = {p:status} ", array("availableFrom" => $availableFrom, "availableTo" => $availableTo));
         }
         f::setResponseJson(array("ok" => 1));
     }
 }
开发者ID:jumper9,项目名称:test,代码行数:29,代码来源:forms.php


示例11: view

 function view()
 {
     events::observe('save', 'pages', 'settings', 'save');
     events::observer();
     $settings = settings::get('pages');
     f::set($settings);
 }
开发者ID:rigidus,项目名称:ea,代码行数:7,代码来源:settings.module.php


示例12: send

 /**
  * Sets up all curl options and sends the request
  *
  * @return object Response
  */
 protected function send()
 {
     // start a curl request
     $curl = curl_init();
     // curl options
     $params = array(CURLOPT_URL => $this->options['url'], CURLOPT_ENCODING => $this->options['encoding'], CURLOPT_CONNECTTIMEOUT => $this->options['timeout'], CURLOPT_TIMEOUT => $this->options['timeout'], CURLOPT_AUTOREFERER => true, CURLOPT_RETURNTRANSFER => $this->options['body'], CURLOPT_FOLLOWLOCATION => true, CURLOPT_MAXREDIRS => 10, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_HEADER => false, CURLOPT_HEADERFUNCTION => array($this, 'header'));
     // add the progress
     if (is_callable($this->options['progress'])) {
         $params[CURLOPT_NOPROGRESS] = false;
         $params[CURLOPT_PROGRESSFUNCTION] = $this->options['progress'];
     }
     // add all headers
     if (!empty($this->options['headers'])) {
         $params[CURLOPT_HTTPHEADER] = $this->options['headers'];
     }
     // add the user agent
     if (!empty($this->options['agent'])) {
         $params[CURLOPT_USERAGENT] = $this->options['agent'];
     }
     // do some request specific stuff
     switch (strtolower($this->options['method'])) {
         case 'post':
             $params[CURLOPT_POST] = true;
             $params[CURLOPT_POSTFIELDS] = $this->postfields($this->options['data']);
             break;
         case 'put':
             $params[CURLOPT_CUSTOMREQUEST] = 'PUT';
             $params[CURLOPT_POSTFIELDS] = $this->postfields($this->options['data']);
             // put a file
             if ($this->options['file']) {
                 $params[CURLOPT_INFILE] = fopen($this->options['file'], 'r');
                 $params[CURLOPT_INFILESIZE] = f::size($this->options['file']);
             }
             break;
         case 'delete':
             $params[CURLOPT_CUSTOMREQUEST] = 'DELETE';
             $params[CURLOPT_POSTFIELDS] = $this->postfields($this->options['data']);
             break;
         case 'head':
             $params[CURLOPT_CUSTOMREQUEST] = 'HEAD';
             $params[CURLOPT_POSTFIELDS] = $this->postfields($this->options['data']);
             $params[CURLOPT_NOBODY] = true;
             break;
     }
     curl_setopt_array($curl, $params);
     $content = curl_exec($curl);
     $error = curl_errno($curl);
     $message = curl_error($curl);
     $info = curl_getinfo($curl);
     curl_close($curl);
     $this->response = new RemoteResponse();
     $this->response->headers = $this->headers;
     $this->response->error = $error;
     $this->response->message = $message;
     $this->response->content = $content;
     $this->response->code = $info['http_code'];
     $this->response->info = $info;
     return $this->response;
 }
开发者ID:getkirby,项目名称:toolkit,代码行数:64,代码来源:remote.php


示例13: render

 public function render()
 {
     $file = $this->root . DS . str_replace('.', DS, $this->file) . '.php';
     if (!file_exists($file)) {
         throw new Exception('Invalid view: ' . $this->file);
     }
     return f::load($file, $this->data);
 }
开发者ID:LucasFyl,项目名称:korakia,代码行数:8,代码来源:view.php


示例14: delete

 protected function delete($name, $output)
 {
     if ($file = f::resolve($this->root() . DS . $name, ['yaml', 'yml', 'php'])) {
         f::remove($file);
     }
     $output->writeln('<comment>The "' . $name . '" blueprint has been deleted!</comment>');
     $output->writeln('');
 }
开发者ID:getkirby,项目名称:cli,代码行数:8,代码来源:Blueprint.php


示例15: write

 public static function write($file, $data, $type = null)
 {
     // type autodetection
     if (is_null($type)) {
         $type = f::extension($file);
     }
     return f::write($file, data::encode($data, $type));
 }
开发者ID:robinandersen,项目名称:robin,代码行数:8,代码来源:data.php


示例16: view

 function view()
 {
     events::observe('save', 'system', 'users', 'saveProfile');
     events::observer();
     admin::components('validator');
     admin::addHeader(' ' . adminUser::get('user_login'));
     f::set(adminUser::gets());
 }
开发者ID:rigidus,项目名称:ea,代码行数:8,代码来源:profile.module.php


示例17: assets

 public function assets($type, $root, $files)
 {
     $output = array();
     foreach ($files as $filename) {
         $output[] = f::read(dirname($root) . DS . 'assets' . DS . $type . DS . $filename);
     }
     $this->{$type} .= implode(PHP_EOL . PHP_EOL, $output);
 }
开发者ID:irenehilber,项目名称:kirby-base,代码行数:8,代码来源:plugins.php


示例18: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->user = $this->createAdmin();
     $this->user->login('test');
     $this->page = $this->site->children()->create('test', 'test');
     f::copy($this->roots->dummy . DS . 'images' . DS . 'forrest.jpg', $this->page->root() . DS . '1.jpg');
     f::copy($this->roots->dummy . DS . 'images' . DS . 'forrest.jpg', $this->page->root() . DS . '2.jpg');
 }
开发者ID:biggtfish,项目名称:Clean-Blog-Kirby-Theme,代码行数:9,代码来源:FileModelTest.php


示例19: language

 public function language()
 {
     if (!is_null($this->language)) {
         return $this->language;
     }
     $codes = $this->page->site()->languages()->codes();
     $code = f::extension(f::name($this->root));
     return $this->language = in_array($code, $codes) ? $this->page->site()->languages()->find($code) : false;
 }
开发者ID:kristianhalte,项目名称:super_organic,代码行数:9,代码来源:content.php


示例20: to

 public function to()
 {
     $source = $this->source();
     $name = f::name($source['name']);
     $extension = f::extension($source['name']);
     $safeName = f::safeName($name);
     $safeExtension = str_replace('jpeg', 'jpg', str::lower($extension));
     return str::template($this->options['to'], array('name' => $name, 'filename' => $source['name'], 'safeName' => $safeName, 'safeFilename' => $safeName . '.' . $safeExtension, 'extension' => $extension, 'safeExtension' => $safeExtension));
 }
开发者ID:chrishiam,项目名称:LVSL,代码行数:9,代码来源:upload.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP fAuthorization类代码示例发布时间:2022-05-23
下一篇:
PHP ezpTestCase类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap