Esempio n. 1
0
 /**
  * Retrieve the global instance, creating it if necessary.
  */
 public static function instance()
 {
     if (self::$instance === null) {
         self::$instance = new HectaneAPI();
     }
     return self::$instance;
 }
Esempio n. 2
0
 /**
  * Override the default implementation of wp_mail().
  *
  * This function is responsible for marshalling the parameters into the JSON
  * data that is sent to Hectane.
  */
 function wp_mail($to, $subject, $message, $headers = '', $attachments = array())
 {
     if (!is_array($to)) {
         $to = array($to);
     }
     $headers = hectane_parseHeaders($headers);
     $from = hectane_emailFrom($headers);
     unset($headers['From']);
     $email = array('from' => $from, 'to' => is_array($to) ? $to : array($to), 'subject' => $subject, 'headers' => $headers ? $headers : new stdClass());
     if (hectane_isMessageHtml($message)) {
         $email['html'] = $message;
     } else {
         $email['text'] = $message;
     }
     return HectaneAPI::instance()->send($email);
 }