$oPhpDelicious = new PhpDelicious(AUTH_DELICIOUS_USERNAME, AUTH_DELICIOUS_PASSWORD);\r
if ($sXml = $oPhpDelicious->HttpRequest($sCmd)) {\r
if (strlen($sXml) > 0) {\r
- // Strip last two lines off the file, because these contain a timestamp\r
- $sXml = substr($sXml, 0, strrpos($sXml,"\n"));\r
- $sXml = substr($sXml, 0, strrpos($sXml,"\n"));\r
+ //// Strip last two lines off the file, because these contain a timestamp\r
+ //$sXml = substr($sXml, 0, strrpos($sXml,"\n"));\r
+ //$sXml = substr($sXml, 0, strrpos($sXml,"\n"));\r
+\r
+ // If $sXml contains no line-breaks, pretty-ify the XML\r
+ if (strpos($sXml, "\n") !== true) {\r
+ $sXml = str_replace("?><posts ","?>\n<posts ", $sXml);\r
+ $sXml = str_replace("><post ",">\n <post ", $sXml);\r
+ $sXml = str_replace("></posts>",">\n</posts>", $sXml);\r
+ }\r
\r
fwrite(STDOUT, $sXml);\r
}\r
$oPhpDelicious = new PhpDelicious(AUTH_DELICIOUS_USERNAME, AUTH_DELICIOUS_PASSWORD);\r
if ($sXml = $oPhpDelicious->HttpRequest($sCmd)) {\r
if (strlen($sXml) > 0) {\r
- // Strip last two lines off the file, because these contain a timestamp\r
- $sXml = substr($sXml, 0, strrpos($sXml,"\n"));\r
- $sXml = substr($sXml, 0, strrpos($sXml,"\n"));\r
+ //// Strip last two lines off the file, because these contain a timestamp\r
+ //$sXml = substr($sXml, 0, strrpos($sXml,"\n"));\r
+ //$sXml = substr($sXml, 0, strrpos($sXml,"\n"));\r
+\r
+ // If $sXml contains no line-breaks, pretty-ify the XML\r
+ if (strpos($sXml, "\n") !== true) {\r
+ $sXml = str_replace("?><tags ","?>\n<tags ", $sXml);\r
+ $sXml = str_replace("><tag ",">\n <tag ", $sXml);\r
+ $sXml = str_replace("></tags>",">\n</tags>", $sXml);\r
+ }\r
\r
fwrite(STDOUT, $sXml);\r
}\r