Plugin Directory

Changeset 2006018


Ignore:
Timestamp:
01/04/2019 12:09:01 AM (7 years ago)
Author:
pogidude
Message:

Deploy from git

Location:
magic-action-box/trunk
Files:
1 added
16 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • magic-action-box/trunk/lib/classes/MAB_Ajax.php

    r1292020 r2006018  
    6262
    6363            if(is_object($api) && method_exists($api, $_POST['task'])){
    64                 $resultArray['result'] = $api->$_POST['task']();
     64                $resultArray['result'] = $api->{$_POST['task']}();
    6565                $this->log("API {$_POST['api']} and Task {$_POST['task']} exists", 'debug');
    6666            } else {
  • magic-action-box/trunk/lib/classes/ProsulumMabAdmin.php

    r1345184 r2006018  
    13511351     */
    13521352    function initMailChimp(){
    1353         require_once MAB_LIB_DIR . 'integration/mailchimp/Mailchimp.php';
     1353        require_once MAB_LIB_DIR . 'integration/mailchimp/MAB_MailChimp.php';
    13541354
    13551355        $settings = $this->getSettings();
     
    13601360
    13611361        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);
    13631365        } catch(Exception $e){
    13641366            $this->log('Failed to initialize MailChimp: ' . $e->getMessage(), 'debug');
     
    13661368        }
    13671369
    1368         if($mailchimp instanceof Mailchimp){
     1370        if($mailchimp instanceof MAB_MailChimp && $mailchimp->success()){
    13691371            return $mailchimp;
    13701372        } else {
     
    13821384    //returns all lists
    13831385    function getMailChimpLists( $forceUpdate = false ) {
    1384        
    13851386        if( !$forceUpdate ){
    13861387            //check from cache
     
    13961397        $mailchimp = $this->initMailChimp();
    13971398
    1398         if($mailchimp instanceof Mailchimp) {
    1399 
     1399        if($mailchimp instanceof MAB_MailChimp) {
    14001400            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));
    14021403            } catch(Exception $e) {
    14031404                $this->log($e->getMessage(), 'debug');
     
    14051406            }
    14061407
    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'] );
    14101411                }
    14111412            }
     
    14251426
    14261427        try {
    1427             $data = $mailchimp->lists->getList( array( 'list_id' => $listId ) );
     1428            $data = $mailchimp->get('lists/' . $listId, array('fields' => 'id,name,subscribe_url_long'));
    14281429        } catch(Exception $e){
    14291430            $this->log($e->getMessage(), 'debug');
     
    14321433       
    14331434        //return empty string if no data
    1434         if( empty( $data ) )
     1435        if( !$mailchimp->success() || empty( $data ) )
    14351436            return '';
    1436        
    1437         //get only the required data in subarray
    1438         $data = $data['data'][0];
    1439        
     1437
    14401438        return $data;
    14411439    }
     
    14461444
    14471445        $mailchimp = $this->initMailChimp();
     1446        $groups = array();
    14481447
    14491448        if(empty($mailchimp)) return array();
    14501449
    14511450        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            }
    14531463        } catch(Exception $e){
    14541464            $this->log($e->getMessage(), 'debug');
  • magic-action-box/trunk/lib/classes/ProsulumMabBase.php

    r1167732 r2006018  
    426426     * MailChimp
    427427     */
     428    public static function require_mailchimp(){
     429        require_once MAB_LIB_DIR . 'integration/mailchimp/MAB_MailChimp.php';
     430    }
     431
    428432    function get_mailchimp_merge_vars( $id ) {
    429         require_once MAB_LIB_DIR . 'integration/mailchimp/Mailchimp.php';
    430 
     433        self::require_mailchimp();
    431434        $settings = MAB('settings')->getAll();
    432435        $mailchimp = new Mailchimp($settings['optin']['mailchimp-api']);
     
    445448   
    446449    function get_mailchimp_account_details( $apikey = '' ){
    447         require_once MAB_LIB_DIR . 'integration/mailchimp/Mailchimp.php';
     450        self::require_mailchimp();
    448451        if( empty( $apikey ) ){
    449452            $settings = MAB('settings')->getAll();
     
    451454        }
    452455        $mailchimp = new Mailchimp($apikey);
    453         $details = $mailchimp->helper->accountDetails();
     456
     457        $details = $mailchimp->get('', array('fields' => 'account_id,account_name'));
    454458        return $details;
    455459    }
     
    460464        }
    461465
    462         require_once MAB_LIB_DIR . 'integration/mailchimp/Mailchimp.php';
     466        self::require_mailchimp();
    463467
    464468        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' ) );
    469475
    470476        } catch(Exception $e){
  • magic-action-box/trunk/lib/shortcodes.php

    r1163410 r2006018  
    1111        'force_show' => false
    1212    );
     13
    1314    extract( shortcode_atts( $default, $atts ) );
    1415
     
    3334    $atts = shortcode_atts( $default, $atts );
    3435
    35     $atts['text'] = trim($content);
    36 
     36    $atts['text'] = do_shortcode(trim($content));
     37   
    3738    return mab_button( $atts );
    3839}
  • magic-action-box/trunk/readme.txt

    r1465564 r2006018  
    44Tags: opt in, call to action, aweber, email, email marketing, form, mailing list, marketing, newsletter, webform, mailchimp, constant contact
    55Requires at least: 3.5
    6 Tested up to: 4.6
    7 Stable tag: 2.17.1
     6Tested up to: 5.0.2
     7Stable tag: 2.17.2
    88
    99Magic Action Box let's you display professional looking opt-in forms and feature boxes in your WordPress site.
     
    100100
    101101== 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
    102107= 2.17.1 =
    103108*2016-02-07*
  • magic-action-box/trunk/views/metaboxes/optin-providers/mailchimp.php

    r1134385 r2006018  
    5151                <option value=""><?php _e('None', 'mab'); ?></option>
    5252                <?php foreach($mcGroups as $i => $grouping): ?>
    53                     <optgroup label="<?php echo $grouping['name']; ?>">
     53                    <optgroup label="<?php echo $grouping['title']; ?>">
    5454                    <?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']);
    5656                    ?>
    5757                        <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.