[pLog-svn] r4820 - plog/branches/lifetype-1.2/class/template/smarty/plugins

oscar at devel.lifetype.net oscar at devel.lifetype.net
Thu Feb 22 14:02:45 EST 2007


Author: oscar
Date: 2007-02-22 14:02:45 -0500 (Thu, 22 Feb 2007)
New Revision: 4820

Modified:
   plog/branches/lifetype-1.2/class/template/smarty/plugins/modifier.capitalize.php
Log:
Fix for Mantis issue http://bugs.lifetype.net/view.php?id=1183, some characters such as '?\195?\167' are not being considered parts of words and therefore a word like 'retroenlla?\195?\167os' will become 'Retroenlla?\195?\167Os' once it is processed by Smarty's "capitalize" modifier. I think it's got something to do with the \w modifier of the regexp, I read somewhere that word boundaries are calculated based on the current system locale settings.

Modified: plog/branches/lifetype-1.2/class/template/smarty/plugins/modifier.capitalize.php
===================================================================
--- plog/branches/lifetype-1.2/class/template/smarty/plugins/modifier.capitalize.php	2007-02-22 18:17:53 UTC (rev 4819)
+++ plog/branches/lifetype-1.2/class/template/smarty/plugins/modifier.capitalize.php	2007-02-22 19:02:45 UTC (rev 4820)
@@ -20,8 +20,13 @@
  */
 function smarty_modifier_capitalize($string, $uc_digits = false)
 {
-    smarty_modifier_capitalize_ucfirst(null, $uc_digits);
-    return preg_replace_callback('!\'?\b\w(\w|\')*\b!', 'smarty_modifier_capitalize_ucfirst', $string);
+    //smarty_modifier_capitalize_ucfirst(null, $uc_digits);
+    //return preg_replace_callback('!\'?\b\w(\w|\')*\b!', 'smarty_modifier_capitalize_ucfirst', $string);
+
+	// Fix for Mantis issue http://bugs.lifetype.net/view.php?id=1183
+	// Characters such as 'ç' are used as words separators instead of being considered as characters
+	// so a word such as 'retroenllaços' becomes 'RetroenllaçOs'
+	return( ucwords( $string ));
 }
 
 function smarty_modifier_capitalize_ucfirst($string, $uc_digits = null)
@@ -39,5 +44,4 @@
         return $string[0];
 }
 
-
 ?>



More information about the pLog-svn mailing list