Example #1
0
 /**
  * @see	\wcf\system\SingletonFactory::init()
  */
 protected function init()
 {
     $sourceCodeTags = array();
     foreach (BBCodeCache::getInstance()->getBBCodes() as $bbcode) {
         if ($bbcode->isSourceCode) {
             $sourceCodeTags[] = $bbcode->bbcodeTag;
         }
     }
     if (!empty($sourceCodeTags)) {
         $this->sourceCodeRegEx = implode('|', $sourceCodeTags);
     }
 }
 /**
  * @see	\wcf\system\option\IOptionType::getFormElement()
  */
 public function getFormElement(Option $option, $value)
 {
     $allowedBBCodes = array();
     if ($option->allowedbbcodepermission) {
         $allowedBBCodes = explode(',', WCF::getSession()->getPermission($option->allowedbbcodepermission));
     } else {
         $allowedBBCodes = array_keys(BBCodeCache::getInstance()->getBBCodes());
     }
     BBCodeHandler::getInstance()->setAllowedBBCodes($allowedBBCodes);
     WCF::getTPL()->assign(array('defaultSmilies' => SmileyCache::getInstance()->getCategorySmilies(), 'option' => $option, 'value' => $value));
     return WCF::getTPL()->fetch('messageOptionType');
 }
Example #3
0
 /**
  * Returns true if the given BBCode tag is allowed by the given list of
  * BBCode tags. If the relevant BBCode should be globally disabled or non-
  * existent, false is returned.
  * 
  * @param	string		$bbcodeTag
  * @param	array<string>	$allowedBBCodeTags
  * @return	boolean
  */
 public static function isAllowedBBCode($bbcodeTag, array $allowedBBCodeTags)
 {
     // check if bbcode is unknown or disabled
     if (BBCodeCache::getInstance()->getBBCodeByTag($bbcodeTag) === null) {
         return false;
     }
     // all BBCodes are allowed
     if (in_array('all', $allowedBBCodeTags)) {
         return true;
     }
     // no BBCode are allowed
     if (in_array('none', $allowedBBCodeTags)) {
         return false;
     }
     return in_array($bbcodeTag, $allowedBBCodeTags);
 }
 /**
  * Loads the list of BBCodes for the HTML select element.
  * 
  * @return	array<string>
  */
 protected function loadBBCodeSelection()
 {
     $this->bbCodes = array_keys(BBCodeCache::getInstance()->getBBCodes());
     asort($this->bbCodes);
 }
Example #5
0
 /**
  * Returns a list of known highlighters.
  * 
  * @return	array<string>
  */
 public function getHighlighters()
 {
     return BBCodeCache::getInstance()->getHighlighters();
 }