1
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
5
* An open source application development framework for PHP 5.1.6 or newer
8
* @author ExpressionEngine Dev Team
9
* @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
10
* @license http://codeigniter.com/user_guide/license.html
11
* @link http://codeigniter.com
16
// ------------------------------------------------------------------------
19
* CodeIgniter XML Helpers
21
* @package CodeIgniter
24
* @author ExpressionEngine Dev Team
25
* @link http://codeigniter.com/user_guide/helpers/xml_helper.html
28
// ------------------------------------------------------------------------
31
* Convert Reserved XML characters to Entities
37
if ( ! function_exists('xml_convert'))
39
function xml_convert($str, $protect_all = FALSE)
41
$temp = '__TEMP_AMPERSANDS__';
43
// Replace entities to temporary markers so that
44
// ampersands won't get messed up
45
$str = preg_replace("/&#(\d+);/", "$temp\\1;", $str);
47
if ($protect_all === TRUE)
49
$str = preg_replace("/&(\w+);/", "$temp\\1;", $str);
52
$str = str_replace(array("&","<",">","\"", "'", "-"),
53
array("&", "<", ">", """, "'", "-"),
56
// Decode the temp markers back to entities
57
$str = preg_replace("/$temp(\d+);/","&#\\1;",$str);
59
if ($protect_all === TRUE)
61
$str = preg_replace("/$temp(\w+);/","&\\1;", $str);
68
// ------------------------------------------------------------------------
70
/* End of file xml_helper.php */
71
/* Location: ./system/helpers/xml_helper.php */
b'\\ No newline at end of file'