diff options
author | Urban Müller | 2008-06-23 13:09:02 +0000 |
---|---|---|
committer | Urban Müller | 2008-06-23 13:09:02 +0000 |
commit | 156228c730ac944b751f6e8bb7d463c2fee3763c (patch) | |
tree | 2da7e38367b854162809c3e463d0bfb16076914d /it.class | |
parent | 4f531ee59521e4bd10fca1010e22d88066b43620 (diff) | |
download | itools-156228c730ac944b751f6e8bb7d463c2fee3763c.tar.gz itools-156228c730ac944b751f6e8bb7d463c2fee3763c.tar.bz2 itools-156228c730ac944b751f6e8bb7d463c2fee3763c.zip |
allow comma separated list in filter_keys, simpler mail sending
Diffstat (limited to 'it.class')
-rw-r--r-- | it.class | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -361,12 +361,12 @@ function replace($replacements, $string, $p = array()) /** * Extract key => value pairs from assoc array by key * @param $array array to filter - * @param $keys array of keys to keep + * @param $keys array or comma separated list of keys to keep */ function filter_keys($array, $keys) { $result = array(); - $keep = array_flip($keys); + $keep = array_flip(is_string($keys) ? explode(",", $keys) : (array)$keys); foreach ($array as $key => $val) if (isset($keep[$key])) @@ -658,6 +658,19 @@ function map($expr, $arr) return (array)$result; } +/** + * Send a mail. Expects array for Header => Content pairs with Body => for the mail body + */ +function mail($p) +{ + $body = $p['Body']; + unset($p['Body']); + $mail = new it_mail($p); + $mail->add_body($body); + + return $mail->send(); +} + } ?> |