Plugin Directory

Changeset 205753


Ignore:
Timestamp:
02/14/2010 11:24:57 PM (16 years ago)
Author:
cybio
Message:

r447@forge (orig r15): olli | 2010-02-15 00:22:48 +0100

  • [FIX] default gravatar
Location:
gravatarlocalcache/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • gravatarlocalcache/trunk/GravatarLocalCache.php

    r205642 r205753  
    77Description: Local cache for gravatar images (saves dnsqueries and let you control cache/proxysettings of the images).
    88Author: Oliver Schaal
    9 Version: 0.9.4
     9Version: 0.9.5
    1010
    1111    This is a WordPress plugin (http://wordpress.org) and widget
     
    1919}
    2020
    21 // downloadfunction of wordpress
     21// we need the downloadfunction of wordpress
    2222require_once(ABSPATH . 'wp-admin/includes/file.php');
    2323
     
    136136                        @unlink($_tmp);
    137137
    138                         // lets try to fetch the default avatar
    139                         // preg_match('/&d=(.*)/i',$_imageurl,$_defaultavatar);
    140                         // $_tmp = download_url(urldecode($_defaultavatar[1]));
    141                         if ( self::$defaultAvatar == 'mystery') {
    142                             $_defavatar = 'http://www.gravatar.com/avatar/'.md5('unknown@gravatar.com').'?s='.$_img[2];
    143                         } elseif (self::$defaultAvatar == 'blank') {
    144                             $_defavatar = includes_url('images/blank.gif');
    145                         } else {
    146                             // should never reach this point
    147                             $_defavatar = 'http://www.gravatar.com/avatar/?d='.self::$defaultAvatar.'&s='.$_img[2];
    148                         }
    149                         $_tmp = download_url($_defavatar);
     138                        // lets try to fetch the default avatar in the url
     139                        preg_match('/&d=(.*)/i',$_imageurl,$_defaultavatar);
     140                        $_tmp = download_url(urldecode($_defaultavatar[1]));
    150141                        if ( is_wp_error($_tmp) ) {
    151                             // print '<!-- GravatarLocalCache: default image couldn't be fetched -->';
     142                            // print '<!-- GravatarLocalCache: default image (url param) couldn't be fetched -->';
    152143                            @unlink($_tmp);
    153                             return $matches[0];
     144
     145                            // last chance, lets try the default gravatar set in wordpress
     146                            if ( self::$defaultAvatar == 'mystery') {
     147                                $_defavatar = 'http://www.gravatar.com/avatar/'.md5('unknown@gravatar.com').'?s='.$_img[2];
     148                            } elseif (self::$defaultAvatar == 'blank') {
     149                                $_defavatar = includes_url('images/blank.gif');
     150                            } else {
     151                                // should never reach this point
     152                                $_defavatar = 'http://www.gravatar.com/avatar/?d='.self::$defaultAvatar.'&s='.$_img[2];
     153                            }
     154
     155                            $_tmp = download_url($_defavatar);
     156                            if ( is_wp_error($_tmp) ) {
     157                                // print '<!-- GravatarLocalCache: default image (wordpress setting) couldn't be fetched -->';
     158                                @unlink($_tmp);
     159                                return $matches[0];
     160                            }
    154161                        }
    155162                    }
  • gravatarlocalcache/trunk/readme.txt

    r205642 r205753  
    1010Requires at least: 2.8
    1111Tested up to: 2.9.1
    12 Stable tag: 0.9.4
     12Stable tag: 0.9.5
    1313
    1414Local cache for gravatar images (saves dnsqueries and let you control cache/proxysettings of the images).
     
    3838If your plugin/theme doesn't use this function, GLC can't fetch the gravatar requests. Ask the author of the plugin/theme to use "get_avatar()".
    3939
    40 = How can i change the cache/proxy-settings if images? =
     40= How can i change the cache/proxy-settings of the images? =
    4141If you use apache as your webserver, you can set the options throught .htacces as described [here (german)](http://blog.splash.de/2010/01/29/cache-kontrolle-beim-apache-via-htaccess/) , [here](http://www.samaxes.com/2009/01/more-on-compressing-and-caching-your-site-with-htaccess/) or [here](http://www.realityloop.com/blog/2009/08/19/optimizing-page-load-times-using-moddeflate-modexpires-etag-apache2).
    4242For other webservers you have to check the manual.
     
    4545
    4646== Changelog ==
     47
     48= 0.9.5 (1.0.0 RC4) =
     49* [FIX] default gravatar
     50* [more information](http://blog.splash.de/2010/02/15/gravatarlocalcache-0-9-3-0-9-5/)
    4751
    4852= 0.9.4 (1.0.0 RC3) =
Note: See TracChangeset for help on using the changeset viewer.