| 1 |
<?php /* $Id: mimemail.module,v 1.43 2009/02/22 23:31:35 jerdavis Exp $ */ |
<?php /* $Id: mimemail.module,v 1.44 2009/02/23 04:28:46 jerdavis Exp $ */ |
| 2 |
|
|
| 3 |
/** |
/** |
| 4 |
* @file |
* @file |
| 54 |
} |
} |
| 55 |
|
|
| 56 |
/** |
/** |
| 57 |
|
* Implementation of hook_theme(). |
| 58 |
|
*/ |
| 59 |
|
function mimemail_theme() { |
| 60 |
|
module_load_include('theme.inc', 'mimemail', 'theme/mimemail'); |
| 61 |
|
return mimemail_theme_theme(); |
| 62 |
|
} |
| 63 |
|
|
| 64 |
|
/** |
| 65 |
* Sends a mime-encoded e-mail. |
* Sends a mime-encoded e-mail. |
| 66 |
* |
* |
| 67 |
* This function first determines the mail engine to use, then prepares the |
* This function first determines the mail engine to use, then prepares the |
| 282 |
return mimemail($from, $to, $subject, $body, NULL, $headers, NULL, array(), $mailkey); |
return mimemail($from, $to, $subject, $body, NULL, $headers, NULL, array(), $mailkey); |
| 283 |
} |
} |
| 284 |
} |
} |
|
|
|
|
/** |
|
|
* Implementation of hook_theme(). |
|
|
*/ |
|
|
function mimemail_theme() { |
|
|
$path = drupal_get_path('module', 'mimemail') .'/theme'; |
|
|
|
|
|
return array( |
|
|
'mimemail_message' => array( |
|
|
'arguments' => array('body' => NULL, 'mailkey' => NULL), |
|
|
'template' => 'mimemail', |
|
|
'pattern' => 'mimemail__', |
|
|
'path' => $path, |
|
|
) |
|
|
); |
|
|
} |
|
|
|
|
|
/** |
|
|
* A preprocess function for theme('mimemail_message'). |
|
|
* |
|
|
* The $variables array initially contains the following arguments: |
|
|
* - $body: The message body |
|
|
* - $mailkey: The mailkey associated with the message |
|
|
* |
|
|
* See includes/mimemail.tpl.php for additional variables |
|
|
*/ |
|
|
function template_preprocess_mimemail_message(&$variables) { |
|
|
$theme = variable_get('theme_default', NULL); |
|
|
|
|
|
// Check for the existence of a mail.css file in the current theme folder |
|
|
if (!file_exists($styles)) { |
|
|
$styles = drupal_get_path('theme', $theme) .'/mail.css'; |
|
|
} |
|
|
|
|
|
// If no mail.css was found, gather all style sheets |
|
|
if (!file_exists($styles)) { |
|
|
// embed a version of all style definitions |
|
|
$styles = preg_replace('|<link.*href="'. base_path() |
|
|
.'([^"?]*)[?"].*|', '\1', drupal_get_css()); |
|
|
} |
|
|
|
|
|
// Process each style sheet |
|
|
foreach (explode("\n", $styles) as $style) { |
|
|
if (file_exists($style)) $css .= file_get_contents($style); |
|
|
} |
|
|
|
|
|
$variables['css'] = str_replace(' ','', str_replace("\n", '', $css)); |
|
|
} |
|