summaryrefslogtreecommitdiff
path: root/program/include/rcube_shared.inc
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2012-09-05 16:17:56 +0200
committerThomas Bruederli <thomas@roundcube.net>2012-09-05 16:17:56 +0200
commitba3cd80c0c61e679cef92a1f4f51e645090a1472 (patch)
tree4bd7c352dade0d18c19f25d65b04a5b896813918 /program/include/rcube_shared.inc
parent957ac142e3c80db3b86df4f0db3b82cfa8856206 (diff)
parente263994adc3f8f331c6167da1665c1920a5142f9 (diff)
Merge branch 'master' of github.com:roundcube/roundcubemail
Diffstat (limited to 'program/include/rcube_shared.inc')
-rw-r--r--program/include/rcube_shared.inc33
1 files changed, 27 insertions, 6 deletions
diff --git a/program/include/rcube_shared.inc b/program/include/rcube_shared.inc
index 85f278432..c15305c08 100644
--- a/program/include/rcube_shared.inc
+++ b/program/include/rcube_shared.inc
@@ -108,11 +108,11 @@ function slashify($str)
/**
- * Remove slash at the end of the string
+ * Remove slashes at the end of the string
*/
function unslashify($str)
{
- return preg_replace('/\/$/', '', $str);
+ return preg_replace('/\/+$/', '', $str);
}
@@ -231,7 +231,7 @@ function array_keys_recursive($array)
{
$keys = array();
- if (!empty($array)) {
+ if (!empty($array) && is_array($array)) {
foreach ($array as $key => $child) {
$keys[] = $key;
foreach (array_keys_recursive($child) as $val) {
@@ -255,7 +255,7 @@ function asciiwords($str, $css_id = false, $replace_with = '')
/**
- * Remove single and double quotes from given string
+ * Remove single and double quotes from a given string
*
* @param string Input value
*
@@ -306,6 +306,29 @@ function format_email_recipient($email, $name = '')
/**
+ * Format e-mail address
+ *
+ * @param string $email E-mail address
+ *
+ * @return string Formatted e-mail address
+ */
+function format_email($email)
+{
+ $email = trim($email);
+ $parts = explode('@', $email);
+ $count = count($parts);
+
+ if ($count > 1) {
+ $parts[$count-1] = mb_strtolower($parts[$count-1]);
+
+ $email = implode('@', $parts);
+ }
+
+ return $email;
+}
+
+
+/**
* mbstring replacement functions
*/
if (!extension_loaded('mbstring'))
@@ -399,7 +422,6 @@ function rcube_autoload($classname)
{
$filename = preg_replace(
array(
- '/MDB2_(.+)/',
'/Mail_(.+)/',
'/Net_(.+)/',
'/Auth_(.+)/',
@@ -408,7 +430,6 @@ function rcube_autoload($classname)
),
array(
'Mail/\\1',
- 'Mail/\\1',
'Net/\\1',
'Auth/\\1',
'html',