PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.12
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.12
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
formidable / classes / models / FrmRecaptchaSettings.php

FrmRecaptchaSettings.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 6.12, at classes/models/FrmRecaptchaSettings.php

128 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 die( 'You are not allowed to call this page directly.' );
4 }
5
6 /**
7 * @since 6.8.4
8 */
9 class FrmRecaptchaSettings extends FrmFieldCaptchaSettings {
10
11 /**
12 * @since 6.8.4
13 *
14 * @return void
15 */
16 protected function set_endpoint() {
17 $this->endpoint = 'https://www.google.com/recaptcha/api/siteverify';
18 }
19
20 /**
21 * @since 6.11.1
22 *
23 * @return string
24 */
25 public function get_name() {
26 return 'reCAPTCHA';
27 }
28
29 /**
30 * @since 6.8.4
31 *
32 * @return string
33 */
34 public function get_element_class_name() {
35 return 'g-recaptcha';
36 }
37
38 /**
39 * @since 6.8.4
40 *
41 * @return string
42 */
43 public function get_documentation_url() {
44 return 'https://www.google.com/recaptcha/';
45 }
46
47 /**
48 * @since 6.8.4
49 *
50 * @return string
51 */
52 public function get_site_key_tooltip() {
53 return __( 'reCAPTCHA is a free, accessible CAPTCHA service that helps to digitize books while blocking spam on your blog. reCAPTCHA asks commenters to retype two words scanned from a book to prove that they are a human. This verifies that they are not a spambot.', 'formidable' );
54 }
55
56 /**
57 * Add additional element attributes for reCAPTCHA.
58 *
59 * @since 6.8.4
60 *
61 * @param array $attributes
62 * @param array $field
63 * @return array
64 */
65 public function add_front_end_element_attributes( $attributes, $field ) {
66 $attributes = parent::add_front_end_element_attributes( $attributes, $field );
67 $captcha_size = $attributes['data-size'];
68
69 if ( $captcha_size === 'invisible' && ! $this->frm_settings->re_multi ) {
70 $attributes['data-callback'] = 'frmAfterRecaptcha';
71 }
72
73 return $attributes;
74 }
75
76 /**
77 * @since 6.8.4
78 *
79 * @param array $field
80 * @return string
81 */
82 protected function get_captcha_size( $field ) {
83 if ( $this->captcha_is_invisible() ) {
84 return 'invisible';
85 }
86 return parent::get_captcha_size( $field );
87 }
88
89 /**
90 * Show the Captcha field size setting if the captcha is visible.
91 *
92 * @since 6.8.4
93 *
94 * @return bool
95 */
96 public function should_show_captcha_size() {
97 return ! $this->captcha_is_invisible();
98 }
99
100 /**
101 * @since 6.8.4
102 *
103 * @return bool
104 */
105 public function should_show_captcha_theme() {
106 return ! $this->captcha_is_invisible();
107 }
108
109 /**
110 * @since 6.8.4
111 *
112 * @return bool
113 */
114 private function captcha_is_invisible() {
115 return in_array( $this->frm_settings->re_type, array( 'invisible', 'v3' ), true );
116 }
117
118 /**
119 * @since 6.8.4
120 * @deprecated 6.11.1
121 * @return string
122 */
123 public function getName() {
124 _deprecated_function( __METHOD__, '6.11.1' );
125 return $this->get_name();
126 }
127 }
128