3 namespace wcf\system\bbcode
;
5 use wcf\data\page\Page
;
6 use wcf\system\message\embedded\
object\MessageEmbeddedObjectManager
;
7 use wcf\util\StringUtil
;
10 * Parses the [wsp] bbcode tag.
12 * @author Alexander Ebert
13 * @copyright 2001-2019 WoltLab GmbH
14 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
15 * @package WoltLabSuite\Core\System\Bbcode
18 class WoltLabSuitePageBBCode
extends AbstractBBCode
23 public function getParsedTag(array $openingTag, $content, array $closingTag, BBCodeParser
$parser)
25 $pageID = (!empty($openingTag['attributes'][0])) ? \
intval($openingTag['attributes'][0]) : 0;
30 $title = (!empty($openingTag['attributes'][1])) ? StringUtil
::trim($openingTag['attributes'][1]) : '';
32 /** @var Page $page */
33 $page = MessageEmbeddedObjectManager
::getInstance()->getObject('com.woltlab.wcf.page', $pageID);
35 return StringUtil
::getAnchorTag($page->getLink(), $title ?
: $page->getTitle());