| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
die( 'You are not allowed to call this page directly.' ); |
| 5 |
} |
| 6 |
|
| 7 |
/** |
| 8 |
* @since 3.0 |
| 9 |
*/ |
| 10 |
class FrmFieldCreditCard extends FrmFieldType { |
| 11 |
|
| 12 |
/** |
| 13 |
* @var string |
| 14 |
* |
| 15 |
* @since 3.0 |
| 16 |
*/ |
| 17 |
protected $type = 'credit_card'; |
| 18 |
|
| 19 |
/** |
| 20 |
* @var bool |
| 21 |
* |
| 22 |
* @since 3.0 |
| 23 |
*/ |
| 24 |
protected $has_for_label = false; |
| 25 |
|
| 26 |
/** |
| 27 |
* @return array |
| 28 |
*/ |
| 29 |
protected function field_settings_for_type() { |
| 30 |
return array( |
| 31 |
'clear_on_focus' => false, |
| 32 |
'description' => false, |
| 33 |
'default' => false, |
| 34 |
'required' => false, |
| 35 |
); |
| 36 |
} |
| 37 |
|
| 38 |
protected function include_form_builder_file() { |
| 39 |
return FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/field-credit-card.php'; |
| 40 |
} |
| 41 |
|
| 42 |
/** |
| 43 |
* @param array $args |
| 44 |
* @param array $shortcode_atts |
| 45 |
* |
| 46 |
* @return string |
| 47 |
*/ |
| 48 |
public function front_field_input( $args, $shortcode_atts ) { |
| 49 |
$pass_args = array( |
| 50 |
'errors' => $args['errors'], |
| 51 |
'html_id' => $args['html_id'], |
| 52 |
'field_id' => $args['field_id'], |
| 53 |
); |
| 54 |
|
| 55 |
ob_start(); |
| 56 |
|
| 57 |
if ( FrmAppHelper::is_style_editor_page() || FrmFormsHelper::is_block_or_page_builder_preview() ) { |
| 58 |
// Payment gateway scripts are unavailable in preview contexts, use the builder placeholder. |
| 59 |
$field = $this->field; |
| 60 |
include $this->include_form_builder_file(); |
| 61 |
} else { |
| 62 |
FrmStrpLiteActionsController::show_card( $this->field, $args['field_name'], $pass_args ); |
| 63 |
} |
| 64 |
|
| 65 |
return ob_get_clean(); |
| 66 |
} |
| 67 |
} |
| 68 |
|