aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2012-12-18 18:02:58 -0200
committerSilvio Rhatto <rhatto@riseup.net>2012-12-18 18:02:58 -0200
commit686e84172e7eda2dea4b187089d77524a69ac4e8 (patch)
treed1586f11cb1c578bdccbf1af92cbb3feb2ca8cb1
parent43c4c15a33dfcb610a28fe802ce6086447471ca5 (diff)
downloadreminder-686e84172e7eda2dea4b187089d77524a69ac4e8.tar.gz
reminder-686e84172e7eda2dea4b187089d77524a69ac4e8.tar.bz2
Refactoring reminder_parse_subscribers()HEADmaster
-rw-r--r--reminder.module13
1 files changed, 10 insertions, 3 deletions
diff --git a/reminder.module b/reminder.module
index b3a550a..1954a21 100644
--- a/reminder.module
+++ b/reminder.module
@@ -453,11 +453,18 @@ function reminder_send($nid) {
/**
* Helper function to parse subscribers.
*
- * @todo
- * Ignore blank lines.
+ * @see http://stackoverflow.com/questions/1028553/how-to-get-email-address-from-a-long-string
*/
function reminder_parse_subscribers($subscribers) {
- return explode("\n", $subscribers);
+ foreach(preg_split('/ |,|;|\n/', $subscribers) as $token) {
+ $email = filter_var(filter_var($token, FILTER_SANITIZE_EMAIL), FILTER_VALIDATE_EMAIL);
+
+ if ($email !== false) {
+ $emails[] = $email;
+ }
+ }
+
+ return $emails;
}
/**