mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 23:02:48 +08:00
取消base文件中的filter_exp函数并入Input类
This commit is contained in:
@@ -11,6 +11,8 @@
|
|||||||
// $Id$
|
// $Id$
|
||||||
namespace Think;
|
namespace Think;
|
||||||
class Input {
|
class Input {
|
||||||
|
// 全局过滤规则
|
||||||
|
static $filter = NULL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取系统变量 支持过滤和默认值
|
* 获取系统变量 支持过滤和默认值
|
||||||
@@ -43,6 +45,15 @@ class Input {
|
|||||||
case 'globals': $input =& $GLOBALS;break;
|
case 'globals': $input =& $GLOBALS;break;
|
||||||
default:return NULL;
|
default:return NULL;
|
||||||
}
|
}
|
||||||
|
// 变量全局过滤
|
||||||
|
array_walk_recursive($input,'self::filter_exp');
|
||||||
|
if(self::$filter) {
|
||||||
|
$_filters = explode(',',self::$filter);
|
||||||
|
foreach($_filters as $_filter){
|
||||||
|
// 全局参数过滤
|
||||||
|
array_walk_recursive($input,$_filter);
|
||||||
|
}
|
||||||
|
}
|
||||||
if(''== $args[0]) {
|
if(''== $args[0]) {
|
||||||
// 返回全部数据
|
// 返回全部数据
|
||||||
return $input;
|
return $input;
|
||||||
@@ -67,4 +78,10 @@ class Input {
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 过滤表单中的表达式
|
||||||
|
static private filter_exp(&$value){
|
||||||
|
if (in_array(strtolower($value),array('exp','or'))){
|
||||||
|
$value .= ' ';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
7
base.php
7
base.php
@@ -284,10 +284,3 @@ function S($name,$value='',$options=null) {
|
|||||||
return Think\Cache::set($name, $value, $expire);
|
return Think\Cache::set($name, $value, $expire);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 过滤表单中的表达式
|
|
||||||
function filter_exp(&$value){
|
|
||||||
if (in_array(strtolower($value),array('exp','or'))){
|
|
||||||
$value .= ' ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user