Version Description
- Original version
=
Download this release
Release Info
Developer | markjaquith |
Plugin | Login Logo |
Version | 0.1 |
Comparing to | |
See all releases |
Version 0.1
- login-logo.php +107 -0
- readme.txt +49 -0
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
login-logo.php
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Login Logo
|
4 |
+
Description: Drop a PNG file named <code>login-logo.png</code> into your <code>wp-content</code> directory. This simple plugin takes care of the rest, with zero configuration. Transparent backgrounds work best. Keep the width below 326 pixels.
|
5 |
+
Version: 0.1
|
6 |
+
License: GPL
|
7 |
+
Author: Mark Jaquith
|
8 |
+
Author URI: http://coveredwebservices.com/
|
9 |
+
*/
|
10 |
+
|
11 |
+
class CWS_Login_Logo_Plugin {
|
12 |
+
static $instance;
|
13 |
+
var $logo_path;
|
14 |
+
var $logo_url;
|
15 |
+
var $width = 0;
|
16 |
+
var $height = 0;
|
17 |
+
var $original_height;
|
18 |
+
var $logo_size;
|
19 |
+
var $logo_file_exists;
|
20 |
+
|
21 |
+
public function __construct() {
|
22 |
+
self::$instance = $this;
|
23 |
+
$this->add_hooks();
|
24 |
+
}
|
25 |
+
|
26 |
+
private function add_hooks() {
|
27 |
+
add_action( 'init', array( $this, 'init' ) );
|
28 |
+
add_action( 'login_head', array( $this, 'login_head' ) );
|
29 |
+
}
|
30 |
+
|
31 |
+
public function init() {
|
32 |
+
$this->logo_path = WP_CONTENT_DIR . '/login-logo.png';
|
33 |
+
$this->logo_url = WP_CONTENT_URL . '/login-logo.png';
|
34 |
+
}
|
35 |
+
|
36 |
+
private function logo_file_exists() {
|
37 |
+
if ( ! isset( $this->logo_file_exists ) )
|
38 |
+
$this->logo_file_exists = !! file_exists( $this->logo_path );
|
39 |
+
return !! $this->logo_file_exists;
|
40 |
+
}
|
41 |
+
|
42 |
+
private function get_width() {
|
43 |
+
$this->get_logo_size();
|
44 |
+
return absint( $this->width );
|
45 |
+
}
|
46 |
+
|
47 |
+
private function get_height() {
|
48 |
+
$this->get_logo_size();
|
49 |
+
return absint( $this->height );
|
50 |
+
}
|
51 |
+
|
52 |
+
private function get_original_height() {
|
53 |
+
$this->get_logo_size();
|
54 |
+
return absint( $this->original_height );
|
55 |
+
}
|
56 |
+
|
57 |
+
private function get_logo_size() {
|
58 |
+
if ( !$this->logo_file_exists() )
|
59 |
+
return false;
|
60 |
+
if ( !$this->logo_size ) {
|
61 |
+
if ( $sizes = getimagesize( $this->logo_path ) ) {
|
62 |
+
$this->logo_size = $sizes;
|
63 |
+
$this->width = $sizes[0];
|
64 |
+
$this->height = $sizes[1];
|
65 |
+
$this->original_height = $this->height;
|
66 |
+
if ( $this->width > 326 ) {
|
67 |
+
// Use CSS 3 scaling
|
68 |
+
$ratio = $this->height / $this->width;
|
69 |
+
$this->height = ceil( $ratio * 326 );
|
70 |
+
$this->width = 326;
|
71 |
+
}
|
72 |
+
} else {
|
73 |
+
$this->logo_file_exists = false;
|
74 |
+
}
|
75 |
+
}
|
76 |
+
return array( $this->width, $this->height );
|
77 |
+
}
|
78 |
+
|
79 |
+
private function css3( $rule, $value ) {
|
80 |
+
foreach ( array( '', '-o-', '-webkit-', '-khtml-', '-moz-', '-ms-' ) as $prefix ) {
|
81 |
+
echo $prefix . $rule . ': ' . $value . '; ';
|
82 |
+
}
|
83 |
+
}
|
84 |
+
|
85 |
+
public function login_head() {
|
86 |
+
?>
|
87 |
+
<!-- Login Logo plugin for WordPress: http://txfx.net/wordpress-plugins/login-logo/ -->
|
88 |
+
<style type="text/css">
|
89 |
+
h1 a {
|
90 |
+
background: url(<?php echo esc_url_raw( $this->logo_url ); ?>) no-repeat top center;
|
91 |
+
width: 326px;
|
92 |
+
height: <?php echo $this->get_height() + 3; ?>px;
|
93 |
+
<?php $this->css3( 'background-size', 'contain' ); ?>
|
94 |
+
}
|
95 |
+
</style>
|
96 |
+
<!--[if lt IE 9]>
|
97 |
+
<style type="text/css">
|
98 |
+
height: <?php echo $this->get_original_height() + 3; ?>px;
|
99 |
+
</style>
|
100 |
+
<![endif]-->
|
101 |
+
<?php
|
102 |
+
}
|
103 |
+
|
104 |
+
}
|
105 |
+
|
106 |
+
// Bootstrap
|
107 |
+
new CWS_Login_Logo_Plugin;
|
readme.txt
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Login Logo ===
|
2 |
+
Contributors: markjaquith
|
3 |
+
Donate link: http://txfx.net/wordpress-plugins/donate
|
4 |
+
Tags: customize, login, login screen, logo, custom logo
|
5 |
+
Requires at least: 3.0
|
6 |
+
Tested up to: 3.1
|
7 |
+
Stable tag: trunk
|
8 |
+
|
9 |
+
Customize the logo on the WP login screen by simply dropping a file named login-logo.png into your WP content directory. CSS is automatic!
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
This plugin allows you to customize the logo on the WordPress login screen. There is zero configuration. You just drop the logo file into your WordPress content directory, named `login-logo.png` and this plugin takes over.
|
14 |
+
|
15 |
+
Note that you should use a transparent background on the PNG image and keep the width below 326 pixels for best results. Larger images will be downsized in modern browsers, but it isn't recommended to rely on that.
|
16 |
+
|
17 |
+
This plugin also works in the `mu-plugins` directory.
|
18 |
+
|
19 |
+
== Installation ==
|
20 |
+
|
21 |
+
1. [Click here](http://coveredwebservices.com/wp-plugin-install/?plugin=login-logo) to install and activate.
|
22 |
+
|
23 |
+
2. Create a PNG image of less than 326 pixels wide, with a transparent background.
|
24 |
+
|
25 |
+
3. Upload the PNG image to your WordPress content directory (`/wp-content/`, by default), and name the file `login-logo.png`.
|
26 |
+
|
27 |
+
4. Done! The login screen will now use your logo.
|
28 |
+
|
29 |
+
== Screenshots ==
|
30 |
+
|
31 |
+
1. A login screen with a custom logo
|
32 |
+
|
33 |
+
2. A source image
|
34 |
+
|
35 |
+
== Frequently Asked Questions ==
|
36 |
+
|
37 |
+
= Why does my image look strange in IE or an outdated browser? =
|
38 |
+
|
39 |
+
Your image is probably too wide. Wide images are scaled down in IE 9 or other modern browsers, but not in older browsers. Use an image that is no more than 326 pixels wide.
|
40 |
+
|
41 |
+
|
42 |
+
== Changelog ==
|
43 |
+
|
44 |
+
= 0.1 =
|
45 |
+
* Original version
|
46 |
+
|
47 |
+
== Upgrade Notice ==
|
48 |
+
|
49 |
+
Upgrade now!
|
screenshot-1.png
ADDED
Binary file
|
screenshot-2.png
ADDED
Binary file
|