update - v1.0.1
This commit is contained in:
parent
40e5c4f41f
commit
7eede35961
@ -1,4 +1,4 @@
|
||||
# Dailyscripture (1.0.0)
|
||||
# Dailyscripture (1.0.1)
|
||||
|
||||
Display the daily scripture from [https://github.com/trueChristian/daily-scripture](https://github.com/trueChristian/daily-scripture).
|
||||
|
||||
@ -8,8 +8,8 @@ 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*: 5th January, 2022
|
||||
+ *Version*: 1.0.0
|
||||
+ *Last Build*: 6th January, 2022
|
||||
+ *Version*: 1.0.1
|
||||
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
|
||||
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
|
49
helper.php
49
helper.php
@ -26,6 +26,8 @@
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\CMS\Date\Date;
|
||||
use Joomla\CMS\Factory;
|
||||
|
||||
class ModDailyScriptureHelper
|
||||
{
|
||||
@ -62,12 +64,12 @@ class ModDailyScriptureHelper
|
||||
protected $telegramID = 440;
|
||||
|
||||
/**
|
||||
* Telegram Date = ID
|
||||
* Telegram Date of the telegramID
|
||||
*
|
||||
* @var int
|
||||
* @var string
|
||||
* @since 1.0
|
||||
*/
|
||||
protected $telegramDate = 1640995200;
|
||||
protected $telegramDate = 'Saturday 01 January, 2022';
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@ -131,15 +133,17 @@ class ModDailyScriptureHelper
|
||||
protected function setTelegram()
|
||||
{
|
||||
// get today
|
||||
$today = time();
|
||||
$today = $this->getTimeStamp();
|
||||
// get the telegram date
|
||||
$telegram_date = $this->getTimeStamp($this->telegramDate);
|
||||
// get the difference
|
||||
$difference = $today - $this->telegramDate;
|
||||
// get the number of days
|
||||
$days = round($difference / (60 * 60 * 24));
|
||||
$difference = $today - $telegram_date;
|
||||
// get the number of days (plus one of the current date)
|
||||
$days = round($difference / 86400) + 1;
|
||||
// add the days
|
||||
$day = $this->telegramID + $days;
|
||||
$id = $this->telegramID + $days;
|
||||
// validate the ID
|
||||
if (($id = $this->validateID($day)) > 0)
|
||||
if ($id > 0)
|
||||
{
|
||||
// get the width
|
||||
$width = $this->params->get('width', 100);
|
||||
@ -155,27 +159,22 @@ class ModDailyScriptureHelper
|
||||
}
|
||||
|
||||
/**
|
||||
* validate the current ID of the post
|
||||
* get today's time stamp based on user
|
||||
*
|
||||
* @return int the post ID
|
||||
* @return int the timestamp
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
protected function validateID($id)
|
||||
protected function getTimeStamp($getDate = 'now')
|
||||
{
|
||||
// url to post
|
||||
$post_url = "https://t.me/daily_scripture/$id?embed=1";
|
||||
// try to get post (painful work around because of an ugly API)
|
||||
if (($post = $this->getFileContents($post_url, false)) !== false && strpos($post, 'tgme_widget_message_error') === false)
|
||||
{
|
||||
return $id;
|
||||
}
|
||||
// try again
|
||||
if ($id > 0)
|
||||
{
|
||||
return $this->validateID(--$id);
|
||||
}
|
||||
return 0;
|
||||
// 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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,6 @@
|
||||
MOD_DAILYSCRIPTURE="Dailyscripture"
|
||||
MOD_DAILYSCRIPTURE_DESCRIPTION="Display the daily scripture from https://github.com/trueChristian/daily-scripture."
|
||||
MOD_DAILYSCRIPTURE_XML_DESCRIPTION="<h1>Dailyscripture (v.1.0.0)</h1> <div style='clear: both;'></div><p>Display the daily scripture from https://github.com/trueChristian/daily-scripture.</p><p>Created by <a href='https://www.vdm.io/' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 1st January, 2022</small></p>"
|
||||
MOD_DAILYSCRIPTURE_XML_DESCRIPTION="<h1>Dailyscripture (v.1.0.1)</h1> <div style='clear: both;'></div><p>Display the daily scripture from https://github.com/trueChristian/daily-scripture.</p><p>Created by <a href='https://www.vdm.io/' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 1st January, 2022</small></p>"
|
||||
MOD_DAILYSCRIPTURE_THERE_WAS_AN_ERROR_PLEASE_TRY_AGAIN_LATTER="There was an error, please try again latter."
|
||||
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"
|
||||
|
@ -1,6 +1,6 @@
|
||||
MOD_DAILYSCRIPTURE="Dailyscripture"
|
||||
MOD_DAILYSCRIPTURE_DESCRIPTION="Display the daily scripture from https://github.com/trueChristian/daily-scripture."
|
||||
MOD_DAILYSCRIPTURE_XML_DESCRIPTION="<h1>Dailyscripture (v.1.0.0)</h1> <div style='clear: both;'></div><p>Display the daily scripture from https://github.com/trueChristian/daily-scripture.</p><p>Created by <a href='https://www.vdm.io/' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 1st January, 2022</small></p>"
|
||||
MOD_DAILYSCRIPTURE_XML_DESCRIPTION="<h1>Dailyscripture (v.1.0.1)</h1> <div style='clear: both;'></div><p>Display the daily scripture from https://github.com/trueChristian/daily-scripture.</p><p>Created by <a href='https://www.vdm.io/' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 1st January, 2022</small></p>"
|
||||
MOD_DAILYSCRIPTURE_THERE_WAS_AN_ERROR_PLEASE_TRY_AGAIN_LATTER="There was an error, please try again latter."
|
||||
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"
|
||||
|
@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="module" version="4" client="site" method="upgrade">
|
||||
<name>MOD_DAILYSCRIPTURE</name>
|
||||
<creationDate>5th January, 2022</creationDate>
|
||||
<creationDate>6th January, 2022</creationDate>
|
||||
<author>Llewellyn van der Merwe</author>
|
||||
<authorEmail>joomla@vdm.io</authorEmail>
|
||||
<authorUrl>https://www.vdm.io/</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>1.0.0</version>
|
||||
<version>1.0.1</version>
|
||||
<description>MOD_DAILYSCRIPTURE_XML_DESCRIPTION</description>
|
||||
|
||||
<!-- Language files -->
|
||||
|
Loading…
Reference in New Issue
Block a user