summaryrefslogtreecommitdiffstats
path: root/system/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'system/helpers')
-rw-r--r--system/helpers/array_helper.php4
-rw-r--r--system/helpers/cookie_helper.php2
-rw-r--r--system/helpers/date_helper.php12
-rw-r--r--system/helpers/download_helper.php2
-rw-r--r--system/helpers/email_helper.php2
-rw-r--r--system/helpers/file_helper.php181
-rw-r--r--system/helpers/form_helper.php26
-rw-r--r--system/helpers/html_helper.php6
-rw-r--r--system/helpers/path_helper.php2
-rw-r--r--system/helpers/security_helper.php4
-rw-r--r--system/helpers/smiley_helper.php8
-rw-r--r--system/helpers/text_helper.php4
-rw-r--r--system/helpers/typography_helper.php24
-rw-r--r--system/helpers/url_helper.php10
14 files changed, 227 insertions, 60 deletions
diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php
index 236e3904e..8ae44826a 100644
--- a/system/helpers/array_helper.php
+++ b/system/helpers/array_helper.php
@@ -43,7 +43,7 @@ if (! function_exists('element'))
{
function element($item, $array, $default = FALSE)
{
- if ( ! isset($array[$item]) OR $array[$item] == "")
+ if (! isset($array[$item]) OR $array[$item] == "")
{
return $default;
}
@@ -65,7 +65,7 @@ if (! function_exists('random_element'))
{
function random_element($array)
{
- if ( ! is_array($array))
+ if (! is_array($array))
{
return $array;
}
diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php
index 102057f8c..75c769e9c 100644
--- a/system/helpers/cookie_helper.php
+++ b/system/helpers/cookie_helper.php
@@ -73,7 +73,7 @@ if (! function_exists('set_cookie'))
$path = $CI->config->item('cookie_path');
}
- if ( ! is_numeric($expire))
+ if (! is_numeric($expire))
{
$expire = time() - 86500;
}
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php
index 24e0b1794..004cfb122 100644
--- a/system/helpers/date_helper.php
+++ b/system/helpers/date_helper.php
@@ -123,7 +123,7 @@ if (! function_exists('standard_date'))
'DATE_W3C' => '%Y-%m-%dT%H:%i:%s%Q'
);
- if ( ! isset($formats[$fmt]))
+ if (! isset($formats[$fmt]))
{
return FALSE;
}
@@ -152,12 +152,12 @@ if (! function_exists('timespan'))
$CI =& get_instance();
$CI->lang->load('date');
- if ( ! is_numeric($seconds))
+ if (! is_numeric($seconds))
{
$seconds = 1;
}
- if ( ! is_numeric($time))
+ if (! is_numeric($time))
{
$time = time();
}
@@ -271,7 +271,7 @@ if (! function_exists('days_in_month'))
return 0;
}
- if ( ! is_numeric($year) OR strlen($year) != 4)
+ if (! is_numeric($year) OR strlen($year) != 4)
{
$year = date('Y');
}
@@ -442,7 +442,7 @@ if (! function_exists('human_to_unix'))
$datestr = trim($datestr);
$datestr = preg_replace("/\040+/", "\040", $datestr);
- if ( ! ereg("^[0-9]{2,4}\-[0-9]{1,2}\-[0-9]{1,2}\040[0-9]{1,2}:[0-9]{1,2}.*$", $datestr))
+ if (! ereg("^[0-9]{2,4}\-[0-9]{1,2}\-[0-9]{1,2}\040[0-9]{1,2}:[0-9]{1,2}.*$", $datestr))
{
return FALSE;
}
@@ -592,7 +592,7 @@ if (! function_exists('timezones'))
if ($tz == 'GMT')
$tz = 'UTC';
- return ( ! isset($zones[$tz])) ? 0 : $zones[$tz];
+ return (! isset($zones[$tz])) ? 0 : $zones[$tz];
}
}
diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php
index 5e47fc5c9..284c6c96e 100644
--- a/system/helpers/download_helper.php
+++ b/system/helpers/download_helper.php
@@ -61,7 +61,7 @@ if (! function_exists('force_download'))
@include(APPPATH.'config/mimes'.EXT);
// Set a default mime if we can't find it
- if ( ! isset($mimes[$extension]))
+ if (! isset($mimes[$extension]))
{
$mime = 'application/octet-stream';
}
diff --git a/system/helpers/email_helper.php b/system/helpers/email_helper.php
index e677afd28..307f3b588 100644
--- a/system/helpers/email_helper.php
+++ b/system/helpers/email_helper.php
@@ -37,7 +37,7 @@ if (! function_exists('valid_email'))
{
function valid_email($address)
{
- return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $address)) ? FALSE : TRUE;
+ return (! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $address)) ? FALSE : TRUE;
}
}
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php
index 04c5747bf..1eb8348e9 100644
--- a/system/helpers/file_helper.php
+++ b/system/helpers/file_helper.php
@@ -40,7 +40,7 @@ if (! function_exists('read_file'))
{
function read_file($file)
{
- if ( ! file_exists($file))
+ if (! file_exists($file))
{
return FALSE;
}
@@ -50,7 +50,7 @@ if (! function_exists('read_file'))
return file_get_contents($file);
}
- if ( ! $fp = @fopen($file, 'rb'))
+ if (! $fp = @fopen($file, 'rb'))
{
return FALSE;
}
@@ -87,7 +87,7 @@ if (! function_exists('write_file'))
{
function write_file($path, $data, $mode = 'wb')
{
- if ( ! $fp = @fopen($path, $mode))
+ if (! $fp = @fopen($path, $mode))
{
return FALSE;
}
@@ -123,7 +123,7 @@ if (! function_exists('delete_files'))
// Trim the trailing slash
$path = preg_replace("|^(.+?)/*$|", "\\1", $path);
- if ( ! $current_dir = @opendir($path))
+ if (! $current_dir = @opendir($path))
return;
while(FALSE !== ($filename = @readdir($current_dir)))
@@ -167,7 +167,7 @@ if (! function_exists('get_filenames'))
{
function get_filenames($source_dir, $include_path = FALSE, $_recursion = FALSE)
{
- static $_filedata = array();
+ $_filedata = array();
if ($fp = @opendir($source_dir))
{
@@ -180,11 +180,11 @@ if (! function_exists('get_filenames'))
while (FALSE !== ($file = readdir($fp)))
{
- if (@is_dir($source_dir.$file) && substr($file, 0, 1) != '.')
+ if (@is_dir($source_dir.$file) && strncmp($file, '.', 1) !== 0)
{
get_filenames($source_dir.$file.DIRECTORY_SEPARATOR, $include_path, TRUE);
}
- elseif (substr($file, 0, 1) != ".")
+ elseif (strncmp($file, '.', 1) !== 0)
{
$_filedata[] = ($include_path == TRUE) ? $source_dir.$file : $file;
@@ -201,4 +201,171 @@ if (! function_exists('get_filenames'))
// --------------------------------------------------------------------
+/**
+ * Get Directory File Information
+ *
+ * Reads the specified directory and builds an array containing the filenames,
+ * filesize, dates, and permissions
+ *
+ * Any sub-folders contained within the specified path are read as well.
+ *
+ * @access public
+ * @param string path to source
+ * @param bool whether to include the path as part of the filename
+ * @param bool internal variable to determine recursion status - do not use in calls
+ * @return array
+ */
+if (! function_exists('get_dir_file_info'))
+{
+ function get_dir_file_info($source_dir, $include_path = FALSE, $_recursion = FALSE)
+ {
+ $_filedata = array();
+ $relative_path = $source_dir;
+
+ if ($fp = @opendir($source_dir))
+ {
+ // reset the array and make sure $source_dir has a trailing slash on the initial call
+ if ($_recursion === FALSE)
+ {
+ $_filedata = array();
+ $source_dir = rtrim(realpath($source_dir), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
+ }
+
+ while (FALSE !== ($file = readdir($fp)))
+ {
+ if (@is_dir($source_dir.$file) && strncmp($file, '.', 1) !== 0)
+ {
+ get_dir_file_info($source_dir.$file.DIRECTORY_SEPARATOR, $include_path, TRUE);
+ }
+ elseif (strncmp($file, '.', 1) !== 0)
+ {
+ $_filedata[$file] = get_file_info($source_dir.$file);
+ $_filedata[$file]['relative_path'] = $relative_path;
+ }
+ }
+ return $_filedata;
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+/**
+* Get File Info
+*
+* Given a file and path, returns the name, path, size, date modified
+* Second parameter allows you to explicitly declare what information you want returned
+* Options are: name, server_path, size, date, readable, writable, executable, fileperms
+* Returns FALSE if the file cannot be found.
+*
+* @access public
+* @param string path to file
+* @param mixed array or comma separated string of information returned
+* @return array
+*/
+if (! function_exists('get_file_info'))
+{
+ function get_file_info($file, $returned_values = array('name', 'server_path', 'size', 'date'))
+ {
+
+ if (! file_exists($file))
+ {
+ return FALSE;
+ }
+
+ if (is_string($returned_values))
+ {
+ $returned_values = explode(',', $returned_values);
+ }
+
+ foreach ($returned_values as $key)
+ {
+ switch ($key)
+ {
+ case 'name':
+ $fileinfo['name'] = substr(strrchr($file, '/'), 1);
+ break;
+ case 'server_path':
+ $fileinfo['server_path'] = $file;
+ break;
+ case 'size':
+ $fileinfo['size'] = filesize($file);
+ break;
+ case 'date':
+ $fileinfo['date'] = filectime($file);
+ break;
+ case 'readable':
+ $fileinfo['readable'] = is_readable($file);
+ break;
+ case 'writable':
+ // There are known problems using is_weritable on IIS. It may not be reliable - consider fileperms()
+ $fileinfo['writable'] = is_writable($file);
+ break;
+ case 'executable':
+ $fileinfo['executable'] = is_executable($file);
+ break;
+ case 'fileperms':
+ $fileinfo['fileperms'] = fileperms($file);
+ break;
+ }
+ }
+
+ return $fileinfo;
+ }
+}
+
+// --------------------------------------------------------------------
+
+/**
+ * Get Mime by Extension
+ *
+ * Translates a file extension into a mime type based on config/mimes.php.
+ * Returns FALSE if it can't determine the type, or open the mime config file
+ *
+ * Note: this is NOT an accurate way of determining file mime types, and is here strictly as a convenience
+ * It should NOT be trusted, and should certainly NOT be used for security
+ *
+ * @access public
+ * @param string path to file
+ * @return mixed
+ */
+if (! function_exists('get_mime_by_extension'))
+{
+ function get_mime_by_extension($file)
+ {
+ $extension = substr(strrchr($file, '.'), 1);
+
+ global $mimes;
+
+ if (! is_array($mimes))
+ {
+ if (! require_once(APPPATH.'config/mimes.php'))
+ {
+ return FALSE;
+ }
+ }
+
+ if (array_key_exists($extension, $mimes))
+ {
+ if (is_array($mimes[$extension]))
+ {
+ // Multiple mime types, just give the first one
+ return current($mimes[$extension]);
+ }
+ else
+ {
+ return $mimes[$extension];
+ }
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
+}
+
?> \ No newline at end of file
diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php
index db41cb5cd..10858339e 100644
--- a/system/helpers/form_helper.php
+++ b/system/helpers/form_helper.php
@@ -48,7 +48,7 @@ if (! function_exists('form_open'))
$form = '<form action="'.$action.'"';
- if ( ! isset($attributes['method']))
+ if (! isset($attributes['method']))
{
$form .= ' method="post"';
}
@@ -111,7 +111,7 @@ if (! function_exists('form_hidden'))
{
function form_hidden($name, $value = '')
{
- if ( ! is_array($name))
+ if (! is_array($name))
{
return '<input type="hidden" name="'.$name.'" value="'.form_prep($value).'" />';
}
@@ -141,7 +141,7 @@ if (! function_exists('form_input'))
{
function form_input($data = '', $value = '', $extra = '')
{
- $defaults = array('type' => 'text', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value, 'maxlength' => '500', 'size' => '50');
+ $defaults = array('type' => 'text', 'name' => ((! is_array($data)) ? $data : ''), 'value' => $value, 'maxlength' => '500', 'size' => '50');
return "<input ".parse_form_attributes($data, $defaults).$extra." />\n";
}
@@ -164,7 +164,7 @@ if (! function_exists('form_password'))
{
function form_password($data = '', $value = '', $extra = '')
{
- if ( ! is_array($data))
+ if (! is_array($data))
{
$data = array('name' => $data);
}
@@ -191,7 +191,7 @@ if (! function_exists('form_upload'))
{
function form_upload($data = '', $value = '', $extra = '')
{
- if ( ! is_array($data))
+ if (! is_array($data))
{
$data = array('name' => $data);
}
@@ -216,9 +216,9 @@ if (! function_exists('form_textarea'))
{
function form_textarea($data = '', $value = '', $extra = '')
{
- $defaults = array('name' => (( ! is_array($data)) ? $data : ''), 'cols' => '90', 'rows' => '12');
+ $defaults = array('name' => ((! is_array($data)) ? $data : ''), 'cols' => '90', 'rows' => '12');
- if ( ! is_array($data) OR ! isset($data['value']))
+ if (! is_array($data) OR ! isset($data['value']))
{
$val = $value;
}
@@ -248,7 +248,7 @@ if (! function_exists('form_dropdown'))
{
function form_dropdown($name = '', $options = array(), $selected = array(), $extra = '')
{
- if ( ! is_array($selected))
+ if (! is_array($selected))
{
$selected = array($selected);
}
@@ -291,7 +291,7 @@ if (! function_exists('form_checkbox'))
{
function form_checkbox($data = '', $value = '', $checked = TRUE, $extra = '')
{
- $defaults = array('type' => 'checkbox', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value);
+ $defaults = array('type' => 'checkbox', 'name' => ((! is_array($data)) ? $data : ''), 'value' => $value);
if (is_array($data) AND array_key_exists('checked', $data))
{
@@ -332,7 +332,7 @@ if (! function_exists('form_radio'))
{
function form_radio($data = '', $value = '', $checked = TRUE, $extra = '')
{
- if ( ! is_array($data))
+ if (! is_array($data))
{
$data = array('name' => $data);
}
@@ -357,7 +357,7 @@ if (! function_exists('form_submit'))
{
function form_submit($data = '', $value = '', $extra = '')
{
- $defaults = array('type' => 'submit', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value);
+ $defaults = array('type' => 'submit', 'name' => ((! is_array($data)) ? $data : ''), 'value' => $value);
return "<input ".parse_form_attributes($data, $defaults).$extra." />\n";
}
@@ -378,7 +378,7 @@ if (! function_exists('form_reset'))
{
function form_reset($data = '', $value = '', $extra = '')
{
- $defaults = array('type' => 'reset', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value);
+ $defaults = array('type' => 'reset', 'name' => ((! is_array($data)) ? $data : ''), 'value' => $value);
return "<input ".parse_form_attributes($data, $defaults).$extra." />\n";
}
@@ -399,7 +399,7 @@ if (! function_exists('form_button'))
{
function form_button($data = '', $content = '', $extra = '')
{
- $defaults = array('name' => (( ! is_array($data)) ? $data : ''), 'type' => 'submit');
+ $defaults = array('name' => ((! is_array($data)) ? $data : ''), 'type' => 'submit');
if ( is_array($data) AND isset($data['content']))
{
diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php
index 3e15b4442..4e86465c1 100644
--- a/system/helpers/html_helper.php
+++ b/system/helpers/html_helper.php
@@ -105,7 +105,7 @@ if (! function_exists('_list'))
function _list($type = 'ul', $list, $attributes = '', $depth = 0)
{
// If an array wasn't submitted there's nothing to do...
- if ( ! is_array($list))
+ if (! is_array($list))
{
return $list;
}
@@ -138,7 +138,7 @@ if (! function_exists('_list'))
$out .= str_repeat(" ", $depth + 2);
$out .= "<li>";
- if ( ! is_array($val))
+ if (! is_array($val))
{
$out .= $val;
}
@@ -194,7 +194,7 @@ if (! function_exists('img'))
{
function img($src = '', $index_page = FALSE)
{
- if ( ! is_array($src) )
+ if (! is_array($src) )
{
$src = array('src' => $src);
}
diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php
index 30d26d6ee..6abff06af 100644
--- a/system/helpers/path_helper.php
+++ b/system/helpers/path_helper.php
@@ -57,7 +57,7 @@ if (! function_exists('set_realpath'))
// Make sure the path exists
if ($check_existance == TRUE)
{
- if ( ! is_dir($path))
+ if (! is_dir($path))
{
show_error('Not a valid path: '.$path);
}
diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php
index 7552fd89c..edb6ebb50 100644
--- a/system/helpers/security_helper.php
+++ b/system/helpers/security_helper.php
@@ -59,9 +59,9 @@ if (! function_exists('dohash'))
{
if ($type == 'sha1')
{
- if ( ! function_exists('sha1'))
+ if (! function_exists('sha1'))
{
- if ( ! function_exists('mhash'))
+ if (! function_exists('mhash'))
{
require_once(BASEPATH.'libraries/Sha1'.EXT);
$SH = new CI_SHA;
diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php
index 25962eb54..81c6b9199 100644
--- a/system/helpers/smiley_helper.php
+++ b/system/helpers/smiley_helper.php
@@ -67,7 +67,7 @@ if (! function_exists('get_clickable_smileys'))
{
function get_clickable_smileys($image_url = '', $smileys = NULL)
{
- if ( ! is_array($smileys))
+ if (! is_array($smileys))
{
if (FALSE === ($smileys = _get_smiley_array()))
{
@@ -120,7 +120,7 @@ if (! function_exists('parse_smileys'))
return $str;
}
- if ( ! is_array($smileys))
+ if (! is_array($smileys))
{
if (FALSE === ($smileys = _get_smiley_array()))
{
@@ -154,14 +154,14 @@ if (! function_exists('_get_smiley_array'))
{
function _get_smiley_array()
{
- if ( ! file_exists(APPPATH.'config/smileys'.EXT))
+ if (! file_exists(APPPATH.'config/smileys'.EXT))
{
return FALSE;
}
include(APPPATH.'config/smileys'.EXT);
- if ( ! isset($smileys) OR ! is_array($smileys))
+ if (! isset($smileys) OR ! is_array($smileys))
{
return FALSE;
}
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php
index 21ab77830..df3c89e6f 100644
--- a/system/helpers/text_helper.php
+++ b/system/helpers/text_helper.php
@@ -226,7 +226,7 @@ if (! function_exists('word_censor'))
{
function word_censor($str, $censored, $replacement = '')
{
- if ( ! is_array($censored))
+ if (! is_array($censored))
{
return $str;
}
@@ -354,7 +354,7 @@ if (! function_exists('word_wrap'))
function word_wrap($str, $charlim = '76')
{
// Se the character limit
- if ( ! is_numeric($charlim))
+ if (! is_numeric($charlim))
$charlim = 76;
// Reduce multiple spaces
diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php
index 4d9a1bb6b..88071604d 100644
--- a/system/helpers/typography_helper.php
+++ b/system/helpers/typography_helper.php
@@ -330,13 +330,13 @@ class Auto_typography {
$one_before = substr($str, $start+$current-1, 1);
$one_after = substr($str, $start+$current+2, 1);
- if ( ! in_array($one_after, $space, TRUE) && $one_after != "<")
+ if (! in_array($one_after, $space, TRUE) && $one_after != "<")
{
$str = str_replace( $one_before."\"'".$one_after,
$one_before."&#8220;&#8216;".$one_after,
$str);
}
- elseif ( ! in_array($one_before, $space, TRUE) && (in_array($one_after, $space, TRUE) OR $one_after == '<'))
+ elseif (! in_array($one_before, $space, TRUE) && (in_array($one_after, $space, TRUE) OR $one_after == '<'))
{
$str = str_replace( $one_before."\"'".$one_after,
$one_before."&#8221;&#8217;".$one_after,
@@ -363,7 +363,7 @@ class Auto_typography {
$one_before."&#8216;&#8220;".$one_after,
$str);
}
- elseif ( ! in_array($one_before, $space, TRUE) && $one_before != ">")
+ elseif (! in_array($one_before, $space, TRUE) && $one_before != ">")
{
$str = str_replace( $one_before."'\"".$one_after,
$one_before."&#8217;&#8221;".$one_after,
@@ -378,7 +378,7 @@ class Auto_typography {
{
for ($i=0, $s=sizeof($matches['0']); $i < $s; ++$i)
{
- if ( ! in_array($matches['1'][$i], $space, TRUE) && ! in_array($matches['3'][$i], $space, TRUE))
+ if (! in_array($matches['1'][$i], $space, TRUE) && ! in_array($matches['3'][$i], $space, TRUE))
{
$str = str_replace( $matches['0'][$i],
$matches['1'][$i]."&#8220;".$matches['2'][$i]."&#8221;".$matches['3'][$i],
@@ -391,7 +391,7 @@ class Auto_typography {
{
for ($i=0, $s=sizeof($matches['0']); $i < $s; ++$i)
{
- if ( ! in_array($matches['1'][$i], $space, TRUE) && ! in_array($matches['3'][$i], $space, TRUE))
+ if (! in_array($matches['1'][$i], $space, TRUE) && ! in_array($matches['3'][$i], $space, TRUE))
{
$str = str_replace( $matches['0'][$i],
$matches['1'][$i]."&#8216;".$matches['2'][$i]."&#8217;".$matches['3'][$i],
@@ -412,7 +412,7 @@ class Auto_typography {
$one_before = substr($str, $start+$current-1, 1);
$one_after = substr($str, $start+$current+1, 1);
- if ( ! in_array($one_before, $space, TRUE) && ! in_array($one_after, $space, TRUE))
+ if (! in_array($one_before, $space, TRUE) && ! in_array($one_after, $space, TRUE))
{
$str = str_replace( $one_before."'".$one_after,
$one_before."&#8217;".$one_after,
@@ -435,9 +435,9 @@ class Auto_typography {
$two_before = substr($str, $start+$current-2, 1);
$two_after = substr($str, $start+$current+3, 1);
- if (( ! in_array($one_before, $space, TRUE) && ! in_array($one_after, $space, TRUE))
+ if ((! in_array($one_before, $space, TRUE) && ! in_array($one_after, $space, TRUE))
OR
- ( ! in_array($two_before, $space, TRUE) && ! in_array($two_after, $space, TRUE) && $one_before == ' ' && $one_after == ' ')
+ (! in_array($two_before, $space, TRUE) && ! in_array($two_after, $space, TRUE) && $one_before == ' ' && $one_after == ' ')
)
{
$str = str_replace( $two_before.$one_before."--".$one_after.$two_after,
@@ -468,13 +468,13 @@ class Auto_typography {
$one_before = substr($str, $start+$current-1, 1);
$one_after = substr($str, $start+$current+1, 1);
- if ( ! in_array($one_after, $space, TRUE))
+ if (! in_array($one_after, $space, TRUE))
{
$str = str_replace( $one_before.'"'.$one_after,
$one_before."&#8220;".$one_after,
$str);
}
- elseif( ! in_array($one_before, $space, TRUE))
+ elseif(! in_array($one_before, $space, TRUE))
{
$str = str_replace( $one_before."'".$one_after,
$one_before."&#8221;".$one_after,
@@ -495,13 +495,13 @@ class Auto_typography {
$one_before = substr($str, $start+$current-1, 1);
$one_after = substr($str, $start+$current+1, 1);
- if ( ! in_array($one_after, $space, TRUE))
+ if (! in_array($one_after, $space, TRUE))
{
$str = str_replace( $one_before."'".$one_after,
$one_before."&#8216;".$one_after,
$str);
}
- elseif( ! in_array($one_before, $space, TRUE))
+ elseif(! in_array($one_before, $space, TRUE))
{
$str = str_replace( $one_before."'".$one_after,
$one_before."&#8217;".$one_after,
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php
index 1ff26082c..02c7f3379 100644
--- a/system/helpers/url_helper.php
+++ b/system/helpers/url_helper.php
@@ -103,9 +103,9 @@ if (! function_exists('anchor'))
{
$title = (string) $title;
- if ( ! is_array($uri))
+ if (! is_array($uri))
{
- $site_url = ( ! preg_match('!^\w+://!i', $uri)) ? site_url($uri) : $uri;
+ $site_url = (! preg_match('!^\w+://!i', $uri)) ? site_url($uri) : $uri;
}
else
{
@@ -150,7 +150,7 @@ if (! function_exists('anchor_popup'))
{
$title = (string) $title;
- $site_url = ( ! preg_match('!^\w+://!i', $uri)) ? site_url($uri) : $uri;
+ $site_url = (! preg_match('!^\w+://!i', $uri)) ? site_url($uri) : $uri;
if ($title == '')
{
@@ -162,14 +162,14 @@ if (! function_exists('anchor_popup'))
return "<a href='javascript:void(0);' onclick=\"window.open('".$site_url."', '_blank');\">".$title."</a>";
}
- if ( ! is_array($attributes))
+ if (! is_array($attributes))
{
$attributes = array();
}
foreach (array('width' => '800', 'height' => '600', 'scrollbars' => 'yes', 'status' => 'yes', 'resizable' => 'yes', 'screenx' => '0', 'screeny' => '0', ) as $key => $val)
{
- $atts[$key] = ( ! isset($attributes[$key])) ? $val : $attributes[$key];
+ $atts[$key] = (! isset($attributes[$key])) ? $val : $attributes[$key];
}
return "<a href='javascript:void(0);' onclick=\"window.open('".$site_url."', '_blank', '"._parse_attributes($atts, TRUE)."');\">".$title."</a>";