File: /home4/cca63905/public_html/nueva/modules/wnetsecurity/wnetsecurity.php
<?php
/**
* Copyright since 2014 Waynet Sp. z o.o.
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/OSL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to kontakt@waynet.pl so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to https://devdocs.prestashop-project.org/ for more information.
*
* @author Waynet Sp. z o.o. <kontakt@waynet.pl>
* @copyright since 2014 Waynet Sp. z o.o.
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
use PrestaShop\ModuleLibServiceContainer\DependencyInjection\ServiceContainer;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
use Waynet\Security\Controller\Admin\ConfigurationController;
use Waynet\Security\Installer\InstallerException;
use Waynet\Security\Installer\InstallerInterface;
if (!defined('_PS_VERSION_')) {
exit;
}
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
require_once __DIR__ . '/vendor/autoload.php';
}
class WnetSecurity extends \Module
{
private $container;
protected $tabs = [];
public function __construct()
{
$this->name = 'wnetsecurity';
$this->module_key = '8c26f85c54d5a8f32a27748600078b8f';
$this->tab = 'others';
$this->version = '1.0.1';
$this->author = 'Waynet Sp. z o.o.';
$this->author_uri = 'https://www.waynet.io/';
$this->need_instance = 0;
$this->bootstrap = true;
$this->ps_versions_compliancy = ['min' => '1.7', 'max' => '8.1.99'];
parent::__construct();
$this->displayName = $this->l('Waynet Security');
$this->description = $this->l('Automatic store scanning for security vulnerabilities in the system and modules.');
$this->tabs = [
[
'class_name' => \AdminWnetSecurityAjaxController::TAB_NAME,
'name' => $this->name,
'visible' => false,
],
];
$this->dependencies = ['ps_eventbus', 'ps_accounts'];
$this->container = new ServiceContainer($this->name, $this->getLocalPath());
}
/** @return bool */
public function isUsingNewTranslationSystem()
{
return false;
}
/** @return bool */
public function install()
{
if (70100 > PHP_VERSION_ID) {
$this->_errors[] = $this->l('This module requires PHP 7.1 or later');
return false;
}
try {
$result = $this->getService(InstallerInterface::class)->install($this);
} catch (InstallerException $exception) {
$this->_errors[] = $exception->getMessage();
return false;
}
return $result && parent::install();
}
/** @return bool */
public function uninstall()
{
try {
$result = $this->getService(InstallerInterface::class)->uninstall($this);
} catch (InstallerException $exception) {
$this->_errors[] = $exception->getMessage();
return false;
}
return $result && parent::uninstall();
}
/**
* @template T
*
* @param string|class-string<T> $name
*
* @return T|object
*
* @throws ServiceNotFoundException
*/
public function getService($name)
{
return $this->container->getService($name);
}
/** @return string */
public function getContent()
{
return $this->getService(ConfigurationController::class)->indexAction();
}
/** @return array */
public function getTabs()
{
return $this->tabs;
}
}