mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Fixed bbcode class conflict with user's existing pear class install.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.1.0@42517 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
76ffdd4acb
commit
c8ee3933ec
@ -1,4 +1,4 @@
|
||||
[HTML_BBCodeParser]
|
||||
[SSHTMLBBCodeParser]
|
||||
|
||||
; possible values: single|double
|
||||
; use single or double quotes for attributes
|
||||
|
@ -4,8 +4,8 @@
|
||||
require_once('HTML/HTMLBBCodeParser.php');
|
||||
/*Seting up the PEAR bbcode parser*/
|
||||
$config = parse_ini_file('BBCodeParser.ini', true);
|
||||
$options = &HTML_BBCodeParser::getStaticProperty('HTML_BBCodeParser', '_options');
|
||||
$options = $config['HTML_BBCodeParser'];
|
||||
$options = &SSHTMLBBCodeParser::getStaticProperty('SSHTMLBBCodeParser', '_options');
|
||||
$options = $config['SSHTMLBBCodeParser'];
|
||||
//Debug::show($options);
|
||||
unset($options);
|
||||
|
||||
@ -101,7 +101,7 @@ class BBCodeParser extends TextParser {
|
||||
|
||||
function parse() {
|
||||
$this->content = str_replace(array('&', '<', '>'), array('&', '<', '>'), $this->content);
|
||||
$this->content = HTML_BBCodeParser::staticQparse($this->content);
|
||||
$this->content = SSHTMLBBCodeParser::staticQparse($this->content);
|
||||
$this->content = "<p>".$this->content."</p>";
|
||||
$this->content = str_replace("\n\n", "</p><p>", $this->content);
|
||||
$this->content = str_replace("\n", "<br />", $this->content);
|
||||
|
@ -4,7 +4,7 @@ require_once 'HTML/HTMLBBCodeParser.php';
|
||||
/**
|
||||
* Dummy class that filters need to extend from.
|
||||
*/
|
||||
class HTML_BBCodeParser_Filter extends HTML_BBCodeParser
|
||||
class SSHTMLBBCodeParser_Filter extends SSHTMLBBCodeParser
|
||||
{
|
||||
}
|
||||
?>
|
@ -20,7 +20,7 @@
|
||||
//
|
||||
|
||||
/**
|
||||
* @package HTML_BBCodeParser
|
||||
* @package SSHTMLBBCodeParser
|
||||
* @author Stijn de Reede <sjr@gmx.co.uk>
|
||||
*/
|
||||
|
||||
@ -30,7 +30,7 @@ require_once 'HTML/BBCodeParser/Filter.php';
|
||||
|
||||
|
||||
|
||||
class HTML_BBCodeParser_Filter_Basic extends HTML_BBCodeParser_Filter
|
||||
class SSHTMLBBCodeParser_Filter_Basic extends SSHTMLBBCodeParser_Filter
|
||||
{
|
||||
|
||||
/**
|
||||
|
@ -20,7 +20,7 @@
|
||||
//
|
||||
|
||||
/**
|
||||
* @package HTML_BBCodeParser
|
||||
* @package SSHTMLBBCodeParser
|
||||
* @author Stijn de Reede <sjr@gmx.co.uk>
|
||||
*/
|
||||
|
||||
@ -30,7 +30,7 @@ require_once 'HTML/BBCodeParser/Filter.php';
|
||||
|
||||
|
||||
|
||||
class HTML_BBCodeParser_Filter_EmailLinks extends HTML_BBCodeParser_Filter
|
||||
class SSHTMLBBCodeParser_Filter_EmailLinks extends SSHTMLBBCodeParser_Filter
|
||||
{
|
||||
|
||||
/**
|
||||
@ -66,7 +66,7 @@ class HTML_BBCodeParser_Filter_EmailLinks extends HTML_BBCodeParser_Filter
|
||||
*/
|
||||
function _preparse()
|
||||
{
|
||||
$options = HTML_BBCodeParser::getStaticProperty('HTML_BBCodeParser','_options');
|
||||
$options = SSHTMLBBCodeParser::getStaticProperty('SSHTMLBBCodeParser','_options');
|
||||
$o = $options['open'];
|
||||
$c = $options['close'];
|
||||
$oe = $options['open_esc'];
|
||||
|
@ -20,7 +20,7 @@
|
||||
//
|
||||
|
||||
/**
|
||||
* @package HTML_BBCodeParser
|
||||
* @package SSHTMLBBCodeParser
|
||||
* @author Stijn de Reede <sjr@gmx.co.uk>
|
||||
*/
|
||||
|
||||
@ -30,7 +30,7 @@ require_once 'HTML/BBCodeParser/Filter.php';
|
||||
|
||||
|
||||
|
||||
class HTML_BBCodeParser_Filter_Extended extends HTML_BBCodeParser_Filter
|
||||
class SSHTMLBBCodeParser_Filter_Extended extends SSHTMLBBCodeParser_Filter
|
||||
{
|
||||
|
||||
/**
|
||||
|
@ -20,12 +20,12 @@
|
||||
//
|
||||
|
||||
/**
|
||||
* @package HTML_BBCodeParser
|
||||
* @package SSHTMLBBCodeParser
|
||||
* @author Stijn de Reede <sjr@gmx.co.uk>
|
||||
*/
|
||||
require_once 'HTML/BBCodeParser/Filter.php';
|
||||
|
||||
class HTML_BBCodeParser_Filter_Images extends HTML_BBCodeParser_Filter
|
||||
class SSHTMLBBCodeParser_Filter_Images extends SSHTMLBBCodeParser_Filter
|
||||
{
|
||||
|
||||
/**
|
||||
@ -66,7 +66,7 @@ class HTML_BBCodeParser_Filter_Images extends HTML_BBCodeParser_Filter
|
||||
*/
|
||||
function _preparse()
|
||||
{
|
||||
$options = HTML_BBCodeParser::getStaticProperty('HTML_BBCodeParser','_options');
|
||||
$options = SSHTMLBBCodeParser::getStaticProperty('SSHTMLBBCodeParser','_options');
|
||||
$o = $options['open'];
|
||||
$c = $options['close'];
|
||||
$oe = $options['open_esc'];
|
||||
|
@ -20,7 +20,7 @@
|
||||
//
|
||||
|
||||
/**
|
||||
* @package HTML_BBCodeParser
|
||||
* @package SSHTMLBBCodeParser
|
||||
* @author Stijn de Reede <sjr@gmx.co.uk>
|
||||
*/
|
||||
require_once 'HTML/BBCodeParser/Filter.php';
|
||||
@ -28,7 +28,7 @@ require_once 'HTML/BBCodeParser/Filter.php';
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class HTML_BBCodeParser_Filter_Links extends HTML_BBCodeParser_Filter
|
||||
class SSHTMLBBCodeParser_Filter_Links extends SSHTMLBBCodeParser_Filter
|
||||
{
|
||||
/**
|
||||
* List of allowed schemes
|
||||
@ -81,7 +81,7 @@ class HTML_BBCodeParser_Filter_Links extends HTML_BBCodeParser_Filter
|
||||
*/
|
||||
function _preparse()
|
||||
{
|
||||
$options = HTML_BBCodeParser::getStaticProperty('HTML_BBCodeParser', '_options');
|
||||
$options = SSHTMLBBCodeParser::getStaticProperty('SSHTMLBBCodeParser', '_options');
|
||||
$o = $options['open'];
|
||||
$c = $options['close'];
|
||||
$oe = $options['open_esc'];
|
||||
@ -110,7 +110,7 @@ class HTML_BBCodeParser_Filter_Links extends HTML_BBCodeParser_Filter
|
||||
function smarterPPLinkExpand($matches)
|
||||
{
|
||||
//echo '<hr><pre>';var_dump($matches);echo '</pre><hr>';
|
||||
$options = HTML_BBCodeParser::getStaticProperty('HTML_BBCodeParser','_options');
|
||||
$options = SSHTMLBBCodeParser::getStaticProperty('SSHTMLBBCodeParser','_options');
|
||||
$o = $options['open'];
|
||||
$c = $options['close'];
|
||||
|
||||
@ -171,7 +171,7 @@ class HTML_BBCodeParser_Filter_Links extends HTML_BBCodeParser_Filter
|
||||
*/
|
||||
function smarterPPLink($matches)
|
||||
{
|
||||
$options = HTML_BBCodeParser::getStaticProperty('HTML_BBCodeParser','_options');
|
||||
$options = SSHTMLBBCodeParser::getStaticProperty('SSHTMLBBCodeParser','_options');
|
||||
$o = $options['open'];
|
||||
$c = $options['close'];
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
|
||||
/**
|
||||
* @package HTML_BBCodeParser
|
||||
* @package SSHTMLBBCodeParser
|
||||
* @author Stijn de Reede <sjr@gmx.co.uk>
|
||||
*/
|
||||
|
||||
@ -30,7 +30,7 @@ require_once 'HTML/BBCodeParser/Filter.php';
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class HTML_BBCodeParser_Filter_Lists extends HTML_BBCodeParser_Filter
|
||||
class SSHTMLBBCodeParser_Filter_Lists extends SSHTMLBBCodeParser_Filter
|
||||
{
|
||||
|
||||
/**
|
||||
@ -78,7 +78,7 @@ class HTML_BBCodeParser_Filter_Lists extends HTML_BBCodeParser_Filter
|
||||
*/
|
||||
function _preparse()
|
||||
{
|
||||
$options = HTML_BBCodeParser::getStaticProperty('HTML_BBCodeParser','_options');
|
||||
$options = SSHTMLBBCodeParser::getStaticProperty('SSHTMLBBCodeParser','_options');
|
||||
$o = $options['open'];
|
||||
$c = $options['close'];
|
||||
$oe = $options['open_esc'];
|
||||
|
@ -20,7 +20,7 @@
|
||||
//
|
||||
|
||||
/**
|
||||
* @package HTML_BBCodeParser
|
||||
* @package SSHTMLBBCodeParser
|
||||
* @author Stijn de Reede <sjr@gmx.co.uk>
|
||||
*
|
||||
*
|
||||
@ -34,21 +34,21 @@
|
||||
*
|
||||
*
|
||||
* Usage:
|
||||
* $parser = new HTML_BBCodeParser();
|
||||
* $parser = new SSHTMLBBCodeParser();
|
||||
* $parser->setText('normal [b]bold[/b] and normal again');
|
||||
* $parser->parse();
|
||||
* echo $parser->getParsed();
|
||||
* or:
|
||||
* $parser = new HTML_BBCodeParser();
|
||||
* $parser = new SSHTMLBBCodeParser();
|
||||
* echo $parser->qparse('normal [b]bold[/b] and normal again');
|
||||
* or:
|
||||
* echo HTML_BBCodeParser::staticQparse('normal [b]bold[/b] and normal again');
|
||||
* echo SSHTMLBBCodeParser::staticQparse('normal [b]bold[/b] and normal again');
|
||||
*
|
||||
*
|
||||
* Setting the options from the ini file:
|
||||
* $config = parse_ini_file('BBCodeParser.ini', true);
|
||||
* $options = &PEAR::getStaticProperty('HTML_BBCodeParser', '_options');
|
||||
* $options = $config['HTML_BBCodeParser'];
|
||||
* $options = &PEAR::getStaticProperty('SSHTMLBBCodeParser', '_options');
|
||||
* $options = $config['SSHTMLBBCodeParser'];
|
||||
* unset($options);
|
||||
*
|
||||
*
|
||||
@ -81,7 +81,7 @@
|
||||
|
||||
|
||||
|
||||
class HTML_BBCodeParser
|
||||
class SSHTMLBBCodeParser
|
||||
{
|
||||
/**
|
||||
* An array of tags parsed by the engine, should be overwritten by filters
|
||||
@ -164,10 +164,10 @@ class HTML_BBCodeParser
|
||||
* @access public
|
||||
* @author Stijn de Reede <sjr@gmx.co.uk>
|
||||
*/
|
||||
function HTML_BBCodeParser($options = array())
|
||||
function SSHTMLBBCodeParser($options = array())
|
||||
{
|
||||
// set the already set options
|
||||
$baseoptions = &HTML_BBCodeParser::getStaticProperty('HTML_BBCodeParser', '_options');
|
||||
$baseoptions = &SSHTMLBBCodeParser::getStaticProperty('SSHTMLBBCodeParser', '_options');
|
||||
if (is_array($baseoptions)) {
|
||||
foreach ($baseoptions as $k => $v) {
|
||||
$this->_options[$k] = $v;
|
||||
@ -197,7 +197,7 @@ class HTML_BBCodeParser
|
||||
unset($baseoptions);
|
||||
|
||||
// return if this is a subclass
|
||||
if (is_subclass_of($this, 'HTML_BBCodeParser_Filter')) {
|
||||
if (is_subclass_of($this, 'SSHTMLBBCodeParser_Filter')) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -237,20 +237,23 @@ class HTML_BBCodeParser
|
||||
*/
|
||||
function addFilter($filter)
|
||||
{
|
||||
|
||||
$filter = ucfirst($filter);
|
||||
if (!array_key_exists($filter, $this->_filters)) {
|
||||
$class = 'HTML_BBCodeParser_Filter_'.$filter;
|
||||
$class = 'SSHTMLBBCodeParser_Filter_'.$filter;
|
||||
@include_once 'HTML/BBCodeParser/Filter/'.$filter.'.php';
|
||||
if (!class_exists($class)) {
|
||||
|
||||
|
||||
//PEAR::raiseError("Failed to load filter $filter", null, PEAR_ERROR_DIE);
|
||||
}
|
||||
|
||||
$this->_filters[$filter] = new $class;
|
||||
$this->_definedTags = array_merge(
|
||||
$this->_definedTags,
|
||||
$this->_filters[$filter]->_definedTags
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -327,7 +330,7 @@ class HTML_BBCodeParser
|
||||
$this->_preparsed = $this->_text;
|
||||
|
||||
// return if this is a subclass
|
||||
if (is_subclass_of($this, 'HTML_BBCodeParser')) {
|
||||
if (is_subclass_of($this, 'SSHTMLBBCodeParser')) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -887,7 +890,7 @@ class HTML_BBCodeParser
|
||||
*/
|
||||
function staticQparse($str)
|
||||
{
|
||||
$p = new HTML_BBCodeParser();
|
||||
$p = new SSHTMLBBCodeParser();
|
||||
$str = $p->qparse($str);
|
||||
unset($p);
|
||||
return $str;
|
||||
|
Loading…
Reference in New Issue
Block a user