From 4ba89c9f993a26aa85c84e88e04d07b0c56f7728 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Mon, 16 Mar 2015 10:21:24 -0400
Subject: [PATCH] Backport new utility function for compatibility reasons

---
 program/lib/Roundcube/rcube_utils.php |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/program/lib/Roundcube/rcube_utils.php b/program/lib/Roundcube/rcube_utils.php
index f4c0e90..e6f9493 100644
--- a/program/lib/Roundcube/rcube_utils.php
+++ b/program/lib/Roundcube/rcube_utils.php
@@ -985,6 +985,28 @@
     }
 
     /**
+     * Compare two strings for matching words (order not relevant)
+     *
+     * @param string Haystack
+     * @param string Needle
+     * @return boolen True if match, False otherwise
+     */
+    public static function words_match($haystack, $needle)
+    {
+        $a_needle = self::tokenize_string($needle, 1);
+        $haystack = join(" ", self::tokenize_string($haystack, 1));
+
+        $hits = 0;
+        foreach ($a_needle as $w) {
+            if (stripos($haystack, $w) !== false) {
+                $hits++;
+            }
+        }
+
+        return $hits >= count($a_needle);
+    }
+
+    /**
      * Parse commandline arguments into a hash array
      *
      * @param array $aliases Argument alias names

--
Gitblit v1.9.1