* @access public
* @static
*/
- public static function &replaceDomainTokens($str, &$domain, $html = FALSE, $knownTokens = NULL, $escapeSmarty = FALSE) {
+ public static function &replaceDomainTokens(
+ $str,
+ &$domain,
+ $html = FALSE,
+ $knownTokens = NULL,
+ $escapeSmarty = FALSE
+ ) {
$key = 'domain';
- if (!$knownTokens ||
+ if (
+ !$knownTokens ||
!CRM_Utils_Array::value($key, $knownTokens)
) {
return $str;
}
- $str = preg_replace(self::tokenRegex($key), 'self::getDomainTokenReplacement(\'\\1\',$domain,$html)', $str);
+ $str = preg_replace(
+ self::tokenRegex($key),
+ 'self::getDomainTokenReplacement(\'\\1\',$domain,$html)',
+ $str
+ );
return $str;
}
* @static
*/
public static function &replaceOrgTokens($str, &$org, $html = FALSE, $escapeSmarty = FALSE) {
- self::$_tokens['org'] = array_merge(array_keys(CRM_Contact_BAO_Contact::importableFields('Organization')),
- array('address', 'display_name', 'checksum', 'contact_id')
- );
+ self::$_tokens['org'] =
+ array_merge(
+ array_keys(CRM_Contact_BAO_Contact::importableFields('Organization')),
+ array('address', 'display_name', 'checksum', 'contact_id')
+ );
$cv = NULL;
foreach (self::$_tokens['org'] as $token) {
* @access public
* @static
*/
- public static function &replaceMailingTokens($str, &$mailing, $html = FALSE, $knownTokens = NULL, $escapeSmarty = FALSE) {
+ public static function &replaceMailingTokens(
+ $str,
+ &$mailing,
+ $html = FALSE,
+ $knownTokens = NULL,
+ $escapeSmarty = FALSE
+ ) {
$key = 'mailing';
if (!$knownTokens || !isset($knownTokens[$key])) {
return $str;
return $str;
}
- public static function getActionTokenReplacement($token, &$addresses, &$urls, $html = FALSE, $escapeSmarty = FALSE) {
+ public static function getActionTokenReplacement(
+ $token,
+ &$addresses,
+ &$urls,
+ $html = FALSE,
+ $escapeSmarty = FALSE
+ ) {
/* If the token is an email action, use it. Otherwise, find the
* appropriate URL */
* @access public
* @static
*/
- public static function &replaceContactTokens($str, &$contact, $html = FALSE, $knownTokens = NULL,
- $returnBlankToken = FALSE, $escapeSmarty = FALSE
+ public static function &replaceContactTokens(
+ $str,
+ &$contact,
+ $html = FALSE,
+ $knownTokens = NULL,
+ $returnBlankToken = FALSE,
+ $escapeSmarty = FALSE
) {
$key = 'contact';
if (self::$_tokens[$key] == NULL) {
/* This should come from UF */
- self::$_tokens[$key] = array_merge(array_keys(CRM_Contact_BAO_Contact::exportableFields('All')),
- array('checksum', 'contact_id')
- );
+ self::$_tokens[$key] =
+ array_merge(
+ array_keys(CRM_Contact_BAO_Contact::exportableFields('All')),
+ array('checksum', 'contact_id')
+ );
}
// here we intersect with the list of pre-configured valid tokens
return $str;
}
- $str = preg_replace(self::tokenRegex($key),
+ $str = preg_replace(
+ self::tokenRegex($key),
'self::getContactTokenReplacement(\'\\1\', $contact, $html, $returnBlankToken, $escapeSmarty)',
$str
);
return $str;
}
- public static function getContactTokenReplacement($token, &$contact, $html = FALSE,
- $returnBlankToken = FALSE, $escapeSmarty = FALSE
+ public static function getContactTokenReplacement(
+ $token,
+ &$contact,
+ $html = FALSE,
+ $returnBlankToken = FALSE,
+ $escapeSmarty = FALSE
) {
if (self::$_tokens['contact'] == NULL) {
/* This should come from UF */
- self::$_tokens['contact'] = array_merge(array_keys(CRM_Contact_BAO_Contact::exportableFields('All')),
- array('checksum', 'contact_id')
- );
+ self::$_tokens['contact'] =
+ array_merge(
+ array_keys(CRM_Contact_BAO_Contact::exportableFields('All')),
+ array('checksum', 'contact_id')
+ );
}
/* Construct value from $token and $contact */
* @access public
* @static
*/
- public static function &replaceHookTokens($str, &$contact, &$categories, $html = FALSE, $escapeSmarty = FALSE) {
-
+ public static function &replaceHookTokens(
+ $str,
+ &$contact,
+ &$categories,
+ $html = FALSE,
+ $escapeSmarty = FALSE
+ ) {
foreach ($categories as $key) {
- $str = preg_replace(self::tokenRegex($key),
+ $str = preg_replace(
+ self::tokenRegex($key),
'self::getHookTokenReplacement(\'\\1\', $contact, $key, $html, $escapeSmarty)',
$str
);
return $str;
}
- public static function getHookTokenReplacement($token, &$contact, $category, $html = FALSE, $escapeSmarty = FALSE) {
+ public static function getHookTokenReplacement(
+ $token,
+ &$contact,
+ $category,
+ $html = FALSE,
+ $escapeSmarty = FALSE
+ ) {
$value = CRM_Utils_Array::value("{$category}.{$token}", $contact);
- if ($value &&
- !$html
- ) {
+ if ($value && !$html) {
$value = str_replace('&', '&', $value);
}