X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FBookmark%2Fdeliciousbookmarkimporter.php;h=018239f49d6be341edc6cbfd065820c64fcf463a;hb=4e1ce4e5bbc43869dc7c85463f9a733da9f5fda4;hp=545c336860e769721e147a8f28ba88117bd3e0de;hpb=56875318489b11c96d0360f7458bb3c6f1a25dc9;p=quix0rs-gnu-social.git diff --git a/plugins/Bookmark/deliciousbookmarkimporter.php b/plugins/Bookmark/deliciousbookmarkimporter.php index 545c336860..018239f49d 100644 --- a/plugins/Bookmark/deliciousbookmarkimporter.php +++ b/plugins/Bookmark/deliciousbookmarkimporter.php @@ -61,52 +61,26 @@ class DeliciousBookmarkImporter extends QueueHandler /** * Handle the data * - * @param array $data array of user, dt, dd + * @param array $data associative array of user & bookmark info from DeliciousBackupImporter::importBookmark() * * @return boolean success value */ function handle($data) { - list($user, $dt, $dd) = $data; - - $as = $dt->getElementsByTagName('a'); - - if ($as->length == 0) { - throw new ClientException(_("No tag in a
.")); - } - - $a = $as->item(0); - - $private = $a->getAttribute('private'); - - if ($private != 0) { - throw new ClientException(_('Skipping private bookmark.')); - } - - if (!empty($dd)) { - $description = $dd->nodeValue; - } else { - $description = null; - } - - $title = $a->nodeValue; - $url = $a->getAttribute('href'); - $tags = $a->getAttribute('tags'); - $addDate = $a->getAttribute('add_date'); - $created = common_sql_date(intval($addDate)); + $profile = Profile::staticGet('id', $data['profile_id']); try { - $saved = Bookmark::saveNew($user->getProfile(), - $title, - $url, - $tags, - $description, - array('created' => $created, + $saved = Bookmark::saveNew($profile, + $data['title'], + $data['url'], + $data['tags'], + $data['description'], + array('created' => $data['created'], 'distribute' => false)); } catch (ClientException $e) { // Most likely a duplicate -- continue on with the rest! - common_log(LOG_ERR, "Error importing delicious bookmark to $url: " . $e->getMessage()); + common_log(LOG_ERR, "Error importing delicious bookmark to $data[url]: " . $e->getMessage()); return true; }