Permalink
Browse files

Add optional truncate parameter - shortens message if it's too long

  • Loading branch information...
1 parent 65dd823 commit b5dce543d7872b9de390a63153a7af484ceae170 Martin Steel committed Sep 29, 2011
Showing with 12 additions and 1 deletion.
  1. +12 −1 mediaburstSMS.class.php
View
@@ -42,6 +42,7 @@ class mediaburstSMS {
private $password;
private $from;
private $long;
+ private $truncate;
private $ssl;
// Proxy server fields
private $proxy_host;
@@ -75,7 +76,8 @@ public function __construct( $username="", $password="", $options = array() ) {
// options and defaults
$this->long = (array_key_exists('long', $options)) ? $options['long'] : true;
$this->from = (array_key_exists('from', $options)) ? $options['from'] : null;
- $this->ssl = (array_key_exists('ssl' , $options)) ? $options['ssl'] : mediaburstHTTP::SSLSupport();
+ $this->truncate = (array_key_exists('truncate', $options)) ? $options['truncate'] : false;
+ $this->ssl = (array_key_exists('ssl' , $options)) ? $options['ssl'] : mediaburstHTTP::SSLSupport();
$this->proxy_host = (array_key_exists('proxy_host', $options)) ? $options['proxy_host'] : null;
$this->proxy_port = (array_key_exists('proxy_port', $options)) ? $options['proxy_port'] : null;
}
@@ -106,6 +108,8 @@ public function Send( $to, $message ) {
$sms_node->appendChild($req_doc->createElement('Concat', 3));
if($this->from)
$sms_node->appendChild($req_doc->createElement('From', $this->from));
+ if($this->truncate)
+ $sms_node->appendChild($req_doc->createElement('Truncate', 1));
$root->appendChild($sms_node);
}
@@ -249,6 +253,13 @@ private function set_long($value) {
$this->long = $value;
}
+ private function get_truncate() {
+ return $this->truncate;
+ }
+ private function set_truncate($value) {
+ $this->truncate = $value;
+ }
+
private function get_ssl() {
return $this->ssl;
}

0 comments on commit b5dce54

Please sign in to comment.