classe strftime
This commit is contained in:
parent
2cd7ec458c
commit
fd85a595be
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
## Version 11.5.08
|
## Version 11.5.08
|
||||||
### Corrections :
|
### Corrections :
|
||||||
- Bugs divers et dépréciation PHP 8.1
|
- Bugs divers et dépréciations PHP 8.1
|
||||||
|
- Ajout d'une classe spécifique strftime suite à sa dépréciation.
|
||||||
|
|
||||||
## Version 11.5.07
|
## Version 11.5.07
|
||||||
### Correction :
|
### Correction :
|
||||||
|
|
|
@ -12,5 +12,6 @@ class autoload {
|
||||||
require_once 'core/class/phpmailer/SMTP.class.php';
|
require_once 'core/class/phpmailer/SMTP.class.php';
|
||||||
require_once "core/class/jsondb/Dot.class.php";
|
require_once "core/class/jsondb/Dot.class.php";
|
||||||
require_once "core/class/jsondb/JsonDb.class.php";
|
require_once "core/class/jsondb/JsonDb.class.php";
|
||||||
|
require_once "core/class/strftime/php-8.1-strftime.class.php";
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,217 @@
|
||||||
|
<?php
|
||||||
|
namespace PHP81_BC;
|
||||||
|
|
||||||
|
use DateTime;
|
||||||
|
use DateTimeZone;
|
||||||
|
use DateTimeInterface;
|
||||||
|
use Exception;
|
||||||
|
use IntlDateFormatter;
|
||||||
|
use IntlGregorianCalendar;
|
||||||
|
use InvalidArgumentException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Locale-formatted PHP81_BC\strftime using IntlDateFormatter (PHP 8.1 compatible)
|
||||||
|
* This provides a cross-platform alternative to PHP81_BC\strftime() for when it will be removed from PHP.
|
||||||
|
* Note that output can be slightly different between libc sprintf and this function as it is using ICU.
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
* use function \PHP81_BC\PHP81_BC\strftime;
|
||||||
|
* echo PHP81_BC\strftime('%A %e %B %Y %X', new \DateTime('2021-09-28 00:00:00'), 'fr_FR');
|
||||||
|
*
|
||||||
|
* Original use:
|
||||||
|
* \setlocale(LC_TIME, 'fr_FR.UTF-8');
|
||||||
|
* echo \PHP81_BC\strftime('%A %e %B %Y %X', strtotime('2021-09-28 00:00:00'));
|
||||||
|
*
|
||||||
|
* @param string $format Date format
|
||||||
|
* @param integer|string|DateTime $timestamp Timestamp
|
||||||
|
* @return string
|
||||||
|
* @author BohwaZ <https://bohwaz.net/>
|
||||||
|
*/
|
||||||
|
function strftime (string $format, $timestamp = null, ?string $locale = null) : string {
|
||||||
|
if (!($timestamp instanceof DateTimeInterface)) {
|
||||||
|
$timestamp = is_int($timestamp) ? '@' . $timestamp : (string) $timestamp;
|
||||||
|
|
||||||
|
try {
|
||||||
|
$timestamp = new DateTime($timestamp);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
throw new InvalidArgumentException('$timestamp argument is neither a valid UNIX timestamp, a valid date-time string or a DateTime object.', 0, $e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$timestamp->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||||
|
|
||||||
|
if (empty($locale)) {
|
||||||
|
// get current locale
|
||||||
|
$locale = setlocale(LC_TIME, '0');
|
||||||
|
}
|
||||||
|
// remove trailing part not supported by ext-intl locale
|
||||||
|
$locale = preg_replace('/[^\w-].*$/', '', $locale);
|
||||||
|
|
||||||
|
$intl_formats = [
|
||||||
|
'%a' => 'EEE', // An abbreviated textual representation of the day Sun through Sat
|
||||||
|
'%A' => 'EEEE', // A full textual representation of the day Sunday through Saturday
|
||||||
|
'%b' => 'MMM', // Abbreviated month name, based on the locale Jan through Dec
|
||||||
|
'%B' => 'MMMM', // Full month name, based on the locale January through December
|
||||||
|
'%h' => 'MMM', // Abbreviated month name, based on the locale (an alias of %b) Jan through Dec
|
||||||
|
];
|
||||||
|
|
||||||
|
$intl_formatter = function (DateTimeInterface $timestamp, string $format) use ($intl_formats, $locale) {
|
||||||
|
$tz = $timestamp->getTimezone();
|
||||||
|
$date_type = IntlDateFormatter::FULL;
|
||||||
|
$time_type = IntlDateFormatter::FULL;
|
||||||
|
$pattern = '';
|
||||||
|
|
||||||
|
switch ($format) {
|
||||||
|
// %c = Preferred date and time stamp based on locale
|
||||||
|
// Example: Tue Feb 5 00:45:10 2009 for February 5, 2009 at 12:45:10 AM
|
||||||
|
case '%c':
|
||||||
|
$date_type = IntlDateFormatter::LONG;
|
||||||
|
$time_type = IntlDateFormatter::SHORT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
// %x = Preferred date representation based on locale, without the time
|
||||||
|
// Example: 02/05/09 for February 5, 2009
|
||||||
|
case '%x':
|
||||||
|
$date_type = IntlDateFormatter::SHORT;
|
||||||
|
$time_type = IntlDateFormatter::NONE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Localized time format
|
||||||
|
case '%X':
|
||||||
|
$date_type = IntlDateFormatter::NONE;
|
||||||
|
$time_type = IntlDateFormatter::MEDIUM;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$pattern = $intl_formats[$format];
|
||||||
|
}
|
||||||
|
|
||||||
|
// In October 1582, the Gregorian calendar replaced the Julian in much of Europe, and
|
||||||
|
// the 4th October was followed by the 15th October.
|
||||||
|
// ICU (including IntlDateFormattter) interprets and formats dates based on this cutover.
|
||||||
|
// Posix (including PHP81_BC\strftime) and timelib (including DateTimeImmutable) instead use
|
||||||
|
// a "proleptic Gregorian calendar" - they pretend the Gregorian calendar has existed forever.
|
||||||
|
// This leads to the same instants in time, as expressed in Unix time, having different representations
|
||||||
|
// in formatted strings.
|
||||||
|
// To adjust for this, a custom calendar can be supplied with a cutover date arbitrarily far in the past.
|
||||||
|
$calendar = IntlGregorianCalendar::createInstance();
|
||||||
|
$calendar->setGregorianChange(PHP_INT_MIN);
|
||||||
|
|
||||||
|
return (new IntlDateFormatter($locale, $date_type, $time_type, $tz, $calendar, $pattern))->format($timestamp);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Same order as https://www.php.net/manual/en/function.PHP81_BC\strftime.php
|
||||||
|
$translation_table = [
|
||||||
|
// Day
|
||||||
|
'%a' => $intl_formatter,
|
||||||
|
'%A' => $intl_formatter,
|
||||||
|
'%d' => 'd',
|
||||||
|
'%e' => function ($timestamp) {
|
||||||
|
return sprintf('% 2u', $timestamp->format('j'));
|
||||||
|
},
|
||||||
|
'%j' => function ($timestamp) {
|
||||||
|
// Day number in year, 001 to 366
|
||||||
|
return sprintf('%03d', $timestamp->format('z')+1);
|
||||||
|
},
|
||||||
|
'%u' => 'N',
|
||||||
|
'%w' => 'w',
|
||||||
|
|
||||||
|
// Week
|
||||||
|
'%U' => function ($timestamp) {
|
||||||
|
// Number of weeks between date and first Sunday of year
|
||||||
|
$day = new DateTime(sprintf('%d-01 Sunday', $timestamp->format('Y')));
|
||||||
|
return sprintf('%02u', 1 + ($timestamp->format('z') - $day->format('z')) / 7);
|
||||||
|
},
|
||||||
|
'%V' => 'W',
|
||||||
|
'%W' => function ($timestamp) {
|
||||||
|
// Number of weeks between date and first Monday of year
|
||||||
|
$day = new DateTime(sprintf('%d-01 Monday', $timestamp->format('Y')));
|
||||||
|
return sprintf('%02u', 1 + ($timestamp->format('z') - $day->format('z')) / 7);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Month
|
||||||
|
'%b' => $intl_formatter,
|
||||||
|
'%B' => $intl_formatter,
|
||||||
|
'%h' => $intl_formatter,
|
||||||
|
'%m' => 'm',
|
||||||
|
|
||||||
|
// Year
|
||||||
|
'%C' => function ($timestamp) {
|
||||||
|
// Century (-1): 19 for 20th century
|
||||||
|
return floor($timestamp->format('Y') / 100);
|
||||||
|
},
|
||||||
|
'%g' => function ($timestamp) {
|
||||||
|
return substr($timestamp->format('o'), -2);
|
||||||
|
},
|
||||||
|
'%G' => 'o',
|
||||||
|
'%y' => 'y',
|
||||||
|
'%Y' => 'Y',
|
||||||
|
|
||||||
|
// Time
|
||||||
|
'%H' => 'H',
|
||||||
|
'%k' => function ($timestamp) {
|
||||||
|
return sprintf('% 2u', $timestamp->format('G'));
|
||||||
|
},
|
||||||
|
'%I' => 'h',
|
||||||
|
'%l' => function ($timestamp) {
|
||||||
|
return sprintf('% 2u', $timestamp->format('g'));
|
||||||
|
},
|
||||||
|
'%M' => 'i',
|
||||||
|
'%p' => 'A', // AM PM (this is reversed on purpose!)
|
||||||
|
'%P' => 'a', // am pm
|
||||||
|
'%r' => 'h:i:s A', // %I:%M:%S %p
|
||||||
|
'%R' => 'H:i', // %H:%M
|
||||||
|
'%S' => 's',
|
||||||
|
'%T' => 'H:i:s', // %H:%M:%S
|
||||||
|
'%X' => $intl_formatter, // Preferred time representation based on locale, without the date
|
||||||
|
|
||||||
|
// Timezone
|
||||||
|
'%z' => 'O',
|
||||||
|
'%Z' => 'T',
|
||||||
|
|
||||||
|
// Time and Date Stamps
|
||||||
|
'%c' => $intl_formatter,
|
||||||
|
'%D' => 'm/d/Y',
|
||||||
|
'%F' => 'Y-m-d',
|
||||||
|
'%s' => 'U',
|
||||||
|
'%x' => $intl_formatter,
|
||||||
|
];
|
||||||
|
|
||||||
|
$out = preg_replace_callback('/(?<!%)%([_#-]?)([a-zA-Z])/', function ($match) use ($translation_table, $timestamp) {
|
||||||
|
$prefix = $match[1];
|
||||||
|
$char = $match[2];
|
||||||
|
$pattern = '%'.$char;
|
||||||
|
if ($pattern == '%n') {
|
||||||
|
return "\n";
|
||||||
|
} elseif ($pattern == '%t') {
|
||||||
|
return "\t";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($translation_table[$pattern])) {
|
||||||
|
throw new InvalidArgumentException(sprintf('Format "%s" is unknown in time format', $pattern));
|
||||||
|
}
|
||||||
|
|
||||||
|
$replace = $translation_table[$pattern];
|
||||||
|
|
||||||
|
if (is_string($replace)) {
|
||||||
|
$result = $timestamp->format($replace);
|
||||||
|
} else {
|
||||||
|
$result = $replace($timestamp, $pattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($prefix) {
|
||||||
|
case '_':
|
||||||
|
// replace leading zeros with spaces but keep last char if also zero
|
||||||
|
return preg_replace('/\G0(?=.)/', ' ', $result);
|
||||||
|
case '#':
|
||||||
|
case '-':
|
||||||
|
// remove leading zeros but keep last char if also zero
|
||||||
|
return preg_replace('/^0+(?=.)/', '', $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}, $format);
|
||||||
|
|
||||||
|
$out = str_replace('%%', '%', $out);
|
||||||
|
return $out;
|
||||||
|
}
|
|
@ -2626,9 +2626,9 @@ class core extends common {
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
// Journalisation
|
// Journalisation
|
||||||
$dataLog = mb_detect_encoding(strftime('%d/%m/%y',time()), 'UTF-8', true)
|
$dataLog = mb_detect_encoding(PHP81_BC\strftime('%d/%m/%y',time()), 'UTF-8', true)
|
||||||
? strftime('%d/%m/%y',time()) . ';' . strftime('%R',time()) . ';'
|
? PHP81_BC\strftime('%d/%m/%y',time()) . ';' . PHP81_BC\strftime('%R',time()) . ';'
|
||||||
: utf8_encode(strftime('%d/%m/%y',time())) . ';' . utf8_encode(strftime('%R',time())) . ';' ;
|
: utf8_encode(PHP81_BC\strftime('%d/%m/%y',time())) . ';' . utf8_encode(PHP81_BC\strftime('%R',time())) . ';' ;
|
||||||
$dataLog .= helper::getIp($this->getData(['config','connect','anonymousIp'])) . ';';
|
$dataLog .= helper::getIp($this->getData(['config','connect','anonymousIp'])) . ';';
|
||||||
$dataLog .= $this->getUser('id') ? $this->getUser('id') . ';' : 'anonyme' . ';';
|
$dataLog .= $this->getUser('id') ? $this->getUser('id') . ';' : 'anonyme' . ';';
|
||||||
$dataLog .= $this->getUrl();
|
$dataLog .= $this->getUrl();
|
||||||
|
|
|
@ -316,9 +316,9 @@ class addon extends common {
|
||||||
$store[$key]['category'],
|
$store[$key]['category'],
|
||||||
'<a href="' . self::BASEURL_STORE . self::MODULE_STORE . $key . '" target="_blank" >'.$store[$key]['title'].'</a>',
|
'<a href="' . self::BASEURL_STORE . self::MODULE_STORE . $key . '" target="_blank" >'.$store[$key]['title'].'</a>',
|
||||||
$store[$key]['version'],
|
$store[$key]['version'],
|
||||||
mb_detect_encoding(strftime('%d %B %Y', $store[$key]['versionDate']), 'UTF-8', true)
|
mb_detect_encoding(PHP81_BC\strftime('%d %B %Y', $store[$key]['versionDate']), 'UTF-8', true)
|
||||||
? strftime('%d %B %Y', $store[$key]['versionDate'])
|
? PHP81_BC\strftime('%d %B %Y', $store[$key]['versionDate'])
|
||||||
: utf8_encode(strftime('%d %B %Y', $store[$key]['versionDate'])),
|
: utf8_encode(PHP81_BC\strftime('%d %B %Y', $store[$key]['versionDate'])),
|
||||||
implode(', ', array_keys($inPagesTitle,$key)),
|
implode(', ', array_keys($inPagesTitle,$key)),
|
||||||
template::button('moduleExport' . $key, [
|
template::button('moduleExport' . $key, [
|
||||||
'class' => $class,
|
'class' => $class,
|
||||||
|
@ -342,9 +342,9 @@ class addon extends common {
|
||||||
public function item() {
|
public function item() {
|
||||||
$store = json_decode(helper::getUrlContents(self::BASEURL_STORE . self::MODULE_STORE . 'list'), true);
|
$store = json_decode(helper::getUrlContents(self::BASEURL_STORE . self::MODULE_STORE . 'list'), true);
|
||||||
self::$storeItem = $store [$this->getUrl(2)] ;
|
self::$storeItem = $store [$this->getUrl(2)] ;
|
||||||
self::$storeItem ['fileDate'] = mb_detect_encoding(strftime('%d %B %Y',self::$storeItem ['fileDate']), 'UTF-8', true)
|
self::$storeItem ['fileDate'] = mb_detect_encoding(PHP81_BC\strftime('%d %B %Y',self::$storeItem ['fileDate']), 'UTF-8', true)
|
||||||
? strftime('%d %B %Y', self::$storeItem ['fileDate'])
|
? PHP81_BC\strftime('%d %B %Y', self::$storeItem ['fileDate'])
|
||||||
: utf8_encode(strftime('%d %B %Y', self::$storeItem ['fileDate']));
|
: utf8_encode(PHP81_BC\strftime('%d %B %Y', self::$storeItem ['fileDate']));
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'title' =>'Module ' . self::$storeItem['title'],
|
'title' =>'Module ' . self::$storeItem['title'],
|
||||||
|
|
|
@ -734,9 +734,9 @@ class config extends common {
|
||||||
$d = $this->getData(['blacklist']);
|
$d = $this->getData(['blacklist']);
|
||||||
$data = '';
|
$data = '';
|
||||||
foreach ($d as $key => $item) {
|
foreach ($d as $key => $item) {
|
||||||
$data .= mb_detect_encoding(strftime('%d/%m/%y',$item['lastFail']), 'UTF-8', true)
|
$data .= mb_detect_encoding(PHP81_BC\strftime('%d/%m/%y',$item['lastFail']), 'UTF-8', true)
|
||||||
? strftime('%d/%m/%y',$item['lastFail']) . ';' . utf8_encode(strftime('%R',$item['lastFail'])) . ';'
|
? PHP81_BC\strftime('%d/%m/%y',$item['lastFail']) . ';' . utf8_encode(PHP81_BC\strftime('%R',$item['lastFail'])) . ';'
|
||||||
: utf8_encode(strftime('%d/%m/%y',$item['lastFail'])) . ';' . utf8_encode(strftime('%R',$item['lastFail'])) . ';' ;
|
: utf8_encode(PHP81_BC\strftime('%d/%m/%y',$item['lastFail'])) . ';' . utf8_encode(PHP81_BC\strftime('%R',$item['lastFail'])) . ';' ;
|
||||||
$data .= $key . ';' . $item['ip'] . ';' . $item['connectFail'] . PHP_EOL;
|
$data .= $key . ';' . $item['ip'] . ';' . $item['connectFail'] . PHP_EOL;
|
||||||
}
|
}
|
||||||
file_put_contents($fileName,$data,FILE_APPEND);
|
file_put_contents($fileName,$data,FILE_APPEND);
|
||||||
|
|
|
@ -487,9 +487,9 @@ class user extends common {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Journalisation
|
// Journalisation
|
||||||
$dataLog = mb_detect_encoding(strftime('%d/%m/%y',time()), 'UTF-8', true)
|
$dataLog = mb_detect_encoding(PHP81_BC\strftime('%d/%m/%y',time()), 'UTF-8', true)
|
||||||
? strftime('%d/%m/%y',time()) . ';' . strftime('%R',time()) . ';'
|
? PHP81_BC\strftime('%d/%m/%y',time()) . ';' . PHP81_BC\strftime('%R',time()) . ';'
|
||||||
: utf8_encode(strftime('%d/%m/%y',time())) . ';' . utf8_encode(strftime('%R',time())) . ';' ;
|
: utf8_encode(PHP81_BC\strftime('%d/%m/%y',time())) . ';' . utf8_encode(PHP81_BC\strftime('%R',time())) . ';' ;
|
||||||
$dataLog .= helper::getIp($this->getData(['config','connect','anonymousIp'])) . ';';
|
$dataLog .= helper::getIp($this->getData(['config','connect','anonymousIp'])) . ';';
|
||||||
$dataLog .= $this->getInput('userLoginId', helper::FILTER_ID) . ';' ;
|
$dataLog .= $this->getInput('userLoginId', helper::FILTER_ID) . ';' ;
|
||||||
$dataLog .= $this->getUrl() .';' ;
|
$dataLog .= $this->getUrl() .';' ;
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -278,9 +278,9 @@ class blog extends common {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
self::$comments[] = [
|
self::$comments[] = [
|
||||||
mb_detect_encoding(strftime('%d %B %Y - %H:%M', $comment['createdOn']), 'UTF-8', true)
|
mb_detect_encoding(PHP81_BC\strftime('%d %B %Y - %H:%M', $comment['createdOn']), 'UTF-8', true)
|
||||||
? strftime('%d %B %Y - %H:%M', $comment['createdOn'])
|
? PHP81_BC\strftime('%d %B %Y - %H:%M', $comment['createdOn'])
|
||||||
: utf8_encode(strftime('%d %B %Y - %H:%M', $comment['createdOn'])),
|
: utf8_encode(PHP81_BC\strftime('%d %B %Y - %H:%M', $comment['createdOn'])),
|
||||||
$comment['content'],
|
$comment['content'],
|
||||||
$comment['userId'] ? $this->getData(['user', $comment['userId'], 'firstname']) . ' ' . $this->getData(['user', $comment['userId'], 'lastname']) : $comment['author'],
|
$comment['userId'] ? $this->getData(['user', $comment['userId'], 'firstname']) . ' ' . $this->getData(['user', $comment['userId'], 'lastname']) : $comment['author'],
|
||||||
$buttonApproval,
|
$buttonApproval,
|
||||||
|
@ -456,12 +456,12 @@ class blog extends common {
|
||||||
$approved = count($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i],'comment']));
|
$approved = count($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i],'comment']));
|
||||||
}
|
}
|
||||||
// Met en forme le tableau
|
// Met en forme le tableau
|
||||||
$date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
|
$date = mb_detect_encoding(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
|
||||||
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
|
? PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
|
||||||
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
|
: utf8_encode(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
|
||||||
$heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
|
$heure = mb_detect_encoding(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
|
||||||
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
|
? PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
|
||||||
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
|
: utf8_encode(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
|
||||||
self::$articles[] = [
|
self::$articles[] = [
|
||||||
'<a href="' . helper::baseurl() . $this->getUrl(0) . '/' . $articleIds[$i] . '" target="_blank" >' .
|
'<a href="' . helper::baseurl() . $this->getUrl(0) . '/' . $articleIds[$i] . '" target="_blank" >' .
|
||||||
$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) .
|
$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) .
|
||||||
|
|
|
@ -14,12 +14,12 @@
|
||||||
<!-- bloc signature et date -->
|
<!-- bloc signature et date -->
|
||||||
<?php echo $module::$articleSignature . ' - ';?>
|
<?php echo $module::$articleSignature . ' - ';?>
|
||||||
<?php echo template::ico('calendar-empty'); ?>
|
<?php echo template::ico('calendar-empty'); ?>
|
||||||
<?php $date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
|
<?php $date = mb_detect_encoding(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
|
||||||
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
|
? PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
|
||||||
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
|
: utf8_encode(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
|
||||||
$heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
|
$heure = mb_detect_encoding(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
|
||||||
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
|
? PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
|
||||||
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
|
: utf8_encode(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
|
||||||
echo $date . ' à ' . $heure;
|
echo $date . ' à ' . $heure;
|
||||||
?>
|
?>
|
||||||
<!-- Bloc edition -->
|
<!-- Bloc edition -->
|
||||||
|
@ -143,9 +143,9 @@
|
||||||
<?php foreach($module::$comments as $commentId => $comment): ?>
|
<?php foreach($module::$comments as $commentId => $comment): ?>
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<h4><?php echo $module::$commentsSignature[$commentId]; ?>
|
<h4><?php echo $module::$commentsSignature[$commentId]; ?>
|
||||||
le <?php echo mb_detect_encoding(strftime('%d %B %Y - %H:%M', $comment['createdOn']), 'UTF-8', true)
|
le <?php echo mb_detect_encoding(PHP81_BC\strftime('%d %B %Y - %H:%M', $comment['createdOn']), 'UTF-8', true)
|
||||||
? strftime('%d %B %Y - %H:%M', $comment['createdOn'])
|
? PHP81_BC\strftime('%d %B %Y - %H:%M', $comment['createdOn'])
|
||||||
: utf8_encode(strftime('%d %B %Y - %H:%M', $comment['createdOn']));
|
: utf8_encode(PHP81_BC\strftime('%d %B %Y - %H:%M', $comment['createdOn']));
|
||||||
?>
|
?>
|
||||||
</h4>
|
</h4>
|
||||||
<?php echo $comment['content']; ?>
|
<?php echo $comment['content']; ?>
|
||||||
|
|
|
@ -36,9 +36,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="blogDate">
|
<div class="blogDate">
|
||||||
<?php echo template::ico('calendar-empty'); ?>
|
<?php echo template::ico('calendar-empty'); ?>
|
||||||
<?php echo mb_detect_encoding(strftime('%d %B %Y - %H:%M', $article['publishedOn']), 'UTF-8', true)
|
<?php echo mb_detect_encoding(PHP81_BC\strftime('%d %B %Y - %H:%M', $article['publishedOn']), 'UTF-8', true)
|
||||||
? strftime('%d %B %Y', $article['publishedOn'])
|
? PHP81_BC\strftime('%d %B %Y', $article['publishedOn'])
|
||||||
: utf8_encode(strftime('%d %B %Y', $article['publishedOn'])); ?>
|
: utf8_encode(PHP81_BC\strftime('%d %B %Y', $article['publishedOn'])); ?>
|
||||||
</div>
|
</div>
|
||||||
<p class="blogContent">
|
<p class="blogContent">
|
||||||
<?php echo helper::subword(strip_tags($article['content'],'<br><p>'), 0, 400); ?>...
|
<?php echo helper::subword(strip_tags($article['content'],'<br><p>'), 0, 400); ?>...
|
||||||
|
|
|
@ -240,21 +240,21 @@ class news extends common {
|
||||||
// News en fonction de la pagination
|
// News en fonction de la pagination
|
||||||
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
|
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
|
||||||
// Met en forme le tableau
|
// Met en forme le tableau
|
||||||
$dateOn = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true)
|
$dateOn = mb_detect_encoding(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true)
|
||||||
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))
|
? PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))
|
||||||
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
|
: utf8_encode(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
|
||||||
$dateOn .= ' à ';
|
$dateOn .= ' à ';
|
||||||
$dateOn .= mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true)
|
$dateOn .= mb_detect_encoding(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true)
|
||||||
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))
|
? PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))
|
||||||
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
|
: utf8_encode(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
|
||||||
if ($this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) {
|
if ($this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) {
|
||||||
$dateOff = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true)
|
$dateOff = mb_detect_encoding(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true)
|
||||||
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))
|
? PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))
|
||||||
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])));
|
: utf8_encode(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])));
|
||||||
$dateOff .= ' à ';
|
$dateOff .= ' à ';
|
||||||
$dateOff .= mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true)
|
$dateOff .= mb_detect_encoding(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true)
|
||||||
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))
|
? PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))
|
||||||
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])));
|
: utf8_encode(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])));
|
||||||
} else {
|
} else {
|
||||||
$dateOff = 'Permanent';
|
$dateOff = 'Permanent';
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,12 +8,12 @@
|
||||||
<!-- bloc signature et date -->
|
<!-- bloc signature et date -->
|
||||||
<?php echo $module::$articleSignature . ' - ';?>
|
<?php echo $module::$articleSignature . ' - ';?>
|
||||||
<?php echo template::ico('calendar-empty'); ?>
|
<?php echo template::ico('calendar-empty'); ?>
|
||||||
<?php $date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
|
<?php $date = mb_detect_encoding(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
|
||||||
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
|
? PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
|
||||||
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
|
: utf8_encode(PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
|
||||||
$heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
|
$heure = mb_detect_encoding(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
|
||||||
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
|
? PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
|
||||||
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
|
: utf8_encode(PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
|
||||||
echo $date . ' à ' . $heure;
|
echo $date . ' à ' . $heure;
|
||||||
?>
|
?>
|
||||||
<!-- Bloc edition -->
|
<!-- Bloc edition -->
|
||||||
|
|
|
@ -14,9 +14,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="newsSignature">
|
<div class="newsSignature">
|
||||||
<?php echo template::ico('calendar-empty'); ?>
|
<?php echo template::ico('calendar-empty'); ?>
|
||||||
<?php echo mb_detect_encoding(strftime('%d %B %Y', $news['publishedOn']), 'UTF-8', true)
|
<?php echo mb_detect_encoding(PHP81_BC\strftime('%d %B %Y', $news['publishedOn']), 'UTF-8', true)
|
||||||
? strftime('%d %B %Y', $news['publishedOn'])
|
? PHP81_BC\strftime('%d %B %Y', $news['publishedOn'])
|
||||||
: utf8_encode(strftime('%d %B %Y', $news['publishedOn'])); ?>
|
: utf8_encode(PHP81_BC\strftime('%d %B %Y', $news['publishedOn'])); ?>
|
||||||
- <?php echo $news['userId']; ?>
|
- <?php echo $news['userId']; ?>
|
||||||
<!-- Bloc edition -->
|
<!-- Bloc edition -->
|
||||||
<?php if (
|
<?php if (
|
||||||
|
|
Loading…
Reference in New Issue