PHP Classes

File: application/helpers/gcaptcha_helper.php

Recommend this page to a friend!
  Classes of Eray Akartuna  >  CodeIgniter ReCaptcha plugin  >  application/helpers/gcaptcha_helper.php  >  Download  
File: application/helpers/gcaptcha_helper.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: CodeIgniter ReCaptcha plugin
Perform validation using Recaptcha in CodeIgniter
Author: By
Last change:
Date: 5 years ago
Size: 1,159 bytes
 

Contents

Class file image Download
<?php defined('BASEPATH') OR exit('No direct script access allowed');

/**
 * Google ReCaptcha Helper
 *
 * @package CodeIgniter
 * @subpackage Helpers
 * @category Helpers
 * @author Eray Akartuna - http://eray.info
 */

// ------------------------------------------------------------------------

if (!function_exists('create_gcaptcha')) {
   
/**
     * Create ReCAPTCHA
     *
     */
   
function create_gcaptcha()
    {
       
$ci = get_instance();

        try {
            if (!
$ci->config->item('enable_gcaptcha')) {
                throw new
Exception('Google ReCaptcha must be enabled on the config.');
            }
        } catch (
Exception $e) {
           
var_dump($e->getMessage());
        }

       
$return = "<script src='https://www.google.com/recaptcha/api.js'></script>";
       
$return .= '<div class="g-recaptcha" data-sitekey="' . $ci->config->item('gcaptcha_client_secret') . '"></div>';
        return
$return;
    }
}

if (!
function_exists('gcaptcha_error')) {
   
/**
     * Create ReCAPTCHA
     *
     */
   
function gcaptcha_error()
    {
        return
form_error('g-recaptcha-response');
    }
}



For more information send a message to info at phpclasses dot org.