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 # 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") ![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*: 3rd August, 2023 + *Last Build*: 3rd August, 2023
+ *Version*: 2.0.11 + *Version*: 2.0.12
+ *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,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**, > (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*: **196018** + *Line count*: **196041**
+ *File count*: **1701** + *File count*: **1702**
+ *Folder count*: **162** + *Folder count*: **162**
**361 Hours** or **46 Eight Hour Days** (the actual time the author spent) **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") ![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*: 3rd August, 2023 + *Last Build*: 3rd August, 2023
+ *Version*: 2.0.11 + *Version*: 2.0.12
+ *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,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**, > (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*: **196018** + *Line count*: **196041**
+ *File count*: **1701** + *File count*: **1702**
+ *Folder count*: **162** + *Folder count*: **162**
**361 Hours** or **46 Eight Hour Days** (the actual time the author spent) **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> <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.11</version> <version>2.0.12</version>
<description><![CDATA[ <description><![CDATA[
<h1>Get Bible (v.2.0.11)</h1> <h1>Get Bible (v.2.0.12)</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.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. // Set db if not set already.
if (!isset($db)) if (!isset($db))

View File

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

View File

@ -124,8 +124,8 @@ class GetbibleModelApp extends ItemModel
if (empty($this->book)) if (empty($this->book))
{ {
$this->book = Factory::_('DailyScripture')->book(); $this->book = Factory::_('DailyScripture')->book();
$this->chapter = Factory::_('DailyScripture')->chapter(); $this->chapter = $this->chapter ?? Factory::_('DailyScripture')->chapter();
$this->verses = Factory::_('DailyScripture')->verses(); $this->verses = $this->verses?? Factory::_('DailyScripture')->verses();
} }
// if we still have nothing... were done here! // 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'] ?? ''; $book = $query['ref'] ?? $query['b'] ?? $query['book'] ?? '';
if (is_numeric($book) && $book > 0) if (is_numeric($book) && $book > 0)
{ {
$book = $this->getBookName((int) $book); $book = $this->getBookName((int) $book, $segments[0]);
} }
$segments[1] = $book; $segments[1] = $book;
@ -299,7 +299,7 @@ class GetbibleRouter extends JComponentRouterBase
$value = $segments[$key] ?? null; $value = $segments[$key] ?? null;
$book_number = 0; $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) if ($book_name !== null && $book_number > 0)
{ {
@ -363,19 +363,20 @@ class GetbibleRouter extends JComponentRouterBase
/** /**
* Retrieve book based on the value provided * Retrieve book based on the value provided
* *
* @param mixed $value * @param mixed $value
* @param int &$bookNumber * @param int &$bookNumber
* @param string|null $translation The book translation.
* *
* @return string|null * @return string|null
* @since 3.3 * @since 3.3
*/ */
private function getBook($value, int &$bookNumber): ?string private function getBook($value, int &$bookNumber, ?string $translation = null): ?string
{ {
if (is_numeric($value)) if (is_numeric($value))
{ {
$bookNumber = $value; $bookNumber = $value;
return $this->getBookName((int) $value); return $this->getBookName((int) $value, $translation);
} }
elseif (!empty($value) && ($bookNumber = $this->getBookNumber($value)) !== null) elseif (!empty($value) && ($bookNumber = $this->getBookNumber($value)) !== null)
{ {
@ -687,13 +688,33 @@ class GetbibleRouter extends JComponentRouterBase
/** /**
* Get a Book name * 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 * @return string|null The book name
* @since 3.3 * @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) if (($name = $this->getVar('book', $value, 'nr', 'name')) !== null)
{ {
return $name; return $name;

View File

@ -20,7 +20,7 @@ defined('_JEXEC') or die('Restricted access');
?> ?>
<?php if (!empty($this->defaultTranslation)): ?> <?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; ?>) <?php echo $this->defaultTranslation->translation; ?> (<?php echo $this->defaultTranslation->abbreviation; ?>)
</a> </a>
<?php endif; ?> <?php endif; ?>
@ -35,11 +35,11 @@ defined('_JEXEC') or die('Restricted access');
<div class="uk-accordion-content"> <div class="uk-accordion-content">
<?php foreach ($translations as $translation): ?> <?php foreach ($translations as $translation): ?>
<?php if ($translation->abbreviation !== $this->chapter->abbreviation): ?> <?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; ?>) <?php echo $translation->translation; ?> (<?php echo $translation->abbreviation; ?>)
</a> </a>
<?php else: ?> <?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; ?>) <?php echo $translation->translation; ?> (<?php echo $translation->abbreviation; ?>)
</a> </a>
<?php endif; ?> <?php endif; ?>

View File

@ -179,4 +179,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.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> </updates>