Login Logo - Version 0.7

Version Description

  • The "title" attribute of the header link matches the WordPress site title instead of saying "Powered by WordPress".
  • The URL for the login logo includes "versioning" based on last file modification date, for browser cache flushing.
Download this release

Release Info

Developer markjaquith
Plugin Icon wp plugin Login Logo
Version 0.7
Comparing to
See all releases

Code changes from version 0.6 to 0.7

Files changed (2) hide show
  1. login-logo.php +20 -13
  2. readme.txt +14 -7
login-logo.php CHANGED
@@ -2,7 +2,7 @@
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. Crop it tight, with a width of 312 pixels, for best results.
5
- Version: 0.6
6
  License: GPL
7
  Plugin URI: http://txfx.net/wordpress-plugins/login-logo/
8
  Author: Mark Jaquith
@@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29
 
30
  class CWS_Login_Logo_Plugin {
31
  static $instance;
32
- const cutoff = 312;
33
  var $logo_locations;
34
  var $logo_location;
35
  var $width = 0;
@@ -51,7 +51,7 @@ class CWS_Login_Logo_Plugin {
51
  // First, see if there is one for this specific site (blog)
52
  $this->logo_locations['site'] = array(
53
  'path' => WP_CONTENT_DIR . '/login-logo-site-' . $blog_id . '.png',
54
- 'url' => $this->maybe_ssl( WP_CONTENT_URL . '/login-logo-site-' . $blog_id . '.png' )
55
  );
56
 
57
  // Next, we see if there is one for this specific network
@@ -59,14 +59,14 @@ class CWS_Login_Logo_Plugin {
59
  if ( $site && isset( $site->id ) ) {
60
  $this->logo_locations['network'] = array(
61
  'path' => WP_CONTENT_DIR . '/login-logo-network-' . $site->id . '.png',
62
- 'url' => $this->maybe_ssl( WP_CONTENT_URL . '/login-logo-network-' . $site->id . '.png' )
63
  );
64
  }
65
  }
66
  // Finally, we do a global lookup
67
  $this->logo_locations['global'] = array(
68
  'path' => WP_CONTENT_DIR . '/login-logo.png',
69
- 'url' => $this->maybe_ssl( WP_CONTENT_URL . '/login-logo.png' )
70
  );
71
  }
72
 
@@ -93,8 +93,10 @@ class CWS_Login_Logo_Plugin {
93
 
94
  private function get_location( $what = '' ) {
95
  if ( $this->logo_file_exists() ) {
96
- if ( 'path' == $what || 'url' == $what )
97
  return $this->logo_location[$what];
 
 
98
  else
99
  return $this->logo_location;
100
  }
@@ -131,11 +133,11 @@ class CWS_Login_Logo_Plugin {
131
  $this->height = $sizes[1];
132
  $this->original_height = $this->height;
133
  $this->original_width = $this->width;
134
- if ( $this->width > self::cutoff ) {
135
  // Use CSS 3 scaling
136
  $ratio = $this->height / $this->width;
137
- $this->height = ceil( $ratio * self::cutoff );
138
- $this->width = self::cutoff;
139
  }
140
  } else {
141
  $this->logo_file_exists = false;
@@ -151,7 +153,11 @@ class CWS_Login_Logo_Plugin {
151
  }
152
 
153
  public function login_headerurl() {
154
- return trailingslashit( get_bloginfo( 'url' ) );
 
 
 
 
155
  }
156
 
157
  public function login_head() {
@@ -159,24 +165,25 @@ class CWS_Login_Logo_Plugin {
159
  if ( !$this->logo_file_exists() )
160
  return;
161
  add_filter( 'login_headerurl', array( $this, 'login_headerurl' ) );
 
162
  ?>
163
  <!-- Login Logo plugin for WordPress: http://txfx.net/wordpress-plugins/login-logo/ -->
164
  <style type="text/css">
165
  .login h1 a {
166
  background: url(<?php echo esc_url_raw( $this->get_location( 'url' ) ); ?>) no-repeat top center;
167
- width: <?php echo self::cutoff; ?>px;
168
  height: <?php echo $this->get_height(); ?>px;
169
  margin-left: 8px;
170
  padding-bottom: 16px;
171
  <?php
172
- if ( self::cutoff < $this->get_original_width() )
173
  $this->css3( 'background-size', 'contain' );
174
  else
175
  $this->css3( 'background-size', 'auto' );
176
  ?>
177
  }
178
  </style>
179
- <?php if ( self::cutoff < $this->get_width() ) { ?>
180
  <!--[if lt IE 9]>
181
  <style type="text/css">
182
  height: <?php echo $this->get_original_height() + 3; ?>px;
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. Crop it tight, with a width of 312 pixels, for best results.
5
+ Version: 0.7
6
  License: GPL
7
  Plugin URI: http://txfx.net/wordpress-plugins/login-logo/
8
  Author: Mark Jaquith
29
 
30
  class CWS_Login_Logo_Plugin {
31
  static $instance;
32
+ const CUTOFF = 312;
33
  var $logo_locations;
34
  var $logo_location;
35
  var $width = 0;
51
  // First, see if there is one for this specific site (blog)
52
  $this->logo_locations['site'] = array(
53
  'path' => WP_CONTENT_DIR . '/login-logo-site-' . $blog_id . '.png',
54
+ 'url' => $this->maybe_ssl( content_url( 'login-logo-site-' . $blog_id . '.png' ) )
55
  );
56
 
57
  // Next, we see if there is one for this specific network
59
  if ( $site && isset( $site->id ) ) {
60
  $this->logo_locations['network'] = array(
61
  'path' => WP_CONTENT_DIR . '/login-logo-network-' . $site->id . '.png',
62
+ 'url' => $this->maybe_ssl( content_url( 'login-logo-network-' . $site->id . '.png' ) )
63
  );
64
  }
65
  }
66
  // Finally, we do a global lookup
67
  $this->logo_locations['global'] = array(
68
  'path' => WP_CONTENT_DIR . '/login-logo.png',
69
+ 'url' => $this->maybe_ssl( content_url( 'login-logo.png' ) )
70
  );
71
  }
72
 
93
 
94
  private function get_location( $what = '' ) {
95
  if ( $this->logo_file_exists() ) {
96
+ if ( 'path' == $what )
97
  return $this->logo_location[$what];
98
+ elseif ( 'url' == $what )
99
+ return $this->logo_location[$what] . '?v=' . filemtime( $this->logo_location['path'] );
100
  else
101
  return $this->logo_location;
102
  }
133
  $this->height = $sizes[1];
134
  $this->original_height = $this->height;
135
  $this->original_width = $this->width;
136
+ if ( $this->width > self::CUTOFF ) {
137
  // Use CSS 3 scaling
138
  $ratio = $this->height / $this->width;
139
+ $this->height = ceil( $ratio * self::CUTOFF );
140
+ $this->width = self::CUTOFF;
141
  }
142
  } else {
143
  $this->logo_file_exists = false;
153
  }
154
 
155
  public function login_headerurl() {
156
+ return esc_url( trailingslashit( get_bloginfo( 'url' ) ) );
157
+ }
158
+
159
+ public function login_headertitle() {
160
+ return esc_attr( get_bloginfo( 'name' ) );
161
  }
162
 
163
  public function login_head() {
165
  if ( !$this->logo_file_exists() )
166
  return;
167
  add_filter( 'login_headerurl', array( $this, 'login_headerurl' ) );
168
+ add_filter( 'login_headertitle', array( $this, 'login_headertitle' ) );
169
  ?>
170
  <!-- Login Logo plugin for WordPress: http://txfx.net/wordpress-plugins/login-logo/ -->
171
  <style type="text/css">
172
  .login h1 a {
173
  background: url(<?php echo esc_url_raw( $this->get_location( 'url' ) ); ?>) no-repeat top center;
174
+ width: <?php echo self::CUTOFF; ?>px;
175
  height: <?php echo $this->get_height(); ?>px;
176
  margin-left: 8px;
177
  padding-bottom: 16px;
178
  <?php
179
+ if ( self::CUTOFF < $this->get_original_width() )
180
  $this->css3( 'background-size', 'contain' );
181
  else
182
  $this->css3( 'background-size', 'auto' );
183
  ?>
184
  }
185
  </style>
186
+ <?php if ( self::CUTOFF < $this->get_width() ) { ?>
187
  <!--[if lt IE 9]>
188
  <style type="text/css">
189
  height: <?php echo $this->get_original_height() + 3; ?>px;
readme.txt CHANGED
@@ -1,10 +1,10 @@
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.3
6
- Tested up to: 3.4
7
- Stable tag: 0.6
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
 
@@ -45,6 +45,10 @@ Your image is probably too wide. Wide images are scaled down in IE 9 or other mo
45
 
46
  == Changelog ==
47
 
 
 
 
 
48
  = 0.6 =
49
  * You can provide `login-logo-site-{$blog_id}.png` to have a different logo per multisite site.
50
  * Support for WordPress 3.4
@@ -70,6 +74,9 @@ Your image is probably too wide. Wide images are scaled down in IE 9 or other mo
70
 
71
  == Upgrade Notice ==
72
 
 
 
 
73
  = 0.6 =
74
  Upgrade now for WordPress 3.4 support! Also adds the ability to set a custom logo per site on a network.
75
 
@@ -83,4 +90,4 @@ Adds support for SSL
83
  Makes the logo link to your site instead of WordPress.org! Support for per-network logos.
84
 
85
  = 0.2 =
86
- Upgrade now to avoid stretching small images.
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.3
6
+ Tested up to: 3.5
7
+ Stable tag: 0.6
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
 
45
 
46
  == Changelog ==
47
 
48
+ = 0.7 =
49
+ * The "title" attribute of the header link matches the WordPress site title instead of saying "Powered by WordPress".
50
+ * The URL for the login logo includes "versioning" based on last file modification date, for browser cache flushing.
51
+
52
  = 0.6 =
53
  * You can provide `login-logo-site-{$blog_id}.png` to have a different logo per multisite site.
54
  * Support for WordPress 3.4
74
 
75
  == Upgrade Notice ==
76
 
77
+ = 0.7 =
78
+ The "title" attribute of the header link matches the WordPress site title instead of saying "Powered by WordPress".
79
+
80
  = 0.6 =
81
  Upgrade now for WordPress 3.4 support! Also adds the ability to set a custom logo per site on a network.
82
 
90
  Makes the logo link to your site instead of WordPress.org! Support for per-network logos.
91
 
92
  = 0.2 =
93
+ Upgrade now to avoid stretching small images.