includes/wikiengine/Render/Xhtml/Specialchar.php
changeset 1 fe660c52c48f
equal deleted inserted replaced
0:902822492a68 1:fe660c52c48f
       
     1 <?php
       
     2 // vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
       
     3 /**
       
     4  * Specialchar rule end renderer for Xhtml
       
     5  *
       
     6  * PHP versions 4 and 5
       
     7  *
       
     8  * @category   Text
       
     9  * @package    Text_Wiki
       
    10  * @author     Paul M. Jones <pmjones@php.net>
       
    11  * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
       
    12  * @version    CVS: $Id: Specialchar.php,v 1.2 2005/07/30 08:03:29 toggg Exp $
       
    13  * @link       http://pear.php.net/package/Text_Wiki
       
    14  */
       
    15 
       
    16 /**
       
    17  * This class renders special characters in XHTML.
       
    18  *
       
    19  * @category   Text
       
    20  * @package    Text_Wiki
       
    21  * @author     Paul M. Jones <pmjones@php.net>
       
    22  * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
       
    23  * @version    Release: @package_version@
       
    24  * @link       http://pear.php.net/package/Text_Wiki
       
    25  */
       
    26 class Text_Wiki_Render_Xhtml_SpecialChar extends Text_Wiki_Render {
       
    27 
       
    28     var $types = array('~bs~' => '&#92;',
       
    29                        '~hs~' => '&nbsp;',
       
    30                        '~amp~' => '&amp;',
       
    31                        '~ldq~' => '&ldquo;',
       
    32                        '~rdq~' => '&rdquo;',
       
    33                        '~lsq~' => '&lsquo;',
       
    34                        '~rsq~' => '&rsquo;',
       
    35                        '~c~' => '&copy;',
       
    36                        '~--~' => '&mdash;',
       
    37                        '" -- "' => '&mdash;',
       
    38                        '&quot; -- &quot;' => '&mdash;',
       
    39                        '~lt~' => '&lt;',
       
    40                        '~gt~' => '&gt;');
       
    41 
       
    42     function token($options)
       
    43     {
       
    44         if (isset($this->types[$options['char']])) {
       
    45             return $this->types[$options['char']];
       
    46         } else {
       
    47             return '&#'.substr($options['char'], 1, -1).';';
       
    48         }
       
    49     }
       
    50 }
       
    51 
       
    52 ?>