comparison vendor/plugins/gravatar/lib/.svn/text-base/gravatar.rb.svn-base @ 22:40f7cfd4df19

* Update to SVN trunk rev 4173
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Fri, 24 Sep 2010 14:06:04 +0100
parents 513646585e45
children 94944d00e43c
comparison
equal deleted inserted replaced
14:1d32c0a0efbf 22:40f7cfd4df19
24 24
25 # The alt text to use in the img tag for the gravatar. Since it's a 25 # The alt text to use in the img tag for the gravatar. Since it's a
26 # decorational picture, the alt text should be empty according to the 26 # decorational picture, the alt text should be empty according to the
27 # XHTML specs. 27 # XHTML specs.
28 :alt => '', 28 :alt => '',
29
30 # The title text to use for the img tag for the gravatar.
31 :title => '',
29 32
30 # The class to assign to the img tag for the gravatar. 33 # The class to assign to the img tag for the gravatar.
31 :class => 'gravatar', 34 :class => 'gravatar',
32 35
33 # Whether or not to display the gravatars using HTTPS instead of HTTP 36 # Whether or not to display the gravatars using HTTPS instead of HTTP
46 49
47 # Return the HTML img tag for the given email address's gravatar. 50 # Return the HTML img tag for the given email address's gravatar.
48 def gravatar(email, options={}) 51 def gravatar(email, options={})
49 src = h(gravatar_url(email, options)) 52 src = h(gravatar_url(email, options))
50 options = DEFAULT_OPTIONS.merge(options) 53 options = DEFAULT_OPTIONS.merge(options)
51 [:class, :alt, :size].each { |opt| options[opt] = h(options[opt]) } 54 [:class, :alt, :size, :title].each { |opt| options[opt] = h(options[opt]) }
52 "<img class=\"#{options[:class]}\" alt=\"#{options[:alt]}\" width=\"#{options[:size]}\" height=\"#{options[:size]}\" src=\"#{src}\" />" 55 "<img class=\"#{options[:class]}\" alt=\"#{options[:alt]}\" title=\"#{options[:title]}\" width=\"#{options[:size]}\" height=\"#{options[:size]}\" src=\"#{src}\" />"
53 end 56 end
54 57
55 # Returns the base Gravatar URL for the given email hash. If ssl evaluates to true, 58 # Returns the base Gravatar URL for the given email hash. If ssl evaluates to true,
56 # a secure URL will be used instead. This is required when the gravatar is to be 59 # a secure URL will be used instead. This is required when the gravatar is to be
57 # displayed on a HTTPS site. 60 # displayed on a HTTPS site.