本文整理汇总了PHP中Sanitize::stripEscape方法的典型用法代码示例。如果您正苦于以下问题:PHP Sanitize::stripEscape方法的具体用法?PHP Sanitize::stripEscape怎么用?PHP Sanitize::stripEscape使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sanitize
的用法示例。
在下文中一共展示了Sanitize::stripEscape方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseParamsAjax
function parseParamsAjax($params = array())
{
if (is_array($params) && !empty($params)) {
if (ini_get('magic_quotes_gpc') == 1) {
if (function_exists('s2_stripslashes_deep')) {
$params['form'] = s2_stripslashes_deep($params);
} else {
$params['form'] = stripslashes_deep($params);
}
} else {
$form = $params;
$params = array_merge($params, array('form' => $form));
}
// array check to prevent weird error with form being a mosParameters object in J1.0.x
if (is_array($params['form']) && isset($params['form']['data'])) {
$params['data'] = Sanitize::stripEscape($params['form']['data']);
unset($params['form']['data']);
}
} elseif (is_string($params)) {
if (ini_get('magic_quotes_gpc') == 1) {
return stripslashes($params);
}
}
return $params;
}
示例2: stripEscape
function stripEscape($param)
{
if (!is_array($param) || empty($param)) {
if (is_bool($param)) {
return $param;
}
$return = preg_replace('/^[\\t ]*(?:-!)+/', '', $param);
return $return;
}
foreach ($param as $key => $value) {
if (!is_array($value)) {
$return[$key] = preg_replace('/^[\\t ]*(?:-!)+/', '', $value);
} elseif ($value) {
foreach ($value as $array => $string) {
$return[$key][$array] = Sanitize::stripEscape($string);
}
}
}
if (isset($return)) {
return $return;
} else {
return $param;
}
}
示例3: parseParams
/**
* Returns array of GET and POST parameters. GET parameters are taken from given URL.
*
* @param string $fromUrl URL to mine for parameter information.
* @return array Parameters found in POST and GET.
* @access public
*/
function parseParams($fromUrl = '')
{
$params = array();
$params['data'] = array();
isset($_COOKIE) and ini_get('magic_quotes_gpc') == 1 and $_COOKIE = s2_stripslashes_deep($_COOKIE);
if (isset($_POST)) {
if (ini_get('magic_quotes_gpc') == 1) {
if (function_exists('s2_stripslashes_deep')) {
$params['form'] = s2_stripslashes_deep($_POST);
} else {
$params['form'] = stripslashes_deep($_POST);
}
} else {
$params['form'] = $_POST;
}
if (isset($params['form']['_method'])) {
if (isset($_SERVER) && !empty($_SERVER)) {
$_SERVER['REQUEST_METHOD'] = $params['form']['_method'];
} else {
$_ENV['REQUEST_METHOD'] = $params['form']['_method'];
}
unset($params['form']['_method']);
}
}
if (isset($params['form']['data'])) {
$params['data'] = Sanitize::stripEscape($params['form']['data']);
unset($params['form']['data']);
}
if (isset($_GET)) {
if (ini_get('magic_quotes_gpc') == 1) {
$url = s2_stripslashes_deep($_GET);
} else {
$url = $_GET;
}
if (isset($params['url'])) {
$params['url'] = array_merge($params['url'], $url);
} else {
$params['url'] = $url;
}
}
foreach ($_FILES as $name => $data) {
if ($name != 'data') {
$params['form'][$name] = $data;
}
}
if (isset($_FILES['data'])) {
foreach ($_FILES['data'] as $key => $data) {
foreach ($data as $model => $fields) {
foreach ($fields as $field => $value) {
$params['data'][$model][$field][$key] = $value;
}
}
}
}
if (isset($params['data']['controller'])) {
$params['controller'] = Sanitize::getString($params['data'], 'controller');
$params['action'] = Sanitize::getString($params['data'], 'action');
}
$Router =& S2Router::getInstance();
$Router->app = $this->app;
$params = S2Router::parse($params);
foreach ($params['url'] as $key => $value) {
if ($key != 'url') {
$params[$key] = $value;
}
}
return $params;
}