Jannick Knudsen 4 роки тому
батько
коміт
e9102e8eda
6 змінених файлів з 41 додано та 8 видалено
  1. 1 1
      VERSION
  2. 1 0
      VERSIONLOG
  3. 1 1
      package.json
  4. 35 3
      plug_admin_bar.php
  5. 1 1
      plug_login.php
  6. 2 2
      plugin.php

+ 1 - 1
VERSION

@@ -1 +1 @@
-v0.0.47
+v0.0.48

+ 1 - 0
VERSIONLOG

@@ -46,3 +46,4 @@ v0.0.44
 v0.0.45
 v0.0.46
 v0.0.47
+v0.0.48

+ 1 - 1
package.json

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

+ 35 - 3
plug_admin_bar.php

@@ -77,7 +77,17 @@ if (!class_exists("plug_admin_bar")) {
 		function bu_admin_link_first() {
 			global $wp_admin_bar;
 			if (get_option($this->pluginname . "_admin_bar" . '_dags_logo', true)) {
-				$wp_admin_bar->add_menu(array('id' => 'dags-logo', 'title' => '<img src="/wp-content/plugins/dagsplug/logo.png" style="margin-top: 4px;">', 'href' => 'https://dags.dk/', 'meta' => array('title' => __('Dags dk', 'dagsopt'))));
+				$imageurl = get_option($this->pluginname . "_admin_bar_image", true);
+				if (!$imageurl) {
+					$imageurl = "/wp-content/plugins/dagsplug/logo.png";
+				}
+				if (is_admin()) {
+					$wp_admin_bar->add_menu(array('id' => 'dags-logo', 'title' => '<img src="' . $imageurl . '" style="margin-top: 4px; height: 24px; background-color: #ffff00;">', 'href' => '/', 'meta' => array('title' => __('Home', 'dagsopt'))));
+
+				} else {
+					$wp_admin_bar->add_menu(array('id' => 'dags-logo', 'title' => '<img src="' . $imageurl . '" style="margin-top: 4px; height: 24px; background-color: #ffffff;">', 'href' => '/wp-admin/', 'meta' => array('title' => __('Home', 'dagsopt'))));
+
+				}
 			}
 		}
 		function bu_admin_link_remove_comments() {
@@ -87,8 +97,11 @@ if (!class_exists("plug_admin_bar")) {
 
 		function bu_admin_link_last() {
 			global $wp_admin_bar;
+
+			$wp_admin_bar->remove_node("wp-logo");
+
 			if (get_option($this->pluginname . "_admin_bar" . '_dags_logo', true)) {
-				$wp_admin_bar->remove_node("wp-logo");
+
 			}
 			if (get_option($this->pluginname . "_admin_bar" . '_show_ip', true)) {
 				$wp_admin_bar->add_menu(array('parent' => 'top-secondary', 'id' => 'IP', 'title' => 'IP: ' . $_SERVER['SERVER_ADDR'], 'href' => admin_url('admin.php?page=' . $this->pluginname . '-options')));
@@ -146,6 +159,8 @@ if (!class_exists("plug_admin_bar")) {
 				update_option($pre . '_local_title', $_POST[$pre . '_local_title']);
 			}
 
+			update_option($pre . '_image', $_POST[$pre . '_image']);
+
 			update_option($pre . '_dags_logo', $_POST[$pre . '_dags_logo']);
 			update_option($pre . '_show_ip', $_POST[$pre . '_show_ip']);
 
@@ -165,6 +180,7 @@ if (!class_exists("plug_admin_bar")) {
 
 		function admin_line($pre) {
 			?>
+
 				<table>
 				<tr><td ><?php echo (__("Server switcher", "dagsopt")) ?></td><td><input name="<?php echo ($pre . '_show_switcher'); ?>" type="checkbox" id="<?php echo ($pre . '_show_switcher'); ?>" <?php if (get_option($pre . '_show_switcher', true)) {
 				echo 'checked';
@@ -190,7 +206,23 @@ if (!class_exists("plug_admin_bar")) {
 				<tr><td ><?php echo (__("Dags logo", "dagsopt")) ?></td><td><input name="<?php echo ($pre . '_dags_logo'); ?>" type="checkbox" id="<?php echo ($pre . '_dags_logo'); ?>" <?php if (get_option($pre . '_dags_logo', true)) {
 				echo 'checked';
 			}
-			?> /></td></tr>
+			?> />
+
+
+		<div >
+			<div style="width: 300px; height: 100px; overflow: hidden">
+				<img height="100" src="<?php echo (stripslashes(get_option($pre . "_image"))); ?>">
+			</div>
+
+		  <?php echo (__("Login image:", "dagsopt")) ?><br>
+		<input type="text" name="<?php echo ($pre . '_image'); ?>" class="valuereciever" value="<?php echo (stripslashes(get_option($pre . "_image"))); ?>" />
+
+		<button class="button uploadbutton">Upload</button>
+		</div>
+
+
+
+		</td></tr>
 
 
 				<tr><td ><?php echo (__("Show IP", "dagsopt")) ?></td><td><input name="<?php echo ($pre . '_show_ip'); ?>" type="checkbox" id="<?php echo ($pre . '_show_ip'); ?>" <?php if (get_option($pre . '_show_ip', true)) {

+ 1 - 1
plug_login.php

@@ -95,7 +95,7 @@ if (!class_exists("plug_login")) {
               	custom_uploader.on('select', function() {
                     attachment = custom_uploader.state().get('selection').first().toJSON();
                     console.log(attachment);
-                    target.val("/"+attachment.url.split("/").slice(3).join("/"));
+                    target.val("<?php echo WP_SITEURL_CDN ?>/"+attachment.url.split("/").slice(3).join("/"));
 
 					preview.attr("src", target.val() );
 

+ 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.47
+Version: 0.0.48
 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.47";
+	var $version = "0.0.48";
 	var $publish_date = "2021-01-14";
 	var $pluginname;
 	var $plugintitle;