protected function init() { parent::init(); // call easter egg. ;) TeraliosUtil::easterEgg(16); }
/** * @see \wcf\system\bbcode\IBBCode::getParsedTag() */ public function getParsedTag(array $openingTag, $content, array $closingTag, BBCodeParser $parser) { // copyright counter. TeraliosBBCodesCopyright::callCopyright(); TeraliosUtil::easterEgg(16); // map attributes $this->mapAttributes($openingTag); // assign values $title = $this->title; $position = $this->position; $points = array(); // build array $content = str_replace('[.]', '[*]', $content); if (preg_match(self::SPLIT_PATTERN, $content)) { // split on [+] [-] or [*] $elements = array(); $elements = preg_split(self::SPLIT_PATTERN, $content, -1, PREG_SPLIT_DELIM_CAPTURE); // remove first element. unset($elements[0]); // build array for points. if (!empty($elements)) { $i = 1; $count = count($elements); while ($i < $count) { $sign = $elements[$i]; $value = StringUtil::trim($elements[$i + 1]); // check value, when is not empty, add. if (!empty($value) && $value != '<br />') { if (!isset($points[$sign])) { $points[$sign] = array(); } $points[$sign][] = $value; } // current index + 2 $i = $i + 2; } } } // output if (empty($points)) { return '[procontra]' . $content . '[/procontra]'; } else { if ($parser->getOutputType() == 'text/html') { // assign variables WCF::getTPL()->assign(array('pcTitle' => $title, 'pcPoints' => $points, 'pcPosition' => $position)); return WCF::getTPL()->fetch('proContraBBCodeTag'); } else { if ($parser->getOutputType() == 'text/simplified-html') { // no supports simplified html. $return = $title . '<br />'; $return .= str_repeat('-', mb_strlen($title)) . '<br />'; foreach ($points as $sign => $values) { $length = count($values); if ($length > 0) { $length--; for ($i = 0; $i <= $length; $i++) { $return .= $sign . ' ' . $values[$i] . '<br />'; } } } return $return; } } } }