From bd4a3197cdf6457ee0a0354466ea739eaf6ba579 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Thu, 6 Apr 2023 01:22:46 +0200 Subject: [PATCH] Adds better linking to Telegram post. Adds comment display options. Adds more detailed information about how this works. --- README.md | 46 +--- helper.php | 234 +++++++++++++----- language/en-GB/en-GB.mod_dailyscripture.ini | 21 +- .../en-GB/en-GB.mod_dailyscripture.sys.ini | 21 +- mod_dailyscripture.php | 2 +- mod_dailyscripture.xml | 74 +++++- script.php | 64 +++++ tmpl/default.php | 13 +- 8 files changed, 349 insertions(+), 126 deletions(-) create mode 100644 script.php diff --git a/README.md b/README.md index 735c767..6718102 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Dailyscripture (1.0.1) +# Dailyscripture (1.1.4) Display the daily scripture from [https://github.com/trueChristian/daily-scripture](https://github.com/trueChristian/daily-scripture). @@ -8,46 +8,10 @@ Display the daily scripture from [https://github.com/trueChristian/daily-scriptu + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Dailyscripture](https://www.vdm.io/) + *First Build*: 22nd October, 2015 -+ *Last Build*: 7th January, 2022 -+ *Version*: 1.0.1 ++ *Last Build*: 5th April, 2023 ++ *Version*: 1.1.4 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html -> This **module** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com). -> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) - - -## Contributors -This project exists thanks to all the people who contribute to the [Joomla Component Builder Project](https://github.com/vdm-io/Joomla-Component-Builder). - -[![Contributors](https://opencollective.com/Joomla-Component-Builder/contributors.svg?width=890&button=false)](https://github.com/vdm-io/Joomla-Component-Builder/graphs/contributors) - -### Backers -Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/Joomla-Component-Builder#backer)] - -[![Our Backers on opencollective](https://opencollective.com/Joomla-Component-Builder/backers.svg?width=890)](https://opencollective.com/Joomla-Component-Builder#backers) - -### Sponsors -Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/Joomla-Component-Builder#sponsor)] - -[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/0/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/0/website) -[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/1/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/1/website) -[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/2/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/2/website) -[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/3/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/3/website) -[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/4/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/4/website) -[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/5/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/5/website) -[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/6/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/6/website) -[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/7/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/7/website) -[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/8/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/8/website) -[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/9/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/9/website) -[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/10/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/10/website) -[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/11/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/11/website) -[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/12/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/12/website) -[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/13/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/13/website) -[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/14/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/14/website) -[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/15/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/15/website) -[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/16/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/16/website) -[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/17/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/17/website) -[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/18/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/18/website) -[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/19/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/19/website) -[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/20/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/20/website) \ No newline at end of file +> This **module** was build with a Joomla [Automated Component Builder](https://www.joomlacomponentbuilder.com). +> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io) \ No newline at end of file diff --git a/helper.php b/helper.php index 7544329..3da771d 100644 --- a/helper.php +++ b/helper.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.0.x + @version 2.1.x @created 22nd October, 2015 @package Sermon Distributor @subpackage helper.php @@ -25,9 +25,7 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -use Joomla\Registry\Registry; -use Joomla\CMS\Date\Date; -use Joomla\CMS\Factory; +use Joomla\Registry\Registry; class ModDailyScriptureHelper { @@ -37,7 +35,15 @@ class ModDailyScriptureHelper * @var Registry * @since 1.0 */ - protected $params; + protected Registry $params; + + /** + * The Translation Version + * + * @var string + * @since 1.1 + */ + protected string $version; /** * Scripture @@ -47,29 +53,37 @@ class ModDailyScriptureHelper */ protected $scripture = null; + /** + * Telegram Scripture + * + * @var string + * @since 1.1 + */ + protected string $telegram = ''; + + /** + * Telegram Comments + * + * @var string + * @since 1.1 + */ + protected string $comments = ''; + /** * Type * * @var int * @since 1.0 */ - protected $type; + protected int $type; /** - * Telegram ID = Date + * The Telegram Post ID * * @var int - * @since 1.0 + * @since 1.1 */ - protected $telegramID = 440; - - /** - * Telegram Date of the telegramID - * - * @var string - * @since 1.0 - */ - protected $telegramDate = 'Saturday 01 January, 2022'; + protected int $id = 0; /** * Constructor. @@ -87,22 +101,43 @@ class ModDailyScriptureHelper $this->params = $params; // get the version $this->type = $params->get('type', 1); + // get the version + $this->version = $params->get('version', 'kjv'); + // implementation type = 1 = gitHub if ($this->type == 1) { - // get the version - $version = $params->get('version', 'kjv'); // the link to the scripture for the day - $path = "https://raw.githubusercontent.com/trueChristian/daily-scripture/master/scripture/$version/README.json"; + $path = "https://raw.githubusercontent.com/trueChristian/daily-scripture/master/scripture/{$this->version}/README.json"; // get the scripture object $this->scripture = $this->getFileContents($path); } - // implementation type = 2 = Telegram - elseif ($this->type == 2) + } + } + + /** + * get the Telegram Post ID + * + * @return int + * @since 1.1 + */ + protected function getId(): int + { + if ($this->id == 0) + { + // the link to the scripture for the day + $path = "https://raw.githubusercontent.com/trueChristian/daily-scripture/master/scripture/{$this->version}/README.tg.id"; + // get the scripture object + $id = trim($this->getFileContents($path, false)); + + // make sure we have a number here + if (is_numeric($id)) { - $this->setTelegram(); + $this->id = (int) $id; } } + + return $this->id; } /** @@ -111,76 +146,152 @@ class ModDailyScriptureHelper * @param mixed $name Name of the value to retrieve. * * @return mixed The request value - * * @since 1.0 */ - public function __get($name) + public function __get($key) { - if ($this->type == 1 && $this->checkScripture($name)) + if ($this->type == 1 && $this->checkScripture($key)) { - return $this->scripture->{$name}; + return $this->scripture->{$key}; } - elseif ($this->type == 2 && $name === 'telegram' && isset($this->telegram)) + elseif ($this->type == 2 && $key === 'telegram') { - return $this->telegram; + return $this->getTelegram(); } + elseif ($key === 'comments') + { + return $this->getComments(); + } + return null; } /** * get the Telegram script * + * @return string|null + * + * @since 1.1 + */ + protected function getTelegram(): ?string + { + if (empty($this->telegram)) + { + $this->setTelegram(); + } + + return $this->checkString($this->telegram) ? $this->telegram : null; + } + + /** + * set the Telegram script + * * @return void * * @since 1.0 */ protected function setTelegram() { - // get today - $today = $this->getTimeStamp(); - // get the telegram date - $telegram_date = $this->getTimeStamp($this->telegramDate); - // get the difference - $difference = $today - $telegram_date; - // get the number of days (plus one of the current date) - $days = round($difference / 86400) + 1; - // add the days - $id = $this->telegramID + $days; // validate the ID - if ($id > 0) + if (($id = $this->getId()) > 0) { - // get the width - $width = $this->params->get('width', 100); // get the color $color = $this->getColor(); - // get the userpic - $userpic = $this->getUserPic(); + // get the dark theme $dark = $this->getDarkTheme(); + + // get the width + $width = $this->params->get('width', 100); + + // get the userpic + $userpic = $this->getUserPic(); + // set the script - $this->telegram = ""; + $this->telegram = ""; } } /** - * get today's time stamp based on user + * get the Telegram Comment script * - * @param string $getDate the string to get the time stamp for + * @return string|null * - * @return int the timestamp - * - * @since 1.0 + * @since 1.1 */ - protected function getTimeStamp($getDate = 'now') + protected function getComments(): ?string { - // get today's date - $date = new Date($getDate); - // get the user time zone - $timezone = Factory::getUser()->getTimezone(); - // update the date to the users time zone - $date->setTimezone($timezone); - // return the time stamp - return $date->toUnix(); + if (empty($this->comments)) + { + $this->setComments(); + } + + return $this->checkString($this->comments) ? $this->comments : null; + } + + /** + * set the Telegram script + * + * @return void + * + * @since 1.1 + */ + protected function setComments() + { + // should we add comments + if (($id = $this->getId()) > 0 && $this->params->get('show_comments', 0) == 1) + { + // get the color + $color = $this->getColor(); + + // get the dark theme + $dark = $this->getDarkTheme(); + + // get comment limit + $limit = $this->params->get('comments_limit', 5); + + // get comment Height + $height = $this->getCommentHeight(); + + // get color ful switch + $colorful = $this->getCommentColorful(); + + // set the script + $this->comments = ""; + } + } + + /** + * get the comment height + * + * @return string height value + * + * @since 1.1 + */ + protected function getCommentHeight() + { + if (($height = $this->params->get('comments_height')) > 300) + { + return " data-height=\"$height\""; + } + + return ''; + } + + /** + * get the comment color ful switch + * + * @return string height value + * + * @since 1.1 + */ + protected function getCommentColorful() + { + if (($colorful = $this->params->get('comments_colorful', 0)) == 1) + { + return " data-colorful=\"1\""; + } + return ''; } /** @@ -307,7 +418,7 @@ class ModDailyScriptureHelper * * @input string $path The path to get remotely * - * @returns object on success + * @returns mixed on success * * @since 1.0 */ @@ -359,7 +470,8 @@ class ModDailyScriptureHelper return $content; } } - return false; + + return null; } /** diff --git a/language/en-GB/en-GB.mod_dailyscripture.ini b/language/en-GB/en-GB.mod_dailyscripture.ini index 2dde901..3e36613 100644 --- a/language/en-GB/en-GB.mod_dailyscripture.ini +++ b/language/en-GB/en-GB.mod_dailyscripture.ini @@ -1,15 +1,22 @@ MOD_DAILYSCRIPTURE="Dailyscripture" -MOD_DAILYSCRIPTURE_DESCRIPTION="Display the daily scripture from https://github.com/trueChristian/daily-scripture." -MOD_DAILYSCRIPTURE_XML_DESCRIPTION="

Dailyscripture (v.1.0.1)

Display the daily scripture from https://github.com/trueChristian/daily-scripture.

Created by Llewellyn van der Merwe
Development started 1st January, 2022

" -MOD_DAILYSCRIPTURE_THERE_WAS_AN_ERROR_PLEASE_TRY_AGAIN_LATTER="There was an error, please try again latter." +MOD_DAILYSCRIPTURE_DESCRIPTION="A Joomla Module to Display the Daily Scripture." +MOD_DAILYSCRIPTURE_XML_DESCRIPTION="

Dailyscripture (v.1.1.4)

A Joomla Module to Display the Daily Scripture.

Created by Llewellyn van der Merwe
Development started 1st January, 2022

" +MOD_DAILYSCRIPTURE_THERE_WAS_AN_ERROR_LOADING_THE_DAILY_SCRIPTURE_PLEASE_TRY_AGAIN_LATTER="There was an error loading the Daily Scripture, please try again latter." +MOD_DAILYSCRIPTURE_DAILY_SCRIPTURE="Daily Scripture" MOD_DAILYSCRIPTURE_TYPE_LABEL="Implementation Type" MOD_DAILYSCRIPTURE_TYPE_DESCRIPTION="What kind of implementation would you like to use. Direct from gitHub the main source, or directly from Telegram its official channel" MOD_DAILYSCRIPTURE_DIRECT_FROM_GITHUB="Direct from gitHub" MOD_DAILYSCRIPTURE_DIRECT_FROM_TELEGRAM="Direct from Telegram" -MOD_DAILYSCRIPTURE_LINK_LABEL="Show Link" -MOD_DAILYSCRIPTURE_LINK_DESCRIPTION="Should we show the link to the daily scripture channel on Telegram." +MOD_DAILYSCRIPTURE_SHOW_COMMENTS_LABEL="Show Comments" +MOD_DAILYSCRIPTURE_SHOW_COMMENTS_DESCRIPTION="The option to load comment below the post" MOD_DAILYSCRIPTURE_YES="Yes" MOD_DAILYSCRIPTURE_NO="No" +MOD_DAILYSCRIPTURE_COMMENTS_LIMIT_LABEL="Comments limit" +MOD_DAILYSCRIPTURE_COMMENTS_COLORFUL_LABEL="Use different colors for names" +MOD_DAILYSCRIPTURE_COMMENTS_HEIGHT_LABEL="Comments Height" +MOD_DAILYSCRIPTURE_COMMENTS_HEIGHT_DESCRIPTION="Use 300 for auto height. Any higher value to set custom height, since 300 is the smallest height available." +MOD_DAILYSCRIPTURE_LINK_LABEL="Show Link" +MOD_DAILYSCRIPTURE_LINK_DESCRIPTION="Should we show the link to the daily scripture channel on Telegram." MOD_DAILYSCRIPTURE_WIDTH_LABEL="Width" MOD_DAILYSCRIPTURE_AUTHOR_PHOTO_LABEL="Author Photo" MOD_DAILYSCRIPTURE_AUTO="Auto" @@ -26,4 +33,6 @@ MOD_DAILYSCRIPTURE_CUSTOM="Custom" MOD_DAILYSCRIPTURE_CUSTOM_COLOR_LABEL="Custom Color" MOD_DAILYSCRIPTURE_THEME_LABEL="Theme" MOD_DAILYSCRIPTURE_LIGHT_THEME="Light Theme" -MOD_DAILYSCRIPTURE_DARK_THEME="Dark Theme" \ No newline at end of file +MOD_DAILYSCRIPTURE_DARK_THEME="Dark Theme" +MOD_DAILYSCRIPTURE_DAILY_SCRIPTURE_NOTE_LABEL="Details" +MOD_DAILYSCRIPTURE_DAILY_SCRIPTURE_NOTE_DESCRIPTION="
Relevant Links:
How it works

The daily scripture architecture is designed to automatically select a random verse from a collection of scripture without any human intervention. The core process of selecting a random verse can be broken down into three main steps: shuffling the verses, choosing the first verse from the shuffled list, and updating the list of used verses.

  1. Shuffling the verses: The script first reads the entire list of verses from a file called "SCRIPTURE" and then shuffles this list using a random sorting algorithm. This ensures that the order of the verses in the list is entirely random and unpredictable. This randomness is crucial, as it eliminates any potential human bias or control over the selection process.
  2. Choosing the first verse from the shuffled list: Once the list of verses has been randomly shuffled, the script selects the very first verse from this shuffled list. Because the order of the verses is random, the selected verse is also random and unbiased. This chosen verse is then considered the verse of the day.
  3. Updating the list of used verses: To ensure that the same verse isn't selected again within a short period, the script maintains a separate list of recently used verses, stored in a file called "SCRIPTURE_USED." After selecting the verse of the day, the script removes it from the main "SCRIPTURE" list and adds it to the "SCRIPTURE_USED" list. Additionally, to prevent the "SCRIPTURE_USED" list from growing indefinitely, the script retains only the last 182 used verses (approximately six months). If the "SCRIPTURE_USED" list grows beyond this limit, the oldest verse in the list is removed and added back to the main "SCRIPTURE" list, making it eligible for selection again.

In summary, the random verse generation process implemented in this script is entirely automated and unbiased, relying on a random sorting algorithm to shuffle the list of verses before selecting one. The system also maintains a list of recently used verses to prevent repetition within a six-month period. This approach ensures a truly unexpected and random selection of verses, free from any human intervention or influence.

" \ No newline at end of file diff --git a/language/en-GB/en-GB.mod_dailyscripture.sys.ini b/language/en-GB/en-GB.mod_dailyscripture.sys.ini index 2dde901..3e36613 100644 --- a/language/en-GB/en-GB.mod_dailyscripture.sys.ini +++ b/language/en-GB/en-GB.mod_dailyscripture.sys.ini @@ -1,15 +1,22 @@ MOD_DAILYSCRIPTURE="Dailyscripture" -MOD_DAILYSCRIPTURE_DESCRIPTION="Display the daily scripture from https://github.com/trueChristian/daily-scripture." -MOD_DAILYSCRIPTURE_XML_DESCRIPTION="

Dailyscripture (v.1.0.1)

Display the daily scripture from https://github.com/trueChristian/daily-scripture.

Created by Llewellyn van der Merwe
Development started 1st January, 2022

" -MOD_DAILYSCRIPTURE_THERE_WAS_AN_ERROR_PLEASE_TRY_AGAIN_LATTER="There was an error, please try again latter." +MOD_DAILYSCRIPTURE_DESCRIPTION="A Joomla Module to Display the Daily Scripture." +MOD_DAILYSCRIPTURE_XML_DESCRIPTION="

Dailyscripture (v.1.1.4)

A Joomla Module to Display the Daily Scripture.

Created by Llewellyn van der Merwe
Development started 1st January, 2022

" +MOD_DAILYSCRIPTURE_THERE_WAS_AN_ERROR_LOADING_THE_DAILY_SCRIPTURE_PLEASE_TRY_AGAIN_LATTER="There was an error loading the Daily Scripture, please try again latter." +MOD_DAILYSCRIPTURE_DAILY_SCRIPTURE="Daily Scripture" MOD_DAILYSCRIPTURE_TYPE_LABEL="Implementation Type" MOD_DAILYSCRIPTURE_TYPE_DESCRIPTION="What kind of implementation would you like to use. Direct from gitHub the main source, or directly from Telegram its official channel" MOD_DAILYSCRIPTURE_DIRECT_FROM_GITHUB="Direct from gitHub" MOD_DAILYSCRIPTURE_DIRECT_FROM_TELEGRAM="Direct from Telegram" -MOD_DAILYSCRIPTURE_LINK_LABEL="Show Link" -MOD_DAILYSCRIPTURE_LINK_DESCRIPTION="Should we show the link to the daily scripture channel on Telegram." +MOD_DAILYSCRIPTURE_SHOW_COMMENTS_LABEL="Show Comments" +MOD_DAILYSCRIPTURE_SHOW_COMMENTS_DESCRIPTION="The option to load comment below the post" MOD_DAILYSCRIPTURE_YES="Yes" MOD_DAILYSCRIPTURE_NO="No" +MOD_DAILYSCRIPTURE_COMMENTS_LIMIT_LABEL="Comments limit" +MOD_DAILYSCRIPTURE_COMMENTS_COLORFUL_LABEL="Use different colors for names" +MOD_DAILYSCRIPTURE_COMMENTS_HEIGHT_LABEL="Comments Height" +MOD_DAILYSCRIPTURE_COMMENTS_HEIGHT_DESCRIPTION="Use 300 for auto height. Any higher value to set custom height, since 300 is the smallest height available." +MOD_DAILYSCRIPTURE_LINK_LABEL="Show Link" +MOD_DAILYSCRIPTURE_LINK_DESCRIPTION="Should we show the link to the daily scripture channel on Telegram." MOD_DAILYSCRIPTURE_WIDTH_LABEL="Width" MOD_DAILYSCRIPTURE_AUTHOR_PHOTO_LABEL="Author Photo" MOD_DAILYSCRIPTURE_AUTO="Auto" @@ -26,4 +33,6 @@ MOD_DAILYSCRIPTURE_CUSTOM="Custom" MOD_DAILYSCRIPTURE_CUSTOM_COLOR_LABEL="Custom Color" MOD_DAILYSCRIPTURE_THEME_LABEL="Theme" MOD_DAILYSCRIPTURE_LIGHT_THEME="Light Theme" -MOD_DAILYSCRIPTURE_DARK_THEME="Dark Theme" \ No newline at end of file +MOD_DAILYSCRIPTURE_DARK_THEME="Dark Theme" +MOD_DAILYSCRIPTURE_DAILY_SCRIPTURE_NOTE_LABEL="Details" +MOD_DAILYSCRIPTURE_DAILY_SCRIPTURE_NOTE_DESCRIPTION="
Relevant Links:
How it works

The daily scripture architecture is designed to automatically select a random verse from a collection of scripture without any human intervention. The core process of selecting a random verse can be broken down into three main steps: shuffling the verses, choosing the first verse from the shuffled list, and updating the list of used verses.

  1. Shuffling the verses: The script first reads the entire list of verses from a file called "SCRIPTURE" and then shuffles this list using a random sorting algorithm. This ensures that the order of the verses in the list is entirely random and unpredictable. This randomness is crucial, as it eliminates any potential human bias or control over the selection process.
  2. Choosing the first verse from the shuffled list: Once the list of verses has been randomly shuffled, the script selects the very first verse from this shuffled list. Because the order of the verses is random, the selected verse is also random and unbiased. This chosen verse is then considered the verse of the day.
  3. Updating the list of used verses: To ensure that the same verse isn't selected again within a short period, the script maintains a separate list of recently used verses, stored in a file called "SCRIPTURE_USED." After selecting the verse of the day, the script removes it from the main "SCRIPTURE" list and adds it to the "SCRIPTURE_USED" list. Additionally, to prevent the "SCRIPTURE_USED" list from growing indefinitely, the script retains only the last 182 used verses (approximately six months). If the "SCRIPTURE_USED" list grows beyond this limit, the oldest verse in the list is removed and added back to the main "SCRIPTURE" list, making it eligible for selection again.

In summary, the random verse generation process implemented in this script is entirely automated and unbiased, relying on a random sorting algorithm to shuffle the list of verses before selecting one. The system also maintains a list of recently used verses to prevent repetition within a six-month period. This approach ensures a truly unexpected and random selection of verses, free from any human intervention or influence.

" \ No newline at end of file diff --git a/mod_dailyscripture.php b/mod_dailyscripture.php index fc6b03a..4667088 100644 --- a/mod_dailyscripture.php +++ b/mod_dailyscripture.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.0.x + @version 2.1.x @created 22nd October, 2015 @package Sermon Distributor @subpackage mod_dailyscripture.php diff --git a/mod_dailyscripture.xml b/mod_dailyscripture.xml index 10d6c59..d760b06 100644 --- a/mod_dailyscripture.xml +++ b/mod_dailyscripture.xml @@ -1,15 +1,18 @@ MOD_DAILYSCRIPTURE - 7th January, 2022 + 5th April, 2023 Llewellyn van der Merwe joomla@vdm.io https://www.vdm.io/ Copyright (C) 2015. All Rights Reserved GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - 1.0.1 + 1.1.4 MOD_DAILYSCRIPTURE_XML_DESCRIPTION + + script.php + en-GB/en-GB.mod_dailyscripture.ini @@ -29,7 +32,10 @@ - +
MOD_DAILYSCRIPTURE_DIRECT_FROM_TELEGRAM + + + + + + + + + + + + + + + + + showon="type:2[OR]show_comments:1"> @@ -126,7 +182,7 @@ name="custom_color" default="1" label="MOD_DAILYSCRIPTURE_CUSTOM_COLOR_LABEL" - showon="type:2[AND]color:7" + showon="type:2[AND]color:7[OR]show_comments:1[AND]color:7" /> + showon="type:2[OR]show_comments:1"> @@ -143,6 +199,10 @@ MOD_DAILYSCRIPTURE_DARK_THEME
+
+ + +
\ No newline at end of file diff --git a/script.php b/script.php new file mode 100644 index 0000000..5ecb598 --- /dev/null +++ b/script.php @@ -0,0 +1,64 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + A sermon distributor that links to Dropbox. + +/----------------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Dailyscripture script file. + * + * @package DailyScripture + */ +class mod_DailyScriptureInstallerScript +{ + + /** + * Called before any type of action + * + * @param string $route Which action is happening (install|uninstall|discover_install|update) + * @param Joomla\CMS\Installer\InstallerAdapter $adapter The object responsible for running this script + * + * @return boolean True on success + */ + public function preflight($route, $adapter) + { + // get application + $app = JFactory::getApplication(); + + // the default for both install and update + $jversion = new JVersion(); + if (!$jversion->isCompatible('3.8.0')) + { + $app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error'); + return false; + } + + if ('install' === $route) + { +// + } + + return true; + } +} diff --git a/tmpl/default.php b/tmpl/default.php index 7c28f8a..4b10882 100644 --- a/tmpl/default.php +++ b/tmpl/default.php @@ -10,7 +10,7 @@ /------------------------------------------------------------------------------------------------------------------------------------/ - @version 2.0.x + @version 2.1.x @created 22nd October, 2015 @package Sermon Distributor @subpackage default.php @@ -37,11 +37,16 @@ defined('_JEXEC') or die('Restricted access'); get('link', 1) == 1): ?> date; ?> -
- date; ?> +

date; ?>

+ + comments): ?> + comments; ?> get('type', 1) == 2 && $today->telegram): ?> telegram; ?> + comments): ?> + comments; ?> + - +