summaryrefslogtreecommitdiffstats
path: root/system/libraries/Form_validation.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-04-09 14:10:27 +0200
committerAndrey Andreev <narf@devilix.net>2014-04-09 14:10:27 +0200
commit9a0e0c76b64d2a401d7ae32d1e53aaca30c7d959 (patch)
tree51a5ed00a7f155640e8b8197fd20d0145eea3643 /system/libraries/Form_validation.php
parentb8bec1bf7407ebaee1c2b8bc1bddebe340e0346d (diff)
Minor changes in FV, Trackback
Diffstat (limited to 'system/libraries/Form_validation.php')
-rw-r--r--system/libraries/Form_validation.php33
1 files changed, 8 insertions, 25 deletions
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index 31d73303e..2f072343d 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -223,8 +223,6 @@ class CI_Form_validation {
$indexes[] = $matches[1][$i];
}
}
-
- $is_array = TRUE;
}
// Build our master array
@@ -1096,19 +1094,16 @@ class CI_Form_validation {
* Check if the input value doesn't already exist
* in the specified database field.
*
- * @param string
- * @param string field
+ * @param string $str
+ * @param string $field
* @return bool
*/
public function is_unique($str, $field)
{
sscanf($field, '%[^.].%[^.]', $table, $field);
- if (isset($this->CI->db))
- {
- $query = $this->CI->db->limit(1)->get_where($table, array($field => $str));
- return $query->num_rows() === 0;
- }
- return FALSE;
+ return isset($this->CI->db)
+ ? ($this->CI->db->limit(1)->get_where($table, array($field => $str))->num_rows() === 0)
+ : FALSE;
}
// --------------------------------------------------------------------
@@ -1126,10 +1121,6 @@ class CI_Form_validation {
{
return FALSE;
}
- else
- {
- $val = (int) $val;
- }
return (MB_ENABLED === TRUE)
? ($val <= mb_strlen($str))
@@ -1151,10 +1142,6 @@ class CI_Form_validation {
{
return FALSE;
}
- else
- {
- $val = (int) $val;
- }
return (MB_ENABLED === TRUE)
? ($val >= mb_strlen($str))
@@ -1176,14 +1163,10 @@ class CI_Form_validation {
{
return FALSE;
}
- else
- {
- $val = (int) $val;
- }
return (MB_ENABLED === TRUE)
- ? (mb_strlen($str) === $val)
- : (strlen($str) === $val);
+ ? (mb_strlen($str) === (int) $val)
+ : (strlen($str) === (int) $val);
}
// --------------------------------------------------------------------
@@ -1219,7 +1202,7 @@ class CI_Form_validation {
// There's a bug affecting PHP 5.2.13, 5.3.2 that considers the
// underscore to be a valid hostname character instead of a dash.
// Reference: https://bugs.php.net/bug.php?id=51192
- if (version_compare(PHP_VERSION, '5.2.13', '==') === 0 OR version_compare(PHP_VERSION, '5.3.2', '==') === 0)
+ if (version_compare(PHP_VERSION, '5.2.13', '==') OR version_compare(PHP_VERSION, '5.3.2', '=='))
{
sscanf($str, 'http://%[^/]', $host);
$str = substr_replace($str, strtr($host, array('_' => '-', '-' => '_')), 7, strlen($host));