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


PHP Input::protocol方法代码示例

本文整理汇总了PHP中Input::protocol方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::protocol方法的具体用法?PHP Input::protocol怎么用?PHP Input::protocol使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Input的用法示例。


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

示例1: before

 public function before()
 {
     parent::before();
     if (!defined('IS_SSL')) {
         define('IS_SSL', Input::protocol() == 'https');
     }
     if (!defined('IS_ADMIN')) {
         define('IS_ADMIN', $this->check_is_admin_request());
     }
     if (!defined('IS_SP')) {
         define('IS_SP', \MyAgent\Agent::is_mobile_device());
     }
     if (!defined('IS_API')) {
         define('IS_API', Site_Util::check_is_api());
     }
     $this->set_default_data();
     $this->check_ssl_required_request_and_redirect();
     $this->check_remote_ip();
     $this->auth_instance = Auth::forge($this->auth_driver);
     if (!defined('IS_AUTH')) {
         define('IS_AUTH', $this->check_auth(false));
     }
     $this->check_auth_and_redirect();
     $this->set_current_user();
     $this->check_required_setting_and_redirect();
     self::setup_assets();
 }
开发者ID:uzura8,项目名称:flockbird,代码行数:27,代码来源:base.php

示例2: create_url

 public static function create_url()
 {
     $base_url = '';
     if (\Input::server('http_host')) {
         $base_url .= \Input::protocol() . '://' . \Input::server('http_host');
     }
     if (\Input::server('script_name')) {
         $base_url .= str_replace('\\', '/', dirname(\Input::server('script_name')));
         // Add a slash if it is missing
         $base_url = rtrim($base_url, '/') . '/';
     }
     return $base_url;
 }
开发者ID:niceboy120,项目名称:PulseFramework,代码行数:13,代码来源:Pulse.php

示例3: router

 public function router($method, $params)
 {
     Config::load('base');
     //$action = $this->request->controller . '_' . $this->request->action;
     $action = $this->request->route->translation;
     Logger::params($action, Input::all(), $this->params());
     // ssl
     $cfg = empty($this->subsystem) ? 'site' : 'site.' . $this->subsystem;
     list($need, $action_list, $both_list) = $this->get_onoff(Config::get($cfg . '.ssl'));
     $redirect = false;
     if (empty($both_list) || !in_array($action, $both_list)) {
         $ssl = Input::protocol() == 'http';
         if ($ssl) {
             $redirect = $need ? in_array($action, $action_list) : !in_array($action, $action_list);
         } else {
             $redirect = $need ? !in_array($action, $action_list) : in_array($action, $action_list);
         }
     }
     if ($redirect) {
         return Response::redirect(Uri::create(Input::uri(), [], [], $ssl));
     }
     // authentication
     $flg = false;
     list($need, $action_list, $both_list) = $this->get_onoff(Config::get($cfg . '.auth'));
     if (empty($both_list) || !in_array($action, $both_list)) {
         if ($this->is_login()) {
             $flg = $need ? !in_array($action, $action_list) : in_array($action, $action_list);
         } else {
             $flg = $need ? in_array($action, $action_list) : !in_array($action, $action_list);
         }
     }
     if ($flg) {
         return Response::redirect($this->subsystem . '/auth');
     }
     // call controller
     $call = 'action_' . $this->request->action;
     if (is_callable([$this, $call])) {
         $this->{$call}($params);
     }
 }
开发者ID:marietta-adachi,项目名称:website,代码行数:40,代码来源:tpl.php

示例4: generate_base_url

 /**
  * Generates a base url.
  *
  * @return string the base url
  */
 protected static function generate_base_url()
 {
     $base_url = '';
     if (\Input::server('http_host')) {
         $base_url .= \Input::protocol() . '://' . \Input::server('http_host');
     }
     if (\Input::server('script_name')) {
         $common = get_common_path(array(\Input::server('request_uri'), \Input::server('script_name')));
         $base_url .= $common;
     }
     // Add a slash if it is missing and return it
     return rtrim($base_url, '/') . '/';
 }
开发者ID:vienbk91,项目名称:fuelphp17,代码行数:18,代码来源:fuel.php

示例5: generate_base_url

 /**
  * Generates a base url.
  *
  * @return  string  the base url
  */
 protected static function generate_base_url()
 {
     $base_url = '';
     if (\Input::server('http_host')) {
         $base_url .= \Input::protocol() . '://' . \Input::server('http_host');
     }
     if (\Input::server('script_name')) {
         $base_url .= str_replace('\\', '/', dirname(\Input::server('script_name')));
     }
     // Add a slash if it is missing and return it
     return rtrim($base_url, '/') . '/';
 }
开发者ID:cloudetm,项目名称:development,代码行数:17,代码来源:fuel.php

示例6: _parse_search

 /**
  * Parses an actual route - extracted out of parse() to make it recursive.
  *
  * @param   string  The URI object
  * @param   object  route object
  * @param   string  request method
  * @return  array|boolean
  */
 protected function _parse_search($uri, $route = null, $method = null)
 {
     if ($route === null) {
         $route = $this;
     }
     if (is_array($route->translation)) {
         foreach ($route->translation as $r) {
             $verb = $r[0];
             $protocol = isset($r[2]) ? $r[2] ? 'https' : 'http' : false;
             if (($protocol === false or $protocol == \Input::protocol()) and $method == strtoupper($verb)) {
                 $r[1]->search = $route->search;
                 $result = $route->_parse_search($uri, $r[1], $method);
                 if ($result) {
                     return $result;
                 }
             }
         }
         return false;
     }
     if ($this->case_sensitive) {
         $result = preg_match('#^' . $route->search . '$#uD', $uri, $params);
     } else {
         $result = preg_match('#^' . $route->search . '$#uiD', $uri, $params);
     }
     if ($result === 1) {
         return $route->matched($uri, $params);
     } else {
         return false;
     }
 }
开发者ID:marietta-adachi,项目名称:website,代码行数:38,代码来源:route.php

示例7: convert_protocol2resuested

 public static function convert_protocol2resuested($url)
 {
     if (Input::protocol() != 'https') {
         return $url;
     }
     return preg_replace('#^http://#', 'https://', $url);
 }
开发者ID:uzura8,项目名称:flockbird,代码行数:7,代码来源:uri.php

示例8: generateBaseUrl

 protected function generateBaseUrl()
 {
     if ($this->_base_url === null) {
         $base_url = '';
         if (\Input::server('http_host')) {
             $base_url .= \Input::protocol() . '://' . \Input::server('http_host');
         }
         $this->_base_url = rtrim($base_url, '/') . '/';
     }
     return $this->_base_url;
 }
开发者ID:soundintheory,项目名称:fuel-cmf,代码行数:11,代码来源:Extension.php

示例9: url

 /**
  * Creates a URL
  *
  * @param array  $query Array of query elements
  * @param string $url   URL
  *
  * @return string
  */
 protected function url($url, array $query = array())
 {
     $protocol = $this->getConfig('protocol', false);
     if (isset($protocol) === false) {
         $protocol = strtolower(\Input::protocol());
     }
     $url = $protocol . '://' . $url;
     return \Uri::create($url, array(), $query);
 }
开发者ID:indigophp,项目名称:fuel-gravatar,代码行数:17,代码来源:Gravatar.php


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