| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Text Field Class |
| 5 |
*/ |
| 6 |
class WeForms_Form_Field_HumanPresence extends WeForms_Field_Contract { |
| 7 |
|
| 8 |
public function __construct() { |
| 9 |
$this->name = __( 'HP Anti-Spam', 'weforms' ); |
| 10 |
$this->input_type = 'humanpresence'; |
| 11 |
$this->icon = 'humanpresence'; |
| 12 |
} |
| 13 |
|
| 14 |
/** |
| 15 |
* Render the field |
| 16 |
* |
| 17 |
* @param array $field_settings |
| 18 |
* @param int $form_id |
| 19 |
* |
| 20 |
* @return void |
| 21 |
*/ |
| 22 |
public function render( $field_settings, $form_id ) { |
| 23 |
|
| 24 |
} |
| 25 |
|
| 26 |
/** |
| 27 |
* Custom validator |
| 28 |
* |
| 29 |
* @return array |
| 30 |
*/ |
| 31 |
public function get_validator() { |
| 32 |
return [ |
| 33 |
'callback' => 'has_humanpresence_installed', |
| 34 |
'button_class' => 'button-faded', |
| 35 |
'msg_title' => __( 'Human Presence Anti-Spam Required', 'weforms' ), |
| 36 |
'msg' => apply_filters( 'wpuf-form-builder-humanpresence-validation-msg', sprintf( |
| 37 |
__( 'To enable Human Presence Anti-Spam on weForms, <a href="%s" target="_blank">Install and activate the plugin</a> on your site. Once installed, toggle on the weForms form you want to protect.', 'weforms' ), |
| 38 |
// admin_url( 'admin.php?page=weforms#/settings' ), |
| 39 |
'http://www.humanpresence.io/weforms-signup' |
| 40 |
) ), |
| 41 |
]; |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* Get field options setting |
| 46 |
* |
| 47 |
* @return array |
| 48 |
*/ |
| 49 |
public function get_options_settings() { |
| 50 |
$settings = [ |
| 51 |
]; |
| 52 |
|
| 53 |
return $settings; |
| 54 |
} |
| 55 |
|
| 56 |
/** |
| 57 |
* Get the field props |
| 58 |
* |
| 59 |
* @return array |
| 60 |
*/ |
| 61 |
public function get_field_props() { |
| 62 |
$props = [ |
| 63 |
'template' => $this->get_type(), |
| 64 |
'label' => '', |
| 65 |
'is_meta' => 'yes', |
| 66 |
'id' => 0, |
| 67 |
'is_new' => true, |
| 68 |
'wpuf_cond' => null, |
| 69 |
]; |
| 70 |
|
| 71 |
return $props; |
| 72 |
} |
| 73 |
|
| 74 |
} |
| 75 |
|