ltsecurityinc安防产品在线商城代码
This commit is contained in:
+36
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleSimpleTemplateDirective\Model;
|
||||
|
||||
use Magento\Framework\Filter\SimpleDirective\ProcessorInterface;
|
||||
use Magento\Framework\Filter\Template;
|
||||
|
||||
/**
|
||||
* Filters a value for testing purposes
|
||||
*/
|
||||
class FooFilter implements \Magento\Framework\Filter\DirectiveProcessor\FilterInterface
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function filterValue(string $value, array $params): string
|
||||
{
|
||||
$arg1 = $params[0] ?? null;
|
||||
|
||||
return strtoupper(strrev($value . $arg1 ?? ''));
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return 'foofilter';
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleSimpleTemplateDirective\Model;
|
||||
|
||||
use Magento\Framework\Filter\Template;
|
||||
|
||||
/**
|
||||
* A legacy directive test entity
|
||||
*/
|
||||
class LegacyFilter extends Template
|
||||
{
|
||||
/**
|
||||
* Filter a directive
|
||||
*
|
||||
* @param $construction
|
||||
* @return string
|
||||
*/
|
||||
protected function coolDirective($construction)
|
||||
{
|
||||
return 'value1: ' . $construction[1] . ':' . $construction[2];
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter a directive
|
||||
*
|
||||
* @param $construction
|
||||
* @return string
|
||||
*/
|
||||
public function coolerDirective($construction)
|
||||
{
|
||||
return 'value2: ' . $construction[1] . ':' . $construction[2];
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleSimpleTemplateDirective\Model;
|
||||
|
||||
use Magento\Framework\Filter\SimpleDirective\ProcessorInterface;
|
||||
use Magento\Framework\Filter\Template;
|
||||
|
||||
/**
|
||||
* Handles the {{mydir}} directive
|
||||
*/
|
||||
class MyDirProcessor implements ProcessorInterface
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return 'mydir';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function process(
|
||||
$value,
|
||||
array $parameters,
|
||||
?string $html
|
||||
): string {
|
||||
return $value . $parameters['param1'] . $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getDefaultFilters(): ?array
|
||||
{
|
||||
return ['foofilter'];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user