Merge remote-tracking branch 'upstream/4.4' into 4.4-master-2014-08-04-22-25-32
[civicrm-core.git] / CRM / Utils / QueryFormatter.php
index baa8f36f3e98b0046aa4b87e2649a881cbfa20a4..4222339b65db34e4b0a4f2de02d0b816e6ec74bd 100644 (file)
@@ -192,10 +192,18 @@ class CRM_Utils_QueryFormatter {
     if (empty($text)) {
       $result = '*';
     }
+    elseif (strpos($text, '+') !== FALSE || strpos($text, '-') !== FALSE) {
+      // if user supplies their own include/exclude operators, use text as is (with trailing wildcard)
+      $result = $this->mapWords($text, 'word*');
+    }
     elseif (strpos($text, '*') !== FALSE) {
       // if user supplies their own wildcards, then don't do any sophisticated changes
       $result = $this->mapWords($text, '+word');
     }
+    elseif (preg_match('/^(["\']).*\1$/m', $text)) {
+      // if surrounded by quotes, use term as is
+      $result = $text;
+    }
     else {
       switch ($mode) {
         case self::MODE_NONE: