[pLog-svn] r634 - in plugins/trunk: . gravatar

oscar at devel.plogworld.net oscar at devel.plogworld.net
Thu Dec 30 19:09:08 GMT 2004


Author: oscar
Date: 2004-12-30 19:09:07 +0000 (Thu, 30 Dec 2004)
New Revision: 634

Added:
   plugins/trunk/gravatar/
   plugins/trunk/gravatar/plugingravatar.class.php
Log:
added the new gravatar plugin... ported from 0.3.2 to 1.0 by me, original credits go to somebody whose name I can't remember :)


Added: plugins/trunk/gravatar/plugingravatar.class.php
===================================================================
--- plugins/trunk/gravatar/plugingravatar.class.php	2004-12-30 19:06:45 UTC (rev 633)
+++ plugins/trunk/gravatar/plugingravatar.class.php	2004-12-30 19:09:07 UTC (rev 634)
@@ -0,0 +1,49 @@
+<?php
+
+	include_once( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
+    include_once( PLOG_CLASS_PATH."class/plugin/pluginmanager.class.php" );
+
+    /**
+     * Mostra un avatar a cada comentari descarregant-lo de Gravatar.com. Versió 0.2
+     */
+
+
+class PluginGravatar extends PluginBase {
+
+  function PluginGravatar()
+  {
+    $this->PluginBase();
+    $this->desc = "<p>Returns the URL of an (gr)avatar for every comment. The image is loaded from Gravatar.com</p>
+                   <p>In order to use, simply include the following:<br/><br/>
+                   <strongs>{\$gravatar->gravatar(\$comment,\$default,\$size)}</strong><br/>
+                   <p>Where \$default is the URL of the default image that will be shown in case there is no gravatar available
+                   or if the user did not give an email address. \$size is the desired size in pixels of the gravatar.</p>
+                   <p>Example:</p>
+                   <pre>
+&lt;img class=\"gravatar\" 
+src=\"{\$gravatar->gravatar(\$comment,\"http://lalah.com/default.png\",40)}\" 
+alt=\"{\$comment->getUsername()}\" 
+title=\"{\$comment->getUsername()}\" 
+width=\"40\" height=\"40\" /&gt;
+</pre>";
+    $this->author = "Dani Armengol";
+    $this->id = "gravatar";
+    $this->locales = Array();
+  }
+
+  function gravatar($comment,$default,$mida)
+  {
+    if($comment->getUserEmail() != "")
+      {
+	$grav_url = "http://www.gravatar.com/avatar.php?gravatar_id=".md5($comment->getUserEmail())."&amp;default=".urlencode($default)."&amp;size=".$mida;
+      }
+    else
+      {
+	$grav_url = $default;
+      }
+    
+    return $grav_url;
+  }
+
+}
+?>




More information about the pLog-svn mailing list