[pLog-svn] r3303 - plog/trunk/class/data
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Sun Apr 30 11:36:13 GMT 2006
Author: jondaley
Date: 2006-04-30 11:36:12 +0000 (Sun, 30 Apr 2006)
New Revision: 3303
Modified:
plog/trunk/class/data/textfilter.class.php
Log:
remove duplicate code, and just call urlize. domainize() should be called for the subdomain/domain part of the string, and urlize is for the path part.
Modified: plog/trunk/class/data/textfilter.class.php
===================================================================
--- plog/trunk/class/data/textfilter.class.php 2006-04-29 19:35:45 UTC (rev 3302)
+++ plog/trunk/class/data/textfilter.class.php 2006-04-30 11:36:12 UTC (rev 3303)
@@ -420,33 +420,17 @@
/**
* Given a string, convert it into something that can be used in the domain part of a URL
- * (it probably doesn't work very
- * well with non iso-8859-X strings) It will remove the following characters:
+ * change spaces and underscores to hyphens - then call our regular urlize function for
+ * the rest.
*
- * ; / ? : @ & = + $ ,
- *
- * It will convert accented characters such as , , , etc to
- * their non-accented counterparts (a, e, i) And
- * any other non-alphanumeric character that hasn't been removed
- * or replaced will be thrown away.
- *
* @param string The string that we wish to convert into something that can be used as a URL
*/
function domainize( $string )
{
- // remove unnecessary spaces and make everything lower case
- $string = preg_replace( "/ +/", " ", strtolower($string) );
-
- // removing a set of reserved characters (rfc2396: ; / ? : @ & = + $ ,)
- $string = str_replace(array(';','/','?',':','@','&','=','+','$',','), '', $string);
-
- // replace some characters to similar ones
- $search = array('_',' ','ä','ö','ü','é','è','à','ç','à','è','ì','ò','ù','á','é','í','ó','ú','ë','ï');
- $replace = array('-','-','a','o','u','e','e','a','c','a','e','i','o','u','a','e','i','o','u','e','i');
+ $search = array('_',' ');
+ $replace = array('-','-');
$string = str_replace($search, $replace, $string);
-
- // and everything that is still left that hasn't been replaced/encoded, throw it away
- $string = preg_replace( '/[^a-z0-9.-]/', '', $string );
+ $string = urlize($string);
$string = trim($string, "-.");
return $string;
More information about the pLog-svn
mailing list