Script untuk mengadakan parsing ayat yg otomatis menjadi link/ referensi ke dbase.
Contoh www.ekaristi.org/artikel/sumarya.php
File: header.php
| Code: | <?
/**
by : me :)
email : friendship@ekaristi.org <--- silahkan kontak kalau ada problem, harap sabar dengan balasannya.
format :
pembuka --> [[
penutup --> ]]
Contoh: Kej 3:13-15 ditulis menjadi [[Kej 3:13-15]] akan tampil menjadi Kej 3:13-15 yg berupakan link ke ayat-ayat tsb
usage :
[[ bahasa, Kitab Bab Ayat1 - Ayat2 ; Kitab Bab Ayat1 - Ayat, bahasa ; dst ]] Contoh: Kej 3:13-15; Kis 2:10-13; Mrk 5:2-6 ditulis menjadi [[Kej 3:13-15; Kis 2:10-13; Mrk 5:2-6]]
Bahasa terdiri dari singkatan 3 huruf,
vul = vulgata
idb = indonesia
rhe = douay rheims
Contoh: versi douay rheims Kej 3:13-15 ditulis menjadi [[rhe,Kej 3:13-15]] tampil <rhe>Kej3:13-15
NB: notasi penulisan ayat TIDAK ada tanda titik (period)
**/
$_header_ = <<<HEADERS
<html>
<head>
<title>$page_title</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-us">
<META content="keterangan web" name=description>
<META content="keyword, katakunci web utk search engine" name=keywords>
<META content="index, follow" name=robots>
<link href="<__folder_berisi_file_style.css__>/style.css" type=text/css rel=stylesheet>
<link href="<__folder_berisi_file_favicon.ico__>/favicon.ico" rel="shortcut icon">
<script language="JavaScript" src="<__folder_berisi_file_header.js__>/header.js"></script>
</head>
<body bgcolor="#FFFFFF">
HEADERS;
/**
ganti dgn false, jika tidak ingin berupa link PopUp Windows
**/
$pop_Up = true;
if (! isset( $_file_ ) ) {
echo $_header_;
return;
}
$f = implode('', file($_file_) );
$f = preg_replace('|<\?.*?\?>|s', '', $f, 1);
echo $_header_;
$tmp = tempnam('/tmp','_f_');
$fw = fopen($tmp, 'w');
fwrite($fw, _vars_($_file_));
fwrite($fw, $f);
fclose($fw);
$fo = shell_exec('/usr/local/bin/php -q ' . $tmp);
unlink ($tmp);
echo _bdb_parse($fo);
exit;
function _bdb_q($q) {
global $pop_Up;
if ($pop_Up) {
$a = <<<TMP
<a onClick="bdb_Pop('<_q_>', 500, 220)" href="javascript:void"><_qa_></a>
TMP;
}
else {
$a = <<<AYT
<a href='http://ekaristi.org/bible/bq.php?q=<_q_>' target=_blank><_qa_></a>
AYT;
}
$qq = '[['.$q.']]';
$p = array();
$p[] = '|(<[^>]+>)+|';
$p[] = '|[^a-z0-9,;:\-]+|i';
$q = preg_replace($p, '', $q);
if ( preg_match('|[,:;\-]|s', $q) ) {
$q = preg_replace('|[\s]+|','',$q);
$a = preg_replace('|<_q_>|', htmlspecialchars($q), $a);
$qc = @explode(';', $q);
foreach ( $qc as $qr ) {
$v = @explode(',', $qr);
if ( count($v)>1 ) {
if ( ! preg_match('|[0-9]+:[0-9]+|s', $qr) ) { return $qq; }
if ( strlen($v[0])>3 && strlen($v[1])<4 ) { $v = array_reverse($v); }
if ( strlen($v[0])==3 ) { $t .= '<'.$v[0].'>' . $v[1]; }
else if ( strlen($v[1])>3 ) { $t .= $v[1]; }
else { return $qq; }
}
else {
$t .= $v[0];
}
$t .= ' ; ';
}
$t = preg_replace('|\s\;\s$|', '', $t);
$a = preg_replace('|<_qa_>|', htmlspecialchars($t), $a);
return $a;
}
return $qq;
}
function _bdb_parse($f) {
return preg_replace("#\[\[(.*?)\]\]#ise", "_bdb_q('\\1')", $f);
}
function _vars_($f) {
$self = $_SERVER['PHP_SELF'];
$p = dirname ($f);
while ( list($key,$val) = each( $_FILES )) {
$val = preg_replace('|[\n]+|','',$val);
$line .= ' $_FILES["'.$key.'"] = \'' . $val . "';\n";
}
while ( list($key,$val) = each( $_ENV )) {
$val = preg_replace('|[\n]+|','',$val);
$line .= ' $_ENV["'.$key.'"] = \'' . $val . "';\n";
}
while ( list($key,$val) = each( $_GET )) {
$val = preg_replace('|[\n]+|','',$val);
$line .= ' $_GET["'.$key.'"] = \'' . $val . "';\n";
}
while ( list($key,$val) = each( $_POST )) {
$val = preg_replace('|[\n]+|','',$val);
$line .= ' $_POST["'.$key.'"] = \'' . $val . "';\n";
}
while ( list($key,$val) = each( $_COOKIE )) {
$val = preg_replace('|[\n]+|','',$val);
$line .= ' $_COOKIE["'.$key.'"] = \'' . $val . "';\n";
}
while ( list($key,$val) = each( $_SERVER )) {
$val = preg_replace('|[\n]+|','',$val);
$line .= ' $_SERVER["'.$key.'"] = \'' . $val . "';\n";
}
while ( list($key,$val) = @each( $_SESSION )) {
$val = preg_replace('|[\n]+|','',$val);
$line .= ' $_SESSION["'.$key.'"] = \'' . $val . "';\n";
}
return <<<SRV
<?php
$line
\$PHP_SELF = '$self';
ini_set('include_path', '$p');
?>
SRV;
}
?> |
File: footer.php
| Code: | <div align="center">
<center>
copyright bla bla ...
</center>
</div>
</body>
</html> |
File: header.js
| Code: |
function bdb_Pop(q,w,h) {
var x = (screen.width-w)/2;
var y = (screen.height-h)/2;
return window.open(
'http://ekaristi.org/bible/bq.php?q='+q,
'BDB',
'width=' + w + ',' +
'height=' + h + ',' +
'screenX=' + x + ',' +
'screenY=' + y + ',' +
'left=' + x + ',' +
'top=' + y + ',' +
'scrollbars,alwaysRaised,resizable'
);
}
function popUp(query,w,h) {
var x = (screen.width-w)/2;
var y = (screen.height-h)/2;
return window.open(
"http://ekaristi.org/bible/bdb.php?q=" + query + "&f=1",
"BDB",
"width=" + w + "," +
"height=" + h + "," +
"screenX=" + x + "," +
"screenY=" + y + "," +
"left=" + x + "," +
"top=" + y + "," +
"scrollbars,alwaysRaised,resizable"
);
} |
File: template.php
| Code: | <?php
$_file_ = __FILE__;
$page_title ='Judul Halaman';
require( $_SERVER['DOCUMENT_ROOT'] . '/<__folder_berisi_file_header.php__>/header.php' );
?>
Isi / content, body html, text, dst, dst
<?php
sisipan kode-kode php, dst, dst
?>
lainnya...
<?php
require( $_SERVER['DOCUMENT_ROOT'] . '</__folder_berisi_file_footer.php__/footer.php');
?> |
_________________ Salam dan doa
F A Q
It fails to show just how the world is divided. Evil stands for division against unity. In union with God and His miracles I see my self everyday in the mirror. I am a miracle that science still is at it's heels glancing up a vast yet unacceptable impossibility, a climb to faith. Science can't and will never explain God, for science is only capable in calculating the calculable. How is science to measure anything outside of time and space that started time and space, how is the created to measure the creator? Science is an apathy of one who seeks his heart and yet refuse to see it, Tony B Mat 12:32 Jangan membohongi diri! | Indonesia Katolik -Terjemahan Baru © Ekaristi dot Org | | Matius 12:32 | Apabila seorang mengucapkan sesuatu menentang Anak Manusia, ia akan diampuni, tetapi jika ia menentang Roh Kudus, ia tidak akan diampuni, di dunia ini tidak, dan di dunia yang akan datangpun tidak. |
|