// http://video.search.yahoo.com/mrss uses it as a // singleton, but the only place I've seen it in the // wild is at blip.tv, which puts a CDATA section // inside (giving the <embed> element to use. case "content": // XXX break; default: // Ignore // XXX - Is there anything else we'd want? break; } return true; } /* Register this handler with the XML parser */ add_xml_handler("http://search.yahoo.com/mrss/", array("element" => 'media_element_handler')); /********************* Plugin part ********************/ /* thumbnail_hook * If the article contains a thumbnail image, attach it to the displayed * version. */ function thumbnail_hook($nodename, &$retval, &$context) { if (!isset($retval['media:thumbnail'])) { return; } $thumb = "<img class=\"thumbnail\" src=\"" . $retval['media:thumbnail'] . "\"/>\n"; if (isset($retval['content'])) { $retval['content'] = $thumb . $retval['content']; } if (isset($retval['summary'])) {
*/ /* dc_element_handler */ function dc_element_handler($ns_url, $prefix, $elt_name, &$attrs, &$children, &$retval, &$context) { $parent = $context[count($context) - 1]['name']; switch ($elt_name) { case "creator": // XXX - Make sure $chldren is a string? $retval['author_name'] = $children; break; case "date": switch ($parent) { case "channel": case "item": $retval['pub_time'] = strtotime($children); break; default: // Dunno what to do with this break; } break; default: // echo "Warning: unknown \"dc:\" element: [$elt_name]\n"; break; } return true; } /* Register this handler with the XML parser */ add_xml_handler("http://purl.org/dc/elements/1.1/", array("element" => 'dc_element_handler'));
*/ function content_element_handler($ns_url, $prefix, $elt_name, &$attrs, &$children, &$retval, &$context) { $parent = $context[count($context) - 1]['name']; switch ($elt_name) { case "encoded": /* In practice, only RSS files[1] use the Content * module (since Atom already has a <content> * element), so we'll just set the parent's 'content'. * * [1] So does RDF, actually, but it's specially * crafted to look like RSS. */ // XXX - Make sure $chldren is a string? # Clean up HTML run_hooks("clean-html", array(&$children)); $retval['content'] =& $children; // XXX - AFAIK <content:encoded> is only used in RSS // feeds, to provide the body of an article (i.e. // inside an <item>). run_hooks("body", array("content", &$children, &$context)); break; default: // echo "Warning: unknown \"content:\" element: [$elt_name]\n"; break; } return true; } /* Register this handler with the XML parser */ add_xml_handler("http://purl.org/rss/1.0/modules/content/", array("element" => 'content_element_handler'));