mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-13 16:34:52 +09:00
Remove trailing whitespace
This commit is contained in:
parent
3b0030e82b
commit
a9f72a5cd2
81 changed files with 2455 additions and 2455 deletions
|
|
@ -23,34 +23,34 @@ class ApiStore extends Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
'mms_supported' => false,
|
||||
'delay_supported' => true,
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Config keys used by this driver are stored here.
|
||||
*/
|
||||
protected static $_required_config = array('api_user', 'api_key');
|
||||
|
||||
|
||||
/**
|
||||
* Check if the current SMS driver is supported on this server.
|
||||
*
|
||||
*
|
||||
* This method returns true on success and false on failure.
|
||||
*
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isSupported()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Store the last response.
|
||||
*/
|
||||
protected $_last_response = '';
|
||||
|
||||
|
||||
/**
|
||||
* Send a message.
|
||||
*
|
||||
*
|
||||
* This method returns true on success and false on failure.
|
||||
*
|
||||
*
|
||||
* @param array $messages
|
||||
* @param object $original
|
||||
* @return bool
|
||||
|
|
@ -58,7 +58,7 @@ class ApiStore extends Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
public function send(array $messages, \Rhymix\Framework\SMS $original)
|
||||
{
|
||||
$status = true;
|
||||
|
||||
|
||||
foreach ($messages as $i => $message)
|
||||
{
|
||||
$data = array();
|
||||
|
|
@ -69,7 +69,7 @@ class ApiStore extends Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
{
|
||||
$data['subject'] = $message->subject;
|
||||
}
|
||||
|
||||
|
||||
$result = $this->_apiCall(sprintf('message/%s', strtolower($message->type)), $data);
|
||||
if (!$result)
|
||||
{
|
||||
|
|
@ -81,13 +81,13 @@ class ApiStore extends Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
$message->errors[] = 'ApiStore API error: ' . $result->result_code . ' ' . $result->result_message;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* API call.
|
||||
*
|
||||
*
|
||||
* @param string $url
|
||||
* @param array $data
|
||||
* @param string $method (optional)
|
||||
|
|
@ -106,12 +106,12 @@ class ApiStore extends Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
$version = 1;
|
||||
}
|
||||
$url = sprintf('http://api.apistore.co.kr/ppurio/%d/%s/%s', $version, trim($url, '/'), $this->_config['api_user']);
|
||||
|
||||
|
||||
// Set the API key in the header.
|
||||
$headers = array(
|
||||
'x-waple-authorization' => $this->_config['api_key'],
|
||||
);
|
||||
|
||||
|
||||
// Send the API reqeust.
|
||||
if ($method === 'GET')
|
||||
{
|
||||
|
|
@ -128,10 +128,10 @@ class ApiStore extends Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
$result = @json_decode($this->_last_response);
|
||||
return $result ?: false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetch the last API response.
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function _getLastResponse()
|
||||
|
|
|
|||
|
|
@ -11,18 +11,18 @@ abstract class Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
* The configuration is stored here.
|
||||
*/
|
||||
protected $_config = null;
|
||||
|
||||
|
||||
/**
|
||||
* The driver specification is stored here.
|
||||
*/
|
||||
protected static $_spec = array();
|
||||
|
||||
|
||||
/**
|
||||
* Config keys used by this driver are stored here.
|
||||
*/
|
||||
protected static $_required_config = array();
|
||||
protected static $_optional_config = array();
|
||||
|
||||
|
||||
/**
|
||||
* Direct invocation of the constructor is not permitted.
|
||||
*/
|
||||
|
|
@ -30,10 +30,10 @@ abstract class Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
{
|
||||
$this->_config = $config;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new instance of the current SMS driver, using the given settings.
|
||||
*
|
||||
*
|
||||
* @param array $config
|
||||
* @return object
|
||||
*/
|
||||
|
|
@ -41,74 +41,74 @@ abstract class Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
{
|
||||
return new static($config);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the human-readable name of this SMS driver.
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getName()
|
||||
{
|
||||
return class_basename(get_called_class());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the list of configuration fields required by this SMS driver.
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getRequiredConfig()
|
||||
{
|
||||
return static::$_required_config;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the list of configuration fields optionally used by this SMS driver.
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getOptionalConfig()
|
||||
{
|
||||
return static::$_optional_config;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the list of API types supported by this SMS driver.
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getAPITypes()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the spec for this SMS driver.
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getAPISpec()
|
||||
{
|
||||
return static::$_spec;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the current SMS driver is supported on this server.
|
||||
*
|
||||
*
|
||||
* This method returns true on success and false on failure.
|
||||
*
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isSupported()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send a message.
|
||||
*
|
||||
*
|
||||
* This method returns true on success and false on failure.
|
||||
*
|
||||
*
|
||||
* @param array $messages
|
||||
* @param object $original
|
||||
* @return bool
|
||||
|
|
|
|||
|
|
@ -31,30 +31,30 @@ class CoolSMS extends Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
'image_max_filesize' => 300000,
|
||||
'delay_supported' => true,
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Config keys used by this driver are stored here.
|
||||
*/
|
||||
protected static $_required_config = array('api_key', 'api_secret');
|
||||
protected static $_optional_config = array('sender_key');
|
||||
|
||||
|
||||
/**
|
||||
* Check if the current SMS driver is supported on this server.
|
||||
*
|
||||
*
|
||||
* This method returns true on success and false on failure.
|
||||
*
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isSupported()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send a message.
|
||||
*
|
||||
*
|
||||
* This method returns true on success and false on failure.
|
||||
*
|
||||
*
|
||||
* @param array $messages
|
||||
* @param object $original
|
||||
* @return bool
|
||||
|
|
@ -111,7 +111,7 @@ class CoolSMS extends Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
$status = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $status;
|
||||
}
|
||||
catch (\Nurigo\Exceptions\CoolsmsException $e)
|
||||
|
|
|
|||
|
|
@ -31,29 +31,29 @@ class Dummy extends Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
'image_max_filesize' => 300000,
|
||||
'delay_supported' => true,
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Sent messages are stored here for debugging and testing.
|
||||
*/
|
||||
protected $_sent_messages = array();
|
||||
|
||||
|
||||
/**
|
||||
* Check if the current SMS driver is supported on this server.
|
||||
*
|
||||
*
|
||||
* This method returns true on success and false on failure.
|
||||
*
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isSupported()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send a message.
|
||||
*
|
||||
*
|
||||
* This method returns true on success and false on failure.
|
||||
*
|
||||
*
|
||||
* @param array $messages
|
||||
* @param object $original
|
||||
* @return bool
|
||||
|
|
@ -66,20 +66,20 @@ class Dummy extends Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get sent messages.
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSentMessages()
|
||||
{
|
||||
return $this->_sent_messages;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reset sent messages.
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function resetSentMessages()
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class iwinv extends Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
* API endpoint URL (fallback if URL is not explicitly configured)
|
||||
*/
|
||||
const LEGACY_API_URL = 'https://sms.service.iwinv.kr/send/';
|
||||
|
||||
|
||||
/**
|
||||
* API specifications.
|
||||
*/
|
||||
|
|
@ -54,10 +54,10 @@ class iwinv extends Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the list of API URLs supported by this driver.
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getApiUrls()
|
||||
|
|
@ -81,7 +81,7 @@ class iwinv extends Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
{
|
||||
$status = true;
|
||||
$curl = null;
|
||||
|
||||
|
||||
foreach ($messages as $i => $message)
|
||||
{
|
||||
// Authentication
|
||||
|
|
@ -89,7 +89,7 @@ class iwinv extends Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
'Content-Type: multipart/form-data',
|
||||
'secret: ' . base64_encode($this->_config['api_key'] . '&' . $this->_config['api_secret']),
|
||||
);
|
||||
|
||||
|
||||
// Sender and recipient
|
||||
$data = array();
|
||||
$data['from'] = str_replace('-', '', \Rhymix\Framework\Korea::formatPhoneNumber($message->from));
|
||||
|
|
@ -100,26 +100,26 @@ class iwinv extends Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
{
|
||||
$data['to'] = array_first($data['to']);
|
||||
}
|
||||
|
||||
|
||||
// Subject and content
|
||||
if ($message->type === 'LMS' && $message->subject)
|
||||
{
|
||||
$data['title'] = $message->subject;
|
||||
}
|
||||
$data['text'] = $message->content;
|
||||
|
||||
|
||||
// Image attachment
|
||||
if ($message->image)
|
||||
{
|
||||
$data['image'] = curl_file_create(realpath($message->image));
|
||||
}
|
||||
|
||||
|
||||
// Set delay
|
||||
if ($message->delay && $message->delay > time() + 900)
|
||||
{
|
||||
$data['date'] = gmdate('Y-m-d H:i:s', $message->delay + (3600 * 9));
|
||||
}
|
||||
|
||||
|
||||
// Set API URL
|
||||
if (!empty($this->_config['api_url']))
|
||||
{
|
||||
|
|
@ -129,7 +129,7 @@ class iwinv extends Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
{
|
||||
$api_url = self::LEGACY_API_URL;
|
||||
}
|
||||
|
||||
|
||||
// We need to use curl because Filehandler::getRemoteResource() doesn't work with this API for some reason.
|
||||
if (!$curl)
|
||||
{
|
||||
|
|
@ -143,7 +143,7 @@ class iwinv extends Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
curl_setopt($curl, \CURLOPT_HTTPHEADER, $headers);
|
||||
$result = curl_exec($curl);
|
||||
$err = curl_error($curl);
|
||||
|
||||
|
||||
// Check the result.
|
||||
if ($err)
|
||||
{
|
||||
|
|
@ -161,12 +161,12 @@ class iwinv extends Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
$status = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($curl)
|
||||
{
|
||||
@curl_close($curl);
|
||||
}
|
||||
|
||||
|
||||
return $status;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,29 +23,29 @@ class Ppurio extends Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
'mms_supported' => false,
|
||||
'delay_supported' => true,
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Config keys used by this driver are stored here.
|
||||
*/
|
||||
protected static $_required_config = array('api_user');
|
||||
|
||||
|
||||
/**
|
||||
* Check if the current SMS driver is supported on this server.
|
||||
*
|
||||
*
|
||||
* This method returns true on success and false on failure.
|
||||
*
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isSupported()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send a message.
|
||||
*
|
||||
*
|
||||
* This method returns true on success and false on failure.
|
||||
*
|
||||
*
|
||||
* @param array $messages
|
||||
* @param object $original
|
||||
* @return bool
|
||||
|
|
@ -59,26 +59,26 @@ class Ppurio extends Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
// Authentication and basic information
|
||||
$data = array();
|
||||
$data['userid'] = $this->_config['api_user'];
|
||||
|
||||
|
||||
// Sender and recipient
|
||||
$data['callback'] = preg_replace('/[^0-9]/', '', $message->from);
|
||||
$data['phone'] = implode('|', array_map(function($num) {
|
||||
return preg_replace('/[^0-9]/', '', $num);
|
||||
}, $message->to));
|
||||
|
||||
|
||||
// Subject and content
|
||||
if ($message->type === 'LMS' && $message->subject)
|
||||
{
|
||||
$data['subject'] = $message->subject;
|
||||
}
|
||||
$data['msg'] = $message->content;
|
||||
|
||||
|
||||
// Set delay
|
||||
if ($message->delay && $message->delay > time() + 600)
|
||||
{
|
||||
$data['appdate'] = gmdate('YmdHis', $message->delay + (3600 * 9));
|
||||
}
|
||||
|
||||
|
||||
// Send!
|
||||
$url = 'https://www.ppurio.com/api/send_utf8_json.php';
|
||||
$result = \FileHandler::getRemoteResource($url, $data, 5, 'POST');
|
||||
|
|
@ -97,7 +97,7 @@ class Ppurio extends Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $status;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ namespace Rhymix\Framework\Drivers\SMS;
|
|||
class SolAPI extends Base implements \Rhymix\Framework\Drivers\SMSInterface
|
||||
{
|
||||
const appId = 'PAOe9c8ftH8R';
|
||||
|
||||
|
||||
/**
|
||||
* API specifications.
|
||||
*/
|
||||
|
|
@ -115,7 +115,7 @@ class SolAPI extends Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
}
|
||||
$groupArray[] = $options;
|
||||
}
|
||||
|
||||
|
||||
if($groupMessage)
|
||||
{
|
||||
$jsonObject = new \stdClass();
|
||||
|
|
@ -156,7 +156,7 @@ class SolAPI extends Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create header string for http protocol
|
||||
* @param $config
|
||||
|
|
@ -212,7 +212,7 @@ class SolAPI extends Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
private function request($method, $url, $data = false)
|
||||
{
|
||||
$url = 'https://api.solapi.com/' . $url;
|
||||
|
||||
|
||||
if(!$data)
|
||||
{
|
||||
$data = null;
|
||||
|
|
@ -222,7 +222,7 @@ class SolAPI extends Base implements \Rhymix\Framework\Drivers\SMSInterface
|
|||
$data = json_encode($data);
|
||||
}
|
||||
$result = \FileHandler::getRemoteResource($url, $data, 3, $method, 'application/json', array('Authorization' => $this->getHeader()));
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue