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


PHP Input::extension方法代码示例

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


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

示例1: router

 /**
  * Router
  *
  * Requests are not made to methods directly The request will be for an "object".
  * this simply maps the object and method to the correct Controller method.
  *
  * @param  string
  * @param  array
  */
 public function router($resource, array $arguments)
 {
     \Config::load('rest', true);
     // If no (or an invalid) format is given, auto detect the format
     if (is_null($this->format) or !array_key_exists($this->format, $this->_supported_formats)) {
         // auto-detect the format
         $this->format = array_key_exists(\Input::extension(), $this->_supported_formats) ? \Input::extension() : $this->_detect_format();
     }
     //Check method is authorized if required
     if (\Config::get('rest.auth') == 'basic') {
         $valid_login = $this->_prepare_basic_auth();
     } elseif (\Config::get('rest.auth') == 'digest') {
         $valid_login = $this->_prepare_digest_auth();
     }
     //If the request passes auth then execute as normal
     if (\Config::get('rest.auth') == '' or $valid_login) {
         // If they call user, go to $this->post_user();
         $controller_method = strtolower(\Input::method()) . '_' . $resource;
         // Fall back to action_ if no rest method is provided
         if (!method_exists($this, $controller_method)) {
             $controller_method = 'action_' . $resource;
         }
         // If method is not available, set status code to 404
         if (method_exists($this, $controller_method)) {
             return call_user_func_array(array($this, $controller_method), $arguments);
         } else {
             $this->response->status = $this->no_method_status;
             return;
         }
     } else {
         $this->response(array('status' => 0, 'error' => 'Not Authorized'), 401);
     }
 }
开发者ID:wushian,项目名称:MDD,代码行数:42,代码来源:rest.php

示例2: action_index

 public function action_index()
 {
     $ext = Input::extension();
     Log::info('500:' . Input::uri() . '.' . $ext);
     $this->response_status = 500;
     $this->template->content = View_Smarty::forge('500');
 }
开发者ID:marietta-adachi,项目名称:website,代码行数:7,代码来源:500.php

示例3: action_file

 public function action_file($size = null, $file_cate = null, $split_num = null, $file_name = null)
 {
     $file_name = sprintf('%s.%s', $file_name, Input::extension());
     $config = array('type' => 'file', 'file_cate' => $file_cate, 'split_num' => $split_num, 'size' => $size, 'file_name' => $file_name);
     $file = new Site_FileMaker($config);
     if (!($data = $file->get_data())) {
         throw new HttpNotFoundException();
     }
     $ext = $file->get_extension();
     $accept_exts = conf('upload.types.file.accept_format');
     return Response::forge($data, 200, array('Content-Type' => $accept_exts[$ext]));
 }
开发者ID:uzura8,项目名称:flockbird,代码行数:12,代码来源:media.php

示例4: action_index

 public function action_index()
 {
     $ext = Input::extension();
     Log::info('404:' . Input::uri() . '.' . $ext);
     // コンテンツの場合は404を返す
     $ext = Input::extension();
     if (in_array($ext, array('png', 'jpg', 'jpeg', 'gif', 'js', 'css', 'aspx', 'xml', 'json'))) {
         header('HTTP/1.1 404 Not Found');
         exit;
     }
     $this->response_status = 404;
     $this->template->content = View_Smarty::forge('404');
 }
开发者ID:marietta-adachi,项目名称:website,代码行数:13,代码来源:404.php

示例5: router

 /**
  * Routes controller requests.
  * 
  * Differences from parent: fixes a bug for custom auth method and adds custom no auth error.
  *
  * @param string $resource  Controller action name.
  * @param array  $arguments Arguments.
  * 
  * @return mixed
  */
 public function router($resource, $arguments)
 {
     \Config::load('rest', true);
     // If no (or an invalid) format is given, auto detect the format
     if (is_null($this->format) or !array_key_exists($this->format, $this->_supported_formats)) {
         // auto-detect the format
         $this->format = array_key_exists(\Input::extension(), $this->_supported_formats) ? \Input::extension() : $this->_detect_format();
     }
     // Get the configured auth method if none is defined
     $this->auth === null and $this->auth = \Config::get('rest.auth');
     //Check method is authorized if required, and if we're authorized
     if ($this->auth == 'basic') {
         $valid_login = $this->_prepare_basic_auth();
     } elseif ($this->auth == 'digest') {
         $valid_login = $this->_prepare_digest_auth();
     } elseif (method_exists($this, $this->auth)) {
         $valid_login = $this->{$this->auth}();
         if ($valid_login instanceof \Response) {
             return $valid_login;
         }
     } else {
         $valid_login = false;
     }
     // If the request passes auth then execute as normal
     if (empty($this->auth) or $valid_login) {
         // If they call user, go to $this->post_user();
         $controller_method = strtolower(\Input::method()) . '_' . $resource;
         // Fall back to action_ if no rest method is provided
         if (!method_exists($this, $controller_method)) {
             $controller_method = 'action_' . $resource;
         }
         // If method is not available, set status code to 404
         if (method_exists($this, $controller_method)) {
             return call_user_func_array(array($this, $controller_method), $arguments);
         } else {
             $this->response->status = $this->no_method_status;
             return;
         }
     } else {
         $this->response(array('message' => 'Missing or Invalid Authorization'), 401);
     }
 }
开发者ID:mehulsbhatt,项目名称:volcano,代码行数:52,代码来源:controller.php

示例6: matched

 /**
  * Parses a route match and returns the controller, action and params.
  *
  * @access	public
  * @param	string	The matched route
  * @return	object  $this
  */
 public function matched($uri = '', $named_params = array())
 {
     // Clean out all the non-named stuff out of $named_params
     foreach ($named_params as $key => $val) {
         if (is_numeric($key)) {
             unset($named_params[$key]);
         }
     }
     $this->named_params = $named_params;
     if ($this->translation instanceof \Closure) {
         $this->callable = $this->translation;
     } else {
         $path = $this->translation;
         if ($uri != '') {
             if ($this->strip_extension) {
                 strpos($uri, $ext = \Input::extension()) === false or $uri = substr($uri, 0, -(strlen($ext) + 1));
             }
             if ($this->case_sensitive) {
                 $path = preg_replace('#^' . $this->search . '$#uD', $this->translation, $uri);
             } else {
                 $path = preg_replace('#^' . $this->search . '$#uiD', $this->translation, $uri);
             }
         }
         $this->segments = explode('/', trim($path, '/'));
     }
     return $this;
 }
开发者ID:wushian,项目名称:MDD,代码行数:34,代码来源:route.php

示例7: matched

 /**
  * Parses a route match and returns the controller, action and params.
  *
  * @access	public
  * @param	string	The matched route
  * @return	object  $this
  */
 public function matched($uri = '', $named_params = array())
 {
     // Clean out all the non-named stuff out of $named_params
     foreach ($named_params as $key => $val) {
         if (is_numeric($key)) {
             unset($named_params[$key]);
         }
     }
     $this->named_params = $named_params;
     if ($this->translation instanceof \Closure) {
         $this->callable = $this->translation;
     } else {
         $path = $this->translation;
         if ($uri != '') {
             // strip the extension if needed and there is something to strip
             if ($this->strip_extension and strrchr($uri, '.') == ($ext = '.' . \Input::extension())) {
                 $uri = substr($uri, 0, -strlen($ext));
             }
             if ($this->case_sensitive) {
                 $path = preg_replace('#^' . $this->search . '$#uD', $this->translation, $uri);
             } else {
                 $path = preg_replace('#^' . $this->search . '$#uiD', $this->translation, $uri);
             }
         }
         $this->segments = explode('/', trim($path, '/'));
     }
     return $this;
 }
开发者ID:marietta-adachi,项目名称:website,代码行数:35,代码来源:route.php

示例8: getImagePath

 /**
  * Get the current base path, stopping at the given segment number
  */
 protected function getImagePath($startSegment)
 {
     $segments = \Uri::segments();
     $startSegment = min($startSegment, count($segments));
     return implode('/', array_slice($segments, $startSegment)) . '.' . \Input::extension();
 }
开发者ID:soundintheory,项目名称:fuel-cmf,代码行数:9,代码来源:image.php


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