]> git.mxchange.org Git - friendica.git/commitdiff
Add new Content\BBCode::getShareOpeningTag
authorHypolite Petovan <hypolite@mrpetovan.com>
Thu, 18 Jun 2020 12:53:30 +0000 (08:53 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Thu, 18 Jun 2020 12:53:30 +0000 (08:53 -0400)
src/Content/Text/BBCode.php

index 09d03106869890a1642e8f4de1d83b0b4f4b6bac..1cd8e438cd310a1f3656c17fb5f4ef14c6d55628 100644 (file)
@@ -2223,4 +2223,33 @@ class BBCode
 
                return $body;
        }
+
+       /**
+        * @param $author
+        * @param $profile
+        * @param $avatar
+        * @param $guid
+        * @param $posted
+        * @param $link
+        * @return string
+        * @TODO Rewrite to handle over whole record array
+        */
+       public static function getShareOpeningTag($author, $profile, $avatar, $guid, $posted, $link)
+       {
+               $header = "[share author='" . str_replace(["'", "[", "]"], ["&#x27;", "&#x5B;", "&#x5D;"], $author).
+                       "' profile='" . str_replace(["'", "[", "]"], ["&#x27;", "&#x5B;", "&#x5D;"], $profile).
+                       "' avatar='" . str_replace(["'", "[", "]"], ["&#x27;", "&#x5B;", "&#x5D;"], $avatar);
+
+               if ($guid) {
+                       $header .= "' guid='" . str_replace(["'", "[", "]"], ["&#x27;", "&#x5B;", "&#x5D;"], $guid);
+               }
+
+               if ($posted) {
+                       $header .= "' posted='" . str_replace(["'", "[", "]"], ["&#x27;", "&#x5B;", "&#x5D;"], $posted);
+               }
+
+               $header .= "' link='" . str_replace(["'", "[", "]"], ["&#x27;", "&#x5B;", "&#x5D;"], $link)."']";
+
+               return $header;
+       }
 }