From: <ru...@us...> - 2010-06-13 21:51:23
|
Revision: 7530 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7530&view=rev Author: rurban Date: 2010-06-13 21:51:16 +0000 (Sun, 13 Jun 2010) Log Message: ----------- Initial fragment of a new plugin Added Paths: ----------- trunk/lib/plugin/FacebookLike.php Added: trunk/lib/plugin/FacebookLike.php =================================================================== --- trunk/lib/plugin/FacebookLike.php (rev 0) +++ trunk/lib/plugin/FacebookLike.php 2010-06-13 21:51:16 UTC (rev 7530) @@ -0,0 +1,79 @@ +<?php // -*-php-*- +// rcs_id('$Id: FacebookLike.php 7417 2010-05-19 12:57:42Z vargenau $'); +/* + * Copyright 2010 Reini Urban + * + * This file is part of PhpWiki. + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * PhpWiki is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PhpWiki; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/** + Optional opengraph page meta data to be added to head.tmpl: + og:title - The title of your page; if not specified, the title element will be used. + og:site_name - The name of your web site, e.g., "CNN" or "IMDb". + og:image - The URL of the best picture for this page. The image must be at least + 50px by 50px and have a maximum aspect ratio of 3:1. +*/ + +class WikiPlugin_FacebookLike +extends WikiPlugin +{ + function getDescription() { + return _("Display a Facebook Like button. See http://developers.facebook.com/docs/reference/plugins/like"); + } + + function getDefaultArguments() { + return array('width' => 450, + 'height' => 35, + //'title' => '', // override WIKINAME + 'colorscheme' => 'light', // or "dark" + 'show_faces' => "false", + 'layout' => "standard", // or "button_count" + 'action' => "like", // or "recommend" + ); + } + + function run($dbi, $argstr, &$request, $basepage) { + $args = $this->getArgs($argstr, $request); + extract($args); + //$iframe = "<iframe src=\"http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fexample.com%2Fpage%2Fto%2Flike&layout=standard&show_faces=false&width=450&action=like&colorscheme=light&height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;\" allowTransparency=\"true\"></iframe>"; + $urlargs = array("href" => $url, + "layout" => $layout, + "show_faces" => $show_faces, + "width" => $width, + "action" => "like", // or "recommend" + "colorscheme"=> $colorscheme, + "height" => $height + ); + $url = "http://www.facebook.com/plugins/like.php?href=".htmlentities(WikiUrl($pagename,$urlargs,true)); + $params = array("src" => $url, + "scrolling" => 'no', + "frameborder" => '0', + "style" => "border:none; overflow:hidden; " + ."width:$width"."px; height:$height"."px;", + "allowtransparency" => "true"); + return HTML::iframe($params); + } +}; + +// Local Variables: +// mode: php +// tab-width: 4 +// c-basic-offset: 4 +// c-hanging-comment-ender-p: nil +// indent-tabs-mode: nil +// End: +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |