Last active
October 7, 2015 00:38
-
-
Save giovanniramos/3078188 to your computer and use it in GitHub Desktop.
Removes the style markup in html tags, derived from a text editor
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
<?php | |
/** | |
* Removes the style markup in html tags, derived from a text editor | |
* | |
* @param string $value The input string | |
* @return string | |
* @link https://gist.github.com/3078188 | |
* | |
* */ | |
function clearStyle($value) | |
{ | |
$value = preg_replace("~<(a|ol|ul|li|h[1-6r]|d[dlt]|em|p|i|b|s|strong|span|div|table|t[dhr])\s?(style.*)?/>~i", "<$1>", $value); | |
return $value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment