2 /* vim: set expandtab tabstop=4 shiftwidth=4: */
3 // +----------------------------------------------------------------------+
5 // +----------------------------------------------------------------------+
6 // | Copyright (c) 1997-2003 The PHP Group |
7 // +----------------------------------------------------------------------+
8 // | This source file is subject to version 2.02 of the PHP license, |
9 // | that is bundled with this package in the file LICENSE, and is |
10 // | available at through the world-wide-web at |
11 // | http://www.php.net/license/2_02.txt. |
12 // | If you did not receive a copy of the PHP license and are unable to |
13 // | obtain it through the world-wide-web, please send a note to |
14 // | license@php.net so we can mail you a copy immediately. |
15 // +----------------------------------------------------------------------+
16 // | Author: Stijn de Reede <sjr@gmx.co.uk> |
17 // +----------------------------------------------------------------------+
19 // $Id: Lists.php 6079 2013-06-05 00:45:38Z fishbone $
24 * @package HTML_BBCodeParser2
25 * @author Stijn de Reede <sjr@gmx.co.uk>
27 //require_once 'HTML/BBCodeParser2/Filter.php';
28 require_once $gEnvManager->getLibPath() . '/HTML_BBCodeParser2-0.1.0/BBCodeParser2/Filter.php'; // modified for Magic3 by naoki
33 class HTML_BBCodeParser2_Filter_Lists extends HTML_BBCodeParser2_Filter
37 * An array of tags parsed by the engine
42 var $_definedTags = array( 'list' => array( 'htmlopen' => 'ol',
46 'attributes'=> array('list' => 'style=%2$slist-style-type:%1$s;%2$s')
48 'ulist' => array( 'htmlopen' => 'ul',
52 'attributes'=> array('list' => 'style=%2$slist-style-type:%1$s;%2$s')
54 'li' => array( 'htmlopen' => 'li',
57 'parent' => 'none^ulist,list',
58 'attributes'=> array()
64 * Executes statements before the actual array building starts
66 * This method should be overwritten in a filter if you want to do
67 * something before the parsing process starts. This can be useful to
68 * allow certain short alternative tags which then can be converted into
69 * proper tags with preg_replace() calls.
70 * The main class walks through all the filters and and calls this
71 * method if it exists. The filters should modify their private $_text
77 * @author Stijn de Reede <sjr@gmx.co.uk>, Seth Price <seth@pricepages.org>
81 $options = $this->_options;
82 $o = $options['open'];
83 $c = $options['close'];
84 $oe = $options['open_esc'];
85 $ce = $options['close_esc'];
87 $pattern = array( "!".$oe."\*".$ce."!",
88 "!".$oe."(u?)list=(?-i:A)(\s*[^".$ce."]*)".$ce."!i",
89 "!".$oe."(u?)list=(?-i:a)(\s*[^".$ce."]*)".$ce."!i",
90 "!".$oe."(u?)list=(?-i:I)(\s*[^".$ce."]*)".$ce."!i",
91 "!".$oe."(u?)list=(?-i:i)(\s*[^".$ce."]*)".$ce."!i",
92 "!".$oe."(u?)list=(?-i:1)(\s*[^".$ce."]*)".$ce."!i",
93 "!".$oe."(u?)list([^".$ce."]*)".$ce."!i");
95 $replace = array( $o."li".$c,
96 $o."\$1list=upper-alpha\$2".$c,
97 $o."\$1list=lower-alpha\$2".$c,
98 $o."\$1list=upper-roman\$2".$c,
99 $o."\$1list=lower-roman\$2".$c,
100 $o."\$1list=decimal\$2".$c,
101 $o."\$1list\$2".$c );
103 $this->_preparsed = preg_replace($pattern, $replace, $this->_text);