|
@@ -13,6 +13,67 @@ if (!class_exists("plug_mail")) {
|
|
|
|
|
|
add_filter('wp_mail', array(&$this, 'mail_logger'), 10, 1);
|
|
add_filter('wp_mail', array(&$this, 'mail_logger'), 10, 1);
|
|
|
|
|
|
|
|
+ add_filter('wp_mail_from_name', array(&$this, 'sender_name'));
|
|
|
|
+ add_filter('wp_mail_from', array(&$this, 'sender_email'));
|
|
|
|
+
|
|
|
|
+ //add_filter("wp_footer", array(&$this, 'tester'));
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function sender_email($original_email_address) {
|
|
|
|
+ $g = stripcslashes(get_option($this->pluginname . "_mail_emailsettings"));
|
|
|
|
+ $arr = json_decode($g, true);
|
|
|
|
+
|
|
|
|
+ if (isset($arr[$_SERVER['HTTP_HOST']])) {
|
|
|
|
+ $darr = $arr[$_SERVER['HTTP_HOST']];
|
|
|
|
+ } else {
|
|
|
|
+ $dom = explode(".", $_SERVER['HTTP_HOST']);
|
|
|
|
+ $topdom = implode(".", array_slice($dom, -2));
|
|
|
|
+ if (isset($arr[$topdom])) {
|
|
|
|
+ $darr = $arr[$topdom];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (isset($darr)) {
|
|
|
|
+ return $darr[1];
|
|
|
|
+ } else {
|
|
|
|
+ return $original_email_address;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function sender_name($original_email_from) {
|
|
|
|
+ $g = stripcslashes(get_option($this->pluginname . "_mail_emailsettings"));
|
|
|
|
+ $arr = json_decode($g, true);
|
|
|
|
+ if (isset($arr[$_SERVER['HTTP_HOST']])) {
|
|
|
|
+ $darr = $arr[$_SERVER['HTTP_HOST']];
|
|
|
|
+ } else {
|
|
|
|
+ $dom = explode(".", $_SERVER['HTTP_HOST']);
|
|
|
|
+ $topdom = implode(".", array_slice($dom, -2));
|
|
|
|
+ if (isset($arr[$topdom])) {
|
|
|
|
+ $darr = $arr[$topdom];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (isset($darr)) {
|
|
|
|
+ return $darr[0];
|
|
|
|
+ } else {
|
|
|
|
+ return $original_email_from;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function tester() {
|
|
|
|
+ $g = stripcslashes(get_option($this->pluginname . "_mail_emailsettings"));
|
|
|
|
+ $arr = json_decode($g, true);
|
|
|
|
+ if (isset($arr[$_SERVER['HTTP_HOST']])) {
|
|
|
|
+ $darr = $arr[$_SERVER['HTTP_HOST']];
|
|
|
|
+ } else {
|
|
|
|
+ $dom = explode(".", $_SERVER['HTTP_HOST']);
|
|
|
|
+ $topdom = implode(".", array_slice($dom, -2));
|
|
|
|
+ if (isset($arr[$topdom])) {
|
|
|
|
+ $darr = $arr[$topdom];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (isset($darr)) {
|
|
|
|
+ print_r($darr);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
function mail_logger($args) {
|
|
function mail_logger($args) {
|
|
@@ -30,11 +91,12 @@ if (!class_exists("plug_mail")) {
|
|
function help() {
|
|
function help() {
|
|
?>
|
|
?>
|
|
<?php echo (__("Adds mail log functions", "dagsopt")) ?>
|
|
<?php echo (__("Adds mail log functions", "dagsopt")) ?>
|
|
|
|
+ <?php echo (__("Adds mail settings", "dagsopt")) ?>
|
|
<?php
|
|
<?php
|
|
}
|
|
}
|
|
|
|
|
|
function Option($pre) {
|
|
function Option($pre) {
|
|
- // update_option($pre . '_support_splash', $_POST[$pre . '_support_splash']);
|
|
|
|
|
|
+ update_option($pre . '_emailsettings', $_POST[$pre . '_emailsettings']);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -67,14 +129,18 @@ $data = file_get_contents(ABSPATH . "/wp-content/uploads/maillog.log");
|
|
|
|
|
|
function admin_line($pre) {
|
|
function admin_line($pre) {
|
|
?>
|
|
?>
|
|
-
|
|
|
|
|
|
+ <?php echo (__("Emailsettings:", "dagsopt")) ?><br><textarea style="width: 100%; height: 150px;" name="<?php echo ($pre . '_emailsettings'); ?>"><?php echo (stripcslashes(get_option($pre . "_emailsettings"))); ?></textarea>
|
|
<hr>
|
|
<hr>
|
|
|
|
|
|
- <a href="/wp-admin/admin.php?page=dagsopt-options-mail">Se log</a>
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+<?php echo ($pre . "_emailsettings"); ?>
|
|
|
|
+<?php
|
|
|
|
+$g = stripcslashes(get_option($pre . "_emailsettings"));
|
|
|
|
+ $arr = json_decode($g, true);
|
|
|
|
+ ?>
|
|
|
|
|
|
|
|
+ <hr>
|
|
|
|
|
|
|
|
+ <a href="/wp-admin/admin.php?page=dagsopt-options-mail">Se log</a>
|
|
|
|
|
|
<?php
|
|
<?php
|
|
}
|
|
}
|