summaryrefslogtreecommitdiffstats
path: root/system/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'system/helpers')
-rw-r--r--system/helpers/array_helper.php8
-rw-r--r--system/helpers/captcha_helper.php20
-rw-r--r--system/helpers/cookie_helper.php6
-rw-r--r--system/helpers/date_helper.php22
-rw-r--r--system/helpers/directory_helper.php4
-rw-r--r--system/helpers/download_helper.php10
-rw-r--r--system/helpers/email_helper.php2
-rw-r--r--system/helpers/file_helper.php12
-rw-r--r--system/helpers/form_helper.php36
-rw-r--r--system/helpers/html_helper.php23
-rw-r--r--system/helpers/inflector_helper.php26
-rw-r--r--system/helpers/language_helper.php2
-rw-r--r--system/helpers/number_helper.php2
-rw-r--r--system/helpers/path_helper.php4
-rw-r--r--system/helpers/security_helper.php38
-rw-r--r--system/helpers/smiley_helper.php18
-rw-r--r--system/helpers/string_helper.php8
-rw-r--r--system/helpers/text_helper.php18
-rw-r--r--system/helpers/typography_helper.php7
-rw-r--r--system/helpers/url_helper.php6
-rw-r--r--system/helpers/xml_helper.php4
21 files changed, 122 insertions, 154 deletions
diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php
index 075a31fdf..daa21a3ef 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 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
@@ -79,7 +79,7 @@ if ( ! function_exists('random_element'))
/**
* Elements
*
- * Returns only the array items specified. Will return a default value if
+ * Returns only the array items specified. Will return a default value if
* it is not set.
*
* @access public
@@ -93,12 +93,12 @@ if ( ! function_exists('elements'))
function elements($items, $array, $default = FALSE)
{
$return = array();
-
+
if ( ! is_array($items))
{
$items = array($items);
}
-
+
foreach ($items as $item)
{
if (isset($array[$item]))
diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php
index 19ec0c778..130c2c746 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 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
@@ -106,8 +106,8 @@ if ( ! function_exists('create_captcha'))
// Do we have a "word" yet?
// -----------------------------------
- if ($word == '')
- {
+ if ($word == '')
+ {
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$str = '';
@@ -117,7 +117,7 @@ if ( ! function_exists('create_captcha'))
}
$word = $str;
- }
+ }
// -----------------------------------
// Determine angle and position
@@ -143,7 +143,7 @@ if ( ! function_exists('create_captcha'))
}
// -----------------------------------
- // Assign colors
+ // Assign colors
// -----------------------------------
$bg_color = imagecolorallocate ($im, 255, 255, 255);
@@ -153,13 +153,13 @@ if ( ! function_exists('create_captcha'))
$shadow_color = imagecolorallocate($im, 255, 240, 240);
// -----------------------------------
- // Create the rectangle
+ // Create the rectangle
// -----------------------------------
ImageFilledRectangle($im, 0, 0, $img_width, $img_height, $bg_color);
// -----------------------------------
- // Create the spiral pattern
+ // Create the spiral pattern
// -----------------------------------
$theta = 1;
@@ -183,7 +183,7 @@ if ( ! function_exists('create_captcha'))
}
// -----------------------------------
- // Write the text
+ // Write the text
// -----------------------------------
$use_font = ($font_path != '' AND file_exists($font_path) AND function_exists('imagettftext')) ? TRUE : FALSE;
@@ -219,13 +219,13 @@ if ( ! function_exists('create_captcha'))
// -----------------------------------
- // Create the border
+ // Create the border
// -----------------------------------
imagerectangle($im, 0, 0, $img_width-1, $img_height-1, $border_color);
// -----------------------------------
- // Generate the image
+ // Generate the image
// -----------------------------------
$img_name = $now.'.jpg';
diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php
index 7cee02827..31d2d31c8 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 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
@@ -37,7 +37,7 @@
* @param mixed
* @param string the value of the cookie
* @param string the number of seconds until expiration
- * @param string the cookie domain. Usually: .yourdomain.com
+ * @param string the cookie domain. Usually: .yourdomain.com
* @param string the cookie path
* @param string the cookie prefix
* @return void
@@ -85,7 +85,7 @@ if ( ! function_exists('get_cookie'))
* Delete a COOKIE
*
* @param mixed
- * @param string the cookie domain. Usually: .yourdomain.com
+ * @param string the cookie domain. Usually: .yourdomain.com
* @param string the cookie path
* @param string the cookie prefix
* @return void
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php
index 553e8d7ee..f3f01f751 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 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
@@ -69,7 +69,7 @@ if ( ! function_exists('now'))
* This function is identical to PHPs date() function,
* except that it allows date codes to be formatted using
* the MySQL style, where each code letter is preceded
- * with a percent sign: %Y %m %d etc...
+ * with a percent sign: %Y %m %d etc...
*
* The benefit of doing dates this way is that you don't
* have to worry about escaping your text letters that
@@ -366,7 +366,7 @@ if ( ! function_exists('mysql_to_unix'))
$time = str_replace(' ', '', $time);
// YYYYMMDDHHMMSS
- return mktime(
+ return mktime(
substr($time, 8, 2),
substr($time, 10, 2),
substr($time, 12, 2),
@@ -394,7 +394,7 @@ if ( ! function_exists('unix_to_human'))
{
function unix_to_human($time = '', $seconds = FALSE, $fmt = 'us')
{
- $r = date('Y', $time).'-'.date('m', $time).'-'.date('d', $time).' ';
+ $r = date('Y', $time).'-'.date('m', $time).'-'.date('d', $time).' ';
if ($fmt == 'us')
{
@@ -451,18 +451,18 @@ if ( ! function_exists('human_to_unix'))
$ex = explode("-", $split['0']);
- $year = (strlen($ex['0']) == 2) ? '20'.$ex['0'] : $ex['0'];
- $month = (strlen($ex['1']) == 1) ? '0'.$ex['1'] : $ex['1'];
- $day = (strlen($ex['2']) == 1) ? '0'.$ex['2'] : $ex['2'];
+ $year = (strlen($ex['0']) == 2) ? '20'.$ex['0'] : $ex['0'];
+ $month = (strlen($ex['1']) == 1) ? '0'.$ex['1'] : $ex['1'];
+ $day = (strlen($ex['2']) == 1) ? '0'.$ex['2'] : $ex['2'];
$ex = explode(":", $split['1']);
$hour = (strlen($ex['0']) == 1) ? '0'.$ex['0'] : $ex['0'];
- $min = (strlen($ex['1']) == 1) ? '0'.$ex['1'] : $ex['1'];
+ $min = (strlen($ex['1']) == 1) ? '0'.$ex['1'] : $ex['1'];
if (isset($ex['2']) && preg_match('/[0-9]{1,2}/', $ex['2']))
{
- $sec = (strlen($ex['2']) == 1) ? '0'.$ex['2'] : $ex['2'];
+ $sec = (strlen($ex['2']) == 1) ? '0'.$ex['2'] : $ex['2'];
}
else
{
@@ -478,7 +478,7 @@ if ( ! function_exists('human_to_unix'))
$hour = $hour + 12;
if (substr($ampm, 0, 1) == 'a' AND $hour == 12)
- $hour = '00';
+ $hour = '00';
if (strlen($hour) == 1)
$hour = '0'.$hour;
@@ -537,7 +537,7 @@ if ( ! function_exists('timezone_menu'))
/**
* Timezones
*
- * Returns an array of timezones. This is a helper function
+ * Returns an array of timezones. This is a helper function
* for various other ones in this library
*
* @access public
diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php
index 38347fa62..757901480 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 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
@@ -31,7 +31,7 @@
* Create a Directory Map
*
* Reads the specified directory and builds an array
- * representation of it. Sub-folders contained with the
+ * representation of it. Sub-folders contained with the
* directory will be mapped as well.
*
* @access public
diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php
index f8073d238..e6752db4a 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 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
@@ -58,13 +58,13 @@ if ( ! function_exists('force_download'))
$extension = end($x);
// Load the mime types
- if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT))
+ if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'))
{
- include(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT);
+ include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php');
}
- elseif (is_file(APPPATH.'config/mimes'.EXT))
+ elseif (is_file(APPPATH.'config/mimes.php'))
{
- include(APPPATH.'config/mimes'.EXT);
+ include(APPPATH.'config/mimes.php');
}
// Set a default mime if we can't find it
diff --git a/system/helpers/email_helper.php b/system/helpers/email_helper.php
index 651aef439..8fcdad9b5 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 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php
index 44344947e..2bd8bce10 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 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
@@ -311,7 +311,7 @@ if ( ! function_exists('get_file_info'))
$fileinfo['readable'] = is_readable($file);
break;
case 'writable':
- // There are known problems using is_weritable on IIS. It may not be reliable - consider fileperms()
+ // There are known problems using is_weritable on IIS. It may not be reliable - consider fileperms()
$fileinfo['writable'] = is_writable($file);
break;
case 'executable':
@@ -352,13 +352,13 @@ if ( ! function_exists('get_mime_by_extension'))
if ( ! is_array($mimes))
{
- if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT))
+ if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'))
{
- include(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT);
+ include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php');
}
- elseif (is_file(APPPATH.'config/mimes'.EXT))
+ elseif (is_file(APPPATH.'config/mimes.php'))
{
- include(APPPATH.'config/mimes'.EXT);
+ include(APPPATH.'config/mimes.php');
}
if ( ! is_array($mimes))
diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php
index 8aa788c6c..a6dfdb2ba 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 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
@@ -67,12 +67,12 @@ if ( ! function_exists('form_open'))
// CSRF
if ($CI->config->item('csrf_protection') === TRUE)
{
- $hidden[$CI->security->csrf_token_name] = $CI->security->csrf_hash;
+ $hidden[$CI->security->get_csrf_token_name()] = $CI->security->get_csrf_hash();
}
if (is_array($hidden) AND count($hidden) > 0)
{
- $form .= sprintf("\n<div class=\"hidden\">%s</div>", form_hidden($hidden));
+ $form .= sprintf("<div style=\"display:none\">%s</div>", form_hidden($hidden));
}
return $form;
@@ -114,7 +114,7 @@ if ( ! function_exists('form_open_multipart'))
/**
* Hidden Input Field
*
- * Generates hidden fields. You can pass a simple key/value string or an associative
+ * Generates hidden fields. You can pass a simple key/value string or an associative
* array with multiple values.
*
* @access public
@@ -540,7 +540,7 @@ if ( ! function_exists('form_label'))
/**
* Fieldset Tag
*
- * Used to produce <fieldset><legend>text</legend>. To close fieldset
+ * Used to produce <fieldset><legend>text</legend>. To close fieldset
* use form_fieldset_close()
*
* @access public
@@ -663,7 +663,7 @@ if ( ! function_exists('form_prep'))
* Form Value
*
* Grabs a value from the POST array for the specified field so you can
- * re-populate an input field or textarea. If Form Validation
+ * re-populate an input field or textarea. If Form Validation
* is active it retrieves the info from the validation class
*
* @access public
@@ -858,7 +858,7 @@ if ( ! function_exists('set_radio'))
/**
* Form Error
*
- * Returns the error for a specific form field. This is a helper for the
+ * Returns the error for a specific form field. This is a helper for the
* form validation class.
*
* @access public
@@ -885,7 +885,7 @@ if ( ! function_exists('form_error'))
/**
* Validation Error String
*
- * Returns all the errors associated with a form submission. This is a helper
+ * Returns all the errors associated with a form submission. This is a helper
* function for the form validation class.
*
* @access public
@@ -1032,25 +1032,23 @@ if ( ! function_exists('_get_validation_object'))
{
$CI =& get_instance();
- // We set this as a variable since we're returning by reference
+ // We set this as a variable since we're returning by reference.
$return = FALSE;
- if ( ! isset($CI->load->_ci_classes) OR ! isset($CI->load->_ci_classes['form_validation']))
+ if (FALSE !== ($object = $CI->load->is_loaded('form_validation')))
{
- return $return;
- }
-
- $object = $CI->load->_ci_classes['form_validation'];
+ if ( ! isset($CI->$object) OR ! is_object($CI->$object))
+ {
+ return $return;
+ }
- if ( ! isset($CI->$object) OR ! is_object($CI->$object))
- {
- return $return;
+ return $CI->$object;
}
- return $CI->$object;
+ return $return;
}
}
/* End of file form_helper.php */
-/* Location: ./system/helpers/form_helper.php */ \ No newline at end of file
+/* Location: ./system/helpers/form_helper.php */
diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php
index c6103ab6f..bd66bc2d0 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 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
@@ -30,7 +30,7 @@
/**
* Heading
*
- * Generates an HTML heading tag. First param is the data.
+ * Generates an HTML heading tag. First param is the data.
* Second param is the size of the heading tag.
*
* @access public
@@ -40,9 +40,10 @@
*/
if ( ! function_exists('heading'))
{
- function heading($data = '', $h = '1')
+ function heading($data = '', $h = '1', $attributes = '')
{
- return "<h".$h.">".$data."</h".$h.">";
+ $attributes = ($attributes != '') ? ' '.$attributes : $attributes;
+ return "<h".$h.$attributes.">".$data."</h".$h.">";
}
}
@@ -113,7 +114,7 @@ if ( ! function_exists('_list'))
// Set the indentation based on the depth
$out = str_repeat(" ", $depth);
- // Were any attributes submitted? If so generate a string
+ // Were any attributes submitted? If so generate a string
if (is_array($attributes))
{
$atts = '';
@@ -127,7 +128,7 @@ if ( ! function_exists('_list'))
// Write the opening list tag
$out .= "<".$type.$attributes.">\n";
- // Cycle through the list elements. If an array is
+ // Cycle through the list elements. If an array is
// encountered we will recursively call _list()
static $_last_list_item = '';
@@ -243,7 +244,7 @@ if ( ! function_exists('img'))
* Generates a page document type declaration
*
* Valid options are xhtml-11, xhtml-strict, xhtml-trans, xhtml-frame,
- * html4-strict, html4-trans, and html4-frame. Values are saved in the
+ * html4-strict, html4-trans, and html4-frame. Values are saved in the
* doctypes config file.
*
* @access public
@@ -258,13 +259,13 @@ if ( ! function_exists('doctype'))
if ( ! is_array($_doctypes))
{
- if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/doctypes'.EXT))
+ if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/doctypes.php'))
{
- include(APPPATH.'config/'.ENVIRONMENT.'/doctypes'.EXT);
+ include(APPPATH.'config/'.ENVIRONMENT.'/doctypes.php');
}
- elseif (is_file(APPPATH.'config/doctypes'.EXT))
+ elseif (is_file(APPPATH.'config/doctypes.php'))
{
- include(APPPATH.'config/doctypes'.EXT);
+ include(APPPATH.'config/doctypes.php');
}
if ( ! is_array($_doctypes))
diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php
index 4cd7486b4..2352b642e 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 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
@@ -41,20 +41,22 @@ if ( ! function_exists('singular'))
{
function singular($str)
{
- $str = strtolower(trim($str));
+ $str = trim($str);
$end = substr($str, -3);
- if ($end == 'ies')
+ $str = preg_replace('/(.*)?([s|c]h)es/i','$1$2',$str);
+
+ if (strtolower($end) == 'ies')
{
- $str = substr($str, 0, strlen($str)-3).'y';
+ $str = substr($str, 0, strlen($str)-3).(preg_match('/[a-z]/',$end) ? 'y' : 'Y');
}
- elseif ($end == 'ses')
+ elseif (strtolower($end) == 'ses')
{
$str = substr($str, 0, strlen($str)-2);
}
else
{
- $end = substr($str, -1);
+ $end = strtolower(substr($str, -1));
if ($end == 's')
{
@@ -82,18 +84,18 @@ if ( ! function_exists('plural'))
{
function plural($str, $force = FALSE)
{
- $str = strtolower(trim($str));
+ $str = trim($str);
$end = substr($str, -1);
- if ($end == 'y')
+ if (preg_match('/y/i',$end))
{
// Y preceded by vowel => regular plural
- $vowels = array('a', 'e', 'i', 'o', 'u');
+ $vowels = array('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U');
$str = in_array(substr($str, -2, 1), $vowels) ? $str.'s' : substr($str, 0, -1).'ies';
}
- elseif ($end == 'h')
+ elseif (preg_match('/h/i',$end))
{
- if (substr($str, -2) == 'ch' OR substr($str, -2) == 'sh')
+ if(preg_match('/^[c|s]h$/i',substr($str, -2)))
{
$str .= 'es';
}
@@ -102,7 +104,7 @@ if ( ! function_exists('plural'))
$str .= 's';
}
}
- elseif ($end == 's')
+ elseif (preg_match('/s/i',$end))
{
if ($force == TRUE)
{
diff --git a/system/helpers/language_helper.php b/system/helpers/language_helper.php
index ac0d69da1..e768b453c 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 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php
index 611777559..fc967e8b5 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 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php
index ffcf46842..02b14e836 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 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
@@ -39,7 +39,7 @@ if ( ! function_exists('set_realpath'))
{
function set_realpath($path, $check_existance = FALSE)
{
- // Security check to make sure the path is NOT a URL. No remote file inclusion!
+ // Security check to make sure the path is NOT a URL. No remote file inclusion!
if (preg_match("#^(http:\/\/|https:\/\/|www\.|ftp|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})#i", $path))
{
show_error('The path you submitted must be a local server path, not a URL');
diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php
index 61ebf46f9..a4df65623 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 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
@@ -67,22 +67,6 @@ if ( ! function_exists('sanitize_filename'))
/**
* Hash encode a string
*
- * This is simply an alias for do_hash()
- * dohash() is now deprecated
- */
-if ( ! function_exists('dohash'))
-{
- function dohash($str, $type = 'sha1')
- {
- return do_hash($str, $type);
- }
-}
-
-// --------------------------------------------------------------------
-
-/**
- * Hash encode a string
- *
* @access public
* @param string
* @return string
@@ -93,23 +77,7 @@ if ( ! function_exists('do_hash'))
{
if ($type == 'sha1')
{
- if ( ! function_exists('sha1'))
- {
- if ( ! function_exists('mhash'))
- {
- require_once(BASEPATH.'libraries/Sha1'.EXT);
- $SH = new CI_SHA;
- return $SH->generate($str);
- }
- else
- {
- return bin2hex(mhash(MHASH_SHA1, $str));
- }
- }
- else
- {
- return sha1($str);
- }
+ return sha1($str);
}
else
{
@@ -151,7 +119,7 @@ if ( ! function_exists('encode_php_tags'))
{
function encode_php_tags($str)
{
- return str_replace(array('<?php', '<?PHP', '<?', '?>'), array('&lt;?php', '&lt;?PHP', '&lt;?', '?&gt;'), $str);
+ return str_replace(array('<?php', '<?PHP', '<?', '?>'), array('&lt;?php', '&lt;?PHP', '&lt;?', '?&gt;'), $str);
}
}
diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php
index a2d1031b3..22ca4df77 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 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
@@ -30,7 +30,7 @@
/**
* Smiley Javascript
*
- * Returns the javascript required for the smiley insertion. Optionally takes
+ * Returns the javascript required for the smiley insertion. Optionally takes
* an array of aliases to loosely couple the smiley array to the view.
*
* @access public
@@ -157,7 +157,7 @@ if ( ! function_exists('get_clickable_smileys'))
foreach ($smileys as $key => $val)
{
// Keep duplicates from being used, which can happen if the
- // mapping array contains multiple identical replacements. For example:
+ // mapping array contains multiple identical replacements. For example:
// :-) and :) might be replaced with the same image so both smileys
// will be in the array.
if (isset($used[$smileys[$key][0]]))
@@ -204,7 +204,7 @@ if ( ! function_exists('parse_smileys'))
}
// Add a trailing slash to the file path if needed
- $image_url = preg_replace("/(.+?)\/*$/", "\\1/", $image_url);
+ $image_url = preg_replace("/(.+?)\/*$/", "\\1/", $image_url);
foreach ($smileys as $key => $val)
{
@@ -229,15 +229,15 @@ if ( ! function_exists('_get_smiley_array'))
{
function _get_smiley_array()
{
- if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys'.EXT))
+ if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys.php'))
{
- include(APPPATH.'config/'.ENVIRONMENT.'/smileys'.EXT);
+ include(APPPATH.'config/'.ENVIRONMENT.'/smileys.php');
}
- elseif (file_exists(APPPATH.'config/smileys'.EXT))
+ elseif (file_exists(APPPATH.'config/smileys.php'))
{
- include(APPPATH.'config/smileys'.EXT);
+ include(APPPATH.'config/smileys.php');
}
-
+
if (isset($smileys) AND is_array($smileys))
{
return $smileys;
diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php
index 7765bba31..9f730bd10 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 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
@@ -150,7 +150,7 @@ if ( ! function_exists('reduce_double_slashes'))
/**
* Reduce Multiples
*
- * Reduces multiple instances of a particular character. Example:
+ * Reduces multiple instances of a particular character. Example:
*
* Fred, Bill,, Joe, Jimmy
*
@@ -187,7 +187,7 @@ if ( ! function_exists('reduce_multiples'))
* Useful for generating passwords or hashes.
*
* @access public
- * @param string type of random string. basic, alpha, alunum, numeric, nozero, unique, md5, encrypt and sha1
+ * @param string type of random string. basic, alpha, alunum, numeric, nozero, unique, md5, encrypt and sha1
* @param integer number of characters
* @return string
*/
@@ -245,7 +245,7 @@ if ( ! function_exists('random_string'))
/**
* Alternator
*
- * Allows strings to be alternated. See docs...
+ * Allows strings to be alternated. See docs...
*
* @access public
* @param string (as many parameters as needed)
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php
index cca093976..7d621257f 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 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
@@ -63,7 +63,7 @@ if ( ! function_exists('word_limiter'))
/**
* Character Limiter
*
- * Limits the string based on the character count. Preserves complete words
+ * Limits the string based on the character count. Preserves complete words
* so the character count may not be exactly as specified.
*
* @access public
@@ -133,7 +133,7 @@ if ( ! function_exists('ascii_to_entities'))
*/
if (count($temp) == 1)
{
- $out .= '&#'.array_shift($temp).';';
+ $out .= '&#'.array_shift($temp).';';
$count = 1;
}
@@ -366,13 +366,13 @@ if ( ! function_exists('convert_accented_characters'))
{
function convert_accented_characters($str)
{
- if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars'.EXT))
+ if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php'))
{
- include(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars'.EXT);
+ include(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php');
}
- elseif (is_file(APPPATH.'config/foreign_chars'.EXT))
+ elseif (is_file(APPPATH.'config/foreign_chars.php'))
{
- include(APPPATH.'config/foreign_chars'.EXT);
+ include(APPPATH.'config/foreign_chars.php');
}
if ( ! isset($foreign_characters))
@@ -389,7 +389,7 @@ if ( ! function_exists('convert_accented_characters'))
/**
* Word Wrap
*
- * Wraps text at the specified character. Maintains the integrity of words.
+ * Wraps text at the specified character. Maintains the integrity of words.
* Anything placed between {unwrap}{/unwrap} will not be word wrapped, nor
* will URLs.
*
@@ -429,7 +429,7 @@ if ( ! function_exists('word_wrap'))
// Use PHP's native function to do the initial wordwrap.
// We set the cut flag to FALSE so that any individual words that are
- // too long get left alone. In the next step we'll deal with them.
+ // too long get left alone. In the next step we'll deal with them.
$str = wordwrap($str, $charlim, "\n", FALSE);
// Split the string into individual lines of text and cycle through them
diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php
index 302bf45c5..0cd66738d 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 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
@@ -84,9 +84,8 @@ if ( ! function_exists('entity_decode'))
{
function entity_decode($str, $charset='UTF-8')
{
- $CI =& get_instance();
- $CI->load->library('security');
- return $CI->security->entity_decode($str, $charset);
+ global $SEC;
+ return $SEC->entity_decode($str, $charset);
}
}
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php
index d0516cee6..8e93744fb 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 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
@@ -286,7 +286,7 @@ if ( ! function_exists('safe_mailto'))
{
foreach ($attributes as $key => $val)
{
- $x[] = ' '.$key.'="';
+ $x[] = ' '.$key.'="';
for ($i = 0; $i < strlen($val); $i++)
{
$x[] = "|".ord(substr($val, $i, 1));
@@ -363,7 +363,7 @@ if ( ! function_exists('safe_mailto'))
*
* Automatically links URL and Email addresses.
* Note: There's a bit of extra code here to deal with
- * URLs or emails that end in a period. We'll strip these
+ * URLs or emails that end in a period. We'll strip these
* off and add them after the link.
*
* @access public
diff --git a/system/helpers/xml_helper.php b/system/helpers/xml_helper.php
index cdd81ad70..2219d662a 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 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
@@ -46,7 +46,7 @@ if ( ! function_exists('xml_convert'))
if ($protect_all === TRUE)
{
- $str = preg_replace("/&(\w+);/", "$temp\\1;", $str);
+ $str = preg_replace("/&(\w+);/", "$temp\\1;", $str);
}
$str = str_replace(array("&","<",">","\"", "'", "-"),