You are here

function constant_contact_create_object in Constant Contact 6.2

Same name and namespace in other branches
  1. 6.3 constant_contact.module \constant_contact_create_object()
  2. 7.3 constant_contact.module \constant_contact_create_object()

Helper method, creates an object of the cc class Used in many functions throughout

11 calls to constant_contact_create_object()
constant_contact_add_list_form_submit in ./contactlists.admin.inc
Submit handler for the add contact list admin page
constant_contact_delete_list_form_submit in ./contactlists.admin.inc
Submit handler for the delete contact list admin page
constant_contact_edit_list_form in ./contactlists.admin.inc
Displays the manage contact lists page in the admin
constant_contact_edit_list_form_submit in ./contactlists.admin.inc
Submit handler for the add contact list admin page
constant_contact_form_user_register_alter in ./constant_contact.module
Alter the user registration form

... See full list

File

./constant_contact.module, line 808

Code

function constant_contact_create_object() {
  $username = variable_get('constant_contact_username', '');
  $password = variable_get('constant_contact_password', '');
  $api_key = variable_get('constant_contact_api_key', '');
  if ($username && $password && $api_key) {
    require_once dirname(__FILE__) . '/class.cc.php';
    $cc = new cc($username, $password, $api_key);

    // check we can connect to the API
    if ($cc
      ->get_service_description()) {
      return $cc;
    }
  }
  return false;
}