本文整理汇总了PHP中CRM_Utils_Array::urlEncode方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_Array::urlEncode方法的具体用法?PHP CRM_Utils_Array::urlEncode怎么用?PHP CRM_Utils_Array::urlEncode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_Array
的用法示例。
在下文中一共展示了CRM_Utils_Array::urlEncode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
/**
* Send an SMS Message via the Clickatell API Server
*
* @param array the message with a to/from/text
*
* @return mixed true on sucess or PEAR_Error object
* @access public
*/
function send($recipients, $header, $message, $jobID = NULL)
{
if ($this->_apiType = 'http') {
$postDataArray = array();
$url = $this->formURLPostData("/http/sendmsg", $postDataArray);
if (array_key_exists('from', $this->_providerInfo['api_params'])) {
$postDataArray['from'] = $this->_providerInfo['api_params']['from'];
}
$postDataArray['to'] = $header['To'];
$postDataArray['text'] = substr($message, 0, 160);
// max of 160 characters, is probably not multi-lingual
if (array_key_exists('mo', $this->_providerInfo['api_params'])) {
$postDataArray['mo'] = $this->_providerInfo['api_params']['mo'];
}
// sendmsg with callback request:
$postDataArray['callback'] = 3;
$isTest = 0;
if (array_key_exists('is_test', $this->_providerInfo['api_params']) && $this->_providerInfo['api_params']['is_test'] == 1) {
$isTest = 1;
}
/**
* Check if we are using a queue when sending as each account
* with Clickatell is assigned three queues namely 1, 2 and 3.
*/
if (isset($header['queue']) && is_numeric($header['queue'])) {
if (in_array($header['queue'], range(1, 3))) {
$postDataArray['queue'] = $header['queue'];
}
}
/**
* Must we escalate message delivery if message is stuck in
* the queue at Clickatell?
*/
if (isset($header['escalate']) && !empty($header['escalate'])) {
if (is_numeric($header['escalate'])) {
if (in_array($header['escalate'], range(1, 2))) {
$postDataArray['escalate'] = $header['escalate'];
}
}
}
if ($isTest == 1) {
$response = array('data' => 'ID:' . rand());
} else {
$postData = CRM_Utils_Array::urlEncode($postDataArray);
$response = $this->curl($url, $postData);
}
if (PEAR::isError($response)) {
return $response;
}
$send = explode(":", $response['data']);
if ($send[0] == "ID") {
//trim whitespace around the id
$apiMsgID = trim($send[1], " \t\r\n");
$this->createActivity($apiMsgID, $message, $header, $jobID);
return $apiMsgID;
} else {
// delete any parent activity & throw error
if (CRM_Utils_Array::value('parent_activity_id', $header)) {
$params = array('id' => $header['parent_activity_id']);
CRM_Activity_BAO_Activity::deleteActivity($params);
}
return PEAR::raiseError($response['data']);
}
}
}