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


PHP site函数代码示例

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


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

示例1: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$request->isSecure() && noah_installed() && site('forceSsl') == '1') {
         return redirect($request->path(), 302, [], true);
     }
     return $next($request);
 }
开发者ID:projnoah,项目名称:noah,代码行数:14,代码来源:ForceSSL.php

示例2: rules

 public function rules()
 {
     $site_id = site()->id;
     $publicable = true;
     request()->merge(compact('site_id', 'publicable'));
     return ['key' => 'required|unique:' . $this->getTable() . ',key,' . (string) $this->id . ',id,site_id,' . $site_id, 'value' => 'required'];
 }
开发者ID:livecms,项目名称:core,代码行数:7,代码来源:Setting.php

示例3: socialLogin

 /**
  * Redirect user to the related service auth.
  *
  * @param $service
  * @return \Illuminate\Http\Response
  *
  * @author Cali
  */
 public function socialLogin($service)
 {
     if (site($service . 'On') != '1') {
         return redirect('/');
     }
     return Socialite::with($service)->redirect();
 }
开发者ID:projnoah,项目名称:noah,代码行数:15,代码来源:SocialAuthenticatesUsers.php

示例4: posterImage

 /**
  * Get the item's poster image object or a default image
  *
  * @return string
  */
 public function posterImage()
 {
     if ($this->poster()->isNotEmpty()) {
         return $this->image($this->poster());
     }
     return site()->image(site()->defaultPlaceImage());
 }
开发者ID:evendev,项目名称:grg-kirby,代码行数:12,代码来源:BasePage.php

示例5: categoryImage

 /**
  * Get the category image for calendar use
  *
  * @return File
  */
 public function categoryImage()
 {
     if ($this->hasCalendarImage()) {
         return $this->image($this->calendarImage());
     }
     return site()->image(site()->eventDefaultImage());
 }
开发者ID:evendev,项目名称:paintcrazy,代码行数:12,代码来源:category.php

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

示例7: validateToken

 /**
  *  Gatekeeper function that validates input forms and prevents csrf attacks.
  *  Call this from your form action code.
  *
  * @param string $targetURL The URL of the form action that brought us here.
  * @param boolean $haltExecutionOnBadRequest If set to true, the function halts all execution if the form doesn't validate. (True by default.)
  * @return true|false
  */
 public static function validateToken($action = '', $haltExecutionOnBadRequest = true)
 {
     if (site()->session()->isAPIRequest()) {
         return true;
     }
     return parent::validateToken($action, $haltExecutionOnBadRequest);
 }
开发者ID:uniteddiversity,项目名称:Known,代码行数:15,代码来源:Actions.php

示例8: css

 /**
  *  DISPLAY
  */
 public function css()
 {
     if ($language = site()->language() and $language->direction() === 'rtl') {
         $this->assets->setHook('css', tools::load('css', 'components/rtl'));
     }
     return '<style>' . $this->fontPaths($this->getHooks('css')) . '</style>';
 }
开发者ID:dmak78,项目名称:panel-bar,代码行数:10,代码来源:assets.php

示例9: registerPages

 function registerPages()
 {
     site()->addPageHandler('/admin/?', '\\Idno\\Pages\\Admin\\Home');
     site()->addPageHandler('/admin/plugins/?', '\\Idno\\Pages\\Admin\\Plugins');
     site()->addPageHandler('/admin/dependencies/?', '\\Idno\\Pages\\Admin\\Dependencies');
     site()->addPageHandler('/admin/about/?', '\\Idno\\Pages\\Admin\\About');
 }
开发者ID:phpsource,项目名称:idno,代码行数:7,代码来源:Admin.php

示例10: registerEvents

 function registerEvents()
 {
     \Idno\Core\site()->addEventHook('saved', function (\Idno\Core\Event $event) {
         $eventdata = $event->data();
         if ($object = $eventdata['object']) {
             if (site()->session()->isLoggedOn()) {
                 if (!empty(site()->session()->currentUser()->robot_state)) {
                     $user = site()->session()->currentUser();
                     switch ($user->robot_state) {
                         case '1':
                             if (class_exists('IdnoPlugins\\Status') && $object instanceof \IdnoPlugins\Status) {
                                 $user->robot_state = '2a';
                             } else {
                                 $user->robot_state = '2b';
                             }
                             self::$changed_state = 1;
                             break;
                         case '2a':
                             if (class_exists('IdnoPlugins\\Photo') && $object instanceof \IdnoPlugins\Photo) {
                                 $user->robot_state = '3a';
                             }
                             self::$changed_state = 1;
                             break;
                         case '2b':
                             $user->robot_state = '3b';
                             self::$changed_state = 1;
                             break;
                     }
                     $user->save();
                     site()->session()->refreshSessionUser($user);
                 }
             }
         }
     });
 }
开发者ID:johnellison,项目名称:90days,代码行数:35,代码来源:HelperRobot.php

示例11: login

 public function login($welcome = null)
 {
     if ($user = panel()->site()->user()) {
         go(panel()->urls()->index());
     }
     $message = l('login.error');
     $error = false;
     $form = panel()->form('login');
     $form->cancel = false;
     $form->save = l('login.button');
     $form->centered = true;
     if (r::is('post') and get('_csfr') and csfr(get('_csfr'))) {
         $data = $form->serialize();
         $user = site()->user(str::lower($data['username']));
         if (!$user) {
             $error = true;
         } else {
             if (!$user->hasPanelAccess()) {
                 $error = true;
             } else {
                 if (!$user->login(get('password'))) {
                     $error = true;
                 } else {
                     go(panel()->urls()->index());
                 }
             }
         }
     }
     if ($username = s::get('username')) {
         $form->fields->username->value = html($username, false);
     }
     return layout('login', array('meta' => new Snippet('meta'), 'welcome' => $welcome ? l('login.welcome') : '', 'form' => $form, 'error' => $error ? $message : false));
 }
开发者ID:LucasFyl,项目名称:korakia,代码行数:33,代码来源:auth.php

示例12: structure

 public function structure($id, $fieldName, $context)
 {
     $page = empty($id) ? site() : page($id);
     if (!$page) {
         throw new Exception('The page could not be found');
     }
     $blueprint = blueprint::find($page);
     $field = null;
     $fields = $context == 'file' ? $blueprint->files()->fields() : $blueprint->fields();
     // make sure to get fields by case insensitive field names
     foreach ($fields as $f) {
         if (strtolower($f->name) == strtolower($fieldName)) {
             $field = $f;
         }
     }
     if (!$field) {
         throw new Exception('The field could not be found');
     }
     $fields = new Blueprint\Fields($field->fields(), $page);
     $fields = $fields->toArray();
     foreach ($fields as $key => $field) {
         if ($field['type'] == 'textarea') {
             $fields[$key]['buttons'] = false;
         }
     }
     $form = new Form($fields, null, $fieldName);
     $form->save = get('_id') ? l('fields.structure.save') : l('fields.structure.add');
     return view('editor/structure', array('page' => $page, 'form' => $form));
 }
开发者ID:madebypost,项目名称:Gulp-Neat-KirbyCMS,代码行数:29,代码来源:editor.php

示例13: show

 /**
  *  DISPLAY
  */
 public static function show($args = array())
 {
     if ($user = site()->user() and $user->hasPanelAccess()) {
         $self = new self($args);
         return $self->_output();
     }
 }
开发者ID:schobiwan,项目名称:panel-bar,代码行数:10,代码来源:panel-bar.php

示例14: items

 protected function items($page, $method)
 {
     switch ($method) {
         case 'visibleChildren':
             $items = $page->children()->visible();
             break;
         case 'invisibleChildren':
             $items = $page->children()->invisible();
             break;
         case 'siblings':
             $items = $page->siblings()->not($page);
             break;
         case 'pages':
             $items = site()->index();
             $items = $items->sortBy('title', 'asc');
             break;
         case 'index':
             $items = $page->index();
             $items = $items->sortBy('title', 'asc');
             break;
         case 'children':
         case 'files':
         case 'images':
         case 'documents':
         case 'videos':
         case 'audio':
         case 'code':
         case 'archives':
             $items = $page->{$method}();
             break;
     }
     return $items;
 }
开发者ID:DerZyklop,项目名称:gutesache.pxwrk.de,代码行数:33,代码来源:fieldoptions.php

示例15: signup

 protected function signup()
 {
     $self = $this;
     $form = $this->form('installation/signup', array(), function ($form) use($self) {
         $form->validate();
         if (!$form->isValid()) {
             return false;
         }
         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 = site()->users()->create($data);
             // store the new username for the login screen
             s::set('username', $user->username());
             // try to login the user automatically
             if ($user->hasPanelAccess()) {
                 $user->login($data['password']);
             }
             // redirect to the login
             $self->redirect('login');
         } catch (Exception $e) {
             $form->alert($e->getMessage());
         }
     });
     return $this->modal('index', compact('form'));
 }
开发者ID:irenehilber,项目名称:kirby-base,代码行数:29,代码来源:installation.php


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