Merge pull request #16711 from eileenmcnaughton/deprecated
[civicrm-core.git] / CRM / Utils / String.php
index 95eda6658d340e5bad3215a370b397249c0bbe93..1c878580af9a2dd1c74e484d5aff80702d426905 100644 (file)
@@ -433,7 +433,7 @@ class CRM_Utils_String {
    *   the converted string
    */
   public static function htmlToText($html) {
-    require_once 'packages/html2text/rcube_html2text.php';
+    require_once 'html2text/rcube_html2text.php';
     $token_html = preg_replace('!\{([a-z_.]+)\}!i', 'token:{$1}', $html);
     $converter = new rcube_html2text($token_html);
     $token_text = $converter->get_text();
@@ -952,4 +952,23 @@ class CRM_Utils_String {
     }
   }
 
+  /**
+   * Returns the plural form of an English word.
+   *
+   * @param string $str
+   * @return string
+   */
+  public static function pluralize($str) {
+    switch (substr($str, -1)) {
+      case 's':
+        return $str . 'es';
+
+      case 'y':
+        return substr($str, 0, -1) . 'ies';
+
+      default:
+        return $str . 's';
+    }
+  }
+
 }