Changeset 517477
- Timestamp:
- 03/11/2012 01:13:46 PM (14 years ago)
- Location:
- qq-avatar
- Files:
-
- 2 edited
- 3 copied
-
tags/0.3.4 (copied) (copied from qq-avatar/trunk)
-
tags/0.3.4/qq-avatar.php (copied) (copied from qq-avatar/trunk/qq-avatar.php) (8 diffs)
-
tags/0.3.4/readme.txt (copied) (copied from qq-avatar/trunk/readme.txt) (2 diffs)
-
trunk/qq-avatar.php (modified) (8 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
qq-avatar/tags/0.3.4/qq-avatar.php
r491693 r517477 5 5 Author: Meng Zhuo 6 6 Author URI: http://mengzhuo.org 7 Version: 0.3. 37 Version: 0.3.4 8 8 License: GPLv2 or later 9 9 Description: Replace Gravatar while commenter use QQ numeric email address.如果用户使用数字QQ邮箱留言且公开空间头像,就<strong>将Gravatar替换成QQ头像</strong> | <strong><a href="http://me.alipay.com/mengzhuo">捐助</a></strong> | <a title="使用本插件即表示您知晓并接受本条款" href="http://mengzhuo.org/lab/qq-avatar/agreement.htm">条款</a> … … 69 69 $cache = qq_get_home_path().CACHE; 70 70 if ( !is_dir($cache) ){ 71 mkdir( $cache ); 71 if ( !mkdir( $cache ) ){ 72 $warning = new WP_Error('broke', "Can't make cache dir, please check your permisson"); 73 } 72 74 } 73 75 … … 81 83 82 84 $file_url = "$cache/$qq_uin_md5.jpg"; 83 84 if (file_exists("$cache/$qq_uin_md5.jpg")){ 85 86 if (time()-filemtime($file_url) > 30*836000){ 87 unlink($file_url); 88 } 89 90 if (file_exists($file_url)){ 85 91 86 92 $original_img = preg_replace("/src='[^']*'/", … … 89 95 return $original_img; 90 96 } 91 97 92 98 $response = wp_remote_get( QQ_REQUEST.$qq_uin, 93 99 array('user-agent'=>QQ_REQUEST_UA, … … 113 119 114 120 $qq_uin_md5 = md5($qq_info->uin);//yes, it's recheck. 115 $pic_path = "$cache/$qq_uin_md5.jpg";116 121 117 if ( isset($qq_info->avatarUrl) && !file_exists($pic_path)){122 if ( isset($qq_info->avatarUrl) && !file_exists($file_url) ){ 118 123 119 124 $pic_handle = wp_remote_get($qq_info->avatarUrl, … … 131 136 $pic_handle = $pic_handle['body']; 132 137 133 $temp_pic = fopen( $ pic_path,'wb+');138 $temp_pic = fopen( $file_url,'wb+'); 134 139 135 140 if (fwrite($temp_pic,$pic_handle)){ … … 137 142 "src='".get_home_url().'/'.CACHE."/$qq_uin_md5.jpg'", 138 143 $original_img); 144 } 145 else{ 146 $warning = new WP_Error('broke', "No more disk space to Storage QQ_Avatar Cache"); 139 147 } 140 148 … … 147 155 } 148 156 } 157 if (is_wp_error($warning)){ 158 $original_img = $original_img.'<--'.$warning->get_error_message().'-->'; 159 } 149 160 return $original_img; 150 161 } -
qq-avatar/tags/0.3.4/readme.txt
r491693 r517477 4 4 Requires at least: 3.1 5 5 Tested up to: 3.3.1 6 Stable tag: 0.3. 36 Stable tag: 0.3.4 7 7 License: GPLv2 or later 8 8 … … 18 18 19 19 == Changelog == 20 21 = 0.3.4 = 22 ADD:Check Disk space while can't write cache file and warn the admin. 23 ADD:if direction of the cache cant be made then warn the admin to check their permisson. 24 ADD:A month cachetime for ANY cached Avatar has been storaged. 20 25 21 26 = 0.3.3 = -
qq-avatar/trunk/qq-avatar.php
r491693 r517477 5 5 Author: Meng Zhuo 6 6 Author URI: http://mengzhuo.org 7 Version: 0.3. 37 Version: 0.3.4 8 8 License: GPLv2 or later 9 9 Description: Replace Gravatar while commenter use QQ numeric email address.如果用户使用数字QQ邮箱留言且公开空间头像,就<strong>将Gravatar替换成QQ头像</strong> | <strong><a href="http://me.alipay.com/mengzhuo">捐助</a></strong> | <a title="使用本插件即表示您知晓并接受本条款" href="http://mengzhuo.org/lab/qq-avatar/agreement.htm">条款</a> … … 69 69 $cache = qq_get_home_path().CACHE; 70 70 if ( !is_dir($cache) ){ 71 mkdir( $cache ); 71 if ( !mkdir( $cache ) ){ 72 $warning = new WP_Error('broke', "Can't make cache dir, please check your permisson"); 73 } 72 74 } 73 75 … … 81 83 82 84 $file_url = "$cache/$qq_uin_md5.jpg"; 83 84 if (file_exists("$cache/$qq_uin_md5.jpg")){ 85 86 if (time()-filemtime($file_url) > 30*836000){ 87 unlink($file_url); 88 } 89 90 if (file_exists($file_url)){ 85 91 86 92 $original_img = preg_replace("/src='[^']*'/", … … 89 95 return $original_img; 90 96 } 91 97 92 98 $response = wp_remote_get( QQ_REQUEST.$qq_uin, 93 99 array('user-agent'=>QQ_REQUEST_UA, … … 113 119 114 120 $qq_uin_md5 = md5($qq_info->uin);//yes, it's recheck. 115 $pic_path = "$cache/$qq_uin_md5.jpg";116 121 117 if ( isset($qq_info->avatarUrl) && !file_exists($pic_path)){122 if ( isset($qq_info->avatarUrl) && !file_exists($file_url) ){ 118 123 119 124 $pic_handle = wp_remote_get($qq_info->avatarUrl, … … 131 136 $pic_handle = $pic_handle['body']; 132 137 133 $temp_pic = fopen( $ pic_path,'wb+');138 $temp_pic = fopen( $file_url,'wb+'); 134 139 135 140 if (fwrite($temp_pic,$pic_handle)){ … … 137 142 "src='".get_home_url().'/'.CACHE."/$qq_uin_md5.jpg'", 138 143 $original_img); 144 } 145 else{ 146 $warning = new WP_Error('broke', "No more disk space to Storage QQ_Avatar Cache"); 139 147 } 140 148 … … 147 155 } 148 156 } 157 if (is_wp_error($warning)){ 158 $original_img = $original_img.'<--'.$warning->get_error_message().'-->'; 159 } 149 160 return $original_img; 150 161 } -
qq-avatar/trunk/readme.txt
r491693 r517477 4 4 Requires at least: 3.1 5 5 Tested up to: 3.3.1 6 Stable tag: 0.3. 36 Stable tag: 0.3.4 7 7 License: GPLv2 or later 8 8 … … 18 18 19 19 == Changelog == 20 21 = 0.3.4 = 22 ADD:Check Disk space while can't write cache file and warn the admin. 23 ADD:if direction of the cache cant be made then warn the admin to check their permisson. 24 ADD:A month cachetime for ANY cached Avatar has been storaged. 20 25 21 26 = 0.3.3 =
Note: See TracChangeset
for help on using the changeset viewer.