]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Bookmark/classes/Bookmark.php
Merged stuff from upstream/master
[quix0rs-gnu-social.git] / plugins / Bookmark / classes / Bookmark.php
index b593bc1909cef57d26f34d70656fe133fbe82a1e..7fd3f53ac1546ea008dcde34bd8b4bfc0256fdc7 100644 (file)
@@ -92,12 +92,16 @@ class Bookmark extends Managed_DataObject
      * @return  Bookmark            The found bookmark object.
      * @throws  NoResultException   When you don't find it after all.
      */
+<<<<<<< .merge_file_ZPs3Af
     static public function fromStored(Notice $stored)
     {
         return self::getByPK(array('uri' => $stored->getUri()));
     }
 
     public function getStored()
+=======
+    static function getByNotice(Notice $notice)
+>>>>>>> .merge_file_eD7Wwf
     {
         return Notice::getByKeys(array('uri' => $this->getUri()));
     }
@@ -157,7 +161,12 @@ class Bookmark extends Managed_DataObject
      *
      * @return Bookmark the Bookmark object
      */
+<<<<<<< .merge_file_ZPs3Af
     static function saveActivityObject(ActivityObject $actobj, Notice $stored)
+=======
+    static function saveNew(Profile $profile, $title, $url, $rawtags, $description,
+                            array $options=array())
+>>>>>>> .merge_file_eD7Wwf
     {
         $url = null;
         // each extra element is array('tagname', array('attr'=>'val', ...), 'content')
@@ -177,11 +186,20 @@ class Bookmark extends Managed_DataObject
             throw new ClientException(sprintf(_m('Expected exactly 1 link rel=related in a Bookmark, got %1$d.'), count($relLinkEls)));
         }
 
+<<<<<<< .merge_file_ZPs3Af
         if (!strlen($actobj->title)) {
             throw new ClientException(_m('You must provide a non-empty title.'));
         }
         if (!common_valid_http_url($url)) {
             throw new ClientException(_m('Only web bookmarks can be posted (HTTP or HTTPS).'));
+=======
+        if (array_key_exists('uri', $options)) {
+            $other = Bookmark::getKV('uri', $options['uri']);
+            if (!empty($other)) {
+                // TRANS: Client exception thrown when trying to save a new bookmark that already exists.
+                throw new ClientException(_m('Bookmark already exists.'));
+            }
+>>>>>>> .merge_file_eD7Wwf
         }
 
         try {