0) { * $ref = $matches[0]; * $url = "$ref"; * $parts = explode($ref, $remaining, 2); * $done .= $parts[0] . $url; * $remaining = $parts[1]; * } else { * $done .= $remaining; * $remaining = ""; * } * } * * return $done; * } * ?> * * * Copyright (C) 2002 Greg Hamerly (greg_hamerly at baylor dot edu) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. or see http://www.gnu.org/copyleft/gpl.html */ /* the list of bible books */ $bible_books = array( "Gen(esis)?", "Gn", "Ex(odus)?", "Le(v(iticus)?)?", "Lv", "Nu(m(bers)?)?", "Nm", "De(ut(eronomy)?)?", "Jos(h(ua)?)?", "Js", "Judg(es)?", "Jdg?", "Ru(th)?", "[12] *Sa(m(uel)?)?", "[12] *Ki(ngs?)?", "[12] *Ch(r(onicles)?)?", "Ez(ra?)?", "Ne(h(emiah)?)?", "Es(t(her)?)?", "Job", "Ps(a(lms?)?)?", "Pr(ov(erbs)?)?", "Ec(c(lesiastes)?)?", "Song( of S(olomon|ongs)?)?", "Is(aiah)?", "Je(r(emiah)?)?", "La(m(entations)?)?", "Eze(k(iel)?)?", "Da(n(iel)?)?", "Ho(s(ea)?)?", "Joel?", "Am(os)?", "Ob(ad(iah)?)?", "Jon(ah)?", "Mic(ah)?", "Na(h(um)?)?", "Hab(ak(kuk)?)?", "Zep(h(aniah)?)?", "Hag(g(ai)?)?", "Zec(h(ariah)?)?", "Mal(achi)?", "Mat(t(hew)?)?", "Mark?", "Mk", "Lu(ke?)?", "Lk", "John?", "Jn", "Ac(ts)?", "Ro(m(ans)?)?", "Rm", "[12] *Co(r(inthians)?)?", "Ga(l(atians)?)?", "Ep(h(esians)?)?", "Ph(il(ippians)?)?", "Col(oss(ians)?)?", "[12] *Th(ess(alonians)?)?", "[12] *Ti(m(othy)?)?", "Ti(t(us)?)?", "Phile(m(on)?)?", "Heb(r(ews)?)?", "Ja(m(es)?)?", "[12] *Pe(t(er)?)?", "[123] *(Jo(hn)?)", "[123] *Jn", "Ju(de?)?", "Re(v(elations?)?)?" ); /* references can be: * chapter [0-9]{1,3} * chapter:verse [0-9]{1,3}:[0-9]{1,3} */ $n = "[0-9]{1,3}"; // define a reference for a single chapter or verse $r1 = "($n(:$n)?)"; // add the ability to have a range (passage) $r2 = "($r1)( *- *($r1))?"; // add the ability to have several disjoint passages from the same // book $reference = "($r2)([,;] *($r2))*"; // recognize any of the names of the books $bible_books_re = join("|", $bible_books); // the full regular expression -- book names + references, on word // boundaries $full_bibleref_re = "\b($bible_books_re) +($reference)?\b"; ?>