Merge pull request #4771 from pratikshad/CRM-15409
[civicrm-core.git] / CRM / Utils / ReCAPTCHA.php
index efad639019fc9754aec750bebac6fab311f626f8..f570bd2ffcfbf01c15f9e1817cd2e5c7cf17af94 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -52,7 +52,7 @@ class CRM_Utils_ReCAPTCHA {
   static private $_singleton = NULL;
 
   /**
-   * singleton function used to manage this object
+   * Singleton function used to manage this object
    *
    * @param string the key to permit session scope's
    *
@@ -67,6 +67,9 @@ class CRM_Utils_ReCAPTCHA {
     return self::$_singleton;
   }
 
+  /**
+   *
+   */
   function __construct() {}
 
   /**
@@ -77,7 +80,9 @@ class CRM_Utils_ReCAPTCHA {
     $error  = NULL;
     $config = CRM_Core_Config::singleton();
     $useSSL = FALSE;
-    require_once 'packages/recaptcha/recaptchalib.php';
+    if ( !function_exists( 'recaptcha_get_html' ) ) {
+      require_once 'packages/recaptcha/recaptchalib.php';
+    }
 
     // See if we are using SSL
     if (CRM_Utils_System::isSSL()) {
@@ -109,6 +114,12 @@ class CRM_Utils_ReCAPTCHA {
     );
   }
 
+  /**
+   * @param $value
+   * @param CRM_Core_Form $form
+   *
+   * @return mixed
+   */
   static function validate($value, $form) {
     $config = CRM_Core_Config::singleton();