/** * @see \wcf\system\bbcode\IBBCode::getParsedTag() */ public function getParsedTag(array $openingTag, $content, array $closingTag, BBCodeParser $parser) { // copyright TeraliosBBCodesCopyright::callCopyright(); $content = StringUtil::trim($content); // check controller for parsing foot notes. if (static::$parse == null) { static::parseFootnotes(); } // footnote and fn parse. if ($openingTag['name'] == 'fn') { if (self::$parse == true) { // no content and no index for content tag: drop footnote. $content = StringUtil::trim($content); if (empty($content) && !isset($openingTag['attributes'][0])) { return ''; } // build hash from content or use index for content attribute $hash = !empty($content) ? StringUtil::getHash($content) : StringUtil::getHash($openingTag['attributes'][0]); // check footnotes for existing. if (!isset(static::$footnotes[$hash])) { // check for buffred content. if (empty($content) && isset(static::$footnoteContent[$hash])) { $content = static::$footnoteContent[$hash]; } $footnoteIndex = FootnoteMap::getInstance()->add($content, Footnote::TYPE_BBCODE); static::$footnotes[$hash] = $footnoteIndex; } else { $footnoteIndex = static::$footnotes[$hash]; } // get index for tag attribute. $footnoteTagIndex = Footnote::getTagIndex($footnoteIndex); } else { $footnoteTagIndex = ''; $footnoteIndex = static::$indexNoParse; ++static::$indexNoParse; } WCF::getTPL()->assign(array('footnoteTagID' => $footnoteTagIndex, 'footnoteIndex' => $footnoteIndex)); return WCF::getTPL()->fetch('footnoteBBCode'); } else { if ($openingTag['name'] == 'fnc') { if (static::$parse == false) { return ''; } $contentIndex = StringUtil::getHash($openingTag['attributes'][0]); // set content or buffered. if (isset(static::$footnotes[$contentIndex])) { $index = static::$footnotes[$contentIndex]; $footnote = FootnoteMap::getInstance()->getFootnote($index); if ($footnote != false) { $footnote->setText(StringUtil::trim($content), Footnote::TYPE_HTML); } } else { static::$footnoteContent[$contentIndex] = $content; } return ''; } } }
/** * @see \wcf\system\bbcode\IBBCode::getParsedTag() */ public function getParsedTag(array $openingTag, $content, array $closingTag, BBCodeParser $parser) { // copyright TeraliosBBCodesCopyright::callCopyright(); $content = StringUtil::trim($content); if (!empty($content) || mb_strpos($content, '[.]') !== false && mb_strpos($content, '[:]') !== false) { $content = str_replace('[.]', '[*]', $content); // build main list elements $listElements = preg_split('#\\[\\*\\]#', $content, -1, PREG_SPLIT_NO_EMPTY); foreach ($listElements as $key => $val) { $val = StringUtil::trim($val); if (empty($val) || $val == '<br />') { unset($listElements[$key]); } else { $listElements[$key] = $val; } } // build list if (!empty($listElements)) { $listContent = ''; foreach ($listElements as $point) { if (mb_substr_count($point, '[:]') == 1) { // reset key and value. $key = $value = ''; // split list element on [:] in key and definition of key. list($key, $value) = preg_split('#\\[:\\]#', $point, -1); $key = StringUtil::trim($key); $value = StringUtil::trim($value); if (empty($value)) { $value = WCF::getLanguage()->get('wcf.bbcode.dlist.noDefinition'); } // key is not empty. if (!empty($key)) { if ($parser->getOutputType() == 'text/html') { $listContent .= '<dt>' . $key . '</dt><dd>' . $value . '</dd>'; } else { if ($parser->getOutputType() == 'text/simplified-html') { $listContent .= '*' . $key . ': ' . $value . "\n"; } } } } } if (!empty($listContent)) { if ($parser->getOutputType() == 'text/html') { return '<dl class="dlistBBCode">' . $listContent . '</dl><span></span>'; } else { if ($parser->getOutputType() == 'text/simplified-html') { return $listContent; } } } } } return '[dlist]' . $content . '[/dlist]'; }
public function getParsedTag(array $openingTag, $content, array $closingTag, BBCodeParser $parser) { // copyright TeraliosBBCodesCopyright::callCopyright(); // first attribut is icon! $icon = isset($openingTag['attributes'][0]) ? StringUtil::trim($openingTag['attributes'][0]) : 'fa-rebel'; // Yes, Rebel icon as default icon! ;) if (substr($icon, 0, 3) != 'fa-') { $icon = 'fa-' . $icon; } // map attributes $this->mapAttributes(ArrayUtil::trim($openingTag['attributes'])); return '<span class="icon' . ($this->size > 0 ? ' icon' . $this->size : '') . ' ' . $icon . ($this->float != 'none' ? ' iconBB' . ucfirst($this->float) : '') . ' iconBBCode"></span>'; }
/** * @see \wcf\system\bbcode\IBBCode::getParsedTag() */ public function getParsedTag(array $openingTag, $content, array $closingTag, BBCodeParser $parser) { // copyright TeraliosBBCodesCopyright::callCopyright(); $tag = mb_strtolower($openingTag['name']); // heading and subheading tag html. if ($parser->getOutputType() == 'text/html') { // map attributes $this->mapAttributes($openingTag); // assign attributes $anchor = $this->anchor; $noIndex = $this->noIndex; // check anchor and set automark if (BBCODES_HEADLINE_AUTOMARK == 1 && empty($anchor)) { $anchor = substr(md5($content), 0, 10); } else { if (empty($anchor)) { $anchor = ''; } } // check anchor if (!empty($anchor)) { $anchor = sprintf(static::$anchorPrefix, static::anchorExists($anchor, $anchor)); if ($noIndex != true) { $anchor = Directory::getInstance()->addEntry($anchor, StringUtil::decodeHTML($content), $tag == 'h1' ? true : false); } else { $anchor = new Entry($anchor, StringUtil::decodeHTML($content)); } } // assign to template WCF::getTPL()->assign(array('hsTag' => $tag, 'hsEntry' => $anchor, 'hsHeading' => $content, 'hsLinkTitle' => StringUtil::stripHTML($content))); return WCF::getTPL()->fetch('headingBBCode'); } else { if ($parser->getOutputType('text/simplified-html')) { switch ($tag) { case 'h1': $return = '--- ' . $content . ' ---<br />'; break; default: $return = '-- ' . $content . ' --<br />'; break; } return $return; } } }
/** * @see \wcf\system\bbcode\IBBCode::getParsedTag() */ public function getParsedTag(array $openingTag, $content, array $closingTag, BBCodeParser $parser) { //copyright TeraliosBBCodesCopyright::callCopyright(); // map attributes $this->mapAttributes($openingTag); // assign vattributes $title = $this->title; $position = $this->position; $size = $this->size; // size settings. if ($size <= 0 && ($position == 'left' || $position == 'right')) { $size = 2; } else { if ($size >= 4) { $size = 0; $position = 'none'; } } // parse box with out HTML if ($parser->getOutputType() == 'text/simplified-html') { if (!empty($title)) { $return = '<br />----( ' . $title . ' )----<br />'; } else { $return = '<br />--------<br />'; } $return .= $content; $return .= '<br />--------<br />'; return $return; } else { if ($parser->getOutputType() == 'text/html') { WCF::getTPL()->assign(array('boxTitle' => $title, 'boxPosition' => $position, 'boxSize' => $size, 'boxContent' => $content)); return WCF::getTPL()->fetch('contentBoxBBCode', 'wcf'); } } }
/** * Return true if jump marks exists. * * @return boolean */ public function hasEntries() { TeraliosBBCodesCopyright::callCopyright(); return $this->count() > 0 ? true : false; }
/** * @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; } } } }
/** * @see \wcf\system\bbcode\IBBCode::getParsedTag() */ public function getParsedTag(array $openingTag, $content, array $closingTag, BBCodeParser $parser) { // call copyright TeraliosBBCodesCopyright::callCopyright(); // default values $attachmentID = 0; $float = 'none'; $type = 'default'; $link = ''; $text = ''; $isImage = false; // parameter values $attachmentID = isset($openingTag['attributes'][0]) ? intval($openingTag['attributes'][0]) : 0; $float = isset($openingTag['attributes'][1]) ? mb_strtolower($openingTag['attributes'][1]) : 'none'; switch ($float) { case 'left': case 'right': case 'none': break; default: $float = 'none'; } $text = StringUtil::trim($content); $title = WCF::getLanguage()->getDynamicVariable('wcf.bbcode.xattach.title', array('xaID' => $attachmentID)); // get attachment $attachment = MessageEmbeddedObjectManager::getInstance()->getObject('de.teralios.bbcodes.attachment', $attachmentID); if ($attachment === null) { if (static::$attachmentList !== null) { $attachments = static::$attachmentList->getGroupedObjects(static::$objectID); if (isset($attachments[$attachmentID])) { $attachment = $attachments[$attachmentID]; $attachment->markAsEmbedded(); } } } // Attachment if ($attachment !== null) { $title = !empty($attachment->filename) ? WCF::getLanguage()->getDynamicVariable('wcf.bbcode.xattach.title.full', array('xaFilename' => $attachment->filename, 'xaDownloads' => $attachment->downloads)) : $title; $linkParameters = array('object' => $attachment); // can view image if ($attachment->showAsImage() && $attachment->canViewPreview()) { if ($attachment->hasThumbnail()) { $linkParameters['thumbnail'] = 1; } $isImage = true; $link = '<img src="' . StringUtil::encodeHTML(LinkHandler::getInstance()->getLink('Attachment', $linkParameters)) . '"' . (!$attachment->hasThumbnail() ? ' class="embeddedAttachmentLink jsResizeImage"' : '') . ' style="width: ' . ($attachment->hasThumbnail() ? $attachment->thumbnailWidth : $attachment->width) . 'px; height: ' . ($attachment->hasThumbnail() ? $attachment->thumbnailHeight : $attachment->height) . 'px" alt="" />'; if ($attachment->hasThumbnail() && $attachment->canDownload()) { $link = '<a href="' . StringUtil::encodeHTML(LinkHandler::getInstance()->getLink('Attachment', array('object' => $attachment))) . '" title="' . $title . '" class="embeddedAttachmentLink jsImageViewer">' . $link . '</a>'; } } else { if ($attachment->showAsImage()) { $link = StringUtil::encodeHTML(LinkHandler::getInstance()->getLink('Attachment', array('object' => $attachment))); $type = 'image'; } else { $link = StringUtil::encodeHTML(LinkHandler::getInstance()->getLink('Attachment', array('object' => $attachment))); $type = self::getType($attachment); } } } else { $link = StringUtil::encodeHTML(LinkHandler::getInstance()->getLink('Attachment', array('id' => $attachmentID))); } if ($parser->getOutputType() == 'text/html') { WCF::getTPL()->assign(array('xaLink' => $link, 'xaTitle' => $title, 'xaIcon' => self::choseIcon($type), 'xaIsImage' => $isImage, 'xaText' => $text, 'xaFloat' => $float, 'xaNoBorder' => BBCODES_XATTACH_FREESTYLE)); $result = WCF::getTPL()->fetch('xAttachBBCode'); } else { $result = StringUtil::getAnchorTag($link, $title) . (!empty($text) ? ' (' . $text . ')' : ''); } return $result; }