Friday, September 11, 2009

Allow raw html

Allow raw html into wikimarkup (between <html>..</html> tags).

Raw html is enabled if $wgRawHtml is true.

So, in LocalSettings.php:

$wgRawHtml = true;


Now it's possible to add everything into wiki page. For example, iframe with mindmap:
<html><iframe width="600" height="350" frameborder="0" src="http://mind42.com/pub/mindmap?mid=e9f82c8d-8cf8-473c-a753-46671d2f1278"></iframe></html>




http://www.mediawiki.org/wiki/Markup_spec

Friday, August 28, 2009

Disqus

Add Disqus blog comments engine.

I use my own AvbDisqus extension to add Disqus functionality to my MediaWiki site.

Source code of Disqus extension for MediaWiki can be found there: http://devwiki.beloblotskiy.com/index.php5/AvbDisqus_(MediaWiki_extension)

Thursday, August 27, 2009

Google AdSense

Adding Google AdSense module into MediaWiki.

Ad module added with help of Google AdSense extension for MediaWiki engine. This small extension does all routine work.

  1. Download Google AdSense extension for MediaWiki (1.14+).
  2. Unpack to "extensions" directory.
  3. Update LocalSettings.php (see below).
  4. Update common.css (http://devwiki.beloblotskiy.com/index.php5?title=MediaWiki:Common.css). New CSS fragment can be found here. This step is really optional.

LocalSettings.php
require_once( "extensions/GoogleAdSense/GoogleAdSense.php" );
$wgGoogleAdSenseClient = 'pub-8940041409402700';
$wgGoogleAdSenseSlot = '2005982900';
$wgGoogleAdSenseID = 'AvbWiki_Right_Skyscraper_120x600';
$wgGoogleAdSenseWidth = 120;
$wgGoogleAdSenseHeight = 600;

All these parameters are from Google AsSense code.

As always, all extensions are listed here...

Upgrade to 1.15

Upgrade MediaWiki 1.13 to MediaWiki 1.15

Delails are here: http://devwiki.beloblotskiy.com/index.php5?title=MediaWiki_upgrade_history

Wednesday, February 4, 2009

Disable new user registration

Add into LocalSettings.php
$wgGroupPermissions['*']['createaccount'] = false;

Only administrator will be able to create a new account. To do this administrator should use special link: index.php5?title=Special:UserLogin&type=signup

Friday, October 17, 2008

Google Analytics

How to add Google Analytics script into MediaWiki engine? Or how I've wrote my first MediaWiki extension. The first idea was to patch skins and add analytics script before </body> tag. Of course, it isn't nice to patch all skins and keep these files coherent in future. Next idea was to patch Skin::bottomScripts() or Skin::outputPage(). Finally, I've decided to write extension which use one of standard hooks to add additional JavaScript code in result page generated by MediaWiki.

Finally:
MediaWiki extension to add Google Analytics script in each wiki page.

Check product home page.

Create file /extensions/AvbGoogleAnalytics/AvbGoogleAnalytics.php

This is extension body written on PHP.

<?php

if( !defined( 'MEDIAWIKI' ) ) die( -1 );

// Add hook on SkinAfterBottomScripts.
$wgHooks['SkinAfterBottomScripts'][] = 'onSkinAfterBottomScripts_AddAvbGoogleAnalyticsScript';


// returns Google Analytics tracker script
function getAvbGoogleAnalyticsScript($analytics_id)
{
$s = "\n<!-- avb: AvbGoogleAnalytics -->\n"
. "<script type=\"text/javascript\">\n"
. "var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");\n"
. "document.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\"));\n"
. "</script>\n"
. "<script type=\"text/javascript\">\n"
. "var pageTracker = _gat._getTracker(\"" . $analytics_id . "\");\n"
. "pageTracker._trackPageview();\n"
. "</script>\n"
. "<h6>avb:2</h6>\n";

return $s;
}

// Event 'SkinAfterBottomScripts': At the end of Skin::bottomScripts()
// $skin: Skin object
// &$text: bottomScripts Text
// Append to $text to add additional text/scripts after the stock bottom scripts.
// Documentation: \mediawiki-1.13.0\docs\hooks.txt
function onSkinAfterBottomScripts_AddAvbGoogleAnalyticsScript($skin, &$text)
{

// Change "YOUR-ANALYTICS-ID" to your actual analytics id
// (analytics id is string like "UA-1223032-7")
$text .= getAvbGoogleAnalyticsScript("YOUR-ANALYTICS-ID");
return true;
}

?>

And the final step - add the line below at the end of your LocalSettings.php

require_once("extensions/AvbGoogleAnalytics/AvbGoogleAnalytics.php");


Full article is here.

Monday, September 29, 2008

Logo

Logo has been changed to
Instruction $wgLogo = "/skins/common/images/avbwiki.png" was added into LocalSettings.php