Skip to content

Commit

Permalink
Merge pull request #57 from mailchimp/develop
Browse files Browse the repository at this point in the history
Releasing v1.0.2
  • Loading branch information
ciaobeau authored Oct 13, 2016
2 parents 2dc6034 + 94c38de commit 6e28575
Show file tree
Hide file tree
Showing 36 changed files with 639 additions and 530 deletions.
16 changes: 10 additions & 6 deletions admin/class-mailchimp-woocommerce-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ protected function validatePostApiKey($input)
'mailchimp_account_info_username' => null,
);

$api = new MailChimpApi($data['mailchimp_api_key']);
$api = new MailChimp_WooCommerce_MailChimpApi($data['mailchimp_api_key']);

$valid = true;

Expand Down Expand Up @@ -263,6 +263,10 @@ protected function validatePostStoreInfo($input)
add_settings_error('mailchimp_store_settings', '', 'As part of the MailChimp Terms of Use, we require a contact email and a physical mailing address.');
}

if (empty($data['store_phone']) || strlen($data['store_phone']) <= 6) {
add_settings_error('mailchimp_store_settings', '', 'As part of the MailChimp Terms of Use, we require a valid phone number for your store.');
}

$this->setData('validation.store_info', false);
return array();
}
Expand Down Expand Up @@ -472,7 +476,7 @@ private function createMailChimpList($data = null)
}
}

$submission = new MailChimp_CreateListSubmission();
$submission = new MailChimp_WooCommerce_CreateListSubmission();

// allow the subscribers to choose preferred email type (html or text).
$submission->setEmailTypeOption(true);
Expand Down Expand Up @@ -507,7 +511,7 @@ private function createMailChimpList($data = null)

return $list_id;

} catch (MailChimp_Error $e) {
} catch (MailChimp_WooCommerce_Error $e) {
$this->setData('errors.mailchimp_list', $e->getMessage());
return false;
}
Expand All @@ -529,7 +533,7 @@ private function syncStore($data = null)

if (!($store = $this->api()->getStore($site_url))) {
$new = true;
$store = new MailChimp_Store();
$store = new MailChimp_WooCommerce_Store();
}

$list_id = $this->array_get($data, 'mailchimp_list', false);
Expand Down Expand Up @@ -571,11 +575,11 @@ private function syncStore($data = null)

/**
* @param array $data
* @return MailChimp_Address
* @return MailChimp_WooCommerce_Address
*/
private function address(array $data)
{
$address = new MailChimp_Address();
$address = new MailChimp_WooCommerce_Address();

if (isset($data['store_street']) && $data['store_street']) {
$address->setAddress1($data['store_street']);
Expand Down
7 changes: 6 additions & 1 deletion admin/partials/mailchimp-woocommerce-admin-tabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,14 @@
$show_sync_tab = true;
}
}

?>

<?php if (!defined('PHP_VERSION_ID') || (PHP_VERSION_ID < 50600)): ?>
<div class="error notice is-dismissable">
<p><?php _e('MailChimp says: Please upgrade your PHP version to a minimum of 5.6', 'mailchimp-woocommerce'); ?></p>
</div>
<?php endif; ?>

<!-- Create a header in the default WordPress 'wrap' container -->
<div class="wrap">
<div id="icon-themes" class="icon32"></div>
Expand Down
2 changes: 1 addition & 1 deletion admin/partials/tabs/store_info.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
<select name="<?php echo $this->plugin_name; ?>[store_currency_code]" style="width:30%" required>
<?php
$selected_currency_code = isset($options['store_currency_code']) && !empty($options['store_currency_code']) ? $options['store_currency_code'] : 'USD';
foreach (MailChimp_Api_CurrencyCodes::lists() as $key => $value ) {
foreach (MailChimp_WooCommerce_CurrencyCodes::lists() as $key => $value ) {
echo '<option value="' . esc_attr( $key ) . '" ' . selected($key === $selected_currency_code, true, false ) . '>' . esc_html( $value ) . '</option>';
}
?>
Expand Down
20 changes: 20 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
** 0.1.22 **
* flag quantity as 1 if the product does not manage inventory

** 0.1.21 **
* php version check to display warnings < 5.5

** 0.1.19 **
* fix campaign tracking on new orders

** 0.1.18 **
* check woocommerce dependency before activating the plugin

** 0.1.17 **
* fix php version syntax errors for array's

** 0.1.16 **
* fix namespace conflicts
* fix free order 0.00 issue
* fix product variant naming issue

** 0.1.15 **
* adding special MailChimp header to requests

Expand Down
30 changes: 15 additions & 15 deletions includes/api/assets/class-mailchimp-address.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Date: 3/8/16
* Time: 2:22 PM
*/
class MailChimp_Address
class MailChimp_WooCommerce_Address
{
protected $type;
protected $name;
Expand Down Expand Up @@ -54,7 +54,7 @@ public function getName()

/**
* @param mixed $name
* @return MailChimp_Address
* @return MailChimp_WooCommerce_Address
*/
public function setName($name)
{
Expand All @@ -73,7 +73,7 @@ public function getAddress1()

/**
* @param mixed $address1
* @return MailChimp_Address
* @return MailChimp_WooCommerce_Address
*/
public function setAddress1($address1)
{
Expand All @@ -92,7 +92,7 @@ public function getAddress2()

/**
* @param mixed $address2
* @return MailChimp_Address
* @return MailChimp_WooCommerce_Address
*/
public function setAddress2($address2)
{
Expand All @@ -111,7 +111,7 @@ public function getCity()

/**
* @param mixed $city
* @return MailChimp_Address
* @return MailChimp_WooCommerce_Address
*/
public function setCity($city)
{
Expand All @@ -130,7 +130,7 @@ public function getProvince()

/**
* @param mixed $province
* @return MailChimp_Address
* @return MailChimp_WooCommerce_Address
*/
public function setProvince($province)
{
Expand All @@ -149,7 +149,7 @@ public function getProvinceCode()

/**
* @param mixed $province_code
* @return MailChimp_Address
* @return MailChimp_WooCommerce_Address
*/
public function setProvinceCode($province_code)
{
Expand All @@ -168,7 +168,7 @@ public function getPostalCode()

/**
* @param mixed $postal_code
* @return MailChimp_Address
* @return MailChimp_WooCommerce_Address
*/
public function setPostalCode($postal_code)
{
Expand All @@ -187,7 +187,7 @@ public function getCountry()

/**
* @param mixed $country
* @return MailChimp_Address
* @return MailChimp_WooCommerce_Address
*/
public function setCountry($country)
{
Expand All @@ -206,7 +206,7 @@ public function getCountryCode()

/**
* @param mixed $country_code
* @return MailChimp_Address
* @return MailChimp_WooCommerce_Address
*/
public function setCountryCode($country_code)
{
Expand All @@ -225,7 +225,7 @@ public function getLongitude()

/**
* @param mixed $longitude
* @return MailChimp_Address
* @return MailChimp_WooCommerce_Address
*/
public function setLongitude($longitude)
{
Expand All @@ -244,7 +244,7 @@ public function getLatitude()

/**
* @param mixed $latitude
* @return MailChimp_Address
* @return MailChimp_WooCommerce_Address
*/
public function setLatitude($latitude)
{
Expand All @@ -263,7 +263,7 @@ public function getPhone()

/**
* @param mixed $phone
* @return MailChimp_Address
* @return MailChimp_WooCommerce_Address
*/
public function setPhone($phone)
{
Expand All @@ -282,7 +282,7 @@ public function getCompany()

/**
* @param mixed $company
* @return MailChimp_Address
* @return MailChimp_WooCommerce_Address
*/
public function setCompany($company)
{
Expand Down Expand Up @@ -315,7 +315,7 @@ public function toArray()

/**
* @param array $data
* @return MailChimp_Address
* @return MailChimp_WooCommerce_Address
*/
public function fromArray(array $data)
{
Expand Down
24 changes: 12 additions & 12 deletions includes/api/assets/class-mailchimp-cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Date: 7/15/16
* Time: 1:26 PM
*/
class MailChimp_Cart
class MailChimp_WooCommerce_Cart
{
protected $store_id;
protected $id;
Expand Down Expand Up @@ -63,23 +63,23 @@ public function getStoreID()
}

/**
* @param MailChimp_Customer $customer
* @param MailChimp_WooCommerce_Customer $customer
* @return $this
*/
public function setCustomer(MailChimp_Customer $customer)
public function setCustomer(MailChimp_WooCommerce_Customer $customer)
{
$this->customer = $customer;

return $this;
}

/**
* @return MailChimp_Customer
* @return MailChimp_WooCommerce_Customer
*/
public function getCustomer()
{
if (empty($this->customer)) {
$this->customer = new MailChimp_Customer();
$this->customer = new MailChimp_WooCommerce_Customer();
}

return $this->customer;
Expand Down Expand Up @@ -190,10 +190,10 @@ public function getTaxTotal()
}

/**
* @param MailChimp_LineItem $item
* @param MailChimp_WooCommerce_LineItem $item
* @return $this
*/
public function addItem(MailChimp_LineItem $item)
public function addItem(MailChimp_WooCommerce_LineItem $item)
{
$this->lines[] = $item;
return $this;
Expand Down Expand Up @@ -245,14 +245,14 @@ public function toArrayForUpdate()

/**
* @param array $data
* @return MailChimp_Cart
* @return MailChimp_WooCommerce_Cart
*/
public function fromArray(array $data)
{
$singles = [
$singles = array(
'store_id', 'id', 'campaign_id', 'checkout_url',
'currency_code', 'order_total', 'tax_total',
];
);

foreach ($singles as $key) {
if (array_key_exists($key, $data)) {
Expand All @@ -261,12 +261,12 @@ public function fromArray(array $data)
}

if (array_key_exists('customer', $data) && is_array($data['customer'])) {
$this->customer = (new MailChimp_Customer())->fromArray($data['customer']);
$this->customer = (new MailChimp_WooCommerce_Customer())->fromArray($data['customer']);
}

if (array_key_exists('lines', $data) && is_array($data['lines'])) {
foreach ($data['lines'] as $line_item) {
$this->lines[] = (new MailChimp_LineItem)->fromArray($line_item);
$this->lines[] = (new MailChimp_WooCommerce_LineItem)->fromArray($line_item);
}
}

Expand Down
Loading

0 comments on commit 6e28575

Please sign in to comment.