_allowRedirects = true; /* Allow redirects as blogger tends to do that */
$req->setMethod(HTTP_REQUEST_METHOD_GET);
$xml_parser = new xml(false, true, true);
$req->setURL($url);
$rData="";
if($req->sendRequest()) {
$rData=$req->getResponseBody();
} else {
print "********** Error in sendRequest *****";
}
//print($rData);
$ret=$xml_parser->parse($rData);
//print_r($ret);
return $ret;
}
function timelineDate($googleDate){
$thisDate=jDate($googleDate);
print "thisDate=$thisDate";
return jDate($googleDate);
}
function timelineXmlFeed($vals) {
global $myBlog;
$entries=$vals[feed][entry];
//print "*****************************************";
//print_r($entries);
$ret="\n";
for ($i=0;$i$thisContent...\n";
}
$ret=$ret."";
return $ret;
}
$vals=parseXMLURLandReturnArray($file,$rData);
$outputFormat=$_GET["output"];
// First test for timeline format
if ($outputFormat=="timeline") {
print timelineXMLFeed($vals);
return;
}
// Else just assume it's normal XML
$buffer=$rData; // Buffer is the working copy;
// Get the blog ID//
$number=eregi("tag:blogger.com,1999:blog-([0-9]*)",$vals[id],$blogIDs);
$blogID=$blogIDs[1]; // Blogid is important later.
// First adjust the individual entries
// one at a time run through and reformat the URL's to point to the right spot
$entries=$vals[feed][entry];
if ($entries[0]==NULL)
$entries=Array(0=>$entries);
//print_r($entries);
for ($i=0;$i0) /* Use a custom title if supplied */ {
/* This will replace all occurances. On the offchance that they have the title twice it will replace twice
Which is not ideal but probably low risk.
*/
$buffer=str_replace("$oldName", "$myTitle",$buffer);
}
// Finally update the top level links
// Reset all 'top level' links to point to the right spot (e.g. back to the rapidblog feed)
$topLinks=$vals[feed][link];
// Order is important. because we are doing simple str_replace we need to fix them in the right order
for ($kk=count($topLinks)-1;$kk>=0;$kk--) {
if ($topLinks[$kk][type]!="application/atom+xml")
$buffer=str_replace($topLinks[$kk][href],$myBlog,$buffer); // everything else (html, txt) points to main blog
else
$buffer=str_replace($topLinks[$kk][href],$myRss,$buffer); // Have atom point back to this feed
}
// Finally remoce the google schema to put it out of it's misery once and for all since some
// services (apparntly?) sniff the schema and then do bad, bad things based on that.
$buffer=str_replace("schemas.google.com","schemas.loghound.com",$buffer);
print $buffer; // Actually output it for the feed!
?>