Skip to content

Commit

Permalink
created handling for NABRE text and styles
Browse files Browse the repository at this point in the history
  • Loading branch information
Lwangaman authored and Lwangaman committed Mar 22, 2015
1 parent cae0695 commit 43314fe
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 44 deletions.
82 changes: 47 additions & 35 deletions bibleget-io.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
Plugin Name: BibleGet I/O
Version: 2.7
Version: 2.8
Plugin URI: http://www.bibleget.io/
Description: Easily insert Bible quotes from a choice of Bible versions into your articles or pages with the shortcode [bibleget].
Author: John Romano D'Orazio
Expand Down Expand Up @@ -112,7 +112,9 @@ function bibleget_shortcode($atts, $content = null) {
$a = shortcode_atts(array(
'query' => "Matthew1:1-5",
'version' => "",
'versions' => ""), $atts);
'versions' => "",
'forceversion' => false,
'forcecopyright' => false), $atts);

//echo "<div style=\"border:10px solid Blue;\">".$a["query"]."</div>";

Expand All @@ -139,40 +141,43 @@ function bibleget_shortcode($atts, $content = null) {
}
$validversions = array_keys($vversions);
//echo "<div style=\"border:10px solid Blue;\">".print_r($validversions)."</div>";

foreach($versions as $version){
if(!in_array($version,$validversions)){
$optionsurl = admin_url("options-general.php?page=bibleget-settings-admin");
/* translators: you must not change the placeholders \"%s\" or the html <a href=\"%s\">, </a> */
$output = '<span style="color:Red;font-weight:bold;">'.sprintf(__('The requested version "%s" is not valid, please check the list of valid versions in the <a href="%s">settings page</a>',"bibleget-io"),$version,$optionsurl).'</span>';
return '<div class="bibleget-quote-div">' . $output . '</div>';
}
if($a['forceversion'] != "true"){
foreach($versions as $version){
if(!in_array($version,$validversions)){
$optionsurl = admin_url("options-general.php?page=bibleget-settings-admin");
/* translators: you must not change the placeholders \"%s\" or the html <a href=\"%s\">, </a> */
$output = '<span style="color:Red;font-weight:bold;">'.sprintf(__('The requested version "%s" is not valid, please check the list of valid versions in the <a href="%s">settings page</a>',"bibleget-io"),$version,$optionsurl).'</span>';
return '<div class="bibleget-quote-div">' . $output . '</div>';
}
}
}

$queries = queryClean($a["query"]);
if (is_array ( $queries )) {
$goodqueries = processQueries ( $queries, $versions );
// write_log("value of goodqueries after processQueries:");
// write_log($goodqueries);
if ($goodqueries === false) {
$output = "goodqueries returned false";
return '<div class="bibleget-quote-div">' . $output . '</div>';
}
$finalquery = "query=";
$finalquery .= implode ( ";", $goodqueries );
$finalquery .= "&version=";
$finalquery .= implode ( ",", $versions );
// write_log("value of finalquery = ".$finalquery);
if ($finalquery != "") {
// $output = $finalquery;
// return '<div class="bibleget-quote-div">' . $output . '</div>';
$output = queryServer ( $finalquery );
return '<div class="bibleget-quote-div">' . $output . '</div>';
}
} else {

$queries = queryClean($a["query"]);
if (is_array ( $queries )) {
$goodqueries = processQueries ( $queries, $versions );
// write_log("value of goodqueries after processQueries:");
// write_log($goodqueries);
if ($goodqueries === false) {
$output = "goodqueries returned false";
return '<div class="bibleget-quote-div">' . $output . '</div>';
}
$finalquery = "query=";
$finalquery .= implode ( ";", $goodqueries );
$finalquery .= "&version=";
$finalquery .= implode ( ",", $versions );
if($a['forceversion']=="true"){ $finalquery .= "&forceversion=true"; }
if($a['forcecopyright']=="true"){ $finalquery .= "&forcecopyright=true"; }
// write_log("value of finalquery = ".$finalquery);
if ($finalquery != "") {
// $output = $finalquery;
// return '<div class="bibleget-quote-div">' . $output . '</div>';
$output = queryServer ( $finalquery );
return '<div class="bibleget-quote-div">' . $output . '</div>';
}
} else {
/* translators: do not translate "shortcode" unless the version of wordpress in your language uses a translated term to refer to shortcodes */
$output = '<span style="color:Red;font-weight:bold;">' . __( "There are errors in the shortcode, please check carefully your query syntax:", "bibleget-io" ) . '&lt;'.$a['query'].'&gt;<br />' . $queries . '</span>';
return '<div class="bibleget-quote-div">' . $output . '</div>';
$output = '<span style="color:Red;font-weight:bold;">' . __( "There are errors in the shortcode, please check carefully your query syntax:", "bibleget-io" ) . '&lt;'.$a['query'].'&gt;<br />' . $queries . '</span>';
return '<div class="bibleget-quote-div">' . $output . '</div>';
}

}
Expand All @@ -191,9 +196,16 @@ function queryServer($finalquery){
}
$output = curl_exec($ch);
if($output && !curl_errno($ch)){
// remove style and title tags from the output
// remove style and title tags from the output if they are present (should not be present with more recent BibleGet engine
$output = substr($output,0,strpos($output, "<style")) . substr($output,strpos($output, "</style"),strlen($output));
$output = substr($output,0,strpos($output, "<title")) . substr($output,strpos($output, "</title"),strlen($output));

$count1 = null;
$count2 = null;
$output = preg_replace('/&lt;(sm|pof|po|pol|pos|poif|poi|poil|po3|po3l)&gt;/', '<span class="$1">',$output,-1,$count1);
$output = preg_replace('/&lt;\/(sm|pof|po|pol|pos|poif|poi|poil|po3|po3l)&gt;/','</span>',$output,-1,$count2);
//$output .= "<br /><br />Effettuate ".$count1." e ".$count2." sostituzioni.";

}
else{
$output = '<span style="color:Red;font-weight:bold;">'.__("There was an error communicating with the BibleGet server, please wait a few minutes and try again: ","bibleget-io").' &apos;'.curl_error($ch).'&apos;: '.$finalquery.'</span>';
Expand Down
54 changes: 53 additions & 1 deletion css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,56 @@ div.results p.verses span.sup {
font-style: normal;
color: #c10005;
top: -0.6em;
}
}

div.results {
border: 1px solid LightGray;
border-radius:6px;
padding: 12px;
margin:12px auto;
width: 80%;
font-family: 'Palatino Linotype';
}

div.results p.book {
font-weight: bold;
font-style: normal;
font-size: 1.4em;
color: #284f29;
margin: 0px;
}

div.results p.verses {
font-weight: normal;
font-style: normal;
line-height: 150%;
color: #646d73;
text-align: justify;
font-size: 1.0em;
margin: 0px;
font-variant: normal;
}

div.results p.verses span.sup {
font-size: 0.8em;
vertical-align: baseline;
position: relative;
font-weight: normal;
font-style: normal;
color: #c10005;
top: -0.6em;
}

div.results p.verses span.sm {
text-transform: lowercase;
font-variant: small-caps;
}

/* Senseline. A line that is broken to be reading aloud/public speaking. Poetry is included in this category. */
div.results p.verses span.pof {display: block; text-indent: 0; font-style:italic; margin-top:1em; margin-left:5%; font-family:Serif; }
div.results p.verses span.po {display: block; font-style:italic; margin-left:5%; margin-top:-1%; font-family:Serif; }
div.results p.verses span.pol {display: block; font-style:italic; margin-left:5%; margin-top:-1%; margin-bottom:1em; font-family:Serif; }
div.results p.verses span.pos {display: block; font-style:italic; margin-top:1em; margin-left:5%; font-family:Serif; }
div.results p.verses span.poif {display: block; font-style:italic; margin-left:7%; margin-top:1%; font-family:Serif; }
div.results p.verses span.poi {display: block; font-style:italic; margin-left:7%; margin-top:-1%; font-family:Serif; }
div.results p.verses span.poil {display: block; font-style:italic; margin-left:7%; margin-bottom:1%; font-family:Serif; }
Binary file modified languages/bibleget-io-it_IT.mo
Binary file not shown.
4 changes: 2 additions & 2 deletions languages/bibleget-io-it_IT.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ msgstr ""
"Project-Id-Version: BibleGet I/O 1.5\n"
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/bibleget-io\n"
"POT-Creation-Date: 2015-02-14 16:29:15+00:00\n"
"PO-Revision-Date: 2015-02-14 17:47+0100\n"
"PO-Revision-Date: 2015-03-22 00:23+0100\n"
"Last-Translator: John R. D'Orazio <donjohn.fmmi@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
Expand All @@ -32,7 +32,7 @@ msgid ""
"versions in the <a href=\"%s\">settings page</a>"
msgstr ""
"La versione richiesta \"%s\" non è valida, si prega verificare l'elenco "
"delle versioni valida alla <a href=\"%s\">Pagina delle Impostazioni</a>"
"delle versioni valide alla <a href=\"%s\">Pagina delle Impostazioni</a>"

#. translators: do not translate "shortcode" unless the version of wordpress in
#. your language uses a translated term to refer to shortcodes
Expand Down
11 changes: 10 additions & 1 deletion options.php
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,16 @@ public function do_on_my_plugin_settings_save()
." text-decoration: ".($versenumbers_underline ? "underline" : ($versenumbers_strikethrough ? "line-through" : "none"))."; \n"
." color: ".(isset($this->options['fontcolor_versenumbers']) && $this->options['fontcolor_versenumbers'] ? $this->options['fontcolor_versenumbers'] : "Red")."; \n"
." ".($versenumbers_superscript ? "top: -0.6em" : ($versenumbers_subscript ? "bottom: -0.6em" : "top: 0em") )."; \n"
."}";
."} \n"
." \n"
."/* Senseline. A line that is broken to be reading aloud/public speaking. Poetry is included in this category. */ \n"
."div.results p.verses span.pof {display: block; text-indent: 0; font-style:italic; margin-top:1em; margin-left:5%; font-family:Serif; } \n"
."div.results p.verses span.po {display: block; font-style:italic; margin-left:5%; margin-top:-1%; font-family:Serif; } \n"
."div.results p.verses span.pol {display: block; font-style:italic; margin-left:5%; margin-top:-1%; margin-bottom:1em; font-family:Serif; } \n"
."div.results p.verses span.pos {display: block; font-style:italic; margin-top:1em; margin-left:5%; font-family:Serif; } \n"
."div.results p.verses span.poif {display: block; font-style:italic; margin-left:7%; margin-top:1%; font-family:Serif; } \n"
."div.results p.verses span.poi {display: block; font-style:italic; margin-left:7%; margin-top:-1%; font-family:Serif; } \n"
."div.results p.verses span.poil {display: block; font-style:italic; margin-left:7%; margin-bottom:1%; font-family:Serif; } \n";
$cssdata = trim($cssdata);
$file = plugin_dir_path( __FILE__ ) . 'css/styles.css';
if(file_exists($file)){
Expand Down
18 changes: 13 additions & 5 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
Tags: bible,shortcode,quote,citation
Requires at least: 3.0.1
Tested up to: 4.1.0
Stable tag: 2.7
Stable tag: 2.8
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -58,8 +58,10 @@ Nachdem Sie Ihre Auswahl im Bereich Einstellungen vorgenommen haben, denken Sie
Sie können auch festlegen, im Bereich Einstellungen, um die CSS-Datei direkt bearbeiten, wenn Sie möchten, um eine feinere Kontrolle über das Aussehen haben.

THE AUTHOR WOULD LIKE TO THANK THE FOLLOWING USERS FOR CONTRIBUTED TRANSLATIONS:
* SERBIAN TRANSLATION: Ogi Djuraskovic <ognjend@firstsiteguide.com> [firstsiteguide](http://firstsiteguide.com "firstsiteguide")
* POLISH TRANSLATION: Ula Gnatowska <ula.gnatowska@gmail.com> [comunità delle beatitudini](http://beatitudini.it/ "comunità delle beatitudini")

SERBIAN TRANSLATION: Ogi Djuraskovic <ognjend@firstsiteguide.com> WEBSITE: [firstsiteguide](http://firstsiteguide.com "firstsiteguide")

POLISH TRANSLATION: Ula Gnatowska <ula.gnatowska@gmail.com> WEBSITE: [comunità delle beatitudini](http://beatitudini.it/ "comunità delle beatitudini")

[BibleGet I/O](
http://www.bibleget.io/
Expand Down Expand Up @@ -124,6 +126,9 @@ Almeno la prima query deve indicare il nome del libro sul quale effettuare la ri

== Changelog ==

= 2.8 =
* Added specific functionality for parsing NABRE text and applying NABRE specific styles

= 2.7 =
* Added Polish translation thanks to Ula Gnatowska Ula Gnatowska <ula.gnatowska@gmail.com> [comunità delle beatitudini](http://beatitudini.it/ "comunità delle beatitudini")
* Added Serbian translation thanks to Ogi Djuraskovic <ognjend@firstsiteguide.com> [firstsiteguide](http://firstsiteguide.com "firstsiteguide")
Expand Down Expand Up @@ -179,11 +184,14 @@ Almeno la prima query deve indicare il nome del libro sul quale effettuare la ri

== Upgrade Notice ==

= 2.8 =
Added Serbian and Polish translations, added specific functionality for parsing NABRE text and applying NABRE specific styles.

= 2.7 =
Added Serbian and Polish translations
Added Serbian and Polish translations.

= 2.6 =
Minor bugfix from version 2.5, added serbian translation.
Minor bugfix from version 2.5, added Serbian translation.

= 2.5 =
This is a major release which uses the new and upgraded BibleGet I/O service engine. Must update. (plus Bugfixes)
Expand Down

0 comments on commit 43314fe

Please sign in to comment.