Ejemplo n.º 1
0
        break;
    case stristr($_REQUEST['data'], '<rdf'):
        $struct = new OutlineFromXML($_REQUEST['data'], array('rootel' => 'rdf:RDF', 'itemel' => 'item', 'collapsels' => array('title', 'description')));
        break;
    case stristr($_REQUEST['data'], '<feed'):
        $struct = new OutlineFromXML($_REQUEST['data'], array('rootel' => 'feed', 'itemel' => 'entry', 'collapsels' => array('title', 'content', 'summary')));
        break;
    case !checkXML($_REQUEST['data']):
        $struct = new OutlineFromXML($_REQUEST['data']);
        break;
    default:
        $struct = new OutlineFromJSON($_REQUEST['data']);
}
//end switch TRUE
if ($_REQUEST['urlfill']) {
    $struct->toOPMLfields();
    $struct->fillURLs();
}
//if urlfill, then ensure xml and html URLs by calling ->fillURLs.  The toOPMLfields is not necessary but helps fillURLs do it's job easier.
if ($_REQUEST['output'] == 'opml') {
    //output OPML
    header('Content-Type: application/xml;charset=utf-8');
    //send the XML http header
    $struct->toOPMLfields();
    //convert fields to standard OPML field names
    if ($_REQUEST['simplify']) {
        $struct->simplify();
    }
    //if we're simplifying, do so
    echo $struct->toOPML();
    //echo the OPML code for the object