use \HelsingborgStad\RecaptchaIntegration as Captcha;
add_action('wp_enqueue_scripts', 'getScripts', 999);
function getScripts(){
Captcha::initScripts();
}
add_action('pre_comment_on_post', 'reCaptchaValidation');
function reCaptchaValidation() {
if (is_user_logged_in()) {
return;
}
Captcha::initCaptcha();
}
namespace YourTheme\YourCommentLogicNameSpace;
use \HelsingborgStad\RecaptchaIntegration as Captcha;
/**
* Class CommentsFrontEnd
* @package YourTheme\YourCommentLogicNameSpace
*/
class CommentsFrontEnd
{
/**
* CommentFrontEnd constructor.
*/
public function __construct()
{
add_action('wp_enqueue_scripts', array($this, 'getScripts'), 999);
}
/**
* Enqueue Google Captcha javaScripts
*/
public static function getScripts(){
Captcha::initScripts();
}
}
namespace YourTheme\YourCommentLogicNameSpace;
use \HelsingborgStad\RecaptchaIntegration as Captcha;
/**
* Class CommentsBackEnd
* @package YourTheme\YourCommentLogicNameSpace
*/
class CommentsBackEnd
{
/**
* CommentsBackEnd constructor.
*/
public function __construct()
{
add_action('pre_comment_on_post', array($this, 'reCaptchaValidation'));
}
/**
* Validate reCaptcha
*/
public function reCaptchaValidation()
{
if (is_user_logged_in()) {
return;
}
Captcha::initCaptcha();
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.