$xpath->registerNamespace('media', "http://search.yahoo.com/mrss/");
$xpath->registerNamespace('poco', NAMESPACE_POCO);
- $author = array();
+ $author = [];
// Is it RDF?
if ($xpath->query('/rdf:RDF/rss:channel')->length > 0) {
$author["owner-avatar"] = $contact["thumb"];
}
- $header = array();
+ $header = [];
$header["uid"] = $importer["uid"];
$header["network"] = NETWORK_FEED;
$header["type"] = "remote";
return;
}
- $items = array();
+ $items = [];
- $entrylist = array();
+ $entrylist = [];
foreach ($entries AS $entry) {
$entrylist[] = $entry;
if (!$simulate) {
$condition = ["`uid` = ? AND `uri` = ? AND `network` IN (?, ?)",
$importer["uid"], $item["uri"], NETWORK_FEED, NETWORK_DFRN];
- $previous = dba::selectOne('item', ['id'], $condition);
+ $previous = dba::selectFirst('item', ['id'], $condition);
if (DBM::is_result($previous)) {
logger("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already existed under id ".$previous["id"], LOGGER_DEBUG);
continue;
// <category>Ausland</category>
// <media:thumbnail width="152" height="76" url="http://www.taz.de/picture/667875/192/14388767.jpg"/>
- $attachments = array();
+ $attachments = [];
$enclosures = $xpath->query("enclosure", $entry);
foreach ($enclosures AS $enclosure) {
$item["attach"] .= ',';
}
- $attachments[] = array("link" => $href, "type" => $type, "length" => $length);
+ $attachments[] = ["link" => $href, "type" => $type, "length" => $length];
$item["attach"] .= '[attach]href="'.$href.'" length="'.$length.'" type="'.$type.'"[/attach]';
}
}
$item["body"] .= "\n".$item['tag'];
}
- if (!strstr($item["body"], '[url') && ($item['plink'] != '')) {
+ // Add the link to the original feed entry if not present in feed
+ if (!strstr($item["body"], $item['plink']) && ($item['plink'] != '')) {
$item["body"] .= "[hr][url]".$item['plink']."[/url]";
}
}
}
if ($simulate) {
- return array("header" => $author, "items" => $items);
+ return ["header" => $author, "items" => $items];
}
}
}