3 require_once 'recaptcha.civix.php';
5 use CRM_Recaptcha_ExtensionUtil
as E
;
9 * Implements hook_civicrm_config().
11 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_config/
13 function recaptcha_civicrm_config(&$config) {
14 _recaptcha_civix_civicrm_config($config);
18 * Implements hook_civicrm_xmlMenu().
20 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_xmlMenu
22 function recaptcha_civicrm_xmlMenu(&$files) {
23 _recaptcha_civix_civicrm_xmlMenu($files);
27 * Implements hook_civicrm_install().
29 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_install
31 function recaptcha_civicrm_install() {
32 _recaptcha_civix_civicrm_install();
36 * Implements hook_civicrm_postInstall().
38 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_postInstall
40 function recaptcha_civicrm_postInstall() {
41 _recaptcha_civix_civicrm_postInstall();
45 * Implements hook_civicrm_uninstall().
47 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_uninstall
49 function recaptcha_civicrm_uninstall() {
50 _recaptcha_civix_civicrm_uninstall();
54 * Implements hook_civicrm_enable().
56 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_enable
58 function recaptcha_civicrm_enable() {
59 _recaptcha_civix_civicrm_enable();
63 * Implements hook_civicrm_disable().
65 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_disable
67 function recaptcha_civicrm_disable() {
68 _recaptcha_civix_civicrm_disable();
72 * Implements hook_civicrm_upgrade().
74 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_upgrade
76 function recaptcha_civicrm_upgrade($op, CRM_Queue_Queue
$queue = NULL) {
77 return _recaptcha_civix_civicrm_upgrade($op, $queue);
81 * Implements hook_civicrm_managed().
83 * Generate a list of entities to create/deactivate/delete when this module
84 * is installed, disabled, uninstalled.
86 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_managed
88 function recaptcha_civicrm_managed(&$entities) {
89 _recaptcha_civix_civicrm_managed($entities);
93 * Implements hook_civicrm_angularModules().
95 * Generate a list of Angular modules.
97 * Note: This hook only runs in CiviCRM 4.5+. It may
98 * use features only available in v4.6+.
100 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_angularModules
102 function recaptcha_civicrm_angularModules(&$angularModules) {
103 _recaptcha_civix_civicrm_angularModules($angularModules);
107 * Implements hook_civicrm_alterSettingsFolders().
109 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterSettingsFolders
111 function recaptcha_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) {
112 _recaptcha_civix_civicrm_alterSettingsFolders($metaDataFolders);
116 * Implements hook_civicrm_entityTypes().
118 * Declare entity types provided by this module.
120 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_entityTypes
122 function recaptcha_civicrm_entityTypes(&$entityTypes) {
123 _recaptcha_civix_civicrm_entityTypes($entityTypes);
127 * Implements hook_civicrm_navigationMenu().
129 function recaptcha_civicrm_navigationMenu(&$menu) {
130 _recaptcha_civix_insert_navigation_menu($menu, 'Administer/System Settings', [
131 'label' => E
::ts('reCAPTCHA Settings'),
132 'name' => 'recaptcha_settings',
133 'url' => 'civicrm/admin/setting/recaptcha',
134 'permission' => 'administer CiviCRM',
138 _recaptcha_civix_navigationMenu($menu);
142 * Intercept form functions
144 function recaptcha_civicrm_buildForm($formName, &$form) {
146 case 'CRM_Admin_Form_Generic':
147 if ($form->getSettingPageFilter() !== 'recaptcha') {
152 'reCAPTCHA is a free service that helps prevent automated abuse of your site. To use it on public-facing CiviCRM forms: sign up at <a href="%1" target="_blank">Google\'s reCaptcha site</a>; enter the provided public and private keys here; then enable reCAPTCHA under Advanced Settings in any Profile.',
154 1 => 'https://www.google.com/recaptcha',
157 . '<br/><strong>' . E
::ts('Only the reCAPTCHA v2 checkbox type is supported.') . '</strong>';
159 ->addMarkup('<div class="help">' . $helpText . '</div>', [
161 'region' => 'page-body',