Changeset 558000
- Timestamp:
- 06/14/2012 03:11:26 PM (14 years ago)
- Location:
- logoreplacer/trunk
- Files:
-
- 2 edited
-
logoReplacer.php (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
logoreplacer/trunk/logoReplacer.php
r404671 r558000 1 1 <?php 2 2 3 /* Copyright 2010 BisonTech. All Rights Reserved. 3 4 4 This program is free software; you can redistribute it and/or modify5 it under the terms of the GNU General Public License as published by6 the Free Software Foundation; either version 2 of the License, or7 (at your option) any later version.5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 2 of the License, or 8 (at your option) any later version. 8 9 9 This program is distributed in the hope that it will be useful,10 but WITHOUT ANY WARRANTY; without even the implied warranty of11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12 GNU General Public License for more details:13 http://www.gnu.org/licenses/gpl-2.0.html14 */10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details: 14 http://www.gnu.org/licenses/gpl-2.0.html 15 */ 15 16 16 17 /* 17 Plugin Name: LogoReplacer18 Plugin URI: http://wordpress.org/extend/plugins/logoReplacer/19 Description: Replace registration and admin Logo20 Author: http://www.BisonTech.net21 Version: 1.2.0 22 */18 Plugin Name: LogoReplacer 19 Plugin URI: http://wordpress.org/extend/plugins/logoReplacer/ 20 Description: Replace registration and admin Logo 21 Author: http://www.BisonTech.net 22 Version: 2.0.1 23 */ 23 24 24 25 25 26 add_action('plugins_loaded', 'lr_init'); 26 27 27 define ('LOGO_DIR',dirname(__FILE__). '/logos/');28 define('LOGO_DIR', dirname(__FILE__) . '/logos/'); 28 29 29 30 30 function lr_init(){ 31 $version = get_bloginfo('version'); 31 class LRLogoImg { 32 32 33 list($version,$release, $minor) = explode('.',$version); 34 35 //wp 3.1 36 if (($version >= 3) && ($release >=2) ){ 37 $src_login = LOGO_DIR . 'logo-login.png'; 38 }else{ 39 $src_login = LOGO_DIR . 'logo-login.gif'; 40 } 41 $src_head = LOGO_DIR . 'wp-logo-vs.png'; 42 if (($version >= 3) && ($release >=2) ){ 43 $dst_login = ABSPATH . '/wp-admin/images/logo-login.png'; 44 }else{ 45 $dst_login = ABSPATH . '/wp-admin/images/logo-login.gif'; 46 } 47 $dst_head = ABSPATH . '/wp-admin/images/wp-logo-vs.png'; 48 $dst_head2 = ABSPATH . '/wp-admin/images/wp-logo.png'; 33 public $custom_path = NULL; 34 public $installed_path = NULL; 49 35 50 $logo_login_md5 = md5_file($src_login); 51 $logo_head_md5 = md5_file($src_head); 36 function __construct($sCustomPath, $sInstalledPath) { 52 37 53 $logo_login_current = md5_file($dst_login);54 $logo_head_current = md5_file($dst_head);55 $logo_head_current2 = md5_file($dst_head2);38 $this->installed_path = $sInstalledPath; 39 $this->custom_path = $sCustomPath; 40 } 56 41 57 58 59 if ($logo_login_current == $logo_login_md5){ 60 //log... 61 }else{ 62 lr_installLogo($src_login,$dst_login); 63 } 64 65 if ($logo_head_current == $logo_head_md5){ 66 //log 67 }else{ 68 lr_installLogo($src_head,$dst_head); 69 } 70 71 if ($logo_head_current2 == $logo_head_md5){ 72 //log 73 }else{ 74 lr_installLogo($src_head,$dst_head2); 75 } 42 function exec() { 43 if (md5_file($this->custom_path) != md5_file($this->installed_path)) { 44 lr_installLogo($this->custom_path, $this->installed_path); 45 } 46 } 76 47 77 48 } 78 49 79 function lr_installLogo($src,$dst){ 80 if (is_writable($dst)){ 81 if (file_exists($src)){ 82 if (!copy($src, $dst)) { 83 if (DEBUG){ 84 echo "failed to copy $src..."; 85 } 86 } 87 }else{ 88 if (DEBUG){ 89 echo 'file not exist'; 90 } 91 } 92 }else{ 93 if (DEBUG){ 94 echo 'please make wp-admin directory writable!'; 95 } 96 } 50 function lr_init() { 51 52 53 $aImgList = array(); 54 $aImgList[ABSPATH . 'wp-admin/images/logo-login.png'] = LOGO_DIR . 'logo-login.png'; 55 $aImgList[ABSPATH . 'wp-admin/images/logo-login.gif'] = LOGO_DIR . 'logo-login.gif'; 56 $aImgList[ABSPATH . 'wp-admin/images/wp-logo-vs.png'] = LOGO_DIR . 'wp-logo-vs.png'; 57 $aImgList[ABSPATH . 'wp-admin/images/wp-logo.png'] = LOGO_DIR . 'wp-logo.png'; 58 $aImgList[ABSPATH . 'wp-includes/images/admin-bar-sprite.png'] = LOGO_DIR . 'admin-bar-sprite.png'; 59 60 foreach ($aImgList as $sInstalledPath => $sCustomPath) { 61 if (file_exists($sCustomPath)) { 62 $oLogo = new LRLogoImg($sCustomPath, $sInstalledPath); 63 $oLogo->exec(); 64 } 65 } 97 66 } 98 67 99 68 function lr_installLogo($src, $dst) { 69 if (is_writable($dst)) { 70 if (file_exists($src)) { 71 if (!copy($src, $dst)) { 72 if (WP_DEBUG) { 73 echo "Failed to copy $src..."; 74 } 75 } 76 } else { 77 if (WP_DEBUG) { 78 echo 'File not exist'; 79 } 80 } 81 } else { 82 if (WP_DEBUG) { 83 echo 'Please make wp-admin directory writable!'; 84 } 85 } 86 } 100 87 101 88 ?> -
logoreplacer/trunk/readme.txt
r404671 r558000 6 6 Requires at least: 2.0.2 7 7 Tested up to: 2.1 8 Stable tag: 1.28 Stable tag: 2.0 9 9 10 10 This plugin replace WP default admin/login/register page. … … 20 20 21 21 1. Download the .zip file of logoReplacer from the WordPress plugins directory. 22 1. Unzip it into temp directory, edit logo-login.gif or logo-login.png and wp-logo-vs.pngand save with same format.22 1. Unzip it into temp directory, edit all the file in logos directory under plugin directory and save with same format. 23 23 1. Upload logoReplacer direcotry into the /wp-content/plugins/ 24 24 1. Activate the plugin through the "Plugins" menu in WordPress. … … 28 28 1. This is login page with logo modified 29 29 2. This is the admin page with logo modified 30 3. This is the icons and logo of the admin bar modified 30 31 31 32 == Changelog == 33 = 2.0.1 = 34 * Fully rewrited, fix with last wordpress update. 35 * Added admin-bar-sprite.png, now you can change all wp-admin icon bar. 36 32 37 = 1.2.0 = 33 38 * Added support for Wordpress 3.2 admin (now login image is a png)
Note: See TracChangeset
for help on using the changeset viewer.