本文整理汇总了PHP中sms::find_provider方法的典型用法代码示例。如果您正苦于以下问题:PHP sms::find_provider方法的具体用法?PHP sms::find_provider怎么用?PHP sms::find_provider使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sms
的用法示例。
在下文中一共展示了sms::find_provider方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
/**
* Send The SMS Message Using Default Provider
* @param to mixed The destination address.
* @param from mixed The source/sender address
* @param text mixed The text content of the message
*
* @return mixed/bool (returns TRUE if sent FALSE or other text for fail)
*/
public static function send($to = NULL, $from = NULL, $message = NULL)
{
if (!$to or !$message) {
return "Missing Recipients and/or Message";
}
// 1. Do we have an SMS Provider?
$provider = Kohana::config("settings.sms_provider");
if ($provider) {
// 2. Does the plugin exist, and if so, is it active?
$plugin = ORM::factory("plugin")->where("plugin_name", $provider)->where("plugin_active", 1)->find();
if ($plugin->loaded) {
// Plugin exists and is active
// 3. Does this plugin have the SMS Library in place?
$class = ucfirst($provider) . '_SMS';
$path = sms::find_provider($provider);
if ($path) {
// File Exists
$sender = new $class();
// 4. Does the send method exist in this class?
if (method_exists($sender, 'send')) {
$response = $sender->send($to, $from, $message);
return $response;
}
}
}
}
return "No SMS Sending Provider In System";
}