added gravatar to repo view commit logs - sweet
[gwvp-mini.git] / gwvpmini / gwvpmini_web.php
index f6b6665..54b34a4 100644 (file)
@@ -231,12 +231,12 @@ function gwvpmini_emailToUserLink($email)
 {
        global $BASE_URL;
        
-       $username = gwvpmini_GetUserNameFromEmail($username);
+       $username = gwvpmini_GetUserNameFromEmail($email);
        
        if($username !== false) {
                return "<a href=\"$BASE_URL/user/$username\">$username</a>";
        } else {
-               return "Uknown";
+               return false;
        }
 }
 
@@ -253,5 +253,30 @@ function gwvpmini_fourZeroFour()
 }
 
 
+/**\r
+ * Get either a Gravatar URL or complete image tag for a specified email address.\r
+ *\r
+ * @param string $email The email address\r
+ * @param string $s Size in pixels, defaults to 80px [ 1 - 2048 ]\r
+ * @param string $d Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ]\r
+ * @param string $r Maximum rating (inclusive) [ g | pg | r | x ]\r
+ * @param boole $img True to return a complete IMG tag False for just the URL\r
+ * @param array $atts Optional, additional key/value attributes to include in the IMG tag\r
+ * @return String containing either just a URL or a complete image tag\r
+ * @source http://gravatar.com/site/implement/images/php/\r
+ */\r
+function get_gravatar( $email, $s = 80, $d = 'mm', $r = 'g', $img = false, $atts = array() ) {\r
+       $url = 'http://en.gravatar.com/avatar/';\r
+       $url .= md5( strtolower( trim( $email ) ) );\r
+       $url .= "?s=$s&d=$d&r=$r";\r
+       if ( $img ) {\r
+               $url = '<img src="' . $url . '"';\r
+               foreach ( $atts as $key => $val )\r
+                       $url .= ' ' . $key . '="' . $val . '"';\r
+               $url .= ' />';\r
+       }\r
+       return $url;\r
+}\r
+
 
 ?>
\ No newline at end of file