/** * Create new BBCode object and initialize our own settings * * @param string $text */ public function __construct($text = null) { parent::BBCode(); $this->text = $text; // Automagically print hrefs $this->SetDetectURLs(true); // We have our own smileys $config = Kohana::$config->load('site.smiley'); if (!empty($config)) { $this->ClearSmileys(); $this->SetSmileyURL(URL::base() . $config['dir']); foreach ($config['smileys'] as $name => $smiley) { $this->AddSmiley($name, $smiley['src']); } } else { $this->SetEnableSmileys(false); } // We handle newlines with Kohana //$this->SetIgnoreNewlines(true); $this->SetPreTrim('a'); $this->SetPostTrim('a'); // User our own quote $this->AddRule('quote', array('mode' => BBCODE_MODE_CALLBACK, 'method' => array($this, 'bbcode_quote'), 'class' => 'block', 'allow_in' => array('listitem', 'block', 'columns'), 'content' => BBCODE_REQUIRED)); // Media tags $this->AddRule('audio', array('mode' => BBCODE_MODE_CALLBACK, 'method' => array($this, 'bbcode_media'), 'class' => 'block', 'allow_in' => array('listitem', 'block', 'columns', 'inline'), 'allow' => array('align' => '/^left|center|right$/'), 'default' => array('align' => 'left'), 'content' => BBCODE_REQUIRED, 'plain_content' => array(''))); $this->AddRule('video', array('mode' => BBCODE_MODE_CALLBACK, 'method' => array($this, 'bbcode_media'), 'class' => 'block', 'allow_in' => array('listitem', 'block', 'columns', 'inline'), 'allow' => array('align' => '/^left|center|right$/'), 'default' => array('align' => 'left'), 'content' => BBCODE_REQUIRED, 'plain_content' => array(''))); }
/** * Create new BBCode object and initialize our own settings * */ public function __construct($text = null) { parent::BBCode(); $this->text = $text; // Automagically print hrefs $this->SetDetectURLs(true); // We have our own smileys $config = Kohana::config('site.smiley'); if (!empty($config)) { $this->ClearSmileys(); $this->SetSmileyURL(url::base() . $config['dir']); foreach ($config['smileys'] as $name => $smiley) { $this->AddSmiley($name, $smiley['src']); } } else { $this->SetEnableSmileys(false); } // We handle newlines with Kohana $this->SetIgnoreNewlines(true); $this->SetPreTrim('a'); $this->SetPostTrim('a'); // User our own quote $this->AddRule('quote', array('mode' => BBCODE_MODE_CALLBACK, 'method' => array($this, 'bbcode_quote'), 'class' => 'block', 'allow_in' => array('listitem', 'block', 'columns'), 'content' => BBCODE_REQUIRED)); }