summaryrefslogtreecommitdiffstats
path: root/system/helpers
diff options
context:
space:
mode:
authorDerek Allard <derek.allard@ellislab.com>2008-08-21 14:43:31 +0200
committerDerek Allard <derek.allard@ellislab.com>2008-08-21 14:43:31 +0200
commit993925b47a0bfb08e79961c47bcc3d247a03a5dd (patch)
tree4012e1f02407efb333a20c67e5d7d1cac8249b9f /system/helpers
parent719b65d54a85337c5616a781eff07d5031c106e9 (diff)
whitespace fixes
a minor re-ordering of the changelog
Diffstat (limited to 'system/helpers')
-rw-r--r--system/helpers/file_helper.php104
-rw-r--r--system/helpers/form_helper.php12
-rw-r--r--system/helpers/inflector_helper.php84
-rw-r--r--system/helpers/smiley_helper.php34
-rw-r--r--system/helpers/string_helper.php4
5 files changed, 119 insertions, 119 deletions
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php
index 86c5c09db..b59443c0e 100644
--- a/system/helpers/file_helper.php
+++ b/system/helpers/file_helper.php
@@ -262,60 +262,60 @@ if ( ! function_exists('get_dir_file_info'))
* 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
-*/
+* @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;
- }
+ 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;
+ }
}
// --------------------------------------------------------------------
diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php
index 0ad57d532..0c74ac0ff 100644
--- a/system/helpers/form_helper.php
+++ b/system/helpers/form_helper.php
@@ -53,7 +53,7 @@ if ( ! function_exists('form_open'))
$form = '<form action="'.$action.'"';
- $form .= _attributes_to_string($attributes, TRUE);
+ $form .= _attributes_to_string($attributes, TRUE);
$form .= '>';
@@ -214,11 +214,11 @@ if ( ! function_exists('form_textarea'))
{
$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;
}
- else
+ else
{
$val = $data['value'];
unset($data['value']); // textareas don't use the value attribute
@@ -466,7 +466,7 @@ if ( ! function_exists('form_fieldset'))
{
$fieldset = "<fieldset";
- $fieldset .= _attributes_to_string($attributes, FALSE);
+ $fieldset .= _attributes_to_string($attributes, FALSE);
$fieldset .= ">\n";
@@ -623,8 +623,8 @@ if ( ! function_exists('_attributes_to_string'))
{
$attributes .= ' method="post"';
}
-
- return ' '.$attributes;
+
+ return ' '.$attributes;
}
if (is_object($attributes) AND count($attributes) > 0)
diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php
index 49ba542a1..e362a3fd7 100644
--- a/system/helpers/inflector_helper.php
+++ b/system/helpers/inflector_helper.php
@@ -41,28 +41,28 @@ if ( ! function_exists('singular'))
{
function singular($str)
{
- $str = strtolower(trim($str));
- $end = substr($str, -3);
-
- if ($end == 'ies')
- {
- $str = substr($str, 0, strlen($str)-3).'y';
- }
- elseif ($end == 'ses')
- {
- $str = substr($str, 0, strlen($str)-2);
- }
- else
- {
- $end = substr($str, -1);
-
- if ($end == 's')
- {
- $str = substr($str, 0, strlen($str)-1);
- }
- }
-
- return $str;
+ $str = strtolower(trim($str));
+ $end = substr($str, -3);
+
+ if ($end == 'ies')
+ {
+ $str = substr($str, 0, strlen($str)-3).'y';
+ }
+ elseif ($end == 'ses')
+ {
+ $str = substr($str, 0, strlen($str)-2);
+ }
+ else
+ {
+ $end = substr($str, -1);
+
+ if ($end == 's')
+ {
+ $str = substr($str, 0, strlen($str)-1);
+ }
+ }
+
+ return $str;
}
}
@@ -82,26 +82,26 @@ if ( ! function_exists('plural'))
{
function plural($str, $force = FALSE)
{
- $str = strtolower(trim($str));
- $end = substr($str, -1);
-
- if ($end == 'y')
- {
- $str = substr($str, 0, strlen($str)-1).'ies';
- }
- elseif ($end == 's')
- {
- if ($force == TRUE)
- {
- $str .= 'es';
- }
- }
- else
- {
- $str .= 's';
- }
-
- return $str;
+ $str = strtolower(trim($str));
+ $end = substr($str, -1);
+
+ if ($end == 'y')
+ {
+ $str = substr($str, 0, strlen($str)-1).'ies';
+ }
+ elseif ($end == 's')
+ {
+ if ($force == TRUE)
+ {
+ $str .= 'es';
+ }
+ }
+ else
+ {
+ $str .= 's';
+ }
+
+ return $str;
}
}
diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php
index 8f7543746..efa338467 100644
--- a/system/helpers/smiley_helper.php
+++ b/system/helpers/smiley_helper.php
@@ -36,7 +36,7 @@
* @param string form name
* @param string field name
* @return string
- */
+ */
if ( ! function_exists('js_insert_smiley'))
{
function js_insert_smiley($form_name = '', $form_field = '')
@@ -49,7 +49,7 @@ if ( ! function_exists('js_insert_smiley'))
}
</script>
EOF;
- }
+ }
}
// ------------------------------------------------------------------------
@@ -62,7 +62,7 @@ EOF;
* @access public
* @param string the URL to the folder containing the smiley images
* @return array
- */
+ */
if ( ! function_exists('get_clickable_smileys'))
{
function get_clickable_smileys($image_url = '', $smileys = NULL)
@@ -72,12 +72,12 @@ if ( ! function_exists('get_clickable_smileys'))
if (FALSE === ($smileys = _get_smiley_array()))
{
return $smileys;
- }
+ }
}
// Add a trailing slash to the file path if needed
$image_url = preg_replace("/(.+?)\/*$/", "\\1/", $image_url);
-
+
$used = array();
foreach ($smileys as $key => $val)
{
@@ -89,12 +89,12 @@ if ( ! function_exists('get_clickable_smileys'))
{
continue;
}
-
- $link[] = "<a href=\"javascript:void(0);\" onClick=\"insert_smiley('".$key."')\"><img src=\"".$image_url.$smileys[$key][0]."\" width=\"".$smileys[$key][1]."\" height=\"".$smileys[$key][2]."\" alt=\"".$smileys[$key][3]."\" style=\"border:0;\" /></a>";
-
+
+ $link[] = "<a href=\"javascript:void(0);\" onClick=\"insert_smiley('".$key."')\"><img src=\"".$image_url.$smileys[$key][0]."\" width=\"".$smileys[$key][1]."\" height=\"".$smileys[$key][2]."\" alt=\"".$smileys[$key][3]."\" style=\"border:0;\" /></a>";
+
$used[$smileys[$key][0]] = TRUE;
}
-
+
return $link;
}
}
@@ -110,7 +110,7 @@ if ( ! function_exists('get_clickable_smileys'))
* @param string the text to be parsed
* @param string the URL to the folder containing the smiley images
* @return string
- */
+ */
if ( ! function_exists('parse_smileys'))
{
function parse_smileys($str = '', $image_url = '', $smileys = NULL)
@@ -125,17 +125,17 @@ if ( ! function_exists('parse_smileys'))
if (FALSE === ($smileys = _get_smiley_array()))
{
return $str;
- }
+ }
}
-
+
// Add a trailing slash to the file path if needed
$image_url = preg_replace("/(.+?)\/*$/", "\\1/", $image_url);
foreach ($smileys as $key => $val)
- {
+ {
$str = str_replace($key, "<img src=\"".$image_url.$smileys[$key][0]."\" width=\"".$smileys[$key][1]."\" height=\"".$smileys[$key][2]."\" alt=\"".$smileys[$key][3]."\" style=\"border:0;\" />", $str);
}
-
+
return $str;
}
}
@@ -149,7 +149,7 @@ if ( ! function_exists('parse_smileys'))
*
* @access private
* @return mixed
- */
+ */
if ( ! function_exists('_get_smiley_array'))
{
function _get_smiley_array()
@@ -160,12 +160,12 @@ if ( ! function_exists('_get_smiley_array'))
}
include(APPPATH.'config/smileys'.EXT);
-
+
if ( ! isset($smileys) OR ! is_array($smileys))
{
return FALSE;
}
-
+
return $smileys;
}
}
diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php
index 7b6becffe..d85d76ca4 100644
--- a/system/helpers/string_helper.php
+++ b/system/helpers/string_helper.php
@@ -46,7 +46,7 @@ if ( ! function_exists('trim_slashes'))
{
function trim_slashes($str)
{
- return trim($str, '/');
+ return trim($str, '/');
}
}
@@ -173,7 +173,7 @@ if ( ! function_exists('reduce_multiples'))
{
$str = trim($str, $character);
}
-
+
return $str;
}
}