Skip to content

Commit

Permalink
Add LikeBox macro.
Browse files Browse the repository at this point in the history
  • Loading branch information
thijstriemstra committed Sep 21, 2010
1 parent 099bb77 commit e5ee3a8
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions facebookplugins/__init__.py
Expand Up @@ -175,3 +175,56 @@ def expand_macro(self, formatter, name, args):


return self.iframe(src, width, height) return self.iframe(src, width, height)



class LikeBox(WikiMacroBase, FBWikiMacro):
"""
The Like Box is a social plugin that enables Facebook Page owners to attract and gain Likes from their own website.
Examples:
{{{
[[LikeBox]] # current page
[[LikeBox(http://www.facebook.com/sonicyouth)]] # Sonic Youth fanpage on Facebook without stream/header
[[LikeBox(http://www.facebook.com/sonicyouth,stream)]] # with stream
[[LikeBox(http://www.facebook.com/sonicyouth,header)]] # with header
[[LikeBox(http://www.facebook.com/sonicyouth,full)]] # with stream and header
}}}
Check the [http://developers.facebook.com/docs/reference/plugins/like-box documentation]
for more information.
"""

plugin_name = 'likebox'

def expand_macro(self, formatter, name, args):
"""
@param name: the actual name of the macro
@param args: text enclosed in parenthesis at the call of the macro
"""
options = unicode(args).split(",")
href = self.abs_href(formatter)
connections = '10'
width = '292'
height = '255'
header = 'false'
stream = 'false'

if len(options) > 0 and options[0] != "None":
href = options[0]

if len(options) > 1:
param = options[1]

if param == "stream":
stream = 'true'
height = '555'
elif param == "header":
header = 'true'
height = '287'
elif param == "full":
stream = header = 'true'
height = '587'

src = "%s/%s.php?href=%s&connections=%s&stream=%s&header=%s&width=%s&height=%s" % (
self.fb_url, self.plugin_name, href, connections, stream, header, width, height)

return self.iframe(src, width, height)

0 comments on commit e5ee3a8

Please sign in to comment.