/[drupal]/contributions/modules/mimemail/mimemail.module
ViewVC logotype

Diff of /contributions/modules/mimemail/mimemail.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.44, Mon Feb 23 04:28:46 2009 UTC revision 1.45, Fri May 15 14:36:12 2009 UTC
# Line 1  Line 1 
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
# Line 54  function mimemail_user($op, &$edit, &$ac Line 54  function mimemail_user($op, &$edit, &$ac
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
# Line 274  if (strpos(variable_get('smtp_library', Line 282  if (strpos(variable_get('smtp_library',
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));  
 }  

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.45

  ViewVC Help
Powered by ViewVC 1.1.2