]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Bookmark/Bookmark.php
Extended profile - don't show rel for empty phone number
[quix0rs-gnu-social.git] / plugins / Bookmark / Bookmark.php
index 4ee287fb65b88f4bdf3a777f25dd1c95fb3c0ef2..04cd8dbfa866ea1fa6056176084b4f82afba6fd4 100644 (file)
@@ -214,7 +214,11 @@ class Bookmark extends Memcached_DataObject
         }
 
         if (is_string($rawtags)) {
-            $rawtags = preg_split('/[\s,]+/', $rawtags);
+            if (empty($rawtags)) {
+                $rawtags = array();
+            } else {
+                $rawtags = preg_split('/[\s,]+/', $rawtags);
+            }
         }
 
         $nb = new Bookmark();
@@ -274,10 +278,15 @@ class Bookmark extends Memcached_DataObject
 
         // Use user's preferences for short URLs, if possible
 
-        $user = User::staticGet('id', $profile->id);
+        try {
+            $user = User::staticGet('id', $profile->id);
 
-        $shortUrl = File_redirection::makeShort($url, 
-                                                empty($user) ? null : $user);
+            $shortUrl = File_redirection::makeShort($url, 
+                                                    empty($user) ? null : $user);
+        } catch (Exception $e) {
+            // Don't let this stop us.
+            $shortUrl = $url;
+        }
 
         $content = sprintf(_('"%s" %s %s %s'),
                            $title,
@@ -298,7 +307,8 @@ class Bookmark extends Memcached_DataObject
         $options = array_merge(array('urls' => array($url),
                                      'rendered' => $rendered,
                                      'tags' => $tags,
-                                     'replies' => $replies),
+                                     'replies' => $replies,
+                                     'object_type' => ActivityObject::BOOKMARK),
                                $options);
 
         if (!array_key_exists('uri', $options)) {