summaryrefslogtreecommitdiffstats
path: root/system/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'system/helpers')
-rw-r--r--system/helpers/compatibility_helper.php994
-rw-r--r--system/helpers/html_helper.php830
-rw-r--r--system/helpers/language_helper.php114
3 files changed, 969 insertions, 969 deletions
diff --git a/system/helpers/compatibility_helper.php b/system/helpers/compatibility_helper.php
index 3b37cea02..996a6d7ea 100644
--- a/system/helpers/compatibility_helper.php
+++ b/system/helpers/compatibility_helper.php
@@ -1,498 +1,498 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package CodeIgniter
- * @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008, EllisLab, Inc.
- * @license http://codeigniter.com/user_guide/license.html
- * @link http://codeigniter.com
- * @since Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * CodeIgniter Compatibility Helpers
- *
- * This helper contains some functions based on the PEAR PHP_Compat library
- * http://pear.php.net/package/PHP_Compat
- *
- * The PEAR compat library is a little bloated and the code doesn't harmonize
- * well with CodeIgniter, so those functions have been refactored.
- * We cheat a little and use CI's _exception_handler() to output our own PHP errors
- * so that the behavior fully mimicks the PHP 5 counterparts. -- Derek Jones
- *
- * @package CodeIgniter
- * @subpackage Helpers
- * @category Helpers
- * @author ExpressionEngine Dev Team
- * @link http://codeigniter.com/user_guide/helpers/compatibility_helper.html
- */
-
-// ------------------------------------------------------------------------
-
-if ( ! defined('PHP_EOL'))
-{
- define('PHP_EOL', (DIRECTORY_SEPARATOR == '/') ? "\n" : "\r\n");
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * file_put_contents()
- *
- * Writes a string to a file
- * http://us.php.net/manual/en/function.file_put_contents.php
- * argument 4, $context, not supported
- *
- * @access public
- * @param string file name
- * @param mixed data to be written
- * @param int flags
- * @return int length of written string
- */
-if ( ! function_exists('file_put_contents'))
-{
- function file_put_contents($filename, $data, $flags = NULL)
- {
- if (is_scalar($data))
- {
- settype($data, 'STRING');
- }
-
- if ( ! is_string($data) && ! is_array($data) && ! is_resource($data))
- {
- $backtrace = debug_backtrace();
- _exception_handler(E_USER_WARNING, 'file_put_contents(): the 2nd parameter should be either a string or an array', $backtrace[0]['file'], $backtrace[0]['line']);
- return FALSE;
- }
-
- // read stream if given a stream resource
- if (is_resource($data))
- {
- if (get_resource_type($data) !== 'stream')
- {
- $backtrace = debug_backtrace();
- _exception_handler(E_USER_WARNING, 'file_put_contents(): supplied resource is not a valid stream resource', $backtrace[0]['file'], $backtrace[0]['line']);
- return FALSE;
- }
-
- $text = '';
-
- while ( ! feof($data))
- {
- $text .= fread($data, 4096);
- }
-
- $data = $text;
- unset($text);
- }
-
- // strings only please!
- if (is_array($data))
- {
- $data = implode('', $data);
- }
-
- // Set the appropriate mode
- if (($flags & 8) > 0) // 8 = FILE_APPEND flag
- {
- $mode = FOPEN_WRITE_CREATE;
- }
- else
- {
- $mode = FOPEN_WRITE_CREATE_DESTRUCTIVE;
- }
-
- // Check if we're using the include path
- if (($flags & 1) > 0) // 1 = FILE_USE_INCLUDE_PATH flag
- {
- $use_include_path = TRUE;
- }
- else
- {
- $use_include_path = FALSE;
- }
-
- $fp = @fopen($filename, $mode, $use_include_path);
-
- if ($fp === FALSE)
- {
- $backtrace = debug_backtrace();
- _exception_handler(E_USER_WARNING, 'file_put_contents('.htmlentities($filename).') failed to open stream', $backtrace[0]['file'], $backtrace[0]['line']);
- return FALSE;
- }
-
- if (($flags & LOCK_EX) > 0)
- {
- if ( ! flock($fp, LOCK_EX))
- {
- $backtrace = debug_backtrace();
- _exception_handler(E_USER_WARNING, 'file_put_contents('.htmlentities($filename).') unable to acquire an exclusive lock on file', $backtrace[0]['file'], $backtrace[0]['line']);
- return FALSE;
- }
- }
-
- // write it
- if (($written = @fwrite($fp, $data)) === FALSE)
- {
- $backtrace = debug_backtrace();
- _exception_handler(E_USER_WARNING, 'file_put_contents('.htmlentities($filename).') failed to write to '.htmlentities($filename), $backtrace[0]['file'], $backtrace[0]['line']);
- }
-
- // Close the handle
- @fclose($fp);
-
- // Return length
- return $written;
- }
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * fputcsv()
- *
- * Format line as CSV and write to file pointer
- * http://us.php.net/manual/en/function.fputcsv.php
- *
- * @access public
- * @param resource file pointer
- * @param array data to be written
- * @param string delimiter
- * @param string enclosure
- * @return int length of written string
- */
-if ( ! function_exists('fputcsv'))
-{
- function fputcsv($handle, $fields, $delimiter = ',', $enclosure = '"')
- {
- // Checking for a handle resource
- if ( ! is_resource($handle))
- {
- $backtrace = debug_backtrace();
- _exception_handler(E_USER_WARNING, 'fputcsv() expects parameter 1 to be stream resource, '.gettype($handle).' given', $backtrace[0]['file'], $backtrace[0]['line']);
- return FALSE;
- }
-
- // OK, it is a resource, but is it a stream?
- if (get_resource_type($handle) !== 'stream')
- {
- $backtrace = debug_backtrace();
- _exception_handler(E_USER_WARNING, 'fputcsv() expects parameter 1 to be stream resource, '.get_resource_type($handle).' given', $backtrace[0]['file'], $backtrace[0]['line']);
- return FALSE;
- }
-
- // Checking for an array of fields
- if ( ! is_array($fields))
- {
- $backtrace = debug_backtrace();
- _exception_handler(E_USER_WARNING, 'fputcsv() expects parameter 2 to be array, '.gettype($fields).' given', $backtrace[0]['file'], $backtrace[0]['line']);
- return FALSE;
- }
-
- // validate delimiter
- if (strlen($delimiter) > 1)
- {
- $delimiter = substr($delimiter, 0, 1);
- $backtrace = debug_backtrace();
- _exception_handler(E_NOTICE, 'fputcsv() delimiter must be one character long, "'.htmlentities($delimiter).'" used', $backtrace[0]['file'], $backtrace[0]['line']);
- }
-
- // validate enclosure
- if (strlen($enclosure) > 1)
- {
- $enclosure = substr($enclosure, 0, 1);
- $backtrace = debug_backtrace();
- _exception_handler(E_NOTICE, 'fputcsv() enclosure must be one character long, "'.htmlentities($enclosure).'" used', $backtrace[0]['file'], $backtrace[0]['line']);
-
- }
-
- $out = '';
-
- foreach ($fields as $cell)
- {
- $cell = str_replace($enclosure, $enclosure.$enclosure, $cell);
-
- if (strpos($cell, $delimiter) !== FALSE OR strpos($cell, $enclosure) !== FALSE OR strpos($cell, "\n") !== FALSE)
- {
- $out .= $enclosure.$cell.$enclosure.$delimiter;
- }
- else
- {
- $out .= $cell.$delimiter;
- }
- }
-
- $length = @fwrite($handle, substr($out, 0, -1)."\n");
-
- return $length;
- }
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * stripos()
- *
- * Find position of first occurrence of a case-insensitive string
- * http://us.php.net/manual/en/function.stripos.php
- *
- * @access public
- * @param string haystack
- * @param string needle
- * @param int offset
- * @return int numeric position of the first occurrence of needle in the haystack
- */
-if ( ! function_exists('stripos'))
-{
- function stripos($haystack, $needle, $offset = NULL)
- {
- // Cast non string scalar values
- if (is_scalar($haystack))
- {
- settype($haystack, 'STRING');
- }
-
- if ( ! is_string($haystack))
- {
- $backtrace = debug_backtrace();
- _exception_handler(E_USER_WARNING, 'stripos() expects parameter 1 to be string, '.gettype($haystack).' given', $backtrace[0]['file'], $backtrace[0]['line']);
- return FALSE;
- }
-
- if ( ! is_scalar($needle))
- {
- $backtrace = debug_backtrace();
- _exception_handler(E_USER_WARNING, 'stripos() needle is not a string or an integer in '.$backtrace[0]['file'], $backtrace[0]['line']);
- return FALSE;
- }
-
- if (is_float($offset))
- {
- $offset = (int)$offset;
- }
-
- if ( ! is_int($offset) && ! is_bool($offset) && ! is_null($offset))
- {
- $backtrace = debug_backtrace();
- _exception_handler(E_USER_WARNING, 'stripos() expects parameter 3 to be long, '.gettype($offset).' given', $backtrace[0]['file'], $backtrace[0]['line']);
- return NULL;
- }
-
- return strpos(strtolower($haystack), strtolower($needle), $offset);
- }
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * str_ireplace()
- *
- * Find position of first occurrence of a case-insensitive string
- * http://us.php.net/manual/en/function.str-ireplace.php
- * (parameter 4, $count, is not supported as to do so in PHP 4 would make
- * it a required parameter)
- *
- * @access public
- * @param mixed search
- * @param mixed replace
- * @param mixed subject
- * @return int numeric position of the first occurrence of needle in the haystack
- */
-if ( ! function_exists('str_ireplace'))
-{
- function str_ireplace($search, $replace, $subject)
- {
- // Nothing to do here
- if ($search === NULL OR $subject === NULL)
- {
- return $subject;
- }
-
- // Crazy arguments
- if (is_scalar($search) && is_array($replace))
- {
- $backtrace = debug_backtrace();
-
- if (is_object($replace))
- {
- show_error('Object of class '.get_class($replace).' could not be converted to string in '.$backtrace[0]['file'].' on line '.$backtrace[0]['line']);
- }
- else
- {
- _exception_handler(E_USER_NOTICE, 'Array to string conversion in '.$backtrace[0]['file'], $backtrace[0]['line']);
- }
- }
-
- // Searching for an array
- if (is_array($search))
- {
- // Replacing with an array
- if (is_array($replace))
- {
- $search = array_values($search);
- $replace = array_values($replace);
-
- if (count($search) >= count($replace))
- {
- $replace = array_pad($replace, count($search), '');
- }
- else
- {
- $replace = array_slice($replace, 0, count($search));
- }
- }
- else
- {
- // Replacing with a string all positions
- $replace = array_fill(0, count($search), $replace);
- }
- }
- else
- {
- //Searching for a string and replacing with a string.
- $search = array((string)$search);
- $replace = array((string)$replace);
- }
-
- // Prepare the search array
- foreach ($search as $search_key => $search_value)
- {
- $search[$search_key] = '/'.preg_quote($search_value, '/').'/i';
- }
-
- // Prepare the replace array (escape backreferences)
- foreach ($replace as $k => $v)
- {
- $replace[$k] = str_replace(array(chr(92), '$'), array(chr(92).chr(92), '\$'), $v);
- }
-
- // do the replacement
- $result = preg_replace($search, $replace, (array)$subject);
-
- // Check if subject was initially a string and return it as a string
- if ( ! is_array($subject))
- {
- return current($result);
- }
-
- // Otherwise, just return the array
- return $result;
- }
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * http_build_query()
- *
- * Generate URL-encoded query string
- * http://us.php.net/manual/en/function.http-build-query.php
- *
- * @access public
- * @param array form data
- * @param string numeric prefix
- * @param string argument separator
- * @return string URL-encoded string
- */
-if ( ! function_exists('http_build_query'))
-{
- function http_build_query($formdata, $numeric_prefix = NULL, $separator = NULL)
- {
- // Check the data
- if ( ! is_array($formdata) && ! is_object($formdata))
- {
- $backtrace = debug_backtrace();
- _exception_handler(E_USER_WARNING, 'http_build_query() Parameter 1 expected to be Array or Object. Incorrect value given', $backtrace[0]['file'], $backtrace[0]['line']);
- return FALSE;
- }
-
- // Cast it as array
- if (is_object($formdata))
- {
- $formdata = get_object_vars($formdata);
- }
-
- // If the array is empty, return NULL
- if (empty($formdata))
- {
- return NULL;
- }
-
- // Argument separator
- if ($separator === NULL)
- {
- $separator = ini_get('arg_separator.output');
-
- if (strlen($separator) == 0)
- {
- $separator = '&';
- }
- }
-
- // Start building the query
- $tmp = array();
-
- foreach ($formdata as $key => $val)
- {
- if ($val === NULL)
- {
- continue;
- }
-
- if (is_integer($key) && $numeric_prefix != NULL)
- {
- $key = $numeric_prefix.$key;
- }
-
- if (is_resource($val))
- {
- return NULL;
- }
-
- // hand it off to a recursive parser
- $tmp[] = _http_build_query_helper($key, $val, $separator);
- }
-
- return implode($separator, $tmp);
- }
-
-
- // Helper helper. Remind anyone of college?
- // Required to handle recursion in nested arrays.
- //
- // You could shave fractions of fractions of a second by moving where
- // the urlencoding takes place, but it's much less intuitive, and if
- // your application has 10,000 form fields, well, you have other problems ;)
- function _http_build_query_helper($key, $val, $separator = '&')
- {
- if (is_scalar($val))
- {
- return urlencode($key).'='.urlencode($val);
- }
- else
- {
- // arrays please
- if (is_object($val))
- {
- $val = get_object_vars($val);
- }
-
- foreach ($val as $k => $v)
- {
- $tmp[] = _http_build_query_helper($key.'['.$k.']', $v, $separator);
- }
- }
-
- return implode($separator, $tmp);
- }
-}
-
-
-/* End of file compatibility_helper.php */
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package CodeIgniter
+ * @author ExpressionEngine Dev Team
+ * @copyright Copyright (c) 2008, EllisLab, Inc.
+ * @license http://codeigniter.com/user_guide/license.html
+ * @link http://codeigniter.com
+ * @since Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Compatibility Helpers
+ *
+ * This helper contains some functions based on the PEAR PHP_Compat library
+ * http://pear.php.net/package/PHP_Compat
+ *
+ * The PEAR compat library is a little bloated and the code doesn't harmonize
+ * well with CodeIgniter, so those functions have been refactored.
+ * We cheat a little and use CI's _exception_handler() to output our own PHP errors
+ * so that the behavior fully mimicks the PHP 5 counterparts. -- Derek Jones
+ *
+ * @package CodeIgniter
+ * @subpackage Helpers
+ * @category Helpers
+ * @author ExpressionEngine Dev Team
+ * @link http://codeigniter.com/user_guide/helpers/compatibility_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+if ( ! defined('PHP_EOL'))
+{
+ define('PHP_EOL', (DIRECTORY_SEPARATOR == '/') ? "\n" : "\r\n");
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * file_put_contents()
+ *
+ * Writes a string to a file
+ * http://us.php.net/manual/en/function.file_put_contents.php
+ * argument 4, $context, not supported
+ *
+ * @access public
+ * @param string file name
+ * @param mixed data to be written
+ * @param int flags
+ * @return int length of written string
+ */
+if ( ! function_exists('file_put_contents'))
+{
+ function file_put_contents($filename, $data, $flags = NULL)
+ {
+ if (is_scalar($data))
+ {
+ settype($data, 'STRING');
+ }
+
+ if ( ! is_string($data) && ! is_array($data) && ! is_resource($data))
+ {
+ $backtrace = debug_backtrace();
+ _exception_handler(E_USER_WARNING, 'file_put_contents(): the 2nd parameter should be either a string or an array', $backtrace[0]['file'], $backtrace[0]['line']);
+ return FALSE;
+ }
+
+ // read stream if given a stream resource
+ if (is_resource($data))
+ {
+ if (get_resource_type($data) !== 'stream')
+ {
+ $backtrace = debug_backtrace();
+ _exception_handler(E_USER_WARNING, 'file_put_contents(): supplied resource is not a valid stream resource', $backtrace[0]['file'], $backtrace[0]['line']);
+ return FALSE;
+ }
+
+ $text = '';
+
+ while ( ! feof($data))
+ {
+ $text .= fread($data, 4096);
+ }
+
+ $data = $text;
+ unset($text);
+ }
+
+ // strings only please!
+ if (is_array($data))
+ {
+ $data = implode('', $data);
+ }
+
+ // Set the appropriate mode
+ if (($flags & 8) > 0) // 8 = FILE_APPEND flag
+ {
+ $mode = FOPEN_WRITE_CREATE;
+ }
+ else
+ {
+ $mode = FOPEN_WRITE_CREATE_DESTRUCTIVE;
+ }
+
+ // Check if we're using the include path
+ if (($flags & 1) > 0) // 1 = FILE_USE_INCLUDE_PATH flag
+ {
+ $use_include_path = TRUE;
+ }
+ else
+ {
+ $use_include_path = FALSE;
+ }
+
+ $fp = @fopen($filename, $mode, $use_include_path);
+
+ if ($fp === FALSE)
+ {
+ $backtrace = debug_backtrace();
+ _exception_handler(E_USER_WARNING, 'file_put_contents('.htmlentities($filename).') failed to open stream', $backtrace[0]['file'], $backtrace[0]['line']);
+ return FALSE;
+ }
+
+ if (($flags & LOCK_EX) > 0)
+ {
+ if ( ! flock($fp, LOCK_EX))
+ {
+ $backtrace = debug_backtrace();
+ _exception_handler(E_USER_WARNING, 'file_put_contents('.htmlentities($filename).') unable to acquire an exclusive lock on file', $backtrace[0]['file'], $backtrace[0]['line']);
+ return FALSE;
+ }
+ }
+
+ // write it
+ if (($written = @fwrite($fp, $data)) === FALSE)
+ {
+ $backtrace = debug_backtrace();
+ _exception_handler(E_USER_WARNING, 'file_put_contents('.htmlentities($filename).') failed to write to '.htmlentities($filename), $backtrace[0]['file'], $backtrace[0]['line']);
+ }
+
+ // Close the handle
+ @fclose($fp);
+
+ // Return length
+ return $written;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * fputcsv()
+ *
+ * Format line as CSV and write to file pointer
+ * http://us.php.net/manual/en/function.fputcsv.php
+ *
+ * @access public
+ * @param resource file pointer
+ * @param array data to be written
+ * @param string delimiter
+ * @param string enclosure
+ * @return int length of written string
+ */
+if ( ! function_exists('fputcsv'))
+{
+ function fputcsv($handle, $fields, $delimiter = ',', $enclosure = '"')
+ {
+ // Checking for a handle resource
+ if ( ! is_resource($handle))
+ {
+ $backtrace = debug_backtrace();
+ _exception_handler(E_USER_WARNING, 'fputcsv() expects parameter 1 to be stream resource, '.gettype($handle).' given', $backtrace[0]['file'], $backtrace[0]['line']);
+ return FALSE;
+ }
+
+ // OK, it is a resource, but is it a stream?
+ if (get_resource_type($handle) !== 'stream')
+ {
+ $backtrace = debug_backtrace();
+ _exception_handler(E_USER_WARNING, 'fputcsv() expects parameter 1 to be stream resource, '.get_resource_type($handle).' given', $backtrace[0]['file'], $backtrace[0]['line']);
+ return FALSE;
+ }
+
+ // Checking for an array of fields
+ if ( ! is_array($fields))
+ {
+ $backtrace = debug_backtrace();
+ _exception_handler(E_USER_WARNING, 'fputcsv() expects parameter 2 to be array, '.gettype($fields).' given', $backtrace[0]['file'], $backtrace[0]['line']);
+ return FALSE;
+ }
+
+ // validate delimiter
+ if (strlen($delimiter) > 1)
+ {
+ $delimiter = substr($delimiter, 0, 1);
+ $backtrace = debug_backtrace();
+ _exception_handler(E_NOTICE, 'fputcsv() delimiter must be one character long, "'.htmlentities($delimiter).'" used', $backtrace[0]['file'], $backtrace[0]['line']);
+ }
+
+ // validate enclosure
+ if (strlen($enclosure) > 1)
+ {
+ $enclosure = substr($enclosure, 0, 1);
+ $backtrace = debug_backtrace();
+ _exception_handler(E_NOTICE, 'fputcsv() enclosure must be one character long, "'.htmlentities($enclosure).'" used', $backtrace[0]['file'], $backtrace[0]['line']);
+
+ }
+
+ $out = '';
+
+ foreach ($fields as $cell)
+ {
+ $cell = str_replace($enclosure, $enclosure.$enclosure, $cell);
+
+ if (strpos($cell, $delimiter) !== FALSE OR strpos($cell, $enclosure) !== FALSE OR strpos($cell, "\n") !== FALSE)
+ {
+ $out .= $enclosure.$cell.$enclosure.$delimiter;
+ }
+ else
+ {
+ $out .= $cell.$delimiter;
+ }
+ }
+
+ $length = @fwrite($handle, substr($out, 0, -1)."\n");
+
+ return $length;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * stripos()
+ *
+ * Find position of first occurrence of a case-insensitive string
+ * http://us.php.net/manual/en/function.stripos.php
+ *
+ * @access public
+ * @param string haystack
+ * @param string needle
+ * @param int offset
+ * @return int numeric position of the first occurrence of needle in the haystack
+ */
+if ( ! function_exists('stripos'))
+{
+ function stripos($haystack, $needle, $offset = NULL)
+ {
+ // Cast non string scalar values
+ if (is_scalar($haystack))
+ {
+ settype($haystack, 'STRING');
+ }
+
+ if ( ! is_string($haystack))
+ {
+ $backtrace = debug_backtrace();
+ _exception_handler(E_USER_WARNING, 'stripos() expects parameter 1 to be string, '.gettype($haystack).' given', $backtrace[0]['file'], $backtrace[0]['line']);
+ return FALSE;
+ }
+
+ if ( ! is_scalar($needle))
+ {
+ $backtrace = debug_backtrace();
+ _exception_handler(E_USER_WARNING, 'stripos() needle is not a string or an integer in '.$backtrace[0]['file'], $backtrace[0]['line']);
+ return FALSE;
+ }
+
+ if (is_float($offset))
+ {
+ $offset = (int)$offset;
+ }
+
+ if ( ! is_int($offset) && ! is_bool($offset) && ! is_null($offset))
+ {
+ $backtrace = debug_backtrace();
+ _exception_handler(E_USER_WARNING, 'stripos() expects parameter 3 to be long, '.gettype($offset).' given', $backtrace[0]['file'], $backtrace[0]['line']);
+ return NULL;
+ }
+
+ return strpos(strtolower($haystack), strtolower($needle), $offset);
+ }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * str_ireplace()
+ *
+ * Find position of first occurrence of a case-insensitive string
+ * http://us.php.net/manual/en/function.str-ireplace.php
+ * (parameter 4, $count, is not supported as to do so in PHP 4 would make
+ * it a required parameter)
+ *
+ * @access public
+ * @param mixed search
+ * @param mixed replace
+ * @param mixed subject
+ * @return int numeric position of the first occurrence of needle in the haystack
+ */
+if ( ! function_exists('str_ireplace'))
+{
+ function str_ireplace($search, $replace, $subject)
+ {
+ // Nothing to do here
+ if ($search === NULL OR $subject === NULL)
+ {
+ return $subject;
+ }
+
+ // Crazy arguments
+ if (is_scalar($search) && is_array($replace))
+ {
+ $backtrace = debug_backtrace();
+
+ if (is_object($replace))
+ {
+ show_error('Object of class '.get_class($replace).' could not be converted to string in '.$backtrace[0]['file'].' on line '.$backtrace[0]['line']);
+ }
+ else
+ {
+ _exception_handler(E_USER_NOTICE, 'Array to string conversion in '.$backtrace[0]['file'], $backtrace[0]['line']);
+ }
+ }
+
+ // Searching for an array
+ if (is_array($search))
+ {
+ // Replacing with an array
+ if (is_array($replace))
+ {
+ $search = array_values($search);
+ $replace = array_values($replace);
+
+ if (count($search) >= count($replace))
+ {
+ $replace = array_pad($replace, count($search), '');
+ }
+ else
+ {
+ $replace = array_slice($replace, 0, count($search));
+ }
+ }
+ else
+ {
+ // Replacing with a string all positions
+ $replace = array_fill(0, count($search), $replace);
+ }
+ }
+ else
+ {
+ //Searching for a string and replacing with a string.
+ $search = array((string)$search);
+ $replace = array((string)$replace);
+ }
+
+ // Prepare the search array
+ foreach ($search as $search_key => $search_value)
+ {
+ $search[$search_key] = '/'.preg_quote($search_value, '/').'/i';
+ }
+
+ // Prepare the replace array (escape backreferences)
+ foreach ($replace as $k => $v)
+ {
+ $replace[$k] = str_replace(array(chr(92), '$'), array(chr(92).chr(92), '\$'), $v);
+ }
+
+ // do the replacement
+ $result = preg_replace($search, $replace, (array)$subject);
+
+ // Check if subject was initially a string and return it as a string
+ if ( ! is_array($subject))
+ {
+ return current($result);
+ }
+
+ // Otherwise, just return the array
+ return $result;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * http_build_query()
+ *
+ * Generate URL-encoded query string
+ * http://us.php.net/manual/en/function.http-build-query.php
+ *
+ * @access public
+ * @param array form data
+ * @param string numeric prefix
+ * @param string argument separator
+ * @return string URL-encoded string
+ */
+if ( ! function_exists('http_build_query'))
+{
+ function http_build_query($formdata, $numeric_prefix = NULL, $separator = NULL)
+ {
+ // Check the data
+ if ( ! is_array($formdata) && ! is_object($formdata))
+ {
+ $backtrace = debug_backtrace();
+ _exception_handler(E_USER_WARNING, 'http_build_query() Parameter 1 expected to be Array or Object. Incorrect value given', $backtrace[0]['file'], $backtrace[0]['line']);
+ return FALSE;
+ }
+
+ // Cast it as array
+ if (is_object($formdata))
+ {
+ $formdata = get_object_vars($formdata);
+ }
+
+ // If the array is empty, return NULL
+ if (empty($formdata))
+ {
+ return NULL;
+ }
+
+ // Argument separator
+ if ($separator === NULL)
+ {
+ $separator = ini_get('arg_separator.output');
+
+ if (strlen($separator) == 0)
+ {
+ $separator = '&';
+ }
+ }
+
+ // Start building the query
+ $tmp = array();
+
+ foreach ($formdata as $key => $val)
+ {
+ if ($val === NULL)
+ {
+ continue;
+ }
+
+ if (is_integer($key) && $numeric_prefix != NULL)
+ {
+ $key = $numeric_prefix.$key;
+ }
+
+ if (is_resource($val))
+ {
+ return NULL;
+ }
+
+ // hand it off to a recursive parser
+ $tmp[] = _http_build_query_helper($key, $val, $separator);
+ }
+
+ return implode($separator, $tmp);
+ }
+
+
+ // Helper helper. Remind anyone of college?
+ // Required to handle recursion in nested arrays.
+ //
+ // You could shave fractions of fractions of a second by moving where
+ // the urlencoding takes place, but it's much less intuitive, and if
+ // your application has 10,000 form fields, well, you have other problems ;)
+ function _http_build_query_helper($key, $val, $separator = '&')
+ {
+ if (is_scalar($val))
+ {
+ return urlencode($key).'='.urlencode($val);
+ }
+ else
+ {
+ // arrays please
+ if (is_object($val))
+ {
+ $val = get_object_vars($val);
+ }
+
+ foreach ($val as $k => $v)
+ {
+ $tmp[] = _http_build_query_helper($key.'['.$k.']', $v, $separator);
+ }
+ }
+
+ return implode($separator, $tmp);
+ }
+}
+
+
+/* End of file compatibility_helper.php */
/* Location: ./system/helpers/compatibility_helper.php */ \ No newline at end of file
diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php
index e552b86b4..cc34b6530 100644
--- a/system/helpers/html_helper.php
+++ b/system/helpers/html_helper.php
@@ -1,416 +1,416 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package CodeIgniter
- * @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008, EllisLab, Inc.
- * @license http://codeigniter.com/user_guide/license.html
- * @link http://codeigniter.com
- * @since Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * CodeIgniter HTML Helpers
- *
- * @package CodeIgniter
- * @subpackage Helpers
- * @category Helpers
- * @author ExpressionEngine Dev Team
- * @link http://codeigniter.com/user_guide/helpers/html_helper.html
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * Heading
- *
- * Generates an HTML heading tag. First param is the data.
- * Second param is the size of the heading tag.
- *
- * @access public
- * @param string
- * @param integer
- * @return string
- */
-if ( ! function_exists('heading'))
-{
- function heading($data = '', $h = '1')
- {
- return "<h".$h.">".$data."</h".$h.">";
- }
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Unordered List
- *
- * Generates an HTML unordered list from an single or multi-dimensional array.
- *
- * @access public
- * @param array
- * @param mixed
- * @return string
- */
-if ( ! function_exists('ul'))
-{
- function ul($list, $attributes = '')
- {
- return _list('ul', $list, $attributes);
- }
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Ordered List
- *
- * Generates an HTML ordered list from an single or multi-dimensional array.
- *
- * @access public
- * @param array
- * @param mixed
- * @return string
- */
-if ( ! function_exists('ol'))
-{
- function ol($list, $attributes = '')
- {
- return _list('ol', $list, $attributes);
- }
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Generates the list
- *
- * Generates an HTML ordered list from an single or multi-dimensional array.
- *
- * @access private
- * @param string
- * @param mixed
- * @param mixed
- * @param intiger
- * @return string
- */
-if ( ! function_exists('_list'))
-{
- function _list($type = 'ul', $list, $attributes = '', $depth = 0)
- {
- // If an array wasn't submitted there's nothing to do...
- if ( ! is_array($list))
- {
- return $list;
- }
-
- // Set the indentation based on the depth
- $out = str_repeat(" ", $depth);
-
- // Were any attributes submitted? If so generate a string
- if (is_array($attributes))
- {
- $atts = '';
- foreach ($attributes as $key => $val)
- {
- $atts .= ' ' . $key . '="' . $val . '"';
- }
- $attributes = $atts;
- }
-
- // Write the opening list tag
- $out .= "<".$type.$attributes.">\n";
-
- // Cycle through the list elements. If an array is
- // encountered we will recursively call _list()
-
- static $_last_list_item = '';
- foreach ($list as $key => $val)
- {
- $_last_list_item = $key;
-
- $out .= str_repeat(" ", $depth + 2);
- $out .= "<li>";
-
- if ( ! is_array($val))
- {
- $out .= $val;
- }
- else
- {
- $out .= $_last_list_item."\n";
- $out .= _list($type, $val, '', $depth + 4);
- $out .= str_repeat(" ", $depth + 2);
- }
-
- $out .= "</li>\n";
- }
-
- // Set the indentation for the closing tag
- $out .= str_repeat(" ", $depth);
-
- // Write the closing list tag
- $out .= "</".$type.">\n";
-
- return $out;
- }
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Generates HTML BR tags based on number supplied
- *
- * @access public
- * @param integer
- * @return string
- */
-if ( ! function_exists('br'))
-{
- function br($num = 1)
- {
- return str_repeat("<br />", $num);
- }
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Image
- *
- * Generates an <img /> element
- *
- * @access public
- * @param mixed
- * @return string
- */
-if ( ! function_exists('img'))
-{
- function img($src = '', $index_page = FALSE)
- {
- if ( ! is_array($src) )
- {
- $src = array('src' => $src);
- }
-
- $img = '<img';
-
- foreach ($src as $k=>$v)
- {
-
- if ($k == 'src' AND strpos($v, '://') === FALSE)
- {
- $CI =& get_instance();
-
- if ($index_page === TRUE)
- {
- $img .= ' src="'.$CI->config->site_url($v).'" ';
- }
- else
- {
- $img .= ' src="'.$CI->config->slash_item('base_url').$v.'" ';
- }
- }
- else
- {
- $img .= " $k=\"$v\" ";
- }
- }
-
- $img .= '/>';
-
- return $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.
- *
- * @access public
- * @param string type The doctype to be generated
- * @return string
- */
-if ( ! function_exists('doctype'))
-{
- function doctype($type = 'xhtml-strict')
- {
- global $_doctypes;
-
- if ( ! is_array($_doctypes))
- {
- if ( ! require_once(APPPATH.'config/doctypes.php'))
- {
- return FALSE;
- }
- }
-
- if (isset($_doctypes[$type]))
- {
- return $_doctypes[$type];
- }
- else
- {
- return FALSE;
- }
- }
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Link
- *
- * Generates link to a CSS file
- *
- * @access public
- * @param mixed stylesheet hrefs or an array
- * @param string rel
- * @param string type
- * @param string title
- * @param string media
- * @param boolean should index_page be added to the css path
- * @return string
- */
-if ( ! function_exists('link_tag'))
-{
- function link_tag($href = '', $rel = 'stylesheet', $type = 'text/css', $title = '', $media = '', $index_page = FALSE)
- {
- $CI =& get_instance();
-
- $link = '<link ';
-
- if (is_array($href))
- {
- foreach ($href as $k=>$v)
- {
- if ($k == 'href' AND strpos($v, '://') === FALSE)
- {
- if ($index_page === TRUE)
- {
- $link .= ' href="'.$CI->config->site_url($v).'" ';
- }
- else
- {
- $link .= ' href="'.$CI->config->slash_item('base_url').$v.'" ';
- }
- }
- else
- {
- $link .= "$k=\"$v\" ";
- }
- }
-
- $link .= "/>";
- }
- else
- {
- if ( strpos($href, '://') !== FALSE)
- {
- $link .= ' href="'.$href.'" ';
- }
- elseif ($index_page === TRUE)
- {
- $link .= ' href="'.$CI->config->site_url($href).'" ';
- }
- else
- {
- $link .= ' href="'.$CI->config->slash_item('base_url').$href.'" ';
- }
-
- $link .= 'rel="'.$rel.'" type="'.$type.'" ';
-
- if ($media != '')
- {
- $link .= 'media="'.$media.'" ';
- }
-
- if ($title != '')
- {
- $link .= 'title="'.$title.'" ';
- }
-
- $link .= '/>';
- }
-
-
- return $link;
- }
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Generates meta tags from an array of key/values
- *
- * @access public
- * @param array
- * @return string
- */
-if ( ! function_exists('meta'))
-{
- function meta($name = '', $content = '', $type = 'name', $newline = "\n")
- {
- // Since we allow the data to be passes as a string, a simple array
- // or a multidimensional one, we need to do a little prepping.
- if ( ! is_array($name))
- {
- $name = array(array('name' => $name, 'content' => $content, 'type' => $type, 'newline' => $newline));
- }
- else
- {
- // Turn single array into multidimensional
- if (isset($name['name']))
- {
- $name = array($name);
- }
- }
-
- $str = '';
- foreach ($name as $meta)
- {
- $type = ( ! isset($meta['type']) OR $meta['type'] == 'name') ? 'name' : 'http-equiv';
- $name = ( ! isset($meta['name'])) ? '' : $meta['name'];
- $content = ( ! isset($meta['content'])) ? '' : $meta['content'];
- $newline = ( ! isset($meta['newline'])) ? "\n" : $meta['newline'];
-
- $str .= '<meta '.$type.'="'.$name.'" content="'.$content.'" />'.$newline;
- }
-
- return $str;
- }
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Generates non-breaking space entities based on number supplied
- *
- * @access public
- * @param integer
- * @return string
- */
-if ( ! function_exists('nbs'))
-{
- function nbs($num = 1)
- {
- return str_repeat("&nbsp;", $num);
- }
-}
-
-
-/* End of file html_helper.php */
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package CodeIgniter
+ * @author ExpressionEngine Dev Team
+ * @copyright Copyright (c) 2008, EllisLab, Inc.
+ * @license http://codeigniter.com/user_guide/license.html
+ * @link http://codeigniter.com
+ * @since Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter HTML Helpers
+ *
+ * @package CodeIgniter
+ * @subpackage Helpers
+ * @category Helpers
+ * @author ExpressionEngine Dev Team
+ * @link http://codeigniter.com/user_guide/helpers/html_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Heading
+ *
+ * Generates an HTML heading tag. First param is the data.
+ * Second param is the size of the heading tag.
+ *
+ * @access public
+ * @param string
+ * @param integer
+ * @return string
+ */
+if ( ! function_exists('heading'))
+{
+ function heading($data = '', $h = '1')
+ {
+ return "<h".$h.">".$data."</h".$h.">";
+ }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Unordered List
+ *
+ * Generates an HTML unordered list from an single or multi-dimensional array.
+ *
+ * @access public
+ * @param array
+ * @param mixed
+ * @return string
+ */
+if ( ! function_exists('ul'))
+{
+ function ul($list, $attributes = '')
+ {
+ return _list('ul', $list, $attributes);
+ }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Ordered List
+ *
+ * Generates an HTML ordered list from an single or multi-dimensional array.
+ *
+ * @access public
+ * @param array
+ * @param mixed
+ * @return string
+ */
+if ( ! function_exists('ol'))
+{
+ function ol($list, $attributes = '')
+ {
+ return _list('ol', $list, $attributes);
+ }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Generates the list
+ *
+ * Generates an HTML ordered list from an single or multi-dimensional array.
+ *
+ * @access private
+ * @param string
+ * @param mixed
+ * @param mixed
+ * @param intiger
+ * @return string
+ */
+if ( ! function_exists('_list'))
+{
+ function _list($type = 'ul', $list, $attributes = '', $depth = 0)
+ {
+ // If an array wasn't submitted there's nothing to do...
+ if ( ! is_array($list))
+ {
+ return $list;
+ }
+
+ // Set the indentation based on the depth
+ $out = str_repeat(" ", $depth);
+
+ // Were any attributes submitted? If so generate a string
+ if (is_array($attributes))
+ {
+ $atts = '';
+ foreach ($attributes as $key => $val)
+ {
+ $atts .= ' ' . $key . '="' . $val . '"';
+ }
+ $attributes = $atts;
+ }
+
+ // Write the opening list tag
+ $out .= "<".$type.$attributes.">\n";
+
+ // Cycle through the list elements. If an array is
+ // encountered we will recursively call _list()
+
+ static $_last_list_item = '';
+ foreach ($list as $key => $val)
+ {
+ $_last_list_item = $key;
+
+ $out .= str_repeat(" ", $depth + 2);
+ $out .= "<li>";
+
+ if ( ! is_array($val))
+ {
+ $out .= $val;
+ }
+ else
+ {
+ $out .= $_last_list_item."\n";
+ $out .= _list($type, $val, '', $depth + 4);
+ $out .= str_repeat(" ", $depth + 2);
+ }
+
+ $out .= "</li>\n";
+ }
+
+ // Set the indentation for the closing tag
+ $out .= str_repeat(" ", $depth);
+
+ // Write the closing list tag
+ $out .= "</".$type.">\n";
+
+ return $out;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Generates HTML BR tags based on number supplied
+ *
+ * @access public
+ * @param integer
+ * @return string
+ */
+if ( ! function_exists('br'))
+{
+ function br($num = 1)
+ {
+ return str_repeat("<br />", $num);
+ }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Image
+ *
+ * Generates an <img /> element
+ *
+ * @access public
+ * @param mixed
+ * @return string
+ */
+if ( ! function_exists('img'))
+{
+ function img($src = '', $index_page = FALSE)
+ {
+ if ( ! is_array($src) )
+ {
+ $src = array('src' => $src);
+ }
+
+ $img = '<img';
+
+ foreach ($src as $k=>$v)
+ {
+
+ if ($k == 'src' AND strpos($v, '://') === FALSE)
+ {
+ $CI =& get_instance();
+
+ if ($index_page === TRUE)
+ {
+ $img .= ' src="'.$CI->config->site_url($v).'" ';
+ }
+ else
+ {
+ $img .= ' src="'.$CI->config->slash_item('base_url').$v.'" ';
+ }
+ }
+ else
+ {
+ $img .= " $k=\"$v\" ";
+ }
+ }
+
+ $img .= '/>';
+
+ return $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.
+ *
+ * @access public
+ * @param string type The doctype to be generated
+ * @return string
+ */
+if ( ! function_exists('doctype'))
+{
+ function doctype($type = 'xhtml-strict')
+ {
+ global $_doctypes;
+
+ if ( ! is_array($_doctypes))
+ {
+ if ( ! require_once(APPPATH.'config/doctypes.php'))
+ {
+ return FALSE;
+ }
+ }
+
+ if (isset($_doctypes[$type]))
+ {
+ return $_doctypes[$type];
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Link
+ *
+ * Generates link to a CSS file
+ *
+ * @access public
+ * @param mixed stylesheet hrefs or an array
+ * @param string rel
+ * @param string type
+ * @param string title
+ * @param string media
+ * @param boolean should index_page be added to the css path
+ * @return string
+ */
+if ( ! function_exists('link_tag'))
+{
+ function link_tag($href = '', $rel = 'stylesheet', $type = 'text/css', $title = '', $media = '', $index_page = FALSE)
+ {
+ $CI =& get_instance();
+
+ $link = '<link ';
+
+ if (is_array($href))
+ {
+ foreach ($href as $k=>$v)
+ {
+ if ($k == 'href' AND strpos($v, '://') === FALSE)
+ {
+ if ($index_page === TRUE)
+ {
+ $link .= ' href="'.$CI->config->site_url($v).'" ';
+ }
+ else
+ {
+ $link .= ' href="'.$CI->config->slash_item('base_url').$v.'" ';
+ }
+ }
+ else
+ {
+ $link .= "$k=\"$v\" ";
+ }
+ }
+
+ $link .= "/>";
+ }
+ else
+ {
+ if ( strpos($href, '://') !== FALSE)
+ {
+ $link .= ' href="'.$href.'" ';
+ }
+ elseif ($index_page === TRUE)
+ {
+ $link .= ' href="'.$CI->config->site_url($href).'" ';
+ }
+ else
+ {
+ $link .= ' href="'.$CI->config->slash_item('base_url').$href.'" ';
+ }
+
+ $link .= 'rel="'.$rel.'" type="'.$type.'" ';
+
+ if ($media != '')
+ {
+ $link .= 'media="'.$media.'" ';
+ }
+
+ if ($title != '')
+ {
+ $link .= 'title="'.$title.'" ';
+ }
+
+ $link .= '/>';
+ }
+
+
+ return $link;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Generates meta tags from an array of key/values
+ *
+ * @access public
+ * @param array
+ * @return string
+ */
+if ( ! function_exists('meta'))
+{
+ function meta($name = '', $content = '', $type = 'name', $newline = "\n")
+ {
+ // Since we allow the data to be passes as a string, a simple array
+ // or a multidimensional one, we need to do a little prepping.
+ if ( ! is_array($name))
+ {
+ $name = array(array('name' => $name, 'content' => $content, 'type' => $type, 'newline' => $newline));
+ }
+ else
+ {
+ // Turn single array into multidimensional
+ if (isset($name['name']))
+ {
+ $name = array($name);
+ }
+ }
+
+ $str = '';
+ foreach ($name as $meta)
+ {
+ $type = ( ! isset($meta['type']) OR $meta['type'] == 'name') ? 'name' : 'http-equiv';
+ $name = ( ! isset($meta['name'])) ? '' : $meta['name'];
+ $content = ( ! isset($meta['content'])) ? '' : $meta['content'];
+ $newline = ( ! isset($meta['newline'])) ? "\n" : $meta['newline'];
+
+ $str .= '<meta '.$type.'="'.$name.'" content="'.$content.'" />'.$newline;
+ }
+
+ return $str;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Generates non-breaking space entities based on number supplied
+ *
+ * @access public
+ * @param integer
+ * @return string
+ */
+if ( ! function_exists('nbs'))
+{
+ function nbs($num = 1)
+ {
+ return str_repeat("&nbsp;", $num);
+ }
+}
+
+
+/* End of file html_helper.php */
/* Location: ./system/helpers/html_helper.php */ \ No newline at end of file
diff --git a/system/helpers/language_helper.php b/system/helpers/language_helper.php
index 2091fd41d..d90fe3195 100644
--- a/system/helpers/language_helper.php
+++ b/system/helpers/language_helper.php
@@ -1,58 +1,58 @@
-<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package CodeIgniter
- * @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008, EllisLab, Inc.
- * @license http://codeigniter.com/user_guide/license.html
- * @link http://codeigniter.com
- * @since Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * CodeIgniter Language Helpers
- *
- * @package CodeIgniter
- * @subpackage Helpers
- * @category Helpers
- * @author ExpressionEngine Dev Team
- * @link http://codeigniter.com/user_guide/helpers/language_helper.html
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * Lang
- *
- * Fetches a language variable and optionally outputs a form label
- *
- * @access public
- * @param string the language line
- * @param string the id of the form element
- * @return string
- */
-if ( ! function_exists('lang'))
-{
- function lang($line, $id = '')
- {
- $CI =& get_instance();
- $line = $CI->lang->line($line);
-
- if ($id != '')
- {
- $line = '<label for="'.$id.'">'.$line."</label>";
- }
-
- return $line;
- }
-}
-
-// ------------------------------------------------------------------------
-/* End of file language_helper.php */
+<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package CodeIgniter
+ * @author ExpressionEngine Dev Team
+ * @copyright Copyright (c) 2008, EllisLab, Inc.
+ * @license http://codeigniter.com/user_guide/license.html
+ * @link http://codeigniter.com
+ * @since Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Language Helpers
+ *
+ * @package CodeIgniter
+ * @subpackage Helpers
+ * @category Helpers
+ * @author ExpressionEngine Dev Team
+ * @link http://codeigniter.com/user_guide/helpers/language_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Lang
+ *
+ * Fetches a language variable and optionally outputs a form label
+ *
+ * @access public
+ * @param string the language line
+ * @param string the id of the form element
+ * @return string
+ */
+if ( ! function_exists('lang'))
+{
+ function lang($line, $id = '')
+ {
+ $CI =& get_instance();
+ $line = $CI->lang->line($line);
+
+ if ($id != '')
+ {
+ $line = '<label for="'.$id.'">'.$line."</label>";
+ }
+
+ return $line;
+ }
+}
+
+// ------------------------------------------------------------------------
+/* End of file language_helper.php */
/* Location: ./system/helpers/language_helper.php */ \ No newline at end of file