apns-php
 All Data Structures Files Functions Variables Groups Pages
ApnsPHP_Message_Custom Class Reference

The Push Notification Custom Message. More...

Inheritance diagram for ApnsPHP_Message_Custom:
Inheritance graph
Collaboration diagram for ApnsPHP_Message_Custom:
Collaboration graph

Public Member Functions

string getActionLocKey ()
 Get the "View" button title. More...
 
string getLaunchImage ()
 Get the filename of an image file in the application bundle. More...
 
string getLocArgs ()
 Get the variable string values to appear in place of the format specifiers in loc-key. More...
 
string getLocKey ()
 Get the alert-message string in Localizable.strings file. More...
 
void setActionLocKey (string $sActionLocKey= '')
 Set the "View" button title. More...
 
void setLaunchImage (string $sLaunchImage)
 Set the filename of an image file in the application bundle; it may include the extension or omit it. More...
 
void setLocArgs (array $aLocArgs)
 Set the variable string values to appear in place of the format specifiers in loc-key. More...
 
void setLocKey (string $sLocKey)
 Set the alert-message string in Localizable.strings file for the current localization (which is set by the user’s language preference). More...
 
- Public Member Functions inherited from ApnsPHP_Message
void __construct (string $sDeviceToken=null)
 Constructor. More...
 
string __toString ()
 PHP Magic Method. More...
 
void addRecipient (string $sDeviceToken)
 Add a recipient device token. More...
 
boolean getAutoAdjustLongPayload ()
 Get the auto-adjust long payload value. More...
 
integer getBadge ()
 Get the number to badge the application icon with. More...
 
string getCategory ()
 Get the category of notification. More...
 
boolean getContentAvailable ()
 Get if should initiates the Newsstand background download. More...
 
mixed getCustomIdentifier ()
 Get the custom message identifier. More...
 
string getCustomProperty (string $sName)
 Get the custom property value. More...
 
string getCustomPropertyName ()
 Get the first custom property name. More...
 
array getCustomPropertyNames ()
 Get all custom properties names. More...
 
mixed getCustomPropertyValue ()
 Get the first custom property value. More...
 
integer getExpiry ()
 Get the expiry value. More...
 
string getPayload ()
 Convert the message in a JSON-encoded payload. More...
 
string getRecipient (integer $nRecipient=0)
 Get a recipient. More...
 
array getRecipients ()
 Get all recipients. More...
 
integer getRecipientsNumber ()
 Get the number of recipients. More...
 
string getSound ()
 Get the sound to play. More...
 
string getText ()
 Get the alert message to display to the user. More...
 
void setAutoAdjustLongPayload (boolean $bAutoAdjust)
 Set the auto-adjust long payload value. More...
 
void setBadge (integer $nBadge)
 Set the number to badge the application icon with. More...
 
void setCategory (string $sCategory= '')
 Set the category of notification. More...
 
void setContentAvailable (boolean $bContentAvailable=true)
 Initiates the Newsstand background download. More...
 
void setCustomIdentifier (mixed $mCustomIdentifier)
 Set the custom message identifier. More...
 
void setCustomProperty (string $sName, mixed $mValue)
 Set a custom property. More...
 
void setExpiry (integer $nExpiryValue)
 Set the expiry value. More...
 
void setSound (string $sSound= 'default')
 Set the sound to play. More...
 
void setText (string $sText)
 Set the alert message to display to the user. More...
 

Protected Member Functions

array _getPayload ()
 Get the payload dictionary. More...
 
- Protected Member Functions inherited from ApnsPHP_Message
array _getPayload ()
 Get the payload dictionary. More...
 

Protected Attributes

array $_aLocArgs
 Variable string values to appear in place of the format specifiers in loc-key. More...
 
string $_sActionLocKey
 The "View" button title. More...
 
string $_sLaunchImage
 The filename of an image file in the application bundle. More...
 
string $_sLocKey
 A key to an alert-message string in a Localizable.strings file. More...
 
- Protected Attributes inherited from ApnsPHP_Message
mixed $_aCustomProperties
 Custom properties container. More...
 
array $_aDeviceTokens = array()
 Recipients device tokens. More...
 
boolean $_bAutoAdjustLongPayload = true
 If the JSON payload is longer than maximum allowed size, shorts message text. More...
 
boolean $_bContentAvailable
 True to initiates the Newsstand background download. More...
 
mixed $_mCustomIdentifier
 Custom message identifier. More...
 
integer $_nBadge
 Number to badge the application icon with. More...
 
integer $_nExpiryValue = 604800
 That message will expire in 604800 seconds (86400 * 7, 7 days) if not successful delivered. More...
 
string $_sCategory
 notification category. More...
 
string $_sSound
 Sound to play. More...
 
string $_sText
 Alert message to display to the user. More...
 

Additional Inherited Members

- Data Fields inherited from ApnsPHP_Message
const APPLE_RESERVED_NAMESPACE = 'aps'
 string The Apple-reserved aps namespace. More...
 
const PAYLOAD_MAXIMUM_SIZE = 2048
 integer The maximum size allowed for a notification payload. More...
 

Detailed Description

The Push Notification Custom Message.

The class represents a custom message to be delivered to an end user device. Please refer to Table 3-2 for more information.

See Also
http://tinyurl.com/ApplePushNotificationPayload

Definition at line 29 of file Custom.php.

Member Function Documentation

array _getPayload ( )
protected

Get the payload dictionary.

Returns
The payload dictionary.

Definition at line 141 of file Custom.php.

References $_aLocArgs.

142  {
143  $aPayload = parent::_getPayload();
144 
145  $aPayload['aps']['alert'] = array();
146 
147  if (isset($this->_sText) && !isset($this->_sLocKey)) {
148  $aPayload['aps']['alert']['body'] = (string)$this->_sText;
149  }
150 
151  if (isset($this->_sActionLocKey)) {
152  $aPayload['aps']['alert']['action-loc-key'] = $this->_sActionLocKey == '' ?
153  null : (string)$this->_sActionLocKey;
154  }
155 
156  if (isset($this->_sLocKey)) {
157  $aPayload['aps']['alert']['loc-key'] = (string)$this->_sLocKey;
158  }
159 
160  if (isset($this->_aLocArgs)) {
161  $aPayload['aps']['alert']['loc-args'] = $this->_aLocArgs;
162  }
163 
164  if (isset($this->_sLaunchImage)) {
165  $aPayload['aps']['alert']['launch-image'] = (string)$this->_sLaunchImage;
166  }
167 
168  return $aPayload;
169  }
array $_aLocArgs
Variable string values to appear in place of the format specifiers in loc-key.
Definition: Custom.php:33
string getActionLocKey ( )

Get the "View" button title.

Returns
The "View" button title.

Definition at line 58 of file Custom.php.

References $_sActionLocKey.

59  {
60  return $this->_sActionLocKey;
61  }
string $_sActionLocKey
The "View" button title.
Definition: Custom.php:31
string getLaunchImage ( )

Get the filename of an image file in the application bundle.

Returns
The filename of an image file.

Definition at line 131 of file Custom.php.

References $_sLaunchImage.

132  {
133  return $this->_sLaunchImage;
134  }
string $_sLaunchImage
The filename of an image file in the application bundle.
Definition: Custom.php:34
string getLocArgs ( )

Get the variable string values to appear in place of the format specifiers in loc-key.

Returns
The variable string values.

Definition at line 104 of file Custom.php.

References $_aLocArgs.

105  {
106  return $this->_aLocArgs;
107  }
array $_aLocArgs
Variable string values to appear in place of the format specifiers in loc-key.
Definition: Custom.php:33
string getLocKey ( )

Get the alert-message string in Localizable.strings file.

Returns
The alert-message string.

Definition at line 82 of file Custom.php.

References $_sLocKey.

83  {
84  return $this->_sLocKey;
85  }
string $_sLocKey
A key to an alert-message string in a Localizable.strings file.
Definition: Custom.php:32
void setActionLocKey ( string  $sActionLocKey = '')

Set the "View" button title.

If a string is specified, displays an alert with two buttons. iOS uses the string as a key to get a localized string in the current localization to use for the right button’s title instead of "View". If the value is an empty string, the system displays an alert with a single OK button that simply dismisses the alert when tapped.

Parameters
$sActionLocKey[optional] The "View" button title, default empty string.

Definition at line 48 of file Custom.php.

49  {
50  $this->_sActionLocKey = $sActionLocKey;
51  }
void setLaunchImage ( string  $sLaunchImage)

Set the filename of an image file in the application bundle; it may include the extension or omit it.

The image is used as the launch image when users tap the action button or move the action slider. If this property is not specified, the system either uses the previous snapshot, uses the image identified by the UILaunchImageFile key in the application’s Info.plist file, or falls back to Default.png. This property was added in iOS 4.0.

Parameters
$sLaunchImageThe filename of an image file.

Definition at line 121 of file Custom.php.

122  {
123  $this->_sLaunchImage = $sLaunchImage;
124  }
void setLocArgs ( array  $aLocArgs)

Set the variable string values to appear in place of the format specifiers in loc-key.

Parameters
$aLocArgsThe variable string values.

Definition at line 93 of file Custom.php.

94  {
95  $this->_aLocArgs = $aLocArgs;
96  }
void setLocKey ( string  $sLocKey)

Set the alert-message string in Localizable.strings file for the current localization (which is set by the user’s language preference).

The key string can be formatted with %@ and n$@ specifiers to take the variables specified in loc-args.

Parameters
$sLocKeyThe alert-message string.

Definition at line 72 of file Custom.php.

73  {
74  $this->_sLocKey = $sLocKey;
75  }

Field Documentation

array $_aLocArgs
protected

Variable string values to appear in place of the format specifiers in loc-key.

Definition at line 33 of file Custom.php.

Referenced by _getPayload(), and getLocArgs().

string $_sActionLocKey
protected

The "View" button title.

Definition at line 31 of file Custom.php.

Referenced by getActionLocKey().

string $_sLaunchImage
protected

The filename of an image file in the application bundle.

Definition at line 34 of file Custom.php.

Referenced by getLaunchImage().

string $_sLocKey
protected

A key to an alert-message string in a Localizable.strings file.

Definition at line 32 of file Custom.php.

Referenced by getLocKey().


The documentation for this class was generated from the following file: