-
-
Notifications
You must be signed in to change notification settings - Fork 437
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* introduce wrapper class to keep unescaped variants available for templates * escape more settings before usage
- Loading branch information
1 parent
9af160d
commit 8f1dccd
Showing
3 changed files
with
50 additions
and
5 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
app/code/core/Mage/Core/Model/Security/HtmlEscapedString.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,35 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* | ||
*/ | ||
class Mage_Core_Model_Security_HtmlEscapedString implements Stringable | ||
{ | ||
|
||
protected $originalValue; | ||
protected $allowedTags; | ||
|
||
/** | ||
* @param string $originalValue | ||
* @param string[]|null $allowedTags | ||
*/ | ||
public function __construct(string $originalValue, ?array $allowedTags = null) | ||
{ | ||
$this->originalValue = $originalValue; | ||
$this->allowedTags = $allowedTags; | ||
} | ||
|
||
public function __toString(): string | ||
{ | ||
return (string) Mage::helper('core')->escapeHtml( | ||
$this->originalValue, | ||
$this->allowedTags | ||
); | ||
} | ||
|
||
public function getUnescapedValue(): string | ||
{ | ||
return $this->originalValue; | ||
} | ||
} |
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