WPCF7_ConstantContact::get_contact_lists()publicCF7 1.0

Метод класса: WPCF7_ConstantContact{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$WPCF7_ConstantContact = new WPCF7_ConstantContact();
$WPCF7_ConstantContact->get_contact_lists();

Код WPCF7_ConstantContact::get_contact_lists() CF7 6.0.1

public function get_contact_lists() {
	$endpoint = 'https://api.cc.email/v3/contact_lists';

	$request = array(
		'method' => 'GET',
		'headers' => array(
			'Accept' => 'application/json',
			'Content-Type' => 'application/json; charset=utf-8',
		),
	);

	$response = $this->remote_request( $endpoint, $request );

	if ( 400 <= (int) wp_remote_retrieve_response_code( $response ) ) {
		if ( WP_DEBUG ) {
			$this->log( $endpoint, $request, $response );
		}

		return false;
	}

	$response_body = wp_remote_retrieve_body( $response );

	if ( empty( $response_body ) ) {
		return false;
	}

	$response_body = json_decode( $response_body, true );

	if ( ! empty( $response_body['lists'] ) ) {
		return (array) $response_body['lists'];
	} else {
		return array();
	}
}