Damaging content in PRE elements
-
When activating the plugin, it seems that texturizing is not working properly any longer.
For example, PRE elements will be ignored by wptexturize() when you add source code examples within a PRE element and double minus signs. However after activating WP YouTube Lyte, the double minus signs inside the PRE element get replaced by a long minus sign followed by a space.
The cause of this strange effect is these code fragments:
if ( apply_filters( 'lyte_kinda_textureize', true ) ) { $char_codes = array('×','–','\u002d'); $replacements = array("x", "--", "-"); $the_content=str_replace($char_codes, $replacements, $the_content); }if ( apply_filters( 'lyte_kinda_textureize', true ) ) { // replace remaining double dash but restore it in comment tags (this is getting ugly though). $the_content = str_replace( array( ' -- ', '-- ', ' --' ), ' – ', $the_content ); $the_content = str_replace( '<! –', '<!--', $the_content ); $the_content = str_replace( '– >', '-->', $the_content ); }Why are the global replacements in the content done in the first place? This may cause any kind of trouble and the second code block seems to be a hack to restore comment tags which got damaged with the first replacement. Especially it is not correct to always replace
--with–. This is clearly just not ok.As a workaround I disabled the stuff with a custom filter:
function disable_lyte_kinda_textureize( $enabled ) { return false; } add_filter('lyte_kinda_textureize', 'disable_lyte_kinda_textureize');However I’d like to understand, why the replacement was done at all.
The topic ‘Damaging content in PRE elements’ is closed to new replies.