UnTypographizer.class.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************************
00003  *   Copyright (C) 2007 by Konstantin V. Arkhipov                          *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Lesser General Public License as        *
00007  *   published by the Free Software Foundation; either version 3 of the    *
00008  *   License, or (at your option) any later version.                       *
00009  *                                                                         *
00010  ***************************************************************************/
00011 
00015     final class UnTypographizer extends BaseFilter
00016     {
00017         private static $symbols =
00018             array(
00019                 '&nbsp;'    => ' ',
00020                 ' &lt; '    => ' < ',
00021                 ' &gt; '    => ' > ',
00022                 '&#133;'    => '…',
00023                 '&trade;'   => '™',
00024                 '&copy;'    => '©',
00025                 '&#8470;'   => '№',
00026                 '&#151;'    => '—',
00027                 '&mdash;'   => '—',
00028                 '&laquo;'   => '«',
00029                 '&raquo;'   => '»',
00030                 '&bull;'    => '•',
00031                 '&reg;'     => '®',
00032                 '&frac14;'  => '¼',
00033                 '&frac12;'  => '½',
00034                 '&frac34;'  => '¾',
00035                 '&plusmn;'  => '±'
00036             );
00037         
00041         public static function me()
00042         {
00043             return Singleton::getInstance(__CLASS__);
00044         }
00045         
00046         public function apply($value)
00047         {
00048             return strtr($value, self::$symbols);
00049         }
00050     }
00051 ?>