diff options
author | admin <devnull@localhost> | 2006-10-21 21:44:22 +0200 |
---|---|---|
committer | admin <devnull@localhost> | 2006-10-21 21:44:22 +0200 |
commit | e334c472fb4be44feec3a73402fc4a2b062cbfc0 (patch) | |
tree | 553f17d67e7ef652016ec85b2a576bb2210f0ff8 /system/helpers | |
parent | bd6bee75dd26ade1c8d9cfd104bb913065797c59 (diff) |
Diffstat (limited to 'system/helpers')
-rw-r--r-- | system/helpers/array_helper.php | 4 | ||||
-rw-r--r-- | system/helpers/cookie_helper.php | 10 | ||||
-rw-r--r-- | system/helpers/date_helper.php | 32 | ||||
-rw-r--r-- | system/helpers/directory_helper.php | 20 | ||||
-rw-r--r-- | system/helpers/download_helper.php | 8 | ||||
-rw-r--r-- | system/helpers/file_helper.php | 14 | ||||
-rw-r--r-- | system/helpers/form_helper.php | 10 | ||||
-rw-r--r-- | system/helpers/html_helper.php | 4 | ||||
-rw-r--r-- | system/helpers/inflector_helper.php | 4 | ||||
-rw-r--r-- | system/helpers/security_helper.php | 8 | ||||
-rw-r--r-- | system/helpers/string_helper.php | 20 | ||||
-rw-r--r-- | system/helpers/text_helper.php | 68 | ||||
-rw-r--r-- | system/helpers/typography_helper.php | 32 | ||||
-rw-r--r-- | system/helpers/url_helper.php | 38 | ||||
-rw-r--r-- | system/helpers/xml_helper.php | 6 |
15 files changed, 139 insertions, 139 deletions
diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php index 8adbd8548..491c61577 100644 --- a/system/helpers/array_helper.php +++ b/system/helpers/array_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php index 8985fae2e..b117816e2 100644 --- a/system/helpers/cookie_helper.php +++ b/system/helpers/cookie_helper.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Code Igniter Cookie Helpers - * + * * @package CodeIgniter * @subpackage Helpers * @category Helpers @@ -30,7 +30,7 @@ /** * Set cookie * - * Accepts six parameter, or you can submit an associative + * Accepts six parameter, or you can submit an associative * array in the first parameter containing all the values. * * @access public @@ -43,7 +43,7 @@ * @return void */ function set_cookie($name = '', $value = '', $expire = '', $domain = '', $path = '/', $prefix = '') -{ +{ if (is_array($name)) { foreach (array('value', 'expire', 'domain', 'path', 'prefix', 'name') as $item) diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index 911862423..b8df03edb 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -39,10 +39,10 @@ function now() { $CI =& get_instance(); - if (strtolower($CI->config->item('time_reference')) == 'gmt') + if (strtolower($CI->config->item('time_reference')) == 'gmt') { - $now = time(); - $system_time = mktime(gmdate("H", $now), gmdate("i", $now), gmdate("s", $now), gmdate("m", $now), gmdate("d", $now), gmdate("Y", $now)); + $now = time(); + $system_time = mktime(gmdate("H", $now), gmdate("i", $now), gmdate("s", $now), gmdate("m", $now), gmdate("d", $now), gmdate("Y", $now)); if (strlen($system_time) < 10) { @@ -130,7 +130,7 @@ function standard_date($fmt = 'DATE_RFC822', $time = '') /** * Timespan * - * Returns a span of seconds in this format: + * Returns a span of seconds in this format: * 10 days 14 hours 36 minutes 47 seconds * * @access public @@ -244,7 +244,7 @@ function timespan($seconds = 1, $time = '') /** * Number of days in a month * - * Takes a month/year as input and returns the number of days + * Takes a month/year as input and returns the number of days * for the given month/year. Takes leap years into consideration. * * @access public @@ -265,7 +265,7 @@ function days_in_month($month = 0, $year = '') } if ($month == 2) - { + { if ($year % 400 == 0 OR ($year % 4 == 0 AND $year % 100 != 0)) { return 29; @@ -290,7 +290,7 @@ function local_to_gmt($time = '') if ($time == '') $time = time(); - return mktime( gmdate("H", $time), gmdate("i", $time), gmdate("s", $time), gmdate("m", $time), gmdate("d", $time), gmdate("Y", $time)); + return mktime( gmdate("H", $time), gmdate("i", $time), gmdate("s", $time), gmdate("m", $time), gmdate("d", $time), gmdate("Y", $time)); } // ------------------------------------------------------------------------ @@ -335,7 +335,7 @@ function gmt_to_local($time = '', $timezone = 'UTC', $dst = FALSE) * @return integer */ function mysql_to_unix($time = '') -{ +{ // We'll remove certain characters for backward compatibility // since the formatting changed with MySQL 4.1 // YYYY-MM-DD HH:MM:SS @@ -345,7 +345,7 @@ function mysql_to_unix($time = '') $time = str_replace(' ', '', $time); // YYYYMMDDHHMMSS - return mktime( + return mktime( substr($time, 8, 2), substr($time, 10, 2), substr($time, 12, 2), @@ -422,13 +422,13 @@ function human_to_unix($datestr = '') $split = preg_split("/\040/", $datestr); - $ex = explode("-", $split['0']); + $ex = explode("-", $split['0']); $year = (strlen($ex['0']) == 2) ? '20'.$ex['0'] : $ex['0']; $month = (strlen($ex['1']) == 1) ? '0'.$ex['1'] : $ex['1']; $day = (strlen($ex['2']) == 1) ? '0'.$ex['2'] : $ex['2']; - $ex = explode(":", $split['1']); + $ex = explode(":", $split['1']); $hour = (strlen($ex['0']) == 1) ? '0'.$ex['0'] : $ex['0']; $min = (strlen($ex['1']) == 1) ? '0'.$ex['1'] : $ex['1']; @@ -515,10 +515,10 @@ function timezone_menu($default = 'UTC', $class = "", $name = 'timezones') */ function timezones($tz = '') { - // Note: Don't change the order of these even though + // Note: Don't change the order of these even though // some items appear to be in the wrong order - $zones = array( + $zones = array( 'UM12' => -12, 'UM11' => -11, 'UM10' => -10, @@ -548,7 +548,7 @@ function timezones($tz = '') 'UP85' => +8.5, 'UP10' => +10, 'UP11' => +11, - 'UP12' => +12 + 'UP12' => +12 ); if ($tz == '') diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php index 4b7a383b2..e6ed47fd8 100644 --- a/system/helpers/directory_helper.php +++ b/system/helpers/directory_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -45,14 +45,14 @@ function directory_map($source_dir, $top_level_only = FALSE) $filedata = array(); if ($fp = @opendir($source_dir)) - { + { while (FALSE !== ($file = readdir($fp))) { - if (@is_dir($source_dir.$file) && substr($file, 0, 1) != '.' AND $top_level_only == FALSE) - { + if (@is_dir($source_dir.$file) && substr($file, 0, 1) != '.' AND $top_level_only == FALSE) + { $temp_array = array(); - - $temp_array = directory_map($source_dir.$file."/"); + + $temp_array = directory_map($source_dir.$file."/"); $filedata[$file] = $temp_array; } @@ -60,9 +60,9 @@ function directory_map($source_dir, $top_level_only = FALSE) { $filedata[] = $file; } - } - return $filedata; - } + } + return $filedata; + } } diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 8d9fee478..dbedd8722 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -78,8 +78,8 @@ function force_download($filename = '', $data = '') header("Content-Transfer-Encoding: binary"); header('Pragma: public'); header("Content-Length: ".strlen($data)); - } - else + } + else { header('Content-Type: "'.$mime.'"'); header('Content-Disposition: attachment; filename="'.$filename.'"'); diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index 7a04324e4..c9c21380d 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -56,13 +56,13 @@ function read_file($file) flock($fp, LOCK_SH); $data = ''; - if (filesize($file) > 0) + if (filesize($file) > 0) { - $data =& fread($fp, filesize($file)); + $data =& fread($fp, filesize($file)); } flock($fp, LOCK_UN); - fclose($fp); + fclose($fp); return $data; } @@ -72,7 +72,7 @@ function read_file($file) /** * Write File * - * Writes data to the file specified in the path. + * Writes data to the file specified in the path. * Creates a new file if non-existent. * * @access public @@ -119,7 +119,7 @@ function delete_files($path, $del_dir = FALSE, $level = 0) return; while(FALSE !== ($filename = @readdir($current_dir))) - { + { if ($filename != "." and $filename != "..") { if (is_dir($path.'/'.$filename)) diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index e12d89319..6d10a9862 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -53,7 +53,7 @@ function form_open($action = '', $attributes = array(), $hidden = array()) { foreach ($attributes as $key => $val) { - $form .= ' '.$key.'="'.$val.'"'; + $form .= ' '.$key.'="'.$val.'"'; } } @@ -100,7 +100,7 @@ function form_open_multipart($action, $attributes = array(), $hidden = array()) * @return string */ function form_hidden($name, $value = '') -{ +{ if ( ! is_array($name)) { return '<input type="hidden" name="'.$name.'" value="'.form_prep($value).'" />'; @@ -251,7 +251,7 @@ function form_checkbox($data = '', $value = '', $checked = TRUE, $extra = '') { $checked = $data['checked']; - if ($checked == FALSE) + if ($checked == FALSE) unset($data['checked']); } diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 1c97dda53..5ba1df990 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index 3d8d3e0ca..666ec40b8 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php index 34386ffea..06228468f 100644 --- a/system/helpers/security_helper.php +++ b/system/helpers/security_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -60,7 +60,7 @@ function dohash($str, $type = 'sha1') { require_once(BASEPATH.'libraries/Sha1'.EXT); $SH = new CI_SHA; - return $SH->generate($str); + return $SH->generate($str); } else { @@ -88,7 +88,7 @@ function dohash($str, $type = 'sha1') * @return string */ function strip_image_tags($str) -{ +{ $str = preg_replace("#<img\s+.*?src\s*=\s*[\"'](.+?)[\"'].*?\>#", "\\1", $str); $str = preg_replace("#<img\s+.*?src\s*=\s*(.+?).*?\>#", "\\1", $str); diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php index d5a3591f9..ba704df9e 100644 --- a/system/helpers/string_helper.php +++ b/system/helpers/string_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -67,7 +67,7 @@ function trim_slashes($str) */ function reduce_double_slashes($str) { - return preg_replace("#([^:])//+#", "\\1/", $str); + return preg_replace("#([^:])//+#", "\\1/", $str); } // ------------------------------------------------------------------------ @@ -101,15 +101,15 @@ function random_string($type = 'alnum', $len = 8) } $str = ''; - for ($i=0; $i < $len; $i++) - { - $str .= substr($pool, mt_rand(0, strlen($pool) -1), 1); + for ($i=0; $i < $len; $i++) + { + $str .= substr($pool, mt_rand(0, strlen($pool) -1), 1); } - return $str; + return $str; break; - case 'unique' : return md5(uniqid(mt_rand())); - break; - } + case 'unique' : return md5(uniqid(mt_rand())); + break; + } } // ------------------------------------------------------------------------ diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php index e2da32746..fbc63a9b4 100644 --- a/system/helpers/text_helper.php +++ b/system/helpers/text_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -35,12 +35,12 @@ * @access public * @param string * @param integer - * @param string the end character. Usually an ellipsis + * @param string the end character. Usually an ellipsis * @return string */ function word_limiter($str, $n = 100, $end_char = '…') { - if (strlen($str) < $n) + if (strlen($str) < $n) { return $str; } @@ -53,12 +53,12 @@ function word_limiter($str, $n = 100, $end_char = '…') } $str = ''; - for ($i = 0; $i < $n; $i++) + for ($i = 0; $i < $n; $i++) { $str .= $words[$i].' '; } - return trim($str).$end_char; + return trim($str).$end_char; } // ------------------------------------------------------------------------ @@ -72,12 +72,12 @@ function word_limiter($str, $n = 100, $end_char = '…') * @access public * @param string * @param integer - * @param string the end character. Usually an ellipsis + * @param string the end character. Usually an ellipsis * @return string */ function character_limiter($str, $n = 500, $end_char = '…') { - if (strlen($str) < $n) + if (strlen($str) < $n) { return $str; } @@ -95,7 +95,7 @@ function character_limiter($str, $n = 500, $end_char = '…') $out .= $val.' '; if (strlen($out) >= $n) { - return trim($out).$end_char; + return trim($out).$end_char; } } } @@ -116,14 +116,14 @@ function ascii_to_entities($str) $count = 1; $out = ''; $temp = array(); - + for ($i = 0, $s = strlen($str); $i < $s; $i++) { $ordinal = ord($str[$i]); - + if ($ordinal < 128) { - $out .= $str[$i]; + $out .= $str[$i]; } else { @@ -131,9 +131,9 @@ function ascii_to_entities($str) { $count = ($ordinal < 224) ? 2 : 3; } - + $temp[] = $ordinal; - + 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); @@ -141,10 +141,10 @@ function ascii_to_entities($str) $out .= '&#'.$number.';'; $count = 1; $temp = array(); - } - } + } + } } - + return $out; } @@ -169,35 +169,35 @@ function entities_to_ascii($str, $all = TRUE) $digits = $matches['1'][$i]; $out = ''; - + if ($digits < 128) { $out .= chr($digits); - - } + + } elseif ($digits < 2048) { $out .= chr(192 + (($digits - ($digits % 64)) / 64)); $out .= 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)); } - + $str = str_replace($matches['0'][$i], $out, $str); } } - + if ($all) { $str = str_replace(array("&", "<", ">", """, "'", "-"), array("&","<",">","\"", "'", "-"), $str); } - + return $str; } @@ -252,8 +252,8 @@ function word_censor($str, $censored, $replacement = '') */ function highlight_code($str) { - // The highlight string function encodes and highlights - // brackets so we need them to start raw + // The highlight string function encodes and highlights + // brackets so we need them to start raw $str = str_replace(array('<', '>'), array('<', '>'), $str); // Replace any existing PHP tags to temporary markers so they don't accidentally @@ -340,15 +340,15 @@ function word_wrap($str, $chars = '76') $lines = split("\n", $str); $output = ""; - while (list(, $thisline) = each($lines)) + while (list(, $thisline) = each($lines)) { if (strlen($thisline) > $chars) { $line = ""; $words = split(" ", $thisline); - while(list(, $thisword) = each($words)) + while(list(, $thisword) = each($words)) { - while((strlen($thisword)) > $chars) + while((strlen($thisword)) > $chars) { $cur_pos = 0; for($i=0; $i < $chars - 1; $i++) @@ -361,20 +361,20 @@ function word_wrap($str, $chars = '76') $thisword = substr($thisword, $cur_pos, (strlen($thisword) - $cur_pos)); } - if ((strlen($line) + strlen($thisword)) > $chars) + if ((strlen($line) + strlen($thisword)) > $chars) { $output .= $line."\n"; $line = $thisword." "; - } - else + } + else { $line .= $thisword." "; } } $output .= $line."\n"; - } - else + } + else { $output .= $thisline."\n"; } diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php index fe9e3bb92..1681fa37c 100644 --- a/system/helpers/typography_helper.php +++ b/system/helpers/typography_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -46,12 +46,12 @@ function nl2br_except_pre($str) { $newstr .= nl2br($ex[$i]); } - else + else { $newstr .= $ex[$i]; } - if ($ct - 1 != $i) + if ($ct - 1 != $i) $newstr .= "pre>"; } @@ -62,7 +62,7 @@ function nl2br_except_pre($str) /** * Auto Typography Wrapper Function - * + * * * @access public * @param string @@ -78,7 +78,7 @@ function auto_typography($str) /** * Auto Typography Class - * + * * * @access private * @category Helpers @@ -117,7 +117,7 @@ class Auto_typography { /* * Reduce line breaks * - * If there are more than two consecutive line + * If there are more than two consecutive line * breaks we'll compress them down to a maximum * of two since there's no benefit to more. * @@ -127,8 +127,8 @@ class Auto_typography { /* * Convert quotes within tags to temporary marker * - * We don't want quotes converted within - * tags so we'll temporarily convert them to + * We don't want quotes converted within + * tags so we'll temporarily convert them to * {@DQ} and {@SQ} * */ @@ -136,7 +136,7 @@ class Auto_typography { { for ($i = 0; $i < count($matches['0']); $i++) { - $str = str_replace($matches['0'][$i], + $str = str_replace($matches['0'][$i], str_replace(array("'",'"'), array('{@SQ}', '{@DQ}'), $matches['0'][$i]), $str); } @@ -159,7 +159,7 @@ class Auto_typography { * Convert "ignore" tags to temporary marker * * The parser splits out the string at every tag - * it encounters. Certain inline tags, like image + * it encounters. Certain inline tags, like image * tags, links, span tags, etc. will be adversely * affected if they are split out so we'll convert * the opening < temporarily to: {@TAG} @@ -202,7 +202,7 @@ class Auto_typography { * to skip <pre> tags and a few other things. * */ - if (preg_match("#<(/*)(".$this->block_elements.").*?\>#", $chunk, $match)) + if (preg_match("#<(/*)(".$this->block_elements.").*?\>#", $chunk, $match)) { if (preg_match("#".$this->skip_elements."#", $match['2'])) { @@ -244,7 +244,7 @@ class Auto_typography { // Fix an artifact that happens during the paragraph replacement $str = preg_replace('#(<p>\n*</p>)#', '', $str); - // If the user submitted their own paragraph tags with class data + // If the user submitted their own paragraph tags with class data // in them we will retain them instead of using our tags. $str = preg_replace('#(<p.*?>)<p>#', "\\1", $str); @@ -444,8 +444,8 @@ class Auto_typography { } // Ellipsis - $str = preg_replace("#(\w)\.\.\.(\s|<br />|</p>)#", "\\1…\\2", $str); - $str = preg_replace("#(\s|<br />|</p>)\.\.\.(\w)#", "\\1…\\2", $str); + $str = preg_replace("#(\w)\.\.\.(\s|<br />|</p>)#", "\\1…\\2", $str); + $str = preg_replace("#(\s|<br />|</p>)\.\.\.(\w)#", "\\1…\\2", $str); // Run the translation array we defined above $str = str_replace(array_keys($table), array_values($table), $str); @@ -536,5 +536,5 @@ class Auto_typography { } } - + ?>
\ No newline at end of file diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 2f93bcfbf..cd628c6ae 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -30,7 +30,7 @@ /** * Site URL * - * Create a local URL based on your basepath. Segments can be passed via the + * Create a local URL based on your basepath. Segments can be passed via the * first parameter either as a string or an array. * * @access public @@ -38,7 +38,7 @@ * @return string */ function site_url($uri = '') -{ +{ $CI =& get_instance(); return $CI->config->site_url($uri); } @@ -54,7 +54,7 @@ function site_url($uri = '') * @return string */ function base_url() -{ +{ $CI =& get_instance(); return $CI->config->slash_item('base_url'); } @@ -70,7 +70,7 @@ function base_url() * @return string */ function index_page() -{ +{ $CI =& get_instance(); return $CI->config->item('index_page'); } @@ -173,7 +173,7 @@ function anchor_popup($uri = '', $title = '', $attributes = FALSE) */ function mailto($email, $title = '', $attributes = '') { - if ($title == "") + if ($title == "") { $title = $email; } @@ -201,7 +201,7 @@ function mailto($email, $title = '', $attributes = '') */ function safe_mailto($email, $title = '', $attributes = '') { - if ($title == "") + if ($title == "") { $title = $email; } @@ -216,7 +216,7 @@ function safe_mailto($email, $title = '', $attributes = '') $x[] = "|".ord(substr($email, $i, 1)); } - $x[] = '"'; + $x[] = '"'; if ($attributes != '') { @@ -250,7 +250,7 @@ function safe_mailto($email, $title = '', $attributes = '') if ($ordinal < 128) { - $x[] = "|".$ordinal; + $x[] = "|".$ordinal; } else { @@ -266,7 +266,7 @@ function safe_mailto($email, $title = '', $attributes = '') $x[] = "|".$number; $count = 1; $temp = array(); - } + } } } @@ -282,15 +282,15 @@ var l=new Array(); $i = 0; foreach ($x as $val){ ?>l[<?php echo $i++; ?>]='<?php echo $val; ?>';<?php } ?> -for (var i = l.length-1; i >= 0; i=i-1){ -if (l[i].substring(0, 1) == '|') document.write("&#"+unescape(l[i].substring(1))+";"); +for (var i = l.length-1; i >= 0; i=i-1){ +if (l[i].substring(0, 1) == '|') document.write("&#"+unescape(l[i].substring(1))+";"); else document.write(unescape(l[i]));} //]]> </script><?php $buffer = ob_get_contents(); - ob_end_clean(); - return $buffer; + ob_end_clean(); + return $buffer; } // ------------------------------------------------------------------------ @@ -305,7 +305,7 @@ else document.write(unescape(l[i]));} * * @access public * @param string the string - * @param string the type: email, url, or both + * @param string the type: email, url, or both * @param bool whether to create pop-up links * @return string */ @@ -427,7 +427,7 @@ function url_title($str, $separator = 'dash') foreach ($trans as $key => $val) { $str = preg_replace("#".$key."#", $val, $str); - } + } return trim(stripslashes($str)); } @@ -445,12 +445,12 @@ function url_title($str, $separator = 'dash') * @return string */ function redirect($uri = '', $method = 'location') -{ +{ switch($method) { case 'refresh' : header("Refresh:0;url=".site_url($uri)); break; - default : header("location:".site_url($uri)); + default : header("location:".site_url($uri)); break; } exit; diff --git a/system/helpers/xml_helper.php b/system/helpers/xml_helper.php index ee3fc289b..4cc91f4ef 100644 --- a/system/helpers/xml_helper.php +++ b/system/helpers/xml_helper.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -49,7 +49,7 @@ function xml_convert($str) $str = preg_replace("/$temp(\w+);/","&\\1;", $str); return $str; -} +} ?>
\ No newline at end of file |