Example #1
0
 /**
  * Gets the list of valid BB code tags. This removes most behaviors.
  *
  * @see XenForo_BbCode_Formatter_Base::getTags()
  */
 public function getTags()
 {
     if ($this->_tags !== null) {
         return $this->_tags;
     }
     if (is_array($this->_generalTagCallback) && $this->_generalTagCallback[0] == '$this') {
         $this->_generalTagCallback[0] = $this;
     }
     $tags = parent::getTags();
     foreach ($tags as $tagName => &$tag) {
         unset($tag['replace'], $tag['callback'], $tag['trimLeadingLinesAfter']);
         if (!empty($this->_overrideCallbacks[$tagName])) {
             $override = $this->_overrideCallbacks[$tagName];
             if (is_array($override) && $override[0] == '$this') {
                 $override[0] = $this;
             }
             $tag['callback'] = $override;
         } else {
             if ($this->_generalTagCallback) {
                 $tag['callback'] = $this->_generalTagCallback;
             }
         }
     }
     return $tags;
 }
Example #2
0
 public function getTags()
 {
     $tags = parent::getTags();
     $tags['img']['callback'] = array($this, 'handleImgTag');
     $tags['quote']['callback'] = array($this, 'handleQuoteTag');
     $tags['tex']['callback'] = array($this, 'handleTexTag');
     return $tags;
 }
Example #3
0
 public function getTags()
 {
     $tags = parent::getTags();
     if (isset($tags['media'])) {
         $tags['media']['trimLeadingLinesAfter'] = 1;
     }
     return $tags;
 }
Example #4
0
 public function getTags()
 {
     $tags = parent::getTags();
     foreach ($tags as $tagName => $tagOption) {
         if (isset($this->_usableTags[$tagName])) {
             continue;
         }
         unset($tags[$tagName]);
     }
     return $tags;
 }
Example #5
0
 public function getTags()
 {
     if ($this->_tags !== null) {
         return $this->_tags;
     }
     $tags = parent::getTags();
     foreach ($tags as $tagName => &$tag) {
         if ($this->displayableTags === false || is_array($this->displayableTags) && !in_array($tagName, $this->displayableTags)) {
             unset($tags[$tagName]);
         }
     }
     return $tags;
 }
Example #6
0
 /**
  * Gets the list of valid BB code tags. This removes most behaviors.
  *
  * @see XenForo_BbCode_Formatter_Base::getTags()
  */
 public function getTags()
 {
     if ($this->_tags !== null) {
         return $this->_tags;
     }
     $callback = array($this, 'handleTag');
     $tags = parent::getTags();
     foreach ($tags as $tagName => &$tag) {
         unset($tag['replace'], $tag['callback']);
         $tag['callback'] = $callback;
     }
     return $tags;
 }
Example #7
0
 /**
  * Gets the list of valid BB code tags. This removes most behaviors.
  *
  * @see XenForo_BbCode_Formatter_Base::getTags()
  */
 public function getTags()
 {
     if ($this->_tags !== null) {
         return $this->_tags;
     }
     if (is_array($this->_generalTagCallback) && $this->_generalTagCallback[0] == '$this') {
         $this->_generalTagCallback[0] = $this;
     }
     $tags = parent::getTags();
     foreach ($tags as $tagName => &$tag) {
         $tag = $this->_filterTagDefinition($tagName, $tag);
     }
     return $tags;
 }
Example #8
0
 public function getTags()
 {
     if ($this->_tags !== null) {
         return $this->_tags;
     }
     $tags = parent::getTags();
     foreach ($tags as $tagName => &$tag) {
         $tag['isBlock'] = !empty($tag['trimLeadingLinesAfter']);
         if (in_array($tagName, $this->_undisplayableTags)) {
             $tag['callback'] = array($this, 'renderTagUndisplayable');
             unset($tag['trimLeadingLinesAfter'], $tag['stopLineBreakConversion']);
         } else {
             if (isset($this->_stateMap[$tagName])) {
                 $tag['state'] = $this->_stateMap[$tagName];
                 $tag['callback'] = array($this, 'renderTagWithState');
                 unset($tag['stopLineBreakConversion']);
             }
         }
     }
     return $tags;
 }
Example #9
0
 public function getTags()
 {
     if ($this->_tags !== null) {
         return $this->_tags;
     }
     $tags = parent::getTags();
     foreach ($tags as $tagName => &$tag) {
         if (in_array($tagName, $this->_undisplayableTags)) {
             $tag['callback'] = array($this, 'renderTagUndisplayable');
             unset($tag['trimLeadingLinesAfter'], $tag['stopLineBreakConversion']);
         } else {
             if (isset($this->_tagReplacements[$tagName])) {
                 $tag = array_merge($tag, $this->_tagReplacements[$tagName]);
                 if (isset($this->_tagReplacements['replace'])) {
                     unset($tag['callback']);
                 }
             }
         }
     }
     return $tags;
 }
Example #10
0
 /**
  * Constructor.
  *
  * @param XenForo_BbCode_Formatter_Base $formatter Formatting rules.
  */
 public function __construct(XenForo_BbCode_Formatter_Base $formatter)
 {
     $this->_formatter = $formatter;
     $this->_tagList = $formatter->getTags();
 }