XPressME Integration Kit

Trac

Changeset 42


Ignore:
Timestamp:
Dec 23, 2008, 10:51:11 AM (15 years ago)
Author:
toemon
Message:

include/xml.phpライブラリーのD3pipeとの重複でXPressME側で重複を回避していても、モジュールのロード順番などでD3pipeが後になると、D3Pipe側で重複エラーになるので、クラス名、function名を変更することにした。

Location:
trunk/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/xml.php

    r40 r42  
    1414# and returns an equivalent PHP data structure 
    1515################################################################################### 
    16 if( ! function_exists( 'XML_unserialize' ) ) : // d3pipe Used function 
    17 function & XML_unserialize(&$xml){ 
    18         $xml_parser = &new XML(); 
     16if( ! function_exists( 'xpress_XML_unserialize' ) ) : // d3pipe Used function 
     17function & xpress_XML_unserialize(&$xml){ 
     18        $xml_parser = &new xpress_XML(); 
    1919        $data = &$xml_parser->parse($xml); 
    2020        $xml_parser->destruct(); 
     
    2626# Takes one parameter: the data to serialize. Must be an array. 
    2727################################################################################### 
    28 if( ! function_exists( 'XML_serialize' ) ) : // d3pipe Used function 
    29 function & XML_serialize(&$data, $level = 0, $prior_key = NULL){ 
     28if( ! function_exists( 'xpress_XML_serialize' ) ) : // d3pipe Used function 
     29function & xpress_XML_serialize(&$data, $level = 0, $prior_key = NULL){ 
    3030        if($level == 0){ ob_start(); echo '<?xml version="1.0" ?>',"\n"; } 
    3131        while(list($key, $value) = each($data)) 
     
    3535 
    3636                        if(is_array($value) and array_key_exists(0, $value)){ 
    37                                 XML_serialize($value, $level, $key); 
     37                                xpress_XML_serialize($value, $level, $key); 
    3838                        }else{ 
    3939                                $tag = $prior_key ? $prior_key : $key; 
     
    4747                                if(is_null($value)) echo " />\n"; 
    4848                                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"; 
    5050                        } 
    5151        reset($data); 
     
    5656# XML class: utility class to be used with PHP's XML handling functions 
    5757################################################################################### 
    58 class XML{ 
     58class xpress_XML{ 
    5959        var $parser;   #a reference to the XML parser 
    6060        var $document; #the entire XML structure built up so far 
     
    6363        var $last_opened_tag; #keeps track of the last tag opened. 
    6464 
    65         function XML(){ 
     65        function xpress_XML(){ 
    6666                // $this->parser = &xml_parser_create(); 
    6767                $this->parser = xml_parser_create(); // GIJ 
     
    9595                        if(is_array($this->parent[$tag]) and array_key_exists(0,$this->parent[$tag])){ #if the keys are numeric 
    9696                                #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]); 
    9898                        }else{ 
    9999                                #this is the second instance of $tag that we've seen. shift around 
     
    129129} 
    130130 
    131 if( ! function_exists( 'count_numeric_items' ) ) : // d3pipe Used function 
    132 function count_numeric_items(&$array){ 
     131if( ! function_exists( 'xpress_count_numeric_items' ) ) : // d3pipe Used function 
     132function xpress_count_numeric_items(&$array){ 
    133133        return is_array($array) ? count(array_filter(array_keys($array), 'is_numeric')) : 0; 
    134134} 
  • trunk/include/xoops_block_cache.php

    r36 r42  
    55        function xpress_block_cache_write($mydirname,$block_name,$block) 
    66        { 
    7                         $xml = XML_serialize($block); 
     7                        $xml = xpress_XML_serialize($block); 
    88                        $xml_name = $block_name . '.xml'; 
    99                        xpress_cache_write($mydirname,$xml_name,$xml); 
     
    1313                        $xml_name = $block_name . '.xml'; 
    1414                        $xml_data = xpress_cache_read($mydirname,$xml_name); 
    15                         return @XML_unserialize($xml_data); 
     15                        return @xpress_XML_unserialize($xml_data); 
    1616        } 
    1717?> 
Note: See TracChangeset for help on using the changeset viewer.