summaryrefslogtreecommitdiff
path: root/classes/Notice.php
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-03-02 16:51:21 -0800
committerZach Copley <zach@status.net>2010-03-02 16:51:21 -0800
commit9520c0996d5635ca41b72998321d9587aaf1cc12 (patch)
tree6878baec14e0029915ea973b3709af2426f79d5a /classes/Notice.php
parentca21f1da8603be348c1a34a8bcc3e7610b9a395d (diff)
parent79ffebb51b1141791d5ee7478e3a7beaa9fe8faa (diff)
Merge branch 'testing' of gitorious.org:statusnet/mainline into testing
* 'testing' of gitorious.org:statusnet/mainline: OStatus: save file records for enclosures Changed the geo location cookie Expire to Session.
Diffstat (limited to 'classes/Notice.php')
-rw-r--r--classes/Notice.php28
1 files changed, 26 insertions, 2 deletions
diff --git a/classes/Notice.php b/classes/Notice.php
index 63dc96897..c1263c782 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -211,6 +211,8 @@ class Notice extends Memcached_DataObject
* extracting ! tags from content
* array 'tags' list of hashtag strings to save with the notice
* in place of extracting # tags from content
+ * array 'urls' list of attached/referred URLs to save with the
+ * notice in place of extracting links from content
* @fixme tag override
*
* @return Notice
@@ -380,8 +382,11 @@ class Notice extends Memcached_DataObject
$notice->saveTags();
}
- // @fixme pass in data for URLs too?
- $notice->saveUrls();
+ if (isset($urls)) {
+ $notice->saveKnownUrls($urls);
+ } else {
+ $notice->saveUrls();
+ }
// Prepare inbox delivery, may be queued to background.
$notice->distribute();
@@ -427,6 +432,25 @@ class Notice extends Memcached_DataObject
common_replace_urls_callback($this->content, array($this, 'saveUrl'), $this->id);
}
+ /**
+ * Save the given URLs as related links/attachments to the db
+ *
+ * follow redirects and save all available file information
+ * (mimetype, date, size, oembed, etc.)
+ *
+ * @return void
+ */
+ function saveKnownUrls($urls)
+ {
+ // @fixme validation?
+ foreach ($urls as $url) {
+ File::processNew($url, $this->id);
+ }
+ }
+
+ /**
+ * @private callback
+ */
function saveUrl($data) {
list($url, $notice_id) = $data;
File::processNew($url, $notice_id);