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


PHP Request::secure方法代码示例

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


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

示例1: create

 /**
  * Displays the form for account creation
  *
  */
 public function create()
 {
     if (!\Request::secure() && !Utils::isNinjaDev()) {
         Session::flash('warning', trans('texts.enable_https'));
     }
     $account = Auth::user()->account;
     $accountGatewaysIds = $account->gatewayIds();
     $otherProviders = Input::get('other_providers');
     if (!Utils::isNinja() || !env('WEPAY_CLIENT_ID') || Gateway::hasStandardGateway($accountGatewaysIds)) {
         $otherProviders = true;
     }
     $data = self::getViewModel();
     $data['url'] = 'gateways';
     $data['method'] = 'POST';
     $data['title'] = trans('texts.add_gateway');
     if ($otherProviders) {
         $availableGatewaysIds = $account->availableGatewaysIds();
         $data['primaryGateways'] = Gateway::primary($availableGatewaysIds)->orderBy('name', 'desc')->get();
         $data['secondaryGateways'] = Gateway::secondary($availableGatewaysIds)->orderBy('name')->get();
         $data['hiddenFields'] = Gateway::$hiddenFields;
         return View::make('accounts.account_gateway', $data);
     } else {
         return View::make('accounts.account_gateway_wepay', $data);
     }
 }
开发者ID:rafaelsisweb,项目名称:invoice-ninja,代码行数:29,代码来源:AccountGatewayController.php

示例2: publishStory

 /**
  * This will publish the story to the database
  */
 public function publishStory()
 {
     $oRequestInstance = \Request::instance();
     $oRouteInstance = \Route::current();
     // get the extra custom data supplied by the user
     $aCustomData = $this->getCustomSuppliedData();
     $uri = head($oRouteInstance->methods()) . ' ' . $oRouteInstance->uri();
     $aData = ['ip_address' => \Input::getClientIp(), 'domain' => \Request::root(), 'path' => \Request::path(), 'request_method' => $oRequestInstance->getMethod(), 'query_string' => $oRequestInstance->getQueryString(), 'post_string' => \Request::method() == "POST" ? json_encode(\Input::all()) : NULL, 'is_ajax' => \Request::ajax(), 'is_secure' => \Request::secure(), 'route_uri' => $uri ?: '-', 'route_name' => $oRouteInstance->getName() ?: '-', 'route_action' => $oRouteInstance->getActionName() ?: '-', 'class_method' => \Request::method()];
     // merge the custom data to the already built data
     $aData = array_merge($aData, $aCustomData);
     // save the collected data
     $this->getSessionManager()->saveCollectedData($aData);
 }
开发者ID:samcrosoft,项目名称:accesstory,代码行数:16,代码来源:AccessStory.php

示例3: create

 /**
  * Displays the form for account creation
  *
  */
 public function create()
 {
     $data = self::getViewModel();
     $data['url'] = 'gateways';
     $data['method'] = 'POST';
     $data['title'] = trans('texts.add_gateway');
     $data['selectGateways'] = Gateway::where('payment_library_id', '=', 1)->where('id', '!=', GATEWAY_PAYPAL_EXPRESS)->where('id', '!=', GATEWAY_BITPAY)->where('id', '!=', GATEWAY_GOCARDLESS)->where('id', '!=', GATEWAY_DWOLLA)->orderBy('name')->get();
     $data['hiddenFields'] = Gateway::$hiddenFields;
     if (!\Request::secure() && !Utils::isNinjaDev()) {
         Session::flash('warning', trans('texts.enable_https'));
     }
     return View::make('accounts.account_gateway', $data);
 }
开发者ID:abusby,项目名称:invoiceninja,代码行数:17,代码来源:AccountGatewayController.php

示例4: put

 /**
  * Set the value of a cookie.
  *
  * <code>
  *		// Set the value of the "favorite" cookie
  *		Cookie::put('favorite', 'Laravel');
  *
  *		// Set the value of the "favorite" cookie for twenty minutes
  *		Cookie::put('favorite', 'Laravel', 20);
  * </code>
  *
  * @param  string  $name
  * @param  string  $value
  * @param  int     $expiration
  * @param  string  $path
  * @param  string  $domain
  * @param  bool    $secure
  * @return void
  */
 public static function put($name, $value, $expiration = 0, $path = '/', $domain = null, $secure = false)
 {
     if ($expiration !== 0) {
         $expiration = time() + $expiration * 60;
     }
     // If the secure option is set to true, yet the request is not over HTTPS
     // we'll throw an exception to let the developer know that they are
     // attempting to send a secure cookie over the unsecure HTTP.
     if ($secure and !Request::secure()) {
         throw new \Exception("Attempting to set secure cookie over HTTP.");
     }
     static::$jar[$name] = compact('name', 'value', 'expiration', 'path', 'domain', 'secure');
 }
开发者ID:niceboy120,项目名称:Music-Platform,代码行数:32,代码来源:cookie.php

示例5: to_asset

 /**
  * Generate an application URL to an asset.
  *
  * @param  string  $url
  * @param  bool    $https
  * @return string
  */
 public static function to_asset($url, $https = null)
 {
     if (is_null($https)) {
         $https = Request::secure();
     }
     $url = static::to($url, $https);
     // Since assets are not served by Laravel, we do not need to come through
     // the front controller. We'll remove the application index specified in
     // the application configuration from the generated URL.
     if (($index = Config::$items['application']['index']) !== '') {
         $url = str_replace($index . '/', '', $url);
     }
     return $url;
 }
开发者ID:nshontz,项目名称:laravel-blog,代码行数:21,代码来源:url.php

示例6: put

 /**
  * Set the value of a cookie.
  *
  * <code>
  *		// Set the value of the "favorite" cookie
  *		Cookie::put('favorite', 'Laravel');
  *
  *		// Set the value of the "favorite" cookie for twenty minutes
  *		Cookie::put('favorite', 'Laravel', 20);
  * </code>
  *
  * @param  string  $name
  * @param  string  $value
  * @param  int     $expiration
  * @param  string  $path
  * @param  string  $domain
  * @param  bool    $secure
  * @return void
  */
 public static function put($name, $value, $expiration = 0, $path = '/', $domain = null, $secure = false)
 {
     if ($expiration !== 0) {
         $expiration = time() + $expiration * 60;
     }
     $value = static::hash($value) . '+' . $value;
     // If the developer has explicitly disabled SLL, then we shouldn't force
     // this cookie over SSL.
     $secure = $secure && Config::get('application.ssl');
     // If the secure option is set to true, yet the request is not over HTTPS
     // we'll throw an exception to let the developer know that they are
     // attempting to send a secure cookie over the insecure HTTP.
     if ($secure and !Request::secure()) {
         throw new \Exception("Attempting to set secure cookie over HTTP.");
     }
     static::$jar[$name] = compact('name', 'value', 'expiration', 'path', 'domain', 'secure');
 }
开发者ID:acmadi,项目名称:diantaksi,代码行数:36,代码来源:cookie.php

示例7: base_path

        $appDir = base_path() . "/" . Config::get('swagger.app-dir');
        $docDir = Config::get('swagger.doc-dir');
        if (!File::exists($docDir) || is_writable($docDir)) {
            // delete all existing documentation
            if (File::exists($docDir)) {
                File::deleteDirectory($docDir);
            }
            File::makeDirectory($docDir);
            $excludeDirs = Config::get('swagger.excludes');
            $swagger = \Swagger\scan($appDir, ['exclude' => $excludeDirs]);
            $filename = $docDir . '/api-docs.json';
            file_put_contents($filename, $swagger);
        }
    }
    if (Config::get('swagger.behind-reverse-proxy')) {
        $proxy = Request::server('REMOTE_ADDR');
        Request::setTrustedProxies(array($proxy));
    }
    //need the / at the end to avoid CORS errors on Homestead systems.
    $response = response()->view('swagger.index', array('secure' => Request::secure(), 'urlToDocs' => url('api-docs.json'), 'requestHeaders' => Config::get('swagger.requestHeaders'), 'clientId' => Input::get("client_id"), 'clientSecret' => Input::get("client_secret"), 'realm' => Input::get("realm"), 'appName' => Input::get("appName")));
    //need the / at the end to avoid CORS errors on Homestead systems.
    /*$response = Response::make(
          View::make('swaggervel::index', array(
                  'secure'         => Request::secure(),
                  'urlToDocs'      => url('api-docs.json'),
                  'requestHeaders' => Config::get('swaggervel.requestHeaders') )
          ),
          200
      );*/
    return $response;
});
开发者ID:paters936,项目名称:BBMembershipSystem,代码行数:31,代码来源:routes.php

示例8: function

App::before(function ($request) {
    // CloudFlare IP addresses to trust
    // Proxies obtained from https://www.cloudflare.com/ips-v4
    // Cached for 1 week
    try {
        Request::setTrustedProxies(Cache::remember('cloudflare.ips', 24 * 60 * 7, function () {
            $request = App::make('guzzle')->get('https://www.cloudflare.com/ips-v4');
            return explode("\n", $request->getBody());
        }));
    } catch (Exception $e) {
        Cache::forget('cloudflare.ips');
        Log::error($e);
    }
    // If request is not secured and force secured connection is enabled
    // then we need to redirect the user to a secure link.
    if (!Request::secure() && Config::get('bfacp.site.ssl') && $_SERVER['REMOTE_ADDR'] != '127.0.0.1' && filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE)) {
        $path = Request::path();
        if (strlen(Request::server('QUERY_STRING')) > 0) {
            $path .= '?' . Request::server('QUERY_STRING');
        }
        $status = in_array(Request::getMethod(), ['POST', 'PUT', 'DELETE']) ? 307 : 302;
        return Redirect::secure($path, $status);
    }
    // Check if only authorized users are allowed to access the site.
    if (Config::get('bfacp.site.auth') && Auth::guest()) {
        $path = explode('/', Request::path());
        if (count($path) > 1) {
            $route = $path[0] . '/' . $path[1];
        } else {
            $route = $path[0];
        }
开发者ID:BP4U,项目名称:BFAdminCP,代码行数:31,代码来源:filters.php

示例9: array

<?php

/**
 * Gravatar configuration
 */
return array('size' => 80, 'default_image' => false, 'rating' => 'g', 'secure' => Request::secure());
开发者ID:TahsinGokalp,项目名称:L3-Sozluk,代码行数:6,代码来源:default.php

示例10: function

    $memento_service = ServiceLocator::getInstance()->getService(OpenIdServiceCatalog::MementoService);
    $memento_service->saveCurrentRequest();
});
Route::filter("oauth2.save.request", function () {
    $memento_service = ServiceLocator::getInstance()->getService(OAuth2ServiceCatalog::MementoService);
    $memento_service->saveCurrentAuthorizationRequest();
});
Route::filter("oauth2.needs.auth.request", function () {
    $memento_service = ServiceLocator::getInstance()->getService(OAuth2ServiceCatalog::MementoService);
    $oauth2_message = $memento_service->getCurrentAuthorizationRequest();
    if ($oauth2_message == null || !$oauth2_message->isValid()) {
        throw new InvalidAuthorizationRequestException();
    }
});
Route::filter("ssl", function () {
    if (!Request::secure() && ServerConfigurationService::getConfigValue("SSL.Enable")) {
        $openid_memento_service = ServiceLocator::getInstance()->getService(OpenIdServiceCatalog::MementoService);
        $openid_memento_service->saveCurrentRequest();
        $oauth2_memento_service = ServiceLocator::getInstance()->getService(OAuth2ServiceCatalog::MementoService);
        $oauth2_memento_service->saveCurrentAuthorizationRequest();
        return Redirect::secure(Request::getRequestUri());
    }
});
Route::filter("oauth2.enabled", function () {
    if (!ServerConfigurationService::getConfigValue("OAuth2.Enable")) {
        return View::make('404');
    }
});
Route::filter('user.owns.client.policy', function ($route, $request) {
    try {
        $authentication_service = ServiceLocator::getInstance()->getService(UtilsServiceCatalog::AuthenticationService);
开发者ID:smarcet,项目名称:openstackid,代码行数:31,代码来源:filters.php

示例11: function

<?php

use Swagger\Swagger;
Route::any(Config::get('l5-swagger.doc-route') . '/{page?}', function ($page = 'api-docs.json') {
    $filePath = Config::get('l5-swagger.doc-dir') . "/{$page}";
    if (File::extension($filePath) === "") {
        $filePath .= ".json";
    }
    if (!File::Exists($filePath)) {
        App::abort(404, "Cannot find {$filePath}");
    }
    $content = File::get($filePath);
    return Response::make($content, 200, array('Content-Type' => 'application/json'));
});
Route::get('api-docs', function () {
    if (Config::get('l5-swagger.generateAlways')) {
        \Darkaonline\L5Swagger\Generator::generateDocs();
    }
    if (Config::get('l5-swagger.behind-reverse-proxy')) {
        $proxy = Request::server('REMOTE_ADDR');
        Request::setTrustedProxies(array($proxy));
    }
    //need the / at the end to avoid CORS errors on Homestead systems.
    $response = Response::make(view('l5-swagger::index', array('secure' => Request::secure(), 'urlToDocs' => url(Config::get('l5-swagger.doc-route')), 'requestHeaders' => Config::get('l5-swagger.requestHeaders'))), 200);
    if (Config::has('l5-swagger.viewHeaders')) {
        foreach (Config::get('l5-swagger.viewHeaders') as $key => $value) {
            $response->header($key, $value);
        }
    }
    return $response;
});
开发者ID:joshstrange,项目名称:L5-Swagger,代码行数:31,代码来源:routes.php

示例12: factory

 /**
  * Creates a new request object for the given URI. New requests should be
  * created using the [Request::instance] or [Request::factory] methods.
  *
  *     $request = Request::factory($uri);
  *
  * If $cache parameter is set, the response for the request will attempt to
  * be retrieved from the cache.
  *
  * @param   string  $uri URI of the request
  * @param   Cache   $cache
  * @param   array   $injected_routes an array of routes to use, for testing
  * @return  void
  * @throws  Request_Exception
  * @uses    Route::all
  * @uses    Route::matches
  */
 public static function factory($uri = TRUE, HTTP_Cache $cache = NULL, $injected_routes = array())
 {
     // If this is the initial request
     if (!Request::$initial) {
         if (Kohana::$is_cli) {
             // Default protocol for command line is cli://
             $protocol = 'cli';
             // Get the command line options
             $options = CLI::options('uri', 'method', 'get', 'post', 'referrer');
             if (isset($options['uri'])) {
                 // Use the specified URI
                 $uri = $options['uri'];
             } elseif ($uri === TRUE) {
                 $uri = '';
             }
             if (isset($options['method'])) {
                 // Use the specified method
                 $method = strtoupper($options['method']);
             } else {
                 // Default to GET requests
                 $method = HTTP_Request::GET;
             }
             if (isset($options['get'])) {
                 // Overload the global GET data
                 parse_str($options['get'], $_GET);
             }
             if (isset($options['post'])) {
                 // Overload the global POST data
                 parse_str($options['post'], $_POST);
             }
             if (isset($options['referrer'])) {
                 $referrer = $options['referrer'];
             }
         } else {
             if (isset($_SERVER['SERVER_PROTOCOL'])) {
                 $protocol = $_SERVER['SERVER_PROTOCOL'];
             } else {
                 $protocol = HTTP::$protocol;
             }
             if (isset($_SERVER['REQUEST_METHOD'])) {
                 // Use the server request method
                 $method = $_SERVER['REQUEST_METHOD'];
             } else {
                 // Default to GET requests
                 $method = HTTP_Request::GET;
             }
             if (!empty($_SERVER['HTTPS']) and filter_var($_SERVER['HTTPS'], FILTER_VALIDATE_BOOLEAN)) {
                 // This request is secure
                 $secure = TRUE;
             }
             if (isset($_SERVER['HTTP_REFERER'])) {
                 // There is a referrer for this request
                 $referrer = $_SERVER['HTTP_REFERER'];
             }
             if (isset($_SERVER['HTTP_USER_AGENT'])) {
                 // Browser type
                 Request::$user_agent = $_SERVER['HTTP_USER_AGENT'];
             }
             if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) {
                 // Typically used to denote AJAX requests
                 $requested_with = $_SERVER['HTTP_X_REQUESTED_WITH'];
             }
             if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) and isset($_SERVER['REMOTE_ADDR']) and in_array($_SERVER['REMOTE_ADDR'], Request::$trusted_proxies)) {
                 // Use the forwarded IP address, typically set when the
                 // client is using a proxy server.
                 // Format: "X-Forwarded-For: client1, proxy1, proxy2"
                 $client_ips = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
                 Request::$client_ip = array_shift($client_ips);
                 unset($client_ips);
             } elseif (isset($_SERVER['HTTP_CLIENT_IP']) and isset($_SERVER['REMOTE_ADDR']) and in_array($_SERVER['REMOTE_ADDR'], Request::$trusted_proxies)) {
                 // Use the forwarded IP address, typically set when the
                 // client is using a proxy server.
                 $client_ips = explode(',', $_SERVER['HTTP_CLIENT_IP']);
                 Request::$client_ip = array_shift($client_ips);
                 unset($client_ips);
             } elseif (isset($_SERVER['REMOTE_ADDR'])) {
                 // The remote IP address
                 Request::$client_ip = $_SERVER['REMOTE_ADDR'];
             }
             if ($method !== HTTP_Request::GET) {
                 // Ensure the raw body is saved for future use
                 $body = file_get_contents('php://input');
             }
//.........这里部分代码省略.........
开发者ID:gilyaev,项目名称:framework-bench,代码行数:101,代码来源:request.php

示例13: file_put_contents

         $defaultApiVersion = Config::get('swaggervel.default-api-version');
         $defaultSwaggerVersion = Config::get('swaggervel.default-swagger-version');
         $excludeDirs = Config::get('swaggervel.excludes');
         $swagger = \Swagger\scan($appDir, ['exclude' => $excludeDirs]);
         $filename = $docDir . '/api-docs.json';
         file_put_contents($filename, $swagger);
     }
 }
 if (Config::get('swaggervel.behind-reverse-proxy')) {
     $proxy = Request::server('REMOTE_ADDR');
     Request::setTrustedProxies(array($proxy));
 }
 Blade::setEscapedContentTags('{{{', '}}}');
 Blade::setContentTags('{{', '}}');
 //need the / at the end to avoid CORS errors on Homestead systems.
 $response = response()->view('swaggervel::index', array('secure' => Request::secure(), 'urlToDocs' => url(Config::get('swaggervel.doc-route')), 'requestHeaders' => Config::get('swaggervel.requestHeaders'), 'clientId' => Request::input('client_id'), 'clientSecret' => Request::input('client_secret'), 'realm' => Request::input('realm'), 'appName' => Request::input('appName')));
 //need the / at the end to avoid CORS errors on Homestead systems.
 /*$response = Response::make(
       View::make('swaggervel::index', array(
               'secure'         => Request::secure(),
               'urlToDocs'      => url(Config::get('swaggervel.doc-route')),
               'requestHeaders' => Config::get('swaggervel.requestHeaders') )
       ),
       200
   );*/
 if (Config::has('swaggervel.viewHeaders')) {
     foreach (Config::get('swaggervel.viewHeaders') as $key => $value) {
         $response->header($key, $value);
     }
 }
 return $response;
开发者ID:FelixMalfait,项目名称:Swaggervel,代码行数:31,代码来源:routes.php

示例14: array

            $resourceOptions = array('output' => 'json', 'defaultSwaggerVersion' => $resourceList['swaggerVersion'], 'defaultBasePath' => $defaultBasePath);
            $output = array();
            foreach ($swagger->getResourceNames() as $resourceName) {
                $json = $swagger->getResource($resourceName, $resourceOptions);
                $resourceName = str_replace(DIRECTORY_SEPARATOR, '-', ltrim($resourceName, DIRECTORY_SEPARATOR));
                $output[$resourceName] = $json;
            }
            $filename = $docDir . '/api-docs.json';
            file_put_contents($filename, Swagger::jsonEncode($resourceList, true));
            foreach ($output as $name => $json) {
                $name = str_replace(DIRECTORY_SEPARATOR, '-', ltrim($name, DIRECTORY_SEPARATOR));
                $filename = $docDir . '/' . $name . '.json';
                file_put_contents($filename, $json);
            }
        }
    }
    if (Config::get('swaggervel::app.behind-reverse-proxy')) {
        $proxy = Request::server('REMOTE_ADDR');
        Request::setTrustedProxies(array($proxy));
    }
    Blade::setEscapedContentTags('{{{', '}}}');
    Blade::setContentTags('{{', '}}');
    //need the / at the end to avoid CORS errors on Homestead systems.
    $response = Response::make(View::make('swaggervel::index', array('secure' => Request::secure(), 'urlToDocs' => url(Config::get('swaggervel::app.doc-route')), 'requestHeaders' => Config::get('swaggervel::app.requestHeaders'))), 200);
    if (Config::has('swaggervel::app.viewHeaders')) {
        foreach (Config::get('swaggervel::app.viewHeaders') as $key => $value) {
            $response->header($key, $value);
        }
    }
    return $response;
});
开发者ID:prady00,项目名称:Laravel-Swagger-REST,代码行数:31,代码来源:routes.php

示例15: zbase_request_is_secure

/**
 * Determine if the request is over HTTPS
 *
 * @return boolean
 */
function zbase_request_is_secure()
{
    return \Request::secure();
}
开发者ID:claremontdesign,项目名称:zbase,代码行数:9,代码来源:requests.php


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