class-evf-settings-email.php
3 years ago
class-evf-settings-general.php
5 years ago
class-evf-settings-integrations.php
6 years ago
class-evf-settings-misc.php
2 years ago
class-evf-settings-page.php
7 years ago
class-evf-settings-recaptcha.php
2 years ago
class-evf-settings-validation.php
6 years ago
class-evf-settings-integrations.php
92 lines
| 1 | <?php |
| 2 | /** |
| 3 | * EverestForms Integration Settings |
| 4 | * |
| 5 | * @package EverestForms\Admin |
| 6 | * @version 1.3.0 |
| 7 | */ |
| 8 | |
| 9 | defined( 'ABSPATH' ) || exit; |
| 10 | |
| 11 | if ( class_exists( 'EVF_Settings_Integrations', false ) ) { |
| 12 | return new EVF_Settings_Integrations(); |
| 13 | } |
| 14 | |
| 15 | /** |
| 16 | * EVF_Settings_Integrations. |
| 17 | */ |
| 18 | class EVF_Settings_Integrations extends EVF_Settings_Page { |
| 19 | |
| 20 | /** |
| 21 | * Constructor. |
| 22 | */ |
| 23 | public function __construct() { |
| 24 | $this->id = 'integration'; |
| 25 | $this->label = esc_html__( 'Integration', 'everest-forms' ); |
| 26 | |
| 27 | if ( isset( evf()->integrations ) && evf()->integrations->get_integrations() ) { |
| 28 | parent::__construct(); |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * Output the settings. |
| 34 | */ |
| 35 | public function output() { |
| 36 | global $current_section, $hide_save_button; |
| 37 | |
| 38 | // Hide the save button. |
| 39 | $GLOBALS['hide_save_button'] = true; |
| 40 | |
| 41 | $integrations = evf()->integrations->get_integrations(); |
| 42 | |
| 43 | if ( '' === $current_section ) { |
| 44 | $this->output_integrations( $integrations ); |
| 45 | } else { |
| 46 | if ( isset( $integrations[ $current_section ] ) ) { |
| 47 | $integrations[ $current_section ]->output_integration(); |
| 48 | } |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Handles output of the integrations page in admin. |
| 54 | * |
| 55 | * @param array $integrations Array of integrations. |
| 56 | */ |
| 57 | protected function output_integrations( $integrations ) { |
| 58 | ?> |
| 59 | <h2><?php esc_html_e( 'Integrations', 'everest-forms' ); ?></h2> |
| 60 | <div class="everest-forms-integrations-connection"> |
| 61 | <?php foreach ( $integrations as $integration ) : ?> |
| 62 | <div class="everest-forms-integrations"> |
| 63 | <div class="integration-header-info"> |
| 64 | <div class="integration-status"> |
| 65 | <span class="toggle-switch-outer <?php echo esc_attr( $integration->account_status ); ?>"></span> |
| 66 | </div> |
| 67 | <div class="integration-detail"> |
| 68 | <figure class="logo"> |
| 69 | <img src="<?php echo esc_url( $integration->icon ); ?>" alt="<?php echo esc_attr( $integration->method_title ); ?>" /> |
| 70 | </figure> |
| 71 | <div class="integration-info"> |
| 72 | <a href="<?php echo esc_url( admin_url( 'admin.php?page=evf-settings&tab=integration§ion=' . $integration->id ) ); ?>"> |
| 73 | <h3><?php echo esc_html( $integration->method_title ); ?></h3> |
| 74 | </a> |
| 75 | <p><?php echo esc_html( $integration->method_description ); ?></p> |
| 76 | </div> |
| 77 | </div> |
| 78 | </div> |
| 79 | <div class="integartion-action"> |
| 80 | <a class="integration-setup" href="<?php echo esc_url( admin_url( 'admin.php?page=evf-settings&tab=integration§ion=' . $integration->id ) ); ?>"> |
| 81 | <span class="evf-icon evf-icon-setting-cog"></span> |
| 82 | </a> |
| 83 | </div> |
| 84 | </div> |
| 85 | <?php endforeach; ?> |
| 86 | </div> |
| 87 | <?php |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | return new EVF_Settings_Integrations(); |
| 92 |