summaryrefslogtreecommitdiffstats
path: root/system/helpers/xml_helper.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/helpers/xml_helper.php')
-rw-r--r--system/helpers/xml_helper.php32
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("&amp;", "&lt;", "&gt;", "&quot;", "&#39;", "&#45;"),
- $str);
+ $str = str_replace(array("&","<",">","\"", "'", "-"),
+ array("&amp;", "&lt;", "&gt;", "&quot;", "&#39;", "&#45;"),
+ $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