當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。