- Timestamp:
- Dec 23, 2008, 10:51:11 AM (16 years ago)
- Location:
- trunk/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/xml.php
r40 r42 14 14 # and returns an equivalent PHP data structure 15 15 ################################################################################### 16 if( ! function_exists( ' XML_unserialize' ) ) : // d3pipe Used function17 function & XML_unserialize(&$xml){18 $xml_parser = &new XML();16 if( ! function_exists( 'xpress_XML_unserialize' ) ) : // d3pipe Used function 17 function & xpress_XML_unserialize(&$xml){ 18 $xml_parser = &new xpress_XML(); 19 19 $data = &$xml_parser->parse($xml); 20 20 $xml_parser->destruct(); … … 26 26 # Takes one parameter: the data to serialize. Must be an array. 27 27 ################################################################################### 28 if( ! function_exists( ' XML_serialize' ) ) : // d3pipe Used function29 function & XML_serialize(&$data, $level = 0, $prior_key = NULL){28 if( ! function_exists( 'xpress_XML_serialize' ) ) : // d3pipe Used function 29 function & xpress_XML_serialize(&$data, $level = 0, $prior_key = NULL){ 30 30 if($level == 0){ ob_start(); echo '<?xml version="1.0" ?>',"\n"; } 31 31 while(list($key, $value) = each($data)) … … 35 35 36 36 if(is_array($value) and array_key_exists(0, $value)){ 37 XML_serialize($value, $level, $key);37 xpress_XML_serialize($value, $level, $key); 38 38 }else{ 39 39 $tag = $prior_key ? $prior_key : $key; … … 47 47 if(is_null($value)) echo " />\n"; 48 48 elseif(!is_array($value)) echo '>',htmlspecialchars($value),"</$tag>\n"; 49 else echo ">\n", XML_serialize($value, $level+1),str_repeat("\t", $level),"</$tag>\n";49 else echo ">\n",xpress_XML_serialize($value, $level+1),str_repeat("\t", $level),"</$tag>\n"; 50 50 } 51 51 reset($data); … … 56 56 # XML class: utility class to be used with PHP's XML handling functions 57 57 ################################################################################### 58 class XML{58 class xpress_XML{ 59 59 var $parser; #a reference to the XML parser 60 60 var $document; #the entire XML structure built up so far … … 63 63 var $last_opened_tag; #keeps track of the last tag opened. 64 64 65 function XML(){65 function xpress_XML(){ 66 66 // $this->parser = &xml_parser_create(); 67 67 $this->parser = xml_parser_create(); // GIJ … … 95 95 if(is_array($this->parent[$tag]) and array_key_exists(0,$this->parent[$tag])){ #if the keys are numeric 96 96 #this is the third or later instance of $tag we've come across 97 $key = count_numeric_items($this->parent[$tag]);97 $key = xpress_count_numeric_items($this->parent[$tag]); 98 98 }else{ 99 99 #this is the second instance of $tag that we've seen. shift around … … 129 129 } 130 130 131 if( ! function_exists( ' count_numeric_items' ) ) : // d3pipe Used function132 function count_numeric_items(&$array){131 if( ! function_exists( 'xpress_count_numeric_items' ) ) : // d3pipe Used function 132 function xpress_count_numeric_items(&$array){ 133 133 return is_array($array) ? count(array_filter(array_keys($array), 'is_numeric')) : 0; 134 134 } -
trunk/include/xoops_block_cache.php
r36 r42 5 5 function xpress_block_cache_write($mydirname,$block_name,$block) 6 6 { 7 $xml = XML_serialize($block);7 $xml = xpress_XML_serialize($block); 8 8 $xml_name = $block_name . '.xml'; 9 9 xpress_cache_write($mydirname,$xml_name,$xml); … … 13 13 $xml_name = $block_name . '.xml'; 14 14 $xml_data = xpress_cache_read($mydirname,$xml_name); 15 return @ XML_unserialize($xml_data);15 return @xpress_XML_unserialize($xml_data); 16 16 } 17 17 ?>
Note: See TracChangeset
for help on using the changeset viewer.