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


PHP panel函数代码示例

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


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

示例1: layout

 public function layout($type, $data = array())
 {
     $version = panel()->version();
     $base = panel()->urls()->index();
     $cssbase = panel()->urls()->css();
     $jsbase = panel()->urls()->js();
     $defaults = array('title' => panel()->site()->title() . ' | Panel', 'direction' => panel()->direction(), 'meta' => $this->snippet('meta'), 'css' => css($cssbase . '/panel.css?v=' . $version), 'js' => js($jsbase . '/dist/panel.min.js?v=' . $version), 'content' => '', 'bodyclass' => '');
     switch ($type) {
         case 'app':
             $defaults['topbar'] = '';
             $defaults['csrf'] = panel()->csrf();
             $defaults['formcss'] = css($cssbase . '/form.min.css?v=' . $version);
             $defaults['formjs'] = js($jsbase . '/dist/form.min.js?v=' . $version);
             $defaults['appjs'] = js($jsbase . '/dist/app.min.js?v=' . $version);
             // plugin stuff
             $defaults['pluginscss'] = css($base . '/plugins/css?v=' . $version);
             $defaults['pluginsjs'] = js($base . '/plugins/js?v=' . $version);
             break;
         case 'base':
             break;
     }
     $data = array_merge($defaults, $data);
     if (r::ajax() and $type == 'app') {
         $panel = panel();
         $user = $panel->site()->user();
         $response = array('user' => $user ? $user->username() : false, 'direction' => $panel->direction(), 'title' => $data['title'], 'content' => $data['topbar'] . $data['content']);
         return response::json($response);
     } else {
         return new Layout($type, $data);
     }
 }
开发者ID:biggtfish,项目名称:Clean-Blog-Kirby-Theme,代码行数:31,代码来源:base.php

示例2: logout

 public function logout()
 {
     if ($user = panel()->user()) {
         $user->logout();
     }
     $this->redirect('login');
 }
开发者ID:kristianhalte,项目名称:super_organic,代码行数:7,代码来源:auth.php

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

示例4: get

 public function get()
 {
     $history = $this->user->__get('history');
     if (empty($history) or !is_array($history)) {
         return array();
     }
     $update = false;
     $result = array();
     foreach ($history as $item) {
         try {
             $result[] = panel()->page($item);
         } catch (Exception $e) {
             $update = true;
         }
     }
     if ($update) {
         $history = array_map(function ($item) {
             return $item->id();
         }, $result);
         try {
             $this->user->update(array('history' => $history));
         } catch (Exception $e) {
         }
     }
     return $result;
 }
开发者ID:kristianhalte,项目名称:super_organic,代码行数:26,代码来源:history.php

示例5: logout

 public function logout()
 {
     if ($user = panel()->site()->user()) {
         $user->logout();
     }
     go(panel()->urls()->login());
 }
开发者ID:muten84,项目名称:luigibifulco.it,代码行数:7,代码来源:auth.php

示例6: forUser

 public function forUser($username, $fieldName, $fieldType, $path)
 {
     $user = panel()->user($username);
     $form = $user->form('user', function () {
     });
     return $this->route($user, $form, $fieldName, $fieldType, $path);
 }
开发者ID:irenehilber,项目名称:kirby-base,代码行数:7,代码来源:field.php

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

示例8: add

 public function add()
 {
     $self = $this;
     $model = $this->model();
     $structure = $this->structure($model);
     $modalsize = $this->field()->modalsize();
     $fieldsetName = get("fieldset");
     $fieldsetStructure = $this->fieldsetStructure($fieldsetName);
     if (!$fieldsetStructure) {
         return $this->modal('error', array('text' => 'No fieldset with name "' . $fieldsetName . '" found.'));
     }
     $form = $this->form('add', array($model, $fieldsetStructure), function ($form) use($model, $structure, $self, $fieldsetName) {
         $form->validate();
         if (!$form->isValid()) {
             return false;
         }
         $data = $form->serialize();
         $data["_fieldset"] = $fieldsetName;
         $structure->add($data);
         $self->notify(':)');
         $self->redirect($model);
     });
     $form->attr('action', panel()->urls()->current() . "?fieldset=" . get("fieldset"));
     return $this->modal('add', compact('form', 'modalsize'));
 }
开发者ID:TimOetting,项目名称:kirby-builder,代码行数:25,代码来源:controller.php

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

示例10: add

 public function add($id = '/')
 {
     $page = $this->page($id);
     $blueprint = blueprint::find($page);
     $templates = $blueprint->pages()->template();
     $options = array();
     $back = array('subpages' => purl('subpages/index/' . $page->id()), 'page' => purl($page, 'show'));
     $form = panel()->form('pages.add');
     $form->save = l('add');
     $form->back = a::get($back, get('to'));
     foreach ($templates as $template) {
         $options[$template->name()] = $template->title();
     }
     $select = form::field('select', array('name' => 'template', 'label' => l('pages.add.template.label'), 'options' => $options, 'required' => true));
     if ($templates->count() == 1) {
         $select->readonly = true;
         $select->value = $templates->first()->name();
     }
     $form->fields()->append('template', $select);
     if (api::maxPages($page, $blueprint->pages()->max())) {
         $form->fields = array('info' => form::field('info', array('label' => 'pages.add.error.max.headline', 'text' => 'pages.add.error.max.text')));
         $form->save = false;
         $form->centered = true;
     }
     return view('pages/add', array('page' => $page, 'form' => $form));
 }
开发者ID:muten84,项目名称:luigibifulco.it,代码行数:26,代码来源:pages.php

示例11: defaults

 public function defaults()
 {
     $kirby = kirby();
     $root = panel()->roots()->widgets();
     foreach (dir::read($root) as $dir) {
         $kirby->registry->set('widget', $dir, $root . DS . $dir, true);
     }
 }
开发者ID:nsteiner,项目名称:kdoc,代码行数:8,代码来源:widgets.php

示例12: auth

 public function auth()
 {
     try {
         $user = panel()->user();
     } catch (Exception $e) {
         $this->redirect('login');
     }
 }
开发者ID:irenehilber,项目名称:kirby-base,代码行数:8,代码来源:error.php

示例13: id

 public function id()
 {
     $site = panel()->site();
     if ($site->multilang()) {
         return $site->language()->code() . '-' . sha1($this->model->id());
     } else {
         return sha1($this->model->id());
     }
 }
开发者ID:irenehilber,项目名称:kirby-base,代码行数:9,代码来源:changes.php

示例14: input

 public function input()
 {
     $input = parent::input();
     if ($this->autocomplete) {
         $input->attr('autocomplete', 'off');
         $input->data(array('field' => 'autocomplete', 'url' => panel()->urls()->api() . '/autocomplete/emails'));
     }
     return $input;
 }
开发者ID:aoimedia,项目名称:kosmonautensofa,代码行数:9,代码来源:email.php

示例15: index

 public function index($method)
 {
     try {
         $auto = new Kirby\Panel\Autocomplete(panel(), $method, get());
         $result = $auto->result();
     } catch (Exception $e) {
         $result = array();
     }
     return $this->json(array('data' => $result));
 }
开发者ID:irenehilber,项目名称:kirby-base,代码行数:10,代码来源:autocomplete.php


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