home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / Lists.php < prev    next >
Encoding:
PHP Script  |  2004-03-24  |  4.0 KB  |  97 lines

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. // +----------------------------------------------------------------------+
  4. // | PHP Version 4                                                        |
  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. // +----------------------------------------------------------------------+
  18. //
  19. // $Id: Lists.php,v 1.3 2003/07/24 21:04:28 sjr Exp $
  20. //
  21.  
  22.  
  23. /**
  24. * @package  HTML_BBCodeParser
  25. * @author   Stijn de Reede  <sjr@gmx.co.uk>
  26. */
  27.  
  28.  
  29. require_once('HTML/BBCodeParser.php');
  30.  
  31.  
  32.  
  33.  
  34. class HTML_BBCodeParser_Filter_Lists extends HTML_BBCodeParser
  35. {
  36.  
  37.     /**
  38.     * An array of tags parsed by the engine
  39.     *
  40.     * @access   private
  41.     * @var      array
  42.     */
  43.     var $_definedTags = array(  'list'  => array(   'htmlopen'  => 'ol',
  44.                                                     'htmlclose' => 'ol',
  45.                                                     'allowed'   => 'none^li',
  46.                                                     'attributes'=> array(   'list'  => 'type=%2$s%1$s%2$s',
  47.                                                                             's'     => 'start=%2$s%1$d%2$s')
  48.                                                     ),
  49.                                 'ulist' => array(   'htmlopen'  => 'ul',
  50.                                                     'htmlclose' => 'ul',
  51.                                                     'allowed'   => 'none^li',
  52.                                                     'attributes'=> array()
  53.                                                     ),
  54.                                 'li'    => array(   'htmlopen'  => 'li',
  55.                                                     'htmlclose' => 'li',
  56.                                                     'allowed'   => 'all',
  57.                                                     'attributes'=> array(   'li'    => 'value=%2$s%1$d%2$s')
  58.                                                     )
  59.                                 );
  60.  
  61.  
  62.     /**
  63.     * Executes statements before the actual array building starts
  64.     *
  65.     * This method should be overwritten in a filter if you want to do
  66.     * something before the parsing process starts. This can be useful to
  67.     * allow certain short alternative tags which then can be converted into
  68.     * proper tags with preg_replace() calls.
  69.     * The main class walks through all the filters and and calls this
  70.     * method if it exists. The filters should modify their private $_text
  71.     * variable.
  72.     *
  73.     * @return   none
  74.     * @access   private
  75.     * @see      $_text
  76.     * @author   Stijn de Reede  <sjr@gmx.co.uk>
  77.     */
  78.     function _preparse()
  79.     {
  80.         $options = PEAR::getStaticProperty('HTML_BBCodeParser','_options');
  81.         $o = $options['open'];
  82.         $c = $options['close'];
  83.         $oe = $options['open_esc'];
  84.         $ce = $options['close_esc'];
  85.         $pattern = array(   "!".$oe."\*".$ce."(.*)!i",
  86.                             "!".$oe."list".$ce."(.+)".$oe."/list".$ce."!isU");
  87.         $replace = array(   $o."li".$c."\\1".$o."/li".$c,
  88.                             $o."ulist".$c."\\1".$o."/ulist".$c);
  89.         $this->_preparsed = preg_replace($pattern, $replace, $this->_text);
  90.     }
  91.  
  92.  
  93. }
  94.  
  95.  
  96. ?>
  97.