Minor changes in FV, Trackback
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index 31d7330..2f07234 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -223,8 +223,6 @@
$indexes[] = $matches[1][$i];
}
}
-
- $is_array = TRUE;
}
// Build our master array
@@ -1096,19 +1094,16 @@
* 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 @@
{
return FALSE;
}
- else
- {
- $val = (int) $val;
- }
return (MB_ENABLED === TRUE)
? ($val <= mb_strlen($str))
@@ -1151,10 +1142,6 @@
{
return FALSE;
}
- else
- {
- $val = (int) $val;
- }
return (MB_ENABLED === TRUE)
? ($val >= mb_strlen($str))
@@ -1176,14 +1163,10 @@
{
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 @@
// 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));