/**
  * Constructs a new CodeDefinition.
  */
 public static function construct($tagName, $replacementText, $useOption = false, $parseContent = true, $nestLimit = -1, $optionValidator = null, $bodyValidator = null)
 {
     $def = new CodeDefinition();
     $def->elCounter = 0;
     $def->setTagName($tagName);
     $def->setReplacementText($replacementText);
     $def->useOption = $useOption;
     $def->parseContent = $parseContent;
     $def->nestLimit = $nestLimit;
     $def->optionValidator = $optionValidator;
     $def->bodyValidator = $bodyValidator;
     return $def;
 }
Example #2
0
 /**
  * Adds a simple (text-replacement only) bbcode definition
  * 
  * @param string $tagName   the tag name of the code (for example the b in [b])
  * @param string $replace   the html to use, with {param} and optionally {option} for replacements
  * @param boolean $useOption    whether or not this bbcode uses the secondary {option} replacement
  * @param boolean $parseContent whether or not to parse the content within these elements
  * @param integer $nestLimit    an optional limit of the number of elements of this kind that can be nested within
  *                              each other before the parser stops parsing them.
  */
 public function addBBCode($tagName, $replace, $useOption = false, $parseContent = true, $nestLimit = -1)
 {
     $code = new CodeDefinition();
     $code->setTagName($tagName);
     $code->setUseOption($useOption);
     $code->setParseContent($parseContent);
     $code->setNestLimit($nestLimit);
     $code->setReplacementText($replace);
     array_push($this->bbcodes, $code);
 }
Example #3
0
 /**
  * Sets the CodeDefinition that defines this element.
  *
  * @param codeDef the code definition that defines this element node
  */
 public function setCodeDefinition(CodeDefinition $codeDef)
 {
     $this->codeDefinition = $codeDef;
     $this->setTagName($codeDef->getTagName());
 }
 /**
  * Builds a CodeDefinition with the current state of the builder.
  *
  * @return a new CodeDefinition instance
  */
 public function build()
 {
     $definition = CodeDefinition::construct($this->tagName, $this->replacementText, $this->useOption, $this->parseContent, $this->nestLimit, $this->optionValidator, $this->bodyValidator);
     return $definition;
 }