Jump to content

[BUG 4.6.7] Unreplaced {dir} attributes in emails


Go to solution Solved by Stuart Silvester,

Recommended Posts

Posted (edited)

If an email has Our Picks items included there are unreplaced {dir} attributes because the emailWrapper HTML is not formatted properly:

{{if $count == 2}}
	</tr>
	<tr height='30'>
		<td colspan='3' dir='{dir}' class='hidePhone' style='border-bottom: 1px solid #e0e0e0;'>
			<img src='{setting="base_url"}applications/core/interface/email/spacer.png' width='1' height='1' alt=''>
		</td>
	</tr>
	<tr height='30'>
		<td colspan='3' dir='{dir}' class='hidePhone'>
			<img src='{setting="base_url"}applications/core/interface/email/spacer.png' width='1' height='1' alt=''>
		</td>
	</tr>
	<tr>
{{endif}}
<td class='responsive_fullwidth cOurPicksRow' dir='{dir}' width='48%' valign='top' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px;">

This happens because the regex in \IPS\Lang::parseEmail() specifically looks for the {dir} attribute right after the start of a TD element:

		if ( mb_stristr( $output, '{dir}' ) )
		{
			$output = preg_replace( '#(<td\s+?)dir=([\'"]){dir}([\'"])#i', '\1dir=\2' . $dir . '\3', $output );

 

Moving the various dir='{dir}' attributes right after <td fixes it:

<td dir='{dir}' colspan='3' class='hidePhone' style='border-bottom: 1px solid #e0e0e0;'>

<td dir='{dir}' colspan='3' class='hidePhone'>

<td dir='{dir}' class='responsive_fullwidth cOurPicksRow' width='48%' valign='top' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px;">

 

Still, not exactly a reliable way relying on the attributes order in order to parse them properly. The replace code should be updated to work regardless of the order. 👀

Edited by teraßyte
  • 3 weeks later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...