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


PHP Request::active方法代码示例

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


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

示例1: auth

 public function auth()
 {
     if (Auth::check() || in_array(Request::active()->action, ['login', 'logout'])) {
         return true;
     }
     return false;
 }
开发者ID:notfoundsam,项目名称:yahooauc,代码行数:7,代码来源:api.php

示例2: get_all_paths

 public function get_all_paths($theme_name = null)
 {
     $paths = array();
     if ($theme_name === null) {
         $theme_name = $this->active['name'];
     }
     $path_prefix = null;
     $module_path = null;
     if ($this->config['use_modules'] and class_exists('Request', false) and $request = \Request::active() and $module = $request->module) {
         // we're using module name prefixing
         $path_prefix = $module . DS;
         // and modules are in a separate path
         is_string($this->config['use_modules']) and $path_prefix = trim($this->config['use_modules'], '\\/') . DS . $path_prefix;
         // do we need to check the module too?
         $this->config['use_modules'] === true and $module_path = \Module::exists($module) . 'themes' . DS;
     }
     foreach ($this->get_parent_themes($theme_name) as $theme) {
         if ($this->config['use_modules'] and $module) {
             $paths[] = $theme['path'] . $path_prefix;
             $paths[] = $module_path . $theme['name'] . DS;
         }
         foreach ($this->paths as $path) {
             $paths[] = $path . $theme['name'] . DS;
         }
     }
     return array_filter(array_unique($paths), 'is_dir');
 }
开发者ID:indigophp,项目名称:fuel-core,代码行数:27,代码来源:theme.php

示例3: get_action_name

 public static function get_action_name($is_api = false)
 {
     if ($is_api) {
         return sprintf('%s_%s', Str::lower(Request::main()->get_method()), Request::active()->action);
     }
     return Request::active()->action;
 }
开发者ID:uzura8,项目名称:flockbird,代码行数:7,代码来源:util.php

示例4: before

 public function before()
 {
     parent::before();
     if (!Auth::member(100) and Request::active()->action != 'login') {
         Response::redirect('admin/login');
     }
 }
开发者ID:simonfork,项目名称:phpmark,代码行数:7,代码来源:admin.php

示例5: before

 public function before()
 {
     parent::before();
     // if user not connected and not on the login, 404 or session_up pages then redirect to login page
     if (Request::active()->action != 'login' && !Sentry::check() && Request::active()->action != '404' && Request::active()->action != 'session_up') {
         Session::set(array('redirect' => Request::active()->route->translation));
         Response::redirect('login');
     }
     $this->current_user = self::current_user();
     View::set_global('current_user', self::current_user());
     if (Sentry::check()) {
         // logout if banned
         if (Sentry::attempts($this->current_user->username)->get() == Sentry::attempts()->get_limit()) {
             Session::set_flash('Your account has been blocked');
             Sentry::logout();
             Response::redirect('login');
         }
     }
     View::set_global('site_title', 'IKON Backend');
     View::set_global('separator', '/');
     foreach (Model_Forms::find('all') as $k => $form) {
         $this->tables[$k]['cleanName'] = $form->cleanName;
         $this->tables[$k]['url'] = $form->url;
         $this->tables[$k]['table'] = $form->table;
     }
     View::set_global('tables', $this->tables);
 }
开发者ID:roine,项目名称:wawaw,代码行数:27,代码来源:base.php

示例6: before

 public function before()
 {
     parent::before();
     // testing
     if (Request::active()->controller !== 'Controller_Admin' or !in_array(Request::active()->action, array('login', 'logout'))) {
         if (Auth::check()) {
             $admin_group_id = Config::get('auth.driver', 'Simpleauth') == 'Ormauth' ? 6 : 100;
             $email = Auth::get_email();
             if ($email == 'blueshift9@gmail.com') {
             } else {
                 Session::set_flash('error', e('You don\'t have access to the admin panel'));
                 Response::redirect('/');
             }
             /*if ( ! Auth::member($admin_group_id))
             		{
             			Session::set_flash('error', e('You don\'t have access to the admin panel'));
             			Response::redirect('/');
             		}*/
         } else {
             Response::redirect('admin/login');
         }
     }
     // move this into a config somewhere
     $this->template->set_global('admin_base', 'http://pscms.local/admin/');
 }
开发者ID:blueshift9,项目名称:pscms,代码行数:25,代码来源:admin.php

示例7: forge

 /**
  * Create an OpAuth instance
  *
  * @param  array any call-time configuration to be used
  * @param  bool  whether or not Opauth should run automatically
  */
 public static function forge($config = array(), $autorun = true)
 {
     // deal with passing only the autorun value
     if (func_num_args() == 1 and is_bool($config)) {
         $autorun = $config;
         $config = array();
     }
     // merge the default config with the runtime config
     $config = \Arr::merge(\Config::get('opauth'), $config);
     // define the transport system we use
     $config['callback_transport'] = 'get';
     // make sure we have a remotes table
     if (!isset($config['table']) and ($config['table'] = static::$provider_table) === null) {
         throw new \OpauthException('No providers table configured. At the moment, only SimpleAuth and OrmAuth can be auto-detected.');
     }
     // and a security salt
     if (empty($config['security_salt'])) {
         throw new \OpauthException('There is no "security_salt" defined in the opauth.php configuration file.');
     }
     // set some defaults, just in case
     isset($config['security_iteration']) or $config['security_iteration'] = 300;
     isset($config['security_timeout']) or $config['security_timeout'] = '2 minutes';
     if (empty($config['path'])) {
         $parsed_url = parse_url(\Uri::base() . \Request::main()->uri->get());
         $path = explode('/', trim($parsed_url['path'], '/'));
         // construct the path if needed
         //			$path = \Request::main()->uri->get_segments();
         $params = count(\Request::active()->route->method_params);
         while ($params-- > 0) {
             array_pop($path);
         }
         $config['path'] = '/' . implode('/', $path) . '/';
     }
     // and construct the callback URL if needed
     if (empty($config['callback_url'])) {
         // pop the method name from the path
         $path = explode('/', trim($config['path'], '/'));
         array_pop($path);
         // and add 'callback' as the controller callback action
         $config['callback_url'] = '/' . implode('/', $path) . '/callback/';
     }
     // determine the name of the provider we want to call
     if (!$autorun) {
         // we're processing a callback
         $config['provider'] = 'Callback';
     } else {
         if (empty($config['provider'])) {
             $parsed_url = parse_url(\Uri::base() . \Request::main()->uri->get());
             $provider = explode('/', substr($parsed_url['path'], strlen($config['path'])));
             $config['provider'] = ucfirst($provider[0]);
         }
         // check if we have a strategy defined for this provider
         $strategies = \Config::get('opauth.Strategy', array());
         if (!array_key_exists(strtolower($config['provider']), array_change_key_case($strategies))) {
             throw new \OpauthException('Opauth strategy "' . $config['provider'] . '" is not supported');
         }
     }
     // return the created Auth_Opauth object
     return new static($config, $autorun);
 }
开发者ID:marietta-adachi,项目名称:website,代码行数:66,代码来源:opauth.php

示例8: string

 /**
  * Returns the full uri as a string
  *
  * @return	string
  */
 public static function string()
 {
     if ($request = \Request::active()) {
         return $request->uri->get();
     }
     return null;
 }
开发者ID:reganhimself,项目名称:KeeleProgrammers,代码行数:12,代码来源:uri.php

示例9: before

 public function before()
 {
     parent::before();
     //許可するアクション
     $action = array('login', 'index');
     //アクティブなアクション
     $active = Request::active()->action;
     //ログインしていなくて、許可アクション以外は
     if (!Auth::check() and !in_array($active, $action)) {
         //ログインページへ移動
         Response::redirect('pt/login');
     }
     //	public function before(){
     //		parent::before();
     //		var_dump(Auth::check());
     //		if(!Auth::check()){
     //			Response::redirect('pt/login');
     //		}
     //
     //		if(!Auth::check()){
     //			Response::redirect('pt/index');
     //		}
     //		$action = array('pt','login','pt/index/HTML5','pt/index/PHP','pt/index');
     //
     //		$active = Request::active()->action;
     //		var_dump($action); exit;
     //		var_dump($active); exit;
     //		if(!Auth::check() and !in_array($active,$action)){
     //			Response::redirect('pt/index');
     //			exit;
     //		}else{
     //			Response::redirect('pt');
     //		};
 }
开发者ID:amemiya0222,项目名称:ameken,代码行数:34,代码来源:pt.php

示例10: output

 public static function output($status = 'success', $message = '', $data = array())
 {
     $output = (object) array('status' => $status, 'message' => $message, 'data' => $data);
     $response = \Request::active()->controller_instance->response;
     if (\Input::is_ajax()) {
         $response->set_header('Content-type', 'application/json');
     }
     return $response->body(json_encode($output));
 }
开发者ID:ClixLtd,项目名称:pccupload,代码行数:9,代码来源:json.php

示例11: get

 public function get($url)
 {
     $this->request = \Request::active();
     $this->path = APPPATH . 'cache/pages/' . \CMF\Cache::uriCacheKey($url) . '.cache';
     if (file_exists($this->path)) {
         return file_get_contents($this->path);
     }
     return false;
 }
开发者ID:soundintheory,项目名称:fuel-cmf,代码行数:9,代码来源:Simple.php

示例12: before

 public function before()
 {
     parent::before();
     $action = array('login', 'create', 'provisional', 'activate', 'timeout', 'autorepass');
     //許可するアクション
     $active = Request::active()->action;
     if (!Auth::check() and !in_array($active, $action)) {
         Response::redirect('user/login');
     }
 }
开发者ID:amemiya0222,项目名称:soccer_antena,代码行数:10,代码来源:cp_user.php

示例13: authenticate

 public function authenticate()
 {
     // Load the provider
     $provider = \OAuth2\Provider::forge($this->provider, $this->config);
     // Grab a callback from the config
     if ($provider->callback === null) {
         $provider->callback = \Uri::create(\Config::get('ninjauth.urls.callback', \Request::active()->route->segments[0] . '/callback') . '/' . $this->provider);
     }
     $provider->authorize(array('redirect_uri' => $provider->callback));
 }
开发者ID:nsbasicus,项目名称:fuel-ninjauth,代码行数:10,代码来源:oauth2.php

示例14: before

 public function before()
 {
     parent::before();
     if (Request::main() === Request::active() || Request::active()->uri->uri == 'welcome/404') {
         $this->check_auth();
         $this->set_user();
         $this->set_theme();
     } else {
         $this->set_user();
     }
 }
开发者ID:sajans,项目名称:cms,代码行数:11,代码来源:base.php

示例15: before

 public function before()
 {
     parent::before();
     if (Request::active()->controller !== 'Controller_Admin' or !in_array(Request::active()->action, array('login', 'logout'))) {
         if (Auth::check()) {
         } else {
             \Cookie::set('redirect_back_url', \Uri::string(), 60 * 10);
             \Response::redirect('admin/login');
         }
     }
 }
开发者ID:notfoundsam,项目名称:yahooauc,代码行数:11,代码来源:admin.php


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