Changeset 477926
- Timestamp:
- 12/20/2011 11:35:44 AM (14 years ago)
- Location:
- qq-avatar
- Files:
-
- 4 edited
- 1 copied
-
tags/0.3 (copied) (copied from qq-avatar/trunk)
-
tags/0.3/qq-avatar.php (modified) (5 diffs)
-
tags/0.3/readme.txt (modified) (2 diffs)
-
trunk/qq-avatar.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
qq-avatar/tags/0.3/qq-avatar.php
r477817 r477926 2 2 /* 3 3 Plugin Name: QQ Avatar 4 Plugin URI: http://wordpress.org/extend/plugins/qq-avatar/ 4 5 Author: Meng Zhuo 5 6 Author URI: http://mengzhuo.org 6 Version: 0. 27 Version: 0.3 7 8 License: GPLv2 or later 8 Description: Replace Gravatar while commenter use QQ numeric email address.如果用户使用数字QQ邮箱留言且公开空间头像,就 替换成QQ头像。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> 9 10 */ 10 11 /* … … 40 41 function qq_avatar($original_img,$comment_info){ 41 42 if (is_object($comment_info)){ 42 43 if ( !is_dir( CACHE) ){44 mkdir( CACHE);43 $cache = get_home_path().CACHE; 44 if ( !is_dir($cache) ){ 45 mkdir( $cache ); 45 46 } 46 if ( isset($comment_info->comment_author_email) && preg_match('/^\[email protected]/',$comment_info->comment_author_email) ){ 47 48 if ( isset($comment_info->comment_author_email) && preg_match('/^\d+@(vip\.)?qq.com$/',$comment_info->comment_author_email) ){ 47 49 //Thank FSM, It's an QQ number 48 50 $qq_uin = explode("@", $comment_info->comment_author_email); … … 50 52 $qq_uin_md5 = md5($qq_uin); 51 53 52 if (file_exists(CACHE.'/'.$qq_uin_md5.'.jpg')){ 54 $file_url = "$cache/$qq_uin_md5.jpg"; 55 56 if (file_exists("$cache/$qq_uin_md5.jpg")){ 57 53 58 $original_img = preg_replace("/src='[^']*'/", 54 59 "src='".get_home_url().'/'.CACHE."/$qq_uin_md5.jpg'", … … 58 63 59 64 $response = wp_remote_get( QQ_REQUEST.$qq_uin, 60 array('user-agent'=>QQ_REQUEST_UA) 65 array('user-agent'=>QQ_REQUEST_UA, 66 'timeout'=>1 67 ) 61 68 ); 62 69 … … 68 75 $response['body'] 69 76 )); 70 77 if (!is_numeric($qq_info->uin)){ 78 //how the hell you get through this... 79 return $original_img; 80 } 71 81 72 $pic_url = CACHE.'/'.md5($qq_info->uin).'.jpg'; 82 $qq_uin_md5 = md5($qq_info->uin);//yes, it's recheck. 83 $pic_path = "$cache/$qq_uin_md5.jpg"; 73 84 74 if (isset($qq_info->avatarUrl) && !file_exists($pic_ url)){85 if (isset($qq_info->avatarUrl) && !file_exists($pic_path)){ 75 86 76 $pic_handle = wp_remote_get($qq_info->avatarUrl); 87 $pic_handle = wp_remote_get($qq_info->avatarUrl, 88 array('user-agent'=>QQ_REQUEST_UA, 89 'timeout'=>1 90 )); 91 if ($pic_handle['response']['code'] != 200){ 92 return $original_img; 93 } 94 77 95 $pic_handle = $pic_handle['body']; 78 96 79 $temp_pic = fopen( $pic_url,'wb+'); 80 fwrite($temp_pic,$pic_handle); 97 $temp_pic = fopen( $pic_path,'wb+'); 98 99 if (fwrite($temp_pic,$pic_handle)){ 100 $original_img = preg_replace("/src='[^']*'/", 101 "src='".get_home_url().'/'.CACHE."/$qq_uin_md5.jpg'", 102 $original_img); 103 } 104 81 105 fclose($temp_pic); 82 106 } 83 84 $original_img = preg_replace("/src='[^']*'/",85 "src='".get_home_url()."/$pic_url'",86 $original_img);87 107 } 88 108 } -
qq-avatar/tags/0.3/readme.txt
r477817 r477926 1 1 === QQ Avatar === 2 2 Contributors: allarem 3 Tags: avatar,qq 3 Tags: avatar,qq,头像 4 4 Requires at least: 3.1 5 5 Tested up to: 3.3 6 Stable tag: 0. 26 Stable tag: 0.3 7 7 License: GPLv2 or later 8 8 9 Replace Gravatar while commenter use QQ numeric email address. 9 Replace Gravatar while commenter use QQ numeric email address.如果用户使用数字QQ邮箱留言且公开空间头像,就替换成QQ头像。 10 10 11 11 == Description == … … 17 17 You've done it ! 18 18 19 == MD5 == 20 If you find out that your php-file's md5 doesn't match in the changlog, please reinstall to reassure safty. 21 如果您的文件MD5散列值与Changlog里的不符,请重新下载并安装以保证安全 22 19 23 == Changelog == 24 25 = 0.3 = 26 b53efa6c4e95783e59b8376c35dfa304 qq-avatar.php 27 *FIXED:avatar won't show while in wp-admin panel 28 *IMPROVE:Set 1 sencond as timeout to improve performance. 20 29 21 30 = 0.2 = -
qq-avatar/trunk/qq-avatar.php
r477817 r477926 2 2 /* 3 3 Plugin Name: QQ Avatar 4 Plugin URI: http://wordpress.org/extend/plugins/qq-avatar/ 4 5 Author: Meng Zhuo 5 6 Author URI: http://mengzhuo.org 6 Version: 0. 27 Version: 0.3 7 8 License: GPLv2 or later 8 Description: Replace Gravatar while commenter use QQ numeric email address.如果用户使用数字QQ邮箱留言且公开空间头像,就 替换成QQ头像。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> 9 10 */ 10 11 /* … … 40 41 function qq_avatar($original_img,$comment_info){ 41 42 if (is_object($comment_info)){ 42 43 if ( !is_dir( CACHE) ){44 mkdir( CACHE);43 $cache = get_home_path().CACHE; 44 if ( !is_dir($cache) ){ 45 mkdir( $cache ); 45 46 } 46 if ( isset($comment_info->comment_author_email) && preg_match('/^\[email protected]/',$comment_info->comment_author_email) ){ 47 48 if ( isset($comment_info->comment_author_email) && preg_match('/^\d+@(vip\.)?qq.com$/',$comment_info->comment_author_email) ){ 47 49 //Thank FSM, It's an QQ number 48 50 $qq_uin = explode("@", $comment_info->comment_author_email); … … 50 52 $qq_uin_md5 = md5($qq_uin); 51 53 52 if (file_exists(CACHE.'/'.$qq_uin_md5.'.jpg')){ 54 $file_url = "$cache/$qq_uin_md5.jpg"; 55 56 if (file_exists("$cache/$qq_uin_md5.jpg")){ 57 53 58 $original_img = preg_replace("/src='[^']*'/", 54 59 "src='".get_home_url().'/'.CACHE."/$qq_uin_md5.jpg'", … … 58 63 59 64 $response = wp_remote_get( QQ_REQUEST.$qq_uin, 60 array('user-agent'=>QQ_REQUEST_UA) 65 array('user-agent'=>QQ_REQUEST_UA, 66 'timeout'=>1 67 ) 61 68 ); 62 69 … … 68 75 $response['body'] 69 76 )); 70 77 if (!is_numeric($qq_info->uin)){ 78 //how the hell you get through this... 79 return $original_img; 80 } 71 81 72 $pic_url = CACHE.'/'.md5($qq_info->uin).'.jpg'; 82 $qq_uin_md5 = md5($qq_info->uin);//yes, it's recheck. 83 $pic_path = "$cache/$qq_uin_md5.jpg"; 73 84 74 if (isset($qq_info->avatarUrl) && !file_exists($pic_ url)){85 if (isset($qq_info->avatarUrl) && !file_exists($pic_path)){ 75 86 76 $pic_handle = wp_remote_get($qq_info->avatarUrl); 87 $pic_handle = wp_remote_get($qq_info->avatarUrl, 88 array('user-agent'=>QQ_REQUEST_UA, 89 'timeout'=>1 90 )); 91 if ($pic_handle['response']['code'] != 200){ 92 return $original_img; 93 } 94 77 95 $pic_handle = $pic_handle['body']; 78 96 79 $temp_pic = fopen( $pic_url,'wb+'); 80 fwrite($temp_pic,$pic_handle); 97 $temp_pic = fopen( $pic_path,'wb+'); 98 99 if (fwrite($temp_pic,$pic_handle)){ 100 $original_img = preg_replace("/src='[^']*'/", 101 "src='".get_home_url().'/'.CACHE."/$qq_uin_md5.jpg'", 102 $original_img); 103 } 104 81 105 fclose($temp_pic); 82 106 } 83 84 $original_img = preg_replace("/src='[^']*'/",85 "src='".get_home_url()."/$pic_url'",86 $original_img);87 107 } 88 108 } -
qq-avatar/trunk/readme.txt
r477817 r477926 1 1 === QQ Avatar === 2 2 Contributors: allarem 3 Tags: avatar,qq 3 Tags: avatar,qq,头像 4 4 Requires at least: 3.1 5 5 Tested up to: 3.3 6 Stable tag: 0. 26 Stable tag: 0.3 7 7 License: GPLv2 or later 8 8 9 Replace Gravatar while commenter use QQ numeric email address. 9 Replace Gravatar while commenter use QQ numeric email address.如果用户使用数字QQ邮箱留言且公开空间头像,就替换成QQ头像。 10 10 11 11 == Description == … … 17 17 You've done it ! 18 18 19 == MD5 == 20 If you find out that your php-file's md5 doesn't match in the changlog, please reinstall to reassure safty. 21 如果您的文件MD5散列值与Changlog里的不符,请重新下载并安装以保证安全 22 19 23 == Changelog == 24 25 = 0.3 = 26 b53efa6c4e95783e59b8376c35dfa304 qq-avatar.php 27 *FIXED:avatar won't show while in wp-admin panel 28 *IMPROVE:Set 1 sencond as timeout to improve performance. 20 29 21 30 = 0.2 =
Note: See TracChangeset
for help on using the changeset viewer.