HTML_BBCodeParser2
[ class tree: HTML_BBCodeParser2 ] [ index: HTML_BBCodeParser2 ] [ all elements ]

Source for file Lists.php

Documentation is available at Lists.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. // +----------------------------------------------------------------------+
  4. // | PHP Version 5                                                        |
  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$
  20. //
  21.  
  22.  
  23. /**
  24. @package  HTML_BBCodeParser2
  25. @author   Stijn de Reede  <sjr@gmx.co.uk>
  26. */
  27.  
  28. require_once 'HTML/BBCodeParser2/Filter.php';
  29.  
  30. /**
  31.  * 
  32.  */
  33. {
  34.  
  35.     /**
  36.     * An array of tags parsed by the engine
  37.     *
  38.     * @access   private
  39.     * @var      array 
  40.     */
  41.     var $_definedTags = array(  'list'  => array(   'htmlopen'  => 'ol',
  42.                                                     'htmlclose' => 'ol',
  43.                                                     'allowed'   => 'all',
  44.                                                     'child'     => 'none^li',
  45.                                                     'attributes'=> array('list'  => 'style=%2$slist-style-type:%1$s;%2$s')
  46.                                                     ),
  47.                                 'ulist' => array(   'htmlopen'  => 'ul',
  48.                                                     'htmlclose' => 'ul',
  49.                                                     'allowed'   => 'all',
  50.                                                     'child'     => 'none^li',
  51.                                                     'attributes'=> array('list'  => 'style=%2$slist-style-type:%1$s;%2$s')
  52.                                                     ),
  53.                                 'li'    => array(   'htmlopen'  => 'li',
  54.                                                     'htmlclose' => 'li',
  55.                                                     'allowed'   => 'all',
  56.                                                     'parent'    => 'none^ulist,list',
  57.                                                     'attributes'=> array()
  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>, Seth Price <seth@pricepages.org>
  77.     */
  78.     function _preparse()
  79.     {
  80.         $options $this->_options;
  81.         $o $options['open'];
  82.         $c $options['close'];
  83.         $oe $options['open_esc'];
  84.         $ce $options['close_esc'];
  85.         
  86.         $pattern = array(   "!".$oe."\*".$ce."!",
  87.                             "!".$oe."(u?)list=(?-i:A)(\s*[^".$ce."]*)".$ce."!i",
  88.                             "!".$oe."(u?)list=(?-i:a)(\s*[^".$ce."]*)".$ce."!i",
  89.                             "!".$oe."(u?)list=(?-i:I)(\s*[^".$ce."]*)".$ce."!i",
  90.                             "!".$oe."(u?)list=(?-i:i)(\s*[^".$ce."]*)".$ce."!i",
  91.                             "!".$oe."(u?)list=(?-i:1)(\s*[^".$ce."]*)".$ce."!i",
  92.                             "!".$oe."(u?)list([^".$ce."]*)".$ce."!i");
  93.         
  94.         $replace = array(   $o."li".$c,
  95.                             $o."\$1list=upper-alpha\$2".$c,
  96.                             $o."\$1list=lower-alpha\$2".$c,
  97.                             $o."\$1list=upper-roman\$2".$c,
  98.                             $o."\$1list=lower-roman\$2".$c,
  99.                             $o."\$1list=decimal\$2".$c,
  100.                             $o."\$1list\$2".$c );
  101.         
  102.         $this->_preparsed preg_replace($pattern$replace$this->_text);
  103.     }
  104. }

Documentation generated on Sat, 03 Nov 2012 14:30:04 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.