Stable release of v2.0.12

Fixes Links to Translations (to use their own book names).
This commit is contained in:
Robot 2023-08-03 09:07:33 +02:00
parent 0d5551b74f
commit 1b3f535925
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
11 changed files with 71 additions and 25 deletions

View File

@ -57,4 +57,8 @@
# v2.0.11
- Adds better translation selection by Language
- Adds better translation selection by Language
# v2.0.12
- Fixes Links to Translations (to use their own book names)

View File

@ -1,4 +1,4 @@
# Get Bible (2.0.11)
# Get Bible (2.0.12)
![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)
+ *First Build*: 3rd December, 2015
+ *Last Build*: 3rd August, 2023
+ *Version*: 2.0.11
+ *Version*: 2.0.12
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
@ -31,8 +31,8 @@ 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**,
> never making one mistake or taking any coffee break.)
+ *Line count*: **196018**
+ *File count*: **1701**
+ *Line count*: **196041**
+ *File count*: **1702**
+ *Folder count*: **162**
**361 Hours** or **46 Eight Hour Days** (the actual time the author spent)

View File

@ -1,4 +1,4 @@
# Get Bible (2.0.11)
# Get Bible (2.0.12)
![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)
+ *First Build*: 3rd December, 2015
+ *Last Build*: 3rd August, 2023
+ *Version*: 2.0.11
+ *Version*: 2.0.12
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
@ -31,8 +31,8 @@ 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**,
> never making one mistake or taking any coffee break.)
+ *Line count*: **196018**
+ *File count*: **1701**
+ *Line count*: **196041**
+ *File count*: **1702**
+ *Folder count*: **162**
**361 Hours** or **46 Eight Hour Days** (the actual time the author spent)

View File

@ -0,0 +1 @@

View File

@ -7,9 +7,9 @@
<authorUrl>https://getbible.net</authorUrl>
<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>
<version>2.0.11</version>
<version>2.0.12</version>
<description><![CDATA[
<h1>Get Bible (v.2.0.11)</h1>
<h1>Get Bible (v.2.0.12)</h1>
<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.

View File

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

View File

@ -56,6 +56,8 @@ class GetbibleController extends BaseController
'case' => 'STRING',
'target' => 'STRING',
'guid' => 'STRING',
'tag' => 'STRING',
'linker' => 'STRING',
'return' => 'BASE64',
'layout' => 'STRING',
'format' => 'STRING',

View File

@ -124,8 +124,8 @@ class GetbibleModelApp extends ItemModel
if (empty($this->book))
{
$this->book = Factory::_('DailyScripture')->book();
$this->chapter = Factory::_('DailyScripture')->chapter();
$this->verses = Factory::_('DailyScripture')->verses();
$this->chapter = $this->chapter ?? Factory::_('DailyScripture')->chapter();
$this->verses = $this->verses?? Factory::_('DailyScripture')->verses();
}
// if we still have nothing... were done here!

View File

@ -158,7 +158,7 @@ class GetbibleRouter extends JComponentRouterBase
$book = $query['ref'] ?? $query['b'] ?? $query['book'] ?? '';
if (is_numeric($book) && $book > 0)
{
$book = $this->getBookName((int) $book);
$book = $this->getBookName((int) $book, $segments[0]);
}
$segments[1] = $book;
@ -299,7 +299,7 @@ class GetbibleRouter extends JComponentRouterBase
$value = $segments[$key] ?? null;
$book_number = 0;
$book_name = $this->getBook($value, $book_number);
$book_name = $this->getBook($value, $book_number, $vars['t']);
if ($book_name !== null && $book_number > 0)
{
@ -363,19 +363,20 @@ class GetbibleRouter extends JComponentRouterBase
/**
* Retrieve book based on the value provided
*
* @param mixed $value
* @param int &$bookNumber
* @param mixed $value
* @param int &$bookNumber
* @param string|null $translation The book translation.
*
* @return string|null
* @since 3.3
*/
private function getBook($value, int &$bookNumber): ?string
private function getBook($value, int &$bookNumber, ?string $translation = null): ?string
{
if (is_numeric($value))
{
$bookNumber = $value;
return $this->getBookName((int) $value);
return $this->getBookName((int) $value, $translation);
}
elseif (!empty($value) && ($bookNumber = $this->getBookNumber($value)) !== null)
{
@ -687,13 +688,33 @@ class GetbibleRouter extends JComponentRouterBase
/**
* Get a Book name
*
* @param int $value The book number.
* @param int $value The book number.
* @param string|null $translation The book translation.
*
* @return string|null The book name
* @since 3.3
*/
private function getBookName(int $value): ?string
private function getBookName(int $value, ?string $translation = null): ?string
{
if (!empty($translation) && is_numeric($value) && $value > 0)
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName('name'));
$query->from($db->quoteName('#__getbible_book'));
$query->where($db->quoteName('nr') . ' = '. (int) $value);
$query->where($db->quoteName('abbreviation') . ' = ' . $db->quote((string) $translation));
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
return $db->loadResult();
}
}
if (($name = $this->getVar('book', $value, 'nr', 'name')) !== null)
{
return $name;

View File

@ -20,7 +20,7 @@ defined('_JEXEC') or die('Restricted access');
?>
<?php if (!empty($this->defaultTranslation)): ?>
<a class="uk-button uk-button-default uk-button-small uk-width-1-1" href="<?php echo JRoute::_('index.php?option=com_getbible&view=app&t=' . $this->defaultTranslation->abbreviation . '&ref=' . $this->chapter->book_name . '&c=' . $this->chapter->chapter); ?>">
<a class="uk-button uk-button-default uk-button-small uk-width-1-1" href="<?php echo JRoute::_('index.php?option=com_getbible&view=app&t=' . $this->defaultTranslation->abbreviation . '&b=' . $this->chapter->book_nr . '&c=' . $this->chapter->chapter); ?>">
<?php echo $this->defaultTranslation->translation; ?> (<?php echo $this->defaultTranslation->abbreviation; ?>)
</a>
<?php endif; ?>
@ -35,11 +35,11 @@ defined('_JEXEC') or die('Restricted access');
<div class="uk-accordion-content">
<?php foreach ($translations as $translation): ?>
<?php if ($translation->abbreviation !== $this->chapter->abbreviation): ?>
<a class="uk-button uk-button-default uk-button-small uk-width-1-1 uk-margin-small-bottom" href="<?php echo JRoute::_('index.php?option=com_getbible&view=app&t=' . $translation->abbreviation . '&ref=' . $this->chapter->book_name . '&c=' . $this->chapter->chapter); ?>">
<a class="uk-button uk-button-default uk-button-small uk-width-1-1 uk-margin-small-bottom" href="<?php echo JRoute::_('index.php?option=com_getbible&view=app&t=' . $translation->abbreviation . '&b=' . $this->chapter->book_nr . '&c=' . $this->chapter->chapter); ?>">
<?php echo $translation->translation; ?> (<?php echo $translation->abbreviation; ?>)
</a>
<?php else: ?>
<a class="uk-button uk-button-default uk-button-small uk-active uk-width-1-1 uk-margin-small-bottom" href="<?php echo JRoute::_('index.php?option=com_getbible&view=app&t=' . $translation->abbreviation . '&ref=' . $this->chapter->book_name . '&c=' . $this->chapter->chapter); ?>">
<a class="uk-button uk-button-default uk-button-small uk-active uk-width-1-1 uk-margin-small-bottom" href="<?php echo JRoute::_('index.php?option=com_getbible&view=app&t=' . $translation->abbreviation . '&b=' . $this->chapter->book_nr . '&c=' . $this->chapter->chapter); ?>">
<?php echo $translation->translation; ?> (<?php echo $translation->abbreviation; ?>)
</a>
<?php endif; ?>

View File

@ -179,4 +179,22 @@
<maintainerurl>https://getbible.net</maintainerurl>
<targetplatform name="joomla" version="3.*"/>
</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.12</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.12.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>