Add Logo to Admin - Version 1.6

Version Description

(2014-02-12) =

  • Added WP media uploader
  • Rebuilt plugin using OOP
  • Created language file
  • Updated screenshots to reflect new admin page
  • Added validation to settings

1.5.1 (2012-10-04)

  • Fixed login screen image size

1.5 (2012-01-12)

  • Updated for WP 3.3
  • Improved coding
  • Added security nonce

1.4 (2011-02-18)

  • Updated for WP 3.1
  • Removed extraneous CSS and JS files
  • Improved coding

1.3.3 (2009-03-10)

  • Fixed issue with IE7 and logo not displaying

1.3.2 (2009-03-01)

  • Fixed issue with invading other admin pages save function

1.3.1 (2009-02-26)

  • Fixed issue with spaces in filename

1.3 (2009-02-25)

  • Created uploader for logos
  • Added "Settings" link on plugins page
  • Added option to delete logo
  • Added logo select option
  • Updated CSS

1.2 (2009-02-23)

  • Fixed issue with WP installs in subdirectories
  • Removed old code
  • Tested on WP version 2.7.1

1.1 (2008-12-24)

  • Added admin page with options
  • Fixed window.onload JavaScript issue
  • Fixed issue with blogs not located in the root directory
  • Removed extraneous code

1.0.2 (2008-12-16) Fixed weirdness with extra folder

1.0.1 (2008-12-16) Fixed the code to direct to the proper plugin folder

1.0 (2008-12-15) Initial Public Release

=

Download this release

Release Info

Developer tinkerpriest
Plugin Icon wp plugin Add Logo to Admin
Version 1.6
Comparing to
See all releases

Code changes from version 1.3.3 to 1.6

add-logo-to-admin.php ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Add Logo to Admin
4
+ Plugin URI: http://bavotasan.com/2011/add-your-logo-to-the-wordpress-admin-and-login-page/
5
+ Description: Adds a custom logo to your wp-admin and login page.
6
+ Author: c.bavota
7
+ Version: 1.6
8
+ Author URI: http://bavotasan.com
9
+ Text Domain: add-logo
10
+ Domain Path: /languages
11
+ License: GPL2
12
+ */
13
+
14
+ /* Copyright 2014 c.bavota (email : cbavota@gmail.com)
15
+
16
+ This program is free software; you can redistribute it and/or modify
17
+ it under the terms of the GNU General Public License, version 2, as
18
+ published by the Free Software Foundation.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28
+ */
29
+
30
+ // Plugin version
31
+ if ( ! defined( 'ADD_LOGO_VERSION' ) ) {
32
+ define( 'ADD_LOGO_VERSION', '1.6' );
33
+ }
34
+
35
+ if ( ! class_exists( 'WP_Add_Logo_To_Admin' ) ) {
36
+ class WP_Add_Logo_To_Admin {
37
+ /**
38
+ * Construct the plugin object
39
+ */
40
+ public function __construct() {
41
+ $plugin_options = get_option( 'wp_add_logo_to_admin' );
42
+
43
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
44
+ add_action( 'admin_init', array( $this, 'admin_init' ) );
45
+ add_action( 'admin_menu', array( $this, 'admin_menu' ) );
46
+
47
+ if ( 'on' == $plugin_options['login'] ) {
48
+ add_action( 'login_enqueue_scripts', array( $this, 'login_enqueue_scripts' ) );
49
+ add_filter( 'login_headertitle', array( $this, 'login_headertitle' ) );
50
+ add_filter( 'login_headerurl', array( $this, 'login_headerurl' ) );
51
+ }
52
+
53
+ }
54
+
55
+ public function admin_init() {
56
+ register_setting( 'wp_add_logo_to_admin', 'wp_add_logo_to_admin', array( $this, 'wp_add_logo_to_admin_validation' ) );
57
+
58
+ load_plugin_textdomain( 'add-logo', null, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
59
+ }
60
+
61
+ /**
62
+ * Validation
63
+ *
64
+ * @since 1.6
65
+ */
66
+ public function wp_add_logo_to_admin_validation( $input ) {
67
+ $input['login'] = ( empty( $input['login'] ) ) ? '' : 'on';
68
+ $input['admin'] = ( empty( $input['admin'] ) ) ? '' : 'on';
69
+ $input['image'] = esc_url( $input['image'] );
70
+
71
+ return $input;
72
+ }
73
+
74
+ public function admin_menu() {
75
+ add_options_page( __( 'Add Logo to Admin', 'add-logo' ), __( 'Add Logo to Admin', 'add-logo' ), 'manage_options', __FILE__, array( $this, 'add_logo_options_page' ) );
76
+ }
77
+
78
+ /**
79
+ * Custom login logo URL
80
+ *
81
+ * This function is attached to the 'login_headerurl' filter hook.
82
+ *
83
+ * @since 1.6
84
+ */
85
+ public function login_headerurl() {
86
+ return esc_url( home_url() );
87
+ }
88
+
89
+ /**
90
+ * Custom login logo URL title
91
+ *
92
+ * This function is attached to the 'login_headertitle' filter hook.
93
+ *
94
+ * @since 1.6
95
+ */
96
+ public function login_headertitle() {
97
+ return esc_attr( get_bloginfo( 'name' ) );
98
+ }
99
+
100
+ /**
101
+ * Custom login screen
102
+ *
103
+ * This function is attached to the 'login_enqueue_scripts' filter hook.
104
+ *
105
+ * @since 1.6
106
+ */
107
+ function login_enqueue_scripts() {
108
+ $plugin_options = get_option( 'wp_add_logo_to_admin' );
109
+ if ( $image = $plugin_options['image' ] ) { ?>
110
+ <style>
111
+ body.login div#login h1 a {
112
+ background-image: url(<?php echo esc_url( $image ); ?>);
113
+ background-size: contain;
114
+ width: 100%;
115
+ }
116
+ </style>
117
+ <?php
118
+ }
119
+ }
120
+
121
+ /**
122
+ * Create the add logo to admin page
123
+ *
124
+ * This function is referenced in 'add_options_page()'.
125
+ *
126
+ * @since 1.6
127
+ */
128
+ public function add_logo_options_page() {
129
+ if ( ! current_user_can( 'manage_options' ) )
130
+ wp_die( __( 'You do not have sufficient permissions to access this page.', 'add-logo' ) );
131
+
132
+ $plugin_options = get_option( 'wp_add_logo_to_admin' );
133
+ $image = ( $plugin_options['image'] ) ? '<img src="' . esc_url( $plugin_options['image'] ) . '" alt="" style="max-width: 100%;" />' : '';
134
+ $display = ( $plugin_options['image'] ) ? '' : 'style="display: none;"';
135
+ ?>
136
+ <div class="wrap">
137
+ <h2><?php _e( 'Add Logo to Admin', 'add-logo' ); ?></h2>
138
+ <!-- Add Logo to Admin box begin-->
139
+ <form method="post" action="options.php">
140
+ <?php settings_fields( 'wp_add_logo_to_admin' ); ?>
141
+
142
+ <table id="add-logo-table" class="form-table">
143
+ <tr valign="top">
144
+ <th scope="row"><?php _e( 'Logo Options', 'add-logo' ); ?></th>
145
+ <td>
146
+ <fieldset>
147
+ <label for="add-logo-on-login">
148
+ <input name="wp_add_logo_to_admin[login]" id="add-logo-on-login" type="checkbox" <?php checked( esc_attr( $plugin_options['login'] ), 'on' ); ?>>
149
+ <?php _e( 'Display logo on the login page', 'add-logo' ); ?></label>
150
+ <br />
151
+ <label for="add-logo-on-admin">
152
+ <input name="wp_add_logo_to_admin[admin]" id="add-logo-on-admin" type="checkbox" <?php checked( esc_attr( $plugin_options['admin'] ), 'on' ); ?>>
153
+ <?php _e( 'Display logo on all admin pages', 'add-logo' ); ?></label>
154
+ </fieldset>
155
+ </td>
156
+ </tr>
157
+ <tr valign="top">
158
+ <th scope="row"><?php _e( 'Upload Logo', 'add-logo' ); ?></th>
159
+ <td>
160
+ <input type="hidden" id="add-logo-image" name="wp_add_logo_to_admin[image]" value="<?php echo esc_url( $plugin_options['image'] ); ?>" />
161
+ <div id="add-logo-image-container"><?php echo $image; ?></div>
162
+ <a href="#" class="select-image"><?php _e( 'Select image', 'add-logo' ); ?></a>&nbsp;&nbsp;&nbsp;<a href="#" class="delete-image" <?php echo $display; ?>><?php _e( 'Delete image', 'add-logo' ); ?></a>
163
+ <br />
164
+ <p class="description"><?php _e( 'Your logo should be no larger than 320px by 80px or else it will be resized on the login screen.', 'add-logo' ); ?></p>
165
+ </td>
166
+ </tr>
167
+ </table>
168
+
169
+ <?php submit_button(); ?>
170
+ </form>
171
+ <!-- Add Logo to Admin admin box end-->
172
+ </div>
173
+ <?php
174
+ }
175
+
176
+ /**
177
+ * Set up the default options on activation
178
+ *
179
+ * This functions is referenced in 'register_activation_hook()'
180
+ *
181
+ * @since 1.6
182
+ */
183
+ public static function activate() {
184
+ $default_option = array(
185
+ 'login' => 'on',
186
+ 'admin' => 'on',
187
+ 'image' => plugins_url( 'images/logo.png', __FILE__ )
188
+ );
189
+
190
+ add_option( 'wp_add_logo_to_admin', $default_option );
191
+ }
192
+
193
+ /**
194
+ * Remove all options on deactivation
195
+ *
196
+ * This functions is referenced in 'register_deactivation_hook()'
197
+ *
198
+ * @since 1.6
199
+ */
200
+ public static function deactivate() {
201
+ delete_option( 'wp_add_logo_to_admin' );
202
+ }
203
+
204
+ /**
205
+ * Initialization of the plugin which creates the admin page
206
+ *
207
+ * This functions is attached to the 'admin_enqueue_scripts' action hook
208
+ *
209
+ * @since 1.6
210
+ */
211
+ public function admin_enqueue_scripts( $hook ) {
212
+ $plugin_options = get_option( 'wp_add_logo_to_admin' );
213
+
214
+ if ( 'settings_page_add-logo-to-admin/add-logo-to-admin' == $hook ) {
215
+ wp_enqueue_media();
216
+ wp_enqueue_script( 'add_logo_to_admin', plugins_url( 'js/add-logo-select-image.js', __FILE__ ), array( 'jquery', 'media-upload', 'media-views' ), ADD_LOGO_VERSION, true );
217
+ }
218
+
219
+ if ( 'on' == $plugin_options['admin'] ) {
220
+ wp_enqueue_script( 'add_logo_jquery', plugins_url( 'js/add-logo.js', __FILE__ ), array( 'jquery' ), ADD_LOGO_VERSION, true );
221
+ wp_localize_script( 'add_logo_jquery', 'add_logo_image', esc_url( $plugin_options['image'] ) );
222
+ wp_enqueue_style( 'add_logo_to_admin', plugins_url( 'css/add-logo.css', __FILE__ ), '', ADD_LOGO_VERSION );
223
+ }
224
+ }
225
+
226
+ } // END class WP_Plugin_Template
227
+ }
228
+
229
+ if ( class_exists( 'WP_Add_Logo_To_Admin' ) ) {
230
+ /**
231
+ * Installing the activation and deactivation hooks
232
+ *
233
+ * @since 1.6
234
+ */
235
+ register_activation_hook( __FILE__, array( 'WP_Add_Logo_To_Admin', 'activate' ) );
236
+ register_deactivation_hook( __FILE__, array( 'WP_Add_Logo_To_Admin', 'deactivate' ) );
237
+
238
+ // instantiate the plugin class
239
+ $wp_add_logo_to_admin = new WP_Add_Logo_To_Admin();
240
+
241
+ /**
242
+ * Add settings link to plugin admin page
243
+ *
244
+ * @since 1.6
245
+ */
246
+ if ( isset( $wp_add_logo_to_admin ) ) {
247
+ function add_logo_plugin_settings_link( $links ) {
248
+ $settings_link = '<a href="options-general.php?page=add-logo-to-admin/add-logo-to-admin.php">' . __( 'Settings', 'add-logo' ) . '</a>';
249
+ array_unshift( $links, $settings_link );
250
+ return $links;
251
+ }
252
+
253
+ $plugin = plugin_basename( __FILE__ );
254
+ add_filter( "plugin_action_links_$plugin", 'add_logo_plugin_settings_link' );
255
+ }
256
+ }
add-logo.php DELETED
@@ -1,204 +0,0 @@
1
- <?php
2
- /*
3
- Plugin Name: Add Logo to Admin
4
- Plugin URI: http://bavotasan.com/tidbits/add-your-logo-to-the-wordpress-admin-and-login-page/
5
- Description: Adds a custom logo to your site's Admin header and your login page.
6
- Author: c.bavota
7
- Version: 1.3.3
8
- Author URI: http://bavotasan.com
9
- */
10
-
11
- //Initialization
12
- add_action('admin_menu', 'add_logo_init');
13
-
14
-
15
- //add page to admin
16
- function add_logo_init() {
17
- if(stristr($_SERVER['REQUEST_URI'],'?page=add-logo-to-admin/add-logo.php')) {
18
- if(stristr($_SERVER['REQUEST_URI'],'&delete-logo')) {
19
- $directory = dirname(__FILE__) . "/images/";
20
- unlink($directory . $_REQUEST['delete-logo']);
21
- if($_REQUEST['delete-logo'] == get_option('add_logo_filename')) {
22
- update_option('add_logo_filename', "");
23
- update_option('add_logo_logo', "");
24
- }
25
-
26
- $location = str_replace("&delete-logo=". $_REQUEST['delete-logo'], "", $_SERVER['REQUEST_URI']."&deleted=true");
27
- header("Location: $location");
28
- die;
29
- }
30
- if($_REQUEST['submit']) {
31
-
32
- if ($_FILES["file"]["type"]){
33
- $directory = dirname(__FILE__) . "/images/";
34
- $image = str_replace(" ", "-", $_FILES["file"]["name"]);
35
- move_uploaded_file($_FILES["file"]["tmp_name"],
36
- $directory . $image);
37
- update_option('add_logo_logo', get_option('siteurl'). "/wp-content/plugins/add-logo-to-admin/images/". $image);
38
- update_option('add_logo_filename', $image);
39
- }
40
-
41
- if($_REQUEST['add_logo_on_login']) {
42
- update_option('add_logo_on_login',$_REQUEST['add_logo_on_login']);
43
- }
44
-
45
- if($_REQUEST['add_logo_on_admin']) {
46
- update_option('add_logo_on_admin',$_REQUEST['add_logo_on_admin']);
47
- }
48
-
49
- if($_REQUEST['add_logo_filename']) {
50
- update_option('add_logo_filename',$_REQUEST['add_logo_filename']);
51
- update_option('add_logo_logo', get_option('siteurl'). "/wp-content/plugins/add-logo-to-admin/images/". $_REQUEST['add_logo_filename']);
52
- }
53
-
54
- if(stristr($_SERVER['REQUEST_URI'],'&saved=true')) {
55
- $location = $_SERVER['REQUEST_URI'];
56
- } else {
57
- $location = str_replace("&deleted=true", "", $_SERVER['REQUEST_URI']."&saved=true");
58
- }
59
- header("Location: $location");
60
- die;
61
- }
62
-
63
- }
64
- add_options_page('Add Logo to Admin', 'Add Logo to Admin', 10, __FILE__, 'my_plugin_options');
65
- }
66
-
67
- function add_logo_settings_link( $links ) {
68
- $settings_link = '<a href="options-general.php?page=add-logo-to-admin/add-logo.php">Settings</a>';
69
- array_unshift( $links, $settings_link );
70
- return $links;
71
- }
72
-
73
- $plugin = plugin_basename(__FILE__);
74
- add_filter("plugin_action_links_$plugin", 'add_logo_settings_link' );
75
-
76
- //set default options
77
- function set_add_logo_options() {
78
- add_option('add_logo_on_login','yes','Do you want the logo to appear on the login page?');
79
- add_option('add_logo_on_admin','yes','Do you want the logo to appear on the admin pages?');
80
- add_option('add_logo_logo',get_option("siteurl").'/wp-content/plugins/add-logo-to-admin/images/logo.png','Logo location');
81
- add_option('add_logo_filename', 'logo.png','Logo filename');
82
- }
83
-
84
- //delete options upon plugin deactivation
85
- function unset_add_logo_options() {
86
- delete_option('add_logo_on_login');
87
- delete_option('add_logo_on_admin');
88
- delete_option('add_logo_logo');
89
- delete_option('add_logo_filename');
90
- }
91
-
92
- register_activation_hook(__FILE__,'set_add_logo_options');
93
- register_deactivation_hook(__FILE__,'unset_add_logo_options');
94
-
95
- //add logo to admin if "yes" selected
96
- if(get_option('add_logo_on_admin') == "yes") {
97
- if (is_admin()) {
98
- add_action('admin_head', 'wp_admin_admin_css');
99
- function wp_admin_admin_css() {
100
- echo '<link rel="stylesheet" type="text/css" href="' . get_option('siteurl') . '/wp-content/plugins/add-logo-to-admin/css/wp-admin.css" />'."\n";
101
- }
102
- wp_enqueue_script('add_logo_admin_script', get_option('siteurl') . '/wp-content/plugins/add-logo-to-admin/js/admin.js');
103
- wp_localize_script( 'add_logo_admin_script', 'newLogo', array(
104
- 'logo' => get_option('add_logo_logo'),
105
- ));
106
- }
107
- }
108
-
109
- //add logo to login if "yes" is selected
110
- if(get_option('add_logo_on_login') == "yes") {
111
- add_action('login_head', 'wp_admin_login_css');
112
- function wp_admin_login_css() {
113
- echo '<link rel="stylesheet" type="text/css" href="' . get_option('siteurl') . '/wp-content/plugins/add-logo-to-admin/css/login.css" />'."\n";
114
- echo '<script type="text/javascript">' . "\n" . '/* <![CDATA[ */' . "\n" . ' newLogo = {' . "\n" . ' logo: "' . get_option('add_logo_logo') . '"' . "\n" . ' }' . "\n" . '/* ]]> */' . "\n" . '</script>' . "\n";
115
- echo '<script type="text/javascript" src="' . get_option('siteurl') . '/wp-content/plugins/add-logo-to-admin/js/login.js"></script>'."\n";
116
- }
117
- }
118
-
119
- //creating the admin page
120
- function my_plugin_options() {
121
- ?>
122
- <div class="wrap">
123
- <h2>Add Logo to Admin</h2>
124
-
125
- <?php
126
- if ( $_REQUEST['saved'] ) { echo '<div id="message" class="updated fade"><p><strong>Add Logo to Admin settings saved.</strong></p></div>'; }
127
- if ( $_REQUEST['deleted'] ) { echo '<div id="message" class="updated fade"><p><strong>Logo deleted.</strong></p></div>'; }
128
- print_add_logo_form();
129
- ?>
130
- </div>
131
- <?php
132
- }
133
-
134
- //updating the options
135
- function update_add_logo_options() {
136
-
137
- }
138
-
139
- //the actual admin page
140
- function print_add_logo_form() {
141
- $default_login = get_option('add_logo_on_login');
142
- $default_admin = get_option('add_logo_on_admin');
143
- $the_logo = get_option('add_logo_logo');
144
- if ($default_login == "yes") { $login_yes = "checked"; } else { $login_no = "checked"; }
145
- if ($default_admin == "yes") { $admin_yes = "checked"; } else { $admin_no = "checked"; }
146
- ?>
147
- <!-- Add Logo to Admin box begin-->
148
- <form method="post" id="myForm" enctype="multipart/form-data">
149
- <table class="form-table">
150
- <tr valign="top">
151
- <th scope="row" style="width: 370px;">
152
- <label for="add_logo_on_login">Would you like your logo to appear on the login page?</label>
153
- </th>
154
- <td>
155
- <input type="radio" name="add_logo_on_login" value="yes" <?=$login_yes?> />&nbsp;Yes&nbsp;&nbsp;
156
- <input type="radio" name="add_logo_on_login" value="no" <?=$login_no?> />&nbsp;No
157
- </td>
158
- </tr>
159
- <tr valign="top">
160
- <th scope="row" style="width: 370px;">
161
- <label for="add_logo_on_admin">Would you like your logo to appear on the admin pages?</label>
162
- </th>
163
- <td>
164
- <input type="radio" name="add_logo_on_admin" value="yes" <?=$admin_yes?> />&nbsp;Yes&nbsp;&nbsp;
165
- <input type="radio" name="add_logo_on_admin" value="no" <?=$admin_no?> />&nbsp;No
166
- </td>
167
- </tr>
168
- <tr valign="top">
169
- <th scope="row" style="width: 370px;">
170
- <label for="add_logo_logo">Choose a file to upload: </label>
171
- </th>
172
- <td>
173
- <input type="file" name="file" id="file" />&nbsp;<em><small>Click Save Changes below to upload your logo.</small></em>
174
- <?php
175
- update_option('add_logo_logo', get_option('siteurl'). "/wp-content/plugins/add-logo-to-admin/images/". get_option('add_logo_filename'));
176
- $path = dirname(__FILE__) . "/images/";
177
- $directory = get_option('siteurl'). "/wp-content/plugins/add-logo-to-admin/images/";
178
- // Open the folder
179
- $dir_handle = @opendir($path) or die("Unable to open $path");
180
- // Loop through the files
181
- $count = 1;
182
- while ($file = readdir($dir_handle)) {
183
-
184
- if($file == "." || $file == ".." || $file == "index.php" ) {
185
- continue;
186
- }
187
- if($count==1) { echo "<br /><br />Select which logo you would like to use.<br />"; $count++; }
188
- if($file == get_option('add_logo_filename')) { $checked = "checked"; } else { $checked = ""; }
189
- echo "<br /><table><tr><td style=\"padding-right: 5px;\"><img src=\"$directory$file\" style=\"max-height:100px;border:1px solid #aaa;padding:10px;\" /></td><td><input id=\"add_logo_filename\" name=\"add_logo_filename\" type=\"radio\" value=\"$file\" $checked />&nbsp;Select<br /><br /><a href=\"options-general.php?page=add-logo-to-admin/add-logo.php&delete-logo=$file\">&laquo; Delete</a></td></tr></table>";
190
- }
191
-
192
- // Close
193
- closedir($dir_handle);
194
- ?> </td>
195
- </tr>
196
- </table>
197
- <p class="submit">
198
- <input type="submit" name="submit" class="button-primary" value="Save Changes" />
199
- </p>
200
- </form>
201
- <!-- Add Logo to Admin admin box end-->
202
- <?php
203
- }
204
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
css/add-logo.css ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ #admin-logo {
2
+ margin: 10px 0;
3
+ padding: 0 0 5px;
4
+ border-bottom: 1px solid #ddd;
5
+ width: 100%;
6
+ }
css/login.css DELETED
@@ -1,17 +0,0 @@
1
- #newLogo {
2
- padding: 0 0 10px 7px;
3
- max-width: 314px;
4
- margin: 0;
5
- }
6
-
7
- #login h1 {
8
- display: none;
9
- }
10
-
11
- #login {
12
- text-align: center;
13
- }
14
-
15
- #login p {
16
- text-align: left;
17
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
css/wp-admin.css DELETED
@@ -1,17 +0,0 @@
1
- #header-logo {
2
- display: none;
3
- }
4
-
5
- #newLogo {
6
- padding: 0 0 5px;
7
- }
8
-
9
- #wphead {
10
- height: auto;
11
- float: left;
12
- width: 100%;
13
- }
14
-
15
- #wphead h1 a {
16
- display: none;
17
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
images/logo.png CHANGED
Binary file
index.html DELETED
@@ -1,105 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml">
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5
- <title>Add Logo to Admin WordPress plugin | Version 1.3.3</title>
6
- <style type="text/css">
7
- code {
8
- background: #ddd;
9
- }
10
-
11
- h1 {
12
- margin-bottom: 0;
13
- }
14
-
15
- </style>
16
- </head>
17
-
18
- <body>
19
- <h1>Add Logo to Admin</h1>
20
- Version 1.3.3<br />
21
- WordPress plugin<br />
22
- <br />
23
- <strong>== Installation ==</strong><br />
24
- <br />
25
- 1. Unzip the add-logo-to-admin.zip file.<br />
26
- 2. Upload the <code>add-logo-to-admin</code> folder to the <code>/wp-content/plugins/</code> directory.<br />
27
- 3. Activate the plugin through the 'Plugins' menu in WordPress.<br />
28
- 4. Go to Settings => Add Logo to Admin and set your options and add your logo.<br />
29
- <br />
30
- <strong>== Frequently Asked Questions ==</strong> <br />
31
- <br />
32
- 1) How do I add my own logo?
33
- <br />
34
- Just go to Settings => Add Logo to Admin and upload the logo you would like to use.
35
- <br /><br />
36
- 2) How big does my logo need to be?
37
- <br />
38
- You can make it any width or height, as well as any file format.
39
- <br />
40
- <br />
41
- <strong>== Change Log ==</strong><br />
42
- <br />
43
- 1.3.3 (2009-03-10)
44
- <ul>
45
- <li>Fixed issue with IE7 and logo not displaying</li>
46
- </ul>
47
-
48
- 1.3.2 (2009-03-01)
49
- <ul>
50
- <li>Fixed issue with invading other admin pages save function</li>
51
- </ul>
52
-
53
- 1.3.1 (2009-02-26)
54
- <ul>
55
- <li>Fixed issue with spaces in filename</li>
56
- </ul>
57
-
58
- 1.3 (2009-02-25)
59
- <ul>
60
- <li>Created uploader for logos</li>
61
- <li>Added "Settings" link on plugins page</li>
62
- <li>Added option to delete logo</li>
63
- <li>Added logo select option</li>
64
- <li>Updated CSS</li>
65
- </ul>
66
-
67
- 1.2 (2009-02-23)
68
- <ul>
69
- <li>Fixed issue with WP installs in subdirectories</li>
70
- <li>Removed old code</li>
71
- <li>Tested on WP version 2.7.1</li>
72
- </ul>
73
-
74
- 1.1 (2008-12-24)
75
- <ul>
76
- <li>Added admin page with options</li>
77
- <li>Fixed window.onload JavaScript issue</li>
78
- <li>Fixed issue with blogs not located in the root directory</li>
79
- <li>Removed extraneous code</li>
80
- </ul>
81
-
82
- 1.0.2 (2008-12-16)
83
- <ul>
84
- <li>Fixed weirdness with extra folder</li>
85
- </ul>
86
-
87
- 1.0.1 (2008-12-16)
88
- <ul>
89
- <li>
90
- Fixed the code to direct to the proper plugin folder</li>
91
- </ul>
92
-
93
- 1.0 (2008-12-15)
94
- <ul>
95
- <li>
96
- Initial Public Release</li>
97
- </ul>
98
-
99
- <br />
100
- <small>Add Logo to Admin plugin created by <a href="http://bavotasan.com">c.bavota</a>.<br />
101
- <br />
102
- Copyright &copy; c.bavota. All Rights Reserved.</small><br /><br />
103
- <a href="http://bavotasan.com"><img src="http://bavotasan.com/wp-content/themes/bavotasan/images/bavota.png" alt="Bavota San" border="0" width="40px" /></a>
104
- </body>
105
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/add-logo-select-image.js ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ( function($) {
2
+ var file_frame;
3
+ $( '#add-logo-table' )
4
+ .on( 'click', '.select-image', function(e) {
5
+ e.preventDefault();
6
+
7
+ // Let's start over to make sure everything works
8
+ if ( file_frame )
9
+ file_frame.remove();
10
+
11
+ file_frame = wp.media.frames.file_frame = wp.media( {
12
+ title: $(this).data( 'uploader_title' ),
13
+ button: {
14
+ text: $(this).data( 'uploader_button_text' )
15
+ },
16
+ multiple: false
17
+ } );
18
+
19
+ file_frame.on( 'select', function() {
20
+ var attachment = file_frame.state().get( 'selection' ).first().toJSON();
21
+ $( '#add-logo-image' ).val( attachment.url );
22
+ $( '#add-logo-image-container' ).html( '<img src="' + attachment.url + '" alt="" style="max-width:100%;" />' );
23
+ } );
24
+
25
+ file_frame.open();
26
+ $( '.delete-image' ).show();
27
+ } )
28
+ .on( 'click', '.delete-image', function(e) {
29
+ e.preventDefault();
30
+ $(this).hide();
31
+ $( '#add-logo-image' ).val( '' );
32
+ $( '#add-logo-image-container' ).html( '' );
33
+ } );
34
+
35
+ } )(jQuery);
js/add-logo.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ ( function($) {
2
+ $( '.wrap' ).prepend( '<div id="admin-logo"><img src="' + add_logo_image + '" alt="" /></div>' );
3
+ } )( jQuery );
js/admin.js DELETED
@@ -1,27 +0,0 @@
1
- var oldOnload = window.onload;
2
-
3
- if(typeof oldOnload == "function") {
4
- window.onload = function() {
5
- if(oldOnload) {
6
- oldOnload();
7
- }
8
- addLogo();
9
- }
10
- } else {
11
- window.onload = addLogo;
12
- }
13
-
14
- function addLogo() {
15
- var myBody = document.getElementById("wphead").getElementsByTagName("a")[0];
16
- myBody.innerHTML = "";
17
-
18
- var img = document.createElement("img");
19
- var imgSrc = newLogo.logo;
20
- img.setAttribute("src",imgSrc);
21
- img.setAttribute("id", "newLogo");
22
-
23
- myBody.appendChild(img);
24
-
25
- myBody.style.display = "block";
26
- return false;
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/login.js DELETED
@@ -1,28 +0,0 @@
1
- var oldOnload = window.onload;
2
-
3
- if(typeof oldOnload == "function") {
4
- window.onload = function() {
5
- if(oldOnload) {
6
- oldOnload();
7
- }
8
- addLogo();
9
- }
10
- } else {
11
- window.onload = addLogo;
12
- }
13
-
14
- function addLogo() {
15
- var myBody = document.getElementById("login").getElementsByTagName("h1")[0];
16
- myBody.innerHTML = "";
17
-
18
- var img = document.createElement("img");
19
- var imgSrc = newLogo.logo;
20
- img.setAttribute("src",imgSrc);
21
- img.setAttribute("id", "newLogo");
22
-
23
- myBody.appendChild(img);
24
-
25
- myBody.style.display = "block";
26
-
27
- return false;
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
languages/add-logo.pot ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Content-Type: text/plain; charset=utf-8\n"
4
+ "Content-Transfer-Encoding: 8bit\n"
5
+
6
+ #. Text in function
7
+ #: add-logo-to-admin/add-logo-to-admin.php:1
8
+ #: add-logo-to-admin/add-logo-to-admin.php:137
9
+ msgid "Add Logo to Admin"
10
+ msgstr ""
11
+
12
+ #. Text in echo
13
+ #: add-logo-to-admin/add-logo-to-admin.php:162
14
+ msgid "Delete image"
15
+ msgstr ""
16
+
17
+ #. Text in echo
18
+ #: add-logo-to-admin/add-logo-to-admin.php:153
19
+ msgid "Display logo on all admin pages"
20
+ msgstr ""
21
+
22
+ #. Text in echo
23
+ #: add-logo-to-admin/add-logo-to-admin.php:149
24
+ msgid "Display logo on the login page"
25
+ msgstr ""
26
+
27
+ #. Text in echo
28
+ #: add-logo-to-admin/add-logo-to-admin.php:144
29
+ msgid "Logo Options"
30
+ msgstr ""
31
+
32
+ #. Text in echo
33
+ #: add-logo-to-admin/add-logo-to-admin.php:162
34
+ msgid "Select image"
35
+ msgstr ""
36
+
37
+ #. Text in echo
38
+ #: add-logo-to-admin/add-logo-to-admin.php:158
39
+ msgid "Upload Logo"
40
+ msgstr ""
41
+
42
+ #. Text in function
43
+ #: add-logo-to-admin/add-logo-to-admin.php:117
44
+ msgid "You do not have sufficient permissions to access this page."
45
+ msgstr ""
46
+
47
+ #. Text in echo
48
+ #: add-logo-to-admin/add-logo-to-admin.php:164
49
+ msgid "Your logo should be no larger than 320px by 80px or else it will be resized on the login screen."
50
+ msgstr ""
readme.txt CHANGED
@@ -1,16 +1,20 @@
1
  === Add Logo to Admin ===
2
- Contributors: c.bavota
3
- Donate Link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=1929921
4
- Tags: custom logo, admin, login
5
- Requires at least: 2.7
6
- Tested up to: 2.8
7
- Stable tag: 1.3.3
8
-
9
- Add a custom logo to your Admin header and to your login page.
 
 
 
 
10
 
11
  == Description ==
12
 
13
- This plugin allows a user to customize their Admin panel by adding their own logo to the header. It also replaces the WordPress logo on the login screen with the same custom logo.
14
 
15
  == Installation ==
16
 
@@ -19,61 +23,79 @@ This plugin allows a user to customize their Admin panel by adding their own log
19
  3. Activate the plugin through the 'Plugins' menu in WordPress.
20
  4. Go to Settings => Add Logo to Admin and set your options and add your logo.
21
 
22
- == Frequently Asked Questions ==
23
 
24
  1) How do I add my own logo?
25
 
26
- Just go to Settings => Add Logo to Admin and upload the logo you would like to use.
27
 
28
  2) How big does my logo need to be?
29
 
30
- You can make it any width or height, as well as any file format.
31
 
32
  == Screenshots ==
33
 
34
- 1. Admin before and after
35
- 2. Login page before and after
36
 
37
  == Change Log ==
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  1.3.3 (2009-03-10)
40
- <ul>
41
- <li>Fixed issue with IE7 and logo not displaying</li>
42
- </ul>
43
 
44
  1.3.2 (2009-03-01)
45
- <ul>
46
- <li>Fixed issue with invading other admin pages save function</li>
47
- </ul>
48
 
49
  1.3.1 (2009-02-26)
50
- <ul>
51
- <li>Fixed issue with spaces in filename</li>
52
- </ul>
53
 
54
  1.3 (2009-02-25)
55
- <ul>
56
- <li>Created uploader for logos</li>
57
- <li>Added "Settings" link on plugins page</li>
58
- <li>Added option to delete logo</li>
59
- <li>Added logo select option</li>
60
- <li>Updated CSS</li>
61
- </ul>
62
 
63
  1.2 (2009-02-23)
64
- <ul>
65
- <li>Fixed issue with WP installs in subdirectories</li>
66
- <li>Removed old code</li>
67
- <li>Tested on WP version 2.7.1</li>
68
- </ul>
69
 
70
  1.1 (2008-12-24)
71
- <ul>
72
- <li>Added admin page with options</li>
73
- <li>Fixed window.onload JavaScript issue</li>
74
- <li>Fixed issue with blogs not located in the root directory</li>
75
- <li>Removed extraneous code</li>
76
- </ul>
77
 
78
  1.0.2 (2008-12-16)
79
  Fixed weirdness with extra folder
@@ -83,3 +105,8 @@ Fixed the code to direct to the proper plugin folder
83
 
84
  1.0 (2008-12-15)
85
  Initial Public Release
 
 
 
 
 
1
  === Add Logo to Admin ===
2
+ Contributors: tinkerpriest
3
+ Donate Link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4W58JWNBHWKK4
4
+ Tags: custom logo, admin, login, wp-admin, admin logo
5
+ Text Domain: add-logo
6
+ Domain Path: /languages
7
+ Requires at least: 3.5
8
+ Tested up to: 3.8
9
+ Stable tag: 1.6
10
+ License: GPLv2 or later
11
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
+
13
+ Add a custom logo to your wp-admin and login page.
14
 
15
  == Description ==
16
 
17
+ This plugin allows you to customize your admin by adding your own logo to the header. It also replaces the WordPress logo on the login screen with the same custom logo. Tested in Firefox, Safari, Chrome and IE.
18
 
19
  == Installation ==
20
 
23
  3. Activate the plugin through the 'Plugins' menu in WordPress.
24
  4. Go to Settings => Add Logo to Admin and set your options and add your logo.
25
 
26
+ == Frequently Asked Questions ==
27
 
28
  1) How do I add my own logo?
29
 
30
+ Just go to Settings => Add Logo to Admin and click on "Select image" to upload your logo.
31
 
32
  2) How big does my logo need to be?
33
 
34
+ Your logo shouldn't exceed 320px by 80px or it will be resized on the login screen.
35
 
36
  == Screenshots ==
37
 
38
+ 1. The Add Logo to Admin page
39
+ 2. How your logo will appear on the login screen
40
 
41
  == Change Log ==
42
 
43
+ = 1.6 (2014-02-12) =
44
+
45
+ * Added WP media uploader
46
+ * Rebuilt plugin using OOP
47
+ * Created language file
48
+ * Updated screenshots to reflect new admin page
49
+ * Added validation to settings
50
+
51
+ 1.5.1 (2012-10-04)
52
+
53
+ * Fixed login screen image size
54
+
55
+ 1.5 (2012-01-12)
56
+
57
+ * Updated for WP 3.3
58
+ * Improved coding
59
+ * Added security nonce
60
+
61
+ 1.4 (2011-02-18)
62
+
63
+ * Updated for WP 3.1
64
+ * Removed extraneous CSS and JS files
65
+ * Improved coding
66
+
67
  1.3.3 (2009-03-10)
68
+
69
+ * Fixed issue with IE7 and logo not displaying
 
70
 
71
  1.3.2 (2009-03-01)
72
+
73
+ * Fixed issue with invading other admin pages save function
 
74
 
75
  1.3.1 (2009-02-26)
76
+
77
+ * Fixed issue with spaces in filename
 
78
 
79
  1.3 (2009-02-25)
80
+
81
+ * Created uploader for logos
82
+ * Added "Settings" link on plugins page
83
+ * Added option to delete logo
84
+ * Added logo select option
85
+ * Updated CSS
 
86
 
87
  1.2 (2009-02-23)
88
+
89
+ * Fixed issue with WP installs in subdirectories
90
+ * Removed old code
91
+ * Tested on WP version 2.7.1
 
92
 
93
  1.1 (2008-12-24)
94
+
95
+ * Added admin page with options
96
+ * Fixed window.onload JavaScript issue
97
+ * Fixed issue with blogs not located in the root directory
98
+ * Removed extraneous code
 
99
 
100
  1.0.2 (2008-12-16)
101
  Fixed weirdness with extra folder
105
 
106
  1.0 (2008-12-15)
107
  Initial Public Release
108
+
109
+ == Upgrade Notice ==
110
+
111
+ = 1.6 =
112
+ Now you can easily select your logo using the WordPress media uploader. Plus the login screen logo will redirect back to your site and use your site name for the link's title tag.
screenshot-1.jpg CHANGED
Binary file
screenshot-2.jpg CHANGED
Binary file