Plugin Directory

Changeset 517477


Ignore:
Timestamp:
03/11/2012 01:13:46 PM (14 years ago)
Author:
allarem
Message:

update to 0.3.4

Location:
qq-avatar
Files:
2 edited
3 copied

Legend:

Unmodified
Added
Removed
  • qq-avatar/tags/0.3.4/qq-avatar.php

    r491693 r517477  
    55Author: Meng Zhuo
    66Author URI: http://mengzhuo.org
    7 Version: 0.3.3
     7Version: 0.3.4
    88License: GPLv2 or later
    99Description: 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>
     
    6969        $cache = qq_get_home_path().CACHE;
    7070        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            }
    7274        }
    7375       
     
    8183           
    8284                $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)){
    8591                   
    8692                    $original_img = preg_replace("/src='[^']*'/",
     
    8995                    return $original_img;
    9096                }
    91            
     97
    9298                $response = wp_remote_get( QQ_REQUEST.$qq_uin,
    9399                                            array('user-agent'=>QQ_REQUEST_UA,
     
    113119               
    114120                $qq_uin_md5 = md5($qq_info->uin);//yes, it's recheck.
    115                 $pic_path = "$cache/$qq_uin_md5.jpg";
    116121               
    117                 if (isset($qq_info->avatarUrl) && !file_exists($pic_path)){
     122                if ( isset($qq_info->avatarUrl) && !file_exists($file_url) ){
    118123               
    119124                    $pic_handle = wp_remote_get($qq_info->avatarUrl,
     
    131136                    $pic_handle = $pic_handle['body'];
    132137                   
    133                     $temp_pic = fopen( $pic_path,'wb+');
     138                    $temp_pic = fopen( $file_url,'wb+');
    134139                   
    135140                    if (fwrite($temp_pic,$pic_handle)){
     
    137142                                  "src='".get_home_url().'/'.CACHE."/$qq_uin_md5.jpg'",
    138143                                   $original_img);
     144                    }
     145                    else{
     146                        $warning = new WP_Error('broke', "No more disk space to Storage QQ_Avatar Cache");
    139147                    }
    140148                   
     
    147155        }
    148156    }
     157    if (is_wp_error($warning)){
     158        $original_img = $original_img.'<--'.$warning->get_error_message().'-->';
     159    }
    149160    return $original_img;
    150161}
  • qq-avatar/tags/0.3.4/readme.txt

    r491693 r517477  
    44Requires at least: 3.1
    55Tested up to: 3.3.1
    6 Stable tag: 0.3.3
     6Stable tag: 0.3.4
    77License: GPLv2 or later
    88
     
    1818
    1919== Changelog ==
     20
     21= 0.3.4 =
     22ADD:Check Disk space while can't write cache file and warn the admin.
     23ADD:if direction of the cache cant be made then warn the admin to check their permisson.
     24ADD:A month cachetime for ANY cached Avatar has been storaged.
    2025
    2126= 0.3.3 =
  • qq-avatar/trunk/qq-avatar.php

    r491693 r517477  
    55Author: Meng Zhuo
    66Author URI: http://mengzhuo.org
    7 Version: 0.3.3
     7Version: 0.3.4
    88License: GPLv2 or later
    99Description: 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>
     
    6969        $cache = qq_get_home_path().CACHE;
    7070        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            }
    7274        }
    7375       
     
    8183           
    8284                $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)){
    8591                   
    8692                    $original_img = preg_replace("/src='[^']*'/",
     
    8995                    return $original_img;
    9096                }
    91            
     97
    9298                $response = wp_remote_get( QQ_REQUEST.$qq_uin,
    9399                                            array('user-agent'=>QQ_REQUEST_UA,
     
    113119               
    114120                $qq_uin_md5 = md5($qq_info->uin);//yes, it's recheck.
    115                 $pic_path = "$cache/$qq_uin_md5.jpg";
    116121               
    117                 if (isset($qq_info->avatarUrl) && !file_exists($pic_path)){
     122                if ( isset($qq_info->avatarUrl) && !file_exists($file_url) ){
    118123               
    119124                    $pic_handle = wp_remote_get($qq_info->avatarUrl,
     
    131136                    $pic_handle = $pic_handle['body'];
    132137                   
    133                     $temp_pic = fopen( $pic_path,'wb+');
     138                    $temp_pic = fopen( $file_url,'wb+');
    134139                   
    135140                    if (fwrite($temp_pic,$pic_handle)){
     
    137142                                  "src='".get_home_url().'/'.CACHE."/$qq_uin_md5.jpg'",
    138143                                   $original_img);
     144                    }
     145                    else{
     146                        $warning = new WP_Error('broke', "No more disk space to Storage QQ_Avatar Cache");
    139147                    }
    140148                   
     
    147155        }
    148156    }
     157    if (is_wp_error($warning)){
     158        $original_img = $original_img.'<--'.$warning->get_error_message().'-->';
     159    }
    149160    return $original_img;
    150161}
  • qq-avatar/trunk/readme.txt

    r491693 r517477  
    44Requires at least: 3.1
    55Tested up to: 3.3.1
    6 Stable tag: 0.3.3
     6Stable tag: 0.3.4
    77License: GPLv2 or later
    88
     
    1818
    1919== Changelog ==
     20
     21= 0.3.4 =
     22ADD:Check Disk space while can't write cache file and warn the admin.
     23ADD:if direction of the cache cant be made then warn the admin to check their permisson.
     24ADD:A month cachetime for ANY cached Avatar has been storaged.
    2025
    2126= 0.3.3 =
Note: See TracChangeset for help on using the changeset viewer.