예제 #1
0
파일: Blueprint.php 프로젝트: getkirby/cli
 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('');
 }
예제 #2
0
 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;
 }
예제 #3
0
 /**
  * Retreives a registered blueprint file path 
  * 
  * @param string $name
  * @return string 
  */
 public function get($name = null)
 {
     if (is_null($name)) {
         return static::$blueprints;
     }
     $file = f::resolve($this->kirby->roots()->blueprints() . DS . str_replace('/', DS, $name), ['php', 'yml', 'yaml']);
     if (file_exists($file)) {
         return $file;
     } else {
         return a::get(static::$blueprints, $name);
     }
 }
예제 #4
0
 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]);
     }
 }
예제 #5
0
 public function __construct(User $user)
 {
     // store the parent user object
     $this->user = $user;
     // this should rather be coming from the user object
     $this->kirby = kirby::instance();
     // try to find the avatar
     if ($file = f::resolve($this->kirby->roots()->avatars() . DS . $user->username(), ['jpg', 'jpeg', 'gif', 'png'])) {
         $filename = f::filename($file);
     } else {
         $filename = $user->username() . '.jpg';
         $file = $this->kirby->roots()->avatars() . DS . $filename;
     }
     parent::__construct($file, $this->kirby->urls()->avatars() . '/' . $filename);
 }
예제 #6
0
파일: blueprint.php 프로젝트: dmak78/panel
 public static function exists($name)
 {
     return f::resolve(static::$root . DS . $name, array('yml', 'php', 'yaml')) ? true : false;
 }
예제 #7
0
파일: Blueprint.php 프로젝트: getkirby/cli
 protected function exists()
 {
     return f::resolve(dirname($this->file()) . '/' . f::name($this->file()), ['php', 'yml', 'yaml']);
 }