/
cccinvisiblerecaptcha.php
38 lines (26 loc) · 996 Bytes
/
cccinvisiblerecaptcha.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/**
* @package Joomla.Plugin
* @subpackage Fields.Cccinvisiblerecaptcha
*
* @copyright Copyright (C) 2017 Coolcat-Creations.com
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::import('components.com_fields.libraries.fieldsplugin', JPATH_ADMINISTRATOR);
class PlgFieldsCccinvisiblerecaptcha extends FieldsPlugin
{
public function onCustomFieldsPrepareDom($field, DOMElement $parent, JForm $form)
{
JHtml::_('script', 'https://www.google.com/recaptcha/api.js', array('version' => 'auto', 'defer' => true, 'async' => true));
$plugin = JPluginHelper::getPlugin('fields', 'cccinvisiblerecaptcha');
$globalparams = new JRegistry($plugin->params);
$secretkey = $globalparams->get('secretkey');
?>
<div id='recaptcha' class="g-recaptcha"
data-sitekey="<?php echo $secretkey; ?>"
data-callback="onSubmit"
data-size="invisible"></div>
<?php
}
}