Stable release of v2.0.3

Fixed getBible/support#2 so that the view value does not result into Undefined. Fixed getBible/support#3 so that empty translations and translations without the selected books better manage the mismatching query.
This commit is contained in:
Robot 2023-07-26 19:53:35 +02:00
parent cc1678dc49
commit 64cb76436b
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
10 changed files with 107 additions and 34 deletions

View File

@ -12,4 +12,9 @@
# v2.0.2 # v2.0.2
- Adds missing Marked JS file - Adds missing Marked JS file
# v2.0.3
- Fixed getBible/support#2 so that the view value does not result into Undefined.
- Fixed getBible/support#3 so that empty translations and translations without the selected books better manage the mismatching query.

View File

@ -1,4 +1,4 @@
# Get Bible (2.0.2) # Get Bible (2.0.3)
![Get Bible image](https://git.vdm.dev/getBible/joomla-component/raw/branch/master/admin/assets/images/vdm-component.jpg "GetBible") ![Get Bible image](https://git.vdm.dev/getBible/joomla-component/raw/branch/master/admin/assets/images/vdm-component.jpg "GetBible")
@ -19,7 +19,7 @@ In essence, The Bible for Joomla is designed to transform how the Word of God is
+ *Name*: [Get Bible](https://getbible.net) + *Name*: [Get Bible](https://getbible.net)
+ *First Build*: 3rd December, 2015 + *First Build*: 3rd December, 2015
+ *Last Build*: 26th July, 2023 + *Last Build*: 26th July, 2023
+ *Version*: 2.0.2 + *Version*: 2.0.3
+ *Copyright*: Copyright (C) 2015. All Rights Reserved + *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
@ -31,19 +31,19 @@ due to [Automated Component Builder](https://www.joomlacomponentbuilder.com))
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> never making one mistake or taking any coffee break.) > never making one mistake or taking any coffee break.)
+ *Line count*: **189871** + *Line count*: **189942**
+ *File count*: **1662** + *File count*: **1663**
+ *Folder count*: **161** + *Folder count*: **161**
**349 Hours** or **44 Eight Hour Days** (the actual time the author spent) **350 Hours** or **44 Eight Hour Days** (the actual time the author spent)
> (with the following break down: > (with the following break down:
> **debugging @132hours** = codingtime / 4; > **debugging @133hours** = codingtime / 4;
> **planning @76hours** = codingtime / 7; > **planning @76hours** = codingtime / 7;
> **mapping @53hours** = codingtime / 10; > **mapping @53hours** = codingtime / 10;
> **office @88hours** = codingtime / 6;) > **office @88hours** = codingtime / 6;)
**879 Hours** or **110 Eight Hour Days** **880 Hours** or **110 Eight Hour Days**
(a total of the realistic time frame for this project) (a total of the realistic time frame for this project)
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,

View File

@ -1,4 +1,4 @@
# Get Bible (2.0.2) # Get Bible (2.0.3)
![Get Bible image](https://git.vdm.dev/getBible/joomla-component/raw/branch/master/admin/assets/images/vdm-component.jpg "GetBible") ![Get Bible image](https://git.vdm.dev/getBible/joomla-component/raw/branch/master/admin/assets/images/vdm-component.jpg "GetBible")
@ -19,7 +19,7 @@ In essence, The Bible for Joomla is designed to transform how the Word of God is
+ *Name*: [Get Bible](https://getbible.net) + *Name*: [Get Bible](https://getbible.net)
+ *First Build*: 3rd December, 2015 + *First Build*: 3rd December, 2015
+ *Last Build*: 26th July, 2023 + *Last Build*: 26th July, 2023
+ *Version*: 2.0.2 + *Version*: 2.0.3
+ *Copyright*: Copyright (C) 2015. All Rights Reserved + *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
@ -31,19 +31,19 @@ due to [Automated Component Builder](https://www.joomlacomponentbuilder.com))
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> never making one mistake or taking any coffee break.) > never making one mistake or taking any coffee break.)
+ *Line count*: **189871** + *Line count*: **189942**
+ *File count*: **1662** + *File count*: **1663**
+ *Folder count*: **161** + *Folder count*: **161**
**349 Hours** or **44 Eight Hour Days** (the actual time the author spent) **350 Hours** or **44 Eight Hour Days** (the actual time the author spent)
> (with the following break down: > (with the following break down:
> **debugging @132hours** = codingtime / 4; > **debugging @133hours** = codingtime / 4;
> **planning @76hours** = codingtime / 7; > **planning @76hours** = codingtime / 7;
> **mapping @53hours** = codingtime / 10; > **mapping @53hours** = codingtime / 10;
> **office @88hours** = codingtime / 6;) > **office @88hours** = codingtime / 6;)
**879 Hours** or **110 Eight Hour Days** **880 Hours** or **110 Eight Hour Days**
(a total of the realistic time frame for this project) (a total of the realistic time frame for this project)
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,

View File

@ -0,0 +1 @@

View File

@ -7,9 +7,9 @@
<authorUrl>https://getbible.net</authorUrl> <authorUrl>https://getbible.net</authorUrl>
<copyright>Copyright (C) 2015. All Rights Reserved</copyright> <copyright>Copyright (C) 2015. All Rights Reserved</copyright>
<license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license> <license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license>
<version>2.0.2</version> <version>2.0.3</version>
<description><![CDATA[ <description><![CDATA[
<h1>Get Bible (v.2.0.2)</h1> <h1>Get Bible (v.2.0.3)</h1>
<div style="clear: both;"></div> <div style="clear: both;"></div>
<p>Welcome to the next level of scripture engagement - The Bible for Joomla! Our purpose is to bring the Word of God to every person, in their native language, entirely free. This isn't just a typical extension; it's a groundbreaking tool developed to span language divides and deliver a rich, customizable Bible study experience to users worldwide. <p>Welcome to the next level of scripture engagement - The Bible for Joomla! Our purpose is to bring the Word of God to every person, in their native language, entirely free. This isn't just a typical extension; it's a groundbreaking tool developed to span language divides and deliver a rich, customizable Bible study experience to users worldwide.

View File

@ -1539,7 +1539,7 @@ class com_getbibleInstallerScript
echo '<a target="_blank" href="https://getbible.net" title="Get Bible"> echo '<a target="_blank" href="https://getbible.net" title="Get Bible">
<img src="components/com_getbible/assets/images/vdm-component.jpg"/> <img src="components/com_getbible/assets/images/vdm-component.jpg"/>
</a> </a>
<h3>Upgrade to Version 2.0.2 Was Successful! Let us know if anything is not working as expected.</h3>'; <h3>Upgrade to Version 2.0.3 Was Successful! Let us know if anything is not working as expected.</h3>';
// Set db if not set already. // Set db if not set already.
if (!isset($db)) if (!isset($db))

View File

@ -199,6 +199,7 @@ COM_GETBIBLE_VERSE="Verse"
COM_GETBIBLE_VERSES="Verses" COM_GETBIBLE_VERSES="Verses"
COM_GETBIBLE_VERSE_NUMBER="Verse Number" COM_GETBIBLE_VERSE_NUMBER="Verse Number"
COM_GETBIBLE_VIEW_ALL_VERSES_TAGGED="View all verses tagged." COM_GETBIBLE_VIEW_ALL_VERSES_TAGGED="View all verses tagged."
COM_GETBIBLE_WERE_SORRY_THE_TRANSLATION_YOU_SELECTED_DOES_NOT_INCLUDE_THE_BOOK_YOU_WERE_IN_PREVIOUSLY_HOWEVER_WE_HAVE_LOCATED_BSB_WHICH_MIGHT_BE_OF_INTEREST_TO_YOU="We're sorry, the translation you selected does not include the book you were in previously. However, we have located <b>%s</b> which might be of interest to you."
COM_GETBIBLE_WE_CURRENTLY_HAVE_BSB_VERSES_STORED_IN_THE_DATABASE_FOR_THIS_PARTICULAR_TRANSLATION="We currently have <b>%s</b> verses stored in the database for this particular translation." COM_GETBIBLE_WE_CURRENTLY_HAVE_BSB_VERSES_STORED_IN_THE_DATABASE_FOR_THIS_PARTICULAR_TRANSLATION="We currently have <b>%s</b> verses stored in the database for this particular translation."
COM_GETBIBLE_WHAT_IS_THIS_HASH_ALL_ABOUT_CLICK_HERE_TO_READ_MORE="What is this Hash all about? Click here to read more..." COM_GETBIBLE_WHAT_IS_THIS_HASH_ALL_ABOUT_CLICK_HERE_TO_READ_MORE="What is this Hash all about? Click here to read more..."
COM_GETBIBLE_WITHOUT_SELECTING_THE_CORRECT_FAVOURITE_VERSE_YOU_CANT_PERFORM_THE_INITIAL_ACTION="Without selecting the correct favourite verse, you can't perform the initial action." COM_GETBIBLE_WITHOUT_SELECTING_THE_CORRECT_FAVOURITE_VERSE_YOU_CANT_PERFORM_THE_INITIAL_ACTION="Without selecting the correct favourite verse, you can't perform the initial action."

View File

@ -104,10 +104,10 @@ class GetbibleModelApp extends ItemModel
} }
// we get all the Scripture Details // we get all the Scripture Details
$this->translation = $this->input->getString('t') ?? $this->input->getString('version') ?? $this->input->getString('translation', 'kjv') ; $this->translation = $this->input->getString('translation') ?? $this->input->getString('t', 'kjv');
$this->book = $this->input->getInt('b') ?? $this->input->getInt('book'); $this->book = $this->input->getInt('book') ?? $this->input->getInt('b');
$this->chapter = $this->input->getInt('c') ?? $this->input->getInt('chapter', 1); $this->chapter = $this->input->getInt('chapter') ?? $this->input->getInt('c', 1);
$this->verses = $this->input->getString('v') ?? $this->input->getString('verses'); $this->verses = $this->input->getString('verses') ?? $this->input->getString('verse') ?? $this->input->getString('v');
$pk = 0; $pk = 0;
// try the ref string // try the ref string
@ -155,15 +155,31 @@ class GetbibleModelApp extends ItemModel
// we load the queried chapter // we load the queried chapter
if (!Factory::_('GetBible.Watcher')->api($this->translation, $this->book, $this->chapter)) if (!Factory::_('GetBible.Watcher')->api($this->translation, $this->book, $this->chapter))
{ {
$this->book = Factory::_('GetBible.Watcher')->getNextBook($this->translation, $this->book); $book = Factory::_('GetBible.Watcher')->getNextBook($this->translation, $this->book);
$this->chapter = 1; $this->chapter = 1;
$this->verses = null; $this->verses = null;
// so we try to load this one last time // so we try to load this one last time
if (!Factory::_('GetBible.Watcher')->api($this->translation, $this->book, $this->chapter)) if (empty($book) || !Factory::_('GetBible.Watcher')->api($this->translation, $book, $this->chapter))
{ {
return false; return false;
} }
// we found another book
$this->book = $book;
// since we could not find the book we where looking for, we redirect to what we found
$app = JFactory::getApplication();
// get the book name
$name = $this->getBookName($this->book, $this->translation) ?? $book;
// we state this obvious result to the user
$app->enqueueMessage(JText::sprintf("COM_GETBIBLE_WERE_SORRY_THE_TRANSLATION_YOU_SELECTED_DOES_NOT_INCLUDE_THE_BOOK_YOU_WERE_IN_PREVIOUSLY_HOWEVER_WE_HAVE_LOCATED_BSB_WHICH_MIGHT_BE_OF_INTEREST_TO_YOU", $name), 'warning');
$app->redirect(JRoute::_('index.php?option=com_getbible&view=app&t=' . $this->translation . '&ref=' . $name));
return false;
} }
// [or] we load the next chapter // [or] we load the next chapter
@ -681,7 +697,7 @@ class GetbibleModelApp extends ItemModel
$chapter = 1; $chapter = 1;
// make sure its loaded // make sure its loaded
if ($book === null || !Factory::_('GetBible.Watcher')->api($this->translation, $book, $chapter)) if (empty($book) || !Factory::_('GetBible.Watcher')->api($this->translation, $book, $chapter))
{ {
return false; return false;
} }
@ -802,7 +818,7 @@ class GetbibleModelApp extends ItemModel
$book = Factory::_('GetBible.Watcher')->getPreviousBook($this->translation, $this->book); $book = Factory::_('GetBible.Watcher')->getPreviousBook($this->translation, $this->book);
// make sure its loaded // make sure its loaded
if ($book === null || !Factory::_('GetBible.Watcher')->api($this->translation, $book, 1)) if (empty($book) || !Factory::_('GetBible.Watcher')->api($this->translation, $book, 1))
{ {
return false; return false;
} }
@ -1646,6 +1662,36 @@ class GetbibleModelApp extends ItemModel
return $items; return $items;
} }
/**
* Get the book name
*
* @param int $book The book number
*
* @return string|null The book name on success
*/
protected function getBookName(int $book, string $translation): ?string
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Get from #__getbible_book as a
$query->select($db->quoteName(
array('a.name'),
array('name')));
$query->from($db->quoteName('#__getbible_book', 'a'));
$query->where('a.abbreviation = ' . $db->quote($translation));
$query->where('a.nr = ' . $book);
// Reset the query using our newly populated query object.
$db->setQuery($query);
return $db->loadResult();
}
/** /**
* Method to add html span tag to each word in each verse * Method to add html span tag to each word in each verse
* *

View File

@ -38,8 +38,9 @@ class GetbibleRouter extends JComponentRouterBase
public function build(&$query) public function build(&$query)
{ {
$segments = []; $segments = [];
$view = $query['view'] ?? 'app';
if ($query['view'] === 'search') if ($view === 'search')
{ {
$segments[0] = 'search'; $segments[0] = 'search';
$segments[1] = $query['t'] ?? $query['version'] ?? $query['translation'] ?? 'kjv'; $segments[1] = $query['t'] ?? $query['version'] ?? $query['translation'] ?? 'kjv';
@ -112,7 +113,7 @@ class GetbibleRouter extends JComponentRouterBase
$segments[3] = $query['search'] ?? $query['s'] ?? ''; $segments[3] = $query['search'] ?? $query['s'] ?? '';
} }
elseif ($query['view'] === 'openai') elseif ($view === 'openai')
{ {
$segments[0] = 'openai'; $segments[0] = 'openai';
$segments[1] = $query['guid'] ?? ''; $segments[1] = $query['guid'] ?? '';
@ -132,13 +133,13 @@ class GetbibleRouter extends JComponentRouterBase
unset($segments[6]); unset($segments[6]);
} }
} }
elseif ($query['view'] === 'api') elseif ($view === 'api')
{ {
$segments[0] = 'api'; $segments[0] = 'api';
$segments[1] = $query['t'] ?? $query['version'] ?? $query['translation'] ?? 'kjv'; $segments[1] = $query['t'] ?? $query['version'] ?? $query['translation'] ?? 'kjv';
$segments[2] = $query['get'] ?? ''; $segments[2] = $query['get'] ?? '';
} }
elseif ($query['view'] === 'tag') elseif ($view === 'tag')
{ {
$segments[0] = 'tag'; $segments[0] = 'tag';
$segments[1] = $query['t'] ?? $query['version'] ?? $query['translation'] ?? 'kjv'; $segments[1] = $query['t'] ?? $query['version'] ?? $query['translation'] ?? 'kjv';
@ -154,15 +155,13 @@ class GetbibleRouter extends JComponentRouterBase
$segments[0] = $query['t'] ?? $query['version'] ?? $query['translation'] ?? 'kjv'; $segments[0] = $query['t'] ?? $query['version'] ?? $query['translation'] ?? 'kjv';
$segments[1] = $query['ref'] ?? $query['b'] ?? $query['book'] ?? ''; $segments[1] = $query['ref'] ?? $query['b'] ?? $query['book'] ?? '';
$chapter = isset($query['chapter']) ? $query['chapter'] : ''; $chapter = $query['chapter'] ?? $query['c'] ?? '';
$chapter = isset($query['c']) ? $query['c'] : $chapter;
if (strlen($chapter) && is_numeric($chapter)) if (strlen($chapter) && is_numeric($chapter))
{ {
$segments[2] = $chapter; $segments[2] = $chapter;
} }
$verse = isset($query['verse']) ? $query['verse'] : ''; $verse = $query['verse'] ?? $query['v'] ?? '';
$verse = isset($query['v']) ? $query['v'] : $verse;
if (strlen($verse)) if (strlen($verse))
{ {
$segments[3] = $verse; $segments[3] = $verse;
@ -296,6 +295,7 @@ class GetbibleRouter extends JComponentRouterBase
if ($book_name !== null && $book_number > 0) if ($book_name !== null && $book_number > 0)
{ {
$vars['ref'] = $book_name; $vars['ref'] = $book_name;
$vars['book'] = $book_number;
$key++; $key++;
$chapter_number = $this->getChapter($vars, $key, $segments); $chapter_number = $this->getChapter($vars, $key, $segments);
@ -392,6 +392,7 @@ class GetbibleRouter extends JComponentRouterBase
if (!empty($value) && is_numeric($value) && $value > 0) if (!empty($value) && is_numeric($value) && $value > 0)
{ {
$vars['ref'] .= ' ' . $value; $vars['ref'] .= ' ' . $value;
$vars['chapter'] = $value;
$key++; $key++;
return (int) $value; return (int) $value;
@ -416,6 +417,7 @@ class GetbibleRouter extends JComponentRouterBase
if (!empty($value) && (is_numeric($value) || strpos($value, '-') !== false)) if (!empty($value) && (is_numeric($value) || strpos($value, '-') !== false))
{ {
$vars['ref'] .= ':' . $value; $vars['ref'] .= ':' . $value;
$vars['verse'] = $value;
$key++; $key++;
return true; return true;

View File

@ -35,4 +35,22 @@
<maintainerurl>https://getbible.net</maintainerurl> <maintainerurl>https://getbible.net</maintainerurl>
<targetplatform name="joomla" version="3.*"/> <targetplatform name="joomla" version="3.*"/>
</update> </update>
<update>
<name>Get Bible</name>
<description>The Bible for Joomla</description>
<element>pkg_getbible</element>
<type>package</type>
<client>site</client>
<version>2.0.3</version>
<infourl title="Get Bible!">https://getbible.net</infourl>
<downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/getBible/joomla-pkg/archive/v2.0.3.zip</downloadurl>
</downloads>
<tags>
<tag>stable</tag>
</tags>
<maintainer>Llewellyn van der Merwe</maintainer>
<maintainerurl>https://getbible.net</maintainerurl>
<targetplatform name="joomla" version="3.*"/>
</update>
</updates> </updates>