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


PHP data::read方法代码示例

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


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

示例1: info

 public function info()
 {
     if (!is_null($this->info)) {
         return $this->info;
     }
     return $this->info = new Obj(data::read($this->root . DS . 'package.json'));
 }
开发者ID:irenehilber,项目名称:kirby-base,代码行数:7,代码来源:translation.php

示例2: form

 protected function form($user = null)
 {
     $mode = $user ? 'edit' : 'add';
     $fields = data::read(panel()->roots()->forms() . DS . 'user.' . $mode . '.php', 'yaml');
     $content = $user ? $user->data() : array();
     // add all languages
     $fields['language']['options'] = array();
     $fields['language']['default'] = kirby()->option('panel.language', 'en');
     foreach (panel()->languages() as $code => $lang) {
         $fields['language']['options'][$code] = $lang->title();
     }
     // add all roles
     $fields['role']['options'] = array();
     $fields['role']['default'] = site()->roles()->findDefault()->id();
     foreach (site()->roles() as $role) {
         $fields['role']['options'][$role->id()] = $role->name();
     }
     // make the role selector readonly when the user is not an admin
     if (!site()->user()->isAdmin()) {
         $fields['role']['readonly'] = true;
     }
     // make sure the password is never shown in the form
     unset($content['password']);
     return new Form($fields, $content);
 }
开发者ID:aoimedia,项目名称:kosmonautensofa,代码行数:25,代码来源:users.php

示例3: load

 public function load($name)
 {
     // make sure there's no path included in the name
     $name = basename(strtolower($name));
     if (isset(static::$cache[$name])) {
         $this->file = static::$cache[$name]['file'];
         $this->name = static::$cache[$name]['name'];
         $this->yaml = static::$cache[$name]['yaml'];
         return true;
     }
     // find the matching blueprint file
     $file = kirby()->get('blueprint', $name);
     if ($file) {
         $this->file = $file;
         $this->name = $name;
         $this->yaml = data::read($this->file, 'yaml');
         // remove the broken first line
         unset($this->yaml[0]);
         static::$cache[$name] = array('file' => $this->file, 'name' => $this->name, 'yaml' => $this->yaml);
         return true;
     } else {
         if ($name == 'default') {
             throw new Exception(l('blueprints.error.default.missing'));
         } else {
             return $this->load('default');
         }
     }
 }
开发者ID:nsteiner,项目名称:kdoc,代码行数:28,代码来源:blueprint.php

示例4: _extend

 public function _extend($params)
 {
     $extends = $params['extends'];
     $snippet = f::resolve(kirby()->roots()->blueprints() . DS . 'fields' . DS . $extends, array('yml', 'php', 'yaml'));
     if (empty($snippet)) {
         throw new Exception(l('fields.error.extended'));
     }
     $yaml = data::read($snippet, 'yaml');
     $params = a::merge($yaml, $params);
     return $params;
 }
开发者ID:peterbinks,项目名称:peterbinks.net,代码行数:11,代码来源:field.php

示例5: _extend

 public function _extend($params)
 {
     $extends = $params['extends'];
     $files = glob(kirby()->roots()->blueprints() . DS . 'fields' . DS . $extends . '.{yml,yaml,php}', GLOB_BRACE);
     if (empty($files)) {
         throw new Exception(l('fields.error.extended'));
     }
     $yaml = data::read($files[0], 'yaml');
     $params = a::merge($yaml, $params);
     return $params;
 }
开发者ID:ssigur,项目名称:portfolio-2015,代码行数:11,代码来源:field.php

示例6: _extend

 public function _extend($params)
 {
     $extends = $params['extends'];
     $file = kirby()->get('blueprint', 'fields/' . $extends);
     if (empty($file) || !is_file($file)) {
         throw new Exception(l('fields.error.extended'));
     }
     $yaml = data::read($file, 'yaml');
     $params = a::merge($yaml, $params);
     return $params;
 }
开发者ID:nsteiner,项目名称:kdoc,代码行数:11,代码来源:field.php

示例7: __construct

 public function __construct($name)
 {
     $this->name = $name;
     $this->file = static::$root . DS . $name . '.php';
     $this->yaml = data::read($this->file, 'yaml');
     // remove the broken first line
     unset($this->yaml[0]);
     $this->title = a::get($this->yaml, 'title', 'Page');
     $this->preview = a::get($this->yaml, 'preview', 'page');
     $this->deletable = a::get($this->yaml, 'deletable', true);
     $this->pages = new Blueprint\Pages(a::get($this->yaml, 'pages', true));
     $this->files = new Blueprint\Files(a::get($this->yaml, 'files', true));
 }
开发者ID:madebypost,项目名称:Gulp-Neat-KirbyCMS,代码行数:13,代码来源:blueprint.php

示例8: load

 public function load()
 {
     // get the user role and load the
     // correspondant blueprint if available
     $this->name = basename(strtolower($this->user->role()));
     // try to find a user blueprint
     $file = f::resolve(static::$root . DS . $this->name, array('yml', 'php', 'yaml'));
     if ($file) {
         $this->file = $file;
         $this->yaml = data::read($this->file, 'yaml');
         // remove the broken first line
         unset($this->yaml[0]);
     }
 }
开发者ID:irenehilber,项目名称:kirby-base,代码行数:14,代码来源:blueprint.php

示例9: load

 public function load()
 {
     // get the user role and load the
     // correspondant blueprint if available
     $this->name = basename(strtolower($this->user->role()));
     // try to find a user blueprint
     $files = glob(static::$root . DS . $this->name . '.{php,yaml,yml}', GLOB_BRACE);
     if (!empty($files)) {
         $this->file = $files[0];
         $this->yaml = data::read($this->file, 'yaml');
         // remove the broken first line
         unset($this->yaml[0]);
     }
 }
开发者ID:biggtfish,项目名称:Clean-Blog-Kirby-Theme,代码行数:14,代码来源:blueprint.php

示例10: form

 protected function form($user = null)
 {
     $mode = $user ? 'edit' : 'add';
     $fields = data::read(root('panel.app') . DS . 'forms' . DS . 'user.' . $mode . '.php', 'yaml');
     $content = $user ? $user->data() : array();
     // add all languages
     $fields['language']['options'] = array();
     $fields['language']['default'] = c::get('panel.language', 'en');
     foreach (app::languages() as $code => $lang) {
         $fields['language']['options'][$code] = $lang->title();
     }
     // make sure the password is never shown in the form
     unset($content['password']);
     return new Form($fields, $content);
 }
开发者ID:kompuser,项目名称:panel,代码行数:15,代码来源:users.php

示例11: data

 /**
  * get all data for the user
  */
 public function data()
 {
     if (!is_null($this->data)) {
         return $this->data;
     }
     // get all data from the account file
     $this->data = data::read($this->file(), 'yaml');
     // make sure all keys are lowercase
     $this->data = array_change_key_case($this->data, CASE_LOWER);
     // remove garbage
     unset($this->data[0]);
     // add the username
     $this->data['username'] = $this->username;
     // return the data array
     return $this->data;
 }
开发者ID:robinandersen,项目名称:robin,代码行数:19,代码来源:user.php

示例12: __construct

 public function __construct($page, $file)
 {
     $data = data::read($file);
     if (!is_array($data) or empty($data)) {
         throw new Exception('Invalid web mention');
     }
     if (empty($data['url'])) {
         throw new Exception('No url found');
     }
     $this->data = $data;
     $this->page = $page;
     $this->file = $file;
     $this->author = new Author($this);
     $this->id = sha1($file);
     $this->convertTwitterFavorite();
     $this->convertTwitterRepost();
     $this->field('title', 'name');
     $this->field('text');
     $this->field('url');
     $this->field('type');
     $this->field('rsvp');
     $this->date = new Field($this->page, 'date', strtotime($data['published']));
 }
开发者ID:aizlewood,项目名称:2016,代码行数:23,代码来源:mention.php

示例13: info

 /**
  * Read the plugin package file and 
  * return the info as array
  */
 protected function info()
 {
     $this->info = data::read($this->tmp . '/package.json');
     // get the extension type
     if (!isset($this->info['type'])) {
         throw new RuntimeException('Invalid Kirby Plugin Type');
     }
     // check for a valid type
     if (!in_array($this->type(), ['plugin', 'field', 'tag'])) {
         throw new RuntimeException('Invalid Kirby Plugin Type: "' . $this->type() . '"');
     }
     if (!isset($this->info['name'])) {
         throw new RuntimeException('Invalid Kirby Plugin Name');
     }
     $this->output->writeln('');
     $this->output->writeln('<comment>Discovered a ' . $this->type() . ' with the name "' . $this->name() . '"</comment>');
     $this->output->writeln('');
     $this->output->writeln('<info>Description: ' . "\t" . $this->description() . '</info>');
     $this->output->writeln('<info>Repository: ' . "\t" . $this->repo() . '</info>');
     $this->output->writeln('<info>Version: ' . "\t" . $this->version() . '</info>');
     $this->output->writeln('<info>Author: ' . "\t" . $this->author() . '</info>');
     $this->output->writeln('<info>License: ' . "\t" . $this->license() . '</info>');
     $this->output->writeln('<info></info>');
 }
开发者ID:getkirby,项目名称:cli,代码行数:28,代码来源:Plugin.php

示例14: mergeFile

 private function mergeFile($file)
 {
     $file_merge = static::$root . DS . $file . '.php';
     if (file_exists($file_merge)) {
         // read yaml-data of passed file
         $yaml_merge = data::read($file_merge, 'yaml');
         // remove the broken first line:
         unset($yaml_merge[0]);
         // merge
         $this->mergeData($yaml_merge);
     }
 }
开发者ID:RHansmann,项目名称:Kirby-2.0---inheritance-of-blueprints,代码行数:12,代码来源:blueprint.php

示例15: form

 public static function form($id, $data = array())
 {
     $fields = data::read(root('panel.app') . DS . 'forms' . DS . $id . '.php', 'yaml');
     return new Form($fields, $data);
 }
开发者ID:kompuser,项目名称:panel,代码行数:5,代码来源:app.php


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