Skip to content

Commit

Permalink
Rename classes
Browse files Browse the repository at this point in the history
  • Loading branch information
CloCkWeRX committed May 19, 2012
1 parent 5328534 commit 8417705
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 68 deletions.
10 changes: 0 additions & 10 deletions HTML/BBCodeParser/Filter.php

This file was deleted.

30 changes: 15 additions & 15 deletions HTML/BBCodeParser.php → HTML/BBCodeParser2.php
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php <?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */ /* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+
// | PHP Version 4 | // | PHP Version 5 |
// +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group | // | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+
Expand All @@ -20,7 +20,7 @@
// //


/** /**
* @package HTML_BBCodeParser * @package HTML_BBCodeParser2
* @author Stijn de Reede <sjr@gmx.co.uk> * @author Stijn de Reede <sjr@gmx.co.uk>
* *
* *
Expand All @@ -34,21 +34,21 @@
* *
* *
* Usage: * Usage:
* $parser = new HTML_BBCodeParser(); * $parser = new HTML_BBCodeParser2();
* $parser->setText('normal [b]bold[/b] and normal again'); * $parser->setText('normal [b]bold[/b] and normal again');
* $parser->parse(); * $parser->parse();
* echo $parser->getParsed(); * echo $parser->getParsed();
* or: * or:
* $parser = new HTML_BBCodeParser(); * $parser = new HTML_BBCodeParser2();
* echo $parser->qparse('normal [b]bold[/b] and normal again'); * echo $parser->qparse('normal [b]bold[/b] and normal again');
* or: * or:
* echo HTML_BBCodeParser::staticQparse('normal [b]bold[/b] and normal again'); * echo HTML_BBCodeParser2::staticQparse('normal [b]bold[/b] and normal again');
* *
* *
* Setting the options from the ini file: * Setting the options from the ini file:
* $config = parse_ini_file('BBCodeParser.ini', true); * $config = parse_ini_file('BBCodeParser.ini', true);
* $options = &PEAR::getStaticProperty('HTML_BBCodeParser', '_options'); * $options = &PEAR::getStaticProperty('HTML_BBCodeParser2', '_options');
* $options = $config['HTML_BBCodeParser']; * $options = $config['HTML_BBCodeParser2'];
* unset($options); * unset($options);
* *
* *
Expand Down Expand Up @@ -80,7 +80,7 @@
*/ */
require_once 'PEAR.php'; require_once 'PEAR.php';


class HTML_BBCodeParser class HTML_BBCodeParser2
{ {
/** /**
* An array of tags parsed by the engine, should be overwritten by filters * An array of tags parsed by the engine, should be overwritten by filters
Expand Down Expand Up @@ -163,11 +163,11 @@ class HTML_BBCodeParser
* @access public * @access public
* @author Stijn de Reede <sjr@gmx.co.uk> * @author Stijn de Reede <sjr@gmx.co.uk>
*/ */
function HTML_BBCodeParser($options = array()) function __construct($options = array())
{ {
$pear=new PEAR(); $pear=new PEAR();
// set the already set options // set the already set options
$baseoptions = $pear->getStaticProperty('HTML_BBCodeParser', '_options'); $baseoptions = $pear->getStaticProperty('HTML_BBCodeParser2', '_options');
if (is_array($baseoptions)) { if (is_array($baseoptions)) {
foreach ($baseoptions as $k => $v) { foreach ($baseoptions as $k => $v) {
$this->_options[$k] = $v; $this->_options[$k] = $v;
Expand Down Expand Up @@ -197,7 +197,7 @@ function HTML_BBCodeParser($options = array())
unset($baseoptions); unset($baseoptions);


// return if this is a subclass // return if this is a subclass
if (is_subclass_of($this, 'HTML_BBCodeParser_Filter')) { if (is_subclass_of($this, 'HTML_BBCodeParser2_Filter')) {
return; return;
} }


Expand Down Expand Up @@ -227,8 +227,8 @@ function addFilter($filter)
{ {
$filter = ucfirst($filter); $filter = ucfirst($filter);
if (!array_key_exists($filter, $this->_filters)) { if (!array_key_exists($filter, $this->_filters)) {
$class = 'HTML_BBCodeParser_Filter_'.$filter; $class = 'HTML_BBCodeParser2_Filter_'.$filter;
@include_once 'HTML/BBCodeParser/Filter/'.$filter.'.php'; @include_once 'HTML/BBCodeParser2/Filter/'.$filter.'.php';
if (!class_exists($class)) { if (!class_exists($class)) {
PEAR::raiseError("Failed to load filter $filter", null, PEAR_ERROR_DIE); PEAR::raiseError("Failed to load filter $filter", null, PEAR_ERROR_DIE);
} }
Expand Down Expand Up @@ -314,7 +314,7 @@ function _preparse()
$this->_preparsed = $this->_text; $this->_preparsed = $this->_text;


// return if this is a subclass // return if this is a subclass
if (is_subclass_of($this, 'HTML_BBCodeParser')) { if (is_subclass_of($this, 'HTML_BBCodeParser2')) {
return; return;
} }


Expand Down Expand Up @@ -874,7 +874,7 @@ function qparse($str)
*/ */
function staticQparse($str) function staticQparse($str)
{ {
$p = new HTML_BBCodeParser(); $p = new HTML_BBCodeParser2();
$str = $p->qparse($str); $str = $p->qparse($str);
unset($p); unset($p);
return $str; return $str;
Expand Down
9 changes: 9 additions & 0 deletions HTML/BBCodeParser2/Filter.php
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
require_once 'HTML/BBCodeParser2.php';

/**
* Dummy class that filters need to extend from.
*/
class HTML_BBCodeParser2_Filter extends HTML_BBCodeParser2
{
}
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php <?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */ /* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+
// | PHP Version 4 | // | PHP Version 5 |
// +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group | // | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+
Expand All @@ -20,17 +20,17 @@
// //


/** /**
* @package HTML_BBCodeParser * @package HTML_BBCodeParser2
* @author Stijn de Reede <sjr@gmx.co.uk> * @author Stijn de Reede <sjr@gmx.co.uk>
*/ */




require_once 'HTML/BBCodeParser/Filter.php'; require_once 'HTML/BBCodeParser2/Filter.php';








class HTML_BBCodeParser_Filter_Basic extends HTML_BBCodeParser_Filter class HTML_BBCodeParser2_Filter_Basic extends HTML_BBCodeParser2_Filter
{ {


/** /**
Expand Down Expand Up @@ -66,6 +66,3 @@ class HTML_BBCodeParser_Filter_Basic extends HTML_BBCodeParser_Filter
); );


} }


?>
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php <?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */ /* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+
// | PHP Version 4 | // | PHP Version 5 |
// +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group | // | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+
Expand All @@ -20,17 +20,17 @@
// //


/** /**
* @package HTML_BBCodeParser * @package HTML_BBCodeParser2
* @author Stijn de Reede <sjr@gmx.co.uk> * @author Stijn de Reede <sjr@gmx.co.uk>
*/ */




require_once 'HTML/BBCodeParser/Filter.php'; require_once 'HTML/BBCodeParser2/Filter.php';








class HTML_BBCodeParser_Filter_Email extends HTML_BBCodeParser_Filter class HTML_BBCodeParser2_Filter_Email extends HTML_BBCodeParser2_Filter
{ {


/** /**
Expand Down Expand Up @@ -66,8 +66,8 @@ class HTML_BBCodeParser_Filter_Email extends HTML_BBCodeParser_Filter
*/ */
function _preparse() function _preparse()
{ {
$pear=new PEAR(); $pear = new PEAR();
$options = $pear->getStaticProperty('HTML_BBCodeParser','_options'); $options = $pear->getStaticProperty('HTML_BBCodeParser2','_options');
$o = $options['open']; $o = $options['open'];
$c = $options['close']; $c = $options['close'];
$oe = $options['open_esc']; $oe = $options['open_esc'];
Expand All @@ -81,6 +81,3 @@ function _preparse()




} }


?>
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php <?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */ /* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+
// | PHP Version 4 | // | PHP Version 5 |
// +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group | // | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+
Expand All @@ -20,17 +20,17 @@
// //


/** /**
* @package HTML_BBCodeParser * @package HTML_BBCodeParser2
* @author Stijn de Reede <sjr@gmx.co.uk> * @author Stijn de Reede <sjr@gmx.co.uk>
*/ */




require_once 'HTML/BBCodeParser/Filter.php'; require_once 'HTML/BBCodeParser2/Filter.php';








class HTML_BBCodeParser_Filter_Extended extends HTML_BBCodeParser_Filter class HTML_BBCodeParser2_Filter_Extended extends HTML_BBCodeParser2_Filter
{ {


/** /**
Expand Down Expand Up @@ -93,5 +93,3 @@ class HTML_BBCodeParser_Filter_Extended extends HTML_BBCodeParser_Filter




} }

?>
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php <?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */ /* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+
// | PHP Version 4 | // | PHP Version 5 |
// +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group | // | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+
Expand All @@ -23,9 +23,9 @@
* @package HTML_BBCodeParser * @package HTML_BBCodeParser
* @author Stijn de Reede <sjr@gmx.co.uk> * @author Stijn de Reede <sjr@gmx.co.uk>
*/ */
require_once 'HTML/BBCodeParser/Filter.php'; require_once 'HTML/BBCodeParser2/Filter.php';


class HTML_BBCodeParser_Filter_Images extends HTML_BBCodeParser_Filter class HTML_BBCodeParser2_Filter_Images extends HTML_BBCodeParser2_Filter
{ {


/** /**
Expand Down Expand Up @@ -66,7 +66,7 @@ class HTML_BBCodeParser_Filter_Images extends HTML_BBCodeParser_Filter
*/ */
function _preparse() function _preparse()
{ {
$options = PEAR::getStaticProperty('HTML_BBCodeParser','_options'); $options = PEAR::getStaticProperty('HTML_BBCodeParser2','_options');
$o = $options['open']; $o = $options['open'];
$c = $options['close']; $c = $options['close'];
$oe = $options['open_esc']; $oe = $options['open_esc'];
Expand Down
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php <?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */ /* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+
// | PHP Version 4 | // | PHP Version 5 |
// +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group | // | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+
Expand All @@ -20,15 +20,15 @@
// //


/** /**
* @package HTML_BBCodeParser * @package HTML_BBCodeParser2
* @author Stijn de Reede <sjr@gmx.co.uk> * @author Stijn de Reede <sjr@gmx.co.uk>
*/ */
require_once 'HTML/BBCodeParser/Filter.php'; require_once 'HTML/BBCodeParser2/Filter.php';


/** /**
* *
*/ */
class HTML_BBCodeParser_Filter_Links extends HTML_BBCodeParser_Filter class HTML_BBCodeParser2_Filter_Links extends HTML_BBCodeParser2_Filter
{ {
/** /**
* List of allowed schemes * List of allowed schemes
Expand Down Expand Up @@ -82,7 +82,7 @@ class HTML_BBCodeParser_Filter_Links extends HTML_BBCodeParser_Filter
*/ */
function _preparse() function _preparse()
{ {
$options = PEAR::getStaticProperty('HTML_BBCodeParser', '_options'); $options = PEAR::getStaticProperty('HTML_BBCodeParser2', '_options');
$o = $options['open']; $o = $options['open'];
$c = $options['close']; $c = $options['close'];
$oe = $options['open_esc']; $oe = $options['open_esc'];
Expand Down Expand Up @@ -111,7 +111,7 @@ function _preparse()
function smarterPPLinkExpand($matches) function smarterPPLinkExpand($matches)
{ {
//echo '<hr><pre>';var_dump($matches);echo '</pre><hr>'; //echo '<hr><pre>';var_dump($matches);echo '</pre><hr>';
$options = PEAR::getStaticProperty('HTML_BBCodeParser','_options'); $options = PEAR::getStaticProperty('HTML_BBCodeParser2','_options');
$o = $options['open']; $o = $options['open'];
$c = $options['close']; $c = $options['close'];
$oe = $options['open_esc']; $oe = $options['open_esc'];
Expand Down Expand Up @@ -169,7 +169,7 @@ function smarterPPLinkExpand($matches)
*/ */
function smarterPPLink($matches) function smarterPPLink($matches)
{ {
$options = PEAR::getStaticProperty('HTML_BBCodeParser','_options'); $options = PEAR::getStaticProperty('HTML_BBCodeParser2','_options');
$o = $options['open']; $o = $options['open'];
$c = $options['close']; $c = $options['close'];


Expand Down
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php <?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */ /* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+
// | PHP Version 4 | // | PHP Version 5 |
// +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group | // | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+
Expand All @@ -21,16 +21,16 @@




/** /**
* @package HTML_BBCodeParser * @package HTML_BBCodeParser2
* @author Stijn de Reede <sjr@gmx.co.uk> * @author Stijn de Reede <sjr@gmx.co.uk>
*/ */


require_once 'HTML/BBCodeParser/Filter.php'; require_once 'HTML/BBCodeParser2/Filter.php';


/** /**
* *
*/ */
class HTML_BBCodeParser_Filter_Lists extends HTML_BBCodeParser_Filter class HTML_BBCodeParser2_Filter_Lists extends HTML_BBCodeParser2_Filter
{ {


/** /**
Expand Down Expand Up @@ -78,7 +78,7 @@ class HTML_BBCodeParser_Filter_Lists extends HTML_BBCodeParser_Filter
*/ */
function _preparse() function _preparse()
{ {
$options = PEAR::getStaticProperty('HTML_BBCodeParser','_options'); $options = PEAR::getStaticProperty('HTML_BBCodeParser2','_options');
$o = $options['open']; $o = $options['open'];
$c = $options['close']; $c = $options['close'];
$oe = $options['open_esc']; $oe = $options['open_esc'];
Expand All @@ -102,7 +102,4 @@ function _preparse()


$this->_preparsed = preg_replace($pattern, $replace, $this->_text); $this->_preparsed = preg_replace($pattern, $replace, $this->_text);
} }
} }


?>
2 changes: 1 addition & 1 deletion package.xml
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<package packagerversion="1.9.4" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> <package packagerversion="1.9.4" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
<name>HTML_BBCodeParser</name> <name>HTML_BBCodeParser2</name>
<channel>pear.php.net</channel> <channel>pear.php.net</channel>
<summary>This is a parser to replace UBB style tags with their html equivalents.</summary> <summary>This is a parser to replace UBB style tags with their html equivalents.</summary>
<description>This is a parser to replace UBB style tags with their html equivalents. <description>This is a parser to replace UBB style tags with their html equivalents.
Expand Down

0 comments on commit 8417705

Please sign in to comment.