|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace XoopsModules\Oledrion; |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
You may not change or alter any portion of this comment or credits |
|
7
|
|
|
of supporting developers from this source code or any supporting source code |
|
8
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
|
9
|
|
|
|
|
10
|
|
|
This program is distributed in the hope that it will be useful, |
|
11
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
13
|
|
|
*/ |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* oledrion |
|
17
|
|
|
* |
|
18
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
|
19
|
|
|
* @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
|
20
|
|
|
* @author Hossein Azizabadi ([email protected]) |
|
21
|
|
|
*/ |
|
22
|
|
|
|
|
23
|
|
|
use XoopsModules\Oledrion; |
|
24
|
|
|
|
|
25
|
|
|
// defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
|
26
|
|
|
|
|
27
|
|
|
/* |
|
28
|
|
|
$information = array(); |
|
29
|
|
|
$information['to'] = '9365965795'; |
|
30
|
|
|
$information['text'] = 'ewrewr we sdf sdfdsf sdfasda sd asd asd'; |
|
31
|
|
|
$sms = \XoopsModules\Oledrion\Sms::sendSms($information); |
|
32
|
|
|
*/ |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* Class Sms |
|
36
|
|
|
*/ |
|
37
|
|
|
class Sms |
|
38
|
|
|
{ |
|
39
|
|
|
/** |
|
40
|
|
|
* @return string |
|
41
|
|
|
*/ |
|
42
|
|
|
public static function getSmsGateway() |
|
43
|
|
|
{ |
|
44
|
|
|
return OLEDRION_SMS_GATEWAY; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @param string $smsGatewayName |
|
49
|
|
|
* @return string |
|
50
|
|
|
*/ |
|
51
|
|
|
public static function getSmsGatewayPath($smsGatewayName) |
|
52
|
|
|
{ |
|
53
|
|
|
return OLEDRION_CLASS_PATH . 'sms' . '/' . $smsGatewayName; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* @param string $smsGatewayName |
|
58
|
|
|
* @return string |
|
59
|
|
|
*/ |
|
60
|
|
|
public static function getSmsGatewayFullClassPath($smsGatewayName) |
|
61
|
|
|
{ |
|
62
|
|
|
$smsGatewayPath = self::getSmsGatewayPath($smsGatewayName); |
|
63
|
|
|
|
|
64
|
|
|
return $smsGatewayPath . '/' . 'sms.php'; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* @param string $smsGatewayName |
|
69
|
|
|
*/ |
|
70
|
|
|
public static function includeSmsGatewayClass($smsGatewayName) |
|
71
|
|
|
{ |
|
72
|
|
|
$smsGatewayClassPath = self::getSmsGatewayFullClassPath($smsGatewayName); |
|
73
|
|
|
require_once $smsGatewayClassPath; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* @param string $smsGatewayName |
|
78
|
|
|
* @return array |
|
79
|
|
|
*/ |
|
80
|
|
|
public static function getSmsGatewayOption($smsGatewayName) |
|
81
|
|
|
{ |
|
82
|
|
|
$option = []; |
|
83
|
|
|
$smsGatewayPath = self::getSmsGatewayPath($smsGatewayName); |
|
84
|
|
|
require_once $smsGatewayPath . '/' . 'option.php'; |
|
85
|
|
|
|
|
86
|
|
|
return $option; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* @param array $information |
|
91
|
|
|
* @return string |
|
92
|
|
|
* @internal param string $smsGatewayName |
|
93
|
|
|
*/ |
|
94
|
|
|
public static function sendSms($information = []) |
|
95
|
|
|
{ |
|
96
|
|
|
$smsGatewayName = self::getSmsGateway(); |
|
97
|
|
|
$option = self::getSmsGatewayOption($smsGatewayName); |
|
98
|
|
|
self::includeSmsGatewayClass($smsGatewayName); |
|
99
|
|
|
|
|
100
|
|
|
return self::sendSms($information, $option); |
|
|
|
|
|
|
101
|
|
|
} |
|
102
|
|
|
} |
|
103
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.