\WP_Buoy_SMS

Class to make and send SMS messages via WordPress.

Summary

Methods
Properties
Constants
__construct()
reset()
getAddressee()
addAddressee()
setSender()
addHeader()
getContent()
setContent()
addStrippedFilter()
send()
No public properties found
MAX_LENGTH
No protected methods found
No protected properties found
N/A
getMessage()
stripFilter()
prepare()
finish()
$addressees
$sender
$to
$headers
$content
$excess
$wp_filters
N/A

Constants

MAX_LENGTH

MAX_LENGTH

Total number of characters a single SMS message can contain.

Properties

$addressees

$addressees : array<mixed,\WP_Buoy_User>

The users to whom the SMS should be sent.

Type

array<mixed,\WP_Buoy_User>

$sender

$sender : false|\WP_Buoy_User

The sender of the SMS.

Type

false|\WP_Buoy_User

$to

$to : array<mixed,string>

Array of addresses.

Type

array<mixed,string>

$headers

$headers : array<mixed,string>

Extra headers to send.

Type

array<mixed,string>

$content

$content : string

Contents of the SMS message.

Type

string

$excess

$excess : string

Leftover SMS content after truncation, if any.

Type

string

$wp_filters

$wp_filters : array

WordPress filter hooks to remove prior to sending.

Type

array

Methods

__construct()

__construct() 

Constructor.

reset()

reset() 

Clears all stored SMS preparation so the object can be reused.

getAddressee()

getAddressee(string|integer  $index = false) : array|\WP_User

Gets an addressee.

Parameters

string|integer $index

An addressee index to get, if only one is wanted.

Returns

array|\WP_User

addAddressee()

addAddressee(\WP_User  $addressee) : void

Adds another addressee to send the SMS message to.

Parameters

\WP_User $addressee

setSender()

setSender(\WP_User  $user) 

Sets the sender of the SMS.

Parameters

\WP_User $user

addHeader()

addHeader(string  $header) 

Adds a header to the sent message.

Parameters

string $header

getContent()

getContent() : string

Gets the contents of the SMS.

Returns

string

setContent()

setContent(string  $string) 

Sets the SMS message content.

This can be longer than the maximum SMS length. If it is, the message will get truncated and subsequent SMS messages will be automatically sent, too.

Parameters

string $string

addStrippedFilter()

addStrippedFilter(callable  $filter_callback, string  $wp_hook = 'wp_mail') 

Register a WordPress filter to be stripped before sending.

Parameters

callable $filter_callback

The callable hooked function or method to strip.

string $wp_hook

The hook from which to strip the callable.

send()

send() 

Sends the SMS message and resets the object when done.

getMessage()

getMessage() : string

Gets the message content that fits inside a single SMS/txt.

Truncates the current SMS message if necessary and then sets the contents to the remainder of the message.

Returns

string

stripFilter()

stripFilter(array  $filter_record) 

Removes registered filter.

Parameters

array $filter_record

An array containing information about the attached filter.

prepare()

prepare() 

Prepares the SMS message for sending.

finish()

finish() 

Restores WordPress filter state after SMS transmission.