diff options
author | Derek Jones <derek.jones@ellislab.com> | 2008-01-28 22:00:20 +0100 |
---|---|---|
committer | Derek Jones <derek.jones@ellislab.com> | 2008-01-28 22:00:20 +0100 |
commit | 269b942a2bf7b022795e591d9b0ad04526ee7e09 (patch) | |
tree | f465bb5a700d4cc5d72ca6e55e251640a46b869b /system/helpers/xml_helper.php | |
parent | a25530f6594c7ba45b3faa9537fda9f807069759 (diff) |
added ability to "extend" helpers
* modified Loader to check for prefixed helpers in application/helpers folder
* surrounded provided helper functions with if (! function_exists('foo')) conditionals so the user's helper functions take precedent.
Diffstat (limited to 'system/helpers/xml_helper.php')
-rw-r--r-- | system/helpers/xml_helper.php | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/system/helpers/xml_helper.php b/system/helpers/xml_helper.php index 1a2c7379c..5aa6de9ec 100644 --- a/system/helpers/xml_helper.php +++ b/system/helpers/xml_helper.php @@ -34,25 +34,27 @@ * @param string
* @return string
*/
-function xml_convert($str)
+if (! function_exists('xml_convert'))
{
- $temp = '__TEMP_AMPERSANDS__';
-
- // Replace entities to temporary markers so that
- // ampersands won't get messed up
- $str = preg_replace("/&#(\d+);/", "$temp\\1;", $str);
- $str = preg_replace("/&(\w+);/", "$temp\\1;", $str);
+ function xml_convert($str)
+ {
+ $temp = '__TEMP_AMPERSANDS__';
+
+ // Replace entities to temporary markers so that
+ // ampersands won't get messed up
+ $str = preg_replace("/&#(\d+);/", "$temp\\1;", $str);
+ $str = preg_replace("/&(\w+);/", "$temp\\1;", $str);
- $str = str_replace(array("&","<",">","\"", "'", "-"),
- array("&", "<", ">", """, "'", "-"),
- $str);
+ $str = str_replace(array("&","<",">","\"", "'", "-"),
+ array("&", "<", ">", """, "'", "-"),
+ $str);
- // Decode the temp markers back to entities
- $str = preg_replace("/$temp(\d+);/","&#\\1;",$str);
- $str = preg_replace("/$temp(\w+);/","&\\1;", $str);
+ // Decode the temp markers back to entities
+ $str = preg_replace("/$temp(\d+);/","&#\\1;",$str);
+ $str = preg_replace("/$temp(\w+);/","&\\1;", $str);
- return $str;
+ return $str;
+ }
}
-
?>
\ No newline at end of file |