Merge pull request #679 from davecivicrm/CRM-12397
[civicrm-core.git] / CRM / Utils / Token.php
index c5349cc0719fa2ed59748d09e952f1c75d532bd1..1047ceca4b57921ba9524a72c8363d0c86679e84 100644 (file)
@@ -81,6 +81,8 @@ class CRM_Utils_Token {
       'phone',
       'address',
       'email',
+      'id',
+      'description',
     ),
     'subscribe' => array( 'group' ),
     'unsubscribe' => array( 'group' ),
@@ -153,7 +155,7 @@ class CRM_Utils_Token {
    */
   public static function token_match($type, $var, &$str) {
     $token = preg_quote('{' . "$type.$var") . '(\|.+?)?' . preg_quote('}');
-    return preg_match("/(^|[^\{]) $token/", $str);
+    return preg_match("/(^|[^\{])$token/", $str);
   }
 
   /**
@@ -274,7 +276,7 @@ class CRM_Utils_Token {
         $addressCache[$cache_key] = $value;
       }
     }
-    elseif ($token == 'name' || $token == 'id') {
+    elseif ($token == 'name' || $token == 'id' || $token == 'description') {
       $value = $domain->$token;
     }
     elseif ($token == 'phone' || $token == 'email') {