Created
May 19, 2011 08:35
-
-
Save kemo/980407 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php defined('SYSPATH') or die('No direct script access.'); | |
class Text extends Kohana_Text { | |
public static function extract_emails($string) | |
{ | |
$return = array(); | |
if (Valid::email($string)) | |
{ | |
$return[] = $string; | |
} | |
else | |
{ | |
$exploded = explode(',', $string); | |
foreach ($exploded as $e) | |
{ | |
$e = trim($e, "\n\t \"'"); | |
if (Valid::email($e)) | |
{ | |
$return[] = $e; | |
} | |
} | |
} | |
return $return; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment