本文整理汇总了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();
}
示例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;
}
示例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);
}
}
示例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, '/') . '/';
}
示例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, '/') . '/';
}
示例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;
}
}
示例7: convert_protocol2resuested
public static function convert_protocol2resuested($url)
{
if (Input::protocol() != 'https') {
return $url;
}
return preg_replace('#^http://#', 'https://', $url);
}
示例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;
}
示例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);
}