Facebook Like-Button Plugin

Compatible with DokuWiki

No compatibility info given!

plugin Facebook Like-Button Plugin for Dokuwiki

Last updated on
2011-01-05
Provides
Syntax, Action
Repository
Source

Similar to facebook, fbcomments, fbsp

Tagged with facebook, fbml, like, social

I looked for a realy good Facebook like-button plugin for Dokuwiki but there were only Facebook plugin and fbsp plugin. The first one only creates a big fat like-box and the second one is too simple. So I created a plugin on my own. You can find this plugin on Github. You can find a current doku on echtzeitraum.de

Features

  1. You can fully customize the appearance.
  2. Easy usage.
  3. Usage of FBML.
  4. Text-Editor button.

Plugin configuration is available in following languages: German, English

Icon of the text editor button by Yusuke Kamiyamane.

Requirements

To use this Plugin you need the following system:

  • PHP >= 5.1.2
  • Dokuwiki >= 2009-02-14b

Download / Installation

To install this plugin go to Admin → Manage plugins and enter in the following URL:

http://downloads.echtzeitraum.de/plugin/dokuwiki/facebooklike.zip

In Admin → Configuration settings you can change various settings. You can modify and redistribute it under the terms of the GPL Version 3.

Usage

Adding the following code will insert a default Facebook like-button (with the default settings) on the current page. You can modify the default settings on the wiki configuration page ( Admin → Configuration settings ).

{{like>}}

If you want you can modify the default settings by adding one or more parameters.

{{like>url=http://example.com/|colorscheme=dark}}

Supported parameters:

Parameter Value Description
url String Page that should be liked. Must be a valid address (e.g. http://example.com/).
layout String Determines the size and amount of social context next to the button. (standard/button_count/box_count)
show_faces Boolean Display faces of friends who likes the specified url. Effects layout “standard” only!
width Integer Width of the “reserved” area.
action String The verb to display in the button. (like/recommend)
font String The font of the button. (arial/verdana/segoe ui/tahoma/lucida grande/trebuchet ms)
colorscheme String Colors of the buttons.(light/dark)

Examples

You can try out different combinations on the official Facebook developer page or on my webpage.

Comments

If you use a secure SSL connection, this Plugin may cause an error message. This is caused by the FBML JavaScript Header, which is called by HTTP and not HTTPS. To fix it, you have to make a little change in action.php.

Search this and delete http: before the double slash. This will automatically choose the correct protocol.

	function _addHeaders (&$event, $param) {
		global $lang;
 
		$event->data["script"][] = array (
		  "type" => "text/javascript",
		  "src" => 'http://connect.facebook.net/'.$this->getLang('fbml_language').'/all.js#xfbml=1',
		);
	}

Here's the result:

action.php
<?php
 
/* Facebook Like-Button Plugin for Dokuwiki
...
 */
 
if(!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'action.php');
 
class action_plugin_facebooklike extends DokuWiki_Action_Plugin {
 
	/**
	 * General information about the plugin.
	 */
	function getInfo(){
		return array(
			'author' => 'Marvin Thomas Rabe',
			'email'  => 'm.rabe@echtzeitraum.de',
			'date'	 => '2011-01-05',
			'name'	 => 'Facebook Like-Button',
			'desc'	 => 'Adds Facebook like-buttons',
			'url'	 => 'http://echtzeitraum.de/plugin/dokuwiki/like-button',
		);
	}
 
	/**
	 * Register its handlers.
	 */
	function register(&$controller) {
	    $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE',  $this, '_addHeaders');
	}
 
	/**
	 * Adds the FBML JavaScript file to the header.
	 */
	function _addHeaders (&$event, $param) {
		global $lang;
 
		$event->data["script"][] = array (
		  "type" => "text/javascript",
		  "src" => '//connect.facebook.net/'.$this->getLang('fbml_language').'/all.js#xfbml=1',
		);
	}
 
}

We are in the process of deprecating FBML. If you are building a new application on Facebook.com, please implement your application using HTML, JavaScript and CSS. You can use our JavaScript SDK and Social Plugins to embedded many of the same social features available in FBML. While there is still functionality that we have not ported over yet, we are no longer adding new features to FBML. Quelle: http://developers.facebook.com/docs/reference/fbml/

— But FBML-LIKE will be still supported. Its listed as an Social Plugin.


ftp is a bad thing for dowmloads, cant download it.

— Fixed.

plugin/facebooklike.txt · Last modified: 2012/04/23 22:04 by 79.255.196.51
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Imprint Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
WikiForumIRCBugsGitXRefTranslate