summaryrefslogtreecommitdiffstats
path: root/system/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'system/helpers')
-rw-r--r--system/helpers/array_helper.php3
-rw-r--r--system/helpers/captcha_helper.php3
-rw-r--r--system/helpers/cookie_helper.php3
-rw-r--r--system/helpers/date_helper.php20
-rw-r--r--system/helpers/directory_helper.php14
-rw-r--r--system/helpers/download_helper.php3
-rw-r--r--system/helpers/email_helper.php15
-rw-r--r--system/helpers/file_helper.php37
-rw-r--r--system/helpers/form_helper.php87
-rw-r--r--system/helpers/html_helper.php9
-rw-r--r--system/helpers/inflector_helper.php24
-rw-r--r--system/helpers/language_helper.php3
-rw-r--r--system/helpers/number_helper.php3
-rw-r--r--system/helpers/path_helper.php3
-rw-r--r--system/helpers/security_helper.php3
-rw-r--r--system/helpers/smiley_helper.php8
-rw-r--r--system/helpers/string_helper.php10
-rw-r--r--system/helpers/text_helper.php3
-rw-r--r--system/helpers/typography_helper.php3
-rw-r--r--system/helpers/url_helper.php20
-rw-r--r--system/helpers/xml_helper.php3
21 files changed, 155 insertions, 122 deletions
diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php
index ed2fe3c4a..0e66e4b77 100644
--- a/system/helpers/array_helper.php
+++ b/system/helpers/array_helper.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Array Helpers
diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php
index 3aac14db8..e9b167fa9 100644
--- a/system/helpers/captcha_helper.php
+++ b/system/helpers/captcha_helper.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter CAPTCHA Helper
diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php
index f396c76b0..02841409d 100644
--- a/system/helpers/cookie_helper.php
+++ b/system/helpers/cookie_helper.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Cookie Helpers
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php
index 5d9251526..0fa400d7e 100644
--- a/system/helpers/date_helper.php
+++ b/system/helpers/date_helper.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Date Helpers
@@ -449,20 +450,13 @@ if ( ! function_exists('human_to_unix'))
return FALSE;
}
- $split = explode(' ', $datestr);
+ sscanf($datestr, '%d-%d-%d %s %s', $year, $month, $day, $time, $ampm);
+ sscanf($time, '%d:%d:%d', $hour, $min, $sec);
+ isset($sec) OR $sec = 0;
- list($year, $month, $day) = explode('-', $split[0]);
-
- $ex = explode(':', $split['1']);
-
- $hour = (int) $ex[0];
- $min = (int) $ex[1];
- $sec = ( ! empty($ex[2]) && preg_match('/[0-9]{1,2}/', $ex[2]))
- ? (int) $ex[2] : 0;
-
- if (isset($split[2]))
+ if (isset($ampm))
{
- $ampm = strtolower($split[2]);
+ $ampm = strtolower($ampm);
if ($ampm[0] === 'p' && $hour < 12)
{
diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php
index 7d6b6770e..49dcfc8a9 100644
--- a/system/helpers/directory_helper.php
+++ b/system/helpers/directory_helper.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Directory Helpers
@@ -46,9 +47,10 @@ if ( ! function_exists('directory_map'))
* representation of it. Sub-folders contained with the
* directory will be mapped as well.
*
- * @param string path to source
- * @param int depth of directories to traverse (0 = fully recursive, 1 = current dir, etc)
- * @param bool whether to show hidden files
+ * @param string $source_dir Path to source
+ * @param int $directory_depth Depth of directories to traverse
+ * (0 = fully recursive, 1 = current dir, etc)
+ * @param bool $hidden Whether to show hidden files
* @return array
*/
function directory_map($source_dir, $directory_depth = 0, $hidden = FALSE)
@@ -67,9 +69,11 @@ if ( ! function_exists('directory_map'))
continue;
}
+ @is_dir($source_dir.$file) AND $file .= DIRECTORY_SEPARATOR;
+
if (($directory_depth < 1 OR $new_depth > 0) && @is_dir($source_dir.$file))
{
- $filedata[$file] = directory_map($source_dir.$file.DIRECTORY_SEPARATOR, $new_depth, $hidden);
+ $filedata[$file] = directory_map($source_dir.$file, $new_depth, $hidden);
}
else
{
diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php
index 2c26a36d5..8fe66e222 100644
--- a/system/helpers/download_helper.php
+++ b/system/helpers/download_helper.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Download Helpers
diff --git a/system/helpers/email_helper.php b/system/helpers/email_helper.php
index 2a63b36c9..dfb166a5a 100644
--- a/system/helpers/email_helper.php
+++ b/system/helpers/email_helper.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Email Helpers
@@ -42,7 +43,8 @@ if ( ! function_exists('valid_email'))
/**
* Validate email address
*
- * @param string
+ * @deprecated 3.0.0 Use PHP's filter_var() instead
+ * @param string $email
* @return bool
*/
function valid_email($email)
@@ -58,12 +60,13 @@ if ( ! function_exists('send_email'))
/**
* Send an email
*
- * @param string
- * @param string
- * @param string
+ * @deprecated 3.0.0 Use PHP's mail() instead
+ * @param string $recipient
+ * @param string $subject
+ * @param string $message
* @return bool
*/
- function send_email($recipient, $subject = 'Test email', $message = 'Hello World')
+ function send_email($recipient, $subject, $message)
{
return mail($recipient, $subject, $message);
}
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php
index 8f23a3d54..aebb6e47a 100644
--- a/system/helpers/file_helper.php
+++ b/system/helpers/file_helper.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter File Helpers
@@ -65,12 +66,12 @@ if ( ! function_exists('write_file'))
* Writes data to the file specified in the path.
* Creates a new file if non-existent.
*
- * @param string path to file
- * @param string file data
- * @param int
+ * @param string $path File path
+ * @param string $data Data to write
+ * @param string $mode fopen() mode (default: 'wb')
* @return bool
*/
- function write_file($path, $data, $mode = FOPEN_WRITE_CREATE_DESTRUCTIVE)
+ function write_file($path, $data, $mode = 'wb')
{
if ( ! $fp = @fopen($path, $mode))
{
@@ -98,13 +99,13 @@ if ( ! function_exists('delete_files'))
* If the second parameter is set to TRUE, any directories contained
* within the supplied base directory will be nuked as well.
*
- * @param string path to file
- * @param bool whether to delete any directories found in the path
- * @param int
- * @param bool whether to skip deleting .htaccess and index page files
+ * @param string $path File path
+ * @param bool $del_dir Whether to delete any directories found in the path
+ * @param bool $htdocs Whether to skip deleting .htaccess and index page files
+ * @param int $_level Current directory depth level (default: 0; internal use only)
* @return bool
*/
- function delete_files($path, $del_dir = FALSE, $level = 0, $htdocs = FALSE)
+ function delete_files($path, $del_dir = FALSE, $htdocs = FALSE, $_level = 0)
{
// Trim the trailing slash
$path = rtrim($path, '/\\');
@@ -120,7 +121,7 @@ if ( ! function_exists('delete_files'))
{
if (is_dir($path.DIRECTORY_SEPARATOR.$filename) && $filename[0] !== '.')
{
- delete_files($path.DIRECTORY_SEPARATOR.$filename, $del_dir, $level + 1, $htdocs);
+ delete_files($path.DIRECTORY_SEPARATOR.$filename, $del_dir, $htdocs, $_level + 1);
}
elseif ($htdocs !== TRUE OR ! preg_match('/^(\.htaccess|index\.(html|htm|php)|web\.config)$/i', $filename))
{
@@ -130,7 +131,7 @@ if ( ! function_exists('delete_files'))
}
@closedir($current_dir);
- if ($del_dir === TRUE && $level > 0)
+ if ($del_dir === TRUE && $_level > 0)
{
return @rmdir($path);
}
@@ -318,12 +319,12 @@ if ( ! function_exists('get_mime_by_extension'))
* 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
*
- * @param string path to file
- * @return mixed
+ * @param string $filename File name
+ * @return string
*/
- function get_mime_by_extension($file)
+ function get_mime_by_extension($filename)
{
- $extension = strtolower(substr(strrchr($file, '.'), 1));
+ $extension = strtolower(substr(strrchr($filename, '.'), 1));
static $mimes;
@@ -358,7 +359,7 @@ if ( ! function_exists('symbolic_permissions'))
* Takes a numeric value representing a file's permissions and returns
* standard symbolic notation representing that value
*
- * @param int
+ * @param int $perms Permissions
* @return string
*/
function symbolic_permissions($perms)
@@ -425,7 +426,7 @@ if ( ! function_exists('octal_permissions'))
* Takes a numeric value representing a file's permissions and returns
* a three character string representing the file's octal permissions
*
- * @param int
+ * @param int $perms Permissions
* @return string
*/
function octal_permissions($perms)
diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php
index 622622c0e..e7bea92cc 100644
--- a/system/helpers/form_helper.php
+++ b/system/helpers/form_helper.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -22,7 +22,9 @@
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
+ * @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Form Helpers
@@ -124,9 +126,9 @@ if ( ! function_exists('form_hidden'))
* Generates hidden fields. You can pass a simple key/value string or
* an associative array with multiple values.
*
- * @param mixed
- * @param string
- * @param bool
+ * @param mixed $name Field name
+ * @param string $value Field value
+ * @param bool $recursing
* @return string
*/
function form_hidden($name, $value = '', $recursing = FALSE)
@@ -149,7 +151,7 @@ if ( ! function_exists('form_hidden'))
if ( ! is_array($value))
{
- $form .= '<input type="hidden" name="'.$name.'" value="'.html_escape($value)."\" />\n";
+ $form .= '<input type="hidden" name="'.$name.'" value="'.form_prep($value)."\" />\n";
}
else
{
@@ -243,9 +245,9 @@ if ( ! function_exists('form_textarea'))
/**
* Textarea field
*
- * @param mixed
- * @param string
- * @param string
+ * @param mixed $data
+ * @param string $value
+ * @param string $extra
* @return string
*/
function form_textarea($data = '', $value = '', $extra = '')
@@ -263,7 +265,7 @@ if ( ! function_exists('form_textarea'))
}
$name = is_array($data) ? $data['name'] : $data;
- return '<textarea '._parse_form_attributes($data, $defaults).$extra.'>'.html_escape($val)."</textarea>\n";
+ return '<textarea '._parse_form_attributes($data, $defaults).$extra.'>'.form_prep($val, TRUE)."</textarea>\n";
}
}
@@ -298,10 +300,10 @@ if ( ! function_exists('form_dropdown'))
/**
* Drop-down Menu
*
- * @param mixed $name = ''
- * @param mixed $options = array()
- * @param mixed $selected = array()
- * @param mixed $extra = array()
+ * @param mixed $name
+ * @param mixed $options
+ * @param mixed $selected
+ * @param mixed $extra
* @return string
*/
function form_dropdown($name = '', $options = array(), $selected = array(), $extra = '')
@@ -349,7 +351,7 @@ if ( ! function_exists('form_dropdown'))
foreach ($val as $optgroup_key => $optgroup_val)
{
$sel = in_array($optgroup_key, $selected) ? ' selected="selected"' : '';
- $form .= '<option value="'.html_escape($optgroup_key).'"'.$sel.'>'
+ $form .= '<option value="'.form_prep($optgroup_key).'"'.$sel.'>'
.(string) $optgroup_val."</option>\n";
}
@@ -357,7 +359,7 @@ if ( ! function_exists('form_dropdown'))
}
else
{
- $form .= '<option value="'.html_escape($key).'"'
+ $form .= '<option value="'.form_prep($key).'"'
.(in_array($key, $selected) ? ' selected="selected"' : '').'>'
.(string) $val."</option>\n";
}
@@ -600,17 +602,28 @@ if ( ! function_exists('form_prep'))
*
* Formats text so that it can be safely placed in a form field in the event it has HTML tags.
*
- * @todo Remove in version 3.1+.
- * @deprecated 3.0.0 This function has been broken for a long time
- * and is now just an alias for html_escape(). It's
- * second argument is ignored.
- * @param string $str = ''
- * @param string $field_name = ''
- * @return string
+ * @param string|string[] $str Value to escape
+ * @param bool $is_textarea Whether we're escaping for a textarea element
+ * @return string|string[] Escaped values
*/
- function form_prep($str = '', $field_name = '')
+ function form_prep($str = '', $is_textarea = FALSE)
{
- return html_escape($str);
+ if (is_array($str))
+ {
+ foreach (array_keys($str) as $key)
+ {
+ $str[$key] = form_prep($str[$key], $is_textarea);
+ }
+
+ return $str;
+ }
+
+ if ($is_textarea === TRUE)
+ {
+ return str_replace(array('<', '>'), array('&lt;', '&gt;'), stripslashes($str));
+ }
+
+ return str_replace(array("'", '"'), array('&#39;', '&quot;'), stripslashes($str));
}
}
@@ -625,23 +638,21 @@ if ( ! function_exists('set_value'))
* re-populate an input field or textarea. If Form Validation
* is active it retrieves the info from the validation class
*
- * @param string
- * @param string
- * @return mixed
+ * @param string $field Field name
+ * @param string $default Default value
+ * @param bool $is_textarea Whether the field is a textarea element
+ * @return string
*/
- function set_value($field = '', $default = '')
+ function set_value($field = '', $default = '', $is_textarea = FALSE)
{
if (FALSE === ($OBJ =& _get_validation_object()))
{
- if ( ! isset($_POST[$field]))
- {
- return html_escape($default);
- }
-
- return html_escape($_POST[$field]);
+ return isset($_POST[$field])
+ ? form_prep($_POST[$field], $is_textarea)
+ : form_prep($default, $is_textarea);
}
- return html_escape($OBJ->set_value($field, $default));
+ return form_prep($OBJ->set_value($field, $default), $is_textarea);
}
}
@@ -862,8 +873,8 @@ if ( ! function_exists('_parse_form_attributes'))
*
* Helper function used by some of the form helpers
*
- * @param array
- * @param array
+ * @param array $attributes List of attributes
+ * @param array $default Default values
* @return string
*/
function _parse_form_attributes($attributes, $default)
@@ -891,7 +902,7 @@ if ( ! function_exists('_parse_form_attributes'))
{
if ($key === 'value')
{
- $val = html_escape($val);
+ $val = form_prep($val);
}
elseif ($key === 'name' && ! strlen($default['name']))
{
diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php
index 2372e8174..fa49f7d75 100644
--- a/system/helpers/html_helper.php
+++ b/system/helpers/html_helper.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter HTML Helpers
@@ -156,12 +157,12 @@ if ( ! function_exists('br'))
/**
* Generates HTML BR tags based on number supplied
*
- * @param int
+ * @param int $count Number of times to repeat the tag
* @return string
*/
- function br($num = 1)
+ function br($count = 1)
{
- return str_repeat('<br />', $num);
+ return str_repeat('<br />', $count);
}
}
diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php
index 647d840e4..59cb296b2 100644
--- a/system/helpers/inflector_helper.php
+++ b/system/helpers/inflector_helper.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Inflector Helpers
@@ -44,7 +45,7 @@ if ( ! function_exists('singular'))
*
* Takes a plural word and makes it singular
*
- * @param string
+ * @param string $str Input string
* @return string
*/
function singular($str)
@@ -108,11 +109,10 @@ if ( ! function_exists('plural'))
*
* Takes a singular word and makes it plural
*
- * @param string
- * @param bool
+ * @param string $str Input string
* @return string
*/
- function plural($str, $force = FALSE)
+ function plural($str)
{
$result = strval($str);
@@ -165,7 +165,7 @@ if ( ! function_exists('camelize'))
*
* Takes multiple words separated by spaces or underscores and camelizes them
*
- * @param string
+ * @param string $str Input string
* @return string
*/
function camelize($str)
@@ -183,7 +183,7 @@ if ( ! function_exists('underscore'))
*
* Takes multiple words separated by spaces and underscores them
*
- * @param string
+ * @param string $str Input string
* @return string
*/
function underscore($str)
@@ -201,8 +201,8 @@ if ( ! function_exists('humanize'))
*
* Takes multiple words separated by the separator and changes them to spaces
*
- * @param string $str
- * @param string $separator
+ * @param string $str Input string
+ * @param string $separator Input separator
* @return string
*/
function humanize($str, $separator = '_')
@@ -218,12 +218,12 @@ if ( ! function_exists('is_countable'))
/**
* Checks if the given word has a plural version.
*
- * @param string the word to check
- * @return bool if the word is countable
+ * @param string $word Word to check
+ * @return bool
*/
function is_countable($word)
{
- return ! in_array(strtolower(strval($word)),
+ return ! in_array(strtolower($word),
array(
'equipment', 'information', 'rice', 'money',
'species', 'series', 'fish', 'meta'
diff --git a/system/helpers/language_helper.php b/system/helpers/language_helper.php
index bd567ed79..658be6de7 100644
--- a/system/helpers/language_helper.php
+++ b/system/helpers/language_helper.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Language Helpers
diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php
index e49f2f7a0..b93096543 100644
--- a/system/helpers/number_helper.php
+++ b/system/helpers/number_helper.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Number Helpers
diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php
index 166fef065..5a798b118 100644
--- a/system/helpers/path_helper.php
+++ b/system/helpers/path_helper.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Path Helpers
diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php
index 8bbd06684..898a49c80 100644
--- a/system/helpers/security_helper.php
+++ b/system/helpers/security_helper.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Security Helpers
diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php
index b6b2afcf4..4b491758e 100644
--- a/system/helpers/smiley_helper.php
+++ b/system/helpers/smiley_helper.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Smiley Helpers
@@ -130,10 +131,9 @@ if ( ! function_exists('get_clickable_smileys'))
*
* @param string the URL to the folder containing the smiley images
* @param array
- * @param array
* @return array
*/
- function get_clickable_smileys($image_url, $alias = '', $smileys = NULL)
+ function get_clickable_smileys($image_url, $alias = '')
{
// For backward compatibility with js_insert_smiley
if (is_array($alias))
@@ -142,7 +142,7 @@ if ( ! function_exists('get_clickable_smileys'))
}
elseif (FALSE === ($smileys = _get_smiley_array()))
{
- return $smileys;
+ return FALSE;
}
// Add a trailing slash to the file path if needed
diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php
index c5c493452..9fc24559a 100644
--- a/system/helpers/string_helper.php
+++ b/system/helpers/string_helper.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter String Helpers
@@ -50,6 +51,9 @@ if ( ! function_exists('trim_slashes'))
*
* this/that/theother
*
+ * @todo Remove in version 3.1+.
+ * @deprecated 3.0.0 This is just an alias for PHP's native trim()
+ *
* @param string
* @return string
*/
@@ -214,10 +218,10 @@ if ( ! function_exists('random_string'))
break;
}
return substr(str_shuffle(str_repeat($pool, ceil($len / strlen($pool)))), 0, $len);
- case 'unique':
+ case 'unique': // todo: remove in 3.1+
case 'md5':
return md5(uniqid(mt_rand()));
- case 'encrypt':
+ case 'encrypt': // todo: remove in 3.1+
case 'sha1':
return sha1(uniqid(mt_rand(), TRUE));
}
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php
index 89602fc28..cce659231 100644
--- a/system/helpers/text_helper.php
+++ b/system/helpers/text_helper.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Text Helpers
diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php
index 96bedd026..48f1f1147 100644
--- a/system/helpers/typography_helper.php
+++ b/system/helpers/typography_helper.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Typography Helpers
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php
index dc77246dc..0aa358a0b 100644
--- a/system/helpers/url_helper.php
+++ b/system/helpers/url_helper.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter URL Helpers
@@ -473,9 +474,11 @@ if ( ! function_exists('url_title'))
* human-friendly URL string with a "separator" string
* as the word separator.
*
- * @param string the string
- * @param string the separator
- * @param bool
+ * @todo Remove old 'dash' and 'underscore' usage in 3.1+.
+ * @param string $str Input string
+ * @param string $separator Word separator
+ * (usually '-' or '_')
+ * @param bool $lowercase Wether to transform the output string to lowercase
* @return string
*/
function url_title($str, $separator = '-', $lowercase = FALSE)
@@ -524,10 +527,11 @@ if ( ! function_exists('redirect'))
* For very fine grained control over headers, you could use the Output
* Library's set_header() function.
*
- * @param string the URL
- * @param string the method: location or refresh
- * @param int
- * @return string
+ * @param string $uri URL
+ * @param string $method Redirect method
+ * 'auto', 'location' or 'refresh'
+ * @param int $code HTTP Response status code
+ * @return void
*/
function redirect($uri = '', $method = 'auto', $code = NULL)
{
diff --git a/system/helpers/xml_helper.php b/system/helpers/xml_helper.php
index 1431777d2..c3dfdcddb 100644
--- a/system/helpers/xml_helper.php
+++ b/system/helpers/xml_helper.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter XML Helpers