-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/2.4-develop' into bugfix/issue-3…
…0009
- Loading branch information
Showing
232 changed files
with
5,139 additions
and
657 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
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 |
---|---|---|
|
@@ -10,7 +10,6 @@ | |
* Toolbar entry that shows latest notifications | ||
* | ||
* @api | ||
* @author Magento Core Team <[email protected]> | ||
* @since 100.0.2 | ||
*/ | ||
class ToolbarEntry extends \Magento\Backend\Block\Template | ||
|
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 |
---|---|---|
|
@@ -12,7 +12,6 @@ | |
/** | ||
* AdminNotification Feed model | ||
* | ||
* @author Magento Core Team <[email protected]> | ||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects) | ||
* @api | ||
* @since 100.0.2 | ||
|
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 |
---|---|---|
|
@@ -8,7 +8,6 @@ | |
/** | ||
* AdminNotification Inbox interface | ||
* | ||
* @author Magento Core Team <[email protected]> | ||
* @api | ||
* @since 100.0.2 | ||
*/ | ||
|
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 |
---|---|---|
|
@@ -8,7 +8,6 @@ | |
/** | ||
* Notification service model | ||
* | ||
* @author Magento Core Team <[email protected]> | ||
* @api | ||
* @since 100.0.2 | ||
*/ | ||
|
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 |
---|---|---|
|
@@ -6,8 +6,6 @@ | |
|
||
/** | ||
* AdminNotification Inbox model | ||
* | ||
* @author Magento Core Team <[email protected]> | ||
*/ | ||
namespace Magento\AdminNotification\Model\ResourceModel\Grid; | ||
|
||
|
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 |
---|---|---|
|
@@ -9,8 +9,6 @@ | |
* AdminNotification Inbox model | ||
* | ||
* @api | ||
* @author Magento Core Team <[email protected]> | ||
* @api | ||
* @since 100.0.2 | ||
*/ | ||
class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection | ||
|
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 |
---|---|---|
|
@@ -6,8 +6,6 @@ | |
|
||
/** | ||
* Collection of unread notifications | ||
* | ||
* @author Magento Core Team <[email protected]> | ||
*/ | ||
namespace Magento\AdminNotification\Model\ResourceModel\Inbox\Collection; | ||
|
||
|
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 |
---|---|---|
|
@@ -9,8 +9,7 @@ | |
|
||
/** | ||
* AdminNotification observer | ||
* | ||
* @author Magento Core Team <[email protected]> | ||
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse) | ||
*/ | ||
class PredispatchAdminActionControllerObserver implements ObserverInterface | ||
{ | ||
|
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 |
---|---|---|
|
@@ -9,7 +9,6 @@ | |
* Search queries relations grid container | ||
* | ||
* @api | ||
* @author Magento Core Team <[email protected]> | ||
* @since 100.0.2 | ||
*/ | ||
class Edit extends \Magento\Backend\Block\Widget\Grid\Container | ||
|
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 |
---|---|---|
|
@@ -9,7 +9,6 @@ | |
* Search query relations edit grid | ||
* | ||
* @api | ||
* @author Magento Core Team <[email protected]> | ||
* @since 100.0.2 | ||
*/ | ||
class Grid extends \Magento\Backend\Block\Widget\Grid | ||
|
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 |
---|---|---|
|
@@ -8,7 +8,6 @@ | |
/** | ||
* Catalog search recommendations resource model | ||
* | ||
* @author Magento Core Team <[email protected]> | ||
* @api | ||
* @since 100.0.2 | ||
*/ | ||
|
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
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
96 changes: 96 additions & 0 deletions
96
app/code/Magento/Catalog/Model/Attribute/Backend/DefaultBackend.php
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,96 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Magento\Catalog\Model\Attribute\Backend; | ||
|
||
use Magento\Catalog\Model\AbstractModel; | ||
use Magento\Catalog\Model\ResourceModel\Eav\Attribute; | ||
use Magento\Eav\Model\Entity\Attribute\Backend\DefaultBackend as ParentBackend; | ||
use Magento\Eav\Model\Entity\Attribute\Exception; | ||
use Magento\Framework\DataObject; | ||
use Magento\Framework\Exception\LocalizedException; | ||
use Magento\Framework\Validation\ValidationException; | ||
use Magento\Framework\Validator\HTML\WYSIWYGValidatorInterface; | ||
|
||
/** | ||
* Default backend model for catalog attributes. | ||
*/ | ||
class DefaultBackend extends ParentBackend | ||
{ | ||
/** | ||
* @var WYSIWYGValidatorInterface | ||
*/ | ||
private $wysiwygValidator; | ||
|
||
/** | ||
* @param WYSIWYGValidatorInterface $wysiwygValidator | ||
*/ | ||
public function __construct(WYSIWYGValidatorInterface $wysiwygValidator) | ||
{ | ||
$this->wysiwygValidator = $wysiwygValidator; | ||
} | ||
|
||
/** | ||
* Validate user HTML value. | ||
* | ||
* @param DataObject $object | ||
* @return void | ||
* @throws LocalizedException | ||
*/ | ||
private function validateHtml(DataObject $object): void | ||
{ | ||
$attribute = $this->getAttribute(); | ||
$code = $attribute->getAttributeCode(); | ||
if ($attribute instanceof Attribute && $attribute->getIsHtmlAllowedOnFront()) { | ||
$value = $object->getData($code); | ||
if ($value | ||
&& is_string($value) | ||
&& (!($object instanceof AbstractModel) || $object->getData($code) !== $object->getOrigData($code)) | ||
) { | ||
try { | ||
$this->wysiwygValidator->validate($object->getData($code)); | ||
} catch (ValidationException $exception) { | ||
$attributeException = new Exception( | ||
__( | ||
'Using restricted HTML elements for "%1". %2', | ||
$attribute->getName(), | ||
$exception->getMessage() | ||
), | ||
$exception | ||
); | ||
$attributeException->setAttributeCode($code)->setPart('backend'); | ||
throw $attributeException; | ||
} | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function beforeSave($object) | ||
{ | ||
parent::beforeSave($object); | ||
$this->validateHtml($object); | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function validate($object) | ||
{ | ||
$isValid = parent::validate($object); | ||
if ($isValid) { | ||
$this->validateHtml($object); | ||
} | ||
|
||
return $isValid; | ||
} | ||
} |
Oops, something went wrong.