Show
Ignore:
Timestamp:
02/12/07 09:18:06 (22 months ago)
Author:
mbonetti
Message:

Only copy image enclosures to item body if the image isn't there yet.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/gregarius/util.php

    r1685 r1691  
    317317                $enclosure = $item['enclosure@url']; 
    318318                // If the enclosure is an image, append it to the content 
    319                 if ($enclosure && array_key_exists('enclosure@type', $item) && preg_match('#image/(png|gif|jpe?g)#', $item['enclosure@type'])) { 
    320                     $description = '<img src="'.$enclosure.'" alt="" />' . $description; 
    321                     $enclosure = ''; 
     319                // but only if it isn't there yet 
     320                if ($enclosure &&  
     321                    array_key_exists('enclosure@type', $item) &&  
     322                    preg_match('#image/(png|gif|jpe?g)#', $item['enclosure@type']) && 
     323                    (FALSE == strpos($description,$enclosure))) { 
     324                        $description = '<img src="'.$enclosure.'" alt="" />' . $description; 
     325                        $enclosure = ''; 
    322326                } 
    323327            } else {