HEX
Server: Apache
System: Linux web15f74.uni5.net 5.4.282-1.el8.elrepo.x86_64 #1 SMP Mon Aug 19 18:33:22 EDT 2024 x86_64
User: lucendi (859622)
PHP: 7.4.33
Disabled: apache_child_terminate,c99_buff_prepare,c99_sess_put,dl,exec,leak,link,myshellexec,openlog,passthru,pclose,pcntl_exec,php_check_syntax,php_strip_whitespace,popen,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,symlink,system,socket_listen,socket_create_listen,putenv
Upload Files
File: /home/lucendi/www/wp-content/themes/divi/core/components/api/email/MailPoet.php
<?php

/**
 * Wrapper for MailPoet's API.
 *
 * @since   3.0.76
 *
 * @package ET\Core\API\Email
 */
class ET_Core_API_Email_MailPoet extends ET_Core_API_Email_Provider {

	/**
	 * @var ET_Core_API_Email_Provider
	 */
	private $_MP;

	public static $PLUGIN_REQUIRED;

	/**
	 * @inheritDoc
	 */
	public $name = 'MailPoet';

	/**
	 * @inheritDoc
	 */
	public $slug = 'mailpoet';

	public function __construct( $owner = '', $account_name = '', $api_key = '' ) {
		parent::__construct( $owner, $account_name, $api_key );

		if ( null === self::$PLUGIN_REQUIRED ) {
			self::$PLUGIN_REQUIRED = esc_html__( 'MailPoet plugin is either not installed or not activated.', 'et_core' );
		}

		$has_php53 = version_compare( PHP_VERSION, '5.3', '>=' );

		if ( $has_php53 && class_exists( '\MailPoet\API\API' ) ) {
			require_once( ET_CORE_PATH . 'components/api/email/_MailPoet3.php' );
			$this->_init_provider_class( '3', $owner, $account_name, $api_key );

		} else if ( class_exists( 'WYSIJA' ) ) {
			require_once( ET_CORE_PATH . 'components/api/email/_MailPoet2.php' );
			$this->_init_provider_class( '2', $owner, $account_name, $api_key );
		}
	}

	protected function _init_provider_class( $version = '2', $owner, $account_name, $api_key ) {
		if ( '3' === $version ) {
			$this->_MP = new ET_Core_API_Email_MailPoet3( $owner, $account_name, $api_key );
		} else {
			$this->_MP = new ET_Core_API_Email_MailPoet2( $owner, $account_name, $api_key );
		}
	}

	/**
	 * @inheritDoc
	 */
	public function get_account_fields() {
		return array();
	}

	/**
	 * @inheritDoc
	 */
	public function get_data_keymap( $keymap = array(), $custom_fields_key = '' ) {
		if ( $this->_MP ) {
			return $this->_MP->get_data_keymap( $keymap, $custom_fields_key );
		}

		$keymap = array(
			'list'       => array(
				'list_id' => 'id',
				'name'    => 'name',
			),
			'subscriber' => array(
				'name'      => 'first_name',
				'last_name' => 'last_name',
				'email'     => 'email',
			),
		);

		return parent::get_data_keymap( $keymap, $custom_fields_key );
	}

	/**
	 * @inheritDoc
	 */
	public function fetch_subscriber_lists() {
		return $this->_MP ? $this->_MP->fetch_subscriber_lists() : self::$PLUGIN_REQUIRED;
	}

	/**
	 * @inheritDoc
	 */
	public function subscribe( $args, $url = '' ) {
		return $this->_MP ? $this->_MP->subscribe( $args, $url ) : self::$PLUGIN_REQUIRED;
	}
}