MagpieFromSimplePie::normalize_enclosure PHP Method

normalize_enclosure() public method

MagpieFromSimplePie::normalize_enclosure
public normalize_enclosure ( &$source, string $from, &$dest, string $to, integer $i )
$from string
$to string
$i integer
    function normalize_enclosure(&$source, $from, &$dest, $to, $i)
    {
        $id_from = $this->element_id($from, $i);
        $id_to = $this->element_id($to, $i);
        if (isset($source["{$id_from}@"])) {
            foreach (explode(',', $source["{$id_from}@"]) as $attr) {
                if ($from == 'link_enclosure' and $attr == 'href') {
                    // from Atom
                    $dest["{$id_to}@url"] = $source["{$id_from}@{$attr}"];
                    $dest["{$id_to}"] = $source["{$id_from}@{$attr}"];
                } elseif ($from == 'enclosure' and $attr == 'url') {
                    // from RSS
                    $dest["{$id_to}@href"] = $source["{$id_from}@{$attr}"];
                    $dest["{$id_to}"] = $source["{$id_from}@{$attr}"];
                } else {
                    $dest["{$id_to}@{$attr}"] = $source["{$id_from}@{$attr}"];
                }
            }
        }
    }