__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
<?php
namespace ElementorPro\Modules\Forms\Classes;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

class Convertkit_Handler {
	/*
	 * @var Rest_Client
	 */
	private $rest_client = null;
	private $api_key = '';

	/**
	 * Convertkit_Handler constructor.
	 *
	 * @param $api_key
	 *
	 * @throws \Exception
	 */
	public function __construct( $api_key ) {
		if ( empty( $api_key ) ) {
			throw new \Exception( 'Invalid API key.' );
		}

		$this->init_rest_client( $api_key );

		if ( ! $this->is_valid_api_key() ) {
			throw new \Exception( 'Invalid API key.' );
		}
	}

	private function init_rest_client( $api_key ) {
		$this->api_key = $api_key;
		$this->rest_client = new Rest_Client( 'https://api.convertkit.com/v3/' );
	}

	/**
	 * validate api key
	 *
	 * @return bool
	 * @throws \Exception
	 */
	private function is_valid_api_key() {
		$forms = $this->get_forms();
		if ( ! empty( $forms ) ) {
			return true;
		}
		$this->api_key = '';

		return false;
	}

	public function get_forms_and_tags() {
		$forms = $this->get_forms();
		$tags = $this->get_tags();

		return [
			'data' => [
				'forms' => $forms['forms'],
				'tags' => $tags['tags'],
			],
		];
	}

	/**
	 * get GetResponse lists associated with API key
	 * @return array
	 * @throws \Exception
	 */
	public function get_forms() {
		$results = $this->rest_client->get( 'forms/?api_key=' . $this->api_key );

		$forms = [
			'' => esc_html__( 'Select...', 'elementor-pro' ),
		];

		if ( ! empty( $results['body']['forms'] ) ) {
			foreach ( $results['body']['forms'] as $index => $form ) {
				if ( ! is_array( $form ) ) {
					continue;
				}
				$forms[ $form['id'] ] = $form['name'];
			}
		}

		$return_array = [
			'forms' => $forms,
		];

		return $return_array;
	}

	public function get_tags() {
		$results = $this->rest_client->get( 'tags/?api_key=' . $this->api_key );

		$tags = [
			'' => esc_html__( 'Select...', 'elementor-pro' ),
		];

		if ( ! empty( $results['body']['tags'] ) ) {
			foreach ( $results['body']['tags'] as $index => $tag ) {
				if ( ! is_array( $tag ) ) {
					continue;
				}
				$tags[ $tag['id'] ] = $tag['name'];
			}
		}

		$return_array = [
			'tags' => $tags,
		];

		return $return_array;
	}

	/**
	 * create contact at ConvertKit via api
	 *
	 * @param array $subscriber_data
	 *
	 * @return array|mixed
	 * @throws \Exception
	 */
	public function create_subscriber( $form_id, $subscriber_data = [] ) {
		$endpoint = sprintf( 'forms/' . $form_id . '/subscribe?api_key=%s', $this->api_key );
		$this->rest_client->add_headers( 'Content-Type', 'application/json' );

		return $this->rest_client->post( $endpoint, $subscriber_data );
	}
}

Filemanager

Name Type Size Permission Actions
action-base.php File 812 B 0664
activecampaign-handler.php File 3.07 KB 0664
ajax-handler.php File 8.97 KB 0664
akismet.php File 5.4 KB 0664
convertkit-handler.php File 2.61 KB 0664
drip-handler.php File 2.01 KB 0664
form-base.php File 8.11 KB 0664
form-record.php File 9.56 KB 0664
getresponse-handler.php File 3.03 KB 0664
honeypot-handler.php File 2.73 KB 0664
integration-base.php File 2.36 KB 0664
mailchimp-handler.php File 4.33 KB 0664
mailerlite-handler.php File 2.56 KB 0664
recaptcha-handler.php File 8.79 KB 0664
recaptcha-v3-handler.php File 4.55 KB 0664
rest-client.php File 4.34 KB 0664
Filemanager