PHP7 preg_replace broken
-
Hi All,
Realize this plugin is pretty much dead, but I do use it on a site, and was hoping someone had an easy fix for preg_replace being deprecated.
In dirtycode.php, the block
function trunc_c2c_preserve_code_formatting( $text ) { $text = str_replace(array('$', "'"), array('$&;', ''&;'), $text); $tags = array('code', 'pre'); foreach ($tags as $tag) { $text = preg_replace( "^(<$tag>)\n?([\S|\s]*?)\n?(</$tag>)^i", "'<$tag>' . trunc_c2c_prep_code(\"$2\") . '</$tag>'", $text ); } $text = str_replace(array('$&;', ''&;'), array('$', "'"), $text); return $text; }
Needs to have the preg_replace replaced with a preg_replace_callback, but I’m having a hard time wrapping my head around it. Thoughts?
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘PHP7 preg_replace broken’ is closed to new replies.