Created
December 14, 2017 19:14
-
-
Save damienwebdev/3b42b01988397589bf8501d9582e27cf to your computer and use it in GitHub Desktop.
Magento Widget XML/HTML Entities 500 Error Fix
This file contains hidden or 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
<?php | |
class Mage_Widget_Helper_Data extends Mage_Core_Helper_Abstract | |
{ | |
/** | |
* Further refine escaped HTML. | |
*/ | |
public function escapeHtml($data, $allowedTags = null) | |
{ | |
$parent = parent::escapeHtml($data, $allowedTags); | |
if (is_array($parent)) { | |
$result = array(); | |
foreach ($parent as $item) { | |
$result[] = $this->escapeHtml($item); | |
} | |
} else { | |
// process single item | |
if (strlen($parent)) { | |
$result = preg_replace('/\&(?!(?:amp|lt|gt|#039|quot);)[^ ;]+;/', "<![CDATA[\\0]]>", $parent); | |
} else { | |
$result = $parent; | |
} | |
} | |
return $result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment