public static function getHookModuleExecList($hook_name = null) { $list = parent::getHookModuleExecList($hook_name); if ($hook_name != 'displayPayment') { return $list; } if (Module::isInstalled('agilemembership') && Module::isInstalled('agilepaypal') && (int) Configuration::get('AGILE_PAYPAL_AM_INTEGRATED') == 1) { include_once _PS_ROOT_DIR_ . "/modules/agilepaypal/agilepaypal.php"; $ap = new AgilePaypal(); if ($ap->hasNonMembershipProducts()) { return $list; } foreach ($list as $payment) { if ($payment['module'] == 'agilepaypal') { return array($payment); } } return false; } return $list; }
/** * Returns an array of event names this subscriber wants to listen to. * * The array keys are event names and the value are a function name * that will be solved by magic __call(). The function contains data to extract: hookId, moduleId * * TODO: add cache layer on $listeners * * @return array The listeners array */ public static function getSubscribedEvents() { $listeners = array(); //Hack SF2 cache clear : if context not mounted, bypass legacy call $legacyContext = OldContext::getContext(); if (!$legacyContext || empty($legacyContext->shop) || empty($legacyContext->employee)) { return $listeners; } $hooks = \HookCore::getHooks(); foreach ($hooks as $hook) { $name = $hook['name']; $id = $hook['id_hook']; $moduleListeners = array(); $modules = array(); //SF2 cache clear bug fix : call bqSQL alias function if (function_exists("bqSQL")) { $modules = \HookCore::getHookModuleExecList($name); } if (is_array($modules)) { foreach ($modules as $order => $module) { $moduleId = $module['id_module']; $functionName = 'call_' . $id . '_' . $moduleId; $moduleListeners[] = array($functionName, 2000 - $order); } if (count($moduleListeners)) { $listeners[$name] = $moduleListeners; } } } return $listeners; }