-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathe_notify.php
64 lines (46 loc) · 993 Bytes
/
e_notify.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2013 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*
*/
if (!defined('e107_INIT')) { exit; }
// e107::lan('_blank','notify',true);
// v2.x Standard
class twilio_notify extends notify
{
function router()
{
$ret = [];
$ret['sms'] = array(
'label' => "SMS",
'field' => "phone",
'category' => ''
);
return $ret;
}
function phone($name, $curVal)
{
return e107::getForm()->text($name, $curVal, 80, ['size'=>'large','placeholder'=>'+1-555-444-3333']);
}
function sms($data=array())
{
if(!empty($data['recipient']))
{
$to = $data['recipient'];
}
if(!empty($data['to']))
{
$to = $data['to'];
}
$ev = [
'to' => $to,
'message' => strip_tags(str_replace('<br />',"\n", $data['message']))
];
return e107::getEvent()->trigger('system_send_sms', $ev);
}
}