public function renderTagWiki(array $tag, array $rendererStates)
{
$text = $this->renderSubTree($tag['children'], $rendererStates);
if ($page = XenForo_Model::create('EWRcarta_Model_Pages')->getPageBySlug($text))
{
$page = XenForo_Model::create('EWRcarta_Model_Pages')->renderPage($page);
return '<div class="wiki">'.$page['HTML'].'</div>';
}
else
{
return false;
}
}
<?php
class EWRcarta_BbCode_Formatter extends XFCP_EWRcarta_BbCode_Formatter
{
protected $_tags;
public function getTags()
{
$this->_tags = parent::getTags();
$this->_tags['h2'] = array('hasOption' => false, 'replace' => array('<h2>', '</h2>'), 'trimLeadingLinesAfter' => 1);
$this->_tags['h3'] = array('hasOption' => false, 'replace' => array('<h3>', '</h3>'), 'trimLeadingLinesAfter' => 1);
$this->_tags['h4'] = array('hasOption' => false, 'replace' => array('<h4>', '</h4>'), 'trimLeadingLinesAfter' => 1);
$this->_tags['h5'] = array('hasOption' => false, 'replace' => array('<h5>', '</h5>'), 'trimLeadingLinesAfter' => 1);
$this->_tags['h6'] = array('hasOption' => false, 'replace' => array('<h6>', '</h6>'), 'trimLeadingLinesAfter' => 1);
$this->_tags['wiki'] = array(
'hasOption' => false,
'trimLeadingLinesAfter' => 1,
'callback' => array($this, 'renderTagWiki')
);
return $this->_tags;
}
public function renderTagWiki(array $tag, array $rendererStates)
{
$text = $this->renderSubTree($tag['children'], $rendererStates);
if ($page = XenForo_Model::create('EWRcarta_Model_Pages')->getPageBySlug($text))
{
if ($this->_view)
{
$page = XenForo_Model::create('EWRcarta_Model_Pages')->renderPage($page);
$template = $this->_view->createTemplateObject('EWRcarta_BBcode', array('page' => $page));
return $template->render();
}
else
{
return '<div>Wiki:<pre><a href="'.XenForo_Link::buildPublicLink('full:wiki', $page).'">' . $page['page_name'] . '</a></pre></div>';
}
}
else
{
return '[wiki]'.$text.'[/wiki]';
}
}
}
IF media exists (checked through model)
IF view exists
render template view (view property must exist)
ELSE
render text view (just basic text)
ELSE
render input (original text)
Auto-linking happens before posts are saved, in XenForo_ControllerPublic_Post::actionSave().No the autolinking happens (iirc) before parsing of my bbcode.
I'll have to keep this in mind for t he next version of BBCM.Auto-linking happens before posts are saved, in XenForo_ControllerPublic_Post::actionSave().
To disable autolinking, it looks like you can hook into the load_class_bb_code code event to extend XenForo_BbCode_Formatter_BbCode_AutoLink, and add tag names to $this->_disableAutoLink.
[wiki]Arthur[FONT=Georgia][/wiki][/FONT]
Fatal error: Class 'XenBBCode_BbCode_Formatter_Base' not found in /<mypath>/library/XenForo/Application.php(514) : eval()'d code on line 1
We use essential cookies to make this site work, and optional cookies to enhance your experience.