-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod_evangelizo.php
53 lines (52 loc) · 1.93 KB
/
mod_evangelizo.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
* @package mod_evangelizo
* @version 1.0
* @author Nicolas Fischmeister - Agence web Cibles
* @link http://www.cibles.fr
* @copyright Copyright (C) 2018 Agence web Cibles. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$date = JHtml::_('date', '', 'Y-m-d');
$langue = $params->get('langue');
$document = JFactory::getDocument();
$document->addStyleDeclaration('
.evangelizo .modal { max-width:800px; }
.evangelizo .modal-body { max-height:inherit; }
.evangelizo .modal-body > div { padding:0.5em 1em 1em; }
.evangelizo .modal-body > div img { float:left; margin:0 1em 0.5em 0; max-width:30%; }
');
$file = realpath(dirname(__FILE__)).'/mod_evangelizo.json';
chmod($file, 0666);
$json = file_get_contents($file);
if(!isset($json) OR empty($json))
$get = 1;
else
{
$evangelizo = json_decode($json);
if($evangelizo->date != $date OR $evangelizo->langue != $langue)
$get = 1;
}
if(isset($get) AND $get == 1)
{
$json = file_get_contents('https://publication.evangelizo.ws/'.$params->get('langue', 'AM').'/days/'.$date);
$evangelizo = json_decode($json);
$evangelizo = $evangelizo->data;
foreach($evangelizo->saints AS $i => $saint)
{
$bio = $saint->bio;
$bio = preg_replace('#(font-size\s*?:.*?(;|(?=""|\'|;)))#', '', $bio);
$bio = preg_replace('#(color\s*?:.*?(;|(?=""|\'|;)))#', '', $bio);
$bio = preg_replace('#(line-height\s*?:.*?(;|(?=""|\'|;)))#', '', $bio);
$bio = preg_replace('#<p[^>]*>[[:space:]| ]*</p>#', '', $bio);
$evangelizo->saints[$i]->bio = $bio;
}
$evangelizo->langue = $langue;
$json = json_encode($evangelizo);
$write = file_put_contents($file, $json);
}
$fete = $evangelizo->liturgic_title;
$saints = $evangelizo->saints;
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'), ENT_COMPAT, 'UTF-8');
require JModuleHelper::getLayoutPath('mod_evangelizo', $params->get('layout', 'default'));