Ver Fonte

Bumped version to 0.0.73

Jannick Knudsen há 3 anos atrás
pai
commit
3ccd48e877
6 ficheiros alterados com 76 adições e 9 exclusões
  1. 1 1
      VERSION
  2. 1 0
      VERSIONLOG
  3. 0 0
      def_plug_classic.php
  4. 1 1
      package.json
  5. 71 5
      plug_mail.php
  6. 2 2
      plugin.php

+ 1 - 1
VERSION

@@ -1 +1 @@
-v0.0.72
+v0.0.73

+ 1 - 0
VERSIONLOG

@@ -71,3 +71,4 @@ v0.0.69
 v0.0.70
 v0.0.71
 v0.0.72
+v0.0.73

+ 0 - 0
plug_classic.php → def_plug_classic.php


+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "dagsplug",
-  "version": "0.0.72",
+  "version": "0.0.73",
   "description": "",
   "main": "script_backend.js",
   "scripts": {

+ 71 - 5
plug_mail.php

@@ -13,6 +13,67 @@ if (!class_exists("plug_mail")) {
 
 			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) {
@@ -30,11 +91,12 @@ if (!class_exists("plug_mail")) {
 		function help() {
 			?>
 				<?php echo (__("Adds mail log functions", "dagsopt")) ?>
+				<?php echo (__("Adds mail settings", "dagsopt")) ?>
  			<?php
 }
 
 		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) {
 			?>
-
+		  <?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>
 
-		 <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
 }

+ 2 - 2
plugin.php

@@ -4,7 +4,7 @@ Plugin Name: dagsopt
 Plugin URI: https://git.tum.dk/tum.dk/dagsplug/
 Description: Tools
 Author: iskedk
-Version: 0.0.72
+Version: 0.0.73
 Date: 2021-01-14
 Author URI: https://iske.dk/
 Text Domain: dagsopt
@@ -17,7 +17,7 @@ function wppluginspage() {
 $wp_dagsopt = new dagsopt();
 
 class dagsopt {
-	var $version = "0.0.72";
+	var $version = "0.0.73";
 	var $publish_date = "2021-01-14";
 	var $pluginname;
 	var $plugintitle;