Version Description
Download this release
Release Info
Developer | uberweb |
Plugin | Uber Login Logo |
Version | 0.6 |
Comparing to | |
See all releases |
Code changes from version 0.51 to 0.6
- readme.txt +11 -3
- uber-login-logo-min.js +1 -4
- uber-login-logo.php +14 -12
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: uberweb
|
3 |
Tags: login, logo, login logo, admin, customisation, customization, branding, custom login, media uploader, AJAX, wp-login
|
4 |
Requires at least: 3.5
|
5 |
-
Tested up to: 3.5
|
6 |
-
Stable tag: 0.
|
7 |
|
8 |
A simple, lightweight WordPress plugin to change your login logo.
|
9 |
|
@@ -37,7 +37,15 @@ As of 0.5 This plugin makes use of the new media editor introduced in WordPress
|
|
37 |
|
38 |
== Changelog ==
|
39 |
|
40 |
-
=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
* javascript entirely rewritten to make use of the new media editor in WP 3.5.
|
43 |
|
2 |
Contributors: uberweb
|
3 |
Tags: login, logo, login logo, admin, customisation, customization, branding, custom login, media uploader, AJAX, wp-login
|
4 |
Requires at least: 3.5
|
5 |
+
Tested up to: 3.5.1
|
6 |
+
Stable tag: 0.6
|
7 |
|
8 |
A simple, lightweight WordPress plugin to change your login logo.
|
9 |
|
37 |
|
38 |
== Changelog ==
|
39 |
|
40 |
+
= version 0.6 =
|
41 |
+
|
42 |
+
* The image size selected in the media manager is now the size that is shown on the login page.
|
43 |
+
|
44 |
+
= version 0.51 =
|
45 |
+
|
46 |
+
* updated API calls in the admin section
|
47 |
+
|
48 |
+
= Version 0.5 =
|
49 |
|
50 |
* javascript entirely rewritten to make use of the new media editor in WP 3.5.
|
51 |
|
uber-login-logo-min.js
CHANGED
@@ -1,5 +1,2 @@
|
|
1 |
var Uber=Uber||{};
|
2 |
-
(function(d){Uber.LoginLogo={config:{version:"0.
|
3 |
-
this;this.elems.$uploadTrigger.on("click",function(){a.config.editor.open();return!1});this.config.editor.on("open",this.preSelectImage)}},setEditor:function(){this.config.editor=wp.media.editor.add("content")},setNonce:function(){this.config.nonce=this.elems.$nonceInput.val()},getOptions:function(){var a=this;d.ajax({url:ajaxurl,type:"post",dataType:"json",data:{action:"displayPreviewImg",uber_login_logo_nonce:this.config.nonce}}).done(function(b){a.showImagePreview(b)})},updateOptions:function(a,
|
4 |
-
b){var c=this;d.ajax({url:ajaxurl,type:"post",dataType:"json",data:{action:"getImageData",id:a,src:b,uber_login_logo_nonce:this.config.nonce}}).done(function(a){c.showImagePreview(a);c.elems.$updateStatus.show()})},showImagePreview:function(a){this.elems.$uploadInput.val(a.src);this.elems.$imgPreview.html('<img src="'+a.src+'" />');this.elems.$imgHolder.show();this.config.selectedId=a.id},preSelectImage:function(){var a=this.config.editor.state().get("selection"),b=wp.media.attachment(this.config.selectedId);
|
5 |
-
b.fetch();a.add(b?[b]:[])},catchInsert:function(){var a=this;wp.media.editor.send.attachment=function(b,c){a.updateOptions(c.id,c.url)}}};Uber.Tools={setElems:function(a,b,c){b.elems=b.elems||{};for(var e in a)b.elems[e]=c?c.find(a[e]):d(a[e])},doesElemExist:function(a){return"undefined"!==typeof a&&a.length}};d(function(){Uber.LoginLogo.init()})})(jQuery,window,document);
|
1 |
var Uber=Uber||{};
|
2 |
+
(function(d){Uber.LoginLogo={config:{version:"0.6",nonce:null,editor:null,selectedId:0},elems:{$container:".uber-login-logo",$uploadTrigger:".upload-image",$uploadInput:"#upload-input",$nonceInput:"#uber_login_logo_nonce",$updateStatus:".update-status",$imgHolder:".img-holder",$imgPreview:".img-preview"},init:function(){Uber.Tools.setElems(this.elems,this);if(Uber.Tools.doesElemExist(this.elems.$container)){_.bindAll(this);this.setNonce();this.setEditor();this.getOptions();this.catchInsert();var a=this;this.elems.$uploadTrigger.on("click",function(){a.config.editor.open();return!1});this.config.editor.on("open",this.preSelectImage)}},setEditor:function(){this.config.editor=wp.media.editor.add("content")},setNonce:function(){this.config.nonce=this.elems.$nonceInput.val()},getOptions:function(){var a=this;d.ajax({url:ajaxurl,type:"post",dataType:"json",data:{action:"displayPreviewImg",uber_login_logo_nonce:this.config.nonce}}).done(function(b){a.showImagePreview(b)})},updateOptions:function(a,b){var c=this;d.ajax({url:ajaxurl,type:"post",dataType:"json",data:{action:"getImageData",id:a,size:b,uber_login_logo_nonce:this.config.nonce}}).done(function(a){c.showImagePreview(a);c.elems.$updateStatus.show()})},showImagePreview:function(a){this.elems.$uploadInput.val(a.src);this.elems.$imgPreview.html('<img src="'+a.src+'" />');this.elems.$imgHolder.show();this.config.selectedId=a.id},preSelectImage:function(){var a=this.config.editor.state().get("selection"),b=wp.media.attachment(this.config.selectedId);b.fetch();a.add(b?[b]:[])},catchInsert:function(){var a=this;wp.media.editor.send.attachment=function(b,c){a.updateOptions(c.id,b.size)}}};Uber.Tools={setElems:function(a,b,c){b.elems=b.elems||{};for(var e in a)b.elems[e]=c?c.find(a[e]):d(a[e])},doesElemExist:function(a){return"undefined"!==typeof a&&a.length}};d(function(){Uber.LoginLogo.init()})})(jQuery,window,document);
|
|
|
|
|
|
uber-login-logo.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* @link http://www.uberweb.com.au/uber-login-logo-wordpress-plugin/
|
7 |
*
|
8 |
* @author Alex Rogers
|
9 |
-
* @version 0.
|
10 |
* @package Uber_Login_Logo
|
11 |
*/
|
12 |
|
@@ -14,7 +14,7 @@
|
|
14 |
Plugin Name: Uber Login Logo
|
15 |
Plugin URI: http://www.uberweb.com.au/uber-login-logo-wordpress-plugin/
|
16 |
Description: Change login logo.
|
17 |
-
Version: 0.
|
18 |
Author: UberWeb
|
19 |
Author URI: http://www.uberweb.com.au/
|
20 |
License: GPLv2 or later
|
@@ -54,7 +54,7 @@ class UberLoginLogo
|
|
54 |
/**
|
55 |
* @const VERSION The current plugin version
|
56 |
*/
|
57 |
-
const VERSION = '0.
|
58 |
|
59 |
/**
|
60 |
* @const UBERURL Link to uberweb site
|
@@ -85,7 +85,7 @@ class UberLoginLogo
|
|
85 |
public static function myAdminScriptsAndStyles()
|
86 |
{
|
87 |
wp_register_style('uber-login-logo', self::getPluginDir() . '/uber-login-logo-min.css', array(), self::VERSION);
|
88 |
-
wp_register_script('uber-login-logo', self::getPluginDir() . '/uber-login-logo-min.js', array('jquery','media-upload','thickbox'), self::VERSION);
|
89 |
|
90 |
wp_enqueue_media();
|
91 |
wp_enqueue_style('uber-login-logo');
|
@@ -148,7 +148,7 @@ class UberLoginLogo
|
|
148 |
<ol>
|
149 |
<li>Use the WordPress media uploader to upload an image, or select one from the media library.</li>
|
150 |
<li>It is highly recommended that you select an image with a width less than 320px.</li>
|
151 |
-
<li>Select
|
152 |
<li>Finished!</li>
|
153 |
</ol>
|
154 |
<form class="inputfields">
|
@@ -187,18 +187,21 @@ class UberLoginLogo
|
|
187 |
{
|
188 |
if (!empty($_POST) && check_admin_referer('uber_login_logo_action','uber_login_logo_nonce')) {
|
189 |
if (current_user_can('manage_options')) {
|
|
|
190 |
$img_id = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT);
|
191 |
-
$
|
192 |
-
$img_meta = wp_get_attachment_metadata($img_id, false);
|
193 |
|
|
|
|
|
|
|
|
|
194 |
$img_data['id'] = $img_id;
|
195 |
-
$img_data['src'] = $
|
196 |
-
$img_data['
|
197 |
-
$img_data['
|
198 |
|
199 |
update_option(uber_login_logo, $img_data);
|
200 |
|
201 |
-
//$returnval = $img_data['src'];
|
202 |
$returnval = json_encode(array('src' => $img_data['src'], 'id' => $img_data['id']));
|
203 |
die($returnval);
|
204 |
}
|
@@ -214,7 +217,6 @@ class UberLoginLogo
|
|
214 |
if (current_user_can('manage_options')) {
|
215 |
$img_data = get_option('uber_login_logo');
|
216 |
if ($img_data) {
|
217 |
-
//$returnval = $img_data['src'];
|
218 |
$returnval = json_encode(array('src' => $img_data['src'], 'id' => $img_data['id']));
|
219 |
}
|
220 |
else {
|
6 |
* @link http://www.uberweb.com.au/uber-login-logo-wordpress-plugin/
|
7 |
*
|
8 |
* @author Alex Rogers
|
9 |
+
* @version 0.6
|
10 |
* @package Uber_Login_Logo
|
11 |
*/
|
12 |
|
14 |
Plugin Name: Uber Login Logo
|
15 |
Plugin URI: http://www.uberweb.com.au/uber-login-logo-wordpress-plugin/
|
16 |
Description: Change login logo.
|
17 |
+
Version: 0.6
|
18 |
Author: UberWeb
|
19 |
Author URI: http://www.uberweb.com.au/
|
20 |
License: GPLv2 or later
|
54 |
/**
|
55 |
* @const VERSION The current plugin version
|
56 |
*/
|
57 |
+
const VERSION = '0.6';
|
58 |
|
59 |
/**
|
60 |
* @const UBERURL Link to uberweb site
|
85 |
public static function myAdminScriptsAndStyles()
|
86 |
{
|
87 |
wp_register_style('uber-login-logo', self::getPluginDir() . '/uber-login-logo-min.css', array(), self::VERSION);
|
88 |
+
wp_register_script('uber-login-logo', self::getPluginDir() . '/uber-login-logo-min.js', array('jquery','media-upload','thickbox','underscore'), self::VERSION);
|
89 |
|
90 |
wp_enqueue_media();
|
91 |
wp_enqueue_style('uber-login-logo');
|
148 |
<ol>
|
149 |
<li>Use the WordPress media uploader to upload an image, or select one from the media library.</li>
|
150 |
<li>It is highly recommended that you select an image with a width less than 320px.</li>
|
151 |
+
<li>Select your desired image size and click "insert into post".</li>
|
152 |
<li>Finished!</li>
|
153 |
</ol>
|
154 |
<form class="inputfields">
|
187 |
{
|
188 |
if (!empty($_POST) && check_admin_referer('uber_login_logo_action','uber_login_logo_nonce')) {
|
189 |
if (current_user_can('manage_options')) {
|
190 |
+
// sanitize inputs
|
191 |
$img_id = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT);
|
192 |
+
$img_size = filter_input(INPUT_POST, 'size', FILTER_SANITIZE_STRING);
|
|
|
193 |
|
194 |
+
// get the img at the correct size
|
195 |
+
$img = wp_get_attachment_image_src($img_id, $img_size);
|
196 |
+
|
197 |
+
// save src + attribs in the DB
|
198 |
$img_data['id'] = $img_id;
|
199 |
+
$img_data['src'] = $img[0];
|
200 |
+
$img_data['width'] = $img[1];
|
201 |
+
$img_data['height'] = $img[2];
|
202 |
|
203 |
update_option(uber_login_logo, $img_data);
|
204 |
|
|
|
205 |
$returnval = json_encode(array('src' => $img_data['src'], 'id' => $img_data['id']));
|
206 |
die($returnval);
|
207 |
}
|
217 |
if (current_user_can('manage_options')) {
|
218 |
$img_data = get_option('uber_login_logo');
|
219 |
if ($img_data) {
|
|
|
220 |
$returnval = json_encode(array('src' => $img_data['src'], 'id' => $img_data['id']));
|
221 |
}
|
222 |
else {
|