public function triggerPreExpiration($metaUser, $mi_pexp) { // No actions on expired, trial or recurring if ($this->isExpired() || $this->isTrial() || $this->recurring) { return false; } $plan = $this->getPlan(); $micro_integrations = $plan->getMicroIntegrations(); $actions = 0; if (empty($micro_integrations)) { return $actions; } foreach ($micro_integrations as $mi_id) { if (!in_array($mi_id, $mi_pexp)) { continue; } $mi = new microIntegration(); if (!$mi->mi_exists($mi_id)) { continue; } $mi->load($mi_id); if (!$mi->callIntegration()) { continue; } // Do the actual pre expiration check on this MI if ($this->isExpired($mi->pre_exp_check)) { $result = $mi->pre_expiration_action($metaUser, $plan); if ($result) { $actions++; } } unset($mi); } return $actions; }