summaryrefslogtreecommitdiffstats
path: root/system/libraries/Input.php
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2008-05-13 06:22:33 +0200
committerDerek Jones <derek.jones@ellislab.com>2008-05-13 06:22:33 +0200
commit0b59f270a432f8c7b6128981f0a39b4a2e2fbd34 (patch)
tree1e7655eabd76bb981692f5d4f21cb1fc7be3e9cd /system/libraries/Input.php
parent5cf664748ee295867f593d7eb7991bd35fe8eca6 (diff)
Some sweeping syntax changes for consistency:
(! foo) changed to ( ! foo) || changed to OR changed newline standardization code in various places from preg_replace to str_replace
Diffstat (limited to 'system/libraries/Input.php')
-rw-r--r--system/libraries/Input.php36
1 files changed, 21 insertions, 15 deletions
diff --git a/system/libraries/Input.php b/system/libraries/Input.php
index f98757947..978d1ff34 100644
--- a/system/libraries/Input.php
+++ b/system/libraries/Input.php
@@ -1,4 +1,4 @@
-<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
@@ -77,9 +77,9 @@ class CI_Input {
// This is effectively the same as register_globals = off
foreach (array($_GET, $_POST, $_COOKIE, $_SERVER, $_FILES, $_ENV, (isset($_SESSION) && is_array($_SESSION)) ? $_SESSION : array()) as $global)
{
- if (! is_array($global))
+ if ( ! is_array($global))
{
- if (! in_array($global, $protected))
+ if ( ! in_array($global, $protected))
{
unset($GLOBALS[$global]);
}
@@ -88,7 +88,7 @@ class CI_Input {
{
foreach ($global as $key => $val)
{
- if (! in_array($key, $protected))
+ if ( ! in_array($key, $protected))
{
unset($GLOBALS[$key]);
}
@@ -97,7 +97,7 @@ class CI_Input {
{
foreach($val as $k => $v)
{
- if (! in_array($k, $protected))
+ if ( ! in_array($k, $protected))
{
unset($GLOBALS[$k]);
}
@@ -181,7 +181,12 @@ class CI_Input {
}
// Standardize newlines
- return preg_replace("/\015\012|\015|\012/", "\n", $str);
+ if (strpos($str, "\r") !== FALSE)
+ {
+ $str = str_replace(array("\r\n", "\r"), "\n", $str);
+ }
+
+ return $str;
}
// --------------------------------------------------------------------
@@ -199,7 +204,7 @@ class CI_Input {
*/
function _clean_input_keys($str)
{
- if (! preg_match("/^[a-z0-9:_\/-]+$/i", $str))
+ if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str))
{
exit('Disallowed Key Characters.');
}
@@ -219,7 +224,7 @@ class CI_Input {
*/
function get($index = '', $xss_clean = FALSE)
{
- if (! isset($_GET[$index]))
+ if ( ! isset($_GET[$index]))
{
return FALSE;
}
@@ -254,7 +259,7 @@ class CI_Input {
*/
function post($index = '', $xss_clean = FALSE)
{
- if (! isset($_POST[$index]))
+ if ( ! isset($_POST[$index]))
{
return FALSE;
}
@@ -289,7 +294,7 @@ class CI_Input {
*/
function cookie($index = '', $xss_clean = FALSE)
{
- if (! isset($_COOKIE[$index]))
+ if ( ! isset($_COOKIE[$index]))
{
return FALSE;
}
@@ -329,7 +334,7 @@ class CI_Input {
*/
function server($index = '', $xss_clean = FALSE)
{
- if (! isset($_SERVER[$index]))
+ if ( ! isset($_SERVER[$index]))
{
return FALSE;
}
@@ -386,7 +391,7 @@ class CI_Input {
$this->ip_address = end($x);
}
- if (! $this->valid_ip($this->ip_address))
+ if ( ! $this->valid_ip($this->ip_address))
{
$this->ip_address = '0.0.0.0';
}
@@ -448,7 +453,7 @@ class CI_Input {
return $this->user_agent;
}
- $this->user_agent = (! isset($_SERVER['HTTP_USER_AGENT'])) ? FALSE : $_SERVER['HTTP_USER_AGENT'];
+ $this->user_agent = ( ! isset($_SERVER['HTTP_USER_AGENT'])) ? FALSE : $_SERVER['HTTP_USER_AGENT'];
return $this->user_agent;
}
@@ -650,8 +655,9 @@ class CI_Input {
*
*/
- if (strpos($str, "\t") !== FALSE) {
- $str = str_replace("\t", " ", $str);
+ if (strpos($str, "\t") !== FALSE)
+ {
+ $str = str_replace("\t", ' ', $str);
}
/*