form_id = $form_id; $captcha->date_created = date('Y-m-d H:i:s'); $captcha->save(); } public static function isActive($form_id) { $total = self::getCollection() ->count() ->where('form_id','=',$form_id) ->and_where('date_created','>=',date('Y-m-d H:i:s',time()-CAPTCHA_SLEEP_TIME)) ->get('co'); return ($total >= CAPTCHA_SLEEP_MAX_REQUESTS); } public static function cleanUp() { self::getCollection() ->delete() ->where('date_created','<',date('Y-m-d',time()-3600)) ->execute() ; } public static function getTypes() { return array( self::TYPE_NONE => \Zira\Locale::t('Do not use'), self::TYPE_DEFAULT => \Zira\Locale::t('Default'), self::TYPE_RECAPTCHA => \Zira\Locale::t('Google reCaptcha v2'), self::TYPE_RECAPTCHA_v3 => \Zira\Locale::t('Google reCaptcha v3') ); } }