Extension:FacebookLikeButton
From MediaWiki.org
|
FacebookLikeButton Release status: stable |
|||
|---|---|---|---|
| Implementation | Tag | ||
| Description | Creates a Facebook Like and/or Send button(s). | ||
| Author(s) | Piotr Zuk (zukoTalk) | ||
| Last version | 1.0.0 (2011-08-11) | ||
| MediaWiki | 1.16 | ||
| License | GNU public License | ||
| Download | MediawikiExtFacebookLikeButton.zip
or |
||
| Example | C++Book reference | ||
|
|||
|
Check usage (experimental) |
|||
Contents |
[edit] What can this extension do?
Allows you to very simply include Facebook Like and/or Send button(s).
[edit] Usage
With the tag <facelikebutton></facelikebutton>
- Version 1: <facelikebutton style="1" showsend="0"></facelikebutton> (without counting box)
- Version 2: <facelikebutton style="2" showsend="0"></facelikebutton> (with horizontal counting box)
- Version 3: <facelikebutton style="3" showsend="0"></facelikebutton> (with vertical counting box)
Default version = 2 (with horizontal counting box) and without send button ( showsend = 0 ).
Set showsend="1" to see the makes the Send button visible.
[edit] Download instructions
You can download the php file from MediawikiExtFacebookLikeButton_zip or copy and paste the code below to the file: $IP/extensions/FacebookLikeButton/FacebookLikeButton.php. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.
[edit] Installation
To install this extension, add the following to LocalSettings.php:
require_once("$IP/extensions/FacebookLikeButton/FacebookLikeButton.php");
[edit] Code
<?php /* Wiki FacebookLikeButton MediaWiki extension ** Installation Instructions: http://www.mediawiki.org/wiki/Extension:FacebookLikeButton */ $wgExtensionFunctions[] = "facebooklikebuttonExtension"; function genereatefacebookscript($showsend, $version) { $str = ""; if( is_numeric($showsend) && $showsend > 1 ) $s = "true"; else $s = "false"; switch($version) { case 1: $str = '<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="" send="'.$s.'" width="450" show_faces="true" action="like" font=""></fb:like>'; break; case 2: $str = '<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="" send="'.$s.'" layout="button_count" width="450" show_faces="false" action="like" font=""></fb:like>'; break; case 3: $str = '<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="" send="'.$s.'" layout="box_count" width="450" show_faces="true" action="like" font=""></fb:like>'; break; } return $str; } function facebooklikebuttonExtension() { global $wgParser; $wgParser->setHook( "facelikebutton", "renderFacebookLikeButton" ); } function renderFacebookLikeButton( $input, $argv ) { $style= @$argv['style']; $showsend= @$argv['showsend']; if (is_numeric($style)) { $version = $style; if (!$versions_facelikebutton[$version]) { $version = 1; } } else { $version = 1; } $output = genereatefacebookscript($showsend, $version); return $output; } $wgExtensionCredits['parserhook'][] = array( 'name' => 'Wiki FacebookLikeButton', 'version' => '1.0.0', 'author' => 'Piotr Zuk', 'url' => 'http://www.mediawiki.org/wiki/Extension:FacebookLikeButton', 'description' => 'Mediawiki FacebookLikeButton Extension' );

