]> git.mxchange.org Git - friendica.git/commitdiff
Rename gravatar_img() more generic to avatar_img().
authorKlaus Weidenbach <Klaus.Weidenbach@gmx.net>
Mon, 20 Feb 2012 23:54:34 +0000 (00:54 +0100)
committerKlaus Weidenbach <Klaus.Weidenbach@gmx.net>
Mon, 9 Apr 2012 19:22:09 +0000 (21:22 +0200)
I would like to extend the Gravatar support to also use Libravatar, a decentralized avatar service.
First step to extract Gravatar from core and put it into its own plugin. Later the Libravatar plugin can be done, too as a plugin.

include/Scrape.php
include/network.php
mod/register.php

index 9c237916bc30bfa4ab7b23440fd23a9f89576c9b..141c90dcfd6a92bbb5246ee78fc61a040ba06a05 100644 (file)
@@ -446,7 +446,7 @@ function probe_url($url, $mode = PROBE_NORMAL) {
                                                $phost = substr($url,strpos($url,'@')+1);
                                                $profile = 'http://' . $phost;
                                                // fix nick character range
-                                               $vcard = array('fn' => $name, 'nick' => $name, 'photo' => gravatar_img($url));
+                                               $vcard = array('fn' => $name, 'nick' => $name, 'photo' => avatar_img($url));
                                                $notify = 'smtp ' . random_string();
                                                $poll = 'email ' . random_string();
                                                $priority = 0;
@@ -655,7 +655,7 @@ function probe_url($url, $mode = PROBE_NORMAL) {
                        }
 
                        if((! $vcard['photo']) && strlen($email))
-                               $vcard['photo'] = gravatar_img($email);
+                               $vcard['photo'] = avatar_img($email);
                        if($poll === $profile)
                                $lnk = $feed->get_permalink();
                        if(isset($lnk) && strlen($lnk))
index 38d0980d50f781464127a77017aeced9f8310ebb..59705634bb6e461de6f3abc5e146e654012d7a6d 100644 (file)
@@ -692,13 +692,13 @@ function allowed_email($email) {
 }}
 
 
-if(! function_exists('gravatar_img')) {
-function gravatar_img($email) {
+if(! function_exists('avatar_img')) {
+function avatar_img($email) {
        $size = 175;
        $opt = 'identicon';   // psuedo-random geometric pattern if not found
        $rating = 'pg';
        $hash = md5(trim(strtolower($email)));
-       
+
        $url = 'http://www.gravatar.com/avatar/' . $hash . '.jpg' 
                . '?s=' . $size . '&d=' . $opt . '&r=' . $rating;
 
index 630c0a6759426fa6918d022087dee6b89ceefc2b..8812ebadb0be1abc026276f577260a952aae3b91 100644 (file)
@@ -324,7 +324,7 @@ function register_post(&$a) {
                require_once('include/Photo.php');
 
                if(($use_gravatar) && (! strlen($photo))) 
-                       $photo = gravatar_img($email);
+                       $photo = avatar_img($email);
                $photo_failure = false;
 
                $filename = basename($photo);
@@ -333,7 +333,7 @@ function register_post(&$a) {
                if($img->is_valid()) {
 
                        $img->scaleImageSquare(175);
-                                       
+
                        $hash = photo_new_resource();
 
                        $r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 4 );