You are here

function _simplenews_html_replace in Simplenews 6.2

Same name and namespace in other branches
  1. 6 simplenews.module \_simplenews_html_replace()
  2. 7.2 includes/simplenews.mail.inc \_simplenews_html_replace()
  3. 7 includes/simplenews.mail.inc \_simplenews_html_replace()

Helper function for simplenews_html_to_text().

List of preg* regular expression patterns to search for and replace with

1 call to _simplenews_html_replace()
simplenews_html_to_text in includes/simplenews.mail.inc
HTML to text conversion for HTML and special characters.

File

includes/simplenews.mail.inc, line 775
Simplenews email send and spool handling

Code

function _simplenews_html_replace() {
  return array(
    '/"/i' => '"',
    '/>/i' => '>',
    '/&lt;/i' => '<',
    '/&amp;/i' => '&',
    '/&copy;/i' => '(c)',
    '/&trade;/i' => '(tm)',
    '/&#8220;/' => '"',
    '/&#8221;/' => '"',
    '/&#8211;/' => '-',
    '/&#8217;/' => "'",
    '/&#38;/' => '&',
    '/&#169;/' => '(c)',
    '/&#8482;/' => '(tm)',
    '/&#151;/' => '--',
    '/&#147;/' => '"',
    '/&#148;/' => '"',
    '/&#149;/' => '*',
    '/&reg;/i' => '(R)',
    '/&bull;/i' => '*',
    '/&euro;/i' => 'Euro ',
    '/&frasl;/i' => '/',
    // put a space before cell content, avoid collapse
    '#(</(?:th|td)[^>]*>)#i' => ' $1',
    // make sure <tr> represents a line
    '#(</tr[^>]*>)#i' => '<br />$1',
  );
}