From 3cad8cac8ba4385cf72669f8bae3a18b6284c15b Mon Sep 17 00:00:00 2001 From: deepend-tildeclub <58404188+deepend-tildeclub@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:30:25 -0700 Subject: [PATCH] delete btbbcode.php (#138) --- src/classes/btbbcode.php | 72 ---------------------------------------- 1 file changed, 72 deletions(-) delete mode 100644 src/classes/btbbcode.php diff --git a/src/classes/btbbcode.php b/src/classes/btbbcode.php deleted file mode 100644 index d1fa2a08..00000000 --- a/src/classes/btbbcode.php +++ /dev/null @@ -1,72 +0,0 @@ - "[b]", "bbCloseTag" = > "[/b]", "htmlOpenTag" => "", "htmlCloseTag" => "", "type" => "simple") - * - * - Populate $arrBBCodes with multiple arrays like the one above with different bb codes. - * - Do btBBCodeParse->parse($string) to retrieve the output - * - 2 different types, simple and complex. If you set the type to complex, you should also set the arguments total - * - * - * ****I saw there was a BBCode parser on php.net both with PECL and PEAR, but I wanted a standalone one for - * in case users did not have the ability to use the packages. - * - * - */ -class btBBCode { - - - protected $arrBBCodes; - - public function __construct($bbCodeArray = []) { - // Quick way to add bb codes - $this->arrBBCodes = $bbCodeArray; - } - - public function addBBCode($newBBCode) { - - $arrCheckKeys = array_keys($newBBCode); - - if (in_array("bbOpenTag", $arrCheckKeys) && in_array("bbCloseTag", $arrCheckKeys) && in_array("htmlOpenTag", $arrCheckKeys) && in_array("htmlCloseTag", $arrCheckKeys)) { - $this->arrBBCodes[] = $newBBCode; - } - } - - public function parse($strText) { - - foreach ($this->arrBBCodes as $bbCodes) { - if ($bbCodes['type'] == "simple") { - $strText = str_replace($bbCodes['bbOpenTag'], $bbCodes['htmlOpenTag'], $strText); - $strText = str_replace($bbCodes['bbCloseTag'], $bbCodes['htmlCloseTag'], $strText); - } else { - $strText = preg_replace( - } - } - } - - - -} - - - -// Default BB Codes - -$arrBold = ["bbOpenTag" => "[b]", "bbCloseTag" => "[/b]", "htmlOpenTag" => "", "htmlCloseTag" => ""]; -$arrItalic = ["bbOpenTag" => "[i]", "bbCloseTag" => "[/i]", "htmlOpenTag" => "", "htmlCloseTag" => ""]; -$arrUnderline = ["bbOpenTag" => "[u]", "bbCloseTag" => "[/u]", "htmlOpenTag" => "", "htmlCloseTag" => ""]; - - -$arrLink = ["bbOpenTag" => "[url]", "bbCloseTag" => "[/url]", "htmlOpenTag" => "