summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsystem/core/CodeIgniter.php2
-rwxr-xr-xsystem/core/Config.php7
-rw-r--r--system/database/DB_query_builder.php2
-rw-r--r--system/helpers/array_helper.php56
-rw-r--r--system/helpers/captcha_helper.php18
-rw-r--r--system/helpers/cookie_helper.php64
-rw-r--r--system/helpers/date_helper.php244
-rw-r--r--system/helpers/directory_helper.php23
-rw-r--r--system/helpers/download_helper.php20
-rw-r--r--system/helpers/email_helper.php28
-rw-r--r--system/helpers/file_helper.php197
-rw-r--r--system/helpers/form_helper.php514
-rw-r--r--system/helpers/html_helper.php187
-rw-r--r--system/helpers/smiley_helper.php115
-rw-r--r--system/helpers/string_helper.php89
-rw-r--r--system/helpers/text_helper.php148
-rw-r--r--system/libraries/Cache/Cache.php48
-rw-r--r--system/libraries/Cache/drivers/Cache_apc.php2
-rw-r--r--system/libraries/Cache/drivers/Cache_dummy.php2
-rw-r--r--system/libraries/Cache/drivers/Cache_file.php16
-rw-r--r--system/libraries/Cache/drivers/Cache_memcached.php24
-rw-r--r--system/libraries/Cache/drivers/Cache_wincache.php2
-rw-r--r--system/libraries/Calendar.php92
-rw-r--r--system/libraries/Cart.php46
-rw-r--r--system/libraries/Driver.php45
-rw-r--r--system/libraries/Encrypt.php35
-rw-r--r--system/libraries/Form_validation.php83
-rw-r--r--system/libraries/Image_lib.php319
-rw-r--r--system/libraries/Javascript.php2
-rw-r--r--system/libraries/Log.php46
-rw-r--r--system/libraries/Migration.php39
-rw-r--r--system/libraries/Pagination.php11
-rw-r--r--system/libraries/Parser.php18
-rw-r--r--system/libraries/Profiler.php44
-rw-r--r--system/libraries/Session.php129
-rw-r--r--system/libraries/Table.php52
-rw-r--r--system/libraries/Typography.php36
-rw-r--r--system/libraries/User_agent.php120
-rw-r--r--system/libraries/Xmlrpc.php36
-rw-r--r--system/libraries/Xmlrpcs.php37
-rw-r--r--system/libraries/Zip.php40
41 files changed, 2015 insertions, 1023 deletions
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php
index 793c4687e..349f9f2d0 100755
--- a/system/core/CodeIgniter.php
+++ b/system/core/CodeIgniter.php
@@ -153,7 +153,7 @@
*
* Note: Order here is rather important as the UTF-8
* class needs to be used very early on, but it cannot
- * properly determine if UTf-8 can be supported until
+ * properly determine if UTF-8 can be supported until
* after the Config class is instantiated.
*
*/
diff --git a/system/core/Config.php b/system/core/Config.php
index 1eab08b82..9cebe6c86 100755
--- a/system/core/Config.php
+++ b/system/core/Config.php
@@ -66,11 +66,6 @@ class CI_Config {
* Constructor
*
* Sets the $config data from the primary config.php file as a class variable
- *
- * @param string the config file name
- * @param boolean if configuration values should be loaded into their own section
- * @param boolean true if errors should just return false, false if an error message should be displayed
- * @return boolean if the file was successfully loaded or not
*/
public function __construct()
{
@@ -192,7 +187,6 @@ class CI_Config {
*
* @param string the config item name
* @param string the index name
- * @param bool
* @return string
*/
public function item($item, $index = '')
@@ -211,7 +205,6 @@ class CI_Config {
* Fetch a config file item - adds slash after item (if item is not empty)
*
* @param string the config item name
- * @param bool
* @return string
*/
public function slash_item($item)
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index 393a1cd75..d0af66de1 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -281,7 +281,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
$v = trim($v);
$this->_track_aliases($v);
- $v = $this->qb_from[] = $this->protect_identifiers($v, TRUE, NULL, FALSE);
+ $this->qb_from[] = $v = $this->protect_identifiers($v, TRUE, NULL, FALSE);
if ($this->qb_caching === TRUE)
{
diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php
index 6f56d9db9..6a7c8e3c7 100644
--- a/system/helpers/array_helper.php
+++ b/system/helpers/array_helper.php
@@ -37,19 +37,19 @@
// ------------------------------------------------------------------------
-/**
- * Element
- *
- * Lets you determine whether an array index is set and whether it has a value.
- * If the element is empty it returns FALSE (or whatever you specify as the default value.)
- *
- * @param string
- * @param array
- * @param mixed
- * @return mixed depends on what the array contains
- */
if ( ! function_exists('element'))
{
+ /**
+ * Element
+ *
+ * Lets you determine whether an array index is set and whether it has a value.
+ * If the element is empty it returns FALSE (or whatever you specify as the default value.)
+ *
+ * @param string
+ * @param array
+ * @param mixed
+ * @return mixed depends on what the array contains
+ */
function element($item, $array, $default = FALSE)
{
return empty($array[$item]) ? $default : $array[$item];
@@ -58,14 +58,14 @@ if ( ! function_exists('element'))
// ------------------------------------------------------------------------
-/**
- * Random Element - Takes an array as input and returns a random element
- *
- * @param array
- * @return mixed depends on what the array contains
- */
if ( ! function_exists('random_element'))
{
+ /**
+ * Random Element - Takes an array as input and returns a random element
+ *
+ * @param array
+ * @return mixed depends on what the array contains
+ */
function random_element($array)
{
return is_array($array) ? $array[array_rand($array)] : $array;
@@ -74,19 +74,19 @@ if ( ! function_exists('random_element'))
// --------------------------------------------------------------------
-/**
- * Elements
- *
- * Returns only the array items specified. Will return a default value if
- * it is not set.
- *
- * @param array
- * @param array
- * @param mixed
- * @return mixed depends on what the array contains
- */
if ( ! function_exists('elements'))
{
+ /**
+ * Elements
+ *
+ * Returns only the array items specified. Will return a default value if
+ * it is not set.
+ *
+ * @param array
+ * @param array
+ * @param mixed
+ * @return mixed depends on what the array contains
+ */
function elements($items, $array, $default = FALSE)
{
$return = array();
diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php
index bdbc62097..b11670658 100644
--- a/system/helpers/captcha_helper.php
+++ b/system/helpers/captcha_helper.php
@@ -37,17 +37,17 @@
// ------------------------------------------------------------------------
-/**
- * Create CAPTCHA
- *
- * @param array array of data for the CAPTCHA
- * @param string path to create the image in
- * @param string URL to the CAPTCHA image folder
- * @param string server path to font
- * @return string
- */
if ( ! function_exists('create_captcha'))
{
+ /**
+ * Create CAPTCHA
+ *
+ * @param array array of data for the CAPTCHA
+ * @param string path to create the image in
+ * @param string URL to the CAPTCHA image folder
+ * @param string server path to font
+ * @return string
+ */
function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = '')
{
$defaults = array('word' => '', 'img_path' => '', 'img_url' => '', 'img_width' => '150', 'img_height' => '30', 'font_path' => '', 'expiration' => 7200);
diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php
index 06560e723..f396c76b0 100644
--- a/system/helpers/cookie_helper.php
+++ b/system/helpers/cookie_helper.php
@@ -37,24 +37,24 @@
// ------------------------------------------------------------------------
-/**
- * Set cookie
- *
- * Accepts seven parameters, or you can submit an associative
- * array in the first parameter containing all the values.
- *
- * @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 path
- * @param string the cookie prefix
- * @param bool true makes the cookie secure
- * @param bool true makes the cookie accessible via http(s) only (no javascript)
- * @return void
- */
if ( ! function_exists('set_cookie'))
{
+ /**
+ * Set cookie
+ *
+ * Accepts seven parameters, or you can submit an associative
+ * array in the first parameter containing all the values.
+ *
+ * @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 path
+ * @param string the cookie prefix
+ * @param bool true makes the cookie secure
+ * @param bool true makes the cookie accessible via http(s) only (no javascript)
+ * @return void
+ */
function set_cookie($name = '', $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = FALSE, $httponly = FALSE)
{
// Set the config file options
@@ -65,15 +65,15 @@ if ( ! function_exists('set_cookie'))
// --------------------------------------------------------------------
-/**
- * Fetch an item from the COOKIE array
- *
- * @param string
- * @param bool
- * @return mixed
- */
if ( ! function_exists('get_cookie'))
{
+ /**
+ * Fetch an item from the COOKIE array
+ *
+ * @param string
+ * @param bool
+ * @return mixed
+ */
function get_cookie($index = '', $xss_clean = FALSE)
{
$CI =& get_instance();
@@ -84,17 +84,17 @@ if ( ! function_exists('get_cookie'))
// --------------------------------------------------------------------
-/**
- * Delete a COOKIE
- *
- * @param mixed
- * @param string the cookie domain. Usually: .yourdomain.com
- * @param string the cookie path
- * @param string the cookie prefix
- * @return void
- */
if ( ! function_exists('delete_cookie'))
{
+ /**
+ * Delete a COOKIE
+ *
+ * @param mixed
+ * @param string the cookie domain. Usually: .yourdomain.com
+ * @param string the cookie path
+ * @param string the cookie prefix
+ * @return void
+ */
function delete_cookie($name = '', $domain = '', $path = '/', $prefix = '')
{
set_cookie($name, '', '', $domain, $path, $prefix);
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php
index f1ba364f5..531d1d32f 100644
--- a/system/helpers/date_helper.php
+++ b/system/helpers/date_helper.php
@@ -37,15 +37,15 @@
// ------------------------------------------------------------------------
-/**
- * Get "now" time
- *
- * Returns time() or its GMT equivalent based on the config file preference
- *
- * @return int
- */
if ( ! function_exists('now'))
{
+ /**
+ * Get "now" time
+ *
+ * Returns time() or its GMT equivalent based on the config file preference
+ *
+ * @return int
+ */
function now()
{
$CI =& get_instance();
@@ -70,24 +70,24 @@ if ( ! function_exists('now'))
// ------------------------------------------------------------------------
-/**
- * Convert MySQL Style Datecodes
- *
- * 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...
- *
- * The benefit of doing dates this way is that you don't
- * have to worry about escaping your text letters that
- * match the date codes.
- *
- * @param string
- * @param int
- * @return int
- */
if ( ! function_exists('mdate'))
{
+ /**
+ * Convert MySQL Style Datecodes
+ *
+ * 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...
+ *
+ * The benefit of doing dates this way is that you don't
+ * have to worry about escaping your text letters that
+ * match the date codes.
+ *
+ * @param string
+ * @param int
+ * @return int
+ */
function mdate($datestr = '', $time = '')
{
if ($datestr == '')
@@ -109,17 +109,17 @@ if ( ! function_exists('mdate'))
// ------------------------------------------------------------------------
-/**
- * Standard Date
- *
- * Returns a date formatted according to the submitted standard.
- *
- * @param string the chosen format
- * @param int Unix timestamp
- * @return string
- */
if ( ! function_exists('standard_date'))
{
+ /**
+ * Standard Date
+ *
+ * Returns a date formatted according to the submitted standard.
+ *
+ * @param string the chosen format
+ * @param int Unix timestamp
+ * @return string
+ */
function standard_date($fmt = 'DATE_RFC822', $time = '')
{
$formats = array(
@@ -146,19 +146,19 @@ if ( ! function_exists('standard_date'))
// ------------------------------------------------------------------------
-/**
- * Timespan
- *
- * Returns a span of seconds in this format:
- * 10 days 14 hours 36 minutes 47 seconds
- *
- * @param int a number of seconds
- * @param int Unix timestamp
- * @param int a number of display units
- * @return string
- */
if ( ! function_exists('timespan'))
{
+ /**
+ * Timespan
+ *
+ * Returns a span of seconds in this format:
+ * 10 days 14 hours 36 minutes 47 seconds
+ *
+ * @param int a number of seconds
+ * @param int Unix timestamp
+ * @param int a number of display units
+ * @return string
+ */
function timespan($seconds = 1, $time = '', $units = 7)
{
$CI =& get_instance();
@@ -261,18 +261,18 @@ if ( ! function_exists('timespan'))
// ------------------------------------------------------------------------
-/**
- * Number of days in a month
- *
- * Takes a month/year as input and returns the number of days
- * for the given month/year. Takes leap years into consideration.
- *
- * @param int a numeric month
- * @param int a numeric year
- * @return int
- */
if ( ! function_exists('days_in_month'))
{
+ /**
+ * Number of days in a month
+ *
+ * Takes a month/year as input and returns the number of days
+ * for the given month/year. Takes leap years into consideration.
+ *
+ * @param int a numeric month
+ * @param int a numeric year
+ * @return int
+ */
function days_in_month($month = 0, $year = '')
{
if ($month < 1 OR $month > 12)
@@ -300,14 +300,14 @@ if ( ! function_exists('days_in_month'))
// ------------------------------------------------------------------------
-/**
- * Converts a local Unix timestamp to GMT
- *
- * @param int Unix timestamp
- * @return int
- */
if ( ! function_exists('local_to_gmt'))
{
+ /**
+ * Converts a local Unix timestamp to GMT
+ *
+ * @param int Unix timestamp
+ * @return int
+ */
function local_to_gmt($time = '')
{
if ($time == '')
@@ -328,20 +328,20 @@ if ( ! function_exists('local_to_gmt'))
// ------------------------------------------------------------------------
-/**
- * Converts GMT time to a localized value
- *
- * Takes a Unix timestamp (in GMT) as input, and returns
- * at the local value based on the timezone and DST setting
- * submitted
- *
- * @param int Unix timestamp
- * @param string timezone
- * @param bool whether DST is active
- * @return int
- */
if ( ! function_exists('gmt_to_local'))
{
+ /**
+ * Converts GMT time to a localized value
+ *
+ * Takes a Unix timestamp (in GMT) as input, and returns
+ * at the local value based on the timezone and DST setting
+ * submitted
+ *
+ * @param int Unix timestamp
+ * @param string timezone
+ * @param bool whether DST is active
+ * @return int
+ */
function gmt_to_local($time = '', $timezone = 'UTC', $dst = FALSE)
{
if ($time == '')
@@ -362,14 +362,14 @@ if ( ! function_exists('gmt_to_local'))
// ------------------------------------------------------------------------
-/**
- * Converts a MySQL Timestamp to Unix
- *
- * @param int Unix timestamp
- * @return int
- */
if ( ! function_exists('mysql_to_unix'))
{
+ /**
+ * Converts a MySQL Timestamp to Unix
+ *
+ * @param int Unix timestamp
+ * @return int
+ */
function mysql_to_unix($time = '')
{
// We'll remove certain characters for backward compatibility
@@ -394,18 +394,18 @@ if ( ! function_exists('mysql_to_unix'))
// ------------------------------------------------------------------------
-/**
- * Unix to "Human"
- *
- * Formats Unix timestamp to the following prototype: 2006-08-21 11:35 PM
- *
- * @param int Unix timestamp
- * @param bool whether to show seconds
- * @param string format: us or euro
- * @return string
- */
if ( ! function_exists('unix_to_human'))
{
+ /**
+ * Unix to "Human"
+ *
+ * Formats Unix timestamp to the following prototype: 2006-08-21 11:35 PM
+ *
+ * @param int Unix timestamp
+ * @param bool whether to show seconds
+ * @param string format: us or euro
+ * @return string
+ */
function unix_to_human($time = '', $seconds = FALSE, $fmt = 'us')
{
$r = date('Y', $time).'-'.date('m', $time).'-'.date('d', $time).' ';
@@ -435,16 +435,16 @@ if ( ! function_exists('unix_to_human'))
// ------------------------------------------------------------------------
-/**
- * Convert "human" date to GMT
- *
- * Reverses the above process
- *
- * @param string format: us or euro
- * @return int
- */
if ( ! function_exists('human_to_unix'))
{
+ /**
+ * Convert "human" date to GMT
+ *
+ * Reverses the above process
+ *
+ * @param string format: us or euro
+ * @return int
+ */
function human_to_unix($datestr = '')
{
if ($datestr == '')
@@ -509,16 +509,16 @@ if ( ! function_exists('human_to_unix'))
// ------------------------------------------------------------------------
-/**
- * Turns many "reasonably-date-like" strings into something
- * that is actually useful. This only works for dates after unix epoch.
- *
- * @param string The terribly formatted date-like string
- * @param string Date format to return (same as php date function)
- * @return string
- */
if ( ! function_exists('nice_date'))
{
+ /**
+ * Turns many "reasonably-date-like" strings into something
+ * that is actually useful. This only works for dates after unix epoch.
+ *
+ * @param string The terribly formatted date-like string
+ * @param string Date format to return (same as php date function)
+ * @return string
+ */
function nice_date($bad_date = '', $format = FALSE)
{
if (empty($bad_date))
@@ -575,18 +575,18 @@ if ( ! function_exists('nice_date'))
// ------------------------------------------------------------------------
-/**
- * Timezone Menu
- *
- * Generates a drop-down menu of timezones.
- *
- * @param string timezone
- * @param string classname
- * @param string menu name
- * @return string
- */
if ( ! function_exists('timezone_menu'))
{
+ /**
+ * Timezone Menu
+ *
+ * Generates a drop-down menu of timezones.
+ *
+ * @param string timezone
+ * @param string classname
+ * @param string menu name
+ * @return string
+ */
function timezone_menu($default = 'UTC', $class = "", $name = 'timezones')
{
$CI =& get_instance();
@@ -617,17 +617,17 @@ if ( ! function_exists('timezone_menu'))
// ------------------------------------------------------------------------
-/**
- * Timezones
- *
- * Returns an array of timezones. This is a helper function
- * for various other ones in this library
- *
- * @param string timezone
- * @return string
- */
if ( ! function_exists('timezones'))
{
+ /**
+ * Timezones
+ *
+ * Returns an array of timezones. This is a helper function
+ * for various other ones in this library
+ *
+ * @param string timezone
+ * @return string
+ */
function timezones($tz = '')
{
// Note: Don't change the order of these even though
diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php
index 4044ace11..bda8fe8bb 100644
--- a/system/helpers/directory_helper.php
+++ b/system/helpers/directory_helper.php
@@ -37,19 +37,20 @@
// ------------------------------------------------------------------------
-/**
- * Create a Directory Map
- *
- * Reads the specified directory and builds an array
- * 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)
- * @return array
- */
if ( ! function_exists('directory_map'))
{
+ /**
+ * Create a Directory Map
+ *
+ * Reads the specified directory and builds an array
+ * 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
+ * @return array
+ */
function directory_map($source_dir, $directory_depth = 0, $hidden = FALSE)
{
if ($fp = @opendir($source_dir))
diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php
index 8b87f8179..97e6986b0 100644
--- a/system/helpers/download_helper.php
+++ b/system/helpers/download_helper.php
@@ -37,18 +37,18 @@
// ------------------------------------------------------------------------
-/**
- * Force Download
- *
- * Generates headers that force a download to happen
- *
- * @param string filename
- * @param mixed the data to be downloaded
- * @param bool wether to try and send the actual file MIME type
- * @return void
- */
if ( ! function_exists('force_download'))
{
+ /**
+ * Force Download
+ *
+ * Generates headers that force a download to happen
+ *
+ * @param string filename
+ * @param mixed the data to be downloaded
+ * @param bool wether to try and send the actual file MIME type
+ * @return void
+ */
function force_download($filename = '', $data = '', $set_mime = FALSE)
{
if ($filename == '' OR $data == '')
diff --git a/system/helpers/email_helper.php b/system/helpers/email_helper.php
index 497625c10..0516e938a 100644
--- a/system/helpers/email_helper.php
+++ b/system/helpers/email_helper.php
@@ -37,14 +37,14 @@
// ------------------------------------------------------------------------
-/**
- * Validate email address
- *
- * @param string
- * @return bool
- */
if ( ! function_exists('valid_email'))
{
+ /**
+ * Validate email address
+ *
+ * @param string
+ * @return bool
+ */
function valid_email($address)
{
return (bool) preg_match('/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix', $address);
@@ -53,16 +53,16 @@ if ( ! function_exists('valid_email'))
// ------------------------------------------------------------------------
-/**
- * Send an email
- *
- * @param string
- * @param string
- * @param string
- * @return bool
- */
if ( ! function_exists('send_email'))
{
+ /**
+ * Send an email
+ *
+ * @param string
+ * @param string
+ * @param string
+ * @return bool
+ */
function send_email($recipient, $subject = 'Test email', $message = 'Hello World')
{
return mail($recipient, $subject, $message);
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php
index a5aabecd6..fb4503479 100644
--- a/system/helpers/file_helper.php
+++ b/system/helpers/file_helper.php
@@ -37,16 +37,16 @@
// ------------------------------------------------------------------------
-/**
- * Read File
- *
- * Opens the file specfied in the path and returns it as a string.
- *
- * @param string path to file
- * @return string
- */
if ( ! function_exists('read_file'))
{
+ /**
+ * Read File
+ *
+ * Opens the file specfied in the path and returns it as a string.
+ *
+ * @param string path to file
+ * @return string
+ */
function read_file($file)
{
if ( ! file_exists($file))
@@ -81,18 +81,19 @@ if ( ! function_exists('read_file'))
// ------------------------------------------------------------------------
-/**
- * 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
- * @return bool
- */
if ( ! function_exists('write_file'))
{
+ /**
+ * 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
+ * @return bool
+ */
function write_file($path, $data, $mode = FOPEN_WRITE_CREATE_DESTRUCTIVE)
{
if ( ! $fp = @fopen($path, $mode))
@@ -111,22 +112,22 @@ if ( ! function_exists('write_file'))
// ------------------------------------------------------------------------
-/**
- * Delete Files
- *
- * Deletes all files contained in the supplied directory path.
- * Files must be writable or owned by the system in order to be deleted.
- * 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
- * @return bool
- */
if ( ! function_exists('delete_files'))
{
+ /**
+ * Delete Files
+ *
+ * Deletes all files contained in the supplied directory path.
+ * Files must be writable or owned by the system in order to be deleted.
+ * 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
+ * @return bool
+ */
function delete_files($path, $del_dir = FALSE, $level = 0, $htdocs = FALSE)
{
// Trim the trailing slash
@@ -164,19 +165,19 @@ if ( ! function_exists('delete_files'))
// ------------------------------------------------------------------------
-/**
- * Get Filenames
- *
- * Reads the specified directory and builds an array containing the filenames.
- * Any sub-folders contained within the specified path are read as well.
- *
- * @param string path to source
- * @param bool whether to include the path as part of the filename
- * @param bool internal variable to determine recursion status - do not use in calls
- * @return array
- */
if ( ! function_exists('get_filenames'))
{
+ /**
+ * Get Filenames
+ *
+ * Reads the specified directory and builds an array containing the filenames.
+ * Any sub-folders contained within the specified path are read as well.
+ *
+ * @param string path to source
+ * @param bool whether to include the path as part of the filename
+ * @param bool internal variable to determine recursion status - do not use in calls
+ * @return array
+ */
function get_filenames($source_dir, $include_path = FALSE, $_recursion = FALSE)
{
static $_filedata = array();
@@ -212,21 +213,21 @@ if ( ! function_exists('get_filenames'))
// --------------------------------------------------------------------
-/**
- * Get Directory File Information
- *
- * Reads the specified directory and builds an array containing the filenames,
- * filesize, dates, and permissions
- *
- * Any sub-folders contained within the specified path are read as well.
- *
- * @param string path to source
- * @param bool Look only at the top level directory specified?
- * @param bool internal variable to determine recursion status - do not use in calls
- * @return array
- */
if ( ! function_exists('get_dir_file_info'))
{
+ /**
+ * Get Directory File Information
+ *
+ * Reads the specified directory and builds an array containing the filenames,
+ * filesize, dates, and permissions
+ *
+ * Any sub-folders contained within the specified path are read as well.
+ *
+ * @param string path to source
+ * @param bool Look only at the top level directory specified?
+ * @param bool internal variable to determine recursion status - do not use in calls
+ * @return array
+ */
function get_dir_file_info($source_dir, $top_level_only = TRUE, $_recursion = FALSE)
{
static $_filedata = array();
@@ -265,20 +266,20 @@ if ( ! function_exists('get_dir_file_info'))
// --------------------------------------------------------------------
-/**
-* Get File Info
-*
-* Given a file and path, returns the name, path, size, date modified
-* Second parameter allows you to explicitly declare what information you want returned
-* Options are: name, server_path, size, date, readable, writable, executable, fileperms
-* Returns FALSE if the file cannot be found.
-*
-* @param string path to file
-* @param mixed array or comma separated string of information returned
-* @return array
-*/
if ( ! function_exists('get_file_info'))
{
+ /**
+ * Get File Info
+ *
+ * Given a file and path, returns the name, path, size, date modified
+ * Second parameter allows you to explicitly declare what information you want returned
+ * Options are: name, server_path, size, date, readable, writable, executable, fileperms
+ * Returns FALSE if the file cannot be found.
+ *
+ * @param string path to file
+ * @param mixed array or comma separated string of information returned
+ * @return array
+ */
function get_file_info($file, $returned_values = array('name', 'server_path', 'size', 'date'))
{
@@ -330,20 +331,20 @@ if ( ! function_exists('get_file_info'))
// --------------------------------------------------------------------
-/**
- * Get Mime by Extension
- *
- * Translates a file extension into a mime type based on config/mimes.php.
- * Returns FALSE if it can't determine the type, or open the mime config file
- *
- * Note: this is NOT an accurate way of determining file mime types, and is here strictly as a convenience
- * It should NOT be trusted, and should certainly NOT be used for security
- *
- * @param string path to file
- * @return mixed
- */
if ( ! function_exists('get_mime_by_extension'))
{
+ /**
+ * Get Mime by Extension
+ *
+ * Translates a file extension into a mime type based on config/mimes.php.
+ * Returns FALSE if it can't determine the type, or open the mime config file
+ *
+ * Note: this is NOT an accurate way of determining file mime types, and is here strictly as a convenience
+ * It should NOT be trusted, and should certainly NOT be used for security
+ *
+ * @param string path to file
+ * @return mixed
+ */
function get_mime_by_extension($file)
{
$extension = strtolower(substr(strrchr($file, '.'), 1));
@@ -386,17 +387,17 @@ if ( ! function_exists('get_mime_by_extension'))
// --------------------------------------------------------------------
-/**
- * Symbolic Permissions
- *
- * Takes a numeric value representing a file's permissions and returns
- * standard symbolic notation representing that value
- *
- * @param int
- * @return string
- */
if ( ! function_exists('symbolic_permissions'))
{
+ /**
+ * Symbolic Permissions
+ *
+ * Takes a numeric value representing a file's permissions and returns
+ * standard symbolic notation representing that value
+ *
+ * @param int
+ * @return string
+ */
function symbolic_permissions($perms)
{
if (($perms & 0xC000) === 0xC000)
@@ -453,17 +454,17 @@ if ( ! function_exists('symbolic_permissions'))
// --------------------------------------------------------------------
-/**
- * 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
- * @return string
- */
if ( ! function_exists('octal_permissions'))
{
+ /**
+ * 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
+ * @return string
+ */
function octal_permissions($perms)
{
return substr(sprintf('%o', $perms), -3);
diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php
index e5b487608..b246d72f3 100644
--- a/system/helpers/form_helper.php
+++ b/system/helpers/form_helper.php
@@ -36,18 +36,18 @@
// ------------------------------------------------------------------------
-/**
- * Form Declaration
- *
- * Creates the opening portion of the form.
- *
- * @param string the URI segments of the form destination
- * @param array a key/value pair of attributes
- * @param array a key/value pair hidden data
- * @return string
- */
if ( ! function_exists('form_open'))
{
+ /**
+ * Form Declaration
+ *
+ * Creates the opening portion of the form.
+ *
+ * @param string the URI segments of the form destination
+ * @param array a key/value pair of attributes
+ * @param array a key/value pair hidden data
+ * @return string
+ */
function form_open($action = '', $attributes = '', $hidden = array())
{
$CI =& get_instance();
@@ -85,18 +85,18 @@ if ( ! function_exists('form_open'))
// ------------------------------------------------------------------------
-/**
- * Form Declaration - Multipart type
- *
- * Creates the opening portion of the form, but with "multipart/form-data".
- *
- * @param string the URI segments of the form destination
- * @param array a key/value pair of attributes
- * @param array a key/value pair hidden data
- * @return string
- */
if ( ! function_exists('form_open_multipart'))
{
+ /**
+ * Form Declaration - Multipart type
+ *
+ * Creates the opening portion of the form, but with "multipart/form-data".
+ *
+ * @param string the URI segments of the form destination
+ * @param array a key/value pair of attributes
+ * @param array a key/value pair hidden data
+ * @return string
+ */
function form_open_multipart($action = '', $attributes = array(), $hidden = array())
{
if (is_string($attributes))
@@ -114,18 +114,19 @@ if ( ! function_exists('form_open_multipart'))
// ------------------------------------------------------------------------
-/**
- * Hidden Input Field
- *
- * Generates hidden fields. You can pass a simple key/value string or
- * an associative array with multiple values.
- *
- * @param mixed
- * @param string
- * @return string
- */
if ( ! function_exists('form_hidden'))
{
+ /**
+ * Hidden Input Field
+ *
+ * Generates hidden fields. You can pass a simple key/value string or
+ * an associative array with multiple values.
+ *
+ * @param mixed
+ * @param string
+ * @param bool
+ * @return string
+ */
function form_hidden($name, $value = '', $recursing = FALSE)
{
static $form;
@@ -163,16 +164,16 @@ if ( ! function_exists('form_hidden'))
// ------------------------------------------------------------------------
-/**
- * Text Input Field
- *
- * @param mixed
- * @param string
- * @param string
- * @return string
- */
if ( ! function_exists('form_input'))
{
+ /**
+ * Text Input Field
+ *
+ * @param mixed
+ * @param string
+ * @param string
+ * @return string
+ */
function form_input($data = '', $value = '', $extra = '')
{
$defaults = array('type' => 'text', 'name' => ( ! is_array($data) ? $data : ''), 'value' => $value);
@@ -183,18 +184,19 @@ if ( ! function_exists('form_input'))
// ------------------------------------------------------------------------
-/**
- * Password Field
- *
- * Identical to the input function but adds the "password" type
- *
- * @param mixed
- * @param string
- * @param string
- * @return string
- */
+
if ( ! function_exists('form_password'))
{
+ /**
+ * Password Field
+ *
+ * Identical to the input function but adds the "password" type
+ *
+ * @param mixed
+ * @param string
+ * @param string
+ * @return string
+ */
function form_password($data = '', $value = '', $extra = '')
{
if ( ! is_array($data))
@@ -209,18 +211,18 @@ if ( ! function_exists('form_password'))
// ------------------------------------------------------------------------
-/**
- * Upload Field
- *
- * Identical to the input function but adds the "file" type
- *
- * @param mixed
- * @param string
- * @param string
- * @return string
- */
if ( ! function_exists('form_upload'))
{
+ /**
+ * Upload Field
+ *
+ * Identical to the input function but adds the "file" type
+ *
+ * @param mixed
+ * @param string
+ * @param string
+ * @return string
+ */
function form_upload($data = '', $value = '', $extra = '')
{
if ( ! is_array($data))
@@ -235,16 +237,16 @@ if ( ! function_exists('form_upload'))
// ------------------------------------------------------------------------
-/**
- * Textarea field
- *
- * @param mixed
- * @param string
- * @param string
- * @return string
- */
if ( ! function_exists('form_textarea'))
{
+ /**
+ * Textarea field
+ *
+ * @param mixed
+ * @param string
+ * @param string
+ * @return string
+ */
function form_textarea($data = '', $value = '', $extra = '')
{
$defaults = array('name' => ( ! is_array($data) ? $data : ''), 'cols' => '40', 'rows' => '10');
@@ -266,17 +268,17 @@ if ( ! function_exists('form_textarea'))
// ------------------------------------------------------------------------
-/**
- * Multi-select menu
- *
- * @param string
- * @param array
- * @param mixed
- * @param string
- * @return string
- */
if ( ! function_exists('form_multiselect'))
{
+ /**
+ * Multi-select menu
+ *
+ * @param string
+ * @param array
+ * @param mixed
+ * @param string
+ * @return string
+ */
function form_multiselect($name = '', $options = array(), $selected = array(), $extra = '')
{
if ( ! strpos($extra, 'multiple'))
@@ -290,17 +292,17 @@ if ( ! function_exists('form_multiselect'))
// --------------------------------------------------------------------
-/**
- * Drop-down Menu
- *
- * @param string
- * @param array
- * @param string
- * @param string
- * @return string
- */
if ( ! function_exists('form_dropdown'))
{
+ /**
+ * Drop-down Menu
+ *
+ * @param string
+ * @param array
+ * @param string
+ * @param string
+ * @return string
+ */
function form_dropdown($name = '', $options = array(), $selected = array(), $extra = '')
{
// If name is really an array then we'll call the function again using the array
@@ -358,17 +360,17 @@ if ( ! function_exists('form_dropdown'))
// ------------------------------------------------------------------------
-/**
- * Checkbox Field
- *
- * @param mixed
- * @param string
- * @param bool
- * @param string
- * @return string
- */
if ( ! function_exists('form_checkbox'))
{
+ /**
+ * Checkbox Field
+ *
+ * @param mixed
+ * @param string
+ * @param bool
+ * @param string
+ * @return string
+ */
function form_checkbox($data = '', $value = '', $checked = FALSE, $extra = '')
{
$defaults = array('type' => 'checkbox', 'name' => ( ! is_array($data) ? $data : ''), 'value' => $value);
@@ -402,17 +404,17 @@ if ( ! function_exists('form_checkbox'))
// ------------------------------------------------------------------------
-/**
- * Radio Button
- *
- * @param mixed
- * @param string
- * @param bool
- * @param string
- * @return string
- */
if ( ! function_exists('form_radio'))
{
+ /**
+ * Radio Button
+ *
+ * @param mixed
+ * @param string
+ * @param bool
+ * @param string
+ * @return string
+ */
function form_radio($data = '', $value = '', $checked = FALSE, $extra = '')
{
if ( ! is_array($data))
@@ -427,16 +429,16 @@ if ( ! function_exists('form_radio'))
// ------------------------------------------------------------------------
-/**
- * Submit Button
- *
- * @param mixed
- * @param string
- * @param string
- * @return string
- */
if ( ! function_exists('form_submit'))
{
+ /**
+ * Submit Button
+ *
+ * @param mixed
+ * @param string
+ * @param string
+ * @return string
+ */
function form_submit($data = '', $value = '', $extra = '')
{
$defaults = array('type' => 'submit', 'name' => ( ! is_array($data) ? $data : ''), 'value' => $value);
@@ -446,16 +448,16 @@ if ( ! function_exists('form_submit'))
// ------------------------------------------------------------------------
-/**
- * Reset Button
- *
- * @param mixed
- * @param string
- * @param string
- * @return string
- */
if ( ! function_exists('form_reset'))
{
+ /**
+ * Reset Button
+ *
+ * @param mixed
+ * @param string
+ * @param string
+ * @return string
+ */
function form_reset($data = '', $value = '', $extra = '')
{
$defaults = array('type' => 'reset', 'name' => ( ! is_array($data) ? $data : ''), 'value' => $value);
@@ -465,16 +467,16 @@ if ( ! function_exists('form_reset'))
// ------------------------------------------------------------------------
-/**
- * Form Button
- *
- * @param mixed
- * @param string
- * @param string
- * @return string
- */
if ( ! function_exists('form_button'))
{
+ /**
+ * Form Button
+ *
+ * @param mixed
+ * @param string
+ * @param string
+ * @return string
+ */
function form_button($data = '', $content = '', $extra = '')
{
$defaults = array('name' => ( ! is_array($data) ? $data : ''), 'type' => 'button');
@@ -490,16 +492,16 @@ if ( ! function_exists('form_button'))
// ------------------------------------------------------------------------
-/**
- * Form Label Tag
- *
- * @param string The text to appear onscreen
- * @param string The id the label applies to
- * @param string Additional attributes
- * @return string
- */
if ( ! function_exists('form_label'))
{
+ /**
+ * Form Label Tag
+ *
+ * @param string The text to appear onscreen
+ * @param string The id the label applies to
+ * @param string Additional attributes
+ * @return string
+ */
function form_label($label_text = '', $id = '', $attributes = array())
{
@@ -523,18 +525,19 @@ if ( ! function_exists('form_label'))
}
// ------------------------------------------------------------------------
-/**
- * Fieldset Tag
- *
- * Used to produce <fieldset><legend>text</legend>. To close fieldset
- * use form_fieldset_close()
- *
- * @param string The legend text
- * @param string Additional attributes
- * @return string
- */
+
if ( ! function_exists('form_fieldset'))
{
+ /**
+ * Fieldset Tag
+ *
+ * Used to produce <fieldset><legend>text</legend>. To close fieldset
+ * use form_fieldset_close()
+ *
+ * @param string The legend text
+ * @param string Additional attributes
+ * @return string
+ */
function form_fieldset($legend_text = '', $attributes = array())
{
$fieldset = '<fieldset'._attributes_to_string($attributes, FALSE).">\n";
@@ -549,14 +552,14 @@ if ( ! function_exists('form_fieldset'))
// ------------------------------------------------------------------------
-/**
- * Fieldset Close Tag
- *
- * @param string
- * @return string
- */
if ( ! function_exists('form_fieldset_close'))
{
+ /**
+ * Fieldset Close Tag
+ *
+ * @param string
+ * @return string
+ */
function form_fieldset_close($extra = '')
{
return '</fieldset>'.$extra;
@@ -565,14 +568,14 @@ if ( ! function_exists('form_fieldset_close'))
// ------------------------------------------------------------------------
-/**
- * Form Close Tag
- *
- * @param string
- * @return string
- */
if ( ! function_exists('form_close'))
{
+ /**
+ * Form Close Tag
+ *
+ * @param string
+ * @return string
+ */
function form_close($extra = '')
{
return '</form>'.$extra;
@@ -581,16 +584,17 @@ if ( ! function_exists('form_close'))
// ------------------------------------------------------------------------
-/**
- * Form Prep
- *
- * Formats text so that it can be safely placed in a form field in the event it has HTML tags.
- *
- * @param string
- * @return string
- */
if ( ! function_exists('form_prep'))
{
+ /**
+ * Form Prep
+ *
+ * Formats text so that it can be safely placed in a form field in the event it has HTML tags.
+ *
+ * @param string
+ * @param string
+ * @return string
+ */
function form_prep($str = '', $field_name = '')
{
static $prepped_fields = array();
@@ -631,18 +635,19 @@ 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
- * is active it retrieves the info from the validation class
- *
- * @param string
- * @return mixed
- */
if ( ! function_exists('set_value'))
{
+ /**
+ * 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
+ * is active it retrieves the info from the validation class
+ *
+ * @param string
+ * @param string
+ * @return mixed
+ */
function set_value($field = '', $default = '')
{
if (FALSE === ($OBJ =& _get_validation_object()))
@@ -661,19 +666,19 @@ if ( ! function_exists('set_value'))
// ------------------------------------------------------------------------
-/**
- * Set Select
- *
- * Let's you set the selected value of a <select> menu via data in the POST array.
- * If Form Validation is active it retrieves the info from the validation class
- *
- * @param string
- * @param string
- * @param bool
- * @return string
- */
if ( ! function_exists('set_select'))
{
+ /**
+ * Set Select
+ *
+ * Let's you set the selected value of a <select> menu via data in the POST array.
+ * If Form Validation is active it retrieves the info from the validation class
+ *
+ * @param string
+ * @param string
+ * @param bool
+ * @return string
+ */
function set_select($field = '', $value = '', $default = FALSE)
{
$OBJ =& _get_validation_object();
@@ -712,19 +717,19 @@ if ( ! function_exists('set_select'))
// ------------------------------------------------------------------------
-/**
- * Set Checkbox
- *
- * Let's you set the selected value of a checkbox via the value in the POST array.
- * If Form Validation is active it retrieves the info from the validation class
- *
- * @param string
- * @param string
- * @param bool
- * @return string
- */
if ( ! function_exists('set_checkbox'))
{
+ /**
+ * Set Checkbox
+ *
+ * Let's you set the selected value of a checkbox via the value in the POST array.
+ * If Form Validation is active it retrieves the info from the validation class
+ *
+ * @param string
+ * @param string
+ * @param bool
+ * @return string
+ */
function set_checkbox($field = '', $value = '', $default = FALSE)
{
$OBJ =& _get_validation_object();
@@ -763,19 +768,19 @@ if ( ! function_exists('set_checkbox'))
// ------------------------------------------------------------------------
-/**
- * Set Radio
- *
- * Let's you set the selected value of a radio field via info in the POST array.
- * If Form Validation is active it retrieves the info from the validation class
- *
- * @param string
- * @param string
- * @param bool
- * @return string
- */
if ( ! function_exists('set_radio'))
{
+ /**
+ * Set Radio
+ *
+ * Let's you set the selected value of a radio field via info in the POST array.
+ * If Form Validation is active it retrieves the info from the validation class
+ *
+ * @param string
+ * @param string
+ * @param bool
+ * @return string
+ */
function set_radio($field = '', $value = '', $default = FALSE)
{
$OBJ =& _get_validation_object();
@@ -817,19 +822,20 @@ if ( ! function_exists('set_radio'))
// ------------------------------------------------------------------------
-/**
- * Form Error
- *
- * Returns the error for a specific form field. This is a helper for the
- * form validation class.
- *
- * @param string
- * @param string
- * @param string
- * @return string
- */
+
if ( ! function_exists('form_error'))
{
+ /**
+ * Form Error
+ *
+ * Returns the error for a specific form field. This is a helper for the
+ * form validation class.
+ *
+ * @param string
+ * @param string
+ * @param string
+ * @return string
+ */
function form_error($field = '', $prefix = '', $suffix = '')
{
if (FALSE === ($OBJ =& _get_validation_object()))
@@ -843,18 +849,18 @@ if ( ! function_exists('form_error'))
// ------------------------------------------------------------------------
-/**
- * Validation Error String
- *
- * Returns all the errors associated with a form submission. This is a helper
- * function for the form validation class.
- *
- * @param string
- * @param string
- * @return string
- */
if ( ! function_exists('validation_errors'))
{
+ /**
+ * Validation Error String
+ *
+ * Returns all the errors associated with a form submission. This is a helper
+ * function for the form validation class.
+ *
+ * @param string
+ * @param string
+ * @return string
+ */
function validation_errors($prefix = '', $suffix = '')
{
if (FALSE === ($OBJ =& _get_validation_object()))
@@ -868,17 +874,17 @@ if ( ! function_exists('validation_errors'))
// ------------------------------------------------------------------------
-/**
- * Parse the form attributes
- *
- * Helper function used by some of the form helpers
- *
- * @param array
- * @param array
- * @return string
- */
if ( ! function_exists('_parse_form_attributes'))
{
+ /**
+ * Parse the form attributes
+ *
+ * Helper function used by some of the form helpers
+ *
+ * @param array
+ * @param array
+ * @return string
+ */
function _parse_form_attributes($attributes, $default)
{
if (is_array($attributes))
@@ -916,17 +922,17 @@ if ( ! function_exists('_parse_form_attributes'))
// ------------------------------------------------------------------------
-/**
- * Attributes To String
- *
- * Helper function used by some of the form helpers
- *
- * @param mixed
- * @param bool
- * @return string
- */
if ( ! function_exists('_attributes_to_string'))
{
+ /**
+ * Attributes To String
+ *
+ * Helper function used by some of the form helpers
+ *
+ * @param mixed
+ * @param bool
+ * @return string
+ */
function _attributes_to_string($attributes, $formtag = FALSE)
{
if (is_string($attributes) && strlen($attributes) > 0)
@@ -975,16 +981,16 @@ if ( ! function_exists('_attributes_to_string'))
// ------------------------------------------------------------------------
-/**
- * Validation Object
- *
- * Determines what the form validation class was instantiated as, fetches
- * the object and returns it.
- *
- * @return mixed
- */
if ( ! function_exists('_get_validation_object'))
{
+ /**
+ * Validation Object
+ *
+ * Determines what the form validation class was instantiated as, fetches
+ * the object and returns it.
+ *
+ * @return mixed
+ */
function &_get_validation_object()
{
$CI =& get_instance();
diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php
index 0417bd253..124f58009 100644
--- a/system/helpers/html_helper.php
+++ b/system/helpers/html_helper.php
@@ -37,17 +37,18 @@
// ------------------------------------------------------------------------
-/**
- * Heading
- *
- * Generates an HTML heading tag.
- *
- * @param string content
- * @param int heading level
- * @return string
- */
if ( ! function_exists('heading'))
{
+ /**
+ * Heading
+ *
+ * Generates an HTML heading tag.
+ *
+ * @param string content
+ * @param int heading level
+ * @param string
+ * @return string
+ */
function heading($data = '', $h = '1', $attributes = '')
{
return '<h'.$h.($attributes != '' ? ' ' : '').$attributes.'>'.$data.'</h'.$h.'>';
@@ -56,17 +57,17 @@ if ( ! function_exists('heading'))
// ------------------------------------------------------------------------
-/**
- * Unordered List
- *
- * Generates an HTML unordered list from an single or multi-dimensional array.
- *
- * @param array
- * @param mixed
- * @return string
- */
if ( ! function_exists('ul'))
{
+ /**
+ * Unordered List
+ *
+ * Generates an HTML unordered list from an single or multi-dimensional array.
+ *
+ * @param array
+ * @param mixed
+ * @return string
+ */
function ul($list, $attributes = '')
{
return _list('ul', $list, $attributes);
@@ -75,17 +76,17 @@ if ( ! function_exists('ul'))
// ------------------------------------------------------------------------
-/**
- * Ordered List
- *
- * Generates an HTML ordered list from an single or multi-dimensional array.
- *
- * @param array
- * @param mixed
- * @return string
- */
if ( ! function_exists('ol'))
{
+ /**
+ * Ordered List
+ *
+ * Generates an HTML ordered list from an single or multi-dimensional array.
+ *
+ * @param array
+ * @param mixed
+ * @return string
+ */
function ol($list, $attributes = '')
{
return _list('ol', $list, $attributes);
@@ -94,19 +95,19 @@ if ( ! function_exists('ol'))
// ------------------------------------------------------------------------
-/**
- * Generates the list
- *
- * Generates an HTML ordered list from an single or multi-dimensional array.
- *
- * @param string
- * @param mixed
- * @param mixed
- * @param int
- * @return string
- */
if ( ! function_exists('_list'))
{
+ /**
+ * Generates the list
+ *
+ * Generates an HTML ordered list from an single or multi-dimensional array.
+ *
+ * @param string
+ * @param mixed
+ * @param mixed
+ * @param int
+ * @return string
+ */
function _list($type = 'ul', $list, $attributes = '', $depth = 0)
{
// If an array wasn't submitted there's nothing to do...
@@ -165,14 +166,14 @@ if ( ! function_exists('_list'))
// ------------------------------------------------------------------------
-/**
- * Generates HTML BR tags based on number supplied
- *
- * @param int
- * @return string
- */
if ( ! function_exists('br'))
{
+ /**
+ * Generates HTML BR tags based on number supplied
+ *
+ * @param int
+ * @return string
+ */
function br($num = 1)
{
return str_repeat('<br />', $num);
@@ -181,17 +182,17 @@ if ( ! function_exists('br'))
// ------------------------------------------------------------------------
-/**
- * Image
- *
- * Generates an <img /> element
- *
- * @param mixed
- * @param bool
- * @return string
- */
if ( ! function_exists('img'))
{
+ /**
+ * Image
+ *
+ * Generates an <img /> element
+ *
+ * @param mixed
+ * @param bool
+ * @return string
+ */
function img($src = '', $index_page = FALSE)
{
if ( ! is_array($src) )
@@ -234,20 +235,20 @@ if ( ! function_exists('img'))
// ------------------------------------------------------------------------
-/**
- * Doctype
- *
- * 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
- * doctypes config file.
- *
- * @param string type The doctype to be generated
- * @return string
- */
if ( ! function_exists('doctype'))
{
+ /**
+ * Doctype
+ *
+ * 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
+ * doctypes config file.
+ *
+ * @param string type The doctype to be generated
+ * @return string
+ */
function doctype($type = 'xhtml1-strict')
{
global $_doctypes;
@@ -275,21 +276,21 @@ if ( ! function_exists('doctype'))
// ------------------------------------------------------------------------
-/**
- * Link
- *
- * Generates link to a CSS file
- *
- * @param mixed stylesheet hrefs or an array
- * @param string rel
- * @param string type
- * @param string title
- * @param string media
- * @param bool should index_page be added to the css path
- * @return string
- */
if ( ! function_exists('link_tag'))
{
+ /**
+ * Link
+ *
+ * Generates link to a CSS file
+ *
+ * @param mixed stylesheet hrefs or an array
+ * @param string rel
+ * @param string type
+ * @param string title
+ * @param string media
+ * @param bool should index_page be added to the css path
+ * @return string
+ */
function link_tag($href = '', $rel = 'stylesheet', $type = 'text/css', $title = '', $media = '', $index_page = FALSE)
{
$CI =& get_instance();
@@ -350,17 +351,17 @@ if ( ! function_exists('link_tag'))
// ------------------------------------------------------------------------
-/**
- * Generates meta tags from an array of key/values
- *
- * @param array
- * @param string
- * @param string
- * @param string
- * @return string
- */
if ( ! function_exists('meta'))
{
+ /**
+ * Generates meta tags from an array of key/values
+ *
+ * @param array
+ * @param string
+ * @param string
+ * @param string
+ * @return string
+ */
function meta($name = '', $content = '', $type = 'name', $newline = "\n")
{
// Since we allow the data to be passes as a string, a simple array
@@ -392,14 +393,14 @@ if ( ! function_exists('meta'))
// ------------------------------------------------------------------------
-/**
- * Generates non-breaking space entities based on number supplied
- *
- * @param int
- * @return string
- */
if ( ! function_exists('nbs'))
{
+ /**
+ * Generates non-breaking space entities based on number supplied
+ *
+ * @param int
+ * @return string
+ */
function nbs($num = 1)
{
return str_repeat('&nbsp;', $num);
diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php
index 8dba74e73..638100e9c 100644
--- a/system/helpers/smiley_helper.php
+++ b/system/helpers/smiley_helper.php
@@ -40,7 +40,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.
*
* @param mixed alias name or array of alias->field_id pairs
@@ -52,7 +52,6 @@ if ( ! function_exists('smiley_js'))
function smiley_js($alias = '', $field_id = '', $inline = TRUE)
{
static $do_setup = TRUE;
-
$r = '';
if ($alias != '' && ! is_array($alias))
@@ -62,69 +61,58 @@ if ( ! function_exists('smiley_js'))
if ($do_setup === TRUE)
{
- $do_setup = FALSE;
-
- $m = array();
+ $do_setup = FALSE;
+ $m = array();
- if (is_array($alias))
+ if (is_array($alias))
+ {
+ foreach ($alias as $name => $id)
{
- foreach ($alias as $name => $id)
- {
- $m[] = '"'.$name.'" : "'.$id.'"';
- }
+ $m[] = '"'.$name.'" : "'.$id.'"';
}
+ }
- $m = '{'.implode(',', $m).'}';
+ $m = '{'.implode(',', $m).'}';
- $r .= <<<EOF
- var smiley_map = {$m};
+ $r .= <<<EOF
+ var smiley_map = {$m};
- function insert_smiley(smiley, field_id) {
- var el = document.getElementById(field_id), newStart;
+ function insert_smiley(smiley, field_id) {
+ var el = document.getElementById(field_id), newStart;
- if ( ! el && smiley_map[field_id]) {
- el = document.getElementById(smiley_map[field_id]);
+ if ( ! el && smiley_map[field_id]) {
+ el = document.getElementById(smiley_map[field_id]);
- if ( ! el)
- return false;
- }
+ if ( ! el)
+ return false;
+ }
- el.focus();
- smiley = " " + smiley;
+ el.focus();
+ smiley = " " + smiley;
- if ('selectionStart' in el) {
- newStart = el.selectionStart + smiley.length;
+ if ('selectionStart' in el) {
+ newStart = el.selectionStart + smiley.length;
- el.value = el.value.substr(0, el.selectionStart) +
- smiley +
- el.value.substr(el.selectionEnd, el.value.length);
- el.setSelectionRange(newStart, newStart);
- }
- else if (document.selection) {
- document.selection.createRange().text = smiley;
- }
+ el.value = el.value.substr(0, el.selectionStart) +
+ smiley +
+ el.value.substr(el.selectionEnd, el.value.length);
+ el.setSelectionRange(newStart, newStart);
}
+ else if (document.selection) {
+ document.selection.createRange().text = smiley;
+ }
+ }
EOF;
}
- else
+ elseif (is_array($alias))
{
- if (is_array($alias))
+ foreach ($alias as $name => $id)
{
- foreach ($alias as $name => $id)
- {
- $r .= 'smiley_map["'.$name.'"] = "'.$id.'";'."\n";
- }
+ $r .= 'smiley_map["'.$name.'"] = "'.$id."\";\n";
}
}
- if ($inline)
- {
- return '<script type="text/javascript" charset="utf-8">/*<![CDATA[ */'.$r.'// ]]></script>';
- }
- else
- {
- return $r;
- }
+ return ($inline) ? '<script type="text/javascript" charset="utf-8">/*<![CDATA[ */'.$r.'// ]]></script>' : $r;
}
}
@@ -144,18 +132,13 @@ if ( ! function_exists('get_clickable_smileys'))
function get_clickable_smileys($image_url, $alias = '', $smileys = NULL)
{
// For backward compatibility with js_insert_smiley
-
if (is_array($alias))
{
$smileys = $alias;
}
-
- if ( ! is_array($smileys))
+ elseif (FALSE === ($smileys = _get_smiley_array()))
{
- if (FALSE === ($smileys = _get_smiley_array()))
- {
- return $smileys;
- }
+ return $smileys;
}
// Add a trailing slash to the file path if needed
@@ -165,7 +148,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]]))
@@ -173,8 +156,7 @@ if ( ! function_exists('get_clickable_smileys'))
continue;
}
- $link[] = "<a href=\"javascript:void(0);\" onclick=\"insert_smiley('".$key."', '".$alias."')\"><img src=\"".$image_url.$smileys[$key][0]."\" width=\"".$smileys[$key][1]."\" height=\"".$smileys[$key][2]."\" alt=\"".$smileys[$key][3]."\" style=\"border:0;\" /></a>";
-
+ $link[] = '<a href="javascript:void(0);" onclick="insert_smiley(\''.$key.'\', \''.$alias.'\')"><img src="'.$image_url.$smileys[$key][0].'" alt="'.$smileys[$key][3].'" style="width: '.$smileys[$key][1].'; height: '.$smileys[$key][2].'; border: 0;" /></a>';
$used[$smileys[$key][0]] = TRUE;
}
@@ -197,25 +179,17 @@ if ( ! function_exists('parse_smileys'))
{
function parse_smileys($str = '', $image_url = '', $smileys = NULL)
{
- if ($image_url == '')
+ if ($image_url == '' OR ( ! is_array($smileys) && FALSE === ($smileys = _get_smiley_array())))
{
return $str;
}
- if ( ! is_array($smileys))
- {
- if (FALSE === ($smileys = _get_smiley_array()))
- {
- return $str;
- }
- }
-
// Add a trailing slash to the file path if needed
- $image_url = preg_replace("/(.+?)\/*$/", "\\1/", $image_url);
+ $image_url = rtrim($image_url, '/').'/';
foreach ($smileys as $key => $val)
{
- $str = str_replace($key, "<img src=\"".$image_url.$smileys[$key][0]."\" width=\"".$smileys[$key][1]."\" height=\"".$smileys[$key][2]."\" alt=\"".$smileys[$key][3]."\" style=\"border:0;\" />", $str);
+ $str = str_replace($key, '<img src="'.$image_url.$smileys[$key][0].'" alt="'.$smileys[$key][3].'" style="width: '.$smileys[$key][1].'; height: '.$smileys[$key][2].'; border: 0;" />', $str);
}
return $str;
@@ -244,12 +218,7 @@ if ( ! function_exists('_get_smiley_array'))
include(APPPATH.'config/smileys.php');
}
- if (isset($smileys) && is_array($smileys))
- {
- return $smileys;
- }
-
- return FALSE;
+ return (isset($smileys) && is_array($smileys)) ? $smileys : FALSE;
}
}
diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php
index aed35c157..a6a6b485d 100644
--- a/system/helpers/string_helper.php
+++ b/system/helpers/string_helper.php
@@ -73,16 +73,14 @@ if ( ! function_exists('strip_slashes'))
{
function strip_slashes($str)
{
- if (is_array($str))
+ if ( ! is_array($str))
{
- foreach ($str as $key => $val)
- {
- $str[$key] = strip_slashes($val);
- }
+ return stripslashes($str);
}
- else
+
+ foreach ($str as $key => $val)
{
- $str = stripslashes($str);
+ $str[$key] = strip_slashes($val);
}
return $str;
@@ -173,13 +171,7 @@ if ( ! function_exists('reduce_multiples'))
function reduce_multiples($str, $character = ',', $trim = FALSE)
{
$str = preg_replace('#'.preg_quote($character, '#').'{2,}#', $character, $str);
-
- if ($trim === TRUE)
- {
- return trim($str, $character);
- }
-
- return $str;
+ return ($trim === TRUE) ? trim($str, $character) : $str;
}
}
@@ -198,44 +190,36 @@ if ( ! function_exists('random_string'))
{
function random_string($type = 'alnum', $len = 8)
{
- switch($type)
+ switch ($type)
{
- case 'basic' : return mt_rand();
- break;
- case 'alnum' :
- case 'numeric' :
- case 'nozero' :
- case 'alpha' :
-
- switch ($type)
- {
- case 'alpha' : $pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
- break;
- case 'alnum' : $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
- break;
- case 'numeric' : $pool = '0123456789';
- break;
- case 'nozero' : $pool = '123456789';
- break;
- }
-
- $str = substr(str_shuffle(str_repeat($pool, ceil($len/strlen($pool)))),0,$len);
-
- return $str;
- break;
- case 'unique' :
- case 'md5' :
-
- return md5(uniqid(mt_rand()));
- break;
- case 'encrypt' :
- case 'sha1' :
-
- $CI =& get_instance();
- $CI->load->helper('security');
-
- return do_hash(uniqid(mt_rand(), TRUE), 'sha1');
- break;
+ case 'basic':
+ return mt_rand();
+ case 'alnum':
+ case 'numeric':
+ case 'nozero':
+ case 'alpha':
+ switch ($type)
+ {
+ case 'alpha':
+ $pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
+ break;
+ case 'alnum':
+ $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
+ break;
+ case 'numeric':
+ $pool = '0123456789';
+ break;
+ case 'nozero':
+ $pool = '123456789';
+ break;
+ }
+ return substr(str_shuffle(str_repeat($pool, ceil($len / strlen($pool)))), 0, $len);
+ case 'unique':
+ case 'md5':
+ return md5(uniqid(mt_rand()));
+ case 'encrypt':
+ case 'sha1':
+ return sha1(uniqid(mt_rand(), TRUE));
}
}
}
@@ -255,7 +239,6 @@ if ( ! function_exists('increment_string'))
function increment_string($str, $separator = '_', $first = 1)
{
preg_match('/(.+)'.$separator.'([0-9]+)$/', $str, $match);
-
return isset($match[2]) ? $match[1].$separator.($match[2] + 1) : $str.$separator.$first;
}
}
@@ -267,7 +250,7 @@ if ( ! function_exists('increment_string'))
*
* Allows strings to be alternated. See docs...
*
- * @param string (as many parameters as needed)
+ * @param string (as many parameters as needed)
* @return string
*/
if ( ! function_exists('alternator'))
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php
index cc501c334..c1c0eb947 100644
--- a/system/helpers/text_helper.php
+++ b/system/helpers/text_helper.php
@@ -58,7 +58,7 @@ if ( ! function_exists('word_limiter'))
preg_match('/^\s*+(?:\S++\s*+){1,'.(int) $limit.'}/', $str, $matches);
- if (strlen($str) == strlen($matches[0]))
+ if (strlen($str) === strlen($matches[0]))
{
$end_char = '';
}
@@ -72,7 +72,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.
*
* @param string
@@ -89,14 +89,14 @@ if ( ! function_exists('character_limiter'))
return $str;
}
- $str = preg_replace("/\s+/", ' ', str_replace(array("\r\n", "\r", "\n"), ' ', $str));
+ $str = preg_replace('/\s+/', ' ', str_replace(array("\r\n", "\r", "\n"), ' ', $str));
if (strlen($str) <= $n)
{
return $str;
}
- $out = "";
+ $out = '';
foreach (explode(' ', trim($str)) as $val)
{
$out .= $val.' ';
@@ -104,7 +104,7 @@ if ( ! function_exists('character_limiter'))
if (strlen($out) >= $n)
{
$out = trim($out);
- return (strlen($out) == strlen($str)) ? $out : $out.$end_char;
+ return (strlen($out) === strlen($str)) ? $out : $out.$end_char;
}
}
}
@@ -138,7 +138,7 @@ if ( ! function_exists('ascii_to_entities'))
If the $temp array has a value but we have moved on, then it seems only
fair that we output that entity and restart $temp before continuing. -Paul
*/
- if (count($temp) == 1)
+ if (count($temp) === 1)
{
$out .= '&#'.array_shift($temp).';';
$count = 1;
@@ -148,16 +148,18 @@ if ( ! function_exists('ascii_to_entities'))
}
else
{
- if (count($temp) == 0)
+ if (count($temp) === 0)
{
$count = ($ordinal < 224) ? 2 : 3;
}
$temp[] = $ordinal;
- if (count($temp) == $count)
+ if (count($temp) === $count)
{
- $number = ($count == 3) ? (($temp['0'] % 16) * 4096) + (($temp['1'] % 64) * 64) + ($temp['2'] % 64) : (($temp['0'] % 32) * 64) + ($temp['1'] % 64);
+ $number = ($count === 3)
+ ? (($temp[0] % 16) * 4096) + (($temp[1] % 64) * 64) + ($temp[2] % 64)
+ : (($temp[0] % 32) * 64) + ($temp[1] % 64);
$out .= '&#'.$number.';';
$count = 1;
@@ -187,10 +189,9 @@ if ( ! function_exists('entities_to_ascii'))
{
if (preg_match_all('/\&#(\d+)\;/', $str, $matches))
{
- for ($i = 0, $s = count($matches['0']); $i < $s; $i++)
+ for ($i = 0, $s = count($matches[0]); $i < $s; $i++)
{
- $digits = $matches['1'][$i];
-
+ $digits = $matches[1][$i];
$out = '';
if ($digits < 128)
@@ -200,25 +201,24 @@ if ( ! function_exists('entities_to_ascii'))
}
elseif ($digits < 2048)
{
- $out .= chr(192 + (($digits - ($digits % 64)) / 64));
- $out .= chr(128 + ($digits % 64));
+ $out .= chr(192 + (($digits - ($digits % 64)) / 64)).chr(128 + ($digits % 64));
}
else
{
- $out .= chr(224 + (($digits - ($digits % 4096)) / 4096));
- $out .= chr(128 + ((($digits % 4096) - ($digits % 64)) / 64));
- $out .= chr(128 + ($digits % 64));
+ $out .= chr(224 + (($digits - ($digits % 4096)) / 4096))
+ .chr(128 + ((($digits % 4096) - ($digits % 64)) / 64))
+ .chr(128 + ($digits % 64));
}
- $str = str_replace($matches['0'][$i], $out, $str);
+ $str = str_replace($matches[0][$i], $out, $str);
}
}
if ($all)
{
- $str = str_replace(array("&amp;", "&lt;", "&gt;", "&quot;", "&apos;", "&#45;"),
- array("&","<",">","\"", "'", "-"),
- $str);
+ return str_replace(array('&amp;', '&lt;', '&gt;', '&quot;', '&apos;', '&#45;'),
+ array('&', '<', '>', '"', "'", '-'),
+ $str);
}
return $str;
@@ -286,27 +286,33 @@ if ( ! function_exists('highlight_code'))
{
function highlight_code($str)
{
- // The highlight string function encodes and highlights
- // brackets so we need them to start raw
- $str = str_replace(array('&lt;', '&gt;'), array('<', '>'), $str);
-
- // Replace any existing PHP tags to temporary markers so they don't accidentally
- // break the string out of PHP, and thus, thwart the highlighting.
- $str = str_replace(array('<?', '?>', '<%', '%>', '\\', '</script>'),
- array('phptagopen', 'phptagclose', 'asptagopen', 'asptagclose', 'backslashtmp', 'scriptclose'),
+ /* The highlight string function encodes and highlights
+ * brackets so we need them to start raw.
+ *
+ * Also replace any existing PHP tags to temporary markers
+ * so they don't accidentally break the string out of PHP,
+ * and thus, thwart the highlighting.
+ */
+ $str = str_replace(array('&lt;', '&gt;', '<?', '?>', '<%', '%>', '\\', '</script>'),
+ array('<', '>', 'phptagopen', 'phptagclose', 'asptagopen', 'asptagclose', 'backslashtmp', 'scriptclose'),
$str);
// The highlight_string function requires that the text be surrounded
// by PHP tags, which we will remove later
- $str = '<?php '.$str.' ?>'; // <?
-
- // All the magic happens here, baby!
- $str = highlight_string($str, TRUE);
+ $str = highlight_string('<?php '.$str.' ?>', TRUE);
// Remove our artificially added PHP, and the syntax highlighting that came with it
- $str = preg_replace('/<span style="color: #([A-Z0-9]+)">&lt;\?php(&nbsp;| )/i', '<span style="color: #$1">', $str);
- $str = preg_replace('/(<span style="color: #[A-Z0-9]+">.*?)\?&gt;<\/span>\n<\/span>\n<\/code>/is', "$1</span>\n</span>\n</code>", $str);
- $str = preg_replace('/<span style="color: #[A-Z0-9]+"\><\/span>/i', '', $str);
+ $str = preg_replace(array(
+ '/<span style="color: #([A-Z0-9]+)">&lt;\?php(&nbsp;| )/i',
+ '/(<span style="color: #[A-Z0-9]+">.*?)\?&gt;<\/span>\n<\/span>\n<\/code>/is',
+ '/<span style="color: #[A-Z0-9]+"\><\/span>/i'
+ ),
+ array(
+ '<span style="color: #$1">',
+ "$1</span>\n</span>\n</code>",
+ ''
+ ),
+ $str);
// Replace our markers back to PHP tags.
return str_replace(array('phptagopen', 'phptagclose', 'asptagopen', 'asptagclose', 'backslashtmp', 'scriptclose'),
@@ -339,7 +345,7 @@ if ( ! function_exists('highlight_phrase'))
if ($phrase != '')
{
- return preg_replace('/('.preg_quote($phrase, '/').')/i', $tag_open."\\1".$tag_close, $str);
+ return preg_replace('/('.preg_quote($phrase, '/').')/i', $tag_open.'\\1'.$tag_close, $str);
}
return $str;
@@ -358,18 +364,23 @@ if ( ! function_exists('convert_accented_characters'))
{
function convert_accented_characters($str)
{
- if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php'))
- {
- include(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php');
- }
- elseif (is_file(APPPATH.'config/foreign_chars.php'))
- {
- include(APPPATH.'config/foreign_chars.php');
- }
+ global $foreign_characters;
- if ( ! isset($foreign_characters))
+ if ( ! isset($foreign_characters) OR ! is_array($foreign_characters))
{
- return $str;
+ if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php'))
+ {
+ include(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php');
+ }
+ elseif (is_file(APPPATH.'config/foreign_chars.php'))
+ {
+ include(APPPATH.'config/foreign_chars.php');
+ }
+
+ if ( ! isset($foreign_characters) OR ! is_array($foreign_characters))
+ {
+ return $str;
+ }
}
return preg_replace(array_keys($foreign_characters), array_values($foreign_characters), $str);
@@ -381,7 +392,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.
*
@@ -391,14 +402,16 @@ if ( ! function_exists('convert_accented_characters'))
*/
if ( ! function_exists('word_wrap'))
{
- function word_wrap($str, $charlim = '76')
+ function word_wrap($str, $charlim = 76)
{
- // Se the character limit
+ // Set the character limit
if ( ! is_numeric($charlim))
+ {
$charlim = 76;
+ }
// Reduce multiple spaces
- $str = preg_replace("| +|", " ", $str);
+ $str = preg_replace('| +|', ' ', $str);
// Standardize newlines
if (strpos($str, "\r") !== FALSE)
@@ -409,22 +422,22 @@ if ( ! function_exists('word_wrap'))
// If the current word is surrounded by {unwrap} tags we'll
// strip the entire chunk and replace it with a marker.
$unwrap = array();
- if (preg_match_all("|(\{unwrap\}.+?\{/unwrap\})|s", $str, $matches))
+ if (preg_match_all('|(\{unwrap\}.+?\{/unwrap\})|s', $str, $matches))
{
- for ($i = 0; $i < count($matches['0']); $i++)
+ for ($i = 0, $c = count($matches[0]); $i < $c; $i++)
{
- $unwrap[] = $matches['1'][$i];
- $str = str_replace($matches['1'][$i], "{{unwrapped".$i."}}", $str);
+ $unwrap[] = $matches[1][$i];
+ $str = str_replace($matches[1][$i], '{{unwrapped'.$i.'}}', $str);
}
}
// 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
- $output = "";
+ $output = '';
foreach (explode("\n", $str) as $line)
{
// Is the line within the allowed character count?
@@ -439,28 +452,26 @@ if ( ! function_exists('word_wrap'))
while ((strlen($line)) > $charlim)
{
// If the over-length word is a URL we won't wrap it
- if (preg_match("!\[url.+\]|://|wwww.!", $line))
+ if (preg_match('!\[url.+\]|://|wwww.!', $line))
{
break;
}
// Trim the word down
- $temp .= substr($line, 0, $charlim-1);
- $line = substr($line, $charlim-1);
+ $temp .= substr($line, 0, $charlim - 1);
+ $line = substr($line, $charlim - 1);
}
// If $temp contains data it means we had to split up an over-length
// word into smaller chunks so we'll add it back to our current line
if ($temp != '')
{
- $output .= $temp."\n".$line;
+ $output .= $temp."\n".$line."\n";
}
else
{
- $output .= $line;
+ $output .= $line."\n";
}
-
- $output .= "\n";
}
// Put our markers back
@@ -468,14 +479,12 @@ if ( ! function_exists('word_wrap'))
{
foreach ($unwrap as $key => $val)
{
- $output = str_replace("{{unwrapped".$key."}}", $val, $output);
+ $output = str_replace('{{unwrapped'.$key.'}}', $val, $output);
}
}
- // Remove the unwrap tags
- $output = str_replace(array('{unwrap}', '{/unwrap}'), '', $output);
-
- return $output;
+ // Remove the unwrap tags and return
+ return str_replace(array('{unwrap}', '{/unwrap}'), '', $output);
}
}
@@ -506,7 +515,6 @@ if ( ! function_exists('ellipsize'))
}
$beg = substr($str, 0, floor($max_length * $position));
-
$position = ($position > 1) ? 1 : $position;
if ($position === 1)
diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php
index f98241617..0493d5a6e 100644
--- a/system/libraries/Cache/Cache.php
+++ b/system/libraries/Cache/Cache.php
@@ -36,16 +36,38 @@
*/
class CI_Cache extends CI_Driver_Library {
- protected $valid_drivers = array(
- 'cache_apc',
- 'cache_file',
- 'cache_memcached',
- 'cache_dummy',
- 'cache_wincache'
- );
-
- protected $_cache_path = NULL; // Path of cache files (if file-based cache)
- protected $_adapter = 'dummy';
+ /**
+ * Valid cache drivers
+ *
+ * @var array
+ */
+ protected $valid_drivers = array(
+ 'cache_apc',
+ 'cache_file',
+ 'cache_memcached',
+ 'cache_dummy',
+ 'cache_wincache'
+ );
+
+ /**
+ * Path of cache files (if file-based cache)
+ *
+ * @var string
+ */
+ protected $_cache_path = NULL;
+
+ /**
+ * Reference to the driver
+ *
+ * @var mixed
+ */
+ protected $_adapter = 'dummy';
+
+ /**
+ * Fallback driver
+ *
+ * @param string
+ */
protected $_backup_driver;
/**
@@ -59,9 +81,9 @@ class CI_Cache extends CI_Driver_Library {
public function __construct($config = array())
{
$default_config = array(
- 'adapter',
- 'memcached'
- );
+ 'adapter',
+ 'memcached'
+ );
foreach ($default_config as $key)
{
diff --git a/system/libraries/Cache/drivers/Cache_apc.php b/system/libraries/Cache/drivers/Cache_apc.php
index 59ab67533..c85034f95 100644
--- a/system/libraries/Cache/drivers/Cache_apc.php
+++ b/system/libraries/Cache/drivers/Cache_apc.php
@@ -75,7 +75,7 @@ class CI_Cache_apc extends CI_Driver {
* Delete from Cache
*
* @param mixed unique identifier of the item in the cache
- * @param bool true on success/false on failure
+ * @return bool true on success/false on failure
*/
public function delete($id)
{
diff --git a/system/libraries/Cache/drivers/Cache_dummy.php b/system/libraries/Cache/drivers/Cache_dummy.php
index e8b791c5b..3f2b4b956 100644
--- a/system/libraries/Cache/drivers/Cache_dummy.php
+++ b/system/libraries/Cache/drivers/Cache_dummy.php
@@ -70,7 +70,7 @@ class CI_Cache_dummy extends CI_Driver {
* Delete from Cache
*
* @param mixed unique identifier of the item in the cache
- * @param bool TRUE, simulating success
+ * @return bool TRUE, simulating success
*/
public function delete($id)
{
diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php
index dd27aa90e..ec4195278 100644
--- a/system/libraries/Cache/drivers/Cache_file.php
+++ b/system/libraries/Cache/drivers/Cache_file.php
@@ -36,8 +36,16 @@
*/
class CI_Cache_file extends CI_Driver {
+ /**
+ * Directory in which to save cache files
+ *
+ * @var string
+ */
protected $_cache_path;
+ /**
+ * Initialize file-based cache
+ */
public function __construct()
{
$CI =& get_instance();
@@ -86,10 +94,10 @@ class CI_Cache_file extends CI_Driver {
public function save($id, $data, $ttl = 60)
{
$contents = array(
- 'time' => time(),
- 'ttl' => $ttl,
- 'data' => $data
- );
+ 'time' => time(),
+ 'ttl' => $ttl,
+ 'data' => $data
+ );
if (write_file($this->_cache_path.$id, serialize($contents)))
{
diff --git a/system/libraries/Cache/drivers/Cache_memcached.php b/system/libraries/Cache/drivers/Cache_memcached.php
index 4cd5f3d6f..813df4b1c 100644
--- a/system/libraries/Cache/drivers/Cache_memcached.php
+++ b/system/libraries/Cache/drivers/Cache_memcached.php
@@ -36,15 +36,25 @@
*/
class CI_Cache_memcached extends CI_Driver {
- protected $_memcached; // Holds the memcached object
+ /**
+ * Holds the memcached object
+ *
+ * @var object
+ */
+ protected $_memcached;
+ /**
+ * Memcached configuration
+ *
+ * @var array
+ */
protected $_memcache_conf = array(
- 'default' => array(
- 'default_host' => '127.0.0.1',
- 'default_port' => 11211,
- 'default_weight' => 1
- )
- );
+ 'default' => array(
+ 'default_host' => '127.0.0.1',
+ 'default_port' => 11211,
+ 'default_weight' => 1
+ )
+ );
/**
* Fetch from cache
diff --git a/system/libraries/Cache/drivers/Cache_wincache.php b/system/libraries/Cache/drivers/Cache_wincache.php
index b32e66a46..74048d564 100644
--- a/system/libraries/Cache/drivers/Cache_wincache.php
+++ b/system/libraries/Cache/drivers/Cache_wincache.php
@@ -78,7 +78,7 @@ class CI_Cache_wincache extends CI_Driver {
* Delete from Cache
*
* @param mixed unique identifier of the item in the cache
- * @param bool true on success/false on failure
+ * @return bool true on success/false on failure
*/
public function delete($id)
{
diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php
index b6f145d95..4db754f5e 100644
--- a/system/libraries/Calendar.php
+++ b/system/libraries/Calendar.php
@@ -38,14 +38,60 @@
*/
class CI_Calendar {
+ /**
+ * Reference to CodeIgniter instance
+ *
+ * @var object
+ */
protected $CI;
- public $lang;
+
+ /**
+ * Current local time
+ *
+ * @var int
+ */
public $local_time;
+
+ /**
+ * Calendar layout template
+ *
+ * @var string
+ */
public $template = '';
+
+ /**
+ * Day of the week to start the calendar on
+ *
+ * @var string
+ */
public $start_day = 'sunday';
+
+ /**
+ * How to display months
+ *
+ * @var string
+ */
public $month_type = 'long';
+
+ /**
+ * How to display names of days
+ *
+ * @var string
+ */
public $day_type = 'abr';
+
+ /**
+ * Whether to show next/prev month links
+ *
+ * @var bool
+ */
public $show_next_prev = FALSE;
+
+ /**
+ * Url base to use for next/prev month links
+ *
+ * @var bool
+ */
public $next_prev_url = '';
/**
@@ -403,28 +449,28 @@ class CI_Calendar {
public function default_template()
{
return array (
- 'table_open' => '<table border="0" cellpadding="4" cellspacing="0">',
- 'heading_row_start' => '<tr>',
- 'heading_previous_cell' => '<th><a href="{previous_url}">&lt;&lt;</a></th>',
- 'heading_title_cell' => '<th colspan="{colspan}">{heading}</th>',
- 'heading_next_cell' => '<th><a href="{next_url}">&gt;&gt;</a></th>',
- 'heading_row_end' => '</tr>',
- 'week_row_start' => '<tr>',
- 'week_day_cell' => '<td>{week_day}</td>',
- 'week_row_end' => '</tr>',
- 'cal_row_start' => '<tr>',
- 'cal_cell_start' => '<td>',
- 'cal_cell_start_today' => '<td>',
- 'cal_cell_content' => '<a href="{content}">{day}</a>',
- 'cal_cell_content_today' => '<a href="{content}"><strong>{day}</strong></a>',
- 'cal_cell_no_content' => '{day}',
- 'cal_cell_no_content_today' => '<strong>{day}</strong>',
- 'cal_cell_blank' => '&nbsp;',
- 'cal_cell_end' => '</td>',
- 'cal_cell_end_today' => '</td>',
- 'cal_row_end' => '</tr>',
- 'table_close' => '</table>'
- );
+ 'table_open' => '<table border="0" cellpadding="4" cellspacing="0">',
+ 'heading_row_start' => '<tr>',
+ 'heading_previous_cell' => '<th><a href="{previous_url}">&lt;&lt;</a></th>',
+ 'heading_title_cell' => '<th colspan="{colspan}">{heading}</th>',
+ 'heading_next_cell' => '<th><a href="{next_url}">&gt;&gt;</a></th>',
+ 'heading_row_end' => '</tr>',
+ 'week_row_start' => '<tr>',
+ 'week_day_cell' => '<td>{week_day}</td>',
+ 'week_row_end' => '</tr>',
+ 'cal_row_start' => '<tr>',
+ 'cal_cell_start' => '<td>',
+ 'cal_cell_start_today' => '<td>',
+ 'cal_cell_content' => '<a href="{content}">{day}</a>',
+ 'cal_cell_content_today' => '<a href="{content}"><strong>{day}</strong></a>',
+ 'cal_cell_no_content' => '{day}',
+ 'cal_cell_no_content_today' => '<strong>{day}</strong>',
+ 'cal_cell_blank' => '&nbsp;',
+ 'cal_cell_end' => '</td>',
+ 'cal_cell_end_today' => '</td>',
+ 'cal_row_end' => '</tr>',
+ 'table_close' => '</table>'
+ );
}
// --------------------------------------------------------------------
diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php
index ca7be555e..eee123584 100644
--- a/system/libraries/Cart.php
+++ b/system/libraries/Cart.php
@@ -36,19 +36,53 @@
*/
class CI_Cart {
- // These are the regular expression rules that we use to validate the product ID and product name
- public $product_id_rules = '\.a-z0-9_-'; // alpha-numeric, dashes, underscores, or periods
- public $product_name_rules = '\.\:\-_ a-z0-9'; // alpha-numeric, dashes, underscores, colons or periods
- public $product_name_safe = TRUE; // only allow safe product names
+ /**
+ * These are the regular expression rules that we use to validate the product ID and product name
+ * alpha-numeric, dashes, underscores, or periods
+ *
+ * @var string
+ */
+ public $product_id_rules = '\.a-z0-9_-';
+
+ /**
+ * These are the regular expression rules that we use to validate the product ID and product name
+ * alpha-numeric, dashes, underscores, colons or periods
+ *
+ * @var string
+ */
+ public $product_name_rules = '\.\:\-_ a-z0-9';
+
+ /**
+ * only allow safe product names
+ *
+ * @var bool
+ */
+ public $product_name_safe = TRUE;
+ // --------------------------------------------------------------------------
// Protected variables. Do not change!
+ // --------------------------------------------------------------------------
+
+ /**
+ * Reference to CodeIgniter instance
+ *
+ * @var object
+ */
protected $CI;
+
+ /**
+ * Contents of the cart
+ *
+ * @var array
+ */
protected $_cart_contents = array();
/**
* Shopping Class Constructor
*
* The constructor loads the Session class, used to store the shopping cart contents.
+ *
+ * @param array
*/
public function __construct($params = array())
{
@@ -245,7 +279,6 @@ class CI_Cart {
* product ID and quantity for each item.
*
* @param array
- * @param string
* @return bool
*/
public function update($items = array())
@@ -396,6 +429,7 @@ class CI_Cart {
*
* Removes an item from the cart
*
+ * @param int
* @return bool
*/
public function remove($rowid)
@@ -427,6 +461,7 @@ class CI_Cart {
*
* Returns the entire cart array
*
+ * @param bool
* @return array
*/
public function contents($newest_first = FALSE)
@@ -449,6 +484,7 @@ class CI_Cart {
* Returns TRUE if the rowid passed to this function correlates to an item
* that has options associated with it.
*
+ * @param mixed
* @return bool
*/
public function has_options($rowid = '')
diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php
index f409f47d4..b1fff154d 100644
--- a/system/libraries/Driver.php
+++ b/system/libraries/Driver.php
@@ -39,11 +39,27 @@
*/
class CI_Driver_Library {
- protected $valid_drivers = array();
+ /**
+ * Array of drivers that are available to use with the driver class
+ *
+ * @var array
+ */
+ protected $valid_drivers = array();
+
+ /**
+ * Name of the current class - usually the driver class
+ *
+ * @var string
+ */
protected static $lib_name;
- // The first time a child is used it won't exist, so we instantiate it
- // subsequents calls will go straight to the proper child.
+ /**
+ * The first time a child is used it won't exist, so we instantiate it
+ * subsequents calls will go straight to the proper child.
+ *
+ * @param mixed $child
+ * @return mixed
+ */
public function __get($child)
{
if ( ! isset($this->lib_name))
@@ -100,6 +116,8 @@ class CI_Driver_Library {
}
+// --------------------------------------------------------------------------
+
/**
* CodeIgniter Driver Class
*
@@ -114,11 +132,32 @@ class CI_Driver_Library {
*/
class CI_Driver {
+ /**
+ * Instance of the parent class
+ *
+ * @var object
+ */
protected $_parent;
+ /**
+ * List of methods in the parent class
+ *
+ * @var array
+ */
protected $_methods = array();
+
+ /**
+ * List of properties in the parent class
+ *
+ * @var array
+ */
protected $_properties = array();
+ /**
+ * Array of methods and properties for the parent class(es)
+ *
+ * @var array
+ */
protected static $_reflections = array();
/**
diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php
index 54b5bf737..17437c1ca 100644
--- a/system/libraries/Encrypt.php
+++ b/system/libraries/Encrypt.php
@@ -38,12 +38,44 @@
*/
class CI_Encrypt {
+ /**
+ * Reference to the user's encryption key
+ *
+ * @var string
+ */
public $encryption_key = '';
+
+ /**
+ * Type of hash operation
+ *
+ * @var string
+ */
protected $_hash_type = 'sha1';
+
+ /**
+ * Flag for the existance of mcrypt
+ *
+ * @var bool
+ */
protected $_mcrypt_exists = FALSE;
+
+ /**
+ * Current cipher to be used with mcrypt
+ *
+ * @var string
+ */
protected $_mcrypt_cipher;
+
+ /**
+ * Method for encrypting/decrypting data
+ *
+ * @var int
+ */
protected $_mcrypt_mode;
+ /**
+ * Initialize Encryption class
+ */
public function __construct()
{
$this->_mcrypt_exists = function_exists('mcrypt_encrypt');
@@ -349,7 +381,8 @@ class CI_Encrypt {
*
* Function description
*
- * @param string
+ * @param string $data
+ * @param string $key
* @return string
*/
protected function _remove_cipher_noise($data, $key)
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index 22bc7ddf3..a52cad5ff 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -36,17 +36,81 @@
*/
class CI_Form_validation {
+ /**
+ * Reference to the CodeIgniter instance
+ *
+ * @var object
+ */
protected $CI;
- protected $_field_data = array();
- protected $_config_rules = array();
+
+ /**
+ * Validation data for the current form submission
+ *
+ * @var array
+ */
+ protected $_field_data = array();
+
+ /**
+ * Validation rules for the current form
+ *
+ * @var array
+ */
+ protected $_config_rules = array();
+
+ /**
+ * Array of validation errors
+ *
+ * @var array
+ */
protected $_error_array = array();
+
+ /**
+ * Array of custom error messages
+ *
+ * @var array
+ */
protected $_error_messages = array();
+
+ /**
+ * Start tag for error wrapping
+ *
+ * @var string
+ */
protected $_error_prefix = '<p>';
+
+ /**
+ * End tag for error wrapping
+ *
+ * @var string
+ */
protected $_error_suffix = '</p>';
+
+ /**
+ * Custom error message
+ *
+ * @var string
+ */
protected $error_string = '';
+
+ /**
+ * Whether the form data has been validated as safe
+ *
+ * @var bool
+ */
protected $_safe_form_data = FALSE;
+
+ /**
+ * Custom data to validate
+ *
+ * @var array
+ */
protected $validation_data = array();
+ /**
+ * Initialize Form_Validation class
+ *
+ * @param array $rules
+ */
public function __construct($rules = array())
{
$this->CI =& get_instance();
@@ -86,8 +150,9 @@ class CI_Form_validation {
* This function takes an array of field names and validation
* rules as input, validates the info, and stores it
*
- * @param mixed
- * @param string
+ * @param mixed $field
+ * @param string $label
+ * @param mixed $rules
* @return object
*/
public function set_rules($field, $label = '', $rules = '')
@@ -241,6 +306,8 @@ class CI_Form_validation {
* Gets the error message associated with a particular field
*
* @param string the field name
+ * @param string the html start tag
+ * @param strign the html end tag
* @return string
*/
public function error($field = '', $prefix = '', $suffix = '')
@@ -326,6 +393,7 @@ class CI_Form_validation {
*
* This function does all the work.
*
+ * @param string $group
* @return bool
*/
public function run($group = '')
@@ -768,6 +836,7 @@ class CI_Form_validation {
*
* @param string
* @param string
+ * @param bool
* @return string
*/
public function set_select($field = '', $value = '', $default = FALSE)
@@ -803,6 +872,7 @@ class CI_Form_validation {
*
* @param string
* @param string
+ * @param bool
* @return string
*/
public function set_radio($field = '', $value = '', $default = FALSE)
@@ -838,6 +908,7 @@ class CI_Form_validation {
*
* @param string
* @param string
+ * @param bool
* @return string
*/
public function set_checkbox($field = '', $value = '', $default = FALSE)
@@ -1116,6 +1187,7 @@ class CI_Form_validation {
* Greater than
*
* @param string
+ * @param int
* @return bool
*/
public function greater_than($str, $min)
@@ -1129,6 +1201,7 @@ class CI_Form_validation {
* Equal to or Greater than
*
* @param string
+ * @param int
* @return bool
*/
public function greater_than_equal_to($str, $min)
@@ -1142,6 +1215,7 @@ class CI_Form_validation {
* Less than
*
* @param string
+ * @param int
* @return bool
*/
public function less_than($str, $max)
@@ -1155,6 +1229,7 @@ class CI_Form_validation {
* Equal to or Less than
*
* @param string
+ * @param int
* @return bool
*/
public function less_than_equal_to($str, $max)
diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php
index 1ab8b23e0..24695049c 100644
--- a/system/libraries/Image_lib.php
+++ b/system/libraries/Image_lib.php
@@ -36,56 +36,335 @@
*/
class CI_Image_lib {
- public $image_library = 'gd2'; // Can be: imagemagick, netpbm, gd, gd2
+ /**
+ * PHP extension/library to use for image manipulation
+ * Can be: imagemagick, netpbm, gd, gd2
+ *
+ * @var string
+ */
+ public $image_library = 'gd2';
+
+ /**
+ * Path to the graphic library (if applicable)
+ *
+ * @var string
+ */
public $library_path = '';
- public $dynamic_output = FALSE; // Whether to send to browser or write to disk
+
+ /**
+ * Whether to send to browser or write to disk
+ *
+ * @var bool
+ */
+ public $dynamic_output = FALSE;
+
+ /**
+ * Path to original image
+ *
+ * @var string
+ */
public $source_image = '';
+
+ /**
+ * Path to the modified image
+ *
+ * @var string
+ */
public $new_image = '';
+
+ /**
+ * Image width
+ *
+ * @var int
+ */
public $width = '';
+
+ /**
+ * Image height
+ *
+ * @var int
+ */
public $height = '';
+
+ /**
+ * Quality percentage of new image
+ *
+ * @var int
+ */
public $quality = '90';
+
+ /**
+ * Whether to create a thumbnail
+ *
+ * @var bool
+ */
public $create_thumb = FALSE;
+
+ /**
+ * String to add to thumbnail version of image
+ *
+ * @var string
+ */
public $thumb_marker = '_thumb';
- public $maintain_ratio = TRUE; // Whether to maintain aspect ratio when resizing or use hard values
- public $master_dim = 'auto'; // auto, height, or width. Determines what to use as the master dimension
+
+ /**
+ * Whether to maintain aspect ratio when resizing or use hard values
+ *
+ * @var bool
+ */
+ public $maintain_ratio = TRUE;
+
+ /**
+ * auto, height, or width. Determines what to use as the master dimension
+ *
+ * @var string
+ */
+ public $master_dim = 'auto';
+
+ /**
+ * Angle at to rotate image
+ *
+ * @var string
+ */
public $rotation_angle = '';
+
+ /**
+ * X Coordinate for manipulation of the current image
+ *
+ * @var int
+ */
public $x_axis = '';
+
+ /**
+ * Y Coordinate for manipulation of the current image
+ *
+ * @var int
+ */
public $y_axis = '';
+ // --------------------------------------------------------------------------
// Watermark Vars
- public $wm_text = ''; // Watermark text if graphic is not used
- public $wm_type = 'text'; // Type of watermarking. Options: text/overlay
+ // --------------------------------------------------------------------------
+
+ /**
+ * Watermark text if graphic is not used
+ *
+ * @var string
+ */
+ public $wm_text = '';
+
+ /**
+ * Type of watermarking. Options: text/overlay
+ *
+ * @var string
+ */
+ public $wm_type = 'text';
+
+ /**
+ * Default transparency for watermark
+ *
+ * @var int
+ */
public $wm_x_transp = 4;
+
+ /**
+ * Default transparency for watermark
+ *
+ * @var int
+ */
public $wm_y_transp = 4;
- public $wm_overlay_path = ''; // Watermark image path
- public $wm_font_path = ''; // TT font
- public $wm_font_size = 17; // Font size (different versions of GD will either use points or pixels)
- public $wm_vrt_alignment = 'B'; // Vertical alignment: T M B
- public $wm_hor_alignment = 'C'; // Horizontal alignment: L R C
- public $wm_padding = 0; // Padding around text
- public $wm_hor_offset = 0; // Lets you push text to the right
- public $wm_vrt_offset = 0; // Lets you push text down
- protected $wm_font_color = '#ffffff'; // Text color
- protected $wm_shadow_color = ''; // Dropshadow color
- public $wm_shadow_distance = 2; // Dropshadow distance
- public $wm_opacity = 50; // Image opacity: 1 - 100 Only works with image
+
+ /**
+ * Watermark image path
+ *
+ * @var string
+ */
+ public $wm_overlay_path = '';
+
+ /**
+ * TT font
+ *
+ * @var string
+ */
+ public $wm_font_path = '';
+
+ /**
+ * Font size (different versions of GD will either use points or pixels)
+ *
+ * @var int
+ */
+ public $wm_font_size = 17;
+
+ /**
+ * Vertical alignment: T M B
+ *
+ * @var string
+ */
+ public $wm_vrt_alignment = 'B';
+
+ /**
+ * Horizontal alignment: L R C
+ *
+ * @var string
+ */
+ public $wm_hor_alignment = 'C';
+
+ /**
+ * Padding around text
+ *
+ * @var int
+ */
+ public $wm_padding = 0;
+
+ /**
+ * Lets you push text to the right
+ *
+ * @var int
+ */
+ public $wm_hor_offset = 0;
+
+ /**
+ * Lets you push text down
+ *
+ * @var int
+ */
+ public $wm_vrt_offset = 0;
+
+ /**
+ * Text color
+ *
+ * @var string
+ */
+ protected $wm_font_color = '#ffffff';
+
+ /**
+ * Dropshadow color
+ *
+ * @var string
+ */
+ protected $wm_shadow_color = '';
+
+ /**
+ * Dropshadow distance
+ *
+ * @var int
+ */
+ public $wm_shadow_distance = 2;
+
+ /**
+ * Image opacity: 1 - 100 Only works with image
+ *
+ * @var int
+ */
+ public $wm_opacity = 50;
+ // --------------------------------------------------------------------------
// Private Vars
+ // --------------------------------------------------------------------------
+
+ /**
+ * Source image folder
+ *
+ * @var string
+ */
public $source_folder = '';
+
+ /**
+ * Destination image folder
+ *
+ * @var string
+ */
public $dest_folder = '';
+
+ /**
+ * Image mime-type
+ *
+ * @var string
+ */
public $mime_type = '';
+
+ /**
+ * Original image width
+ *
+ * @var int
+ */
public $orig_width = '';
+
+ /**
+ * Original image height
+ *
+ * @var int
+ */
public $orig_height = '';
+
+ /**
+ * Image format
+ *
+ * @var string
+ */
public $image_type = '';
+
+ /**
+ * Size of current image
+ *
+ * @var string
+ */
public $size_str = '';
+
+ /**
+ * Full path to source image
+ *
+ * @var string
+ */
public $full_src_path = '';
+
+ /**
+ * Full path to destination image
+ *
+ * @var string
+ */
public $full_dst_path = '';
+
+ /**
+ * Name of function to create image
+ *
+ * @var string
+ */
public $create_fnc = 'imagecreatetruecolor';
+
+ /**
+ * Name of function to copy image
+ *
+ * @var string
+ */
public $copy_fnc = 'imagecopyresampled';
+
+ /**
+ * Error messages
+ *
+ * @var array
+ */
public $error_msg = array();
+
+ /**
+ * Whether to have a drop shadow on watermark
+ *
+ * @var bool
+ */
protected $wm_use_drop_shadow = FALSE;
+
+ /**
+ * Whether to use truetype fonts
+ *
+ * @var bool
+ */
public $wm_use_truetype = FALSE;
+ /**
+ * Initialize Image Library
+ *
+ * @param array $props
+ */
public function __construct($props = array())
{
if (count($props) > 0)
@@ -804,7 +1083,6 @@ class CI_Image_lib {
* This is a wrapper function that chooses the type
* of watermarking based on the specified preference.
*
- * @param string
* @return bool
*/
public function watermark()
@@ -1060,6 +1338,7 @@ class CI_Image_lib {
* based on the type of image being processed
*
* @param string
+ * @param string
* @return resource
*/
public function image_create_gd($path = '', $image_type = '')
@@ -1261,6 +1540,7 @@ class CI_Image_lib {
* A helper function that gets info about the file
*
* @param string
+ * @param bool
* @return mixed
*/
public function get_image_properties($path = '', $return = FALSE)
@@ -1452,6 +1732,7 @@ class CI_Image_lib {
* Show error messages
*
* @param string
+ * @param string
* @return string
*/
public function display_errors($open = '<p>', $close = '</p>')
diff --git a/system/libraries/Javascript.php b/system/libraries/Javascript.php
index 629a3adfe..dd2df697c 100644
--- a/system/libraries/Javascript.php
+++ b/system/libraries/Javascript.php
@@ -723,7 +723,7 @@ class CI_Javascript {
{
if (is_object($result))
{
- $json_result = $result->result_array();
+ $json_result = is_callable(array($result, 'result_array')) ? $result->result_array() : (array) $result;
}
elseif (is_array($result))
{
diff --git a/system/libraries/Log.php b/system/libraries/Log.php
index 66f9ebff9..c10363a2e 100644
--- a/system/libraries/Log.php
+++ b/system/libraries/Log.php
@@ -36,14 +36,60 @@
*/
class CI_Log {
+ /**
+ * Path to save log files
+ *
+ * @var string
+ */
protected $_log_path;
+
+ /**
+ * Level of logging
+ *
+ * @var int
+ */
protected $_threshold = 1;
+
+ /**
+ * Highest level of logging
+ *
+ * @var int
+ */
protected $_threshold_max = 0;
+
+ /**
+ * Array of threshold levels to log
+ *
+ * @var array
+ */
protected $_threshold_array = array();
+
+ /**
+ * Format of timestamp for log files
+ *
+ * @var string
+ */
protected $_date_fmt = 'Y-m-d H:i:s';
+
+ /**
+ * Whether or not the logger can write to the log files
+ *
+ * @var bool
+ */
protected $_enabled = TRUE;
+
+ /**
+ * Predefined logging levels
+ *
+ * @var array
+ */
protected $_levels = array('ERROR' => 1, 'DEBUG' => 2, 'INFO' => 3, 'ALL' => 4);
+ /**
+ * Initialize Logging class
+ *
+ * @return void
+ */
public function __construct()
{
$config =& get_config();
diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php
index a18fcb9f1..ce4683fc1 100644
--- a/system/libraries/Migration.php
+++ b/system/libraries/Migration.php
@@ -39,14 +39,53 @@
*/
class CI_Migration {
+ /**
+ * Whether the library is enabled
+ *
+ * @var bool
+ */
protected $_migration_enabled = FALSE;
+
+ /**
+ * Path to migration classes
+ *
+ * @var string
+ */
protected $_migration_path = NULL;
+
+ /**
+ * Current migration version
+ *
+ * @var mixed
+ */
protected $_migration_version = 0;
+
+ /**
+ * Database table with migration info
+ *
+ * @var string
+ */
protected $_migration_table = 'migrations';
+
+ /**
+ * Whether to automatically run migrations
+ *
+ * @var bool
+ */
protected $_migration_auto_latest = FALSE;
+ /**
+ * Error message
+ *
+ * @var string
+ */
protected $_error_string = '';
+ /**
+ * Initialize Migration Class
+ *
+ * @param array
+ */
public function __construct($config = array())
{
# Only run this constructor on main library load
diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php
index 0fe73d69f..3d2911813 100644
--- a/system/libraries/Pagination.php
+++ b/system/libraries/Pagination.php
@@ -94,17 +94,16 @@ class CI_Pagination {
{
foreach ($params as $key => $val)
{
- if (isset($this->$key))
+ if ($key === 'anchor_class')
+ {
+ $this->anchor_class = ($val != '') ? 'class="'.$val.'" ' : '';
+ }
+ elseif (isset($this->$key))
{
$this->$key = $val;
}
}
}
-
- if ($this->anchor_class != '')
- {
- $this->anchor_class = 'class="'.$this->anchor_class.'" ';
- }
}
// --------------------------------------------------------------------
diff --git a/system/libraries/Parser.php b/system/libraries/Parser.php
index d1b5b764b..c40f339b4 100644
--- a/system/libraries/Parser.php
+++ b/system/libraries/Parser.php
@@ -36,9 +36,25 @@
*/
class CI_Parser {
+ /**
+ * Left delimeter character for psuedo vars
+ *
+ * @var string
+ */
public $l_delim = '{';
+
+ /**
+ * Right delimeter character for psuedo vars
+ *
+ * @var string
+ */
public $r_delim = '}';
- public $object;
+
+ /**
+ * Reference to CodeIgniter instance
+ *
+ * @var object
+ */
protected $CI;
/**
diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php
index 6320ab50d..1e86f3c61 100644
--- a/system/libraries/Profiler.php
+++ b/system/libraries/Profiler.php
@@ -42,23 +42,45 @@
*/
class CI_Profiler {
+ /**
+ * List of profiler sections available to show
+ *
+ * @var array
+ */
protected $_available_sections = array(
- 'benchmarks',
- 'get',
- 'memory_usage',
- 'post',
- 'uri_string',
- 'controller_info',
- 'queries',
- 'http_headers',
- 'session_data',
- 'config'
- );
+ 'benchmarks',
+ 'get',
+ 'memory_usage',
+ 'post',
+ 'uri_string',
+ 'controller_info',
+ 'queries',
+ 'http_headers',
+ 'session_data',
+ 'config'
+ );
+ /**
+ * Number of queries to show before making the additional queries togglable
+ *
+ * @var int
+ */
protected $_query_toggle_count = 25;
+ /**
+ * Reference to the CodeIgniter singleton
+ *
+ * @var object
+ */
protected $CI;
+ /**
+ * Constructor
+ *
+ * Initialize Profiler
+ *
+ * @param array $config
+ */
public function __construct($config = array())
{
$this->CI =& get_instance();
diff --git a/system/libraries/Session.php b/system/libraries/Session.php
index 3515764ce..3fa446d84 100644
--- a/system/libraries/Session.php
+++ b/system/libraries/Session.php
@@ -36,26 +36,151 @@
*/
class CI_Session {
+ /**
+ * Whether to encrypt the session cookie
+ *
+ * @var bool
+ */
public $sess_encrypt_cookie = FALSE;
+
+ /**
+ * Whether to use to the database for session storage
+ *
+ * @var bool
+ */
public $sess_use_database = FALSE;
+
+ /**
+ * Name of the database table in which to store sessions
+ *
+ * @var string
+ */
public $sess_table_name = '';
+
+ /**
+ * Length of time (in seconds) for sessions to expire
+ *
+ * @var int
+ */
public $sess_expiration = 7200;
+
+ /**
+ * Whether to kill session on close of browser window
+ *
+ * @var bool
+ */
public $sess_expire_on_close = FALSE;
+
+ /**
+ * Whether to match session on ip address
+ *
+ * @var bool
+ */
public $sess_match_ip = FALSE;
+
+ /**
+ * Whether to match session on user-agent
+ *
+ * @var bool
+ */
public $sess_match_useragent = TRUE;
+
+ /**
+ * Name of session cookie
+ *
+ * @var string
+ */
public $sess_cookie_name = 'ci_session';
+
+ /**
+ * Session cookie prefix
+ *
+ * @var string
+ */
public $cookie_prefix = '';
+
+ /**
+ * Session cookie path
+ *
+ * @var string
+ */
public $cookie_path = '';
+
+ /**
+ * Session cookie domain
+ *
+ * @var string
+ */
public $cookie_domain = '';
+
+ /**
+ * Whether to set the cookie only on HTTPS connections
+ *
+ * @var bool
+ */
public $cookie_secure = FALSE;
+
+ /**
+ * Whether cookie should be allowed only to be sent by the server
+ *
+ * @var bool
+ */
public $cookie_httponly = FALSE;
+
+ /**
+ * Interval at which to update session
+ *
+ * @var int
+ */
public $sess_time_to_update = 300;
+
+ /**
+ * Key with which to encrypt the session cookie
+ *
+ * @var string
+ */
public $encryption_key = '';
+
+ /**
+ * String to indicate flash data cookies
+ *
+ * @var string
+ */
public $flashdata_key = 'flash';
+
+ /**
+ * Function to use to get the current time
+ *
+ * @var string
+ */
public $time_reference = 'time';
+
+ /**
+ * Probablity level of garbage collection of old sessions
+ *
+ * @var int
+ */
public $gc_probability = 5;
+
+ /**
+ * Session data
+ *
+ * @var array
+ */
public $userdata = array();
+
+ /**
+ * Reference to CodeIgniter instance
+ *
+ * @var object
+ */
public $CI;
+
+ /**
+ * Current time
+ *
+ * @var int
+ */
public $now;
/**
@@ -63,6 +188,8 @@ class CI_Session {
*
* The constructor runs the session routines automatically
* whenever the class is instantiated.
+ *
+ * @param array
*/
public function __construct($params = array())
{
@@ -525,6 +652,7 @@ class CI_Session {
/**
* Delete a session variable from the "userdata" array
*
+ * @param array
* @return void
*/
public function unset_userdata($newdata = array())
@@ -664,6 +792,7 @@ class CI_Session {
/**
* Write the session cookie
*
+ * @param mixed
* @return void
*/
protected function _set_cookie($cookie_data = NULL)
diff --git a/system/libraries/Table.php b/system/libraries/Table.php
index 3777d29ff..236129531 100644
--- a/system/libraries/Table.php
+++ b/system/libraries/Table.php
@@ -38,13 +38,60 @@
*/
class CI_Table {
+ /**
+ * Data for table rows
+ *
+ * @var array
+ */
public $rows = array();
+
+ /**
+ * Data for table heading
+ *
+ * @var array
+ */
public $heading = array();
+
+ /**
+ * Whether or not to automatically create the table header
+ *
+ * @var bool
+ */
public $auto_heading = TRUE;
+
+ /**
+ * Table caption
+ *
+ * @var string
+ */
public $caption = NULL;
+
+ /**
+ * Table layout template
+ *
+ * @var array
+ */
public $template = NULL;
+
+ /**
+ * Newline setting
+ *
+ * @var string
+ */
public $newline = "\n";
+
+ /**
+ * Contents of empty cells
+ *
+ * @var string
+ */
public $empty_cells = '';
+
+ /**
+ * Callback for custom table layout
+ *
+ * @var function
+ */
public $function = FALSE;
/**
@@ -93,7 +140,7 @@ class CI_Table {
* @param mixed
* @return void
*/
- public function set_heading()
+ public function set_heading($args = array())
{
$args = func_get_args();
$this->heading = $this->_prep_args($args);
@@ -172,7 +219,7 @@ class CI_Table {
* @param mixed
* @return void
*/
- public function add_row()
+ public function add_row($args = array())
{
$args = func_get_args();
$this->rows[] = $this->_prep_args($args);
@@ -420,6 +467,7 @@ class CI_Table {
* Set table data from an array
*
* @param array
+ * @param bool
* @return void
*/
protected function _set_from_array($data, $set_heading = TRUE)
diff --git a/system/libraries/Typography.php b/system/libraries/Typography.php
index 21bbad038..50bd12486 100644
--- a/system/libraries/Typography.php
+++ b/system/libraries/Typography.php
@@ -36,22 +36,46 @@
*/
class CI_Typography {
- // Block level elements that should not be wrapped inside <p> tags
+ /**
+ * Block level elements that should not be wrapped inside <p> tags
+ *
+ * @var string
+ */
public $block_elements = 'address|blockquote|div|dl|fieldset|form|h\d|hr|noscript|object|ol|p|pre|script|table|ul';
- // Elements that should not have <p> and <br /> tags within them.
+ /**
+ * Elements that should not have <p> and <br /> tags within them.
+ *
+ * @var string
+ */
public $skip_elements = 'p|pre|ol|ul|dl|object|table|h\d';
- // Tags we want the parser to completely ignore when splitting the string.
+ /**
+ * Tags we want the parser to completely ignore when splitting the string.
+ *
+ * @var string
+ */
public $inline_elements = 'a|abbr|acronym|b|bdo|big|br|button|cite|code|del|dfn|em|i|img|ins|input|label|map|kbd|q|samp|select|small|span|strong|sub|sup|textarea|tt|var';
- // array of block level elements that require inner content to be within another block level element
+ /**
+ * array of block level elements that require inner content to be within another block level element
+ *
+ * @var array
+ */
public $inner_block_required = array('blockquote');
- // the last block element parsed
+ /**
+ * the last block element parsed
+ *
+ * @var string
+ */
public $last_block_element = '';
- // whether or not to protect quotes within { curly braces }
+ /**
+ * whether or not to protect quotes within { curly braces }
+ *
+ * @var bool
+ */
public $protect_braced_quotes = FALSE;
/**
diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php
index b8e0d37fb..0ac605fa4 100644
--- a/system/libraries/User_agent.php
+++ b/system/libraries/User_agent.php
@@ -38,25 +38,110 @@
*/
class CI_User_agent {
- public $agent = NULL;
+ /**
+ * Current user-agent
+ *
+ * @var string
+ */
+ public $agent = NULL;
- public $is_browser = FALSE;
- public $is_robot = FALSE;
- public $is_mobile = FALSE;
+ /**
+ * Flag for if the user-agent belongs to a browser
+ *
+ * @var bool
+ */
+ public $is_browser = FALSE;
+
+ /**
+ * Flag for if the user-agent is a robot
+ *
+ * @var bool
+ */
+ public $is_robot = FALSE;
+
+ /**
+ * Flag for if the user-agent is a mobile browser
+ *
+ * @var bool
+ */
+ public $is_mobile = FALSE;
- public $languages = array();
- public $charsets = array();
+ /**
+ * Languages accepted by the current user agent
+ *
+ * @var array
+ */
+ public $languages = array();
+
+ /**
+ * Character sets accepted by the current user agent
+ *
+ * @var array
+ */
+ public $charsets = array();
- public $platforms = array();
- public $browsers = array();
- public $mobiles = array();
- public $robots = array();
+ /**
+ * List of platforms to compare against current user agent
+ *
+ * @var array
+ */
+ public $platforms = array();
+
+ /**
+ * List of browsers to compare against current user agent
+ *
+ * @var array
+ */
+ public $browsers = array();
+
+ /**
+ * List of mobile browsers to compare against current user agent
+ *
+ * @var array
+ */
+ public $mobiles = array();
+
+ /**
+ * List of robots to compare against current user agent
+ *
+ * @var array
+ */
+ public $robots = array();
- public $platform = '';
- public $browser = '';
- public $version = '';
- public $mobile = '';
- public $robot = '';
+ /**
+ * Current user-agent platform
+ *
+ * @var string
+ */
+ public $platform = '';
+
+ /**
+ * Current user-agent browser
+ *
+ * @var string
+ */
+ public $browser = '';
+
+ /**
+ * Current user-agent version
+ *
+ * @var string
+ */
+ public $version = '';
+
+ /**
+ * Current user-agent mobile name
+ *
+ * @var string
+ */
+ public $mobile = '';
+
+ /**
+ * Current user-agent robot name
+ *
+ * @var string
+ */
+ public $robot = '';
/**
* Constructor
@@ -302,6 +387,7 @@ class CI_User_agent {
/**
* Is Browser
*
+ * @param string $key
* @return bool
*/
public function is_browser($key = NULL)
@@ -326,6 +412,7 @@ class CI_User_agent {
/**
* Is Robot
*
+ * @param string $key
* @return bool
*/
public function is_robot($key = NULL)
@@ -350,6 +437,7 @@ class CI_User_agent {
/**
* Is Mobile
*
+ * @param string $key
* @return bool
*/
public function is_mobile($key = NULL)
@@ -503,6 +591,7 @@ class CI_User_agent {
/**
* Test for a particular language
*
+ * @param string $lang
* @return bool
*/
public function accept_lang($lang = 'en')
@@ -515,6 +604,7 @@ class CI_User_agent {
/**
* Test for a particular character set
*
+ * @param string $charset
* @return bool
*/
public function accept_charset($charset = 'utf-8')
diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php
index fea560c2e..7009deacc 100644
--- a/system/libraries/Xmlrpc.php
+++ b/system/libraries/Xmlrpc.php
@@ -104,24 +104,24 @@ class CI_Xmlrpc {
);
// Array of Valid Parents for Various XML-RPC elements
- $this->valid_parents = array('BOOLEAN' => array('VALUE'),
- 'I4' => array('VALUE'),
- 'INT' => array('VALUE'),
- 'STRING' => array('VALUE'),
- 'DOUBLE' => array('VALUE'),
- 'DATETIME.ISO8601' => array('VALUE'),
- 'BASE64' => array('VALUE'),
- 'ARRAY' => array('VALUE'),
- 'STRUCT' => array('VALUE'),
- 'PARAM' => array('PARAMS'),
- 'METHODNAME' => array('METHODCALL'),
- 'PARAMS' => array('METHODCALL', 'METHODRESPONSE'),
- 'MEMBER' => array('STRUCT'),
- 'NAME' => array('MEMBER'),
- 'DATA' => array('ARRAY'),
- 'FAULT' => array('METHODRESPONSE'),
- 'VALUE' => array('MEMBER', 'DATA', 'PARAM', 'FAULT')
- );
+ $this->valid_parents = array('BOOLEAN' => array('VALUE'),
+ 'I4' => array('VALUE'),
+ 'INT' => array('VALUE'),
+ 'STRING' => array('VALUE'),
+ 'DOUBLE' => array('VALUE'),
+ 'DATETIME.ISO8601' => array('VALUE'),
+ 'BASE64' => array('VALUE'),
+ 'ARRAY' => array('VALUE'),
+ 'STRUCT' => array('VALUE'),
+ 'PARAM' => array('PARAMS'),
+ 'METHODNAME' => array('METHODCALL'),
+ 'PARAMS' => array('METHODCALL', 'METHODRESPONSE'),
+ 'MEMBER' => array('STRUCT'),
+ 'NAME' => array('MEMBER'),
+ 'DATA' => array('ARRAY'),
+ 'FAULT' => array('METHODRESPONSE'),
+ 'VALUE' => array('MEMBER', 'DATA', 'PARAM', 'FAULT')
+ );
// XML-RPC Responses
diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php
index 6d270c2ea..f0c5b48e7 100644
--- a/system/libraries/Xmlrpcs.php
+++ b/system/libraries/Xmlrpcs.php
@@ -48,12 +48,39 @@ if ( ! class_exists('CI_Xmlrpc'))
*/
class CI_Xmlrpcs extends CI_Xmlrpc
{
- public $methods = array(); //array of methods mapped to function names and signatures
- public $debug_msg = ''; // Debug Message
- public $system_methods = array(); // XML RPC Server methods
- public $controller_obj;
- public $object = FALSE;
+ /**
+ * array of methods mapped to function names and signatures
+ *
+ * @var array
+ */
+ public $methods = array();
+
+ /**
+ * Debug Message
+ *
+ * @var string
+ */
+ public $debug_msg = '';
+
+ /**
+ * XML RPC Server methods
+ *
+ * @var array
+ */
+ public $system_methods = array();
+
+ /**
+ * Configuration object
+ *
+ * @var object
+ */
+ public $object = FALSE;
+ /**
+ * Initialize XMLRPC class
+ *
+ * @param array $config
+ */
public function __construct($config = array())
{
parent::__construct();
diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php
index 80438546b..86d0787b2 100644
--- a/system/libraries/Zip.php
+++ b/system/libraries/Zip.php
@@ -42,13 +42,53 @@
*/
class CI_Zip {
+ /**
+ * Zip data in string form
+ *
+ * @var string
+ */
public $zipdata = '';
+
+ /**
+ * Zip data for a directory in string form
+ *
+ * @var string
+ */
public $directory = '';
+
+ /**
+ * Number of files/folder in zip file
+ *
+ * @var int
+ */
public $entries = 0;
+
+ /**
+ * Number of files in zip
+ *
+ * @var int
+ */
public $file_num = 0;
+
+ /**
+ * relative offset of local header
+ *
+ * @var int
+ */
public $offset = 0;
+
+ /**
+ * Reference to time at init
+ *
+ * @var int
+ */
public $now;
+ /**
+ * Initialize zip compression class
+ *
+ * @return void
+ */
public function __construct()
{
$this->now = time();