/** * Lookup as much information as we can about the supporter's location * by passing their given address fields into the warehouse. * * @return array An array of parameters we can pass into targetJSON.sjs */ public function getLocation() { $p = array(); if (!empty($this->Country)) { $p['country'] = $this->Country; } else { $p['country'] = 'us'; } if (!empty($this->State)) { $p['region'] = $this->State; } if (!empty($this->Zip)) { $p['postal_code'] = $this->Zip; } if (!empty($this->PRIVATE_Zip_Plus_4)) { $p['postal_code_extension'] = $this->PRIVATE_Zip_Plus_4; } if (!empty($this->Street)) { $p['address1'] = $this->Street; } // Lookup the supporter's location $conn = SAPSalsaConnector::instance(); if ($conn) { $q = $conn->postJson('http://warehouse.democracyinaction.org/salsa/api/warehouse/append.jsp', array_merge(array('json' => 'true'), $p)); } if (!empty($q)) { $p = (array) $q; } return $p; }
/** * Saves this object to Salsa. */ public function save() { $conn = SAPSalsaConnector::instance(); if ($conn) { $conn->saveObject($this->object, $this); } }
function salsa_campaigns_salsa_logon() { $salsa_campaigns_options = get_option('salsa_campaigns_options'); return SAPSalsaConnector::initialize($salsa_campaigns_options['salsa_url'], $salsa_campaigns_options['salsa_username'], $salsa_campaigns_options['salsa_password']); }