-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding more options to the extension/
- Loading branch information
1 parent
9d33602
commit 75013a3
Showing
15 changed files
with
445 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Magento 2 Coding Standard | ||
|
||
# Run this workflow every time a new commit pushed to your repository or pull requested is created. | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
# Set the job key. The key is displayed as the job name | ||
# when a job name is not provided | ||
magento2-coding-standard: | ||
# Name the Job | ||
name: Magento 2 Coding Standard | ||
|
||
# Set the type of machine to run on | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Checks out a copy of your repository on the ubuntu-latest machine | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
- name: Running Magento 2 Coding Standard Check | ||
uses: extdn/github-actions-m2/magento-coding-standard/7.4@master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# MIT License | ||
|
||
**MagedIn_Frenet Extension** | ||
**Copyright (C) 2024 MagedIn Technology** | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
/** | ||
* MagedIn Technology | ||
* | ||
* Do not edit this file if you want to update this module for future new versions. | ||
* | ||
* @category MagedIn | ||
* @copyright Copyright (c) 2024 MagedIn Technology. | ||
* | ||
* @author MagedIn Support <support@magedin.com> | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MagedIn\TrojanRequestBlocker\Model; | ||
|
||
use Magento\Framework\App\Config\ScopeConfigInterface; | ||
|
||
/** | ||
* DocBlock for Config class. | ||
*/ | ||
class Config | ||
{ | ||
private const XPATH_ENABLED = 'system/magedin_trojan_request_blocker/enabled'; | ||
private const XPATH_ADDITIONAL_PATTERNS = 'system/magedin_trojan_request_blocker/additional_patterns'; | ||
|
||
/** | ||
* @var ScopeConfigInterface | ||
*/ | ||
private ScopeConfigInterface $scopeConfig; | ||
|
||
/** | ||
* @param ScopeConfigInterface $scopeConfig | ||
*/ | ||
public function __construct( | ||
ScopeConfigInterface $scopeConfig | ||
) { | ||
$this->scopeConfig = $scopeConfig; | ||
} | ||
|
||
/** | ||
* DocBlock for method. | ||
* | ||
* @param string $scopeType | ||
* @param null $scopeCode | ||
* | ||
* @return bool | ||
*/ | ||
public function isEnabled(string $scopeType = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeCode = null): bool | ||
{ | ||
return $this->scopeConfig->isSetFlag(self::XPATH_ENABLED, $scopeType, $scopeCode); | ||
} | ||
|
||
/** | ||
* DocBlock for method. | ||
* | ||
* @param string $scopeType | ||
* @param null $scopeCode | ||
* | ||
* @return array | ||
*/ | ||
public function getAdditionalPatterns( | ||
string $scopeType = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, | ||
$scopeCode = null | ||
): array { | ||
$value = $this->scopeConfig->getValue(self::XPATH_ADDITIONAL_PATTERNS, $scopeType, $scopeCode); | ||
$value = explode(PHP_EOL, $value); | ||
$value = array_map('trim', $value); | ||
return (array) $value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
/** | ||
* MagedIn Technology | ||
* | ||
* Do not edit this file if you want to update this module for future new versions. | ||
* | ||
* @category MagedIn | ||
* @copyright Copyright (c) 2024 MagedIn Technology. | ||
* | ||
* @author MagedIn Support <support@magedin.com> | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MagedIn\TrojanRequestBlocker\Service\Patterns; | ||
|
||
use MagedIn\TrojanRequestBlocker\Model\Config; | ||
|
||
/** | ||
* DocBlock for DefaultPatterns class. | ||
*/ | ||
class ConfigPatterns implements PatternsInterface | ||
{ | ||
/** | ||
* @var Config | ||
*/ | ||
private Config $config; | ||
|
||
/** | ||
* @param Config $config | ||
*/ | ||
public function __construct( | ||
Config $config | ||
) { | ||
$this->config = $config; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function load(): array | ||
{ | ||
return $this->config->getAdditionalPatterns(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* MagedIn Technology | ||
* | ||
* Do not edit this file if you want to update this module for future new versions. | ||
* | ||
* @category MagedIn | ||
* @copyright Copyright (c) 2024 MagedIn Technology. | ||
* | ||
* @author MagedIn Support <support@magedin.com> | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MagedIn\TrojanRequestBlocker\Service\Patterns; | ||
|
||
/** | ||
* DocBlock for DefaultPatterns class. | ||
*/ | ||
class DefaultPatterns implements PatternsInterface | ||
{ | ||
/** | ||
* @var array | ||
*/ | ||
private array $patterns; | ||
|
||
/** | ||
* @param array $patterns | ||
*/ | ||
public function __construct( | ||
array $patterns = [] | ||
) { | ||
$this->patterns = $patterns; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function load(): array | ||
{ | ||
return $this->patterns; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
/** | ||
* MagedIn Technology | ||
* | ||
* Do not edit this file if you want to update this module for future new versions. | ||
* | ||
* @category MagedIn | ||
* @copyright Copyright (c) 2024 MagedIn Technology. | ||
* | ||
* @author MagedIn Support <support@magedin.com> | ||
*/ | ||
|
||
namespace MagedIn\TrojanRequestBlocker\Service\Patterns; | ||
|
||
/** | ||
* DocBlock for PatternsInterface interface. | ||
*/ | ||
interface PatternsInterface | ||
{ | ||
/** | ||
* DocBlock for method. | ||
* | ||
* @return array | ||
*/ | ||
public function load(): array; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.