diff options
Diffstat (limited to 'system/helpers')
-rw-r--r-- | system/helpers/array_helper.php | 14 | ||||
-rw-r--r-- | system/helpers/compatibility_helper.php | 38 | ||||
-rw-r--r-- | system/helpers/cookie_helper.php | 14 | ||||
-rw-r--r-- | system/helpers/date_helper.php | 42 | ||||
-rw-r--r-- | system/helpers/directory_helper.php | 4 | ||||
-rw-r--r-- | system/helpers/download_helper.php | 10 | ||||
-rw-r--r-- | system/helpers/email_helper.php | 12 | ||||
-rw-r--r-- | system/helpers/file_helper.php | 38 | ||||
-rw-r--r-- | system/helpers/form_helper.php | 70 | ||||
-rw-r--r-- | system/helpers/html_helper.php | 30 | ||||
-rw-r--r-- | system/helpers/inflector_helper.php | 16 | ||||
-rw-r--r-- | system/helpers/path_helper.php | 10 | ||||
-rw-r--r-- | system/helpers/security_helper.php | 18 | ||||
-rw-r--r-- | system/helpers/smiley_helper.php | 22 | ||||
-rw-r--r-- | system/helpers/string_helper.php | 24 | ||||
-rw-r--r-- | system/helpers/text_helper.php | 33 | ||||
-rw-r--r-- | system/helpers/typography_helper.php | 39 | ||||
-rw-r--r-- | system/helpers/url_helper.php | 40 | ||||
-rw-r--r-- | system/helpers/xml_helper.php | 8 |
19 files changed, 244 insertions, 238 deletions
diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php index 837e41f14..faa90373c 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
*
@@ -39,11 +39,11 @@ * @param mixed
* @return mixed depends on what the array contains
*/
-if (! function_exists('element'))
+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;
}
@@ -61,11 +61,11 @@ if (! function_exists('element')) * @param array
* @return mixed depends on what the array contains
*/
-if (! function_exists('random_element'))
+if ( ! function_exists('random_element'))
{
function random_element($array)
{
- if (! is_array($array))
+ if ( ! is_array($array))
{
return $array;
}
@@ -73,6 +73,6 @@ if (! function_exists('random_element')) }
}
- -/* End of file array_helper.php */ +
+/* End of file array_helper.php */
/* Location: ./system/helpers/array_helper.php */
\ No newline at end of file diff --git a/system/helpers/compatibility_helper.php b/system/helpers/compatibility_helper.php index 076f677fa..077ac674e 100644 --- a/system/helpers/compatibility_helper.php +++ b/system/helpers/compatibility_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 * @@ -35,7 +35,7 @@ // ------------------------------------------------------------------------ -if (! defined('PHP_EOL')) +if ( ! defined('PHP_EOL')) { define('PHP_EOL', (DIRECTORY_SEPARATOR == '/') ? "\n" : "\r\n"); } @@ -55,7 +55,7 @@ if (! defined('PHP_EOL')) * @param int flags * @return int length of written string */ -if (! function_exists('file_put_contents')) +if ( ! function_exists('file_put_contents')) { function file_put_contents($filename, $data, $flags = NULL) { @@ -64,7 +64,7 @@ if (! function_exists('file_put_contents')) settype($data, 'STRING'); } - if (! is_string($data) && ! is_array($data) && ! is_resource($data)) + if ( ! is_string($data) && ! is_array($data) && ! is_resource($data)) { $backtrace = debug_backtrace(); _exception_handler(E_USER_WARNING, 'file_put_contents(): the 2nd parameter should be either a string or an array', $backtrace[0]['file'], $backtrace[0]['line']); @@ -83,7 +83,7 @@ if (! function_exists('file_put_contents')) $text = ''; - while (! feof($data)) + while ( ! feof($data)) { $text .= fread($data, 4096); } @@ -129,7 +129,7 @@ if (! function_exists('file_put_contents')) if (($flags & LOCK_EX) > 0) { - if (! flock($fp, LOCK_EX)) + if ( ! flock($fp, LOCK_EX)) { $backtrace = debug_backtrace(); _exception_handler(E_USER_WARNING, 'file_put_contents('.htmlentities($filename).') unable to acquire an exclusive lock on file', $backtrace[0]['file'], $backtrace[0]['line']); @@ -167,12 +167,12 @@ if (! function_exists('file_put_contents')) * @param string enclosure * @return int length of written string */ -if (! function_exists('fputcsv')) +if ( ! function_exists('fputcsv')) { function fputcsv($handle, $fields, $delimiter = ',', $enclosure = '"') { // Checking for a handle resource - if (! is_resource($handle)) + if ( ! is_resource($handle)) { $backtrace = debug_backtrace(); _exception_handler(E_USER_WARNING, 'fputcsv() expects parameter 1 to be stream resource, '.gettype($handle).' given', $backtrace[0]['file'], $backtrace[0]['line']); @@ -188,7 +188,7 @@ if (! function_exists('fputcsv')) } // Checking for an array of fields - if (! is_array($fields)) + if ( ! is_array($fields)) { $backtrace = debug_backtrace(); _exception_handler(E_USER_WARNING, 'fputcsv() expects parameter 2 to be array, '.gettype($fields).' given', $backtrace[0]['file'], $backtrace[0]['line']); @@ -218,7 +218,7 @@ if (! function_exists('fputcsv')) { $cell = str_replace($enclosure, $enclosure.$enclosure, $cell); - if (strpos($cell, $delimiter) !== FALSE || strpos($cell, $enclosure) !== FALSE || strpos($cell, "\n") !== FALSE) + if (strpos($cell, $delimiter) !== FALSE OR strpos($cell, $enclosure) !== FALSE OR strpos($cell, "\n") !== FALSE) { $out .= $enclosure.$cell.$enclosure.$delimiter; } @@ -248,7 +248,7 @@ if (! function_exists('fputcsv')) * @param int offset * @return int numeric position of the first occurrence of needle in the haystack */ -if (! function_exists('stripos')) +if ( ! function_exists('stripos')) { function stripos($haystack, $needle, $offset = NULL) { @@ -258,14 +258,14 @@ if (! function_exists('stripos')) settype($haystack, 'STRING'); } - if (! is_string($haystack)) + if ( ! is_string($haystack)) { $backtrace = debug_backtrace(); _exception_handler(E_USER_WARNING, 'stripos() expects parameter 1 to be string, '.gettype($haystack).' given', $backtrace[0]['file'], $backtrace[0]['line']); return FALSE; } - if (! is_scalar($needle)) + if ( ! is_scalar($needle)) { $backtrace = debug_backtrace(); _exception_handler(E_USER_WARNING, 'stripos() needle is not a string or an integer in '.$backtrace[0]['file'], $backtrace[0]['line']); @@ -277,7 +277,7 @@ if (! function_exists('stripos')) $offset = (int)$offset; } - if (! is_int($offset) && ! is_bool($offset) && ! is_null($offset)) + if ( ! is_int($offset) && ! is_bool($offset) && ! is_null($offset)) { $backtrace = debug_backtrace(); _exception_handler(E_USER_WARNING, 'stripos() expects parameter 3 to be long, '.gettype($offset).' given', $backtrace[0]['file'], $backtrace[0]['line']); @@ -304,12 +304,12 @@ if (! function_exists('stripos')) * @param mixed subject * @return int numeric position of the first occurrence of needle in the haystack */ -if (! function_exists('str_ireplace')) +if ( ! function_exists('str_ireplace')) { function str_ireplace($search, $replace, $subject) { // Nothing to do here - if ($search === NULL || $subject === NULL) + if ($search === NULL OR $subject === NULL) { return $subject; } @@ -376,7 +376,7 @@ if (! function_exists('str_ireplace')) $result = preg_replace($search, $replace, (array)$subject); // Check if subject was initially a string and return it as a string - if (! is_array($subject)) + if ( ! is_array($subject)) { return current($result); } @@ -400,12 +400,12 @@ if (! function_exists('str_ireplace')) * @param string argument separator * @return string URL-encoded string */ -if (! function_exists('http_build_query')) +if ( ! function_exists('http_build_query')) { function http_build_query($formdata, $numeric_prefix = NULL, $separator = NULL) { // Check the data - if (! is_array($formdata) && ! is_object($formdata)) + if ( ! is_array($formdata) && ! is_object($formdata)) { $backtrace = debug_backtrace(); _exception_handler(E_USER_WARNING, 'http_build_query() Parameter 1 expected to be Array or Object. Incorrect value given', $backtrace[0]['file'], $backtrace[0]['line']); diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php index 7b8989e3b..821622649 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
*
@@ -42,7 +42,7 @@ * @param string the cookie prefix
* @return void
*/
-if (! function_exists('set_cookie'))
+if ( ! function_exists('set_cookie'))
{
function set_cookie($name = '', $value = '', $expire = '', $domain = '', $path = '/', $prefix = '')
{
@@ -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;
}
@@ -103,7 +103,7 @@ if (! function_exists('set_cookie')) * @param bool
* @return mixed
*/
-if (! function_exists('get_cookie'))
+if ( ! function_exists('get_cookie'))
{
function get_cookie($index = '', $xss_clean = FALSE)
{
@@ -123,7 +123,7 @@ if (! function_exists('get_cookie')) * @param string the cookie prefix
* @return void
*/
-if (! function_exists('delete_cookie'))
+if ( ! function_exists('delete_cookie'))
{
function delete_cookie($name = '', $domain = '', $path = '/', $prefix = '')
{
@@ -131,6 +131,6 @@ if (! function_exists('delete_cookie')) }
}
- -/* End of file cookie_helper.php */ +
+/* End of file cookie_helper.php */
/* Location: ./system/helpers/cookie_helper.php */
\ No newline at end of file diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index c4f0e9a40..095e460a9 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
*
@@ -35,7 +35,7 @@ * @access public
* @return integer
*/
-if (! function_exists('now'))
+if ( ! function_exists('now'))
{
function now()
{
@@ -80,7 +80,7 @@ if (! function_exists('now')) * @param integer
* @return integer
*/
-if (! function_exists('mdate'))
+if ( ! function_exists('mdate'))
{
function mdate($datestr = '', $time = '')
{
@@ -107,7 +107,7 @@ if (! function_exists('mdate')) * @param integer Unix timestamp
* @return string
*/
-if (! function_exists('standard_date'))
+if ( ! function_exists('standard_date'))
{
function standard_date($fmt = 'DATE_RFC822', $time = '')
{
@@ -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;
}
@@ -145,19 +145,19 @@ if (! function_exists('standard_date')) * @param integer Unix timestamp
* @return integer
*/
-if (! function_exists('timespan'))
+if ( ! function_exists('timespan'))
{
function timespan($seconds = 1, $time = '')
{
$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();
}
@@ -262,7 +262,7 @@ if (! function_exists('timespan')) * @param integer a numeric year
* @return integer
*/
-if (! function_exists('days_in_month'))
+if ( ! function_exists('days_in_month'))
{
function days_in_month($month = 0, $year = '')
{
@@ -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');
}
@@ -298,7 +298,7 @@ if (! function_exists('days_in_month')) * @param integer Unix timestamp
* @return integer
*/
-if (! function_exists('local_to_gmt'))
+if ( ! function_exists('local_to_gmt'))
{
function local_to_gmt($time = '')
{
@@ -324,7 +324,7 @@ if (! function_exists('local_to_gmt')) * @param bool whether DST is active
* @return integer
*/
-if (! function_exists('gmt_to_local'))
+if ( ! function_exists('gmt_to_local'))
{
function gmt_to_local($time = '', $timezone = 'UTC', $dst = FALSE)
{
@@ -353,7 +353,7 @@ if (! function_exists('gmt_to_local')) * @param integer Unix timestamp
* @return integer
*/
-if (! function_exists('mysql_to_unix'))
+if ( ! function_exists('mysql_to_unix'))
{
function mysql_to_unix($time = '')
{
@@ -390,7 +390,7 @@ if (! function_exists('mysql_to_unix')) * @param string format: us or euro
* @return string
*/
-if (! function_exists('unix_to_human'))
+if ( ! function_exists('unix_to_human'))
{
function unix_to_human($time = '', $seconds = FALSE, $fmt = 'us')
{
@@ -430,7 +430,7 @@ if (! function_exists('unix_to_human')) * @param string format: us or euro
* @return integer
*/
-if (! function_exists('human_to_unix'))
+if ( ! function_exists('human_to_unix'))
{
function human_to_unix($datestr = '')
{
@@ -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;
}
@@ -501,7 +501,7 @@ if (! function_exists('human_to_unix')) * @param string menu name
* @return string
*/
-if (! function_exists('timezone_menu'))
+if ( ! function_exists('timezone_menu'))
{
function timezone_menu($default = 'UTC', $class = "", $name = 'timezones')
{
@@ -544,7 +544,7 @@ if (! function_exists('timezone_menu')) * @param string timezone
* @return string
*/
-if (! function_exists('timezones'))
+if ( ! function_exists('timezones'))
{
function timezones($tz = '')
{
@@ -592,10 +592,10 @@ if (! function_exists('timezones')) if ($tz == 'GMT')
$tz = 'UTC';
- return (! isset($zones[$tz])) ? 0 : $zones[$tz];
+ return ( ! isset($zones[$tz])) ? 0 : $zones[$tz];
}
}
- -/* End of file date_helper.php */ +
+/* End of file date_helper.php */
/* Location: ./system/helpers/date_helper.php */
\ No newline at end of file diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php index d00bdf0aa..1bf694f0b 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
*
@@ -39,7 +39,7 @@ * @param bool whether to limit the result to the top level only
* @return array
*/
-if (! function_exists('directory_map'))
+if ( ! function_exists('directory_map'))
{
function directory_map($source_dir, $top_level_only = FALSE)
{
diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 2096fd849..53191c7a9 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
*
@@ -37,7 +37,7 @@ * @param mixed the data to be downloaded
* @return void
*/
-if (! function_exists('force_download'))
+if ( ! function_exists('force_download'))
{
function force_download($filename = '', $data = '')
{
@@ -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';
}
@@ -95,6 +95,6 @@ if (! function_exists('force_download')) }
}
- -/* End of file download_helper.php */ +
+/* End of file download_helper.php */
/* Location: ./system/helpers/download_helper.php */
\ No newline at end of file diff --git a/system/helpers/email_helper.php b/system/helpers/email_helper.php index 594a030fe..496d61203 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
*
@@ -33,11 +33,11 @@ * @access public
* @return bool
*/
-if (! function_exists('valid_email'))
+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;
}
}
@@ -49,7 +49,7 @@ if (! function_exists('valid_email')) * @access public
* @return bool
*/
-if (! function_exists('send_email'))
+if ( ! function_exists('send_email'))
{
function send_email($recipient, $subject = 'Test email', $message = 'Hello World')
{
@@ -57,6 +57,6 @@ if (! function_exists('send_email')) }
}
- -/* End of file email_helper.php */ +
+/* End of file email_helper.php */
/* Location: ./system/helpers/email_helper.php */
\ No newline at end of file diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index fac916f3d..0d33fe3f2 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
*
@@ -36,11 +36,11 @@ * @param string path to file
* @return string
*/
-if (! function_exists('read_file'))
+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, FOPEN_READ))
+ if ( ! $fp = @fopen($file, FOPEN_READ))
{
return FALSE;
}
@@ -83,11 +83,11 @@ if (! function_exists('read_file')) * @param string file data
* @return bool
*/
-if (! function_exists('write_file'))
+if ( ! function_exists('write_file'))
{
function write_file($path, $data, $mode = FOPEN_WRITE_CREATE_DESTRUCTIVE)
{
- if (! $fp = fopen($path, $mode))
+ if ( ! $fp = fopen($path, $mode))
{
return FALSE;
}
@@ -116,14 +116,14 @@ if (! function_exists('write_file')) * @param bool whether to delete any directories found in the path
* @return bool
*/
-if (! function_exists('delete_files'))
+if ( ! function_exists('delete_files'))
{
function delete_files($path, $del_dir = FALSE, $level = 0)
{
// 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)))
@@ -163,7 +163,7 @@ if (! function_exists('delete_files')) * @param bool internal variable to determine recursion status - do not use in calls
* @return array
*/
-if (! function_exists('get_filenames'))
+if ( ! function_exists('get_filenames'))
{
function get_filenames($source_dir, $include_path = FALSE, $_recursion = FALSE)
{
@@ -215,7 +215,7 @@ if (! function_exists('get_filenames')) * @param bool internal variable to determine recursion status - do not use in calls
* @return array
*/
-if (! function_exists('get_dir_file_info'))
+if ( ! function_exists('get_dir_file_info'))
{
function get_dir_file_info($source_dir, $include_path = FALSE, $_recursion = FALSE)
{
@@ -267,12 +267,12 @@ if (! function_exists('get_dir_file_info')) * @param mixed array or comma separated string of information returned
* @return array
*/
-if (! function_exists('get_file_info'))
+if ( ! function_exists('get_file_info'))
{
function get_file_info($file, $returned_values = array('name', 'server_path', 'size', 'date'))
{
- if (! file_exists($file))
+ if ( ! file_exists($file))
{
return FALSE;
}
@@ -333,7 +333,7 @@ if (! function_exists('get_file_info')) * @param string path to file
* @return mixed
*/
-if (! function_exists('get_mime_by_extension'))
+if ( ! function_exists('get_mime_by_extension'))
{
function get_mime_by_extension($file)
{
@@ -341,9 +341,9 @@ if (! function_exists('get_mime_by_extension')) global $mimes;
- if (! is_array($mimes))
+ if ( ! is_array($mimes))
{
- if (! require_once(APPPATH.'config/mimes.php'))
+ if ( ! require_once(APPPATH.'config/mimes.php'))
{
return FALSE;
}
@@ -380,7 +380,7 @@ if (! function_exists('get_mime_by_extension')) * @param int
* @return string
*/
-if (! function_exists('symbolic_permissions'))
+if ( ! function_exists('symbolic_permissions'))
{
function symbolic_permissions($perms)
{
@@ -448,7 +448,7 @@ if (! function_exists('symbolic_permissions')) * @param int
* @return string
*/
-if (! function_exists('octal_permissions'))
+if ( ! function_exists('octal_permissions'))
{
function octal_permissions($perms)
{
@@ -456,6 +456,6 @@ if (! function_exists('octal_permissions')) }
}
- -/* End of file file_helper.php */ +
+/* End of file file_helper.php */
/* Location: ./system/helpers/file_helper.php */
\ No newline at end of file diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index 541ab844a..c6aa0d2b4 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
*
@@ -38,7 +38,7 @@ * @param array a key/value pair hidden data
* @return string
*/
-if (! function_exists('form_open'))
+if ( ! function_exists('form_open'))
{
function form_open($action = '', $attributes = array(), $hidden = array())
{
@@ -48,7 +48,7 @@ if (! function_exists('form_open')) $form = '<form action="'.$action.'"';
- if (! isset($attributes['method']))
+ if ( ! isset($attributes['method']))
{
$form .= ' method="post"';
}
@@ -85,7 +85,7 @@ if (! function_exists('form_open')) * @param array a key/value pair hidden data
* @return string
*/
-if (! function_exists('form_open_multipart'))
+if ( ! function_exists('form_open_multipart'))
{
function form_open_multipart($action, $attributes = array(), $hidden = array())
{
@@ -107,11 +107,11 @@ if (! function_exists('form_open_multipart')) * @param string
* @return string
*/
-if (! function_exists('form_hidden'))
+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).'" />';
}
@@ -137,11 +137,11 @@ if (! function_exists('form_hidden')) * @param string
* @return string
*/
-if (! function_exists('form_input'))
+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";
}
@@ -160,11 +160,11 @@ if (! function_exists('form_input')) * @param string
* @return string
*/
-if (! function_exists('form_password'))
+if ( ! function_exists('form_password'))
{
function form_password($data = '', $value = '', $extra = '')
{
- if (! is_array($data))
+ if ( ! is_array($data))
{
$data = array('name' => $data);
}
@@ -187,11 +187,11 @@ if (! function_exists('form_password')) * @param string
* @return string
*/
-if (! function_exists('form_upload'))
+if ( ! function_exists('form_upload'))
{
function form_upload($data = '', $value = '', $extra = '')
{
- if (! is_array($data))
+ if ( ! is_array($data))
{
$data = array('name' => $data);
}
@@ -212,13 +212,13 @@ if (! function_exists('form_upload')) * @param string
* @return string
*/
-if (! function_exists('form_textarea'))
+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;
}
@@ -244,11 +244,11 @@ if (! function_exists('form_textarea')) * @param string
* @return string
*/
-if (! function_exists('form_dropdown'))
+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);
}
@@ -287,11 +287,11 @@ if (! function_exists('form_dropdown')) * @param string
* @return string
*/
-if (! function_exists('form_checkbox'))
+if ( ! function_exists('form_checkbox'))
{
function form_checkbox($data = '', $value = '', $checked = FALSE, $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))
{
@@ -328,11 +328,11 @@ if (! function_exists('form_checkbox')) * @param string
* @return string
*/
-if (! function_exists('form_radio'))
+if ( ! function_exists('form_radio'))
{
function form_radio($data = '', $value = '', $checked = FALSE, $extra = '')
{
- if (! is_array($data))
+ if ( ! is_array($data))
{
$data = array('name' => $data);
}
@@ -353,11 +353,11 @@ if (! function_exists('form_radio')) * @param string
* @return string
*/
-if (! function_exists('form_submit'))
+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";
}
@@ -374,11 +374,11 @@ if (! function_exists('form_submit')) * @param string
* @return string
*/
-if (! function_exists('form_reset'))
+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";
}
@@ -395,11 +395,11 @@ if (! function_exists('form_reset')) * @param string
* @return string
*/
-if (! function_exists('form_button'))
+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']))
{
@@ -422,7 +422,7 @@ if (! function_exists('form_button')) * @param string Additional attributes
* @return string
*/
-if (! function_exists('form_label'))
+if ( ! function_exists('form_label'))
{
function form_label($label_text = '', $id = '', $attributes = array())
{
@@ -460,7 +460,7 @@ if (! function_exists('form_label')) * @param string Additional attributes
* @return string
*/
-if (! function_exists('form_fieldset'))
+if ( ! function_exists('form_fieldset'))
{
function form_fieldset($legend_text = '', $attributes = array())
{
@@ -497,7 +497,7 @@ if (! function_exists('form_fieldset')) * @param string
* @return string
*/
-if (! function_exists('form_fieldset_close'))
+if ( ! function_exists('form_fieldset_close'))
{
function form_fieldset_close($extra = '')
{
@@ -514,7 +514,7 @@ if (! function_exists('form_fieldset_close')) * @param string
* @return string
*/
-if (! function_exists('form_close'))
+if ( ! function_exists('form_close'))
{
function form_close($extra = '')
{
@@ -533,7 +533,7 @@ if (! function_exists('form_close')) * @param string
* @return string
*/
-if (! function_exists('form_prep'))
+if ( ! function_exists('form_prep'))
{
function form_prep($str = '')
{
@@ -574,7 +574,7 @@ if (! function_exists('form_prep')) * @param array
* @return string
*/
-if (! function_exists('parse_form_attributes'))
+if ( ! function_exists('parse_form_attributes'))
{
function parse_form_attributes($attributes, $default)
{
@@ -610,6 +610,6 @@ if (! function_exists('parse_form_attributes')) }
}
- -/* End of file form_helper.php */ +
+/* End of file form_helper.php */
/* Location: ./system/helpers/form_helper.php */
\ No newline at end of file diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 592c33a50..7a61055f7 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
*
@@ -38,7 +38,7 @@ * @param integer
* @return string
*/
-if (! function_exists('heading'))
+if ( ! function_exists('heading'))
{
function heading($data = '', $h = '1')
{
@@ -58,7 +58,7 @@ if (! function_exists('heading')) * @param mixed
* @return string
*/
-if (! function_exists('ul'))
+if ( ! function_exists('ul'))
{
function ul($list, $attributes = '')
{
@@ -78,7 +78,7 @@ if (! function_exists('ul')) * @param mixed
* @return string
*/
-if (! function_exists('ol'))
+if ( ! function_exists('ol'))
{
function ol($list, $attributes = '')
{
@@ -100,12 +100,12 @@ if (! function_exists('ol')) * @param intiger
* @return string
*/
-if (! function_exists('_list'))
+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;
}
@@ -171,7 +171,7 @@ if (! function_exists('_list')) * @param integer
* @return string
*/
-if (! function_exists('br'))
+if ( ! function_exists('br'))
{
function br($num = 1)
{
@@ -190,11 +190,11 @@ if (! function_exists('br')) * @param mixed
* @return string
*/
-if (! function_exists('img'))
+if ( ! function_exists('img'))
{
function img($src = '', $index_page = FALSE)
{
- if (! is_array($src) )
+ if ( ! is_array($src) )
{
$src = array('src' => $src);
}
@@ -245,7 +245,7 @@ if (! function_exists('img')) * @param boolean should index_page be added to the css path
* @return string
*/
-if (! function_exists('link_tag'))
+if ( ! function_exists('link_tag'))
{
function link_tag($href = '', $rel = 'stylesheet', $type = 'text/css', $title = '', $media = '', $index_page = FALSE)
{
@@ -320,7 +320,7 @@ if (! function_exists('link_tag')) * @param array
* @return string
*/
-if (! function_exists('meta'))
+if ( ! function_exists('meta'))
{
function meta($meta = array(), $newline = "\n")
{
@@ -343,7 +343,7 @@ if (! function_exists('meta')) * @param integer
* @return string
*/
-if (! function_exists('nbs'))
+if ( ! function_exists('nbs'))
{
function nbs($num = 1)
{
@@ -351,6 +351,6 @@ if (! function_exists('nbs')) }
}
- -/* End of file html_helper.php */ +
+/* End of file html_helper.php */
/* Location: ./system/helpers/html_helper.php */
\ No newline at end of file diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index b0b99be54..49ba542a1 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
*
@@ -37,7 +37,7 @@ * @param string
* @return str
*/
-if (! function_exists('singular'))
+if ( ! function_exists('singular'))
{
function singular($str)
{
@@ -78,7 +78,7 @@ if (! function_exists('singular')) * @param bool
* @return str
*/
-if (! function_exists('plural'))
+if ( ! function_exists('plural'))
{
function plural($str, $force = FALSE)
{
@@ -116,7 +116,7 @@ if (! function_exists('plural')) * @param string
* @return str
*/
-if (! function_exists('camelize'))
+if ( ! function_exists('camelize'))
{
function camelize($str)
{
@@ -137,7 +137,7 @@ if (! function_exists('camelize')) * @param string
* @return str
*/
-if (! function_exists('underscore'))
+if ( ! function_exists('underscore'))
{
function underscore($str)
{
@@ -156,7 +156,7 @@ if (! function_exists('underscore')) * @param string
* @return str
*/
-if (! function_exists('humanize'))
+if ( ! function_exists('humanize'))
{
function humanize($str)
{
@@ -164,6 +164,6 @@ if (! function_exists('humanize')) }
}
- -/* End of file inflector_helper.php */ +
+/* End of file inflector_helper.php */
/* Location: ./system/helpers/inflector_helper.php */
\ No newline at end of file diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php index 05bbd0027..2810b29e2 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
*
@@ -35,7 +35,7 @@ * @param bool checks to see if the path exists
* @return string
*/
-if (! function_exists('set_realpath'))
+if ( ! function_exists('set_realpath'))
{
function set_realpath($path, $check_existance = TRUE)
{
@@ -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);
}
@@ -67,6 +67,6 @@ if (! function_exists('set_realpath')) }
}
- -/* End of file path_helper.php */ +
+/* End of file path_helper.php */
/* Location: ./system/helpers/path_helper.php */
\ No newline at end of file diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php index 0dc1429dd..8391c2d7b 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
*
@@ -35,7 +35,7 @@ * @param string the character set of your data
* @return string
*/
-if (! function_exists('xss_clean'))
+if ( ! function_exists('xss_clean'))
{
function xss_clean($str, $charset = 'ISO-8859-1')
{
@@ -53,15 +53,15 @@ if (! function_exists('xss_clean')) * @param string
* @return string
*/
-if (! function_exists('dohash'))
+if ( ! function_exists('dohash'))
{
function dohash($str, $type = 'sha1')
{
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;
@@ -93,7 +93,7 @@ if (! function_exists('dohash')) * @param string
* @return string
*/
-if (! function_exists('strip_image_tags'))
+if ( ! function_exists('strip_image_tags'))
{
function strip_image_tags($str)
{
@@ -113,7 +113,7 @@ if (! function_exists('strip_image_tags')) * @param string
* @return string
*/
-if (! function_exists('encode_php_tags'))
+if ( ! function_exists('encode_php_tags'))
{
function encode_php_tags($str)
{
@@ -121,6 +121,6 @@ if (! function_exists('encode_php_tags')) }
}
- -/* End of file security_helper.php */ +
+/* End of file security_helper.php */
/* Location: ./system/helpers/security_helper.php */
\ No newline at end of file diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php index 2162ddda0..8f7543746 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
*
@@ -37,7 +37,7 @@ * @param string field name
* @return string
*/
-if (! function_exists('js_insert_smiley'))
+if ( ! function_exists('js_insert_smiley'))
{
function js_insert_smiley($form_name = '', $form_field = '')
{
@@ -63,11 +63,11 @@ EOF; * @param string the URL to the folder containing the smiley images
* @return array
*/
-if (! function_exists('get_clickable_smileys'))
+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()))
{
@@ -111,7 +111,7 @@ if (! function_exists('get_clickable_smileys')) * @param string the URL to the folder containing the smiley images
* @return string
*/
-if (! function_exists('parse_smileys'))
+if ( ! function_exists('parse_smileys'))
{
function parse_smileys($str = '', $image_url = '', $smileys = NULL)
{
@@ -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()))
{
@@ -150,18 +150,18 @@ if (! function_exists('parse_smileys')) * @access private
* @return mixed
*/
-if (! function_exists('_get_smiley_array'))
+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;
}
@@ -170,6 +170,6 @@ if (! function_exists('_get_smiley_array')) }
}
- -/* End of file smiley_helper.php */ +
+/* End of file smiley_helper.php */
/* Location: ./system/helpers/smiley_helper.php */
\ No newline at end of file diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php index b934723bf..7b6becffe 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
*
@@ -42,7 +42,7 @@ * @param string
* @return string
*/
-if (! function_exists('trim_slashes'))
+if ( ! function_exists('trim_slashes'))
{
function trim_slashes($str)
{
@@ -61,7 +61,7 @@ if (! function_exists('trim_slashes')) * @param mixed string or array
* @return mixed string or array
*/
-if (! function_exists('strip_slashes'))
+if ( ! function_exists('strip_slashes'))
{
function strip_slashes($str)
{
@@ -92,7 +92,7 @@ if (! function_exists('strip_slashes')) * @param string
* @return string
*/
-if (! function_exists('strip_quotes'))
+if ( ! function_exists('strip_quotes'))
{
function strip_quotes($str)
{
@@ -111,7 +111,7 @@ if (! function_exists('strip_quotes')) * @param string
* @return string
*/
-if (! function_exists('quotes_to_entities'))
+if ( ! function_exists('quotes_to_entities'))
{
function quotes_to_entities($str)
{
@@ -136,7 +136,7 @@ if (! function_exists('quotes_to_entities')) * @param string
* @return string
*/
-if (! function_exists('reduce_double_slashes'))
+if ( ! function_exists('reduce_double_slashes'))
{
function reduce_double_slashes($str)
{
@@ -163,7 +163,7 @@ if (! function_exists('reduce_double_slashes')) * @param bool TRUE/FALSE - whether to trim the character from the beginning/end
* @return string
*/
-if (! function_exists('reduce_multiples'))
+if ( ! function_exists('reduce_multiples'))
{
function reduce_multiples($str, $character = ',', $trim = FALSE)
{
@@ -190,7 +190,7 @@ if (! function_exists('reduce_multiples')) * @param integer number of characters
* @return string
*/
-if (! function_exists('random_string'))
+if ( ! function_exists('random_string'))
{
function random_string($type = 'alnum', $len = 8)
{
@@ -234,7 +234,7 @@ if (! function_exists('random_string')) * @param string (as many parameters as needed)
* @return string
*/
-if (! function_exists('alternator'))
+if ( ! function_exists('alternator'))
{
function alternator()
{
@@ -260,7 +260,7 @@ if (! function_exists('alternator')) * @param integer number of repeats
* @return string
*/
-if (! function_exists('repeater'))
+if ( ! function_exists('repeater'))
{
function repeater($data, $num = 1)
{
@@ -268,6 +268,6 @@ if (! function_exists('repeater')) }
}
- -/* End of file string_helper.php */ +
+/* End of file string_helper.php */
/* Location: ./system/helpers/string_helper.php */
\ No newline at end of file diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php index 2d03699f3..18f33d2b3 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
*
@@ -38,7 +38,7 @@ * @param string the end character. Usually an ellipsis
* @return string
*/
-if (! function_exists('word_limiter'))
+if ( ! function_exists('word_limiter'))
{
function word_limiter($str, $limit = 100, $end_char = '…')
{
@@ -72,7 +72,7 @@ if (! function_exists('word_limiter')) * @param string the end character. Usually an ellipsis
* @return string
*/
-if (! function_exists('character_limiter'))
+if ( ! function_exists('character_limiter'))
{
function character_limiter($str, $n = 500, $end_char = '…')
{
@@ -81,7 +81,7 @@ if (! function_exists('character_limiter')) return $str;
}
- $str = preg_replace("/\s+/", ' ', preg_replace("/(\r\n|\r|\n)/", " ", $str));
+ $str = preg_replace("/\s+/", ' ', str_replace(array("\r\n", "\r", "\n"), ' ', $str));
if (strlen($str) <= $n)
{
@@ -111,7 +111,7 @@ if (! function_exists('character_limiter')) * @param string
* @return string
*/
-if (! function_exists('ascii_to_entities'))
+if ( ! function_exists('ascii_to_entities'))
{
function ascii_to_entities($str)
{
@@ -163,7 +163,7 @@ if (! function_exists('ascii_to_entities')) * @param bool
* @return string
*/
-if (! function_exists('entities_to_ascii'))
+if ( ! function_exists('entities_to_ascii'))
{
function entities_to_ascii($str, $all = TRUE)
{
@@ -222,11 +222,11 @@ if (! function_exists('entities_to_ascii')) * @param string the optional replacement value
* @return string
*/
-if (! function_exists('word_censor'))
+if ( ! function_exists('word_censor'))
{
function word_censor($str, $censored, $replacement = '')
{
- if (! is_array($censored))
+ if ( ! is_array($censored))
{
return $str;
}
@@ -259,7 +259,7 @@ if (! function_exists('word_censor')) * @param string the text string
* @return string
*/
-if (! function_exists('highlight_code'))
+if ( ! function_exists('highlight_code'))
{
function highlight_code($str)
{
@@ -317,7 +317,7 @@ if (! function_exists('highlight_code')) * @param string the closing tag to end the phrase with
* @return string
*/
-if (! function_exists('highlight_phrase'))
+if ( ! function_exists('highlight_phrase'))
{
function highlight_phrase($str, $phrase, $tag_open = '<strong>', $tag_close = '</strong>')
{
@@ -349,19 +349,22 @@ if (! function_exists('highlight_phrase')) * @param integer the number of characters to wrap at
* @return string
*/
-if (! function_exists('word_wrap'))
+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
$str = preg_replace("| +|", " ", $str);
// Standardize newlines
- $str = preg_replace("/\r\n|\r/", "\n", $str);
+ if (strpos($str, "\r") !== FALSE)
+ {
+ $str = str_replace(array("\r\n", "\r"), "\n", $str);
+ }
// If the current word is surrounded by {unwrap} tags we'll
// strip the entire chunk and replace it with a marker.
@@ -436,6 +439,6 @@ if (! function_exists('word_wrap')) }
}
- -/* End of file text_helper.php */ +
+/* End of file text_helper.php */
/* Location: ./system/helpers/text_helper.php */
\ No newline at end of file diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php index 78ade5cc3..cfb2b94f6 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
*
@@ -34,7 +34,7 @@ * @param string
* @return string
*/
-if (! function_exists('nl2br_except_pre'))
+if ( ! function_exists('nl2br_except_pre'))
{
function nl2br_except_pre($str)
{
@@ -71,7 +71,7 @@ if (! function_exists('nl2br_except_pre')) * @param string
* @return string
*/
-if (! function_exists('auto_typography'))
+if ( ! function_exists('auto_typography'))
{
function auto_typography($str)
{
@@ -117,7 +117,10 @@ class Auto_typography { $str = ' '.$str.' ';
// Standardize Newlines to make matching easier
- $str = preg_replace("/(\r\n|\r)/", "\n", $str);
+ if (strpos($str, "\r") !== FALSE)
+ {
+ $str = str_replace(array("\r\n", "\r"), "\n", $str);
+ }
/*
* Reduce line breaks
@@ -330,13 +333,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."“‘".$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."”’".$one_after,
@@ -363,7 +366,7 @@ class Auto_typography { $one_before."‘“".$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."’”".$one_after,
@@ -378,7 +381,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]."“".$matches['2'][$i]."”".$matches['3'][$i],
@@ -391,7 +394,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]."‘".$matches['2'][$i]."’".$matches['3'][$i],
@@ -412,7 +415,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."’".$one_after,
@@ -435,9 +438,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 +471,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."“".$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."”".$one_after,
@@ -495,13 +498,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."‘".$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."’".$one_after,
@@ -542,6 +545,6 @@ class Auto_typography { }
- -/* End of file typography_helper.php */ +
+/* End of file typography_helper.php */
/* Location: ./system/helpers/typography_helper.php */
\ No newline at end of file diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 32d2da80e..16dd3e021 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
*
@@ -37,7 +37,7 @@ * @param string
* @return string
*/
-if (! function_exists('site_url'))
+if ( ! function_exists('site_url'))
{
function site_url($uri = '')
{
@@ -56,7 +56,7 @@ if (! function_exists('site_url')) * @access public
* @return string
*/
-if (! function_exists('base_url'))
+if ( ! function_exists('base_url'))
{
function base_url()
{
@@ -75,7 +75,7 @@ if (! function_exists('base_url')) * @access public
* @return string
*/
-if (! function_exists('index_page'))
+if ( ! function_exists('index_page'))
{
function index_page()
{
@@ -97,15 +97,15 @@ if (! function_exists('index_page')) * @param mixed any attributes
* @return string
*/
-if (! function_exists('anchor'))
+if ( ! function_exists('anchor'))
{
function anchor($uri = '', $title = '', $attributes = '')
{
$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
{
@@ -140,13 +140,13 @@ if (! function_exists('anchor')) * @param mixed any attributes
* @return string
*/
-if (! function_exists('anchor_popup'))
+if ( ! function_exists('anchor_popup'))
{
function anchor_popup($uri = '', $title = '', $attributes = FALSE)
{
$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 == '')
{
@@ -158,14 +158,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>";
@@ -183,7 +183,7 @@ if (! function_exists('anchor_popup')) * @param mixed any attributes
* @return string
*/
-if (! function_exists('mailto'))
+if ( ! function_exists('mailto'))
{
function mailto($email, $title = '', $attributes = '')
{
@@ -213,7 +213,7 @@ if (! function_exists('mailto')) * @param mixed any attributes
* @return string
*/
-if (! function_exists('safe_mailto'))
+if ( ! function_exists('safe_mailto'))
{
function safe_mailto($email, $title = '', $attributes = '')
{
@@ -328,7 +328,7 @@ if (! function_exists('safe_mailto')) * @param bool whether to create pop-up links
* @return string
*/
-if (! function_exists('auto_link'))
+if ( ! function_exists('auto_link'))
{
function auto_link($str, $type = 'both', $popup = FALSE)
{
@@ -393,7 +393,7 @@ if (! function_exists('auto_link')) * @param string the URL
* @return string
*/
-if (! function_exists('prep_url'))
+if ( ! function_exists('prep_url'))
{
function prep_url($str = '')
{
@@ -425,7 +425,7 @@ if (! function_exists('prep_url')) * @param string the separator: dash, or underscore
* @return string
*/
-if (! function_exists('url_title'))
+if ( ! function_exists('url_title'))
{
function url_title($str, $separator = 'dash')
{
@@ -474,7 +474,7 @@ if (! function_exists('url_title')) * @param string the method: location or redirect
* @return string
*/
-if (! function_exists('redirect'))
+if ( ! function_exists('redirect'))
{
function redirect($uri = '', $method = 'location', $http_response_code = 302)
{
@@ -501,7 +501,7 @@ if (! function_exists('redirect')) * @param bool
* @return string
*/
-if (! function_exists('_parse_attributes'))
+if ( ! function_exists('_parse_attributes'))
{
function _parse_attributes($attributes, $javascript = FALSE)
{
@@ -532,6 +532,6 @@ if (! function_exists('_parse_attributes')) }
}
- -/* End of file url_helper.php */ +
+/* End of file url_helper.php */
/* Location: ./system/helpers/url_helper.php */
\ No newline at end of file diff --git a/system/helpers/xml_helper.php b/system/helpers/xml_helper.php index b91664433..256d1e020 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
*
@@ -34,7 +34,7 @@ * @param string
* @return string
*/
-if (! function_exists('xml_convert'))
+if ( ! function_exists('xml_convert'))
{
function xml_convert($str)
{
@@ -57,6 +57,6 @@ if (! function_exists('xml_convert')) }
}
- -/* End of file xml_helper.php */ +
+/* End of file xml_helper.php */
/* Location: ./system/helpers/xml_helper.php */
\ No newline at end of file |