name = 'botlimiter'; $this->tab = 'administration'; $this->version = '1.0.0'; $this->author = 'Panariga'; $this->need_instance = 0; $this->bootstrap = true; parent::__construct(); $this->displayName = $this->l('Bot Limiter & Firewall'); $this->description = $this->l('Intelligent protection against faceted search scrapers.'); } public function install() { return parent::install() && $this->registerHook('actionFrontControllerInitBefore'); } public function hookActionFrontControllerInitBefore($params) { // 1. Skip if we are currently ON the verification page to avoid loops if ($this->context->controller instanceof BotLimiterVerifyModuleFrontController) { return; } // 2. Initialize Manager $manager = new RuleManager($this->context); // 3. Register Rules (Add more here in future) $manager->addRule(new HeadRequestRule()); $manager->addRule(new FilterTrapRule()); // 4. Execute Rules // If a rule returns FALSE, it means traffic is blocked or redirected. // The rule is responsible for the redirect/exit. $manager->process(); } }