BibleRef: Difference between revisions

From Meta, a Wikimedia project coordination wiki
Content deleted Content added
Category:Parser_extensions
m Reverted changes by 71.7.229.59 (talk) to last version by Jack Phoenix
 
(13 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{MovedToMediaWiki|Extension:BibleRef}}
{{MoveToMediaWiki}}
This extension allows you to easily link Bible references to the Bible text at BibleGateway.com.


Imported with full page histories. --[[User:Roosa|<b>Roosa</b>]] <sub>([[User talk:Roosa|<font color="hotpink">Talk</font>]]) </sub> 19:23, 25 June 2007 (UTC)

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

Copy the following code into '''extensions/BibleRef.php''' :

<pre>
<?php
# Bible References
# Version: 1.0
#
# Links a Bible reference to the text at Biblegateway.com
#
# You can take advantage of BibleGateway's features such as displaying two references together:
# eg. Matt 28:18-20,2Cor 4
#
# Tag :
# <bible>ref</bible>
# Example :
# Col 1:15-20
# <bible>Col 1:15-20</bible>
#
# 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');
}

# The callback function for converting the input text to HTML output
function linkBibleRef($input, $args) {

// 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
);
$versionText = strtolower($args['ver']); // get the desired version from the XML tag
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;
else // if none if given, default to TNIV
$version = 72;
$output = "<a href='http://www.biblegateway.com/passage/?search=".urlencode($input).";&version=".$version.";'";
// if 'thisframe' is not specified in the XML tag, load it in a new window
if (!isset($args['thiswindow']))
$output .= " target='_blank'";
$output .= ">".$input."</a>";
return $output;
}
?>
</pre>


==Usage==
Example: <tt><nowiki><bible>Col 1:15-20</bible></nowiki></tt>

=== Bible Version ===
The default Bible version is the TNIV (Today's New International 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

Eg.: <tt><nowiki><bible ver="esv">John 1:1</bible></nowiki></tt>

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

Eg.: <tt><nowiki><bible thiswindow>2 Cor 4</bible></nowiki></tt>


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


[[Category:MediaWiki extensions]]
[[Category:Parser_extensions]]

Latest revision as of 21:24, 11 October 2013

Imported with full page histories. --Roosa (Talk) 19:23, 25 June 2007 (UTC)[reply]