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


PHP kirby函数代码示例

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


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

示例1: num

 public function num()
 {
     $obj = new Obj();
     $obj->mode = 'default';
     $obj->field = null;
     $obj->format = null;
     if (is_array($this->num)) {
         foreach ($this->num as $k => $v) {
             $obj->{$k} = $v;
         }
     } else {
         if (!empty($this->num)) {
             $obj->mode = $this->num;
         }
     }
     switch ($obj->mode) {
         case 'date':
             // switch the default date format by configured handler
             $defaultDateFormat = kirby()->option('date.handler') == 'strftime' ? '%Y%m%d' : 'Ymd';
             // set the defaults
             isset($obj->field) or $obj->field = 'date';
             isset($obj->format) or $obj->format = $defaultDateFormat;
             break;
     }
     return $obj;
 }
开发者ID:irenehilber,项目名称:kirby-base,代码行数:26,代码来源:pages.php

示例2: 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

示例3: parse

 public function parse()
 {
     if (!$this->field) {
         return '';
     }
     $text = $this->field->value;
     // pre filters
     foreach (static::$pre as $filter) {
         $text = call_user_func_array($filter, array($this, $text));
     }
     // tagsify
     $text = preg_replace_callback('!(?=[^\\]])\\([a-z0-9_-]+:.*?\\)!is', array($this, 'tag'), $text);
     // markdownify
     if (kirby()->option('markdown')) {
         $text = call(kirby::instance()->option('markdown.parser'), $text);
     }
     // smartypantsify
     if (kirby()->option('smartypants')) {
         $text = str_replace('"', '"', $text);
         $text = call(kirby::instance()->option('smartypants.parser'), $text);
     }
     // post filters
     foreach (static::$post as $filter) {
         $text = call_user_func_array($filter, array($this, $text));
     }
     return $text;
 }
开发者ID:irenehilber,项目名称:kirby-base,代码行数:27,代码来源:kirbytext.php

示例4: create

 public function create($uid, $template, $content = array())
 {
     if (empty($template)) {
         throw new Exception(l('pages.add.error.template'));
     }
     $uid = empty($uid) ? str::random(32) : $uid;
     $blueprint = new Blueprint($template);
     $data = array();
     foreach ($blueprint->fields(null) as $key => $field) {
         $data[$key] = $field->default();
     }
     $data = array_merge($data, $content);
     // create the new page and convert it to a page model
     $page = new Page($this->page, parent::create($uid, $template, $data)->dirname());
     if (!$page) {
         throw new Exception(l('pages.add.error.create'));
     }
     kirby()->trigger('panel.page.create', $page);
     // subpage builder
     foreach ((array) $page->blueprint()->pages()->build() as $build) {
         $missing = a::missing($build, array('title', 'template', 'uid'));
         if (!empty($missing)) {
             continue;
         }
         $subpage = $page->children()->create($build['uid'], $build['template'], array('title' => $build['title']));
         if (isset($build['num'])) {
             $subpage->sort($build['num']);
         }
     }
     return $page;
 }
开发者ID:nsteiner,项目名称:kdoc,代码行数:31,代码来源:children.php

示例5: inspectPanelOptions

 public function inspectPanelOptions()
 {
     $root = kirby()->roots()->index() . DS . '/panel';
     require_once $root . DS . '/app/bootstrap.php';
     $panel = new Kirby\Panel(kirby(), $root);
     $this->inspectOptions($panel->defaults());
 }
开发者ID:mzur,项目名称:getkirby.com,代码行数:7,代码来源:inspector.php

示例6: __construct

 /**
  * Instantiate the Manager Route Handler
  *
  * @return void
  */
 public function __construct()
 {
     if (!site()->user() || !site()->user()->hasRole('admin', 'manager')) {
         flash('login.redirect', kirby()->request()->url());
         go('login');
     }
 }
开发者ID:evendev,项目名称:paintcrazy,代码行数:12,代码来源:Manager.php

示例7: index

 public function index()
 {
     if (site()->users()->count() > 0) {
         go(panel()->urls()->login());
     }
     if ($problems = installation::check()) {
         $content = view('installation/check', array('problems' => $problems));
     } else {
         $form = panel()->form('installation', array('language' => kirby()->option('panel.language', 'en')));
         $form->cancel = false;
         $form->save = l('installation.signup.button');
         $form->centered = true;
         foreach (panel()->languages() as $lang) {
             $form->fields()->get('language')->options[$lang->code()] = $lang->title();
         }
         $form->on('submit', function ($form) {
             try {
                 // fetch all the form data
                 $data = $form->serialize();
                 // make sure that the first user is an admin
                 $data['role'] = 'admin';
                 // try to create the new user
                 $user = panel()->site()->users()->create($data);
                 // store the new username for the login screen
                 s::set('username', $user->username());
                 // redirect to the login
                 go(panel()->urls()->login() . '/welcome');
             } catch (Exception $e) {
                 $form->alert($e->getMessage());
             }
         });
         $content = view('installation/signup', array('form' => $form));
     }
     return layout('installation', array('meta' => new Snippet('meta'), 'content' => $content));
 }
开发者ID:aoimedia,项目名称:kosmonautensofa,代码行数:35,代码来源:installation.php

示例8: __construct

 /**
  * Create an instance of the view
  *
  * @param array $options
  * @return void
  */
 public function __construct($options = array())
 {
     $views = isset($options['views']) ? $options['views'] : Config::get('blade_views_dir', kirby()->roots()->templates());
     $cache = isset($options['cache']) ? $options['cache'] : Config::get('blade_cache_dir', kirby()->roots()->cache() . DS . 'views');
     $this->engine = new Blade($views, $cache);
     $this->setEchoFormat();
 }
开发者ID:jevets,项目名称:kirby-view-blade,代码行数:13,代码来源:BladeView.php

示例9: checkAvatars

 protected function checkAvatars()
 {
     $root = kirby()->roots()->avatars();
     // try to create the avatars folder
     dir::make($root);
     return is_writable($root);
 }
开发者ID:biggtfish,项目名称:Clean-Blog-Kirby-Theme,代码行数:7,代码来源:installer.php

示例10: __construct

 public function __construct()
 {
     $endpoint = $this;
     if ($page = page('webmention') and kirby()->path() == $page->uri()) {
         if (r::is('post')) {
             try {
                 $endpoint->start();
                 header::status(202);
                 tpl::set('status', 'success');
                 tpl::set('alert', null);
             } catch (Exception $e) {
                 header::status(400);
                 tpl::set('status', 'error');
                 tpl::set('alert', $e->getMessage());
             }
         } else {
             tpl::set('status', 'idle');
         }
     } else {
         kirby()->routes(array(array('pattern' => 'webmention', 'method' => 'GET|POST', 'action' => function () use($endpoint) {
             try {
                 $endpoint->start();
                 echo response::success('Yay', 202);
             } catch (Exception $e) {
                 echo response::error($e->getMessage());
             }
         })));
     }
 }
开发者ID:aizlewood,项目名称:2016,代码行数:29,代码来源:endpoint.php

示例11: 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

示例12: toHtml

 public function toHtml()
 {
     $snippet = kirby()->roots()->snippets() . DS . 'webmentions' . DS . 'author.php';
     if (!file_exists($snippet)) {
         $snippet = dirname(__DIR__) . DS . 'snippets' . DS . 'author.php';
     }
     return tpl::load($snippet, array('author' => $this, 'mention' => $this->mention));
 }
开发者ID:aizlewood,项目名称:2016,代码行数:8,代码来源:author.php

示例13: __construct

 public function __construct($user)
 {
     if ($user = kirby()->site()->user($user->username())) {
         $this->user = $user;
     } else {
         throw new Exception('The user could not be found');
     }
 }
开发者ID:kristianhalte,项目名称:super_organic,代码行数:8,代码来源:history.php

示例14: __construct

 public function __construct($dir = null)
 {
     $this->dir = $dir ? $dir : kirby()->roots()->cache();
     if (!file_exists($this->dir)) {
         mkdir($this->dir);
     }
     $this->Cache = cache::setup('file', array('root' => $this->dir));
 }
开发者ID:muten84,项目名称:luigibifulco.it,代码行数:8,代码来源:cache.php

示例15: __construct

 /**
  * Create a new CrazyMailer
  *
  * @var array $config data, accepts same as Email::__construct()
  */
 public function __construct($config)
 {
     $defaults = ['to' => KirbyConfig::get('mailer.to'), 'from' => KirbyConfig::get('mailer.from'), 'service' => 'mailgun', 'options' => ['key' => KirbyConfig::get('mailgun.key'), 'domain' => KirbyConfig::get('mailgun.domain')]];
     $this->emailer = new KirbyEmailer(KirbyArray::merge($defaults, $config));
     $this->enabled = env('MAILER_ENABLED', false);
     $handler = new StreamHandler(kirby()->roots()->site() . '/../logs/emailer.log', Logger::WARNING);
     $this->logger = new Logger('crazy');
     $this->logger->pushHandler($handler);
 }
开发者ID:evendev,项目名称:paintcrazy,代码行数:14,代码来源:Mailer.php


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