plug_mail.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. if (!class_exists("plug_mail")) {
  3. class plug_mail {
  4. function __construct($ns) {
  5. $this->title = __("mail", "dagsopt");
  6. $this->pluginname = $ns->pluginname;
  7. $this->file = $ns->file;
  8. $this->ns = $ns;
  9. }
  10. function start() {
  11. $this->logfile = fopen(ABSPATH . "/wp-content/uploads/maillog.log", 'a');
  12. add_filter('wp_mail', array(&$this, 'mail_logger'), 10, 1);
  13. }
  14. function mail_logger($args) {
  15. $str = date("Y-m-d");
  16. $str .= " | " . date("H:i:s");
  17. $str .= " | " . $args['to'];
  18. $str .= " | " . $args['subject'];
  19. fwrite($this->logfile, $str . "\n");
  20. return $args;
  21. }
  22. function help() {
  23. ?>
  24. <?php echo (__("Adds mail log functions", "dagsopt")) ?>
  25. <?php
  26. }
  27. function Option($pre) {
  28. // update_option($pre . '_support_splash', $_POST[$pre . '_support_splash']);
  29. }
  30. function fullscreen() {
  31. ?>
  32. <?php
  33. $data = file_get_contents(ABSPATH . "/wp-content/uploads/maillog.log");
  34. ?>
  35. <table class="form-table">
  36. <tr><td style="width: 100px;">Email log</td>
  37. <td>
  38. <textarea class="" rows="40" style="width: 100%; font-size: 11px;"><?php echo ($data) ?></textarea>
  39. </td></tr>
  40. </table>
  41. <?php
  42. }
  43. function admin_line($pre) {
  44. ?>
  45. <hr>
  46. <a href="/wp-admin/admin.php?page=dagsopt-options-mail">Se log</a>
  47. <?php
  48. }
  49. }
  50. global $plug_mail;
  51. $plug_mail = new plug_mail($this);
  52. $this->dagsopt['plug_mail'] = $plug_mail;
  53. }