Template:BiblePassage

Da Cathopedia, l'enciclopedia cattolica.
Vai alla navigazione Vai alla ricerca

///////////////////////////// // BiblePassage.Services.php ///////////////////////////// $wgBiblePassageServiceList = array(

   'laparola.net' => array(
       'url' => 'http://www.laparola.net/testo.php?riferimento=$1&versioni%5B%5D=C.E.I.&utf8=1',
       'numeration' => 'L',
   ),
   'bibbia.net' => array(
       //'url' => 'http://www.lachiesa.it/bibbia.php?ricerca=citazione&Citazione=$1&Cerca=Cerca&Versione_CEI2008=3&Versione_CEI74=1&Versione_TILC=2&VersettoOn=1',
       'url' => 'http://www.lachiesa.it/bibbia.php?ricerca=citazione&Cerca=Cerca&Versione_CEI2008=3&VersettoOn=1&Citazione=$1',
       'numeration' => 'E',
   ),
   'qumran2.net' => array(
       'url' => 'http://bibbia.qumran2.net/index.php?CiteButton=Estrai&Cite=$1',
       'numeration' => 'E',
       'onmouseover' => 'var t=prepara_popup(\'$1\');nhpup.popup(t,{\'width\': w});',
   ),

);


///////////////////////////// // BiblePassage.php ///////////////////////////// $BPLang = $prefix; if ($BPLang == 'www' || $BPLang == 'commons') $BPLang = 'en'; //print_r($BPBooks); if (array_key_exists($BPLang, $BPBooks)) $arrayBooks = $BPBooks[$BPLang];


///////////////////////////// // BiblePassage.i18n.php ///////////////////////////// $messages = array(); $messages['en'] = array(

   'bp-missing-params' => 'BiblePassage is missing one or more required parameters.',
   'bp-bad-params' => 'BiblePassage received a bad parameter.',
   //'bp-unparsable-param-string' => 'BiblePassage received the unparsable parameter string "$1".',
   'bp-unrecognized-service' => 'BiblePassage does not recognize the biblical text service "$1".',
   'bp-bad-cite' => 'BiblePassage received a bad cite: "$1".',
   'bp-bad-book-name' => 'BiblePassage received a bad book name: "$1"',
   'bp-parenthesis-open' => '(',
   'bp-parenthesis-close' => ')',

);

$messages['it'] = array(

   'bp-missing-params' => 'BiblePassage non ha ricevuto uno o più parametri richiesti.',
   'bp-bad-params' => 'BiblePassage ha ricevuto un parametro sbagliati.',
   //'bp-unparsable-param-string' => 'BiblePassage ha ricevuto una stringa strana: "$1".',
   'bp-unrecognized-service' => 'BiblePassage non riconosce il servizio biblico "$1".',
   'bp-bad-cite' => 'BiblePassage ha ricevuto una citazione sbagliata: "$1".',
   'bp-bad-book-name' => 'BiblePassage ha ricevuto un libro biblico sbagliato: "$1"',
   'bp-parenthesis-open' => '[',
   'bp-parenthesis-close' => ']',

);

///////////////////////////// // BiblePassage.hooks.php ///////////////////////////// function parserFunction_biblepassage($parser, $Service = null, $Cite = null, $text = null) { global $wgScriptPath, $wgOut, $entry; global $arrayBooks;

# Initialize things once if (!$initialized) { # Add system messages //wfLoadExtensionMessages doesn't exist any more in 1.21 //wfLoadExtensionMessages('BiblePassage'); // $parser->disableCache(); $initialized = true; }

# Check for null mandatory parameters if ($Service === null || $Cite === null) return errMissingParams($Service, $Cite);

$Service = trim($Service); $Cite = NormalizeCharacters(strtolower($Cite)); $Cite = CompressChaptersVersicles(strtolower($Cite)); $text = trim($text);

# Get the name of the host $entry = getServiceEntry($Service); if (!$entry) return errBadService($Service);

# The cite must be specified and must be a valid one $Validation = ValidateCite($Cite); if (IsError($Validation)) return $Validation; //var_dump($BoolOneLink);

if ($text) { $ArrayOutput = GenerateHtml($Cite, $entry, $text, true); $url = wfMsgReplaceArgs($entry['url'], array($ArrayOutput['url']));


$Book_ChaptersVersicles = SplitBookChaptersVersicles($Cite); $Book = $Book_ChaptersVersicles[0]; $ChaptersVersicles = $Book_ChaptersVersicles[1];

$NormalizedBook = NormalizeBook($Book); $NormalizedBookForUrl = urlencode("$NormalizedBook "); //$NormalizedBookForUrl = urlencode($AbbreviatedBook); if (substr($NormalizedBook, 0, 5) == $arrayBooks['normalized-psalms-book-name']) { $NormalizedBookForUrl = urlencode($arrayBooks['normalized-psalms-book-name'] . ' '); $SimplifiedChaptersVersicles = ConvertDots2Semicolon($ChaptersVersicles); $TransformedChaptersVersiclesForUrl = TransformPsalmCiteForUrl($NormalizedBook, $SimplifiedChaptersVersicles); } else { $SimplifiedChaptersVersicles = $ChaptersVersicles; $TransformedChaptersVersiclesForUrl = $ChaptersVersicles; }

$NormalizedChaptersVersiclesForUrl = NormalizeCite($TransformedChaptersVersiclesForUrl, true); $CiteForUrl = $NormalizedBookForUrl . // '+' . TransformCiteForUrl($NormalizedChaptersVersiclesForUrl);



$onmouseover = wfMsgReplaceArgs($entry['onmouseover'], array($CiteForUrl)); if ($text == '#onelink#') $TextToShow = $ArrayOutput['text']; else $TextToShow = $text; $Output = '<a onmouseover="' . $onmouseover . '" href="' . $url . '" target=_blank>' . $TextToShow . '</a>'; } else { // Let's build the final URL // the last parameter is $BoolFirstCall $Output = GenerateHtml($Cite, $entry, $text, true); } // maybe one day are we going to output wiki code instead of html? // nowadays the folloing line is for text purpose only if (IsError($Output)) return $Output;

//$WikiOutput = GenerateWikiCode($Cite, $entry, $text, true); // the following is the way to output wiki code (http://www.mediawiki.org/wiki/Manual:Tag_extensions#Version_1.8_to_version_1.15) // but it doesn't work! //return $WikiOutput; //return array( $WikiOutput, 'noparse' => false );

//return $parser->insertStripItem( $Output . " <a href='http://bibbia.qumran2.net/index.php?CiteButton=Estrai&Versions[]=bible_it_cei2008&Cite=Salmi+12,2.4-5;113,5'>versetti</a>", $parser->mStripState ); return $parser->insertStripItem( $Output, $parser->mStripState ); //return $parser->insertStripItem( $WikiOutput, $parser->mStripState ); //return $parser->recursiveTagParse( $Output ); //return $parser->recursiveTagParse( $WikiOutput );

}

  1. ==================================================================
  2. True is argument is an error messagge

function IsError($String) { //debug_print_backtrace(); if (strpos($String, DivError()) === 0) return true; else return false; }

  1. ==================================================================
  2. True is argument is an error messagge

function DivError() {

return '

';

}

  1. ==================================================================
  2. Get the first part of a chapters and versicles set

function FirstChaptersVersiclesBlock($ChaptersVersicles) { global $arrayBooks;

// Let's look for the position where another book part of the cite begins $ChaptersVersiclesNorm = strtr($ChaptersVersicles, 'bcdefghijklmnopqrstuvwxyz', 'aaaaaaaaaaaaaaaaaaaaaaaaa'); $FirstLetterPosition = strpos($ChaptersVersiclesNorm, 'a'); do { if ($FirstLetterPosition !== false) { if (// it's another book name only if before the letter it there is a semicolon // or a semicolon followed by a number < 3 (e.g. "2Cor") ($FirstLetterPosition > 0 && substr($ChaptersVersicles, $FirstLetterPosition - 1, 1) == $arrayBooks['semicolon'] || $FirstLetterPosition > 1 && in_array(substr($ChaptersVersicles, $FirstLetterPosition - 2, 2), array($arrayBooks['semicolon'] . '1', $arrayBooks['semicolon'] . '2', $arrayBooks['semicolon'] . '3') ) ) ) { if (in_array(substr($ChaptersVersicles, $FirstLetterPosition - 2, 2), array($arrayBooks['semicolon'] . '1', $arrayBooks['semicolon'] . '2', $arrayBooks['semicolon'] . '3') ) ) $FirstLetterPosition -= 1; // let's separate here, stripping the final semicolon $FirstBlock = substr($ChaptersVersicles, 0, $FirstLetterPosition - 1); return $FirstBlock; } else { // it wasn't a book name, look for it further $FirstLetterPosition = strpos($ChaptersVersiclesNorm, 'a', $FirstLetterPosition + 1 ); } } } while ($FirstLetterPosition !== false);

// we arrive here if it's a one-book cite return $ChaptersVersicles; }

  1. ==================================================================
  2. Recursively called function to generate the output

function GenerateHtml($Cite, $entry, $text = , $BoolFirstCall = false) { global $arrayBooks; //var_dump($text); $Book_ChaptersVersicles = SplitBookChaptersVersicles($Cite); $Book = $Book_ChaptersVersicles[0]; $NormalizedBook = NormalizeBook($Book); $AbbreviatedBook = AbbreviatedBook($NormalizedBook); $ChaptersVersicles = $Book_ChaptersVersicles[1]; // We have to separate the versicles belonging to the already separated book // from the remaining part which have another book name $FirstChaptersVersiclesBlock = FirstChaptersVersiclesBlock($ChaptersVersicles); $RemainingBlocks = substr($ChaptersVersicles, strlen($FirstChaptersVersiclesBlock) + 1);

if ($FirstChaptersVersiclesBlock == $ChaptersVersicles) { //echo $text; // Another book name hasn't been found // We have a one-book cite $NormalizedBookForUrl = urlencode("$NormalizedBook "); //$NormalizedBookForUrl = urlencode($AbbreviatedBook); if (substr($NormalizedBook, 0, 5) == $arrayBooks['normalized-psalms-book-name']) { $NormalizedBookForUrl = urlencode($arrayBooks['normalized-psalms-book-name'] . ' '); $SimplifiedChaptersVersicles = ConvertDots2Semicolon($ChaptersVersicles); $TransformedChaptersVersiclesForUrl = TransformPsalmCiteForUrl($NormalizedBook, $SimplifiedChaptersVersicles); } else { $SimplifiedChaptersVersicles = $ChaptersVersicles; $TransformedChaptersVersiclesForUrl = $ChaptersVersicles; }

$NormalizedChaptersVersiclesForUrl = NormalizeCite($TransformedChaptersVersiclesForUrl, true); $CiteForUrl = $NormalizedBookForUrl . // '+' . TransformCiteForUrl($NormalizedChaptersVersiclesForUrl); //$CiteForUrl = $NormalizedBookForUrl . '+' . $NormalizedChaptersVersiclesForUrl;

if ($text && $text != '#onelink#') { $BookForText = ; $CiteForText = ; } else { if (substr($NormalizedBook, 0, 5) == $arrayBooks['normalized-psalms-book-name']) { $TransformedChaptersVersiclesForText = TransformPsalmCiteForText($NormalizedBook, $SimplifiedChaptersVersicles); $NormalizedChaptersVersiclesForText = NormalizeCite($TransformedChaptersVersiclesForText, false); } else $NormalizedChaptersVersiclesForText = $SimplifiedChaptersVersicles;

$CiteForText = TransformCiteForText($NormalizedChaptersVersiclesForText); if (! $BoolFirstCall && ! $text) { $BookForText = '' . '<a class=BiblePassage href="/wiki/' . BookArticleName($NormalizedBook) . '">' . AbbreviatedBook($NormalizedBook) . '</a>' . ' '; } elseif ($text == '#onelink#') { $BookForText = '' . AbbreviatedBook($NormalizedBook) . ' '; } else $BookForText = ; } //$Output .= "<a href='" . rawurlencode($url) . "' target=_blank>$ShowWithChapterVersicles</a>"; if ($text) { $ArrayOutput = array ('url' => $CiteForUrl, 'text' => $BookForText . $CiteForText); return $ArrayOutput; } else { $url = wfMsgReplaceArgs($entry['url'], array($CiteForUrl)); $onmouseover = wfMsgReplaceArgs($entry['onmouseover'], array($CiteForUrl)); $Output = $BookForText . '<a onmouseover="' . $onmouseover . '" href="' . $url . '" target=_blank>' . $CiteForText . '</a>'; return $Output; }

//return array( $Output, "markerType" => 'nowiki' ); } else { $FirstBlock = $Book . $FirstChaptersVersiclesBlock; // We are going to call recursively ourselves if ($text) { $ArrayFirstBlockHtml = GenerateHtml($FirstBlock, $entry, $text); if (IsError($ArrayFirstBlockHtml)) return $FirstBlockHtml;

$ArrayRemainingBlocksHtml = GenerateHtml($RemainingBlocks, $entry, $text); if (IsError($ArrayRemainingBlocksHtml)) return $RemainingBlocksHtml;

$ArrayResult = array('url' => $ArrayFirstBlockHtml['url' ] . $arrayBooks['semicolon'] . $ArrayRemainingBlocksHtml['url' ], 'text' => $ArrayFirstBlockHtml['text'] . $arrayBooks['semicolon'] . ' ' . $ArrayRemainingBlocksHtml['text']); return $ArrayResult; } else { $FirstBlockHtml = GenerateHtml($FirstBlock, $entry, $text); if (IsError($FirstBlockHtml)) return $FirstBlockHtml;

$RemainingBlocksHtml = GenerateHtml($RemainingBlocks, $entry, $text); if (IsError($RemainingBlocksHtml)) return $RemainingBlocksHtml;

$Result = $FirstBlockHtml . $arrayBooks['semicolon'] . ' ' . $RemainingBlocksHtml;

return $Result; } }

}


  1. ==================================================================
  2. Recursively called function to generate the output

function GenerateWikiCode($Cite, $entry, $text = , $BoolFirstCall = false) { global $arrayBooks;

$Book_ChaptersVersicles = SplitBookChaptersVersicles($Cite); $Book = $Book_ChaptersVersicles[0]; $NormalizedBook = NormalizeBook($Book); $AbbreviatedBook = AbbreviatedBook($NormalizedBook); $ChaptersVersicles = $Book_ChaptersVersicles[1]; // We have to separate the versicles belonging to the already separated book // from the remaining part which have another book name $FirstChaptersVersiclesBlock = FirstChaptersVersiclesBlock($ChaptersVersicles); $RemainingBlocks = substr($ChaptersVersicles, strlen($FirstChaptersVersiclesBlock) + 1);

if ($FirstChaptersVersiclesBlock == $ChaptersVersicles) { // Another book name hasn't been found // We have a one-book cite //$NormalizedBookForUrl = urlencode($AbbreviatedBook); $NormalizedBookForUrl = urlencode($NormalizedBook); if (substr($NormalizedBook, 0, 5) == $arrayBooks['normalized-psalms-book-name']) { $NormalizedBookForUrl = urlencode($arrayBooks['normalized-psalms-book-name']); $SimplifiedChaptersVersicles = ConvertDots2Semicolon($ChaptersVersicles); $TransformedChaptersVersiclesForUrl = TransformPsalmCiteForUrl($NormalizedBook, $SimplifiedChaptersVersicles); } else { $SimplifiedChaptersVersicles = $ChaptersVersicles; $TransformedChaptersVersiclesForUrl = $ChaptersVersicles; }

$NormalizedChaptersVersiclesForUrl = NormalizeCite($TransformedChaptersVersiclesForUrl, true); $CiteForUrl = $NormalizedBookForUrl . '+' . TransformCiteForUrl($NormalizedChaptersVersiclesForUrl); //$CiteForUrl = $NormalizedBookForUrl . '+' . $NormalizedChaptersVersiclesForUrl; $url = wfMsgReplaceArgs($entry['url'], array($CiteForUrl)); if ($text) { $ShowWithChapterVersicles = $text; $WikiOutput = ; } else { if (substr($NormalizedBook, 0, 5) == $arrayBooks['normalized-psalms-book-name']) { $TransformedChaptersVersiclesForText = TransformPsalmCiteForText($NormalizedBook, $SimplifiedChaptersVersicles); $NormalizedChaptersVersiclesForText = NormalizeCite($TransformedChaptersVersiclesForText, false); } else $NormalizedChaptersVersiclesForText = $SimplifiedChaptersVersicles;

$CiteForText = TransformCiteForText($NormalizedChaptersVersiclesForText); $ShowWithChapterVersicles = $CiteForText; if (! $BoolFirstCall) { $WikiOutput = "[[" . BookArticleName($NormalizedBook) . '|' . AbbreviatedBook($NormalizedBook) . "]] "; } else $WikiOutput = ; } $WikiOutput .= '[' . $url . ' ' . htmlentities($ShowWithChapterVersicles) . ']';

return $WikiOutput; } else { $FirstBlock = $Book . $FirstChaptersVersiclesBlock; // We are going to call recursively ourselves $FirstBlockWiki = GenerateWikiCode($FirstBlock, $entry); if (IsError($FirstBlockWiki)) return $FirstBlockWiki;

$RemainingBlocksWiki = GenerateWikiCode($RemainingBlocks, $entry); if (IsError($RemainingBlocksWiki)) return $RemainingBlocksWiki;

$Result = $FirstBlockWiki . $arrayBooks['semicolon'] . ' ' . $RemainingBlocksWiki;

return $Result; }

}

  1. ==================================================================
  2. Normalizes some characters:
  3. - em dash -> dash

private static function NormalizeCharacters($Cite) { $Cite = mb_str_replace('–', '-', $Cite);

return $Cite; }

  1. ==================================================================
  2. cuts away all spaces from argument

private static function CompressChaptersVersicles($Cite) { $Cite = str_replace(' ', , $Cite); $Cite = str_replace("\t", , $Cite); $Cite = str_replace("\n", , $Cite); $Cite = str_replace("\r", , $Cite); $Cite = str_replace("\0", , $Cite); $Cite = str_replace("\x0B", , $Cite);

//$Cite = str_replace("

", , $Cite); //$Cite = str_replace("

", , $Cite);

//$Cite = implode(, preg_split('[:space:]', $Cite)); return $Cite; }

  1. ==================================================================
  2. Simplifies a cite so that it hasn't any dot, but only commas, dashes and semicolons:
  3. "5,7-8.10;3" => "5,7-8;5,10;3"
  4. "5,7-8.10-6,2.7-11" => "5,7-8;5,10-6,2;6,7-11"

private static function ConvertDots2Semicolon ($ChaptersVersicles) { global $arrayBooks;

if ($ChaptersVersicles == ) return ;

// Are there semicolons? $SemicolonPosition = strpos($ChaptersVersicles, $arrayBooks['semicolon']); if ($SemicolonPosition === false) { $Block = $ChaptersVersicles; $Remaining = ; } else { // Let's extract the block before the semicolons $Block = substr($ChaptersVersicles, 0, $SemicolonPosition); $Remaining = $arrayBooks['semicolon'] . ConvertDots2Semicolon(substr($ChaptersVersicles, $SemicolonPosition + 1)); }

$TypeOfChaptersVersicles = TypeOfChaptersVersicles($Block);

if ($TypeOfChaptersVersicles == 'Chapter' || $TypeOfChaptersVersicles == 'Chapters' || $TypeOfChaptersVersicles == 'ChapterVersicle' || $TypeOfChaptersVersicles == 'ChapterVersiclesInterval' || $TypeOfChaptersVersicles == 'ChaptersVersicles2' ) { //Nothing significant to do $Result = $Block . $Remaining; return $Result; } elseif ($TypeOfChaptersVersicles == 'ChapterVersicles') { // We must separate the versicles along the dots and convert the dots into semicolons $Chapter = substr($Block, 0, strpos($Block, $arrayBooks['comma'])); $Versicles = substr($Block, strpos($Block, $arrayBooks['comma']) + 1);

$FirstVersicles = substr($Versicles, 0, strpos($Versicles, $arrayBooks['dot'])); $RemainingVersicles = substr($Versicles, strpos($Versicles, $arrayBooks['dot']) + 1);

$Result = $Chapter . $arrayBooks['comma'] . $FirstVersicles . $arrayBooks['semicolon'] . ConvertDots2Semicolon ($Chapter . $arrayBooks['comma'] . $RemainingVersicles) . $Remaining; return $Result; } elseif ($TypeOfChaptersVersicles == 'ChaptersVersicles') { // We are going to operate on the dash-separated "chapter,versicles" sub-blocks $PositionOfTheSecondComma = strpos($Block, $arrayBooks['comma'], strpos($Block, $arrayBooks['comma']) + 1); $BeforeTheSecondComma = substr($Block, 0, $PositionOfTheSecondComma); $FromTheSecondCommaOn = substr($Block, $PositionOfTheSecondComma); $ChaptersSeparatorPosition = strrpos($BeforeTheSecondComma, $arrayBooks['dash']); $FirstPart = substr($BeforeTheSecondComma, 0, $ChaptersSeparatorPosition); $RemainingPart = substr($BeforeTheSecondComma, $ChaptersSeparatorPosition + 1) . $FromTheSecondCommaOn;

$Result = ConvertDots2Semicolon ($FirstPart) . $arrayBooks['dash'] . ConvertDots2Semicolon ($RemainingPart) . $Remaining; return $Result; } }

  1. ==================================================================
  2. Transform the Cite into the form allowed in the link

private static function TransformPsalmCiteForUrl($NormalizedBook, $ChaptersVersicles) { global $arrayBooks;

if (substr($NormalizedBook, 0, 5) == $arrayBooks['normalized-psalms-book-name']) { $TransformedChaptersVersicles = // the last parameter is $BoolForUrl TransformChaptersVersiclesOfPsalm ($ChaptersVersicles, substr($NormalizedBook, 5, 1), true); $CiteUrl = $TransformedChaptersVersicles; } else $CiteUrl = $ChaptersVersicles; return $CiteUrl; }

  1. ==================================================================
  2. Transform the Cite into the form allowed in the link

private static function TransformCiteForUrl($Cite) { //$CiteUrl = str_replace (' ', '+', $Cite); //$Cite = urlencode($Cite); return $Cite; }

  1. ==================================================================
  2. Transform the Cite into the form allowed in the link

private static function TransformPsalmCiteForText($NormalizedBook, $ChaptersVersicles) { global $arrayBooks;

if (substr($NormalizedBook, 0, 5) == $arrayBooks['normalized-psalms-book-name']) { $TransformedChaptersVersicles = // the last parameter is $BoolForUrl TransformChaptersVersiclesOfPsalm ($ChaptersVersicles, substr($NormalizedBook, 5, 1), false); $CiteText = $TransformedChaptersVersicles; } else $CiteText = $ChaptersVersicles; return $CiteText; }

  1. ==================================================================
  2. Transform the Cite into the form allowed in the link

private static function TransformCiteForText($CiteText) { global $arrayBooks;

$CiteText = str_replace ($arrayBooks['semicolon'], $arrayBooks['semicolon'] . ' ', $CiteText) ; $CiteText = str_replace (wfMessage('bp-parenthesis-open')->text(), '' . wfMessage('bp-parenthesis-open')->text(), $CiteText) ; $CiteText = str_replace (wfMessage('bp-parenthesis-close')->text(), wfMessage('bp-parenthesis-close')->text() . '', $CiteText) ; return $CiteText; }

  1. ==================================================================
  2. Removes parenthesis with there inner content from argument

private static function RemoveParenthesis($ChaptersVersicles) { if (strpos ($ChaptersVersicles, wfMessage('bp-parenthesis-open')->text()) === false) return $ChaptersVersicles; else { return substr($ChaptersVersicles, 0, strpos ($ChaptersVersicles, wfMessage('bp-parenthesis-open')->text())) . RemoveParenthesis(substr($ChaptersVersicles, strpos ($ChaptersVersicles, wfMessage('bp-parenthesis-close')->text()) + 1)); } }

  1. ==================================================================
  2. Riceives a cite withous semicolon and returns the corresonding type:
  3. NULL =>
  4. chapter only => 'Chapter'
  5. chapter-chapter => 'Chapters'
  6. chapter,versicle => 'ChapterVersicle'
  7. chapter,versicle-versicle => 'ChapterVersiclesInterval'
  8. chapter,versicles.versicle-versicle. .. => 'ChapterVersicles'
  9. chapter,versicle-chapter,versicle => 'ChaptersVersicles2'
  10. chapter1,versicles1-chapter2,versicles2-.. => 'ChaptersVersicles'

private static function TypeOfChaptersVersicles($ChaptersVersicles) { global $arrayBooks;

// if we are working on text, parenthesis could be present: // let's remove them with their content //~ if (strpos ($ChaptersVersicles, wfMessage('bp-parenthesis-open')->text()) !== false) if (strpos ($ChaptersVersicles, wfMessage( 'bp-parenthesis-open' )->text()) !== false) $ChaptersVersicles = RemoveParenthesis($ChaptersVersicles);

if (strpos($ChaptersVersicles, $arrayBooks['comma']) !== false && strrpos($ChaptersVersicles, $arrayBooks['comma']) !== false && strpos($ChaptersVersicles, $arrayBooks['comma']) !== strrpos($ChaptersVersicles, $arrayBooks['comma']) && strpos($ChaptersVersicles, $arrayBooks['dot']) !== false ) // at least 2 commas with complex versicles return 'ChaptersVersicles'; elseif (strpos($ChaptersVersicles, $arrayBooks['comma']) !== false && strrpos($ChaptersVersicles, $arrayBooks['comma']) !== false && strpos($ChaptersVersicles, $arrayBooks['comma']) !== strrpos($ChaptersVersicles, $arrayBooks['comma']) && strpos($ChaptersVersicles, $arrayBooks['dot']) === false ) // 2 commas with simple versicles return 'ChaptersVersicles2'; elseif (strpos($ChaptersVersicles, $arrayBooks['comma']) !== false && strpos($ChaptersVersicles, $arrayBooks['dot']) !== false ) // 1 comma with complex versicles return 'ChapterVersicles'; elseif (strpos($ChaptersVersicles, $arrayBooks['comma']) !== false && strpos($ChaptersVersicles, $arrayBooks['dot']) === false && strpos($ChaptersVersicles, $arrayBooks['dash']) !== false ) // 1 comma with versicles interval return 'ChapterVersiclesInterval'; elseif (strpos($ChaptersVersicles, $arrayBooks['comma']) !== false && strpos($ChaptersVersicles, $arrayBooks['dot']) === false && strpos($ChaptersVersicles, $arrayBooks['dash']) === false ) // 1 comma with simple versicle return 'ChapterVersicle'; elseif (strpos($ChaptersVersicles, $arrayBooks['comma']) === false && strpos($ChaptersVersicles, $arrayBooks['dash']) !== FALSE ) // Chapters separated by dash return 'Chapters'; elseif ($ChaptersVersicles !== ) return 'Chapter'; else return ; }


  1. ==================================================================
  2. Normalies a cite without dots where elements separated by semicolon could refer to the same chapter
  3. Where it happens, it removes the second chapter and substitutes the semicolon with a dot:
  4. e.g.: "3,5;3,7" => "3,5.7"
  5. chapter-block could be these ways:
  6. chapter only => 'Chapter'
  7. chapter-chapter => 'Chapters'
  8. chapter,versicle => 'ChapterVersicle'
  9. chapter,versicle-versicle => 'ChapterVersiclesInterval'
  10. chapter,versicle-chapter,versicle => 'ChaptersVersicles2'

private static function NormalizeCite ($ChaptersVersicles, $BoolForUrl) { global $arrayBooks;

//if ($ChaptersVersicles == ) return $Book;

// Are there semicolons? (we are going to manage things from end to beginning) $LastSemicolonPosition = strrpos($ChaptersVersicles, $arrayBooks['semicolon']); if ($LastSemicolonPosition === false) { $TypeOfChaptersVersicles = TypeOfChaptersVersicles($ChaptersVersicles); if ( $TypeOfChaptersVersicles == 'ChaptersVersicles2') { // 1,2-3,5: We must simplify it $FirstChapter = substr($ChaptersVersicles, 0, strpos($ChaptersVersicles, $arrayBooks['comma'])); $SecondChapter = substr($ChaptersVersicles, strpos($ChaptersVersicles, $arrayBooks['dash']) + 1, strrpos($ChaptersVersicles, $arrayBooks['comma']) - strpos($ChaptersVersicles, $arrayBooks['dash']) - 1); if ($FirstChapter == $SecondChapter) { $Begin = substr($ChaptersVersicles, 0, strpos($ChaptersVersicles, $arrayBooks['dash'])); $SecondVersicle = substr($ChaptersVersicles, strrpos($ChaptersVersicles, $arrayBooks['comma']) + 1); return $Begin . $arrayBooks['dash'] . $SecondVersicle; } else return $ChaptersVersicles; } else return $ChaptersVersicles; } else { // Let's compare the last block after the last semicolons with the previous $LastBlock = substr($ChaptersVersicles, $LastSemicolonPosition + 1); $LastBlock = NormalizeCite($LastBlock, $BoolForUrl); $PreviousBlocks = substr($ChaptersVersicles, 0, $LastSemicolonPosition);

$PreviousSemicolonPosition = strrpos($PreviousBlocks, $arrayBooks['semicolon']); if ($PreviousSemicolonPosition === false) $PreviousBlock = $PreviousBlocks; else $PreviousBlock = substr($PreviousBlocks, $PreviousSemicolonPosition + 1);

$TypeOfLastBlock = TypeOfChaptersVersicles($LastBlock); $TypeOfPreviousBlock = TypeOfChaptersVersicles($PreviousBlock); }

if ($TypeOfLastBlock == 'Chapter' || $TypeOfLastBlock == 'Chapters' || $TypeOfPreviousBlock == 'Chapter' || $TypeOfPreviousBlock == 'Chapters') { // No normalization needed for the pair, only for the blocks return NormalizeCite($PreviousBlocks, $BoolForUrl) . $arrayBooks['semicolon'] . NormalizeCite($LastBlock, $BoolForUrl); } else { // We have to normalize $Chapter = substr($LastBlock, 0, strpos($LastBlock, $arrayBooks['comma'])); if ($TypeOfPreviousBlock == 'ChapterVersicle' || $TypeOfPreviousBlock == 'ChapterVersiclesInterval') { $PreviousChapter = substr($PreviousBlock, 0, strpos($PreviousBlock, $arrayBooks['comma']));

} elseif ($TypeOfPreviousBlock == 'ChaptersVersicles2') { $PreviousChapter = substr($PreviousBlock, strpos($PreviousBlock, $arrayBooks['dash']) + 1, strrpos($PreviousBlock, $arrayBooks['comma']) - strpos($PreviousBlock, $arrayBooks['dash']) - 1); } else $PreviousChapter = ;

if ($Chapter == $PreviousChapter) { $LastBlock = NormalizeCite($LastBlock, $BoolForUrl); $Remaining = substr($LastBlock, strpos($LastBlock, $arrayBooks['comma']) + 1); return NormalizeCite($PreviousBlocks, $BoolForUrl) . $arrayBooks['dot'] . $Remaining; } else { return NormalizeCite($PreviousBlocks, $BoolForUrl) . $arrayBooks['semicolon'] . $LastBlock; } } }

  1. ==================================================================
  2. Works on general Psalms cites, transforming the cite according to NumerationType
  3. Splits cite so that there isn't any ";" inside it and passes it to the function that manage that

private static function TransformChaptersVersiclesOfPsalm ($ChaptersVersicles, $NumerationType, $BoolForUrl) { global $arrayBooks;

if ($ChaptersVersicles == ) return ;

// Are there semicolons? $SemicolonPosition = strpos($ChaptersVersicles, $arrayBooks['semicolon']); if ($SemicolonPosition !== false) { // Let's extract the block before the semicolons $Block = substr($ChaptersVersicles, 0, $SemicolonPosition); $Remaining = $arrayBooks['semicolon'] . TransformChaptersVersiclesOfPsalm(substr($ChaptersVersicles, $SemicolonPosition + 1), $NumerationType, $BoolForUrl); } else { $Block = $ChaptersVersicles; $Remaining = ; }

$TransformedBlock = TransformChapterVersiclesOfPsalm($Block, $NumerationType, $BoolForUrl);

return $TransformedBlock . $Remaining; }

  1. ==================================================================
  2. Works on one Psalm number transforming it according to NumerationType for use in url or in text
  3. Cathopedia shows psalms with double numeration as "PsalmEbraic(PsalmLiturgical)"

private static function TransformChapterOfPsalm ($Psalm, $NumerationType, $BoolForUrl) { global $arrayBooks, $entry;

if (!is_numeric($Psalm)) { $PsalmNorm = strtr($Psalm, 'bcdefghijklmnopqrstuvwxyz', 'aaaaaaaaaaaaaaaaaaaaaaaaa'); $FirstLetterPosition = strpos ($PsalmNorm, 'a'); $PsalmNumeric = substr($Psalm, 0, $FirstLetterPosition); $PsalmLetters = substr($Psalm, $FirstLetterPosition); } else { $PsalmNumeric = $Psalm; $PsalmLetters = ; }

if ($PsalmNumeric <= 8 || $PsalmNumeric >= 148) return $Psalm;

if (!$NumerationType) $NumerationType = $arrayBooks['ebraic-psalm-numeration-letter'];

if ($BoolForUrl) { if ($NumerationType == $entry['numeration']) { // cite and service use the same numeration // apparently it works (???????????????) with 113A/B, 9A/B return $Psalm; } elseif ($NumerationType == $arrayBooks['liturgical-psalm-numeration-letter']) { // cite uses liturgical (LXX) numeration and service use ebraic one if ($PsalmNumeric >= 10 && $PsalmNumeric <= 112 || $PsalmNumeric >= 116 && $PsalmNumeric <= 145) return ($PsalmNumeric + 1) . $PsalmLetters; else switch ($Psalm) { case '9' : return '9' . $arrayBooks['dash'] . '10'; case '9a': return '9'; case '9b': return '10'; case '113' : return '114' . $arrayBooks['dash'] . '115'; case '113a': return '114'; case '113b': return '115'; case '114' : return '116' . $arrayBooks['comma'] . '1' . $arrayBooks['dash'] . '9'; case '115' : return '116' . $arrayBooks['comma'] . '10' . $arrayBooks['dash'] . '19'; case '146' : return '147' . $arrayBooks['comma'] . '1' . $arrayBooks['dash'] . '11'; case '147' : return '147' . $arrayBooks['comma'] . '12' . $arrayBooks['dash'] . '20'; } } else { // cite uses ebraic numeration and service uses liturgical (LXX) one if ($PsalmNumeric >= 11 && $PsalmNumeric <= 113 || $PsalmNumeric >= 117 && $PsalmNumeric <= 146) return ($PsalmNumeric - 1) . $PsalmLetters ; else switch ($Psalm) { case '9': return '9' . $arrayBooks['comma'] . '1' . $arrayBooks['dash'] . '21'; case '10': return '9' . $arrayBooks['comma'] . '22' . $arrayBooks['dash'] . '39'; case '114': return '113' . $arrayBooks['comma'] . '1' . $arrayBooks['dash'] . '8'; case '115': return '113' . $arrayBooks['comma'] . '9' . $arrayBooks['dash'] . '26'; case '116': return '114' . $arrayBooks['dash'] . '115'; case '147': return '146' . $arrayBooks['dash'] . '147'; } } } else { if ($NumerationType == $arrayBooks['liturgical-psalm-numeration-letter']) { // cite uses liturgical (LXX) numeration if ($PsalmNumeric >= 10 && $PsalmNumeric <= 112 || $PsalmNumeric >= 116 && $PsalmNumeric <= 145) return ($Psalm + 1) . $PsalmLetters. wfMessage('bp-parenthesis-open')->text() . $Psalm . wfMessage('bp-parenthesis-close')->text(); else switch ($Psalm) { case '9' : return '9' . $arrayBooks['dash'] . '10' . wfMessage('bp-parenthesis-open')->text() . '9' . wfMessage('bp-parenthesis-close')->text(); case '9a': return '9' . wfMessage('bp-parenthesis-open')->text() . '9A' . wfMessage('bp-parenthesis-close')->text(); case '9b': return '10' . wfMessage('bp-parenthesis-open')->text() . '9B' . wfMessage('bp-parenthesis-close')->text(); case '113' : return '114' . $arrayBooks['dash'] . '115' . wfMessage('bp-parenthesis-open')->text() . '113' . wfMessage('bp-parenthesis-close')->text(); case '113a': return '114' . wfMessage('bp-parenthesis-open')->text() . '113A' . wfMessage('bp-parenthesis-close')->text(); case '113b': return '115' . wfMessage('bp-parenthesis-open')->text() . '113B' . wfMessage('bp-parenthesis-close')->text(); case '114' : return '116' . wfMessage('bp-parenthesis-open')->text() . '114' . wfMessage('bp-parenthesis-close')->text(); //,1-9'; case '115' : return '116' . $arrayBooks['comma'] . '10' . $arrayBooks['dash'] . '19' . wfMessage('bp-parenthesis-open')->text() . '115' . wfMessage('bp-parenthesis-close')->text(); case '146' : return '147' . wfMessage('bp-parenthesis-open')->text() . '146' . wfMessage('bp-parenthesis-close')->text(); //,1-11'; case '147' : return '147' . $arrayBooks['comma'] . '12' . $arrayBooks['dash'] . '20' . wfMessage('bp-parenthesis-open')->text() . '147' . wfMessage('bp-parenthesis-close')->text(); } } else { // cite uses ebraic numeration if ($PsalmNumeric >= 11 && $PsalmNumeric <= 113 || $PsalmNumeric >= 117 && $PsalmNumeric <= 146) return $Psalm . wfMessage('bp-parenthesis-open')->text() . ($Psalm - 1) . $PsalmLetters . wfMessage('bp-parenthesis-close')->text(); else switch ($Psalm) { case '9': return '9' . $arrayBooks['comma'] . '1' . $arrayBooks['dash'] . '21'; case '10': return '10' . wfMessage('bp-parenthesis-open')->text() . '9' . $arrayBooks['comma'] . '22' . $arrayBooks['dash'] . '39' . wfMessage('bp-parenthesis-close')->text(); case '114': return '114' . wfMessage('bp-parenthesis-open')->text() . '113' . $arrayBooks['comma'] . '1' . $arrayBooks['dash'] . '8' . wfMessage('bp-parenthesis-close')->text(); case '115': return '115' . wfMessage('bp-parenthesis-open')->text() . '113' . $arrayBooks['comma'] . '9' . $arrayBooks['dash'] . '26' . wfMessage('bp-parenthesis-close')->text(); case '116': return '116' . wfMessage('bp-parenthesis-open')->text() . '114' . $arrayBooks['dash'] . '115' . wfMessage('bp-parenthesis-close')->text(); case '147': return '147' . wfMessage('bp-parenthesis-open')->text() . '146' . $arrayBooks['dash'] . '147' . wfMessage('bp-parenthesis-close')->text(); } } } }


  1. ==================================================================
  2. Works on a psalm,versicle cite, e.g. 53,5, transforming it according to NumerationType
  3. It knows how to manage notations like "Sal 3,4a" too

private static function TransformChapterVersicleOfPsalm ($ChapterVersicle, $NumerationType, $BoolForUrl) { global $arrayBooks, $entry;

$Psalm = substr($ChapterVersicle, 0, strpos($ChapterVersicle, $arrayBooks['comma'])); $Versicle = substr($ChapterVersicle, strpos($ChapterVersicle, $arrayBooks['comma']) + 1); if (!is_numeric($Versicle)) { $VersicleNorm = strtr($Versicle, 'bcdefghijklmnopqrstuvwxyz', 'aaaaaaaaaaaaaaaaaaaaaaaaa'); $FirstLetterPosition = strpos ($VersicleNorm, 'a'); $VersicleNumeric = substr($Versicle, 0, $FirstLetterPosition); $VersicleLetters = substr($Versicle, $FirstLetterPosition); } else { $VersicleNumeric = $Versicle; $VersicleLetters = ; }

if (!is_numeric($Psalm)) { $PsalmNorm = strtr($Psalm, 'bcdefghijklmnopqrstuvwxyz', 'aaaaaaaaaaaaaaaaaaaaaaaaa'); $FirstLetterPosition = strpos ($PsalmNorm, 'a'); $PsalmNumeric = substr($Psalm, 0, $FirstLetterPosition); $PsalmLetters = substr($Psalm, $FirstLetterPosition); } else { $PsalmNumeric = $Psalm; $PsalmLetters = ; }

if ($PsalmNumeric <= 8 || $PsalmNumeric >= 148) return $ChapterVersicle;

if (!$NumerationType) $NumerationType = $arrayBooks['ebraic-psalm-numeration-letter'];

if ($BoolForUrl) { if ($NumerationType == $entry['numeration'] ) { // cite and service use the same numeration return $ChapterVersicle; } elseif ($NumerationType == $arrayBooks['liturgical-psalm-numeration-letter']) { // cite uses liturgical (LXX) numeration and service use ebraic one if ($PsalmNumeric >= 10 && $PsalmNumeric <= 112 || $PsalmNumeric >= 116 && $PsalmNumeric <= 145) return ($PsalmNumeric + 1) . $PsalmLetters . $arrayBooks['comma'] . $Versicle; else switch ($Psalm) { case '9' : if ($VersicleNumeric <= 21) return $ChapterVersicle; else return '10' . $arrayBooks['comma'] . ($VersicleNumeric - 21) . $VersicleLetters; case '9a': return '9' . $arrayBooks['comma'] . $Versicle; case '9b': return '10' . $arrayBooks['comma'] . $Versicle; case '113' : if ($VersicleNumeric <= 8) return '114' . $arrayBooks['comma'] . $Versicle; else return '115' . $arrayBooks['comma'] . ($VersicleNumeric - 8) . $VersicleLetters; case '113a': return '114' . $arrayBooks['comma'] . $Versicle; case '113b': return '115' . $arrayBooks['comma'] . $Versicle; case '114' : return '116' . $arrayBooks['comma'] . $Versicle; case '115' : return '116' . $arrayBooks['comma'] . ($VersicleNumeric + 9) . $VersicleLetters; case '146' : return '147' . $arrayBooks['comma'] . $Versicle; case '147' : return '147' . $arrayBooks['comma'] . ($VersicleNumeric + 11) . $VersicleLetters; } } else { // cite uses ebraic numeration and service uses liturgical (LXX) one if ($PsalmNumeric >= 11 && $PsalmNumeric <= 113 || $PsalmNumeric >= 117 && $PsalmNumeric <= 146) return ($PsalmNumeric - 1) . $PsalmLetters . $arrayBooks['comma'] . $Versicle; else switch ($Psalm) { case '9': return '9' . $arrayBooks['comma'] . $Versicle; case '10': return '9' . $arrayBooks['comma'] . ($VersicleNumeric + 21) . $VersicleLetters; case '114': return '113' . $arrayBooks['comma'] . $Versicle; case '115': return '113' . $arrayBooks['comma'] . ($VersicleNumeric + 8) . $VersicleLetters; case '116': if ($VersicleNumeric <= 9) return '114' . $arrayBooks['comma'] . $Versicle; else return '115' . $arrayBooks['comma'] . ($VersicleNumeric - 9) . $VersicleLetters; case '147': if ($VersicleNumeric <= 11) return '146' . $arrayBooks['comma'] . $Versicle; else return '147' . $arrayBooks['comma'] . ($VersicleNumeric - 11) . $VersicleLetters; } } } else // we aren't getting the url { if ($NumerationType == $arrayBooks['liturgical-psalm-numeration-letter']) { // cite uses liturgical (LXX) numeration if ($PsalmNumeric >= 10 && $PsalmNumeric <= 112 || $PsalmNumeric >= 116 && $PsalmNumeric <= 145) return ($PsalmNumeric + 1) . $PsalmLetters . wfMessage('bp-parenthesis-open')->text() . $Psalm . wfMessage('bp-parenthesis-close')->text() . $arrayBooks['comma'] . $Versicle; else switch ($Psalm) { case '9' : if ($VersicleNumeric <= 21) return $ChapterVersicle; else return '10' . $arrayBooks['comma'] . ($VersicleNumeric - 21) . $VersicleLetters . wfMessage('bp-parenthesis-open')->text() . '9' . $arrayBooks['comma'] . $Versicle . wfMessage('bp-parenthesis-close')->text() ; case '9a': return '9' . wfMessage('bp-parenthesis-open')->text() . '9A' . wfMessage('bp-parenthesis-close')->text() . $arrayBooks['comma'] . $Versicle ; case '9b': return '10' . wfMessage('bp-parenthesis-open')->text() . '9B' . wfMessage('bp-parenthesis-close')->text() . $arrayBooks['comma'] . $Versicle ; case '113' : if ($VersicleNumeric <= 8) return '114' . $arrayBooks['comma'] . $Versicle; else return '115' . $arrayBooks['comma'] . ($VersicleNumeric - 8) . $VersicleLetters . wfMessage('bp-parenthesis-open')->text() . '113' . $arrayBooks['comma'] . $Versicle . wfMessage('bp-parenthesis-close')->text() ; case '113a': return '114' . wfMessage('bp-parenthesis-open')->text() . '113A' . wfMessage('bp-parenthesis-close')->text() . $arrayBooks['comma'] . $Versicle ; case '113b': return '115' . wfMessage('bp-parenthesis-open')->text() . '113B' . wfMessage('bp-parenthesis-close')->text() . $arrayBooks['comma'] . $Versicle ; case '114' : return '116' . wfMessage('bp-parenthesis-open')->text() . '114' . wfMessage('bp-parenthesis-close')->text() . $arrayBooks['comma'] . $Versicle; case '115' : return '116' . $arrayBooks['comma'] . ($VersicleNumeric + 9) . $VersicleLetters . wfMessage('bp-parenthesis-open')->text() . '115' . $arrayBooks['comma'] . $Versicle . wfMessage('bp-parenthesis-close')->text() ; case '146' : return '147' . wfMessage('bp-parenthesis-open')->text() . '146' . wfMessage('bp-parenthesis-close')->text() . $arrayBooks['comma'] . $Versicle; case '147' : return '147' . $arrayBooks['comma'] . ($VersicleNumeric + 11) . $VersicleLetters . wfMessage('bp-parenthesis-open')->text() . '147' . $arrayBooks['comma'] . $Versicle . wfMessage('bp-parenthesis-close')->text() ; } } else { // cite uses ebraic numeration if ($PsalmNumeric >= 11 && $PsalmNumeric <= 113 || $PsalmNumeric >= 117 && $PsalmNumeric <= 146) return $Psalm . wfMessage('bp-parenthesis-open')->text() . ($PsalmNumeric - 1) . $PsalmLetters . wfMessage('bp-parenthesis-close')->text() . $arrayBooks['comma'] . $Versicle; else switch ($Psalm) { case '9': return '9' . $arrayBooks['comma'] . $Versicle; case '10': return '10' . $arrayBooks['comma'] . $Versicle . wfMessage('bp-parenthesis-open')->text() . '9' . $arrayBooks['comma'] . ($VersicleNumeric + 21) . $VersicleLetters . wfMessage('bp-parenthesis-close')->text(); case '114': return '114' . wfMessage('bp-parenthesis-open')->text() . '113' . wfMessage('bp-parenthesis-close')->text() . $arrayBooks['comma'] . $Versicle; case '115': return '115' . $arrayBooks['comma'] . $Versicle . wfMessage('bp-parenthesis-open')->text() . '113' . $arrayBooks['comma'] . ($VersicleNumeric + 8) . $VersicleLetters . wfMessage('bp-parenthesis-close')->text(); case '116': if ($VersicleNumeric <= 9) return '116' . wfMessage('bp-parenthesis-open')->text() . '114' . wfMessage('bp-parenthesis-close')->text() . $arrayBooks['comma'] . $Versicle; else return '116' . $arrayBooks['comma'] . $Versicle . wfMessage('bp-parenthesis-open')->text() . '115' . $arrayBooks['comma'] . ($VersicleNumeric - 9) . $VersicleLetters . wfMessage('bp-parenthesis-close')->text(); case '147': if ($VersicleNumeric <= 11) return '147' . wfMessage('bp-parenthesis-open')->text() . '146' . wfMessage('bp-parenthesis-close')->text() . $arrayBooks['comma'] . $Versicle; else return '147' . $arrayBooks['comma'] . $Versicle . wfMessage('bp-parenthesis-open')->text() . '147' . $arrayBooks['comma'] . ($VersicleNumeric - 11) . $VersicleLetters . wfMessage('bp-parenthesis-close')->text(); } } } }


  1. ==================================================================
  2. Works on Psalms cite without any ";", transforming the cite according to NumerationType

private static function TransformChapterVersiclesOfPsalm ($ChapterVersicles, $NumerationType, $BoolForUrl) { global $arrayBooks;

$TypeOfChaptersVersicles = TypeOfChaptersVersicles($ChapterVersicles);

if ($TypeOfChaptersVersicles == 'Chapter') { $Result = TransformChapterOfPsalm($ChapterVersicles, $NumerationType, $BoolForUrl); return $Result; } elseif ($TypeOfChaptersVersicles == 'Chapters') { $Psalm1 = substr($ChapterVersicles, 0, strpos($ChapterVersicles, $arrayBooks['dash'])); $Psalm2 = substr($ChapterVersicles, strpos($ChapterVersicles, $arrayBooks['dash']) + 1); $TransformedPsalm1 = TransformChapterOfPsalm($Psalm1, $NumerationType, $BoolForUrl); // let's consider the case that the transformation brings to a "couple" of psalms ("114-115") // or to a part of a psalm ("116,1-9") if (strpos($TransformedPsalm1, $arrayBooks['dash']) !== FALSE && $BoolForUrl) { // we are going to take only the part before the dash $TransformedPsalm1 = substr($TransformedPsalm1, 0, strpos($TransformedPsalm1, $arrayBooks['dash'])); } $TransformedPsalm2 = TransformChapterOfPsalm($Psalm2, $NumerationType, $BoolForUrl); // let's consider the case that the transformation brings to a "couple" of psalms ("114-115") // or to a part of a psalm ("116,1-9") if (strpos($TransformedPsalm2, $arrayBooks['dash']) !== FALSE && $BoolForUrl) { // we are going either // 1st case: to take only the second psalm // 2nd case: to remove the first versicle if (strpos($TransformedPsalm2, $arrayBooks['comma']) === FALSE) { // 1st case $TransformedPsalm2 = substr($TransformedPsalm2, strrpos($TransformedPsalm2, $arrayBooks['dash']) + 1); } else { // 2nd case $TransformedPsalm2 = substr($TransformedPsalm2, 0, strpos($TransformedPsalm2, $arrayBooks['comma']) + 1) . substr($TransformedPsalm2, strrpos($TransformedPsalm2, $arrayBooks['dash']) + 1); } } if (strpos($TransformedPsalm1, $arrayBooks['comma']) xor strpos($TransformedPsalm2, $arrayBooks['comma'])) { if (strpos($TransformedPsalm1, $arrayBooks['comma']) === FALSE) $TransformedPsalm1 .= $arrayBooks['comma'] . '1'; else $TransformedPsalm2 .= $arrayBooks['comma'] . FinalVersicleOfPsalm($TransformedPsalm2); } $Result = $TransformedPsalm1 . $arrayBooks['dash'] . $TransformedPsalm2; return $Result; } elseif ($TypeOfChaptersVersicles == 'ChapterVersicle') { $Result = TransformChapterVersicleOfPsalm($ChapterVersicles, $NumerationType, $BoolForUrl); return $Result; } elseif ($TypeOfChaptersVersicles == 'ChapterVersiclesInterval') { $Chapter = substr($ChapterVersicles, 0, strpos($ChapterVersicles, $arrayBooks['comma'])); $Versicles = substr($ChapterVersicles, strpos($ChapterVersicles, $arrayBooks['comma']) + 1); $Versicle1 = substr($Versicles, 0, strpos($Versicles, $arrayBooks['dash'])); $Versicle2 = substr($Versicles, strpos($Versicles, $arrayBooks['dash']) + 1); $TransformedChapterVersicle1 = TransformChapterVersicleOfPsalm($Chapter . $arrayBooks['comma'] . $Versicle1, $NumerationType, $BoolForUrl); $Chapter1 = substr($TransformedChapterVersicle1, 0, strpos($TransformedChapterVersicle1, $arrayBooks['comma'])); $TransformedChapterVersicle2 = TransformChapterVersicleOfPsalm($Chapter . $arrayBooks['comma'] . $Versicle2, $NumerationType, $BoolForUrl); $Chapter2 = substr($TransformedChapterVersicle2, 0, strpos($TransformedChapterVersicle2, $arrayBooks['comma'])); /* // if the chapter is the same the expression may be simplified: "5,6-5,7" => "5,6-7" if ($Chapter1 == $Chapter2) $TransformedChapterVersicle2 = substr($TransformedChapterVersicle2, strpos($TransformedChapterVersicle2, $arrayBooks['comma']) + 1);

  • /

return $TransformedChapterVersicle1 . $arrayBooks['dash'] . $TransformedChapterVersicle2; } elseif ($TypeOfChaptersVersicles == 'ChapterVersicles') { $Chapter = substr($ChapterVersicles, 0, strpos($ChapterVersicles, $arrayBooks['comma'])); $Versicles = substr($ChapterVersicles, strpos($ChapterVersicles, $arrayBooks['comma']) + 1); // we must split the versicles according to the dot $Result = TransformChapterVersiclesOfPsalm($Chapter . $arrayBooks['comma'] . substr($Versicles, 0, strpos($Versicles, $arrayBooks['dot'])), $NumerationType, $BoolForUrl) . $arrayBooks['semicolon'] . TransformChapterVersiclesOfPsalm($Chapter . $arrayBooks['comma'] . substr($Versicles, strpos($Versicles, $arrayBooks['dot']) + 1), $NumerationType, $BoolForUrl); return $Result;

} elseif ($TypeOfChaptersVersicles == 'ChaptersVersicles2' || $TypeOfChaptersVersicles == 'ChaptersVersicles') { $PositionOfTheSecondComma = strpos($ChapterVersicles, $arrayBooks['comma'], strpos($ChapterVersicles, $arrayBooks['comma']) + 1); $BeforeTheSecondComma = substr($ChapterVersicles, 0, $PositionOfTheSecondComma); $FromTheSecondCommaOn = substr($ChapterVersicles, $PositionOfTheSecondComma); $ChaptersSeparatorPosition = strrpos($BeforeTheSecondComma, $arrayBooks['dash']); $FirstPart = substr($BeforeTheSecondComma, 0, $ChaptersSeparatorPosition); $RemainingPart = substr($BeforeTheSecondComma, $ChaptersSeparatorPosition + 1) . $FromTheSecondCommaOn;

$Result = TransformChapterVersicleOfPsalm ($FirstPart, $NumerationType, $BoolForUrl) . $arrayBooks['dash'] . TransformChapterVersicleOfPsalm ($RemainingPart, $NumerationType, $BoolForUrl); return $Result; } }

  1. ==================================================================
  2. add proper spaces to cite

private static function AddSpacesToChaptersVersicles($Cite) { global $arrayBooks;

return str_replace($arrayBooks['semicolon'], $arrayBooks['semicolon'] . ' ', $Cite); }

  1. ==================================================================
  2. returns only the book name part of the cite

private static function SplitBookChaptersVersicles($Cite) { //$Cite = str_replace(' ', , $Cite); $BookFirstCharacter = substr($Cite, 0, 1); $Other = trim(substr($Cite, 1));

// The book name or abbreviation could be something link "1 Cor", // in order to know where the chapter begins I'm going to look for // the first numeric character $NormalizedOther = strtr($Other, '123456789', '000000000'); $ChapterBeginning = strpos($NormalizedOther, '0'); if ($ChapterBeginning === false) { // We have only a book without chapter and versicles $Book = $BookFirstCharacter . $Other; $ChaptersVersicles = ; } else { // We have to complete the book name $Book = $BookFirstCharacter . substr($Other, 0, $ChapterBeginning); $ChaptersVersicles = substr($Other, $ChapterBeginning); }

return array($Book, $ChaptersVersicles); }

  1. ==================================================================
  2. Get the entry for the specified service, by name

private static function getServiceEntry($Service) { # Get the entry in the list of services global $wgBiblePassageServiceList; return $wgBiblePassageServiceList[$Service]; }

  1. ==================================================================
  2. Validate a chapters and versicles part of a bible cite

private static function ValidateChaptersVersicles($NormalizedBook, $ChaptersVersicles) { global $arrayBooks;

$Dot = $arrayBooks['dot']; if (in_array($Dot, array('.', '-' ))) $Dot = '\\' . $Dot; $Dash = $arrayBooks['dash']; //if (in_array($Dash, array('.', '-' ))) $Dash = '\\' . $Dash;

$Chapter = '[1-9][0-9]{0,2}'; if ($NormalizedBook == $arrayBooks['normalized-psalms-book-name-l']) $Chapter = "($Chapter|9a|9b|113a|113b)"; $ChaptersInterval = $Chapter . $Dash . $Chapter; $Versicle = '[1-9][0-9]{0,2}[a-z]*'; $VersiclesInterval = $Versicle . $Dash . $Versicle; $VersicleToChapterVersicleInterval = $Versicle . $Dash . $Chapter . $arrayBooks['comma'] . $Versicle; $Versicles = "($Versicle|$VersiclesInterval|$VersicleToChapterVersicleInterval)"; $Versicles = $Versicles . '(' . $Dot . $Versicles . ')*'; $ChapterVersicles = "($Chapter|$ChaptersInterval|$Chapter" . $arrayBooks['comma'] . "$Versicles)"; $GeneralPattern = "/^$ChapterVersicles(" . $arrayBooks['semicolon'] . "$ChapterVersicles)*$/"; if (preg_match($GeneralPattern, $ChaptersVersicles)) return true; else return errBadCite($NormalizedBook . ' ' . $ChaptersVersicles); }


  1. ==================================================================
  2. validates a biblical cite made by books, chapters and versicles

private static function ValidateCite($Cite) { $Book_ChaptersVersicles = SplitBookChaptersVersicles($Cite); $Book = $Book_ChaptersVersicles[0]; $NormalizedBook = NormalizeBook($Book); if(IsError($NormalizedBook)) return $NormalizedBook;

$ChaptersVersicles = $Book_ChaptersVersicles[1]; $FirstChaptersVersiclesBlock = FirstChaptersVersiclesBlock($ChaptersVersicles); $Validation = ValidateChaptersVersicles($NormalizedBook, $FirstChaptersVersiclesBlock); if (IsError($Validation)) return $Validation;

$RemaingBlocks = substr($ChaptersVersicles, strlen($FirstChaptersVersiclesBlock) + 1); if ($RemaingBlocks != ) return ValidateCite($RemaingBlocks); else return true; }

  1. ==================================================================
  2. Get an error message for the case where the Cite is bad

private static function errBadCite($Cite) { $CiteHtml = htmlspecialchars($Cite); $msg = wfMsgForContent('bp-bad-cite', @htmlspecialchars($CiteHtml), @htmlspecialchars($Service));

return DivError() . $msg . '

';

}


  1. ==================================================================
  2. Get an error message for the case where the Book name is bad

private static function errBadBook($Book) { $Bookhtml = htmlspecialchars($Book); $msg = wfMsgForContent('bp-bad-book-name', $Bookhtml);

return DivError() . $msg . '';

}


  1. ==================================================================
  2. Get an error message if there are missing parameters

private static function errMissingParams($Service, $Cite) { return DivError() . wfMsg('bp-missing-params', @htmlspecialchars($Service), @htmlspecialchars($Cite)

) . '';

}

  1. ==================================================================
  2. Get an error message if the service name is bad

private static function errBadService($Service) { $msg = wfMsg('bp-unrecognized-service', @htmlspecialchars($Service));

return DivError() . $msg . '';

}

  1. ==================================================================
  2. Abbreviates the standard book name

function AbbreviatedBook($NormalizedBook) { global $arrayBooks;

foreach ( $arrayBooks['books'] as $arrayBook ) { if ( $NormalizedBook == $arrayBook['StandardName'] ) return $arrayBook['StandardAbbr']; }

return  ; }

  1. ==================================================================
  2. Returns the name of the wiki article about the book name

function BookArticleName($NormalizedBook) { global $arrayBooks;

foreach ( $arrayBooks['books'] as $arrayBook ) { if ( $NormalizedBook == $arrayBook['StandardName'] ) return $arrayBook['WikiName']; }

return  ; }


  1. ==================================================================
  2. Normalize the bible book name
  3. the argument is lowercase and without spaces

function NormalizeBook($Book) { global $arrayBooks; foreach ( $arrayBooks['books'] as $Name => $arrayBook )

{//if ($lowercasename=='salmi')return DivError() . print_r($arrayBook) . '';

//print_r($arrayBook['Abbr']);//if ( is_string($arrayBook['Abbr'])) $arrayBook['Abbr'] = array ($arrayBook['Abbr']);

foreach ( $arrayBook['Abbr'] as $Abbr ) { if ( $Book == $Abbr ) return $arrayBook['StandardName']; } }

$msg = wfMessage('bp-bad-book-name', $Book, @htmlspecialchars($Service))->inContentLanguage()->text(); return DivError() . $msg . //wfMsg( 'bp-books-names' ) .

'';

}


///////////////////////////// // BiblePassage.Books.i18n.php /////////////////////////////

$BPBooks = array();

$BPBooks['en'] = array(

        // the first values are for interpreting the cites
       'ebraic-psalm-numeration-letter' => 'E',
       'liturgical-psalm-numeration-letter' => 'L',
       'normalized-psalms-book-name' => 'Psalms',
       'normalized-psalms-book-name-e' => 'PsalmsE',
       'normalized-psalms-book-name-l' => 'PsalmsL',
       'semicolon' => ';', // separates between non-adjacent chapters
       'comma' => ':', // separates between chapter and versicles
       'dot' => ',', // separates between non-adjacent versicles
       'dash' => '-', // chapters or versicles interval

);

$BPBooks['it'] = array(

       // the first values are for interpreting the cites
       'ebraic-psalm-numeration-letter' => 'E',
       'liturgical-psalm-numeration-letter' => 'L',
       'normalized-psalms-book-name' => 'Salmi',
       'normalized-psalms-book-name-e' => 'SalmiE',
       'normalized-psalms-book-name-l' => 'SalmiL',
       'semicolon' => ';',
       'comma' => ',',
       'dot' => '.',
       'dash' => '-',
       'books' => array (
          'genesi'          => array ('StandardName' => 'Genesi',
                                     'StandardAbbr' => 'Gn',
                                     'WikiName'     => 'Libro_della_Genesi',
                                     'LongName'     => 'Libro della Genesi',
                                     'Abbr'          => array ('gn', 'gen', 'ge', 'genesi'),
                                    ),
          'esodo'           => array ('StandardName' => 'Esodo',
                                     'StandardAbbr' => 'Es',
                                     'WikiName'     => 'Libro_dell\'Esodo',
                                     'LongName'     => 'Libro dell\'Esodo',
                                     'Abbr'          => array ('es', 'eso', 'esod', 'ex', 'esodo'),
                                    ),
          'levitico'        => array ('StandardName' => 'Levitico',
                                     'StandardAbbr' => 'Lv',
                                     'WikiName'     => 'Levitico',
                                     'LongName'     => 'Levitico',
                                     'Abbr'          => array ('lv', 'le', 'lev', 'levi', 'levit', 'levitico'),
                                    ),
          'numeri'          => array ('StandardName' => 'Numeri',
                                     'StandardAbbr' => 'Nm',
                                     'WikiName'     => 'Numeri',
                                     'LongName'     => 'Numeri',
                                     'Abbr'          => array ('nm', 'nu', 'num', 'numeri'),
                                    ),
          'deuteronomio'    => array ('StandardName' => 'Deuteronomio',
                                     'StandardAbbr' => 'Dt',
                                     'WikiName'     => 'Deuteronomio',
                                     'LongName'     => 'Deuteronomio',
                                     'Abbr'          => array ('dt', 'de', 'deu', 'deut', 'deuteronomio'),
                                    ),
          'giosuè'          => array ('StandardName' => 'Giosuè',
                                     'StandardAbbr' => 'Gs',
                                     'WikiName'     => 'Libro_di_Giosuè',
                                     'LongName'     => 'Libro di Giosuè',
                                     'Abbr'          => array ('gs', 'gios', 'giosuè'),
                                    ),
          'giudici'         => array ('StandardName' => 'Giudici',
                                     'StandardAbbr' => 'Gdc',
                                     'WikiName'     => 'Libro_dei_Giudici',
                                     'LongName'     => 'Libro dei Giudici',
                                     'Abbr'          => array ('gdc', 'giudic', 'giudici'),
                                    ),
          '1samuele'        => array ('StandardName' => '1Samuele',
                                     'StandardAbbr' => '1Sam',
                                     'WikiName'     => 'Primo_libro_di_Samuele',
                                     'LongName'     => 'Primo libro di Samuele',
                                     'Abbr'          => array ('1s', '1sa', '1sam', '1sm', '1samuele'),
                                    ),
          '2samuele'        => array ('StandardName' => '2Samuele',
                                     'StandardAbbr' => '2Sam',
                                     'WikiName'     => 'Secondo_libro_di_Samuele',
                                     'LongName'     => 'Secondo libro di Samuele',
                                     'Abbr'          => array ('2s', '2sa', '2sam', '2sm', '2samuele'),
                                    ),
          '1re'             => array ('StandardName' => '1Re',
                                     'StandardAbbr' => '1Re',
                                     'WikiName'     => 'Primo_libro_dei_Re',
                                     'LongName'     => 'Primo libro dei Re',
                                     'Abbr'          => array ('1re', '1r'),
                                    ),
          '2re'             => array ('StandardName' => '2Re',
                                     'StandardAbbr' => '2Re',
                                     'WikiName'     => 'Secondo_libro_dei_Re',
                                     'LongName'     => 'Secondo libro dei Re',
                                     'Abbr'          => array ('2re', '2r'),
                                    ),
          'isaia'           => array ('StandardName' => 'Isaia',
                                     'StandardAbbr' => 'Is',
                                     'WikiName'     => 'Libro_di_Isaia',
                                     'LongName'     => 'Libro di Isaia',
                                     'Abbr'          => array ('is', 'isa', 'isaia'),
                                    ),
          'geremia'         => array ('StandardName' => 'Geremia',
                                     'StandardAbbr' => 'Gr',
                                     'WikiName'     => 'Libro_di_Geremia',
                                     'LongName'     => 'Libro di Geremia',
                                     'Abbr'          => array ('ger', 'gr', 'geremia'),
                                    ),
          'ezechiele'       => array ('StandardName' => 'Ezechiele',
                                     'StandardAbbr' => 'Ez',
                                     'WikiName'     => 'Libro_di_Ezechiele',
                                     'LongName'     => 'Libro di Ezechiele',
                                     'Abbr'          => array ('ez', 'eze', 'ezec', 'ezechiele'),
                                    ),
          'osea'            => array ('StandardName' => 'Osea',
                                     'StandardAbbr' => 'Os',
                                     'WikiName'     => 'Libro_di_Osea',
                                     'LongName'     => 'Libro di Osea',
                                     'Abbr'          => array ('os', 'osea'),
                                    ),
          'gioele'          => array ('StandardName' => 'Gioele',
                                     'StandardAbbr' => 'Gl',
                                     'WikiName'     => 'Libro_di_Gioele',
                                     'LongName'     => 'Libro di Gioele',
                                     'Abbr'          => array ('gl', 'gioe', 'gioel', 'gioele'),
                                    ),
          'amos'            => array ('StandardName' => 'Amos',
                                     'StandardAbbr' => 'Am',
                                     'WikiName'     => 'Libro_di_Amos',
                                     'LongName'     => 'Libro di Amos',
                                     'Abbr'          => array ('am', 'amos'),
                                    ),
          'abdia'           => array ('StandardName' => 'Abdia',
                                     'StandardAbbr' => 'Abd',
                                     'WikiName'     => 'Libro_di_Abdia',
                                     'LongName'     => 'Libro di Abdia',
                                     'Abbr'          => array ('abd', 'abdia'),
                                    ),
          'giona'           => array ('StandardName' => 'Giona',
                                     'StandardAbbr' => 'Gion',
                                     'WikiName'     => 'Libro_di_Giona',
                                     'LongName'     => 'Libro di Giona',
                                     'Abbr'          => array ('gio', 'gion', 'giona'),
                                    ),
          'michea'          => array ('StandardName' => 'Michea',
                                     'StandardAbbr' => 'Mi',
                                     'WikiName'     => 'Libro_di_Michea',
                                     'LongName'     => 'Libro di Michea',
                                     'Abbr'          => array ('mi', 'mic', 'mich', 'michea'),
                                    ),
          'naum'            => array ('StandardName' => 'Naum',
                                     'StandardAbbr' => 'Na',
                                     'WikiName'     => 'Libro_di_Naum',
                                     'LongName'     => 'Libro di Naum',
                                     'Abbr'          => array ('na', 'nau', 'naum'),
                                    ),
          'abacuc'          => array ('StandardName' => 'Abacuc',
                                     'StandardAbbr' => 'Ab',
                                     'WikiName'     => 'Libro_di_Abacuc',
                                     'LongName'     => 'Libro di Abacuc',
                                     'Abbr'          => array ('ab', 'aba', 'abacuc'),
                                    ),
          'sofonia'         => array ('StandardName' => 'Sofonia',
                                     'StandardAbbr' => 'Sof',
                                     'WikiName'     => 'Libro_di_Sofonia',
                                     'LongName'     => 'Libro di Sofonia',
                                     'Abbr'          => array ('so', 'sof', 'sf', 'sofonia'),
                                    ),
          'aggeo'           => array ('StandardName' => 'Aggeo',
                                     'StandardAbbr' => 'Ag',
                                     'WikiName'     => 'Libro_di_Aggeo',
                                     'LongName'     => 'Libro di Aggeo',
                                     'Abbr'          => array ('ag', 'agg', 'aggeo'),
                                    ),
          'zaccaria'        => array ('StandardName' => 'Zaccaria',
                                     'StandardAbbr' => 'Zac',
                                     'WikiName'     => 'Libro_di_Zaccaria',
                                     'LongName'     => 'Libro di Zaccaria',
                                     'Abbr'          => array ('za', 'zac', 'zc', 'zaccaria'),
                                    ),
          'malachia'        => array ('StandardName' => 'Malachia',
                                     'StandardAbbr' => 'Mal',
                                     'WikiName'     => 'Libro_di_Malachia',
                                     'LongName'     => 'Libro di Malachia',
                                     'Abbr'          => array ('mal', 'ml', 'malachia'),
                                    ),
          'salmi'           => array ('StandardName' => 'Salmi',
                                     'StandardAbbr' => 'Sal',
                                     'WikiName'     => 'Libro_dei_Salmi',
                                     'LongName'     => 'Libro dei Salmi',
                                     'Abbr'          => array ('sl', 'sal', 'salmo', 'salmi'),
                                    ),
          'salmie'          => array ('StandardName' => 'SalmiE',
                                     'StandardAbbr' => 'Sal',
                                     'WikiName'     => 'Libro_dei_Salmi',
                                     'LongName'     => 'Libro dei Salmi',
                                     'Abbr'          => array ('sle', 'sale', 'salmoe', 'salmie'),
                                    ),
          'salmil'          => array ('StandardName' => 'SalmiL',
                                     'StandardAbbr' => 'Sal',
                                     'WikiName'     => 'Libro_dei_Salmi',
                                     'LongName'     => 'Libro dei Salmi',
                                     'Abbr'          => array ('sll', 'sall', 'salmol', 'salmil'),
                                    ),
          'proverbi'        => array ('StandardName' => 'Proverbi',
                                     'StandardAbbr' => 'Pr',
                                     'WikiName'     => 'Libro_dei_Proverbi',
                                     'LongName'     => 'Libro dei Proverbi',
                                     'Abbr'          => array ('pr', 'prov', 'prv', 'proverbi'),
                                    ),
          'giobbe'          => array ('StandardName' => 'Giobbe',
                                     'StandardAbbr' => 'Gb',
                                     'WikiName'     => 'Libro_di_Giobbe',
                                     'LongName'     => 'Libro di Giobbe',
                                     'Abbr'          => array ('gb', 'giob', 'giobbe'),
                                    ),
          'cantico'         => array ('StandardName' => 'Cantico',
                                     'StandardAbbr' => 'Ct',
                                     'WikiName'     => 'Cantico_dei_Cantici',
                                     'LongName'     => 'Cantico dei Cantici',
                                     'Abbr'          => array ('ct', 'cant', 'cantico'),
                                    ),
          'rut'             => array ('StandardName' => 'Rut',
                                     'StandardAbbr' => 'Rut',
                                     'WikiName'     => 'Libro_di_Rut',
                                     'LongName'     => 'Libro di Rut',
                                     'Abbr'          => array ('rt', 'rut'),
                                    ),
          'lamentazioni'    => array ('StandardName' => 'Lamentazioni',
                                     'StandardAbbr' => 'Lam',
                                     'WikiName'     => 'Libro_delle_Lamentazioni',
                                     'LongName'     => 'Libro delle Lamentazioni',
                                     'Abbr'          => array ('lam', 'lm', 'lament', 'lamentazioni'),
                                    ),
          'qoelet'          => array ('StandardName' => 'Qoelet',
                                     'StandardAbbr' => 'Qo',
                                     'WikiName'     => 'Qoelet',
                                     'LongName'     => 'Qoelet',
                                     'Abbr'          => array ('qo', 'qoe', 'qoel', 'qoelet', 'qohelet', 'eccle', 'ecclesiaste'),
                                    ),
          'ester'           => array ('StandardName' => 'Ester',
                                     'StandardAbbr' => 'Est',
                                     'WikiName'     => 'Libro_di_Ester',
                                     'LongName'     => 'Libro di Ester',
                                     'Abbr'          => array ('est', 'ester'),
                                    ),
          'daniele'         => array ('StandardName' => 'Daniele',
                                     'StandardAbbr' => 'Dn',
                                     'WikiName'     => 'Libro_di_Daniele',
                                     'LongName'     => 'Libro di Daniele',
                                     'Abbr'          => array ('dn', 'dan', 'daniele'),
                                    ),
          'esdra'           => array ('StandardName' => 'Esdra',
                                     'StandardAbbr' => 'Esd',
                                     'WikiName'     => 'Libro_di_Esdra',
                                     'LongName'     => 'Libro di Esdra',
                                     'Abbr'          => array ('esd', 'esdra', 'esdr'),
                                    ),
          'neemia'          => array ('StandardName' => 'Neemia',
                                     'StandardAbbr' => 'Nee',
                                     'WikiName'     => 'Libro_di_Neemia',
                                     'LongName'     => 'Libro di Neemia',
                                     'Abbr'          => array ('ne', 'nee', 'neemia'),
                                    ),
          '1cronache'       => array ('StandardName' => '1Cronache',
                                     'StandardAbbr' => '1Cr',
                                     'WikiName'     => 'Primo_libro_delle_Cronache',
                                     'LongName'     => 'Primo libro delle Cronache',
                                     'Abbr'          => array ('1c', '1cr', '1cro', '1cron', '1cronache'),
                                    ),
          '2cronache'       => array ('StandardName' => '2Cronache',
                                     'StandardAbbr' => '2Cr',
                                     'WikiName'     => 'Secondo_libro_delle_Cronache',
                                     'LongName'     => 'Secondo libro delle Cronache',
                                     'Abbr'          => array ('2c', '2cr', '2cro', '2cron', '2cronache'),
                                    ),
          'tobia'           => array ('StandardName' => 'Tobia',
                                     'StandardAbbr' => 'Tb',
                                     'WikiName'     => 'Libro_di_Tobia',
                                     'LongName'     => 'Libro di Tobia',
                                     'Abbr'          => array ('tb', 'tob', 'tobia'),
                                    ),
          'giuditta'        => array ('StandardName' => 'Giuditta',
                                     'StandardAbbr' => 'Gdt',
                                     'WikiName'     => 'Libro_di_Giuditta',
                                     'LongName'     => 'Libro di Giuditta',
                                     'Abbr'          => array ('gdt', 'giudit', 'giuditta'),
                                    ),
          '1maccabei'       => array ('StandardName' => '1Maccabei',
                                     'StandardAbbr' => '1Mac',
                                     'WikiName'     => 'Primo_libro_dei_Maccabei',
                                     'LongName'     => 'Primo libro dei Maccabei',
                                     'Abbr'          => array ('1mac', '1macc', '1mc', '1maccabei'),
                                    ),
          '2maccabei'       => array ('StandardName' => '2Maccabei',
                                     'StandardAbbr' => '2Mac',
                                     'WikiName'     => 'Secondo_libro_dei_Maccabei',
                                     'LongName'     => 'Secondo libro dei Maccabei',
                                     'Abbr'          => array ('2mac', '2macc', '2mc', '2maccabei'),
                                    ),
          'sapienza'        => array ('StandardName' => 'Sapienza',
                                     'StandardAbbr' => 'Sap',
                                     'WikiName'     => 'Libro_della_Sapienza',
                                     'LongName'     => 'Libro della Sapienza',
                                     'Abbr'          => array ('sp', 'sap', 'sapienza'),
                                    ),
          'siracide'        => array ('StandardName' => 'Siracide',
                                     'StandardAbbr' => 'Sir',
                                     'WikiName'     => 'Siracide',
                                     'LongName'     => 'Siracide',
                                     'Abbr'          => array ('sir', 'sr', 'siracide', 'eccli', 'ecclesiastico'),
                                    ),
          'baruc'           => array ('StandardName' => 'Baruc',
                                     'StandardAbbr' => 'Bar',
                                     'WikiName'     => 'Libro_di_Baruc',
                                     'LongName'     => 'Libro di Baruc',
                                     'Abbr'          => array ('ba', 'bar', 'baru', 'baruc'),
                                    ),
          'matteo'          => array ('StandardName' => 'Matteo',
                                     'StandardAbbr' => 'Mt',
                                     'WikiName'     => 'Vangelo_secondo_Matteo',
                                     'LongName'     => 'Vangelo secondo Matteo',
                                     'Abbr'          => array ('mt', 'mat', 'matt', 'matteo'),
                                    ),
          'marco'           => array ('StandardName' => 'Marco',
                                     'StandardAbbr' => 'Mc',
                                     'WikiName'     => 'Vangelo_secondo_Marco',
                                     'LongName'     => 'Vangelo secondo Marco',
                                     'Abbr'          => array ('mc', 'marco'),
                                    ),
          'luca'            => array ('StandardName' => 'Luca',
                                     'StandardAbbr' => 'Lc',
                                     'WikiName'     => 'Vangelo_secondo_Luca',
                                     'LongName'     => 'Vangelo secondo Luca',
                                     'Abbr'          => array ('lc', 'lu', 'luca'),
                                    ),
          'giovanni'        => array ('StandardName' => 'Giovanni',
                                     'StandardAbbr' => 'Gv',
                                     'WikiName'     => 'Vangelo_secondo_Giovanni',
                                     'LongName'     => 'Vangelo secondo Giovanni',
                                     'Abbr'          => array ('gv', 'giov', 'giovanni'),
                                    ),
          'atti'            => array ('StandardName' => 'Atti',
                                     'StandardAbbr' => 'At',
                                     'WikiName'     => 'Atti_degli_Apostoli',
                                     'LongName'     => 'Atti degli Apostoli',
                                     'Abbr'          => array ('at', 'att', 'atti', 'attidegliapostoli'),
                                    ),
          'romani'          => array ('StandardName' => 'Romani',
                                     'StandardAbbr' => 'Rm',
                                     'WikiName'     => 'Lettera_ai_Romani',
                                     'LongName'     => 'Lettera ai Romani',
                                     'Abbr'          => array ('rm', 'rom', 'romani'),
                                    ),
          '1corinzi'        => array ('StandardName' => '1Corinzi',
                                     'StandardAbbr' => '1Cor',
                                     'WikiName'     => 'Prima_lettera_ai_Corinzi',
                                     'LongName'     => 'Prima lettera ai Corinzi',
                                     'Abbr'          => array ('1co', '1cor', '1cori', '1corinzi', '1corinti'),
                                    ),
          '2corinzi'        => array ('StandardName' => '2Corinzi',
                                     'StandardAbbr' => '2Cor',
                                     'WikiName'     => 'Seconda_lettera_ai_Corinzi',
                                     'LongName'     => 'Seconda lettera ai Corinzi',
                                     'Abbr'          => array ('2co', '2cor', '2cori', '2corinzi', '2corinti'),
                                    ),
          'galati'          => array ('StandardName' => 'Galati',
                                     'StandardAbbr' => 'Gal',
                                     'WikiName'     => 'Lettera_ai_Galati',
                                     'LongName'     => 'Lettera ai Galati',
                                     'Abbr'          => array ('gal', 'galati'),
                                    ),
          'efesini'         => array ('StandardName' => 'Efesini',
                                     'StandardAbbr' => 'Ef',
                                     'WikiName'     => 'Lettera_agli_Efesini',
                                     'LongName'     => 'Lettera agli Efesini',
                                     'Abbr'          => array ('ef', 'efe', 'efes', 'efesini'),
                                    ),
          'filippesi'       => array ('StandardName' => 'Filippesi',
                                     'StandardAbbr' => 'Fil',
                                     'WikiName'     => 'Lettera_ai_Filippesi',
                                     'LongName'     => 'Lettera ai Filippesi',
                                     'Abbr'          => array ('fil', 'flp', 'fp', 'filippesi'),
                                    ),
          'colossesi'       => array ('StandardName' => 'Colossesi',
                                     'StandardAbbr' => 'Col',
                                     'WikiName'     => 'Lettera_ai_Colossesi',
                                     'LongName'     => 'Lettera ai Colossesi',
                                     'Abbr'          => array ('col', 'colo', 'colos', 'coloss', 'colossesi'),
                                    ),
          '1tessalonicesi'  => array ('StandardName' => '1Tessalonicesi',
                                     'StandardAbbr' => '1Ts',
                                     'WikiName'     => 'Prima_lettera_ai_Tessalonicesi',
                                     'LongName'     => 'Prima lettera ai Tessalonicesi',
                                     'Abbr'          => array ('1ts', '1tes', '1tess', '1tessalonicesi'),
                                    ),
          '2tessalonicesi'  => array ('StandardName' => '2Tessalonicesi',
                                     'StandardAbbr' => '2Ts',
                                     'WikiName'     => 'Seconda_lettera_ai_Tessalonicesi',
                                     'LongName'     => 'Seconda lettera ai Tessalonicesi',
                                     'Abbr'          => array ('2ts', '2tes', '2tess', '2tessalonicesi'),
                                    ),
          '1timoteo'        => array ('StandardName' => '1Timoteo',
                                     'StandardAbbr' => '1Tm',
                                     'WikiName'     => 'Prima_lettera_a_Timoteo',
                                     'LongName'     => 'Prima lettera a Timoteo',
                                     'Abbr'          => array ('1tm', '1tim', '1timo', '1timot', '1timoteo'),
                                    ),
          '2timoteo'        => array ('StandardName' => '2Timoteo',
                                     'StandardAbbr' => '2Tm',
                                     'WikiName'     => 'Seconda_lettera_a_Timoteo',
                                     'LongName'     => 'Seconda lettera a Timoteo',
                                     'Abbr'          => array ('2tm', '2tim', '2timo', '2timot', '2timoteo'),
                                    ),
          'tito'            => array ('StandardName' => 'Tito',
                                     'StandardAbbr' => 'Tt',
                                     'WikiName'     => 'Lettera_a_Tito',
                                     'LongName'     => 'Lettera a Tito',
                                     'Abbr'          => array ('tt', 'ti', 'tit', 'tito'),
                                    ),
          'filemone'        => array ('StandardName' => 'Filemone',
                                     'StandardAbbr' => 'Flm',
                                     'WikiName'     => 'Lettera_a_Filemone',
                                     'LongName'     => 'Lettera a Filemone',
                                     'Abbr'          => array ('fm', 'flm', 'filem', 'filemone'),
                                    ),
          'ebrei'           => array ('StandardName' => 'Ebrei',
                                     'StandardAbbr' => 'Eb',
                                     'WikiName'     => 'Lettera_agli_Ebrei',
                                     'LongName'     => 'Lettera agli Ebrei',
                                     'Abbr'          => array ('eb', 'ebr', 'ebrei'),
                                    ),
          'giacomo'         => array ('StandardName' => 'Giacomo',
                                     'StandardAbbr' => 'Gc',
                                     'WikiName'     => 'Lettera_di_Giacomo',
                                     'LongName'     => 'Lettera di Giacomo',
                                     'Abbr'          => array ('gc', 'gia', 'giac', 'giaco', 'giacomo'),
                                    ),
          '1pietro'         => array ('StandardName' => '1Pietro',
                                     'StandardAbbr' => '1Pt',
                                     'WikiName'     => 'Prima_lettera_di_Pietro',
                                     'LongName'     => 'Prima lettera di Pietro',
                                     'Abbr'          => array ('1pt', '1pi', '1pie', '1piet', '1pietro'),
                                    ),
          '2pietro'         => array ('StandardName' => '2Pietro',
                                     'StandardAbbr' => '2Pt',
                                     'WikiName'     => 'Seconda_lettera_di_Pietro',
                                     'LongName'     => 'Seconda lettera di Pietro',
                                     'Abbr'          => array ('2pt', '2pi', '2pie', '2piet', '2pietro'),
                                    ),
          '1giovanni'       => array ('StandardName' => '1Giovanni',
                                     'StandardAbbr' => '1Gv',
                                     'WikiName'     => 'Prima_lettera_di_Giovanni',
                                     'LongName'     => 'Prima lettera di Giovanni',
                                     'Abbr'          => array ('1g', '1gv', '1gio', '1giov', '1giovanni'),
                                    ),
          '2giovanni'       => array ('StandardName' => '2Giovanni',
                                     'StandardAbbr' => '2Gv',
                                     'WikiName'     => 'Seconda_lettera_di_Giovanni',
                                     'LongName'     => 'Seconda lettera di Giovanni',
                                     'Abbr'          => array ('2g', '2gv', '2gio', '2giov', '2giovanni'),
                                    ),
          '3giovanni'       => array ('StandardName' => '3Giovanni',
                                     'StandardAbbr' => '3Gv',
                                     'WikiName'     => 'Terza_lettera_di_Giovanni',
                                     'LongName'     => 'Terza lettera di Giovanni',
                                     'Abbr'          => array ('3g', '3gv', '3gio', '3giov', '3giovanni'),
                                    ),
          'giuda'            => array ('StandardName' => 'Giuda',
                                     'StandardAbbr' => 'Gd',
                                     'WikiName'     => 'Lettera_di_Giuda',
                                     'LongName'     => 'Lettera di Giuda',
                                     'Abbr'          => array ('gd', 'giud', 'giuda'),
                                    ),
          'apocalisse'      => array ('StandardName' => 'Apocalisse',
                                     'StandardAbbr' => 'Ap',
                                     'WikiName'     => 'Apocalisse_di_San_Giovanni',
                                     'LongName'     => 'Apocalisse di San Giovanni',
                                     'Abbr'          => array ('ap', 'apo', 'apoc', 'apoca', 'apocal', 'apocalisse'),
                                    ),
          )

);

$BPBooks['es'] = array(

       // the first values are for interpreting the cites
       'ebraic-psalm-numeration-letter' => 'E',
       'liturgical-psalm-numeration-letter' => 'L',
       'normalized-psalms-book-name' => 'Salmi',
       'normalized-psalms-book-name-e' => 'SalmiE',
       'normalized-psalms-book-name-l' => 'SalmiL',
       'semicolon' => ';',
       'comma' => ',',
       'dot' => '.',
       'dash' => '-',
       'books' => array (
          'génesis'         => array ('StandardName' => 'Génesis',
                                     'StandardAbbr' => 'Gn',
                                     'WikiName'     => 'Libro_del_Génesis',
                                     'LongName'     => 'Libro del Génesis',
                                     'Abbr'          => array ('gn', 'gen', 'ge', 'génesis', 'genesis'),
                                    ),
          'éxodo'           => array ('StandardName' => 'Éxodo',
                                     'StandardAbbr' => 'Es',
                                     'WikiName'     => 'Libro_del_Éxodo',
                                     'LongName'     => 'Libro del Éxodo',
                                     'Abbr'          => array ('ex', 'exo', 'exod', 'éx', 'exodo', 'éxodo'),
                                    ),
          'levítico'        => array ('StandardName' => 'Levítico',
                                     'StandardAbbr' => 'Lv',
                                     'WikiName'     => 'Levítico',
                                     'LongName'     => 'Levítico',
                                     'Abbr'          => array ('lv', 'le', 'lev', 'levi', 'levit', 'levítico', 'levitico'),
                                    ),
          'números'         => array ('StandardName' => 'Números',
                                     'StandardAbbr' => 'Nm',
                                     'WikiName'     => 'Números',
                                     'LongName'     => 'Números',
                                     'Abbr'          => array ('nm', 'nu', 'num', 'números', 'numeros'),
                                    ),
          'deuteronomio'    => array ('StandardName' => 'Deuteronomio',
                                     'StandardAbbr' => 'Dt',
                                     'WikiName'     => 'Deuteronomio',
                                     'LongName'     => 'Deuteronomio',
                                     'Abbr'          => array ('dt', 'de', 'deu', 'deut', 'deuteronomio'),
                                    ),
          'josué¨'          => array ('StandardName' => 'Josué¨',
                                     'StandardAbbr' => 'Js',
                                     'WikiName'     => 'Libro_de_Josué¨',
                                     'LongName'     => 'Libro de Josué¨',
                                     'Abbr'          => array ('js', 'jos', 'josué', 'josue'),
                                    ),
          'jueces'          => array ('StandardName' => 'Jueces',
                                     'StandardAbbr' => 'Jc',
                                     'WikiName'     => 'Libro_de_los_Jueces',
                                     'LongName'     => 'Libro de los Jueces',
                                     'Abbr'          => array ('jc', 'jue', 'jueces'),
                                    ),
          '1samuel'         => array ('StandardName' => '1Samuel',
                                     'StandardAbbr' => '1Sam',
                                     'WikiName'     => 'Primer_libro_de_Samuel',
                                     'LongName'     => 'Primer libro de Samuel',
                                     'Abbr'          => array ('1s', '1sa', '1sam', '1sm', '1samuel'),
                                    ),
          '2samuel'        => array ('StandardName' => '2Samuel',
                                     'StandardAbbr' => '2Sam',
                                     'WikiName'     => 'Segundo_libro_de_Samuel',
                                     'LongName'     => 'Segundo libro de Samuel',
                                     'Abbr'          => array ('2s', '2sa', '2sam', '2sm', '2samuel'),
                                    ),
          '1reyes'          => array ('StandardName' => '1Reyes',
                                     'StandardAbbr' => '1Re',
                                     'WikiName'     => 'Primer_libro_de_lo_Reyes',
                                     'LongName'     => 'Primer libro de los Reyes',
                                     'Abbr'          => array ('1re', '1r', '1reyes'),
                                    ),
          '2reyes'          => array ('StandardName' => '2Reyes',
                                     'StandardAbbr' => '2Re',
                                     'WikiName'     => 'Segundo_libro_de_los_Reyes',
                                     'LongName'     => 'Segundo libro de los Reyes',
                                     'Abbr'          => array ('2re', '2r', '2reyes'),
                                    ),
          'isaías'          => array ('StandardName' => 'Isaías',
                                     'StandardAbbr' => 'Is',
                                     'WikiName'     => 'Libro_de_Isaías',
                                     'LongName'     => 'Libro de Isaías',
                                     'Abbr'          => array ('is', 'isa', 'isaías', 'isaias'),
                                    ),
          'jeremías'        => array ('StandardName' => 'Jeremías',
                                     'StandardAbbr' => 'Jr',
                                     'WikiName'     => 'Libro_de_Jeremías',
                                     'LongName'     => 'Libro de Jeremías',
                                     'Abbr'          => array ('jer', 'jr', 'jeremías', 'jeremias'),
                                    ),
          'ezequiel'        => array ('StandardName' => 'Ezequiel',
                                     'StandardAbbr' => 'Ez',
                                     'WikiName'     => 'Libro_de_Ezequiel',
                                     'LongName'     => 'Libro de Ezequiel',
                                     'Abbr'          => array ('ez', 'eze', 'ezeq', 'ezequiel'),
                                    ),
          'oseas'           => array ('StandardName' => 'Oseas',
                                     'StandardAbbr' => 'Os',
                                     'WikiName'     => 'Libro_de_Oseas',
                                     'LongName'     => 'Libro de Oseas',
                                     'Abbr'          => array ('os', 'oseas'),
                                    ),
          'joel'            => array ('StandardName' => 'Joel',
                                     'StandardAbbr' => 'Jl',
                                     'WikiName'     => 'Libro_de_Joel',
                                     'LongName'     => 'Libro de Joel',
                                     'Abbr'          => array ('jl', 'joe', 'joel'),
                                    ),
          'amós'            => array ('StandardName' => 'Amós',
                                     'StandardAbbr' => 'Am',
                                     'WikiName'     => 'Libro_de_Amós',
                                     'LongName'     => 'Libro de Amós',
                                     'Abbr'          => array ('am', 'amos', 'amós'),
                                    ),
          'abdías'          => array ('StandardName' => 'Abdías',
                                     'StandardAbbr' => 'Abd',
                                     'WikiName'     => 'Libro_de_Abdías',
                                     'LongName'     => 'Libro de Abdías',
                                     'Abbr'          => array ('abd', 'abdías', 'abdias'),
                                    ),
          'jonás'           => array ('StandardName' => 'Jonás',
                                     'StandardAbbr' => 'Jon',
                                     'WikiName'     => 'Libro_de_Jonás',
                                     'LongName'     => 'Libro de Jonás',
                                     'Abbr'          => array ('jo', 'jon', 'jonás', 'jonas'),
                                    ),
          'miqueas'          => array ('StandardName' => 'Miqueas',
                                     'StandardAbbr' => 'Mi',
                                     'WikiName'     => 'Libro_de_Miqueas',
                                     'LongName'     => 'Libro de Miqueas',
                                     'Abbr'          => array ('mi', 'miq', 'miqueas'),
                                    ),
          'nahum'           => array ('StandardName' => 'Nahum',
                                     'StandardAbbr' => 'Na',
                                     'WikiName'     => 'Libro_de_Nahum',
                                     'LongName'     => 'Libro de Nahum',
                                     'Abbr'          => array ('na', 'nah', 'nahum'),
                                    ),
          'Habacuc'         => array ('StandardName' => 'Habacuc',
                                     'StandardAbbr' => 'Hab',
                                     'WikiName'     => 'Libro_de_Habacuc',
                                     'LongName'     => 'Libro de Habacuc',
                                     'Abbr'          => array ('hab', 'haba', 'habacuc'),
                                    ),
          'sofonías'        => array ('StandardName' => 'Sofonías',
                                     'StandardAbbr' => 'Sof',
                                     'WikiName'     => 'Libro_de_Sofonías',
                                     'LongName'     => 'Libro de Sofonías',
                                     'Abbr'          => array ('so', 'sof', 'sf', 'sofonías', 'sofonias'),
                                    ),
          'ageo'           => array ('StandardName' => 'Ageo',
                                     'StandardAbbr' => 'Ag',
                                     'WikiName'     => 'Libro_de_Ageo',
                                     'LongName'     => 'Libro de Ageo',
                                     'Abbr'          => array ('ag', 'agg', 'ageo'),
                                    ),
          'zacarías'        => array ('StandardName' => 'Zacarías',
                                     'StandardAbbr' => 'Zac',
                                     'WikiName'     => 'Libro_de_Zacarías',
                                     'LongName'     => 'Libro de Zacarías',
                                     'Abbr'          => array ('za', 'zac', 'zc', 'zacarías', 'zacarias'),
                                    ),
          'malaquías'       => array ('StandardName' => 'Malaquías',
                                     'StandardAbbr' => 'Mal',
                                     'WikiName'     => 'Libro_de_Malaquías',
                                     'LongName'     => 'Libro de Malaquías',
                                     'Abbr'          => array ('mal', 'ml', 'malaquías', 'malaquias'),
                                    ),
          'salmo'          => array ('StandardName' => 'Salmos',
                                     'StandardAbbr' => 'Sal',
                                     'WikiName'     => 'Libro_de_los_Salmos',
                                     'LongName'     => 'Libro de los Salmos',
                                     'Abbr'          => array ('sl', 'sal', 'salmo', 'salmos'),
                                    ),
          'salmoe'          => array ('StandardName' => 'SalmosE',
                                     'StandardAbbr' => 'Sal',
                                     'WikiName'     => 'Libro_dei_Salmos',
                                     'LongName'     => 'Libro de los Salmos',
                                     'Abbr'          => array ('sle', 'sale', 'salmoe', 'salmose'),
                                    ),
          'salmol'          => array ('StandardName' => 'SalmiL',
                                     'StandardAbbr' => 'Sal',
                                     'WikiName'     => 'Libro_dei_Salmos',
                                     'LongName'     => 'Libro dei Salmos',
                                     'Abbr'          => array ('sll', 'sall', 'salmol', 'salmosl'),
                                    ),
          'proverbios'      => array ('StandardName' => 'Proverbios',
                                     'StandardAbbr' => 'Pr',
                                     'WikiName'     => 'Libro_de_los_Proverbios',
                                     'LongName'     => 'Libro de los Proverbios',
                                     'Abbr'          => array ('pr', 'prov', 'prv', 'proverbios'),
                                    ),
          'job'             => array ('StandardName' => 'Job',
                                     'StandardAbbr' => 'Jb',
                                     'WikiName'     => 'Libro_de_Job',
                                     'LongName'     => 'Libro de Job',
                                     'Abbr'          => array ('jb', 'job'),
                                    ),
          'cantar'          => array ('StandardName' => 'Cantar',
                                     'StandardAbbr' => 'Ct',
                                     'WikiName'     => 'Cantar_de_los_Cantares',
                                     'LongName'     => 'Cantar de los Cantares',
                                     'Abbr'          => array ('ct', 'cant', 'cantar'),
                                    ),
          'rut'             => array ('StandardName' => 'Rut',
                                     'StandardAbbr' => 'Rut',
                                     'WikiName'     => 'Libro_de_Rut',
                                     'LongName'     => 'Libro de Rut',
                                     'Abbr'          => array ('rt', 'rut'),
                                    ),
          'lamentaciones'   => array ('StandardName' => 'Lamentaciones',
                                     'StandardAbbr' => 'Lam',
                                     'WikiName'     => 'Libro_de_las_Lamentaciones',
                                     'LongName'     => 'Libro de las Lamentaciones',
                                     'Abbr'          => array ('lam', 'lm', 'lament', 'lamentaciones'),
                                    ),
          'qohelet'         => array ('StandardName' => 'Qohelet',
                                     'StandardAbbr' => 'Qo',
                                     'WikiName'     => 'Qohelet',
                                     'LongName'     => 'Qohelet',
                                     'Abbr'          => array ('qo', 'qoe', 'qoel', 'qohelet', 'eccle', 'ecclesiastes'),
                                    ),
          'ester'           => array ('StandardName' => 'Ester',
                                     'StandardAbbr' => 'Est',
                                     'WikiName'     => 'Libro_de_Ester',
                                     'LongName'     => 'Libro de Ester',
                                     'Abbr'          => array ('est', 'ester'),
                                    ),
          'daniel'          => array ('StandardName' => 'Daniel',
                                     'StandardAbbr' => 'Dn',
                                     'WikiName'     => 'Libro_de_Daniel',
                                     'LongName'     => 'Libro de Daniel',
                                     'Abbr'          => array ('dn', 'dan', 'daniel'),
                                    ),
          'esdras'          => array ('StandardName' => 'Esdras',
                                     'StandardAbbr' => 'Esd',
                                     'WikiName'     => 'Libro_de_Esdras',
                                     'LongName'     => 'Libro de Esdras',
                                     'Abbr'          => array ('esd', 'esdra', 'esdras'),
                                    ),
          'nehemías'        => array ('StandardName' => 'Nehemías',
                                     'StandardAbbr' => 'Neh',
                                     'WikiName'     => 'Libro_de_Nehemías',
                                     'LongName'     => 'Libro de Nehemías',
                                     'Abbr'          => array ('ne', 'nehe', 'nehemías', 'nehemias'),
                                    ),
          '1crónicas'       => array ('StandardName' => '1Crónicas',
                                     'StandardAbbr' => '1Cr',
                                     'WikiName'     => 'Primer_libro_de_las_Crónicas',
                                     'LongName'     => 'Primer libro de las Crónicas',
                                     'Abbr'          => array ('1c', '1cr', '1cro', '1cron', '1crónicas', '1cronicas'),
                                    ),
          '2crónicas'       => array ('StandardName' => '2Crónicas',
                                     'StandardAbbr' => '2Cr',
                                     'WikiName'     => 'segundo_libro_de_las_Crónicas',
                                     'LongName'     => 'segundo libro de las Crónicas',
                                     'Abbr'          => array ('2c', '2cr', '2cro', '2cron', '2crónicas', '2cronicas'),
                                    ),
          'tobías'          => array ('StandardName' => 'Tobías',
                                     'StandardAbbr' => 'Tb',
                                     'WikiName'     => 'Libro_de_Tobías',
                                     'LongName'     => 'Libro de Tobías',
                                     'Abbr'          => array ('tb', 'tob', 'tobías', 'tobias'),
                                    ),
          'judit'           => array ('StandardName' => 'Judit',
                                     'StandardAbbr' => 'Jdt',
                                     'WikiName'     => 'Libro_de_Judit',
                                     'LongName'     => 'Libro de Judit',
                                     'Abbr'          => array ('jdt', 'judit'),
                                    ),
          '1macabeos'       => array ('StandardName' => '1Macabeos',
                                     'StandardAbbr' => '1Mac',
                                     'WikiName'     => 'Primer_libro_de_los_Macabeos',
                                     'LongName'     => 'Primer libro de los Macabeos',
                                     'Abbr'          => array ('1m', '1mac', '1mcb', '1mc', '1macabeos'),
                                    ),
          '2macabeos'       => array ('StandardName' => '2Macabeos',
                                     'StandardAbbr' => '2Mac',
                                     'WikiName'     => 'Segundo_libro_de_los_Macabeos',
                                     'LongName'     => 'Segundo libro de los Macabeos',
                                     'Abbr'          => array ('2m', '2mac', '2mcb', '2mc', '2macabeos'),
                                    ),
          'sabiduría'       => array ('StandardName' => 'Sabiduría',
                                     'StandardAbbr' => 'Sab',
                                     'WikiName'     => 'Libro_de_la_Sabiduría',
                                     'LongName'     => 'Libro de la Sabiduría',
                                     'Abbr'          => array ('sb', 'sab', 'sabiduría', 'sabiduria'),
                                    ),
          'sirácide'        => array ('StandardName' => 'Sirácide',
                                     'StandardAbbr' => 'Sir',
                                     'WikiName'     => 'Sirácide',
                                     'LongName'     => 'Sirácide',
                                     'Abbr'          => array ('sir', 'sr', 'sirácide', 'siracide', 'ecclo', 'eclesiástico'),
                                    ),
          'baruc'           => array ('StandardName' => 'Baruc',
                                     'StandardAbbr' => 'Bar',
                                     'WikiName'     => 'Libro_de_Baruc',
                                     'LongName'     => 'Libro de Baruc',
                                     'Abbr'          => array ('ba', 'bar', 'baru', 'baruc'),
                                    ),
          'mateo'           => array ('StandardName' => 'Mateo',
                                     'StandardAbbr' => 'Mt',
                                     'WikiName'     => 'Evangelio_según_Mateo',
                                     'LongName'     => 'Evangelio según Mateo',
                                     'Abbr'          => array ('mt', 'mat', 'mateo'),
                                    ),
          'marcos'          => array ('StandardName' => 'Marcos',
                                     'StandardAbbr' => 'Mc',
                                     'WikiName'     => 'Evangelio_según_Marcos',
                                     'LongName'     => 'Evangelio según Marcos',
                                     'Abbr'          => array ('mc', 'marcos'),
                                    ),
          'lucas'           => array ('StandardName' => 'Lucas',
                                     'StandardAbbr' => 'Lc',
                                     'WikiName'     => 'Evangelio_según_Lucas',
                                     'LongName'     => 'Evangelio según Lucas',
                                     'Abbr'          => array ('lc', 'lu', 'lucas'),
                                    ),
          'juan'            => array ('StandardName' => 'Juan',
                                     'StandardAbbr' => 'Jn',
                                     'WikiName'     => 'Evangelio_según_Juan',
                                     'LongName'     => 'Evangelio según Juan',
                                     'Abbr'          => array ('jn', 'juan'),
                                    ),
          'hechos'          => array ('StandardName' => 'Hechos',
                                     'StandardAbbr' => 'Hch',
                                     'WikiName'     => 'Hechos_de_los_Apóstoles',
                                     'LongName'     => 'Hechos de los Apóstoles',
                                     'Abbr'          => array ('hech', 'hechos'),
                                    ),
          'romanos'         => array ('StandardName' => 'Romanos',
                                     'StandardAbbr' => 'Rm',
                                     'WikiName'     => 'Carta_a_los_Romanos',
                                     'LongName'     => 'Carta a los Romanos',
                                     'Abbr'          => array ('rm', 'rom', 'romanos'),
                                    ),
          '1corintios'      => array ('StandardName' => '1Corintios',
                                     'StandardAbbr' => '1Cor',
                                     'WikiName'     => 'Primera_Carta_a_los_Corintios',
                                     'LongName'     => 'Primera Carta a los Corintios',
                                     'Abbr'          => array ('1co', '1cor', '1cori', '1corintios', '1corinti'),
                                    ),
          '2corintios'      => array ('StandardName' => '2Corintios',
                                     'StandardAbbr' => '2Cor',
                                     'WikiName'     => 'Segunda_Carta_ai_Corintios',
                                     'LongName'     => 'Segunda Carta ai Corintios',
                                     'Abbr'          => array ('2co', '2cor', '2cori', '2corintios', '2corinti'),
                                    ),
          'gálatas'         => array ('StandardName' => 'Gálatas',
                                     'StandardAbbr' => 'Gal',
                                     'WikiName'     => 'Carta_a_los_Gálatas',
                                     'LongName'     => 'Carta a los Gálatas',
                                     'Abbr'          => array ('gal', 'gálatas', 'galatas'),
                                    ),
          'efesios'         => array ('StandardName' => 'Efesios',
                                     'StandardAbbr' => 'Ef',
                                     'WikiName'     => 'Carta_a_los_Efesios',
                                     'LongName'     => 'Carta a los Efesios',
                                     'Abbr'          => array ('ef', 'efe', 'efes', 'efesios'),
                                    ),
          'filipenses'      => array ('StandardName' => 'Filipenses',
                                     'StandardAbbr' => 'Fil',
                                     'WikiName'     => 'Carta_a_los_Filipenses',
                                     'LongName'     => 'Carta a los Filipenses',
                                     'Abbr'          => array ('fil', 'flp', 'fp', 'filipenses'),
                                    ),
          'colosenses'      => array ('StandardName' => 'Colosenses',
                                     'StandardAbbr' => 'Col',
                                     'WikiName'     => 'Carta_a_los_Colosenses',
                                     'LongName'     => 'Carta a los Colosenses',
                                     'Abbr'          => array ('col', 'colo', 'colos', 'coloss', 'colosenses'),
                                    ),
          '1tesalonicenses' => array ('StandardName' => '1Tesalonicenses',
                                     'StandardAbbr' => '1Ts',
                                     'WikiName'     => 'Primera_Carta_a_los_Tesalonicenses',
                                     'LongName'     => 'Primera Carta a los Tesalonicenses',
                                     'Abbr'          => array ('1ts', '1tes', '1tesal', '1tesalonicenses'),
                                    ),
          '2tesalonicenses' => array ('StandardName' => '2Tesalonicenses',
                                     'StandardAbbr' => '2Ts',
                                     'WikiName'     => 'Segunda_Carta_a_los_Tesalonicenses',
                                     'LongName'     => 'Segunda Carta a los Tesalonicenses',
                                     'Abbr'          => array ('2ts', '2tes', '2tesal', '2tesalonicenses'),
                                    ),
          '1timoteo'        => array ('StandardName' => '1Timoteo',
                                     'StandardAbbr' => '1Tm',
                                     'WikiName'     => 'Primera_Carta_a_Timoteo',
                                     'LongName'     => 'Primera Carta a Timoteo',
                                     'Abbr'          => array ('1tm', '1tim', '1timo', '1timot', '1timoteo'),
                                    ),
          '2timoteo'        => array ('StandardName' => '2Timoteo',
                                     'StandardAbbr' => '2Tm',
                                     'WikiName'     => 'Segunda_Carta_a_Timoteo',
                                     'LongName'     => 'Segunda Carta a Timoteo',
                                     'Abbr'          => array ('2tm', '2tim', '2timo', '2timot', '2timoteo'),
                                    ),
          'tito'            => array ('StandardName' => 'Tito',
                                     'StandardAbbr' => 'Tt',
                                     'WikiName'     => 'Carta_a_Tito',
                                     'LongName'     => 'Carta a Tito',
                                     'Abbr'          => array ('tt', 'ti', 'tit', 'tito'),
                                    ),
          'filemón'         => array ('StandardName' => 'Filemón',
                                     'StandardAbbr' => 'Flm',
                                     'WikiName'     => 'Carta_a_Filemón',
                                     'LongName'     => 'Carta a Filemón',
                                     'Abbr'          => array ('fm', 'flm', 'filem', 'filemón', 'filemon'),
                                    ),
          'hebreos'         => array ('StandardName' => 'Hebreos',
                                     'StandardAbbr' => 'Hb',
                                     'WikiName'     => 'Carta_a_los_Hebreos',
                                     'LongName'     => 'Carta a los Hebreos',
                                     'Abbr'          => array ('heb', 'hebr', 'hebreos'),
                                    ),
          'santiago'        => array ('StandardName' => 'Santiago',
                                     'StandardAbbr' => 'St',
                                     'WikiName'     => 'Carta_de_Santiago',
                                     'LongName'     => 'Carta de Santiago',
                                     'Abbr'          => array ('st', 'stgo', 'stc', 'santiago'),
                                    ),
          '1pedro'          => array ('StandardName' => '1Pedro',
                                     'StandardAbbr' => '1Pe',
                                     'WikiName'     => 'Primera_Carta_de_Pedro',
                                     'LongName'     => 'Primera Carta de Pedro',
                                     'Abbr'          => array ('1pt', '1p', '1pdr', '1pedro'),
                                    ),
          '2pedro'          => array ('StandardName' => '2Pedro',
                                     'StandardAbbr' => '2Pe',
                                     'WikiName'     => 'Segunda_Carta_de_Pedro',
                                     'LongName'     => 'Segunda Carta de Pedro',
                                     'Abbr'          => array ('2pt', '2p', '2pdr', '2pedro'),
                                    ),
          '1juan'           => array ('StandardName' => '1Juan',
                                     'StandardAbbr' => '1Jn',
                                     'WikiName'     => 'Primera_Carta_de_Juan',
                                     'LongName'     => 'Primera Carta de Juan',
                                     'Abbr'          => array ('1j', '1jn', '1juan'),
                                    ),
          '2juan'           => array ('StandardName' => '2Juan',
                                     'StandardAbbr' => '2Jn',
                                     'WikiName'     => 'Segunda_Carta_de_Juan',
                                     'LongName'     => 'Segunda Carta de Juan',
                                     'Abbr'          => array ('2j', '2jn', '2juan'),
                                    ),
          '3juan'           => array ('StandardName' => '3Juan',
                                     'StandardAbbr' => '3Jn',
                                     'WikiName'     => 'Tercera_Carta_de_Juan',
                                     'LongName'     => 'Tercera Carta de Juan',
                                     'Abbr'          => array ('3j', '3jn', '3juan'),
                                    ),
          'judas'           => array ('StandardName' => 'Judas',
                                     'StandardAbbr' => 'Jd',
                                     'WikiName'     => 'Carta_de_Judas',
                                     'LongName'     => 'Carta de Judas',
                                     'Abbr'          => array ('jd', 'jud', 'judas'),
                                    ),
          'apocalipsis'     => array ('StandardName' => 'Apocalipsis',
                                     'StandardAbbr' => 'Ap',
                                     'WikiName'     => 'Apocalipsis_de_San_Juan',
                                     'LongName'     => 'Apocalipsis de San Juan',
                                     'Abbr'          => array ('ap', 'apo', 'apoc', 'apoca', 'apocal', 'apocalipsis'),
                                    ),
         )

);


///////////////////////////// // BiblePassage.BiblicalBooksFunctions.php /////////////////////////////

  1. Gets the last versicle of a Psalm

function FinalVersicleOfPsalm($Psalm, $NumerationType = 'E') { switch ($Psalm) { case 1: 6; break; case 2: 12; break; case 3: 9; break; case 4: 9; break; case 5: 13; break; case 6: 11; break; case 7: 18; break; case 8: 10; break; case 148: 14; break; case 149: 9; break; case 150: 5; default: if ($NumerationType = 'L') switch ($Psalm) { case 9: 39; break; case 10: 7; break; case 11: 9; break; case 12: 6; break; case 13: 7; break; case 14: 5; break; case 15: 11; break; case 16: 15; break; case 17: 51; break; case 18: 15; break; case 19: 10; break; case 20: 14; break; case 21: 32; break; case 22: 6; break; case 23: 10; break; case 24: 22; break; case 25: 12; break; case 26: 14; break; case 27: 9; break; case 28: 11; break; case 29: 13; break; case 30: 25; break; case 31: 11; break; case 32: 22; break; case 33: 23; break; case 34: 28; break; case 35: 13; break; case 36: 40; break; case 37: 23; break; case 38: 14; break; case 39: 18; break; case 40: 14; break; case 41: 12; break; case 42: 5; break; case 43: 27; break; case 44: 18; break; case 45: 12; break; case 46: 10; break; case 47: 15; break; case 48: 21; break; case 49: 23; break; case 50: 21; break; case 51: 11; break; case 52: 7; break; case 53: 9; break; case 54: 24; break; case 55: 14; break; case 56: 12; break; case 57: 12; break; case 58: 18; break; case 59: 14; break; case 60: 9; break; case 61: 13; break; case 62: 12; break; case 63: 11; break; case 64: 14; break; case 65: 20; break; case 66: 8; break; case 67: 36; break; case 68: 37; break; case 69: 6; break; case 70: 24; break; case 71: 19; break; case 72: 28; break; case 73: 23; break; case 74: 11; break; case 75: 13; break; case 76: 21; break; case 77: 72; break; case 78: 13; break; case 79: 20; break; case 80: 17; break; case 81: 8; break; case 82: 19; break; case 83: 13; break; case 84: 14; break; case 85: 17; break; case 86: 7; break; case 87: 19; break; case 88: 53; break; case 89: 17; break; case 90: 16; break; case 91: 16; break; case 92: 5; break; case 93: 23; break; case 94: 11; break; case 95: 13; break; case 96: 12; break; case 97: 9; break; case 98: 9; break; case 99: 5; break; case 100: 8; break; case 101: 29; break; case 102: 22; break; case 103: 35; break; case 104: 45; break; case 105: 48; break; case 106: 43; break; case 107: 14; break; case 108: 31; break; case 109: 7; break; case 110: 10; break; case 111: 10; break; case 112: 9; break; case 113: 26; break; case 114: 9; break; case 115: 10; break; case 116: 2; break; case 117: 29; break; case 118: 176; break; case 119: 7; break; case 120: 8; break; case 121: 9; break; case 122: 4; break; case 123: 8; break; case 124: 5; break; case 125: 6; break; case 126: 5; break; case 127: 6; break; case 128: 8; break; case 129: 8; break; case 130: 3; break; case 131: 18; break; case 132: 3; break; case 133: 3; break; case 134: 21; break; case 135: 26; break; case 136: 9; break; case 137: 8; break; case 138: 24; break; case 139: 14; break; case 140: 10; break; case 141: 8; break; case 142: 12; break; case 143: 15; break; case 144: 21; break; case 145: 10; break; case 146: 11; break; case 147: 9; break; } else switch ($Psalm) { case 9: 21; break; case 10: 18; break; case 11: 7; break; case 12: 9; break; case 13: 6; break; case 14: 7; break; case 15: 5; break; case 16: 11; break; case 17: 15; break; case 18: 51; break; case 19: 15; break; case 20: 10; break; case 21: 14; break; case 22: 32; break; case 23: 6; break; case 24: 10; break; case 25: 22; break; case 26: 12; break; case 27: 14; break; case 28: 9; break; case 29: 11; break; case 30: 13; break; case 31: 25; break; case 32: 11; break; case 33: 22; break; case 34: 23; break; case 35: 28; break; case 36: 13; break; case 37: 40; break; case 38: 23; break; case 39: 14; break; case 40: 18; break; case 41: 14; break; case 42: 12; break; case 43: 5; break; case 44: 27; break; case 45: 18; break; case 46: 12; break; case 47: 10; break; case 48: 15; break; case 49: 21; break; case 50: 23; break; case 51: 21; break; case 52: 11; break; case 53: 7; break; case 54: 9; break; case 55: 24; break; case 56: 14; break; case 57: 12; break; case 58: 12; break; case 59: 18; break; case 60: 14; break; case 61: 9; break; case 62: 13; break; case 63: 12; break; case 64: 11; break; case 65: 14; break; case 66: 20; break; case 67: 8; break; case 68: 36; break; case 69: 37; break; case 70: 6; break; case 71: 24; break; case 72: 19; break; case 73: 28; break; case 74: 23; break; case 75: 11; break; case 76: 13; break; case 77: 21; break; case 78: 72; break; case 79: 13; break; case 80: 20; break; case 81: 17; break; case 82: 8; break; case 83: 19; break; case 84: 13; break; case 85: 14; break; case 86: 17; break; case 87: 7; break; case 88: 19; break; case 89: 53; break; case 90: 17; break; case 91: 16; break; case 92: 16; break; case 93: 5; break; case 94: 23; break; case 95: 11; break; case 96: 13; break; case 97: 12; break; case 98: 9; break; case 99: 9; break; case 100: 5; break; case 101: 8; break; case 102: 29; break; case 103: 22; break; case 104: 35; break; case 105: 45; break; case 106: 48; break; case 107: 43; break; case 108: 14; break; case 109: 31; break; case 110: 7; break; case 111: 10; break; case 112: 10; break; case 113: 9; break; case 114: 8; break; case 115: 18; break; case 116: 19; break; case 117: 2; break; case 118: 29; break; case 119: 176; break; case 120: 7; break; case 121: 8; break; case 122: 9; break; case 123: 4; break; case 124: 8; break; case 125: 5; break; case 126: 6; break; case 127: 5; break; case 128: 6; break; case 129: 8; break; case 130: 8; break; case 131: 3; break; case 132: 18; break; case 133: 3; break; case 134: 3; break; case 135: 21; break; case 136: 26; break; case 137: 9; break; case 138: 8; break; case 139: 24; break; case 140: 14; break; case 141: 10; break; case 142: 8; break; case 143: 12; break; case 144: 15; break; case 145: 21; break; case 146: 10; break; case 147: 20; break; } } }

  1. Normalize the bible book name

function NormalizeBook($Book) { switch ($Book) { case 'gn': case 'gen': case 'ge': case 'genesi': $NormBook = 'Genesi'; break; case 'es': case 'eso': case 'esod': case 'ex': case 'esodo': $NormBook = 'Esodo'; break; case 'lv': case 'le': case 'lev': case 'levi': case 'levit': case 'levitico': $NormBook = 'Levitico'; break; case 'nm': case 'nu': case 'num': case 'numeri': $NormBook = 'Numeri'; break; case 'dt': case 'de': case 'deu': case 'deut': case 'deuteronomio': $NormBook = 'Deuteronomio'; break; case 'gs': case 'gios': case 'giosuè': $NormBook = 'Giosuè'; break; case 'gdc': case 'giudic': case 'giudici': $NormBook = 'Giudici'; break; case '1s': case '1sa': case '1sam': case '1sm': case '1samuele': $NormBook = '1Samuele'; break; case '2s': case '2sa': case '2sam': case '2sm': case '2samuele': $NormBook = '2Samuele'; break; case '1re': case '1r': $NormBook = '1Re'; break; case '2re': case '2r': $NormBook = '2Re'; break; case 'is': case 'isa': case 'isaia': $NormBook = 'Isaia'; break; case 'ger': case 'gr': case 'geremia': $NormBook = 'Geremia'; break; case 'ez': case 'eze': case 'ezec': case 'ezechiele': $NormBook = 'Ezechiele'; break; case 'os': case 'osea': $NormBook = 'Osea'; break; case 'gl': case 'gioe': case 'gioel': case 'gioele': $NormBook = 'Gioele'; break; case 'am': case 'amos': $NormBook = 'Amos'; break; case 'abd': case 'abdia': $NormBook = 'Abdia'; break; case 'gio': case 'gion': case 'giona': $NormBook = 'Giona'; break; case 'mi': case 'mic': case 'mich': case 'michea': $NormBook = 'Michea'; break; case 'na': case 'nau': case 'naum': $NormBook = 'Naum'; break; case 'ab': case 'aba': case 'abacuc': $NormBook = 'Abacuc'; break; case 'so': case 'sof': case 'sf': case 'sofonia': $NormBook = 'Sofonia'; break; case 'ag': case 'agg': case 'aggeo': $NormBook = 'Aggeo'; break; case 'za': case 'zac': case 'zc': case 'zaccaria': $NormBook = 'Zaccaria'; break; case 'mal': case 'ml': case 'malachia': $NormBook = 'Malachia'; break; case 'sl': case 'sal': case 'salmo': case 'salmi': $NormBook = 'Salmi'; break; case 'sle': case 'sale': case 'salmoe': case 'salmie': $NormBook = 'SalmiE'; break; case 'sll': case 'sall': case 'salmol': case 'salmil': $NormBook = 'SalmiL'; break; case 'pr': case 'prov': case 'prv': case 'proverbi': $NormBook = 'Proverbi'; break; case 'gb': case 'giob': case 'giobbe': $NormBook = 'Giobbe'; break; case 'ct': case 'cant': case 'cantico': $NormBook = 'Cantico'; break; case 'rt': case 'rut': $NormBook = 'Rut'; break; case 'lam': case 'lm': case 'lament': case 'lamentazioni': $NormBook = 'Lamentazioni'; break; case 'qo': case 'qoe': case 'qoel': case 'qoelet': case 'qohelet': case 'eccle': case 'ecclesiaste': $NormBook = 'Qoelet'; break; case 'est': case 'ester': $NormBook = 'Ester'; break; case 'dn': case 'dan': case 'daniele': $NormBook = 'Daniele'; break; case 'esd': case 'esdra': case 'esdr': $NormBook = 'Esdra'; break; case 'ne': case 'nee': case 'neemia': $NormBook = 'Neemia'; break; case '1c': case '1cr': case '1cro': case '1cron': case '1cronache': $NormBook = '1Cronache'; break; case '2c': case '2cr': case '2cro': case '2cron': case '2cronache': $NormBook = '2Cronache'; break; case 'tb': case 'tob': case 'tobia': $NormBook = 'Tobia'; break; case 'gdt': case 'giuditta': $NormBook = 'Giuditta'; break; case '1mac': case '1macc': case '1mc': case '1maccabei': $NormBook = '1Maccabei'; break; case '2mac': case '2macc': case '2mc': case '2maccabei': $NormBook = '2Maccabei'; break; case 'sp': case 'sap': case 'sapienza': $NormBook = 'Sapienza'; break; case 'sir': case 'sr': case 'siracide': case 'eccli': case 'ecclesiastico': $NormBook = 'Siracide'; break; case 'ba': case 'bar': case 'baru': case 'baruc': $NormBook = 'Baruc'; break; case 'mt': case 'mat': case 'matt': case 'matteo': $NormBook = 'Matteo'; break; case 'mc': case 'marco': $NormBook = 'Marco'; break; case 'lc': case 'lu': case 'luca': $NormBook = 'Luca'; break; case 'gv': case 'giov': case 'giovanni': $NormBook = 'Giovanni'; break; case 'at': case 'att': case 'atti': case 'attidegliapostoli': $NormBook = 'Atti'; break; case 'rm': case 'rom': case 'romani': $NormBook = 'Romani'; break; case '1co': case '1cor': case '1cori': case '1corinzi': case '1corinti': $NormBook = '1Corinzi'; break; case '2co': case '2cor': case '2cori': case '2corinzi': case '2corinti': $NormBook = '2Corinzi'; break; case 'gal': case 'galati': $NormBook = 'Galati'; break; case 'ef': case 'efe': case 'efes': case 'efesini': $NormBook = 'Efesini'; break; case 'fil': case 'flp': case 'fp': case 'filippesi': $NormBook = 'Filippesi'; break; case 'col': case 'colo': case 'colos': case 'coloss': case 'colossesi': $NormBook = 'Colossesi'; break; case '1ts': case '1tes': case '1tess': case '1tessalonicesi': $NormBook = '1Tessalonicesi'; break; case '2ts': case '2tes': case '2tess': case '2tessalonicesi': $NormBook = '2Tessalonicesi'; break; case '1tm': case '1tim': case '1timo': case '1timot': case '1timoteo': $NormBook = '1Timoteo'; break; case '2tm': case '2tim': case '2timo': case '2timot': case '2timoteo': $NormBook = '2Timoteo'; break; case 'tt': case 'ti': case 'tit': case 'tito': $NormBook = 'Tito'; break; case 'fm': case 'flm': case 'filem': case 'filemone': $NormBook = 'Filemone'; break; case 'eb': case 'ebr': case 'ebrei': $NormBook = 'Ebrei'; break; case 'gc': case 'gia': case 'giac': case 'giaco': case 'giacomo': $NormBook = 'Giacomo'; break; case '1pt': case '1pi': case '1pie': case '1piet': case '1pietro': $NormBook = '1Pietro'; break; case '2pt': case '2pi': case '2pie': case '2piet': case '2pietro': $NormBook = '2Pietro'; break; case '1gv': case '1gio': case '1giov': case '1giovanni': $NormBook = '1Giovanni'; break; case '2gv': case '2gio': case '2giov': case '2giovanni': $NormBook = '2Giovanni'; break; case '3gv': case '3gio': case '3giov': case '3giovanni': $NormBook = '3Giovanni'; break; case 'gd': case 'giud': case 'giuda': $NormBook = 'Giuda'; break; case 'ap': case 'apo': case 'apoc': case 'apoca': case 'apocal': case 'apocalisse': $NormBook = 'Apocalisse'; break; default: $msg = wfMsgForContent('bp-bad-book-name', $Book, @htmlspecialchars($Service));

$NormBook = DivError() . $msg . '';

} return $NormBook; }


  1. Abbreviates the standard long bible book name

function AbbreviatedBook($NormalizedBook) { switch ($NormalizedBook) { case 'Genesi': $AbbrBook = 'Gn'; break; case 'Esodo': $AbbrBook = 'Es'; break; case 'Levitico': $AbbrBook = 'Lv'; break; case 'Numeri': $AbbrBook = 'Nm'; break; case 'Deuteronomio': $AbbrBook = 'Dt'; break; case 'Giosuè': $AbbrBook = 'Gs'; break; case 'Giudici': $AbbrBook = 'Gdc'; break; case '1Samuele': $AbbrBook = '1Sam'; break; case '2Samuele': $AbbrBook = '2Sam'; break; case '1Re': $AbbrBook = '1Re'; break; case '2Re': $AbbrBook = '2Re'; break; case 'Isaia': $AbbrBook = 'Is'; break; case 'Geremia': $AbbrBook = 'Gr'; break; case 'Ezechiele': $AbbrBook = 'Ez'; break; case 'Osea': $AbbrBook = 'Os'; break; case 'Gioele': $AbbrBook = 'Gl'; break; case 'Amos': $AbbrBook = 'Am'; break; case 'Abdia': $AbbrBook = 'Abd'; break; case 'Giona': $AbbrBook = 'Gion'; break; case 'Michea': $AbbrBook = 'Mi'; break; case 'Naum': $AbbrBook = 'Na'; break; case 'Abacuc': $AbbrBook = 'Ab'; break; case 'Sofonia': $AbbrBook = 'Sof'; break; case 'Aggeo': $AbbrBook = 'Ag'; break; case 'Zaccaria': $AbbrBook = 'Zac'; break; case 'Malachia': $AbbrBook = 'Mal'; break; case 'Salmi': case 'SalmiE': case 'SalmiL': $AbbrBook = 'Sal'; break; case 'Proverbi': $AbbrBook = 'Pr'; break; case 'Giobbe': $AbbrBook = 'Gb'; break; case 'Cantico': $AbbrBook = 'Ct'; break; case 'Rut': $AbbrBook = 'Rut'; break; case 'Lamentazioni': $AbbrBook = 'Lam'; break; case 'Qoelet': $AbbrBook = 'Qo'; break; case 'Ester': $AbbrBook = 'Est'; break; case 'Daniele': $AbbrBook = 'Dn'; break; case 'Esdra': $AbbrBook = 'Esd'; break; case 'Neemia': $AbbrBook = 'Nee'; break; case '1Cronache': $AbbrBook = '1Cr'; break; case '2Cronache': $AbbrBook = '2Cr'; break; case 'Tobia': $AbbrBook = 'Tb'; break; case 'Giuditta': $AbbrBook = 'Gdt'; break; case '1Maccabei': $AbbrBook = '1Mac'; break; case '2Maccabei': $AbbrBook = '2Mac'; break; case 'Sapienza': $AbbrBook = 'Sap'; break; case 'Siracide': $AbbrBook = 'Sir'; break; case 'Baruc': $AbbrBook = 'Bar'; break; case 'Matteo': $AbbrBook = 'Mt'; break; case 'Marco': $AbbrBook = 'Mc'; break; case 'Luca': $AbbrBook = 'Lc'; break; case 'Giovanni': $AbbrBook = 'Gv'; break; case 'Atti': $AbbrBook = 'At'; break; case 'Romani': $AbbrBook = 'Rm'; break; case '1Corinzi': $AbbrBook = '1Cor'; break; case '2Corinzi': $AbbrBook = '2Cor'; break; case 'Galati': $AbbrBook = 'Gal'; break; case 'Efesini': $AbbrBook = 'Ef'; break; case 'Filippesi': $AbbrBook = 'Fil'; break; case 'Colossesi': $AbbrBook = 'Col'; break; case '1Tessalonicesi': $AbbrBook = '1Ts'; break; case '2Tessalonicesi': $AbbrBook = '2Ts'; break; case '1Timoteo': $AbbrBook = '1Tm'; break; case '2Timoteo': $AbbrBook = '2Tm'; break; case 'Tito': $AbbrBook = 'Tt'; break; case 'Filemone': $AbbrBook = 'Flm'; break; case 'Ebrei': $AbbrBook = 'Eb'; break; case 'Giacomo': $AbbrBook = 'Gc'; break; case '1Pietro': $AbbrBook = '1Pt'; break; case '2Pietro': $AbbrBook = '2Pt'; break; case '1Giovanni': $AbbrBook = '1Gv'; break; case '2Giovanni': $AbbrBook = '2Gv'; break; case '3Giovanni': $AbbrBook = '3Gv'; break; case 'Giuda': $AbbrBook = 'Gd'; break; case 'Apocalisse': $AbbrBook = 'Ap'; break; default: $AbbrBook = ; } return $AbbrBook; }


  1. Abbreviates the standard long bible book name

function BookArticleName($NormalizedBook) { switch ($NormalizedBook) { case 'Genesi': $BookArticleName = 'Libro_della_Genesi'; break; case 'Esodo': $BookArticleName = "Libro_dell'Esodo"; break; case 'Levitico': $BookArticleName = 'Levitico'; break; case 'Numeri': $BookArticleName = 'Numeri'; break; case 'Deuteronomio': $BookArticleName = 'Deuteronomio'; break; case 'Giosuè': $BookArticleName = 'Libro_di_Giosuè'; break; case 'Giudici': $BookArticleName = 'Libro_dei_Giudici'; break; case '1Samuele': $BookArticleName = 'Primo_libro_di_Samuele'; break; case '2Samuele': $BookArticleName = 'Secondo_libro_di_Samuele'; break; case '1Re': $BookArticleName = 'Primo_libro_dei_Re'; break; case '2Re': $BookArticleName = 'Secondo_libro_dei_Re'; break; case 'Isaia': $BookArticleName = 'Libro_di_Isaia'; break; case 'Geremia': $BookArticleName = 'Libro_di_Geremia'; break; case 'Ezechiele': $BookArticleName = 'Libro_di_Ezechiele'; break; case 'Osea': $BookArticleName = 'Libro_di_Osea'; break; case 'Gioele': $BookArticleName = 'Libro_di_Gioele'; break; case 'Amos': $BookArticleName = 'Libro_di_Amos'; break; case 'Abdia': $BookArticleName = 'Libro_di_Abdia'; break; case 'Giona': $BookArticleName = 'Libro_di_Giona'; break; case 'Michea': $BookArticleName = 'Libro_di_Michea'; break; case 'Naum': $BookArticleName = 'Libro_di_Naum'; break; case 'Abacuc': $BookArticleName = 'Libro_di_Abacuc'; break; case 'Sofonia': $BookArticleName = 'Libro_di_Sofonia'; break; case 'Aggeo': $BookArticleName = 'Libro_di_Aggeo'; break; case 'Zaccaria': $BookArticleName = 'Libro_di_Zaccaria'; break; case 'Malachia': $BookArticleName = 'Libro_di_Malachia'; break; case 'Salmi': $BookArticleName = 'Libro_dei_Salmi'; break; case 'SalmiE': $BookArticleName = 'Libro_dei_Salmi'; break; case 'SalmiL': $BookArticleName = 'Libro_dei_Salmi'; break; case 'Proverbi': $BookArticleName = 'Libro_dei_Proverbi'; break; case 'Giobbe': $BookArticleName = 'Libro_di_Giobbe'; break; case 'Cantico': $BookArticleName = 'Cantico_dei_Cantici'; break; case 'Rut': $BookArticleName = 'Libro_di_Rut'; break; case 'Lamentazioni': $BookArticleName = 'Libro_delle_Lamentazioni'; break; case 'Qoelet': $BookArticleName = 'Qoelet'; break; case 'Ester': $BookArticleName = 'Libro_di_Ester'; break; case 'Daniele': $BookArticleName = 'Libro_di_Daniele'; break; case 'Esdra': $BookArticleName = 'Libro_di_Esdra'; break; case 'Neemia': $BookArticleName = 'Libro_di_Neemia'; break; case '1Cronache': $BookArticleName = 'Primo_libro_delle_Cronache'; break; case '2Cronache': $BookArticleName = 'Secondo_libro_delle_Cronache'; break; case 'Tobia': $BookArticleName = 'Libro_di_Tobia'; break; case 'Giuditta': $BookArticleName = 'Libro_di_Giuditta'; break; case '1Maccabei': $BookArticleName = 'Primo_libro_dei_Maccabei'; break; case '2Maccabei': $BookArticleName = 'Secondo_libro_dei_Maccabei'; break; case 'Sapienza': $BookArticleName = 'Libro_della_Sapienza'; break; case 'Siracide': $BookArticleName = 'Siracide'; break; case 'Baruc': $BookArticleName = 'Libro_di_Baruc'; break; case 'Matteo': $BookArticleName = 'Vangelo_secondo_Matteo'; break; case 'Marco': $BookArticleName = 'Vangelo_secondo_Marco'; break; case 'Luca': $BookArticleName = 'Vangelo_secondo_Luca'; break; case 'Giovanni': $BookArticleName = 'Vangelo_secondo_Giovanni'; break; case 'Atti': $BookArticleName = 'Atti_degli_Apostoli'; break; case 'Romani': $BookArticleName = 'Lettera_ai_Romani'; break; case '1Corinzi': $BookArticleName = 'Prima_lettera_ai_Corinzi'; break; case '2Corinzi': $BookArticleName = 'Seconda_lettera_ai_Corinzi'; break; case 'Galati': $BookArticleName = 'Lettera_ai_Galati'; break; case 'Efesini': $BookArticleName = 'Lettera_agli_Efesini'; break; case 'Filippesi': $BookArticleName = 'Lettera_ai_Filippesi'; break; case 'Colossesi': $BookArticleName = 'Lettera_ai_Colossesi'; break; case '1Tessalonicesi': $BookArticleName = 'Prima_lettera_ai_Tessalonicesi'; break; case '2Tessalonicesi': $BookArticleName = 'Seconda_lettera_ai_Tessalonicesi'; break; case '1Timoteo': $BookArticleName = 'Prima_lettera_a_Timoteo'; break; case '2Timoteo': $BookArticleName = 'Seconda_lettera_a_Timoteo'; break; case 'Tito': $BookArticleName = 'Lettera_a_Tito'; break; case 'Filemone': $BookArticleName = 'Lettera_a_Filemone'; break; case 'Ebrei': $BookArticleName = 'Lettera_agli_Ebrei'; break; case 'Giacomo': $BookArticleName = 'Lettera_di_Giacomo'; break; case '1Pietro': $BookArticleName = 'Prima_lettera_di_Pietro'; break; case '2Pietro': $BookArticleName = 'Seconda_lettera_di_Pietro'; break; case '1Giovanni': $BookArticleName = 'Prima_lettera_di_Giovanni'; break; case '2Giovanni': $BookArticleName = 'Seconda_lettera_di_Giovanni'; break; case '3Giovanni': $BookArticleName = 'Terza_lettera_di_Giovanni'; break; case 'Giuda': $BookArticleName = 'Lettera_di_Giuda'; break; case 'Apocalisse': $BookArticleName = 'Apocalisse_di_San_Giovanni'; break; default: $BookArticleName = ; } return $BookArticleName; }