Extension:ShoutWiki Ads

ShoutWiki Ads extension displays Google AdSense ads on skins. Currently it supports Monobook (requires patching), Monaco and Truglass skins.

The extension will not display ads
 * when ads are disabled ($wgAdConfig['enabled'] = false;)
 * on the login page (Special:UserLogin)
 * on namespaces where ads are not enabled
 * for autoconfirmed users
 * if the wiki is in a language that is not supported by Google AdSense

This extension is currently very ShoutWiki-specific.

History
The reason why this extension was written was that in the past, each skin (at ShoutWiki) that should have ads needed to implement its own ad loader, which was not very easy to maintain, as it meant lots and lots of code duplication. To solve the problem, we stashed all the ad-related code into one class, and we'd just hook on the different hooks in different skins to display the ads.

Of course, the Monobook skin didn't have the hooks we needed to use, so we had to create them.

All the functions in the ShoutWikiAds class are public and static, so it's very easy to use the class.

Installation

 * 1) Download the files and place them in $IP/extensions/ShoutWikiAds/
 * 2) Apply the patch against your $IP/skins/MonoBook.php
 * 3) Add the line  into the wiki's LocalSettings.php and configure the $wgAdConfig variable
 * 4) Installation can now be verified through the wiki's Special:Version

Parameters
The extension has only one configuration variable, $wgAdConfig. It should look something like this:

If the enabled key is set to false, the extension will do nothing.

The adsense-client key should be set to your AdSense provider number (just the number, not the "pub-" part!).

The right-column and toolbox-button options apply only to the Monobook skin. monaco-sidebar</tt> and monaco-leaderboard</tt> options apply only to the Monaco skin, while truglass-leaderboard</tt> option applies only to the Truglass skin.