public function explodePlanList($recurring)
 {
     global $aecConfig;
     $groups = array();
     $plans = array();
     $gs = array();
     $ps = array();
     // Break apart groups and items, make sure we have no duplicates
     foreach ($this->list as $litem) {
         if ($litem['type'] == 'group') {
             if (!in_array($litem['id'], $gs)) {
                 $gs[] = $litem['id'];
                 $groups[] = $litem;
             }
         } else {
             if (!in_array($litem['id'], $ps)) {
                 if (ItemGroupHandler::checkParentRestrictions($litem['plan'], 'item', $this->metaUser)) {
                     $ps[] = $litem['id'];
                     $plans[] = $litem;
                 }
             }
         }
     }
     foreach ($plans as $pid => $plan) {
         if (!isset($plan['plan']->params['cart_behavior'])) {
             $plan['plan']->params['cart_behavior'] = 0;
         }
         if ($this->metaUser->userid && !$this->expired && ($aecConfig->cfg['enable_shoppingcart'] || $plan['plan']->params['cart_behavior'] == 1) && $plan['plan']->params['cart_behavior'] != 2) {
             // We have a shopping cart situation, care about processors later
             if ($plan['plan']->params['processors'] == '' || is_null($plan['plan']->params['processors'])) {
                 if (!$plan['plan']->params['full_free']) {
                     continue;
                 }
             }
             $plans[$pid]['gw'][0] = new stdClass();
             $plans[$pid]['gw'][0]->processor_name = 'add_to_cart';
             $plans[$pid]['gw'][0]->info['statement'] = '';
             $plans[$pid]['gw'][0]->recurring = 0;
             continue;
         }
         if (empty($plan['select_mode'])) {
             $select_mode = '0';
         } else {
             $select_mode = $plan['select_mode'];
         }
         if ($select_mode == 1) {
             // We want to only select the processors on confirmation
             if ($plan['plan']->params['processors'] == '' || is_null($plan['plan']->params['processors'])) {
                 if (!$plan['plan']->params['full_free']) {
                     continue;
                 }
             }
             $plans[$pid]['gw'][0] = new stdClass();
             $plans[$pid]['gw'][0]->processor_name = 'select';
             $plans[$pid]['gw'][0]->info['statement'] = '';
             $plans[$pid]['gw'][0]->recurring = 0;
             continue;
         }
         if ($plan['plan']->params['full_free']) {
             $plans[$pid]['gw'][0] = new stdClass();
             $plans[$pid]['gw'][0]->processor_name = 'free';
             $plans[$pid]['gw'][0]->info['statement'] = '';
             $plans[$pid]['gw'][0]->recurring = 0;
         } else {
             if ($plan['plan']->params['processors'] != '' && !is_null($plan['plan']->params['processors'])) {
                 $processors = array_reverse($plan['plan']->params['processors']);
                 // Restrict to pre-chosen processor (if set)
                 if (!empty($this->processor)) {
                     $processorid = PaymentProcessorHandler::getProcessorIdfromName($this->processor);
                     if (in_array($processorid, $processors)) {
                         $processors = array($processorid);
                     }
                 }
                 $plan_gw = array();
                 if (count($processors)) {
                     foreach ($processors as $n) {
                         if (empty($n)) {
                             continue;
                         }
                         $pp = new PaymentProcessor();
                         if (!$pp->loadId($n)) {
                             continue;
                         }
                         if (!$pp->processor->active) {
                             continue;
                         }
                         $pp->init();
                         $pp->getInfo();
                         $pp->exchangeSettingsByPlan($plan['plan']);
                         $recurring = $pp->is_recurring($recurring, true);
                         if ($recurring > 1) {
                             $pp->recurring = 0;
                             $plan_gw[] = $pp;
                             if (!$plan['plan']->params['lifetime']) {
                                 $pp = new PaymentProcessor();
                                 $pp->loadId($n);
                                 $pp->init();
                                 $pp->getInfo();
                                 $pp->exchangeSettingsByPlan($plan['plan']);
                                 $pp->recurring = 1;
                                 $plan_gw[] = $pp;
                             }
                         } elseif (!($plan['plan']->params['lifetime'] && $recurring)) {
                             if (is_int($recurring)) {
                                 $pp->recurring = $recurring;
                             }
                             $plan_gw[] = $pp;
                         }
                     }
                 }
                 if (!empty($plan_gw)) {
                     $plans[$pid]['gw'] = $plan_gw;
                 } else {
                     unset($plans[$pid]);
                 }
             }
         }
     }
     $this->list = array_merge($groups, $plans);
 }