phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: phpgwapi/inc class.xmltool.inc.php,1.2,1.3


From: Dan Kuykendall <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpgwapi/inc class.xmltool.inc.php,1.2,1.3
Date: Sat, 21 Sep 2002 02:55:52 -0400

Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv18962

Modified Files:
        class.xmltool.inc.php 
Log Message:
Now is fully working. I will add xpath referencing support at some point

Index: class.xmltool.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.xmltool.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** class.xmltool.inc.php       21 Sep 2002 00:24:11 -0000      1.2
--- class.xmltool.inc.php       21 Sep 2002 06:55:50 -0000      1.3
***************
*** 240,244 ****
                                                        case 'object':
                                                                $subnode = new 
xmltool('node', $nextkey);
!                                                               
$subnode->set_value('PHP_SERIALIZED_OBJECT:'.serialize($val));
                                                                
$node->add_node($subnode);                                                      
                                                                break;
--- 240,244 ----
                                                        case 'object':
                                                                $subnode = new 
xmltool('node', $nextkey);
!                                                               
$subnode->set_value('PHP_SERIALIZED_OBJECT&:'.serialize($val));
                                                                
$node->add_node($subnode);                                                      
                                                                break;
***************
*** 253,257 ****
                                        break;
                                case 'object':
!                                       
$node->set_value('PHP_SERIALIZED_OBJECT:'.serialize($value));
                                        break;
                                case 'resource':
--- 253,257 ----
                                        break;
                                case 'object':
!                                       
$node->set_value('PHP_SERIALIZED_OBJECT&:'.serialize($value));
                                        break;
                                case 'resource':
***************
*** 283,316 ****
                }
  
!               function export_var ($is_start = True)
                {
!                       switch  ($this->data_type)
                        {
!                               case 'root':
!                                       break;
!                               case 'node':
!                                       break;
!                               case 'object':
!                                       break;
                        }
!                       
!                                       
                        if($this->data_type != 'node')
                        {       
!                               $data = $this->data;
!                               $found_at = 
strstr($xmldata['value'],'PHP_SERIALIZED_OBJECT:');
                                if($found_at != False)
                                {
!                                       $data = str_replace 
('PHP_SERIALIZED_OBJECT:', '', $this->data);
!                                       $data = unserialize ($xmldata['value']);
                                }
!                               //if($is_start)
!                               //{
!                               //      $xml_array[$this->data] = $data;
!                               //}
!                               //else
!                               //{
!                                       return $data;
!                               //}
                        }
                        else
--- 283,301 ----
                }
  
!               function export_var()
                {
!                       if($this->node_type == 'root')
                        {
!                               return $this->data->export_var();
                        }
! 
                        if($this->data_type != 'node')
                        {       
!                               $found_at = 
strstr($this->data,'PHP_SERIALIZED_OBJECT&:');
                                if($found_at != False)
                                {
!                                       return unserialize(str_replace 
('PHP_SERIALIZED_OBJECT&:', '', $this->data));
                                }
!                               return $this->data;
                        }
                        else
***************
*** 329,333 ****
                                        }
                                }
!       
                                if($new_index)
                                {
--- 314,318 ----
                                        }
                                }
! 
                                if($new_index)
                                {
***************
*** 335,339 ****
                                        while(list($key,$val) = 
each($this->data))
                                        {
!                                               //$xml_array[$val->name][] = 
$this->export_var($val,False);
                                        }                               
                                }
--- 320,325 ----
                                        while(list($key,$val) = 
each($this->data))
                                        {
! 
!                                               $return_array[$val->name][] = 
$val->export_var();
                                        }                               
                                }
***************
*** 343,352 ****
                                        while(list($key,$val) = 
each($this->data))
                                        {
!                                               //$xml_array[$val->name] = 
$this->export_var($val,False);
                                        }
                                }
                        }
-                       return $xml_array;
                }
                
                function import_xml_children($data, &$i, $parent_node)
--- 329,372 ----
                                        while(list($key,$val) = 
each($this->data))
                                        {
!                                               $return_array[$val->name] = 
$val->export_var();
                                        }
                                }
+                               return $return_array;
+                       }
+               }
+ 
+               function export_struct()
+               {
+                       if($this->node_type == 'root')
+                       {
+                               return $this->data->export_struct();
+                       }
+ 
+                       $retval['tag'] = $this->name;
+                       $retval['attributes'] = $this->attributes;
+                       if($this->data_type != 'node')
+                       {       
+                               $found_at = 
strstr($this->data,'PHP_SERIALIZED_OBJECT&:');
+                               if($found_at != False)
+                               {
+                                       $retval['value'] = 
unserialize(str_replace ('PHP_SERIALIZED_OBJECT&:', '', $this->data));
+                               }
+                               else
+                               {
+                                       $retval['value'] = $this->data;
+                               }
+                               return $retval;
+                       }
+                       else
+                       {
+                               reset($this->data);
+                               while(list($key,$val) = each($this->data))
+                               {
+                                       $retval['children'][] = 
$val->export_struct();
+                               }                               
+                               return $retval;
                        }
                }
+ 
                
                function import_xml_children($data, &$i, $parent_node)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]