Ejemplo n.º 1
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);
 }
 public function __construct()
 {
     $this->tagName = 'file';
     $this->useOption = true;
     parent::__construct();
 }
Ejemplo n.º 3
0
 /**
  * Adds a complex bbcode definition. You may subclass the CodeDefinition class, instantiate a definition of your new
  * class and add it to the parser through this method.
  *
  * @param CodeDefinition $definition the bbcode definition to add
  *
  * @return Parser
  */
 public function addCodeDefinition(CodeDefinition $definition)
 {
     $this->bbcodes[$definition->getTagName()][$definition->usesOption()] = $definition;
     return $this;
 }
Ejemplo n.º 4
0
 public function __construct()
 {
     parent::__construct();
     $this->setTagName('code');
     $this->setParseContent(false);
 }