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)
Friday, August 28, 2009
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.
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...
Ad module added with help of Google AdSense extension for MediaWiki engine. This small extension does all routine work.
- Download Google AdSense extension for MediaWiki (1.14+).
- Unpack to "extensions" directory.
- Update LocalSettings.php (see below).
- 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
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
$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.
And the final step - add the line below at the end of your LocalSettings.php
Full article is here.
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
Saturday, September 20, 2008
Dynamic Page List
Today I'm looking for plug-in for generating article list for main page (for example, list of new articles or list of new edits). It seems DynamicPageList extension will be helpful in this situation. In fact, DynamicPageList or (also known as DPL) is base for number of other plug-ins (for example, Wgraph, TreeAndMenu, Calendar).
DPL manual is here.
As recommended here, I'll install DynamicPageList itself and Call and Inputbox. There are no cross references in DPL extensions in Semeb_extensions.zip!
Step 1
Invoke DPL from your LocalSettings.php with
Step 2: skipped
Step 3: skipped
DPL manual is here.
As recommended here, I'll install DynamicPageList itself and Call and Inputbox. There are no cross references in DPL extensions in Semeb_extensions.zip!
Step 1
Invoke DPL from your LocalSettings.php with
require_once("extensions/DynamicPageList/DynamicPageList2.php");
Step 2: skipped
There is a special feature in DPL which needs another extension: If you use page inclusion and want to use images as link symbols for the original source you must install the LinkedImage extension. For details see there.
Step 3: skipped
In some special cases (when DPL queries refer to uncategorized pages) DPL needs a special database view in the MySQL database. You should run the database statement which creates that view if you want to use DPL statements which refer to uncategorized pages. Many installations work well without that and you can postpone this step until you really need it. If DPL cannot execute a DPL statement without that view it will issue a corresponding warning. More...
Subscribe to:
Posts (Atom)