: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* Wrapper for GetResponse's API.
* @package ET\Core\API\Email
class ET_Core_API_Email_GetResponse extends ET_Core_API_Email_Provider {
public $BASE_URL = 'https://api.getresponse.com/v3';
public $FIELDS_URL = 'https://api.getresponse.com/v3/custom-fields';
public $LISTS_URL = 'https://api.getresponse.com/v3/campaigns';
public $SUBSCRIBE_URL = 'https://api.getresponse.com/v3/contacts';
public $name = 'GetResponse';
public $name_field_only = true;
public $slug = 'getresponse';
* @internal If true, oauth endpoints properties must also be defined.
public $uses_oauth = false;
public function __construct( $owner = '', $account_name = '', $api_key = '' ) {
parent::__construct( $owner, $account_name, $api_key );
$this->_maybe_set_custom_headers();
protected function _maybe_set_custom_headers() {
if ( empty( $this->custom_headers ) && isset( $this->data['api_key'] ) ) {
$this->custom_headers = array( 'X-Auth-Token' => "api-key {$this->data['api_key']}" );
protected function _process_custom_fields( $args ) {
if ( ! isset( $args['custom_fields'] ) ) {
$fields_unprocessed = $args['custom_fields'];
unset( $args['custom_fields'] );
foreach ( $fields_unprocessed as $field_id => $value ) {
if ( is_array( $value ) && $value ) {
// This is a multiple choice field (eg. checkbox, radio, select)
$value = array_values( $value );
$value = array( $value );
'customFieldId' => $field_id,
$args['customFieldValues'] = $fields;
public function get_account_fields() {
'label' => esc_html__( 'API Key', 'et_core' ),
public function get_data_keymap( $keymap = array() ) {
'list_id' => 'campaignId',
'subscribers_count' => 'totalSubscribers',
'list_id' => 'campaign.campaignId',
'ip_address' => 'ipAddress',
'custom_fields' => 'custom_fields',
'error_message' => 'message',
'field_id' => 'customFieldId',
'custom_field_type' => array(
'textarea' => 'textarea',
'checkbox' => 'checkbox',
'select' => 'single_select',
'single_select' => 'select',
return parent::get_data_keymap( $keymap );
public function fetch_subscriber_lists() {
if ( empty( $this->data['api_key'] ) ) {
return $this->API_KEY_REQUIRED;
$this->_maybe_set_custom_headers();
$this->response_data_key = false;
return parent::fetch_subscriber_lists();
public function subscribe( $args, $url = '' ) {
$ip_address = 'true' === self::$_->array_get( $args, 'ip_address', 'true' ) ? et_core_get_ip_address() : '0.0.0.0';
$args['ip_address'] = $ip_address;
$args = $this->transform_data_to_provider_format( $args, 'subscriber' );
$args = $this->_process_custom_fields( $args );
$args['note'] = $this->SUBSCRIBED_VIA;
if ( empty( $args['name'] ) ) {
$this->prepare_request( $this->SUBSCRIBE_URL, 'POST', false, $args );
return parent::subscribe( $args, $this->SUBSCRIBE_URL );