Changeset 2006018
- Timestamp:
- 01/04/2019 12:09:01 AM (7 years ago)
- Location:
- magic-action-box/trunk
- Files:
-
- 1 added
- 16 deleted
- 6 edited
-
lib/classes/MAB_Ajax.php (modified) (1 diff)
-
lib/classes/ProsulumMabAdmin.php (modified) (9 diffs)
-
lib/classes/ProsulumMabBase.php (modified) (4 diffs)
-
lib/integration/mailchimp/MAB_MailChimp.php (added)
-
lib/integration/mailchimp/Mailchimp.php (deleted)
-
lib/integration/mailchimp/Mailchimp/Campaigns.php (deleted)
-
lib/integration/mailchimp/Mailchimp/Conversations.php (deleted)
-
lib/integration/mailchimp/Mailchimp/Ecomm.php (deleted)
-
lib/integration/mailchimp/Mailchimp/Exceptions.php (deleted)
-
lib/integration/mailchimp/Mailchimp/Folders.php (deleted)
-
lib/integration/mailchimp/Mailchimp/Gallery.php (deleted)
-
lib/integration/mailchimp/Mailchimp/Goal.php (deleted)
-
lib/integration/mailchimp/Mailchimp/Helper.php (deleted)
-
lib/integration/mailchimp/Mailchimp/Lists.php (deleted)
-
lib/integration/mailchimp/Mailchimp/Mobile.php (deleted)
-
lib/integration/mailchimp/Mailchimp/Neapolitan.php (deleted)
-
lib/integration/mailchimp/Mailchimp/Reports.php (deleted)
-
lib/integration/mailchimp/Mailchimp/Templates.php (deleted)
-
lib/integration/mailchimp/Mailchimp/Users.php (deleted)
-
lib/integration/mailchimp/Mailchimp/Vip.php (deleted)
-
lib/shortcodes.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
views/metaboxes/optin-providers/mailchimp.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
magic-action-box/trunk/lib/classes/MAB_Ajax.php
r1292020 r2006018 62 62 63 63 if(is_object($api) && method_exists($api, $_POST['task'])){ 64 $resultArray['result'] = $api-> $_POST['task']();64 $resultArray['result'] = $api->{$_POST['task']}(); 65 65 $this->log("API {$_POST['api']} and Task {$_POST['task']} exists", 'debug'); 66 66 } else { -
magic-action-box/trunk/lib/classes/ProsulumMabAdmin.php
r1345184 r2006018 1351 1351 */ 1352 1352 function initMailChimp(){ 1353 require_once MAB_LIB_DIR . 'integration/mailchimp/M ailchimp.php';1353 require_once MAB_LIB_DIR . 'integration/mailchimp/MAB_MailChimp.php'; 1354 1354 1355 1355 $settings = $this->getSettings(); … … 1360 1360 1361 1361 try{ 1362 $mailchimp = new Mailchimp($key); 1362 $mailchimp = new MAB_MailChimp($key); 1363 $params = array("fields" => 'account_id,account_name'); 1364 $response = $mailchimp->get('', $params); 1363 1365 } catch(Exception $e){ 1364 1366 $this->log('Failed to initialize MailChimp: ' . $e->getMessage(), 'debug'); … … 1366 1368 } 1367 1369 1368 if($mailchimp instanceof M ailchimp){1370 if($mailchimp instanceof MAB_MailChimp && $mailchimp->success()){ 1369 1371 return $mailchimp; 1370 1372 } else { … … 1382 1384 //returns all lists 1383 1385 function getMailChimpLists( $forceUpdate = false ) { 1384 1385 1386 if( !$forceUpdate ){ 1386 1387 //check from cache … … 1396 1397 $mailchimp = $this->initMailChimp(); 1397 1398 1398 if($mailchimp instanceof Mailchimp) { 1399 1399 if($mailchimp instanceof MAB_MailChimp) { 1400 1400 try{ 1401 $data = $mailchimp->lists->getList(array(), 0, 100); 1401 // $data = $mailchimp->lists->getList(array(), 0, 100); 1402 $data = $mailchimp->get('lists', array('fields' => 'lists.id,lists.name', 'count' => 30)); 1402 1403 } catch(Exception $e) { 1403 1404 $this->log($e->getMessage(), 'debug'); … … 1405 1406 } 1406 1407 1407 if( is_array($data) && is_array($data['data'])) {1408 foreach($data[' data'] as $item) {1409 $lists[] = array('id' => $item['id'], 'name' => $item['name'] , 'data' => $item);1408 if($mailchimp->success() && is_array($data) && is_array($data['lists'])) { 1409 foreach($data['lists'] as $item) { 1410 $lists[] = array('id' => $item['id'], 'name' => $item['name'] ); 1410 1411 } 1411 1412 } … … 1425 1426 1426 1427 try { 1427 $data = $mailchimp-> lists->getList( array( 'list_id' => $listId ));1428 $data = $mailchimp->get('lists/' . $listId, array('fields' => 'id,name,subscribe_url_long')); 1428 1429 } catch(Exception $e){ 1429 1430 $this->log($e->getMessage(), 'debug'); … … 1432 1433 1433 1434 //return empty string if no data 1434 if( empty( $data ) )1435 if( !$mailchimp->success() || empty( $data ) ) 1435 1436 return ''; 1436 1437 //get only the required data in subarray 1438 $data = $data['data'][0]; 1439 1437 1440 1438 return $data; 1441 1439 } … … 1446 1444 1447 1445 $mailchimp = $this->initMailChimp(); 1446 $groups = array(); 1448 1447 1449 1448 if(empty($mailchimp)) return array(); 1450 1449 1451 1450 try { 1452 $groups = $mailchimp->lists->interestGroupings( $listId ); 1451 $categories_res = $mailchimp->get('lists/' . $listId . '/interest-categories', array('fields' => 'categories.id,categories.title', 'count' => 20)); 1452 1453 if(!$mailchimp->success()){ 1454 return array(); 1455 } 1456 foreach($categories_res['categories'] as $cat) { 1457 $interests_resp = $mailchimp->get('lists/'.$listId.'/interest-categories/'.$cat['id'].'/interests', array('fields'=>'interests.id,interests.name', 'count' => '20')); 1458 if(empty($interests_resp['interests'])) continue; 1459 1460 $cat['groups'] = $interests_resp['interests']; 1461 $groups[] = $cat; 1462 } 1453 1463 } catch(Exception $e){ 1454 1464 $this->log($e->getMessage(), 'debug'); -
magic-action-box/trunk/lib/classes/ProsulumMabBase.php
r1167732 r2006018 426 426 * MailChimp 427 427 */ 428 public static function require_mailchimp(){ 429 require_once MAB_LIB_DIR . 'integration/mailchimp/MAB_MailChimp.php'; 430 } 431 428 432 function get_mailchimp_merge_vars( $id ) { 429 require_once MAB_LIB_DIR . 'integration/mailchimp/Mailchimp.php'; 430 433 self::require_mailchimp(); 431 434 $settings = MAB('settings')->getAll(); 432 435 $mailchimp = new Mailchimp($settings['optin']['mailchimp-api']); … … 445 448 446 449 function get_mailchimp_account_details( $apikey = '' ){ 447 require_once MAB_LIB_DIR . 'integration/mailchimp/Mailchimp.php';450 self::require_mailchimp(); 448 451 if( empty( $apikey ) ){ 449 452 $settings = MAB('settings')->getAll(); … … 451 454 } 452 455 $mailchimp = new Mailchimp($apikey); 453 $details = $mailchimp->helper->accountDetails(); 456 457 $details = $mailchimp->get('', array('fields' => 'account_id,account_name')); 454 458 return $details; 455 459 } … … 460 464 } 461 465 462 require_once MAB_LIB_DIR . 'integration/mailchimp/Mailchimp.php';466 self::require_mailchimp(); 463 467 464 468 try{ 465 $mailchimp = new Mailchimp($key); 466 $res = $mailchimp->helper->ping(); 467 if( !$res ) 468 return array( 'error' => __( 'Invalid MailChimp API key - ' . $res, 'mab' ) ); 469 $mailchimp = new MAB_MailChimp($key); 470 $params = array("fields" => 'account_id,account_name'); 471 $res = $mailchimp->get('', $params); 472 473 if( !$mailchimp->success() ) 474 return array( 'error' => __( 'Invalid MailChimp API key - ' . $mailchimp->getLastError(), 'mab' ) ); 469 475 470 476 } catch(Exception $e){ -
magic-action-box/trunk/lib/shortcodes.php
r1163410 r2006018 11 11 'force_show' => false 12 12 ); 13 13 14 extract( shortcode_atts( $default, $atts ) ); 14 15 … … 33 34 $atts = shortcode_atts( $default, $atts ); 34 35 35 $atts['text'] = trim($content);36 36 $atts['text'] = do_shortcode(trim($content)); 37 37 38 return mab_button( $atts ); 38 39 } -
magic-action-box/trunk/readme.txt
r1465564 r2006018 4 4 Tags: opt in, call to action, aweber, email, email marketing, form, mailing list, marketing, newsletter, webform, mailchimp, constant contact 5 5 Requires at least: 3.5 6 Tested up to: 4.67 Stable tag: 2.17. 16 Tested up to: 5.0.2 7 Stable tag: 2.17.2 8 8 9 9 Magic Action Box let's you display professional looking opt-in forms and feature boxes in your WordPress site. … … 100 100 101 101 == Changelog == 102 103 = 2.17.2 = 104 *2019-01-03 105 *Fix PHP7 error - Indirect access to variables, properties and methods will be evaluated strictly in left-to-right order since PHP 7.0. Use curly braces to remove ambiguity. 106 102 107 = 2.17.1 = 103 108 *2016-02-07* -
magic-action-box/trunk/views/metaboxes/optin-providers/mailchimp.php
r1134385 r2006018 51 51 <option value=""><?php _e('None', 'mab'); ?></option> 52 52 <?php foreach($mcGroups as $i => $grouping): ?> 53 <optgroup label="<?php echo $grouping[' name']; ?>">53 <optgroup label="<?php echo $grouping['title']; ?>"> 54 54 <?php if(!empty($grouping['groups'])): foreach($grouping['groups'] as $j => $group): 55 $groupVal = sprintf('group[%1$s][%2$s]', $grouping['id'], $group[' bit']);55 $groupVal = sprintf('group[%1$s][%2$s]', $grouping['id'], $group['id']); 56 56 ?> 57 57 <option value="<?php echo $groupVal; ?>" <?php selected($selected_mc_group, $groupVal); ?>><?php echo $group['name']; ?></option>
Note: See TracChangeset
for help on using the changeset viewer.