Esempio n. 1
0
 /**
  * @return array
  */
 public function getItems()
 {
     if ($this->bbCodes === NULL) {
         $this->bbCodes = $this->bbCodeRepository->findAll();
     }
     $result = array();
     foreach ($this->bbCodes as $bbCode) {
         $result[] = $bbCode->exportForMarkItUp();
     }
     return $result;
 }
 /**
  * Parses the text. Replaces all bb codes in the text with appropriate HTML tags.
  *
  * @param string $text The text that is to be parsed.
  * @return string       The parsed text.
  */
 public function getParsedText($text)
 {
     if ($this->bbCodes === NULL) {
         $this->bbCodes = $this->bbCodeRepository->findAll();
     }
     foreach ($this->bbCodes as $bbCode) {
         /** @var $bbCode \Mittwald\Typo3Forum\Domain\Model\Format\BBCode */
         if ($bbCode instanceof QuoteBBCode || $bbCode instanceof ListBBCode) {
             continue;
         }
         $text = preg_replace($bbCode->getRegularExpression(), $bbCode->getRegularExpressionReplacement(), $text);
     }
     return $text;
 }