From 53ba8c4ee2ad2bef0c9d58018442f16a24346121 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Sun, 9 Apr 2023 23:19:33 +0200 Subject: [PATCH] first commit --- README.md | 53 ++ fields/index.html | 1 + helper.php | 554 ++++++++++++++++++++ index.html | 1 + language/en-GB/en-GB.mod_dailylight.ini | 49 ++ language/en-GB/en-GB.mod_dailylight.sys.ini | 49 ++ language/en-GB/index.html | 1 + language/index.html | 1 + mod_dailylight.php | 42 ++ mod_dailylight.xml | 310 +++++++++++ rules/index.html | 1 + script.php | 64 +++ tmpl/default.php | 88 ++++ tmpl/index.html | 1 + 14 files changed, 1215 insertions(+) create mode 100644 README.md create mode 100644 fields/index.html create mode 100644 helper.php create mode 100644 index.html create mode 100644 language/en-GB/en-GB.mod_dailylight.ini create mode 100644 language/en-GB/en-GB.mod_dailylight.sys.ini create mode 100644 language/en-GB/index.html create mode 100644 language/index.html create mode 100644 mod_dailylight.php create mode 100644 mod_dailylight.xml create mode 100644 rules/index.html create mode 100644 script.php create mode 100644 tmpl/default.php create mode 100644 tmpl/index.html diff --git a/README.md b/README.md new file mode 100644 index 0000000..3a9630d --- /dev/null +++ b/README.md @@ -0,0 +1,53 @@ +# Dailylight (1.1.2) + +Display the daily scripture from [https://github.com/trueChristian/daily-scripture](https://github.com/trueChristian/daily-scripture). + +# Build Details + ++ *Company*: [Vast Development Method](https://www.vdm.io/) ++ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) ++ *Name*: [Dailylight](https://www.vdm.io/) ++ *First Build*: 22nd October, 2015 ++ *Last Build*: 9th April, 2023 ++ *Version*: 1.1.2 ++ *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](https://www.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 diff --git a/fields/index.html b/fields/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/fields/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/helper.php b/helper.php new file mode 100644 index 0000000..145684d --- /dev/null +++ b/helper.php @@ -0,0 +1,554 @@ + + @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'); + +use Joomla\Registry\Registry; + +class ModDailyLightHelper +{ + /** + * Params + * + * @var Registry + * @since 1.0 + */ + protected Registry $params; + + /** + * Daily Light + * + * @var mixed + * @since 1.0 + */ + protected $daily = null; + + /** + * Telegram Scripture + * + * @var array + * @since 1.1 + */ + protected array $telegram = []; + + /** + * Telegram Comments + * + * @var array + * @since 1.1 + */ + protected array $comments = []; + + /** + * Type + * + * @var int + * @since 1.0 + */ + protected int $type; + + /** + * Time of Day + * + * @var int + * @since 1.0 + */ + protected int $time; + + /** + * The Telegram Post evening ID + * + * @var int + * @since 1.1 + */ + protected int $evening = 0; + + /** + * The Telegram Post morning ID + * + * @var int + * @since 1.1 + */ + protected int $morning = 0; + + /** + * Constructor. + * + * @param Registry|null $params the module settings + * + * @since 1.0 + */ + public function __construct(Registry $params = null) + { + // we must have the params or we cant continue + if ($params) + { + // set the global params + $this->params = $params; + // get the type + $this->type = $params->get('type', 1); + + // implementation type = 1 = gitHub + if ($this->type == 1) + { + // the link to the scripture for the day + $path = $params->get('url_json', "https://raw.githubusercontent.com/trueChristian/daily-light/master/README.json"); + + // get the daily light object + $this->daily = $this->getFileContents($path); + } + } + } + + /** + * get the Telegram Post Evening ID + * + * @param string $time The time of daily light + * + * @return int + * @since 1.1 + */ + protected function getId($time): int + { + if ($this->$time == 0) + { + // the link to the daily light morning/evening + $path = $this->params->get("url_{$time}_telegram_id", "https://raw.githubusercontent.com/trueChristian/daily-light/master/{$time}.tg.id"); + + // get the scripture object + $id = trim($this->getFileContents($path, false)); + + // make sure we have a number here + if (is_numeric($id)) + { + $this->$time = (int) $id; + } + } + + return $this->$time; + } + + /** + * Waco method to get an scripture value + * + * @param mixed $name Name of the value to retrieve. + * + * @return mixed The request value + * @since 1.0 + */ + public function __get($key) + { + if ($this->type == 1 && $this->checkDaily($key)) + { + return $this->daily->{$key}; + } + elseif ($this->type == 2 && ($key === 'telegram.evening' || $key === 'telegram.morning')) + { + if ($key === 'telegram.evening') + { + return $this->getTelegram('evening'); + } + elseif ($key === 'telegram.morning') + { + return $this->getTelegram('morning'); + } + } + elseif ($key === 'comments.evening' || $key === 'comments.morning') + { + if ($key === 'comments.evening') + { + return $this->getComments('evening'); + } + elseif ($key === 'comments.morning') + { + return $this->getComments('morning'); + } + } + + return null; + } + + /** + * get the Telegram script + * + * @param string $time The time of daily light + * + * @return string|null + * @since 1.1 + */ + protected function getTelegram(string $time): ?string + { + if (empty($this->telegram[$time])) + { + $this->setTelegram($time); + } + + return (isset($this->telegram[$time]) && + $this->checkString($this->telegram[$time])) ? $this->telegram[$time] : null; + } + + /** + * set the Telegram script + * + * @param string $time The time of daily light + * + * @return void + * @since 1.0 + */ + protected function setTelegram($time) + { + // validate the ID + if (($id = $this->getId($time)) > 0) + { + // get the color + $color = $this->getColor(); + + // get the dark theme + $dark = $this->getDarkTheme(); + + // get the width + $width = $this->params->get('width', 100); + + // get the userpic + $userpic = $this->getUserPic(); + + // set the daily light + $this->telegram[$time] = ""; + } + } + + /** + * get the Telegram Comment script + * + * @param string $time The time of daily light + * + * @return string|null + * @since 1.1 + */ + protected function getComments($time): ?string + { + if (empty($this->comments[$time])) + { + $this->setComments($time); + } + + return (isset($this->comments[$time]) && + $this->checkString($this->comments[$time])) ? $this->comments[$time] : null; + } + + /** + * set the Telegram script + * + * @param string $time The time of daily light + * + * @return void + * @since 1.1 + */ + protected function setComments($time) + { + // should we add comments + if ($this->params->get('show_comments', 0) == 1 && ($id = $this->getId($time)) > 0) + { + // 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[$time] = ""; + } + } + + /** + * get the color + * + * @return string The telegram script + * @since 1.0 + */ + protected function getColor() + { + // get the color + $color = $this->params->get('color', 1); + + // convert to color + switch($color) + { + case 2: + // Cyan + $color = '13B4C6'; + $dark_color = '39C4E8'; + break; + case 3: + // Green + $color = '29B127'; + $dark_color = '72E350'; + break; + case 4: + // Yellow + $color = 'CA9C0E'; + $dark_color = 'F0B138'; + break; + case 5: + // Red + $color = 'E22F38'; + $dark_color = 'F95C54'; + break; + case 6: + // White + $color = '343638'; + $dark_color = 'FFFFFF'; + break; + case 7: + // custom color + $color = strtoupper(trim($this->params->get('custom_color', 'F646A4'), '#')); + $dark_color = null; + break; + default: + // default + $color = null; + $dark_color = null; + break; + } + + // load colors if set + if ($color) + { + $color = " data-color=\"$color\""; + // load dark color if set + if ($dark_color) + { + $color = "$color data-dark-color=\"$dark_color\""; + } + $this->color = $color; + } + } + + /** + * get the dark theme state + * + * @return string data-dark value + * @since 1.0 + */ + protected function getDarkTheme() + { + // get the theme + $theme = $this->params->get('theme', 1); + + // only load if dark theme is set + if ($theme == 2) + { + $this->dark = " data-dark=\"1\""; + } + } + + /** + * 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 ''; + } + + /** + * get the user pic state + * + * @return string data-userpic value + * @since 1.0 + */ + protected function getUserPic() + { + // get the author_photo + $author_photo = $this->params->get('author_photo', 1); + // convert to userpic + switch($author_photo) + { + case 2: + // Always show + $userpic = 'true'; + break; + case 3: + // Always hide + $userpic = 'false'; + break; + default: + // Auto + $userpic = null; + break; + } + // load userpic if set + if ($userpic) + { + $userpic = " data-userpic=\"$userpic\""; + return $userpic; + } + return ''; + } + + /** + * get the file content + * + * @input string $path The path to get remotely + * + * @returns mixed on success + * @since 1.0 + */ + protected function getFileContents($path, $json = true) + { + // use basic file get content for now + if (($content = @file_get_contents($path)) !== FALSE) + { + // return if found + if ($json) + { + if ($this->checkJson($content)) + { + return json_decode($content); + } + } + elseif ($this->checkString($content)) + { + return $content; + } + } + // use curl if available + elseif (function_exists('curl_version')) + { + // start curl + $ch = curl_init(); + // set the options + $options = array(); + $options[CURLOPT_URL] = $path; + $options[CURLOPT_USERAGENT] = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12'; + $options[CURLOPT_RETURNTRANSFER] = TRUE; + $options[CURLOPT_SSL_VERIFYPEER] = FALSE; + // load the options + curl_setopt_array($ch, $options); + // get the content + $content = curl_exec($ch); + // close the connection + curl_close($ch); + // return if found + if ($json) + { + if ($this->checkJson($content)) + { + return json_decode($content); + } + } + elseif ($this->checkString($content)) + { + return $content; + } + } + + return null; + } + + /** + * Check if have an json string + * + * @input string The json string to check + * + * @returns bool true on success + * @since 1.0 + */ + protected function checkJson($string) + { + if ($this->checkString($string)) + { + json_decode($string); + return (json_last_error() === JSON_ERROR_NONE); + } + return false; + } + + /** + * Check if have a string with a length + * + * @input string The string to check + * + * @returns bool true on success + * @since 1.0 + */ + protected function checkString($string) + { + if (isset($string) && is_string($string) && strlen($string) > 0) + { + return true; + } + return false; + } + + /** + * Check if we have an daily light object with value + * + * @input key The key being requested + * + * @returns bool true on success + * @since 1.0 + */ + protected function checkDaily($key) + { + if (isset($this->daily) && is_object($this->daily) && isset($this->daily->{$key})) + { + return true; + } + return false; + } + +} diff --git a/index.html b/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/language/en-GB/en-GB.mod_dailylight.ini b/language/en-GB/en-GB.mod_dailylight.ini new file mode 100644 index 0000000..8d9a927 --- /dev/null +++ b/language/en-GB/en-GB.mod_dailylight.ini @@ -0,0 +1,49 @@ +MOD_DAILYLIGHT="Dailylight" +MOD_DAILYLIGHT_DESCRIPTION="A Joomla Module to Display the Daily Daily Light on the Daily Path." +MOD_DAILYLIGHT_XML_DESCRIPTION="

Dailylight (v.1.1.2)

A Joomla Module to Display the Daily Daily Light on the Daily Path.

Created by Llewellyn van der Merwe
Development started 14th January, 2022

" +MOD_DAILYLIGHT_DAILY_LIGHT="Daily Light" +MOD_DAILYLIGHT_THERE_WAS_AN_ERROR_LOADING_THE_DAILY_LIGHT_PLEASE_TRY_AGAIN_LATTER="There was an error loading the Daily Light, please try again latter." +MOD_DAILYLIGHT_TIME_OF_DAY_LABEL="Time of Day" +MOD_DAILYLIGHT_TIME_OF_DAY_DESCRIPTION="What time of day would you like to display?" +MOD_DAILYLIGHT_MORNING="Morning" +MOD_DAILYLIGHT_EVENING="Evening" +MOD_DAILYLIGHT_BOTH="Both" +MOD_DAILYLIGHT_TYPE_LABEL="Implementation Type" +MOD_DAILYLIGHT_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_DAILYLIGHT_DIRECT_FROM_GITHUB="Direct from gitHub" +MOD_DAILYLIGHT_DIRECT_FROM_TELEGRAM="Direct from Telegram" +MOD_DAILYLIGHT_SHOW_HEADER_LABEL="Show Header" +MOD_DAILYLIGHT_YES="Yes" +MOD_DAILYLIGHT_NO="No" +MOD_DAILYLIGHT_SHOW_NAME_HEADER_LABEL="Show Name Header" +MOD_DAILYLIGHT_SHOW_SECTION_HEADER_LABEL="Show Section Header" +MOD_DAILYLIGHT_SHOW_BODY_LABEL="Show Body" +MOD_DAILYLIGHT_SHOW_REFERENCES_LABEL="Show References" +MOD_DAILYLIGHT_SHOW_COMMENTS_LABEL="Show Comments" +MOD_DAILYLIGHT_SHOW_COMMENTS_DESCRIPTION="The option to load comment below the post" +MOD_DAILYLIGHT_COMMENTS_LIMIT_LABEL="Comments limit" +MOD_DAILYLIGHT_COMMENTS_COLORFUL_LABEL="Use different colors for names" +MOD_DAILYLIGHT_COMMENTS_HEIGHT_LABEL="Comments Height" +MOD_DAILYLIGHT_COMMENTS_HEIGHT_DESCRIPTION="Use 300 for auto height. Any higher value to set custom height, since 300 is the smallest height available." +MOD_DAILYLIGHT_LINK_LABEL="Show Link" +MOD_DAILYLIGHT_LINK_DESCRIPTION="Should we show the link to the daily scripture channel on Telegram." +MOD_DAILYLIGHT_SHOW_DATE_FOOTER_LABEL="Show Date Footer" +MOD_DAILYLIGHT_WIDTH_LABEL="Width" +MOD_DAILYLIGHT_AUTHOR_PHOTO_LABEL="Author Photo" +MOD_DAILYLIGHT_AUTO="Auto" +MOD_DAILYLIGHT_ALWAYS_SHOW="Always show" +MOD_DAILYLIGHT_ALWAYS_HIDE="Always hide" +MOD_DAILYLIGHT_COLOR_LABEL="Color" +MOD_DAILYLIGHT_DEFAULT="Default" +MOD_DAILYLIGHT_CYAN="Cyan" +MOD_DAILYLIGHT_GREEN="Green" +MOD_DAILYLIGHT_YELLOW="Yellow" +MOD_DAILYLIGHT_RED="Red" +MOD_DAILYLIGHT_WHITE="White" +MOD_DAILYLIGHT_CUSTOM="Custom" +MOD_DAILYLIGHT_CUSTOM_COLOR_LABEL="Custom Color" +MOD_DAILYLIGHT_THEME_LABEL="Theme" +MOD_DAILYLIGHT_LIGHT_THEME="Light Theme" +MOD_DAILYLIGHT_DARK_THEME="Dark Theme" +MOD_DAILYLIGHT_DAILY_LIGHT_NOTE_LABEL="Details" +MOD_DAILYLIGHT_DAILY_LIGHT_NOTE_DESCRIPTION="
Relevant Links:
How it works

We have a script that is designed to update a repository with daily messages called "Daily Light." The script achieves this by first setting up various variables and configurations, then extracting the relevant information for the current day, and finally updating the files and pushing the changes to the repository.

In the first part, the script sets up the file paths, key identifiers, and date information. It establishes the script's directory, the Daily Light file location, and the morning and evening keys used to identify specific sections of the file. It also sets the current date based on the "Africa/Windhoek" timezone. After setting up the configurations, the script searches the Daily Light file for the current day's details using the 'grep' command, which matches the date with the corresponding line of text.

In the second part, the script formats and extracts the relevant information from the matched line of text. It splits the line into separate sections for the morning and evening messages, as well as the respective verses for each. Next, it creates two sets of formatted text—one in HTML and the other in Markdown. These formatted texts include the morning and evening messages, verses, and a link to a Telegram channel.

Finally, the script writes the formatted text to four separate files—morning.html, evening.html, morning.md, and evening.md. It then creates a README.md file with both the morning and evening messages and verses, along with a link to the Telegram channel. Lastly, the script commits the changes with a git commit command, using the current date as the commit message, and pushes the changes to the repository. This ensures that the repository stays updated with the latest Daily Light details for users to access.

" \ No newline at end of file diff --git a/language/en-GB/en-GB.mod_dailylight.sys.ini b/language/en-GB/en-GB.mod_dailylight.sys.ini new file mode 100644 index 0000000..8d9a927 --- /dev/null +++ b/language/en-GB/en-GB.mod_dailylight.sys.ini @@ -0,0 +1,49 @@ +MOD_DAILYLIGHT="Dailylight" +MOD_DAILYLIGHT_DESCRIPTION="A Joomla Module to Display the Daily Daily Light on the Daily Path." +MOD_DAILYLIGHT_XML_DESCRIPTION="

Dailylight (v.1.1.2)

A Joomla Module to Display the Daily Daily Light on the Daily Path.

Created by Llewellyn van der Merwe
Development started 14th January, 2022

" +MOD_DAILYLIGHT_DAILY_LIGHT="Daily Light" +MOD_DAILYLIGHT_THERE_WAS_AN_ERROR_LOADING_THE_DAILY_LIGHT_PLEASE_TRY_AGAIN_LATTER="There was an error loading the Daily Light, please try again latter." +MOD_DAILYLIGHT_TIME_OF_DAY_LABEL="Time of Day" +MOD_DAILYLIGHT_TIME_OF_DAY_DESCRIPTION="What time of day would you like to display?" +MOD_DAILYLIGHT_MORNING="Morning" +MOD_DAILYLIGHT_EVENING="Evening" +MOD_DAILYLIGHT_BOTH="Both" +MOD_DAILYLIGHT_TYPE_LABEL="Implementation Type" +MOD_DAILYLIGHT_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_DAILYLIGHT_DIRECT_FROM_GITHUB="Direct from gitHub" +MOD_DAILYLIGHT_DIRECT_FROM_TELEGRAM="Direct from Telegram" +MOD_DAILYLIGHT_SHOW_HEADER_LABEL="Show Header" +MOD_DAILYLIGHT_YES="Yes" +MOD_DAILYLIGHT_NO="No" +MOD_DAILYLIGHT_SHOW_NAME_HEADER_LABEL="Show Name Header" +MOD_DAILYLIGHT_SHOW_SECTION_HEADER_LABEL="Show Section Header" +MOD_DAILYLIGHT_SHOW_BODY_LABEL="Show Body" +MOD_DAILYLIGHT_SHOW_REFERENCES_LABEL="Show References" +MOD_DAILYLIGHT_SHOW_COMMENTS_LABEL="Show Comments" +MOD_DAILYLIGHT_SHOW_COMMENTS_DESCRIPTION="The option to load comment below the post" +MOD_DAILYLIGHT_COMMENTS_LIMIT_LABEL="Comments limit" +MOD_DAILYLIGHT_COMMENTS_COLORFUL_LABEL="Use different colors for names" +MOD_DAILYLIGHT_COMMENTS_HEIGHT_LABEL="Comments Height" +MOD_DAILYLIGHT_COMMENTS_HEIGHT_DESCRIPTION="Use 300 for auto height. Any higher value to set custom height, since 300 is the smallest height available." +MOD_DAILYLIGHT_LINK_LABEL="Show Link" +MOD_DAILYLIGHT_LINK_DESCRIPTION="Should we show the link to the daily scripture channel on Telegram." +MOD_DAILYLIGHT_SHOW_DATE_FOOTER_LABEL="Show Date Footer" +MOD_DAILYLIGHT_WIDTH_LABEL="Width" +MOD_DAILYLIGHT_AUTHOR_PHOTO_LABEL="Author Photo" +MOD_DAILYLIGHT_AUTO="Auto" +MOD_DAILYLIGHT_ALWAYS_SHOW="Always show" +MOD_DAILYLIGHT_ALWAYS_HIDE="Always hide" +MOD_DAILYLIGHT_COLOR_LABEL="Color" +MOD_DAILYLIGHT_DEFAULT="Default" +MOD_DAILYLIGHT_CYAN="Cyan" +MOD_DAILYLIGHT_GREEN="Green" +MOD_DAILYLIGHT_YELLOW="Yellow" +MOD_DAILYLIGHT_RED="Red" +MOD_DAILYLIGHT_WHITE="White" +MOD_DAILYLIGHT_CUSTOM="Custom" +MOD_DAILYLIGHT_CUSTOM_COLOR_LABEL="Custom Color" +MOD_DAILYLIGHT_THEME_LABEL="Theme" +MOD_DAILYLIGHT_LIGHT_THEME="Light Theme" +MOD_DAILYLIGHT_DARK_THEME="Dark Theme" +MOD_DAILYLIGHT_DAILY_LIGHT_NOTE_LABEL="Details" +MOD_DAILYLIGHT_DAILY_LIGHT_NOTE_DESCRIPTION="
Relevant Links:
How it works

We have a script that is designed to update a repository with daily messages called "Daily Light." The script achieves this by first setting up various variables and configurations, then extracting the relevant information for the current day, and finally updating the files and pushing the changes to the repository.

In the first part, the script sets up the file paths, key identifiers, and date information. It establishes the script's directory, the Daily Light file location, and the morning and evening keys used to identify specific sections of the file. It also sets the current date based on the "Africa/Windhoek" timezone. After setting up the configurations, the script searches the Daily Light file for the current day's details using the 'grep' command, which matches the date with the corresponding line of text.

In the second part, the script formats and extracts the relevant information from the matched line of text. It splits the line into separate sections for the morning and evening messages, as well as the respective verses for each. Next, it creates two sets of formatted text—one in HTML and the other in Markdown. These formatted texts include the morning and evening messages, verses, and a link to a Telegram channel.

Finally, the script writes the formatted text to four separate files—morning.html, evening.html, morning.md, and evening.md. It then creates a README.md file with both the morning and evening messages and verses, along with a link to the Telegram channel. Lastly, the script commits the changes with a git commit command, using the current date as the commit message, and pushes the changes to the repository. This ensures that the repository stays updated with the latest Daily Light details for users to access.

" \ No newline at end of file diff --git a/language/en-GB/index.html b/language/en-GB/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/language/en-GB/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/language/index.html b/language/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/language/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/mod_dailylight.php b/mod_dailylight.php new file mode 100644 index 0000000..13f5cc6 --- /dev/null +++ b/mod_dailylight.php @@ -0,0 +1,42 @@ + + @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'); + +// Include the helper functions only once +JLoader::register('ModDailyLightHelper', __DIR__ . '/helper.php'); + +// get the daily light +$today = new ModDailyLightHelper($params); + +// set the time of day +$target = $params->get('time_of_day', 3); +$times = ($target == 3) ? ['morning', 'evening']:(($target == 1) ? ['morning']:['evening']); + +// get the module class sfx (local) +$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'), ENT_COMPAT, 'UTF-8'); + +// load the default Tmpl +require JModuleHelper::getLayoutPath('mod_dailylight', $params->get('layout', 'default')); diff --git a/mod_dailylight.xml b/mod_dailylight.xml new file mode 100644 index 0000000..43e52af --- /dev/null +++ b/mod_dailylight.xml @@ -0,0 +1,310 @@ + + + MOD_DAILYLIGHT + 9th 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.1.2 + MOD_DAILYLIGHT_XML_DESCRIPTION + + + script.php + + + + en-GB/en-GB.mod_dailylight.ini + en-GB/en-GB.mod_dailylight.sys.ini + + + + + mod_dailylight.php + README.md + helper.php + index.html + language + fields + rules + tmpl + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + +
+
+
+
\ No newline at end of file diff --git a/rules/index.html b/rules/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/rules/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/script.php b/script.php new file mode 100644 index 0000000..a3076aa --- /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'); + +/** + * Dailylight script file. + * + * @package DailyLight + */ +class mod_DailyLightInstallerScript +{ + + /** + * 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 new file mode 100644 index 0000000..42dab04 --- /dev/null +++ b/tmpl/default.php @@ -0,0 +1,88 @@ + + @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'); + + +?> +date_name): ?> +
+ get('show_header', 1) == 1): ?> + <get('header', 'h2'); ?>>date_name; ?>get('header', 'h2'); ?>> + + + get('show_name_header', 1) == 1): ?> + <get('name_header', 'h3'); ?>>{$time}->name; ?>get('name_header', 'h3'); ?>> + + get('show_section_header', 1) == 1): ?> + <get('section_header', 'h5'); ?>>{$time}->header; ?>get('section_header', 'h5'); ?>> + + get('show_body', 1) == 1): ?> + + + get('show_references', 1) == 1): ?> +

{$time}->references); ?>

+ + {'comments.' . $time}): ?> + {'comments.' . $time}; ?> + + + get('link', 1) == 1): ?> + + get('show_date_footer', 0) == 1): ?> + date_name; ?> + + + + + + get('show_date_footer', 0) == 1): ?> +

date_name; ?>

+ + +
+get('type', 1) == 2 && ($today->{'telegram.morning'} || $today->{'telegram.evening'})): ?> +
+ + + {'telegram.' . $time}): ?> + +

+ + {'telegram.' . $time}; ?> + {'comments.' . $time}): ?> + {'comments.' . $time}; ?> + + + + +
+ + + diff --git a/tmpl/index.html b/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file