From cd74fb8609003f88e04f2d0560abe573cfb09231 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 18 Jun 2020 08:53:30 -0400 Subject: [PATCH] Add new Content\BBCode::getShareOpeningTag --- src/Content/Text/BBCode.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index 09d031068..1cd8e438c 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -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(["'", "[", "]"], ["'", "[", "]"], $author). + "' profile='" . str_replace(["'", "[", "]"], ["'", "[", "]"], $profile). + "' avatar='" . str_replace(["'", "[", "]"], ["'", "[", "]"], $avatar); + + if ($guid) { + $header .= "' guid='" . str_replace(["'", "[", "]"], ["'", "[", "]"], $guid); + } + + if ($posted) { + $header .= "' posted='" . str_replace(["'", "[", "]"], ["'", "[", "]"], $posted); + } + + $header .= "' link='" . str_replace(["'", "[", "]"], ["'", "[", "]"], $link)."']"; + + return $header; + } }