Пример #1
0
 protected static function observe_file2mail($file, $data)
 {
     require_once __DIR__ . '/Smekta.php';
     $msg = file_get_contents($file);
     $msg = GN_Smekta::smektuj($msg, $data, false, [__DIR__ . '/../observer']);
     $body = false;
     $mail = ['msg' => '', 'header' => ''];
     foreach (explode("\n", $msg) as $h) {
         if (!trim($h)) {
             $body = true;
             continue;
         }
         if ($body) {
             $mail['msg'] .= "{$h}\n";
         } else {
             $mail['header'] .= "{$h}\n";
             $pos = strpos($h, ':');
             if ($pos) {
                 $mail[strtolower(substr($h, 0, $pos))] = trim(substr($h, $pos + 1));
             }
         }
     }
     return $mail;
 }
Пример #2
0
 public static function set_debug_fun($df)
 {
     self::$debug_fun = $df;
 }