legacy
6 years ago
class-evf-background-process.php
7 years ago
class-evf-deprecated-hooks.php
6 years ago
class-evf-form-fields.php
6 years ago
class-evf-integration.php
7 years ago
class-evf-log-handler.php
6 years ago
class-evf-session.php
8 years ago
class-evf-settings-api.php
6 years ago
class-evf-integration.php
83 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Abstract Integration class |
| 4 | * |
| 5 | * Extension of the Settings API which in turn gets extended |
| 6 | * by individual integrations to offer additional functionality. |
| 7 | * |
| 8 | * @package EverestForms\Abstracts |
| 9 | * @since 1.3.0 |
| 10 | */ |
| 11 | |
| 12 | defined( 'ABSPATH' ) || exit; |
| 13 | |
| 14 | /** |
| 15 | * Abstract Integration Class. |
| 16 | */ |
| 17 | abstract class EVF_Integration extends EVF_Settings_API { |
| 18 | |
| 19 | /** |
| 20 | * Yes or no based on whether the integration is enabled. |
| 21 | * |
| 22 | * @var string |
| 23 | */ |
| 24 | public $enabled = 'yes'; |
| 25 | |
| 26 | /** |
| 27 | * Integration icon. |
| 28 | * |
| 29 | * @var string |
| 30 | */ |
| 31 | public $icon = ''; |
| 32 | |
| 33 | /** |
| 34 | * Integration title. |
| 35 | * |
| 36 | * @var string |
| 37 | */ |
| 38 | public $method_title = ''; |
| 39 | |
| 40 | /** |
| 41 | * Integration description. |
| 42 | * |
| 43 | * @var string |
| 44 | */ |
| 45 | public $method_description = ''; |
| 46 | |
| 47 | /** |
| 48 | * Return the title for admin screens. |
| 49 | * |
| 50 | * @return string |
| 51 | */ |
| 52 | public function get_method_title() { |
| 53 | return apply_filters( 'everest_forms_integration_title', $this->method_title, $this ); |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Return the description for admin screens. |
| 58 | * |
| 59 | * @return string |
| 60 | */ |
| 61 | public function get_method_description() { |
| 62 | return apply_filters( 'everest_forms_integration_description', $this->method_description, $this ); |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Output the gateway settings screen. |
| 67 | */ |
| 68 | public function admin_options() { |
| 69 | echo '<h2>' . esc_html( $this->get_method_title() ) . '</h2>'; |
| 70 | echo wp_kses_post( wpautop( $this->get_method_description() ) ); |
| 71 | echo '<div><input type="hidden" name="section" value="' . esc_attr( $this->id ) . '" /></div>'; |
| 72 | parent::admin_options(); |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * Init settings for gateways. |
| 77 | */ |
| 78 | public function init_settings() { |
| 79 | parent::init_settings(); |
| 80 | $this->enabled = ! empty( $this->settings['enabled'] ) && 'yes' === $this->settings['enabled'] ? 'yes' : 'no'; |
| 81 | } |
| 82 | } |
| 83 |