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 /* $Id: Filter.class.php 4687 2007-12-09 18:57:18Z voxus $ */ 00012 00018 final class Filter extends StaticFactory 00019 { 00023 public static function textImport() 00024 { 00025 return 00026 FilterChain::create()-> 00027 add(Filter::trim())-> 00028 add(Filter::stripTags()); 00029 } 00030 00034 public static function chain() 00035 { 00036 return new FilterChain(); 00037 } 00038 00042 public static function hash($binary = false) 00043 { 00044 return HashFilter::create($binary); 00045 } 00046 00050 public static function pcre() 00051 { 00052 return PCREFilter::create(); 00053 } 00054 00058 public static function trim() 00059 { 00060 return TrimFilter::create(); 00061 } 00062 00066 public static function crop() 00067 { 00068 return CropFilter::create(); 00069 } 00070 00074 public static function stripTags() 00075 { 00076 return StripTagsFilter::create(); 00077 } 00078 00082 public static function lowerCase() 00083 { 00084 return Singleton::getInstance('LowerCaseFilter'); 00085 } 00086 00090 public static function upperCase() 00091 { 00092 return Singleton::getInstance('UpperCaseFilter'); 00093 } 00094 00098 public static function htmlSpecialChars() 00099 { 00100 return Singleton::getInstance('HtmlSpecialCharsFilter'); 00101 } 00102 00106 public static function nl2br() 00107 { 00108 return Singleton::getInstance('NewLinesToBreaks'); 00109 } 00110 00114 public static function urlencode() 00115 { 00116 return Singleton::getInstance('UrlEncodeFilter'); 00117 } 00118 00122 public static function urldecode() 00123 { 00124 return Singleton::getInstance('UrlDecodeFilter'); 00125 } 00126 00130 public static function uudecode() 00131 { 00132 return Singleton::getInstance('UnixToUnixDecode'); 00133 } 00134 00138 public static function uuencode() 00139 { 00140 return Singleton::getInstance('UnixToUnixEncode'); 00141 } 00142 00146 public static function replaceSymbols($search = null, $replace = null) 00147 { 00148 return StringReplaceFilter::create($search, $replace); 00149 } 00150 00154 public static function safeUtf8() 00155 { 00156 return Singleton::getInstance('SafeUtf8Filter'); 00157 } 00158 } 00159 ?>