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

PHP panel函数代码示例

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

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



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


示例16: defaults

 public function defaults()
 {
     $root = panel()->roots()->widgets();
     foreach (dir::read($root) as $dir) {
         // add missing widgets to the order array
         if (!array_key_exists($dir, $this->order)) {
             $this->order[$dir] = true;
         }
         $this->load($dir, $root . DS . $dir . DS . $dir . '.php');
     }
 }
开发者ID:LucasFyl,项目名称:korakia,代码行数:11,代码来源:widgets.php


示例17: getMonthBoard

 public function getMonthBoard($month, $year)
 {
     // Calendar language
     date_default_timezone_set('UTC');
     $l = panel()->language();
     setlocale(LC_ALL, $l . '_' . str::upper($l));
     //setlocale(LC_ALL, 'us_US');
     // Calendar stuff
     $cal = new Calendarboard\calendar();
     $currentMonth = $cal->month($year, $month);
     return tpl::load(__DIR__ . DS . 'template.php', array('currentMonth' => $currentMonth, 'get_day_route_url' => purl($this->model(), 'field/' . $this->field()->name . '/calendarboard/get-day/'), 'calendarboard_url' => $this->model(), 'year_folder' => '/year-' . $year));
 }
开发者ID:molocLab,项目名称:kirby-calendar-board,代码行数:12,代码来源:controller.php


示例18: index

 public function index()
 {
     $site = site();
     $blueprint = blueprint::find($site);
     $fields = $blueprint->fields($site)->toArray();
     $content = $site->content()->toArray();
     $files = null;
     // create the files
     if ($blueprint->files()->max() !== 0 and $blueprint->files()->hide() == false) {
         $files = new Snippet('pages/sidebar/files', array('page' => $site, 'files' => api::files($site, $blueprint)));
     }
     return view('metatags/index', array('topbar' => new Snippet('pages/topbar', array('breadcrumb' => new Snippet('breadcrumb', array('items' => array(array('title' => l('metatags'), 'url' => purl('metatags/'))))), 'search' => purl('pages/search/'))), 'form' => new Form($fields, $content), 's' => $site, 'files' => $files, 'license' => panel()->license()));
 }
开发者ID:aoimedia,项目名称:kosmonautensofa,代码行数:13,代码来源:metatags.php


示例19: __construct

 /**
  * Field setup
  *
  * (1) Load language files
  *
  * @since 1.2.0
  *
  * @return \SelectorField
  */
 public function __construct()
 {
     /*
        (1) Load language files
     */
     $baseDir = __DIR__ . DS . self::LANG_DIR . DS;
     $lang = panel()->language();
     if (file_exists($baseDir . $lang . '.php')) {
         require $baseDir . $lang . '.php';
     } else {
         require $baseDir . 'en.php';
     }
 }
开发者ID:starckio,项目名称:Userskit,代码行数:22,代码来源:selector.php


示例20: delete

 public function delete()
 {
     if (!panel()->user()->isAdmin() and !$this->user->isCurrent()) {
         throw new Exception(l('users.avatar.delete.error.permission'));
     } else {
         if (!$this->exists()) {
             return true;
         }
     }
     if (!parent::delete()) {
         throw new Exception(l('users.avatar.delete.error'));
     }
     kirby()->trigger('panel.avatar.delete', $this);
 }
开发者ID:biggtfish,项目名称:Clean-Blog-Kirby-Theme,代码行数:14,代码来源:avatar.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP panel_begin函数代码示例发布时间:2022-05-15
下一篇:
PHP pam_auth函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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