Version: current

      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: Extended.php,v 1.3 2007/07/02 16:54:25 cweiske Exp $
     20 //
     21
     22 /**
     23  * @package  sapphire
     24  * @subpackage misc
     25  * @author   Stijn de Reede  <sjr@gmx.co.uk>
     26  */
     27
     28 /**
     29  */
     30 require_once 'HTML/BBCodeParser/Filter.php';
     31
     32
     33
     34 /**
     35  * @package  sapphire
     36  * @subpackage misc
     37  */
     38 class SSHTMLBBCodeParser_Filter_Extended extends SSHTMLBBCodeParser_Filter
     39 {
     40
     41     /**
     42     * An array of tags parsed by the engine
     43     *
     44     * @access   private
     45     * @var      array
     46     */
     47     var $_definedTags = array(
     48                                 'color' => array( 'htmlopen'  => 'span',
     49                                                 'htmlclose' => 'span',
     50                                                 'allowed'   => 'all',
     51                                                 'attributes'=> array('color' =>'style=%2$scolor:%1$s%2$s')),
     52                                 'size' => array( 'htmlopen'  => 'span',
     53                                                 'htmlclose' => 'span',
     54                                                 'allowed'   => 'all',
     55                                                 'attributes'=> array('size' =>'style=%2$sfont-size:%1$spt%2$s')),
     56                                 'font' => array( 'htmlopen'  => 'span',
     57                                                 'htmlclose' => 'span',
     58                                                 'allowed'   => 'all',
     59                                                 'attributes'=> array('font' =>'style=%2$sfont-family:%1$s%2$s')),
     60                                 'align' => array( 'htmlopen'  => 'div',
     61                                                 'htmlclose' => 'div',
     62                                                 'allowed'   => 'all',
     63                                                 'attributes'=> array('align' =>'style=%2$stext-align:%1$s%2$s')),
     64                                 'quote' => array('htmlopen'  => 'q',
     65                                                 'htmlclose' => 'q',
     66                                                 'allowed'   => 'all',
     67                                                 'attributes'=> array('quote' =>'cite=%2$s%1$s%2$s')),
     68                                 'code' => array('htmlopen'  => 'div class="codesnippet"><p',
     69                                                 'htmlclose' => 'p></div',
     70                                                 'allowed'   => 'all',
     71                                                 'attributes' => array()),
     72                                 'php' => array('htmlopen'  => 'div class="codesnippet"><p',
     73                                                 'htmlclose' => 'p></div',
     74                                                 'allowed'   => 'all',
     75                                                 'attributes' => array()),
     76                                 'h1' => array('htmlopen'  => 'h1',
     77                                                 'htmlclose' => 'h1',
     78                                                 'allowed'   => 'all',
     79                                                 'attributes'=> array()),
     80                                 'h2' => array('htmlopen'  => 'h2',
     81                                                 'htmlclose' => 'h2',
     82                                                 'allowed'   => 'all',
     83                                                 'attributes'=> array()),
     84                                 'h3' => array('htmlopen'  => 'h3',
     85                                                 'htmlclose' => 'h3',
     86                                                 'allowed'   => 'all',
     87                                                 'attributes'=> array()),
     88                                 'h4' => array('htmlopen'  => 'h4',
     89                                                 'htmlclose' => 'h4',
     90                                                 'allowed'   => 'all',
     91                                                 'attributes'=> array()),
     92                                 'h5' => array('htmlopen'  => 'h5',
     93                                                 'htmlclose' => 'h5',
     94                                                 'allowed'   => 'all',
     95                                                 'attributes'=> array()),
     96                                 'h6' => array('htmlopen'  => 'h6',
     97                                                 'htmlclose' => 'h6',
     98                                                 'allowed'   => 'all',
     99                                                 'attributes'=> array())
    100
    101     );
    102
    103     function _preparse() {
    104         $this->_preparsed = str_replace("\t", "&nbsp;&nbsp;&nbsp;", $this->_text);
    105     $this->_preparsed = preg_replace("/(\[php\])\s*/", '$1', $this->_preparsed);
    106     $this->_preparsed = preg_replace("/\s*(\[\/php\])\s/", '$1', $this->_preparsed);
    107     }
    108 }
    109
    110 ?>
    111

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -