Merge pull request #11197 from agileware/CRM-21104
[civicrm-core.git] / CRM / Utils / ReCAPTCHA.php
index de4021bb1f938298699761021db931c4ccb39d17..808615993097f2fca0e910c6781b7224125c9932 100644 (file)
@@ -62,6 +62,29 @@ class CRM_Utils_ReCAPTCHA {
     return self::$_singleton;
   }
 
+
+  /**
+   * Check if reCaptcha settings is avilable to add on form.
+   */
+  public static function hasSettingsAvailable() {
+    $config = CRM_Core_Config::singleton();
+    if ($config->recaptchaPublicKey == NULL || $config->recaptchaPublicKey == "") {
+      return FALSE;
+    }
+    return TRUE;
+  }
+
+  /**
+   * Check if reCaptcha has to be added on form forcefully.
+   */
+  public static function hasToAddForcefully() {
+    $config = CRM_Core_Config::singleton();
+    if (!$config->forceRecaptcha) {
+      return FALSE;
+    }
+    return TRUE;
+  }
+
   /**
    * Add element to form.
    *