Changeset 1457 for branches

Show
Ignore:
Timestamp:
04/28/06 05:25:50 (3 years ago)
Author:
sdcosta
Message:

Magpie passes 102 out of 112 unit tests.

Location:
branches/magpie-hacks
Files:
25 added
2 modified

Legend:

Unmodified
Added
Removed
  • branches/magpie-hacks/MagpieTests/runTests.php

    r1455 r1457  
    11<?php 
    2  
     2/* vim: set expandtab tabstop=4 shiftwidth=4: */ 
    33/* 
    44 * Project:     MagpieRSS: a simple RSS integration tool 
  • branches/magpie-hacks/rss_parse.inc

    r1415 r1457  
    6565     
    6666    var $incontent          = array(); // non-empty if in namespaced XML content field 
     67    var $base64             = false; // true when Atom 1.0 mode="base64" 
    6768    var $exclude_top        = false; // true when Atom 1.0 type="xhtml" 
    6869 
     
    292293                        $this->exclude_top = false; 
    293294                    } 
     295                    if (isset($attrs['mode']) and trim(strtolower($attrs['mode'])) == 'base64') { 
     296                        $this->base64 = true; 
     297                    } 
    294298              } 
    295299              # Handle inline XHTML body elements --CWJ 
     
    336340     
    337341    function feed_cdata ($p, $text) { 
    338          
    339342        if ($this->incontent) { 
    340             $this->append_content( $text ); 
    341         } 
    342         else { 
     343            if ($this->base64) { 
     344                $this->append_content(base64_decode($text)); 
     345            } else { 
     346                $this->append_content( $text ); 
     347            } 
     348        } else { 
    343349            $current_el = join('_', array_reverse($this->stack)); 
    344350            $this->append($current_el, $text); 
     
    352358        $opener = array_pop($this->incontent); 
    353359 
     360        if ($this->base64) { 
     361             $this->base64 = false; 
     362        } 
    354363        // Don't get bamboozled by namespace voodoo 
    355364        if (strpos($el, ':')) { list($ns, $closer) = split(':', $el); } 
     
    653662                $this->normalize_element($item, 'modified', $item, 'updated'); 
    654663                $this->normalize_element($item, 'issued', $item, 'published'); 
     664                $this->normalize_element($item, 'id', $item, 'guid'); 
    655665            } else { 
    656666                $this->normalize_element($item, 'updated', $item, 'modified'); 
    657                 $this->normalize_element($item, 'published', $item, 'issued'); 
     667                $this->normalize_element($item, 'id', $item, 'guid'); 
    658668            } 
    659669 
     
    674684                    $author = "author"; 
    675685                } 
    676  
    677                 $item["author#"] = $source["{$author}#"]; 
    678                 for ($au = 1; $au <= $item["author#"]; $au++) { 
    679                     $id_to = $this->element_id('author', $au); 
    680                     $id_from = $this->element_id($author, $au); 
    681                      
    682                     $item[$id_to] = $source[$id_from]; 
    683                     foreach (array('name', 'email', 'uri', 'url') as $what) { 
    684                         if (isset($source["{$id_from}_{$what}"])) { 
    685                             $item["{$id_to}_{$what}"] = $source["{$id_from}_{$what}"]; 
    686                         } 
     686         
     687                if (isset($source)) { 
     688                    $item["author#"] = $source["{$author}#"]; 
     689                    for ($au = 1; $au <= $item["author#"]; $au++) { 
     690                       $id_to = $this->element_id('author', $au); 
     691                       $id_from = $this->element_id($author, $au); 
     692                        
     693                       $item[$id_to] = $source[$id_from]; 
     694                       foreach (array('name', 'email', 'uri', 'url') as $what) { 
     695                             if (isset($source["{$id_from}_{$what}"])) { 
     696                                $item["{$id_to}_{$what}"] = $source["{$id_from}_{$what}"]; 
     697                             } 
     698                       } 
    687699                    } 
    688700                } 
     
    705717 
    706718            // Normalized item timestamp 
    707             $atom_date = (isset($item['published']) ) ? $item['published'] : $item['updated']; 
     719            $atom_date = (isset($item['published']) ) ? $item['published'] : 
     720                             ((isset($item['updated']) ) ? $item['updated'] : ""); 
    708721            if ( $atom_date ) { 
    709722                $epoch = @parse_w3cdtf($atom_date);