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


PHP Kohana::sanitize方法代码示例

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


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

示例1: sanitize

 public static function sanitize($value)
 {
     if (is_array($value) or is_object($value)) {
         foreach ($value as $key => $val) {
             $value[$key] = Kohana::sanitize($val);
         }
     } elseif (is_string($value)) {
         if (Kohana::$magic_quotes === TRUE) {
             $value = stripslashes($value);
         }
         if (strpos($value, "\r") !== FALSE) {
             $value = str_replace(array("\r\n", "\r"), "\n", $value);
         }
     }
     return $value;
 }
开发者ID:noikiy,项目名称:kohana,代码行数:16,代码来源:Kohana.php

示例2: before

 /**
  * Pre determine error display logic
  */
 public function before($template = NULL)
 {
     parent::before();
     // Sub requests only!
     if (!$this->request->is_initial()) {
         if ($message = rawurldecode($this->request->param('message'))) {
             $this->_message = $message;
         }
         if ($requested_page = rawurldecode($this->request->param('origuri'))) {
             $this->_requested_page = $requested_page;
         }
     } else {
         // This one was directly requested, don't allow
         $this->request->action(404);
         // Set the requested page accordingly
         $this->_requested_page = Arr::get($_SERVER, 'REQUEST_URI');
     }
     //sanitize the url....
     $this->_requested_page = Kohana::sanitize($this->_requested_page);
     $this->response->status((int) $this->request->action());
 }
开发者ID:JeffPedro,项目名称:project-garage-sale,代码行数:24,代码来源:error.php

示例3: sanitize

 /**
  * Override
  * Recursively sanitizes an input variable:
  *
  * - Strips slashes if magic quotes are enabled
  * - Normalizes all newlines to LF
  *
  * @param   mixed   $value  any variable
  * @return  mixed   sanitized variable
  */
 public static function sanitize($value)
 {
     if (is_array($value) or is_object($value)) {
         foreach ($value as $key => $val) {
             // Recursively clean each value
             $value[$key] = Kohana::sanitize($val);
         }
     } elseif (is_string($value)) {
         if (Kohana::$magic_quotes === TRUE) {
             // Remove slashes added by magic quotes
             $value = stripslashes($value);
         }
         if (strpos($value, "\r") !== FALSE) {
             // Standardize newlines
             $value = str_replace(array("\r\n", "\r"), "\n", $value);
         }
         //Added strip tags
         $value = strip_tags($value);
     }
     return $value;
 }
开发者ID:JeffPedro,项目名称:project-garage-sale,代码行数:31,代码来源:kohana.php

示例4: test_sanitize

 /**
  * Tests Kohana::santize()
  *
  * @test
  * @dataProvider provider_sanitize
  * @covers Kohana::sanitize
  * @param boolean $value  Input for Kohana::sanitize
  * @param boolean $result Output for Kohana::sanitize
  */
 public function test_sanitize($value, $result)
 {
     $this->setEnvironment(array('Kohana::$magic_quotes' => TRUE));
     $this->assertSame($result, Kohana::sanitize($value));
 }
开发者ID:Chinese1904,项目名称:openclassifieds2,代码行数:14,代码来源:CoreTest.php

示例5: action_index

 public function action_index()
 {
     if (!$this->model_name or $this->model_name === 'App') {
         $services = array();
         $models = $this->models;
         $models[] = 'User';
         foreach ($models as $model) {
             $url = Kohana::$base_url . 'api/' . strtolower($model) . '/';
             $services[$model] = $url;
         }
         return $this->json($services);
     }
     $method = $this->request->post('_method');
     $method = $method ? $method : $this->request->method();
     if ($method === Request::POST or $method === Request::PUT) {
         $body_vars = (array) @json_decode($this->request->body());
         $body_vars = Kohana::sanitize($body_vars);
         $values = Arr::merge($this->request->post(), $body_vars);
         parse_str(file_get_contents('php://input'), $php_vars);
         $php_vars = Kohana::sanitize($php_vars);
         $values = Arr::merge($values, $php_vars);
         if ($this->request->param('id')) {
             $values['id'] = $this->request->param('id');
         }
         $this->save($values);
     } else {
         if ($method === Request::GET) {
             $this->get();
         } else {
             if ($method === Request::DELETE) {
                 $this->delete();
             }
         }
     }
 }
开发者ID:huiancg,项目名称:kohana-huia-api,代码行数:35,代码来源:App.php

示例6: eval_search

 private function eval_search($photos = NULL, $users = NULL, $tags = NULL, $type = 'user')
 {
     if (empty($photos) && !empty($users)) {
         return 'user';
     } else {
         if (empty($photos) && !empty($tags)) {
             return 'tag';
         } else {
             return Kohana::sanitize($type);
         }
     }
 }
开发者ID:natgeo,项目名称:kids-myshot,代码行数:12,代码来源:search.php


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