Skip to content

Commit

Permalink
Merge pull request #2 from ikchulakov/fix-emt-base
Browse files Browse the repository at this point in the history
Fix EMT_Base execute safe type
  • Loading branch information
corpsepk authored Oct 31, 2020
2 parents 30e7227 + 81e5d1c commit 59c0c57
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions EMT_Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,13 @@ public function safe_blocks($text, $way, $show = true)
{
if (count($this->_safe_blocks))
{
$safeType = true === $way ? "\\corpsepk\\yii2emt\\EMT_Lib::encrypt_tag(\$m[2])" : "stripslashes(\\corpsepk\\yii2emt\\EMT_Lib::decrypt_tag(\$m[2]))";
$safeblocks = true === $way ? $this->_safe_blocks : array_reverse($this->_safe_blocks);
foreach ($safeblocks as $block)
{
$text = preg_replace_callback(
"/({$block['open']})(.+?)({$block['close']})/s",
function ($m) use ($safeType) {
return $m[1].$safeType.$m[3];
function ($m) use ($way) {
return $m[1].(true === $way ? EMT_Lib::encrypt_tag($m[2]) : stripslashes(EMT_Lib::decrypt_tag($m[2]))).$m[3];
},
$text
);
Expand Down

0 comments on commit 59c0c57

Please sign in to comment.