Current Path: > home > transcarter > > > www > > > > wp-content > plugins > elementor-pro > modules > forms > classes
Operation : Linux host59.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64 Software : Apache Server IP : 198.54.126.42 | Your IP: 216.73.216.135 Domains : 1034 Domain(s) Permission : [ 0755 ]
Name | Type | Size | Last Modified | Actions |
---|---|---|---|---|
action-base.php | File | 812 bytes | March 09 2023 22:15:58. | |
activecampaign-handler.php | File | 3141 bytes | March 09 2023 22:15:58. | |
ajax-handler.php | File | 9131 bytes | March 09 2023 22:15:58. | |
convertkit-handler.php | File | 2671 bytes | March 09 2023 22:15:58. | |
drip-handler.php | File | 2063 bytes | March 09 2023 22:15:58. | |
form-base.php | File | 8361 bytes | March 09 2023 22:15:58. | |
form-record.php | File | 9660 bytes | March 09 2023 22:15:58. | |
getresponse-handler.php | File | 3103 bytes | March 09 2023 22:15:58. | |
honeypot-handler.php | File | 2796 bytes | March 09 2023 22:15:58. | |
integration-base.php | File | 2496 bytes | March 09 2023 22:15:58. | |
mailchimp-handler.php | File | 4422 bytes | March 09 2023 22:15:58. | |
mailerlite-handler.php | File | 2620 bytes | March 09 2023 22:15:58. | |
recaptcha-handler.php | File | 8989 bytes | March 09 2023 22:15:58. | |
recaptcha-v3-handler.php | File | 4663 bytes | March 09 2023 22:15:58. | |
rest-client.php | File | 4436 bytes | March 09 2023 22:15:58. |
<?php namespace ElementorPro\Modules\Forms\Classes; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Drip_Handler { private $rest_client = null; private $api_token = ''; /** * Drip_Handler constructor. * * @param $api_token * * @throws \Exception */ public function __construct( $api_token ) { if ( empty( $api_token ) ) { throw new \Exception( 'Invalid API key.' ); } $this->init_rest_client( $api_token ); if ( ! $this->is_valid_api_token() ) { throw new \Exception( 'Invalid API key.' ); } } private function init_rest_client( $api_token ) { $this->api_token = $api_token; $this->rest_client = new Rest_Client( 'https://api.getdrip.com/v2/' ); $this->rest_client->add_headers( [ 'Authorization' => 'Basic ' . base64_encode( $this->api_token ), 'Content-Type' => 'application/vnd.api+json', ] ); } /** * validate api token * * @return bool * @throws \Exception */ private function is_valid_api_token() { $accounts = $this->get_accounts(); if ( ! empty( $accounts ) ) { return true; } $this->api_token = ''; return false; } /** * get drip accounts associated with API token * @return array * @throws \Exception */ public function get_accounts() { $results = $this->rest_client->get( 'accounts' ); $accounts = [ '' => esc_html__( 'Select...', 'elementor-pro' ), ]; if ( ! empty( $results['body']['accounts'] ) ) { foreach ( $results['body']['accounts'] as $index => $account ) { $accounts[ $account['id'] ] = $account['name']; } } $return_array = [ 'accounts' => $accounts, ]; return $return_array; } /** * create subscriber at drip via api * * @param string $account_id * @param array $subscriber_data * * @return array|mixed * @throws \Exception */ public function create_subscriber( $account_id = '', $subscriber_data = [] ) { $end_point = sprintf( '%s/subscribers/', $account_id ); return $this->rest_client->post( $end_point, [ 'subscribers' => [ $subscriber_data ] ] ); } }
SILENT KILLER Tool