5
0
Fork 0

first commit - v1.0.0

This commit is contained in:
Llewellyn van der Merwe 2022-01-04 17:41:07 +02:00
commit ab2a9f0aec
Signed by: Llewellyn
GPG Key ID: EFC0C720A240551C
12 changed files with 335 additions and 0 deletions

1
fields/index.html Normal file
View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

176
helper.php Normal file
View File

@ -0,0 +1,176 @@
<?php
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
____ ____ __ __ __
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
\ \,\L\_\ __ _ __ ___ ___ ___ ___ \ \ \/\ \/\_\ ____\ \ ,_\ _ __ /\_\ \ \____ __ __\ \ ,_\ ___ _ __
\/_\__ \ /'__`\/\`'__\/' __` __`\ / __`\ /' _ `\ \ \ \ \ \/\ \ /',__\\ \ \/ /\`'__\/\ \ \ '__`\/\ \/\ \\ \ \/ / __`\/\`'__\
/\ \L\ \/\ __/\ \ \/ /\ \/\ \/\ \/\ \L\ \/\ \/\ \ \ \ \_\ \ \ \/\__, `\\ \ \_\ \ \/ \ \ \ \ \L\ \ \ \_\ \\ \ \_/\ \L\ \ \ \/
\ `\____\ \____\\ \_\ \ \_\ \_\ \_\ \____/\ \_\ \_\ \ \____/\ \_\/\____/ \ \__\\ \_\ \ \_\ \_,__/\ \____/ \ \__\ \____/\ \_\
\/_____/\/____/ \/_/ \/_/\/_/\/_/\/___/ \/_/\/_/ \/___/ \/_/\/___/ \/__/ \/_/ \/_/\/___/ \/___/ \/__/\/___/ \/_/
/------------------------------------------------------------------------------------------------------------------------------------/
@version 2.0.x
@created 22nd October, 2015
@package Sermon Distributor
@subpackage helper.php
@author Llewellyn van der Merwe <https://truechristian.church/>
@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 ModDailyScriptureHelper
{
/**
* Scripture
*
* @var array
* @since 1.0
*/
protected $scripture;
/**
* Constructor.
*
* @param Registry $params the module settings
*
* @since 1.0
*/
public function __construct(Registry $params = null)
{
// 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";
// get the scripture object
$this->scripture = $this->getFileContents($path);
}
/**
* 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($name)
{
if ($this->checkScripture($name))
{
return $this->scripture->{$name};
}
return null;
}
/**
* get the file content
*
* @input string $path The path to get remotely
*
* @returns object on success
*
* @since 1.0
*/
protected function getFileContents($path)
{
// use basic file get content for now
if (($content = @file_get_contents($path)) !== FALSE)
{
// return if found
if ($this->checkJson($content))
{
return json_decode($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 ($this->checkJson($content))
{
return json_decode($content);
}
}
return false;
}
/**
* 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 scripture object with value
*
* @input key The key being requested
*
* @returns bool true on success
*
* @since 1.0
*/
protected function checkScripture($key)
{
if (isset($this->scripture) && is_object($this->scripture) && isset($this->scripture->{$key}))
{
return true;
}
return false;
}
}

1
index.html Normal file
View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,8 @@
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://truechristian.church/' 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_LINK_LABEL="Show Link"
MOD_DAILYSCRIPTURE_LINK_DESCRIPTION="Should we show the link to the daily scripture channel on Telegram."
MOD_DAILYSCRIPTURE_YES="Yes"
MOD_DAILYSCRIPTURE_NO="No"

View File

@ -0,0 +1,8 @@
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://truechristian.church/' 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_LINK_LABEL="Show Link"
MOD_DAILYSCRIPTURE_LINK_DESCRIPTION="Should we show the link to the daily scripture channel on Telegram."
MOD_DAILYSCRIPTURE_YES="Yes"
MOD_DAILYSCRIPTURE_NO="No"

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

1
language/index.html Normal file
View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

38
mod_dailyscripture.php Normal file
View File

@ -0,0 +1,38 @@
<?php
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
____ ____ __ __ __
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
\ \,\L\_\ __ _ __ ___ ___ ___ ___ \ \ \/\ \/\_\ ____\ \ ,_\ _ __ /\_\ \ \____ __ __\ \ ,_\ ___ _ __
\/_\__ \ /'__`\/\`'__\/' __` __`\ / __`\ /' _ `\ \ \ \ \ \/\ \ /',__\\ \ \/ /\`'__\/\ \ \ '__`\/\ \/\ \\ \ \/ / __`\/\`'__\
/\ \L\ \/\ __/\ \ \/ /\ \/\ \/\ \/\ \L\ \/\ \/\ \ \ \ \_\ \ \ \/\__, `\\ \ \_\ \ \/ \ \ \ \ \L\ \ \ \_\ \\ \ \_/\ \L\ \ \ \/
\ `\____\ \____\\ \_\ \ \_\ \_\ \_\ \____/\ \_\ \_\ \ \____/\ \_\/\____/ \ \__\\ \_\ \ \_\ \_,__/\ \____/ \ \__\ \____/\ \_\
\/_____/\/____/ \/_/ \/_/\/_/\/_/\/___/ \/_/\/_/ \/___/ \/_/\/___/ \/__/ \/_/ \/_/\/___/ \/___/ \/__/\/___/ \/_/
/------------------------------------------------------------------------------------------------------------------------------------/
@version 2.0.x
@created 22nd October, 2015
@package Sermon Distributor
@subpackage mod_dailyscripture.php
@author Llewellyn van der Merwe <https://truechristian.church/>
@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('ModDailyScriptureHelper', __DIR__ . '/helper.php');
// get the daily scripture
$today = new ModDailyScriptureHelper($params);
// 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_dailyscripture', $params->get('layout', 'default'));

55
mod_dailyscripture.xml Normal file
View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="4" client="site" method="upgrade">
<name>MOD_DAILYSCRIPTURE</name>
<creationDate>4th January, 2022</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>info+joomla@truechristian.church</authorEmail>
<authorUrl>https://truechristian.church/</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>
<description>MOD_DAILYSCRIPTURE_XML_DESCRIPTION</description>
<!-- Language files -->
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.mod_dailyscripture.ini</language>
<language tag="en-GB">en-GB/en-GB.mod_dailyscripture.sys.ini</language>
</languages>
<!-- Model files -->
<files>
<filename module="mod_dailyscripture">mod_dailyscripture.php</filename>
<filename>helper.php</filename>
<filename>index.html</filename>
<folder>language</folder>
<folder>fields</folder>
<folder>rules</folder>
<folder>tmpl</folder>
</files>
<!-- Config parameter -->
<config>
<fields name="params">
<!-- default paths of basic fieldset points to the module -->
<fieldset name="basic" label="basic"
addrulepath="/modules/mod_dailyscripture/rules"
addfieldpath="/modules/mod_dailyscripture/fields"
>
<!-- Link Field. Type: Radio. (joomla) -->
<field
type="radio"
name="link"
label="MOD_DAILYSCRIPTURE_LINK_LABEL"
description="MOD_DAILYSCRIPTURE_LINK_DESCRIPTION"
class="btn-group btn-group-yesno"
default="1">
<!-- Option Set. -->
<option value="1">
MOD_DAILYSCRIPTURE_YES</option>
<option value="0">
MOD_DAILYSCRIPTURE_NO</option>
</field>
</fieldset>
</fields>
</config>
</extension>

1
rules/index.html Normal file
View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

44
tmpl/default.php Normal file
View File

@ -0,0 +1,44 @@
<?php
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
____ ____ __ __ __
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
\ \,\L\_\ __ _ __ ___ ___ ___ ___ \ \ \/\ \/\_\ ____\ \ ,_\ _ __ /\_\ \ \____ __ __\ \ ,_\ ___ _ __
\/_\__ \ /'__`\/\`'__\/' __` __`\ / __`\ /' _ `\ \ \ \ \ \/\ \ /',__\\ \ \/ /\`'__\/\ \ \ '__`\/\ \/\ \\ \ \/ / __`\/\`'__\
/\ \L\ \/\ __/\ \ \/ /\ \/\ \/\ \/\ \L\ \/\ \/\ \ \ \ \_\ \ \ \/\__, `\\ \ \_\ \ \/ \ \ \ \ \L\ \ \ \_\ \\ \ \_/\ \L\ \ \ \/
\ `\____\ \____\\ \_\ \ \_\ \_\ \_\ \____/\ \_\ \_\ \ \____/\ \_\/\____/ \ \__\\ \_\ \ \_\ \_,__/\ \____/ \ \__\ \____/\ \_\
\/_____/\/____/ \/_/ \/_/\/_/\/_/\/___/ \/_/\/_/ \/___/ \/_/\/___/ \/__/ \/_/ \/_/\/___/ \/___/ \/__/\/___/ \/_/
/------------------------------------------------------------------------------------------------------------------------------------/
@version 2.0.x
@created 22nd October, 2015
@package Sermon Distributor
@subpackage default.php
@author Llewellyn van der Merwe <https://truechristian.church/>
@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');
?>
<?php if ($today->scripture): ?>
<<?php echo $params->get('name_header', 'h3'); ?>><?php echo $today->name; ?></<?php echo $params->get('name_header', 'h3'); ?>>
<ul style="list-style-type: none;">
<?php foreach ($today->scripture as $scripture): ?>
<li><b><?php echo $scripture->nr; ?></b> <?php echo $scripture->text; ?></li>
<?php endforeach; ?>
</ul>
<?php if ($params->get('link', 1) == 1): ?>
<a href="https://t.me/s/<?php echo $today->telegram; ?>" target="_blank"><?php echo $today->date; ?></a>
<?php else: ?>
<?php echo $today->date; ?>
<?php endif; ?>
<?php else: ?>
<?php echo JText::_('MOD_DAILYSCRIPTURE_THERE_WAS_AN_ERROR_PLEASE_TRY_AGAIN_LATTER'); ?>
<?php endif; ?>

1
tmpl/index.html Normal file
View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>