[pLog-svn] r2630 - plog/trunk/class/data

oscar at devel.lifetype.net oscar at devel.lifetype.net
Thu Nov 24 21:04:57 GMT 2005


Author: oscar
Date: 2005-11-24 21:04:56 +0000 (Thu, 24 Nov 2005)
New Revision: 2630

Modified:
   plog/trunk/class/data/textfilter.class.php
Log:
Added support for configurable character to be used instead of '_' when generating permalinks and host names when subdomains are enabled. By default and if empty, the character used will be '_'. This is for all the people who wanted to use '-' :)

Modified: plog/trunk/class/data/textfilter.class.php
===================================================================
--- plog/trunk/class/data/textfilter.class.php	2005-11-24 20:35:56 UTC (rev 2629)
+++ plog/trunk/class/data/textfilter.class.php	2005-11-24 21:04:56 UTC (rev 2630)
@@ -10,6 +10,12 @@
 	
 	include_once( PLOG_CLASS_PATH."class/config/config.class.php" );
 	include_once( PLOG_CLASS_PATH."class/data/stringutils.class.php" );
+	
+	/**
+	 * default character used as the word separator, instead of blank spaces
+	 * when creating permalinks and blog names (for subdomains)
+	 */
+	define( 'URLIZE_WORD_SEPARATOR_DEFAULT', '_' ); 
 
     /**
      * \ingroup Data
@@ -397,7 +403,9 @@
 
             // 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' );
+			include_once( PLOG_CLASS_PATH."class/config/config.class.php" );
+			$config =& Config::getConfig();
+            $replace = array( $config->getValue( "urlize_word_separator", URLIZE_WORD_SEPARATOR_DEFAULT ), 'a','o','u','e','e','a','c', 'a', 'e', 'i', 'o', 'u', 'a', 'e', 'i', 'o', 'u', 'e', 'i' );
             $string = str_replace($search, $replace, $string);
             
             // and everything that is still left that hasn't been replaced/encoded, throw it away




More information about the pLog-svn mailing list