ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_Base
|
||||
* @copyright Copyright (c) 2021 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license/ End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\Base\Model\Extensions;
|
||||
|
||||
use Magento\Framework\DataObject;
|
||||
use Plumrocket\Base\Api\GetModuleVersionInterface;
|
||||
|
||||
/**
|
||||
* Container for information about extension
|
||||
* Use in case when module hasn't \Plumrocket\Base\Api\ModuleInformationInterface realise
|
||||
* @since 2.3.0
|
||||
* @deprecated 2.5.0
|
||||
*/
|
||||
class EmptyInformation extends DataObject
|
||||
{
|
||||
/**
|
||||
* @var \Plumrocket\Base\Api\GetModuleVersionInterface
|
||||
*/
|
||||
private $getModuleVersion;
|
||||
|
||||
/**
|
||||
* EmptyInformation constructor.
|
||||
*
|
||||
* @param \Plumrocket\Base\Api\GetModuleVersionInterface $getModuleVersion
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(
|
||||
GetModuleVersionInterface $getModuleVersion,
|
||||
array $data = []
|
||||
) {
|
||||
parent::__construct($data);
|
||||
$this->getModuleVersion = $getModuleVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function isService(): bool
|
||||
{
|
||||
return (bool) $this->_getData('is_service');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getTitle(): string
|
||||
{
|
||||
return (string) $this->_getData('title');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getWikiLink(): string
|
||||
{
|
||||
return (string) $this->_getData('wiki');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getConfigSection(): string
|
||||
{
|
||||
return (string) $this->_getData('config_section');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getIsEnabledFieldConfigPath(): string
|
||||
{
|
||||
return (string) $this->_getData('is_enabled_path');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getModuleName(): string
|
||||
{
|
||||
return (string) $this->_getData('module_name');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getVendorAndModuleName(): string
|
||||
{
|
||||
return (string) $this->_getData('full_module_name') ?: 'Plumrocket_' . $this->getModuleName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getInstalledVersion(): string
|
||||
{
|
||||
return $this->getModuleVersion->execute($this->getVendorAndModuleName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $isService
|
||||
* @return \Plumrocket\Base\Model\Extensions\EmptyInformation
|
||||
*/
|
||||
public function setIsService(bool $isService): EmptyInformation
|
||||
{
|
||||
return $this->setData('is_service', $isService);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $title
|
||||
* @return \Plumrocket\Base\Model\Extensions\EmptyInformation
|
||||
*/
|
||||
public function setTitle(string $title): EmptyInformation
|
||||
{
|
||||
return $this->setData('title', $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $configSection
|
||||
* @return \Plumrocket\Base\Model\Extensions\EmptyInformation
|
||||
*/
|
||||
public function setConfigSection(string $configSection): EmptyInformation
|
||||
{
|
||||
return $this->setData('config_section', $configSection);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $wikiLink
|
||||
* @return \Plumrocket\Base\Model\Extensions\EmptyInformation
|
||||
*/
|
||||
public function setWikiLink(string $wikiLink): EmptyInformation
|
||||
{
|
||||
return $this->setData('wiki', $wikiLink);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $moduleName
|
||||
* @return \Plumrocket\Base\Model\Extensions\EmptyInformation
|
||||
*/
|
||||
public function setVendorAndModuleName(string $moduleName): EmptyInformation
|
||||
{
|
||||
return $this->setData('full_module_name', $moduleName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $moduleName
|
||||
* @return \Plumrocket\Base\Model\Extensions\EmptyInformation
|
||||
*/
|
||||
public function setModuleName(string $moduleName): EmptyInformation
|
||||
{
|
||||
return $this->setData('module_name', $moduleName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $configPath
|
||||
* @return \Plumrocket\Base\Model\Extensions\EmptyInformation
|
||||
*/
|
||||
public function setIsEnabledFieldConfigPath(string $configPath): EmptyInformation
|
||||
{
|
||||
return $this->setData('is_enabled_path', $configPath);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_Base
|
||||
* @copyright Copyright (c) 2021 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license/ End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\Base\Model\Extensions;
|
||||
|
||||
use Plumrocket\Base\Model\Extension\GetModuleName;
|
||||
|
||||
/**
|
||||
* @since 2.3.0
|
||||
* @deprecated since 2.5.0
|
||||
* @see \Plumrocket\Base\Model\Extension\Information\Get
|
||||
*/
|
||||
class GetInformation
|
||||
{
|
||||
/**
|
||||
* @var \Plumrocket\Base\Api\ModuleInformationInterface[]
|
||||
*/
|
||||
private $extensions;
|
||||
|
||||
/**
|
||||
* @var \Plumrocket\Base\Model\Extension\GetModuleName
|
||||
*/
|
||||
private $getExtensionName;
|
||||
|
||||
/**
|
||||
* @param \Plumrocket\Base\Model\Extension\GetModuleName $getModuleName
|
||||
* @param array $extensions
|
||||
*/
|
||||
public function __construct(
|
||||
GetModuleName $getModuleName,
|
||||
array $extensions = []
|
||||
) {
|
||||
$this->getExtensionName = $getModuleName;
|
||||
$this->extensions = $extensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $moduleName
|
||||
* @return \Plumrocket\Base\Api\ModuleInformationInterface|null
|
||||
*/
|
||||
public function execute(string $moduleName)
|
||||
{
|
||||
$moduleName = $this->getExtensionName->execute($moduleName);
|
||||
return $this->extensions[$moduleName] ?? null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_Base
|
||||
* @copyright Copyright (c) 2020 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license/ End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\Base\Model\Extensions;
|
||||
|
||||
use Plumrocket\Base\Api\Data\ExtensionInformationInterface;
|
||||
use Plumrocket\Base\Api\GetModuleVersionInterface;
|
||||
|
||||
/**
|
||||
* @since 2.3.0
|
||||
* @deprecated since 2.5.0 - it is better to use "pr_extensions.xml" than this class with constants
|
||||
*/
|
||||
class Information implements ExtensionInformationInterface
|
||||
{
|
||||
const IS_SERVICE = true;
|
||||
const NAME = 'Base';
|
||||
const WIKI = '';
|
||||
const CONFIG_SECTION = 'plumbase';
|
||||
|
||||
/**
|
||||
* Path to config that define if module enabled,
|
||||
* for modules without configs left this constant empty
|
||||
*/
|
||||
const IS_ENABLED_FIELD_CONFIG_PATH = '';
|
||||
const MODULE_NAME = 'Base';
|
||||
const VENDOR_NAME = 'Plumrocket';
|
||||
|
||||
/**
|
||||
* @var \Plumrocket\Base\Api\GetModuleVersionInterface
|
||||
*/
|
||||
private $getModuleVersion;
|
||||
|
||||
/**
|
||||
* ModuleInformation constructor.
|
||||
*
|
||||
* @param \Plumrocket\Base\Api\GetModuleVersionInterface $getModuleVersion
|
||||
*/
|
||||
public function __construct(GetModuleVersionInterface $getModuleVersion)
|
||||
{
|
||||
$this->getModuleVersion = $getModuleVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function isService(): bool
|
||||
{
|
||||
return static::IS_SERVICE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getTitle(): string
|
||||
{
|
||||
return static::NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getDocumentationLink(): string
|
||||
{
|
||||
return static::WIKI;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getWikiLink(): string
|
||||
{
|
||||
return static::WIKI;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getConfigSection(): string
|
||||
{
|
||||
return static::CONFIG_SECTION;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getIsEnabledFieldConfigPath(): string
|
||||
{
|
||||
return static::IS_ENABLED_FIELD_CONFIG_PATH;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getModuleName(): string
|
||||
{
|
||||
return static::MODULE_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getVendorAndModuleName(): string
|
||||
{
|
||||
return static::VENDOR_NAME . '_' . $this->getModuleName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getUrl(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getMarketplaceUrl(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getInstalledVersion(): string
|
||||
{
|
||||
return $this->getModuleVersion->execute($this->getVendorAndModuleName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function setIsService(bool $isService): ExtensionInformationInterface
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function setTitle(string $title): ExtensionInformationInterface
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function setConfigSection(string $configSection): ExtensionInformationInterface
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function setDocumentationLink(string $documentationLink): ExtensionInformationInterface
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function setWikiLink(string $wikiLink): ExtensionInformationInterface
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function setUrl(string $extensionUrl): ExtensionInformationInterface
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function setMarketplaceUrl(string $extensionMarketplaceUrl): ExtensionInformationInterface
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function setModuleName(string $moduleName): ExtensionInformationInterface
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function setIsEnabledFieldConfigPath(string $configPath): ExtensionInformationInterface
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user