Extension:BibleRef

This extension allows you to easily link Bible references to the Bible text at BibleGateway.com.

Installation
Add this line at the end of LocalSettings.php : include('extensions/BibleRef.php');

You can add a variable (optional) $wgBibleRefDefaultVersion in the LocalSettings.php file to change the default version, example to use a French version as default : $wgBibleRefDefaultVersion = 'ls';

Copy the following code into extensions/BibleRef.php :

<?php
 * 1) Bible References
 * 2) Version: 1.1
 * 3) Modified 7th May 2007 by Matt Dolan
 * 4) Links a Bible reference to the text at Biblegateway.com
 * 5) You can take advantage of BibleGateway's features such as displaying two references together:
 * 6) eg. Matt 28:18-20,2Cor 4
 * 7) Tag :
 * 8)   ref
 * 9) Example :
 * 10)   Col 1:15-20
 * 11)   Col 1:15-20
 * 12) Soli Deo Gloria!
 * 1) Example :
 * 2)   Col 1:15-20
 * 3)   Col 1:15-20
 * 4) Soli Deo Gloria!
 * 1) Soli Deo Gloria!

$wgExtensionFunctions[] = 'wfBibleRef'; $wgExtensionCredits['parserhook'][] = array(       'name' => 'Bible References',        'description' => 'Links Bible References to BibleGateway.com',        'author' => 'Matt Dolan',        'url' => 'http://meta.wikimedia.org/wiki/BibleRef' );

function wfBibleRef { global $wgParser; $wgParser->setHook('bible', 'linkBibleRef'); }

function linkBibleRef($input, $args) { global $wgBibleRefDefaultVersion;
 * 1) The callback function for converting the input text to HTML output

// BibleGateway's Version numbers $versions = array(               'niv-us'        => 31, // New International Version (American English)                'niv'           => 64, // New International Version (British English)                'nasb'          => 49, // North American Standard Bible                'esv'           => 47, // English Standard Version                'tniv'          => 72, // Today's New International Version                'msg'           => 65, // The Message                'nlt'           => 51, // New Living Translation                'kjv'           => 9,  // King James Version                'av'            => 9,  // Authorised Version (= KJV)                'cev'           => 46, // Contemporary English Version                'nkjv'          => 50, // New King James Version                'ls'            => 2,  // Louis Segond                'sem'           => 32, // La Bible du Semeur );	// Added functionality for other online Bibles - array values are URLs to search path	$nonBGVersions = array( 'net'		=> 'http://net.bible.org/passage.php?passage=',		// Net Bible );

$versionText = strtolower($args['ver']);               // get the desired version from the XML tag

if ($versionText=='')				// if no version specified in XML tag {		if (isset($wgBibleRefDefaultVersion)) { 	// use the default defined value, if that's set elsewhere if (is_int($wgBibleRefDefaultVersion)) $versionText = $wgBibleRefDefaultVersion; else $versionText = $versions[$wgBibleRefDefaultVersion]; }		else                                   // if none if given, default to ESV $versionText = 47; }	if ($nonBGVersions[$versionText]!='') {        // if the version requested match a non-Bible Gateway one above $output = "<a href='".$nonBGVersions[$versionText].urlencode($input).";' "; }	else { if ($versions[$versionText]!='')       // if the version requested match one defined above... $version = $versions[$versionText];    // get the BibleGateway version number elseif (is_int($versionText))                  // if the given 'ver' tag is an integer, we'll assumed it's a version number $version = $versionText; $output = "".$input."";

return $output; } ?>

Usage
Example:  Col 1:15-20 

Bible Version
The default Bible version is the ESV (English Standard Version).

You may specify an alternate version in the tag, using the 'ver' attribute. Possible values:
 * 'NIV-US' - New International Version (American English)
 * 'NIV' - New International Version (British English)
 * 'NASB' - North American Standard Bible
 * 'ESV' - English Standard Version
 * 'TNIV' - Today's New International Version
 * 'MSG' - The Message
 * 'NLT' - New Living Translation
 * 'KJV'	- King James Version
 * 'AV' - Authorised Version (synonym for KJV)
 * 'CEV' - Contemporary English Version
 * 'NKJV' - New King James Version
 * 'LS' - Louis Segond (french)
 * 'SEM' - La Bible du Semeur (french)

Non-BibleGateway versions
 * 'NET' - Net Bible

Eg.:  John 1:1 

Link Target Window
The Bible page by default will open in a new window. If you would rather it opened in the same window add the flag 'thiswindow'.

Eg.:  2 Cor 4 

Credits
Created by Matt Dolan - http://mgdproductions.co.uk

Example
See an example of this add-on in action at: Cubic Path Wiki (run by the author of the AIM extension)