Revision: 223
http://sourceforge.net/p/beeframework/code/223
Author: m_plomer
Date: 2014-09-22 08:59:52 +0000 (Mon, 22 Sep 2014)
Log Message:
-----------
- changes to Bee_Utils_Strings::toAscii
Modified Paths:
--------------
trunk/framework/Bee/Utils/Strings.php
Modified: trunk/framework/Bee/Utils/Strings.php
===================================================================
--- trunk/framework/Bee/Utils/Strings.php 2014-09-18 06:19:09 UTC (rev 222)
+++ trunk/framework/Bee/Utils/Strings.php 2014-09-22 08:59:52 UTC (rev 223)
@@ -214,12 +214,13 @@
*
* @return string
*/
- public static function toAscii($string, $table=array(), $delimiter='-', $toLowercase=true) {
+ public static function toAscii($string, $table=array(), $delimiter='-', $toLowercase=true, $allowEmailChars=false) {
if (count($table)>0) {
$string = strtr($string, $table);
}
$ascii = iconv('UTF-8', 'ASCII//TRANSLIT', $string);
- $ascii = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $ascii);
+ $emailChars = $allowEmailChars ? '@.' : '';
+ $ascii = preg_replace("/[^a-zA-Z0-9\/_|+ -".$emailChars."]/", '', $ascii);
$ascii = trim($ascii, '-');
$ascii = preg_replace("/[\/_|+ -]+/", $delimiter, $ascii);
return $toLowercase ? strtolower($ascii) : $ascii;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|