Author: as
Date: Mon Dec 10 15:24:46 2007
New Revision: 6953

Log:
- Some code fixes to make Feed compatible with older versions of PHP (5.1.*).

Modified:
    trunk/Feed/src/interfaces/processor.php
    trunk/Feed/src/processors/atom.php

Modified: trunk/Feed/src/interfaces/processor.php
==============================================================================
--- trunk/Feed/src/interfaces/processor.php [iso-8859-1] (original)
+++ trunk/Feed/src/interfaces/processor.php [iso-8859-1] Mon Dec 10 15:24:46 
2007
@@ -102,7 +102,7 @@
         }
         foreach ( $value as $valueElement )
         {
-            $meta = $this->xml->createElement( $element, $valueElement );
+            $meta = $this->xml->createElement( $element, ( $valueElement 
instanceof ezcFeedElement ) ? $valueElement->__toString() : 
(string)$valueElement );
             $root->appendChild( $meta );
         }
     }
@@ -130,7 +130,7 @@
             }
             else
             {
-                $meta = $this->xml->createElement( $element, $valueElement );
+                $meta = $this->xml->createElement( $element, ( $valueElement 
instanceof ezcFeedElement ) ? $valueElement->__toString() : 
(string)$valueElement );
             }
             foreach ( $attributes as $attrName => $attrValue )
             {

Modified: trunk/Feed/src/processors/atom.php
==============================================================================
--- trunk/Feed/src/processors/atom.php [iso-8859-1] (original)
+++ trunk/Feed/src/processors/atom.php [iso-8859-1] Mon Dec 10 15:24:46 2007
@@ -482,7 +482,7 @@
                     switch ( $val )
                     {
                         case 'html':
-                            $dataNode->set( htmlspecialchars( $dataNode ) );
+                            $dataNode->set( htmlspecialchars( 
$dataNode->__toString() ) );
                             $this->addAttribute( $elementTag, 'type', $val );
                             break;
 
@@ -517,7 +517,7 @@
 
         if ( !$this->schema->isEmpty( $element, $subElement ) )
         {
-            $elementTag->nodeValue = $dataNode;
+            $elementTag->nodeValue = ( $dataNode instanceof ezcFeedElement ) ? 
$dataNode->__toString() : (string)$dataNode;
         }
     }
 
@@ -556,7 +556,7 @@
                     switch ( $val )
                     {
                         case 'html':
-                            $dataNode->set( htmlspecialchars( $dataNode ) );
+                            $dataNode->set( htmlspecialchars( 
$dataNode->__toString() ) );
                             $this->addAttribute( $elementTag, 'type', $val );
                             break;
 
@@ -581,14 +581,14 @@
                             }
                             else if ( substr_compare( $val, 'text/', 0, 5, 
true ) === 0 )
                             {
-                                $dataNode->set( htmlspecialchars( $dataNode ) 
);
+                                $dataNode->set( htmlspecialchars( 
$dataNode->__toString() ) );
                                 $this->addAttribute( $elementTag, 'type', $val 
);
                                 break;
                             }
                             else if ( $val !== null )
                             {
                                 // @todo: make 76 and "\n" options?
-                                $dataNode->set( chunk_split( base64_encode( 
$dataNode ), 76, "\n" ) );
+                                $dataNode->set( chunk_split( base64_encode( 
$dataNode->__toString() ), 76, "\n" ) );
                                 $this->addAttribute( $elementTag, 'type', $val 
);
                             }
                             else
@@ -613,7 +613,7 @@
 
         if ( !$this->schema->isEmpty( $element, $subElement ) )
         {
-            $elementTag->nodeValue = $dataNode;
+            $elementTag->nodeValue = ( $dataNode instanceof ezcFeedElement) ? 
$dataNode->__toString() : (string)$dataNode;
         }
     }
 
@@ -714,7 +714,7 @@
                                 switch ( $val )
                                 {
                                     case 'html':
-                                        $dataNode->set( htmlspecialchars( 
$dataNode ) );
+                                        $dataNode->set( htmlspecialchars( 
$dataNode->__toString() ) );
                                         $this->addAttribute( $childTag, 
'type', $val );
                                         break;
 
@@ -754,7 +754,7 @@
                             // Sample date: 2003-12-13T18:30:02-05:00
                             $dataNode->set( date( "c", 
ezcFeedTools::prepareDate( $dataNode->get() ) ) );
                         }
-                        $childTag->nodeValue = $dataNode;
+                        $childTag->nodeValue = ($dataNode instanceof 
ezcFeedElement ) ? $dataNode->__toString() : (string)$dataNode;
                     }
                 }
             }


-- 
svn-components mailing list
[EMAIL PROTECTED]
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to