|
items as $item) {
$photoid = ereg_replace('.*/photo/([0-9]*)$', "\\1", $item[guid]);
$handle = cached_fopen_url("http://www.flickr.com/services/rest/?method=flickr.photos.getInfo&photo_id=$photoid&api_key=$api_key", "rb");
$content = '';
while(!feof($handle)) { $content .= fread($handle,4096); }
fclose($handle);
$objXML = new xml2Array();
$arrOutput = $objXML->parse($content);
$arrOutput = $arrOutput[0][children][0][children];
$linkAndThumb = explode("", $item[description]);
$linkAndThumb = $linkAndThumb[2];
$linkAndThumb = str_replace('
', '', $linkAndThumb);
$ownerURL = ereg_replace('^.*http://www.flickr.com/photos/([^/]*).*$', "\\1", $linkAndThumb);
$numComments = $arrOutput[6][tagData];
$numNotes = count($arrOutput[7][children]);
$ownerName = $arrOutput[0][attrs][USERNAME];
$title = $arrOutput[1][tagData];
$descr = $arrOutput[2][tagData];
$tags = $arrOutput[8][children];
$dateTime = date("jS M g:i a", $item[date_timestamp]);
#echo "";
#print_r ($tags);
#echo "
";
if ($k % 2 == 0) {
$start = "\n\n\t| ";
$end = "";
}
else {
$start = "\n\t | ";
$end = "\t | \n
\n";
}
$outhtml = '';
if ($title) $outhtml .= "$title
\n$dateTime
\n";
$outhtml .= "by $ownerName
\n";
$outhtml .= "$linkAndThumb
\n";
if ($descr) $outhtml .= "$descr
\n";
if (count($tags) || $numNotes || $numComments) {
$outhtml .= "";
$end = "\n" . $end;
}
if (count($tags)) {
foreach ($tags as $tag) {
$outhtml .= " \n";
}
}
if ($numNotes || $numComments) {
$outhtml .= "";
$end = "" . $end;
}
if ($numNotes) {
$outhtml .= "[$numNotes note";
if ($numNotes>1) $outhtml .= "s";
$outhtml .= "]\n";
}
if ($numComments) {
$outhtml .= "[$numComments comment";
if ($numComments>1) $outhtml .= "s";
$outhtml .= "]\n";
}
echo "$start$outhtml$end";
$k++;
}
}
?>