# Filter.class.php

Go to the documentation of this file.

    00001 <?php
    00002 /***************************************************************************
    00003  *   Copyright (C) 2005-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
    00017     final class Filter extends StaticFactory
    00018     {
    00022         public static function textImport()
    00023         {
    00024             return
    00025                 FilterChain::create()->
    00026                     add(Filter::trim())->
    00027                     add(Filter::stripTags());
    00028         }
    00029
    00033         public static function chain()
    00034         {
    00035             return new FilterChain();
    00036         }
    00037
    00041         public static function hash($binary = false)
    00042         {
    00043             return HashFilter::create($binary);
    00044         }
    00045
    00049         public static function pcre()
    00050         {
    00051             return PCREFilter::create();
    00052         }
    00053
    00057         public static function trim()
    00058         {
    00059             return TrimFilter::create();
    00060         }
    00061
    00065         public static function crop()
    00066         {
    00067             return CropFilter::create();
    00068         }
    00069
    00073         public static function stripTags()
    00074         {
    00075             return StripTagsFilter::create();
    00076         }
    00077
    00081         public static function lowerCase()
    00082         {
    00083             return Singleton::getInstance('LowerCaseFilter');
    00084         }
    00085
    00089         public static function upperCase()
    00090         {
    00091             return Singleton::getInstance('UpperCaseFilter');
    00092         }
    00093
    00097         public static function htmlSpecialChars()
    00098         {
    00099             return Singleton::getInstance('HtmlSpecialCharsFilter');
    00100         }
    00101
    00105         public static function nl2br()
    00106         {
    00107             return Singleton::getInstance('NewLinesToBreaks');
    00108         }
    00109
    00113         public static function urlencode()
    00114         {
    00115             return Singleton::getInstance('UrlEncodeFilter');
    00116         }
    00117
    00121         public static function urldecode()
    00122         {
    00123             return Singleton::getInstance('UrlDecodeFilter');
    00124         }
    00125
    00129         public static function uudecode()
    00130         {
    00131             return Singleton::getInstance('UnixToUnixDecode');
    00132         }
    00133
    00137         public static function uuencode()
    00138         {
    00139             return Singleton::getInstance('UnixToUnixEncode');
    00140         }
    00141
    00145         public static function replaceSymbols($search = null, $replace = null)
    00146         {
    00147             return StringReplaceFilter::create($search, $replace);
    00148         }
    00149
    00153         public static function safeUtf8()
    00154         {
    00155             return Singleton::getInstance('SafeUtf8Filter');
    00156         }
    00157     }
    00158 ?>