Files
productlinkchecker/productlinkchecker.php

74 lines
1.9 KiB
PHP

<?php
/**
* Product Link Checker
*
* @author Panariga
* @copyright 2025 Panariga
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
class ProductLinkChecker extends Module
{
public function __construct()
{
$this->name = 'productlinkchecker';
$this->tab = 'seo';
$this->version = '1.0.0';
$this->author = 'Panariga';
$this->need_instance = 0;
$this->ps_versions_compliancy = ['min' => '1.7.0', 'max' => _PS_VERSION_];
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('Product Link Checker');
$this->description = $this->l('Generates a JSON list of all product links for testing purposes.');
$this->confirmUninstall = $this->l('Are you sure you want to uninstall this module?');
}
/**
* Installation of the module.
*/
public function install()
{
if (!parent::install()) {
return false;
}
// Generate and save a unique security token
$token = Tools::passwdGen(32);
Configuration::updateValue('PLC_SECURITY_TOKEN', $token);
return true;
}
/**
* Uninstallation of the module.
*/
public function uninstall()
{
Configuration::deleteByName('PLC_SECURITY_TOKEN');
return parent::uninstall();
}
/**
* Module configuration page.
*/
public function getContent()
{
$this->context->smarty->assign([
'security_token' => Configuration::get('PLC_SECURITY_TOKEN'),
'shops' => Shop::getShops(true, null, true),
'languages' => Language::getLanguages(true),
'base_controller_url' => $this->context->link->getModuleLink($this->name, 'generate', [], true),
]);
return $this->display(__FILE__, 'views/templates/admin/configure.tpl');
}
}