Plugin Directory

Changeset 219395


Ignore:
Timestamp:
03/19/2010 03:25:24 AM (16 years ago)
Author:
chatroll
Message:

Chatroll Live Chat 1.2.5 Release

Location:
chatroll-live-chat
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • chatroll-live-chat/tags/1.2.5/readme.txt

    r214725 r219395  
    55Requires at least: 2.8
    66Tested up to: 2.9
    7 Stable tag: 1.2.4
     7Stable tag: 1.2.5
    88
    99Chatroll is a simple and flexible chat plugin for WordPress. Use Chatroll as a live chat or shoutbox on your sidebar, posts and pages.
     
    108108== Changelog ==
    109109
     110= 1.2.5 =
     111* Improved Gravatar support. Removed Curl dependency.
     112
    110113= 1.2.4 =
    111114* Add support for Gravatars and local avatars.
  • chatroll-live-chat/tags/1.2.5/wp-chatroll.php

    r214725 r219395  
    237237
    238238    /**
    239      * We need special handling for Gravatar image URLs because:
    240      *  1) Chatroll requires image URLs to have valid filename extensions (.png, .jpg, etc.)
    241      *  2) Chatroll does not support image URLs that redirect or have GET parameters
    242      * Both these issues should be fixed in a future Chatroll service update.
    243      * Please contact support@chatroll.com for more information.
    244      */
    245     public function getGravatarUrl($url)
    246     {
    247         // Gravatar URL pattern
    248         $gpattern = "http:\/\/www\.gravatar\.com\/avatar\/[a-z0-9]+";
    249 
    250         // Decode URL-encoded characters in the Gravatar URL for processing
    251         $url = urldecode($url);
    252 
    253         // Extract the user image URL and default image URL from the combined Gravatar URL
    254         $userUrl = "";
    255         $defaultUrl = "";
    256         if (preg_match("/(" . $gpattern . ").*d=(" . $gpattern . ").*/", $url, $matches)) {
    257             $userUrl = $matches[1];
    258             $defaultUrl = $matches[2];
    259         }
    260 
    261         // Use CURL to check if the Gravatar exists, otherwise use the default image URL
    262         $ch = curl_init($userUrl . "?d=404");
    263         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    264         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    265         curl_setopt($ch, CURLOPT_FAILONERROR, true);
    266         curl_setopt($ch, CURLOPT_NOBODY, true);
    267         curl_setopt($ch, CURLOPT_TIMEOUT, 5);
    268         curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
    269         curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; it; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6");
    270         $html = curl_exec($ch);
    271         if(!curl_errno($ch)) {
    272             return $userUrl . ".jpg";
    273         } else {
    274             return $defaultUrl . ".jpg";
    275         }
    276     }
    277 
    278     /**
    279239     * OVERRIDE Chatroll::appendPlatformDefaultAttr()
    280240     *  Set user parameters for SSO integration
     
    304264            // This ONLY takes effect when the Single Sign-On (SSO) check box is turned on via the Chatroll's Settings page!
    305265            if (function_exists('get_avatar')) {
     266                // 38px image size
    306267                $avtr = get_avatar($current_user->ID, 38);
    307268                $avtr_src = preg_replace("/.*src='([^']*)'.*/", "$1", $avtr);
     
    312273                        $domain = preg_replace("/^(http[s]?:\/\/[^\/]+).*/", "$1", $url);
    313274                        $avtr_src = $domain . $avtr_src;
    314                     } else if (preg_match("/gravatar\.com/", $avtr_src)) {
    315                         // Get full Gravatar image URL (with extension)
    316                         $avtr_src = $this->getGravatarUrl($avtr_src);
    317                     }
    318                     $attr['upic'] = $avtr_src;
     275                    }
     276                    // The gravatar image URL is extracted from an image tag and ampersands (&) are escaped to &
     277                    // Chatroll uses the URL to download the image, as opposed to using it directly for an html img tag.
     278                    // Thus we need to un-escape the specialchars. (e.g. & -> &)
     279                    $attr['upic'] = htmlspecialchars_decode($avtr_src);
    319280                }
    320281            }
  • chatroll-live-chat/trunk/readme.txt

    r214725 r219395  
    55Requires at least: 2.8
    66Tested up to: 2.9
    7 Stable tag: 1.2.4
     7Stable tag: 1.2.5
    88
    99Chatroll is a simple and flexible chat plugin for WordPress. Use Chatroll as a live chat or shoutbox on your sidebar, posts and pages.
     
    108108== Changelog ==
    109109
     110= 1.2.5 =
     111* Improved Gravatar support. Removed Curl dependency.
     112
    110113= 1.2.4 =
    111114* Add support for Gravatars and local avatars.
  • chatroll-live-chat/trunk/wp-chatroll.php

    r214725 r219395  
    237237
    238238    /**
    239      * We need special handling for Gravatar image URLs because:
    240      *  1) Chatroll requires image URLs to have valid filename extensions (.png, .jpg, etc.)
    241      *  2) Chatroll does not support image URLs that redirect or have GET parameters
    242      * Both these issues should be fixed in a future Chatroll service update.
    243      * Please contact support@chatroll.com for more information.
    244      */
    245     public function getGravatarUrl($url)
    246     {
    247         // Gravatar URL pattern
    248         $gpattern = "http:\/\/www\.gravatar\.com\/avatar\/[a-z0-9]+";
    249 
    250         // Decode URL-encoded characters in the Gravatar URL for processing
    251         $url = urldecode($url);
    252 
    253         // Extract the user image URL and default image URL from the combined Gravatar URL
    254         $userUrl = "";
    255         $defaultUrl = "";
    256         if (preg_match("/(" . $gpattern . ").*d=(" . $gpattern . ").*/", $url, $matches)) {
    257             $userUrl = $matches[1];
    258             $defaultUrl = $matches[2];
    259         }
    260 
    261         // Use CURL to check if the Gravatar exists, otherwise use the default image URL
    262         $ch = curl_init($userUrl . "?d=404");
    263         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    264         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    265         curl_setopt($ch, CURLOPT_FAILONERROR, true);
    266         curl_setopt($ch, CURLOPT_NOBODY, true);
    267         curl_setopt($ch, CURLOPT_TIMEOUT, 5);
    268         curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
    269         curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; it; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6");
    270         $html = curl_exec($ch);
    271         if(!curl_errno($ch)) {
    272             return $userUrl . ".jpg";
    273         } else {
    274             return $defaultUrl . ".jpg";
    275         }
    276     }
    277 
    278     /**
    279239     * OVERRIDE Chatroll::appendPlatformDefaultAttr()
    280240     *  Set user parameters for SSO integration
     
    304264            // This ONLY takes effect when the Single Sign-On (SSO) check box is turned on via the Chatroll's Settings page!
    305265            if (function_exists('get_avatar')) {
     266                // 38px image size
    306267                $avtr = get_avatar($current_user->ID, 38);
    307268                $avtr_src = preg_replace("/.*src='([^']*)'.*/", "$1", $avtr);
     
    312273                        $domain = preg_replace("/^(http[s]?:\/\/[^\/]+).*/", "$1", $url);
    313274                        $avtr_src = $domain . $avtr_src;
    314                     } else if (preg_match("/gravatar\.com/", $avtr_src)) {
    315                         // Get full Gravatar image URL (with extension)
    316                         $avtr_src = $this->getGravatarUrl($avtr_src);
    317                     }
    318                     $attr['upic'] = $avtr_src;
     275                    }
     276                    // The gravatar image URL is extracted from an image tag and ampersands (&) are escaped to &
     277                    // Chatroll uses the URL to download the image, as opposed to using it directly for an html img tag.
     278                    // Thus we need to un-escape the specialchars. (e.g. & -> &)
     279                    $attr['upic'] = htmlspecialchars_decode($avtr_src);
    319280                }
    320281            }
Note: See TracChangeset for help on using the changeset viewer.