Browse Source

retirar strftime que está descontinuada php8.2

1.8
bruno 1 year ago
parent
commit
a49f0b4b84
  1. 10
      img/libs/plugins/function.html_select_date.php
  2. 8
      include/PHPExcel/Calculation/DateTime.php
  3. 22
      include/jpgraph/jpgraph.php
  4. 2
      include/jpgraph/jpgraph_errhandler.inc.php

10
img/libs/plugins/function.html_select_date.php

@ -42,7 +42,7 @@ function smarty_function_html_select_date($params, &$smarty) {
require_once $smarty->_get_plugin_filepath('function', 'html_options');
/* Default values. */
$prefix = "Date_";
$start_year = strftime("%Y");
$start_year = date("Y");
$end_year = $start_year;
$display_days = true;
$display_months = true;
@ -151,16 +151,16 @@ function smarty_function_html_select_date($params, &$smarty) {
// make syntax "+N" or "-N" work with start_year and end_year
if (preg_match('!^(\+|\-)\s*(\d+)$!', $end_year, $match)) {
if ($match[1] == '+') {
$end_year = strftime('%Y') + $match[2];
$end_year = date('Y') + $match[2];
} else {
$end_year = strftime('%Y') - $match[2];
$end_year = date('Y') - $match[2];
}
}
if (preg_match('!^(\+|\-)\s*(\d+)$!', $start_year, $match)) {
if ($match[1] == '+') {
$start_year = strftime('%Y') + $match[2];
$start_year = date('Y') + $match[2];
} else {
$start_year = strftime('%Y') - $match[2];
$start_year = date('Y') - $match[2];
}
}
if (strlen($time[0]) > 0) {

8
include/PHPExcel/Calculation/DateTime.php

@ -534,7 +534,7 @@ class PHPExcel_Calculation_DateTime
if ($testVal2 !== false) {
$testVal3 = strtok('- ');
if ($testVal3 === false) {
$testVal3 = strftime('%Y');
$testVal3 = date('Y');
}
} else {
return PHPExcel_Calculation_Functions::VALUE();
@ -554,16 +554,16 @@ class PHPExcel_Calculation_DateTime
if (($PHPDateArray !== false) && ($PHPDateArray['error_count'] == 0)) {
// Execute function
if ($PHPDateArray['year'] == '') {
$PHPDateArray['year'] = strftime('%Y');
$PHPDateArray['year'] = date('Y');
}
if ($PHPDateArray['year'] < 1900) {
return PHPExcel_Calculation_Functions::VALUE();
}
if ($PHPDateArray['month'] == '') {
$PHPDateArray['month'] = strftime('%m');
$PHPDateArray['month'] = date('m');
}
if ($PHPDateArray['day'] == '') {
$PHPDateArray['day'] = strftime('%d');
$PHPDateArray['day'] = date('d');
}
$excelDateValue = floor(
PHPExcel_Shared_Date::FormattedPHPToExcel(

22
include/jpgraph/jpgraph.php

@ -356,6 +356,7 @@ class DateLocale {
public $iLocale = 'C'; // environmental locale be used by default
private $iDayAbb = null, $iShortDay = null, $iShortMonth = null, $iMonthName = null;
function __construct() {
settype($this->iDayAbb, 'array');
settype($this->iShortDay, 'array');
@ -391,16 +392,30 @@ class DateLocale {
return FALSE;
}
$this->iLocale = $aLocale;
for( $i = 0, $ofs = 0 - strftime('%w'); $i < 7; $i++, $ofs++ ) {
$day = strftime('%a', strtotime("$ofs day"));
$date_day = new DateTimeImmutable();
for( $i = 0, $ofs = 0 - $date_day->format("w"); $i < 7; $i++, $ofs++ ) {
if($ofs > 0){ // acrescentar a data
$date_day = $date_day->add(new DateInterval("P{$ofs}D"));
}
else if( $ofs < 0 ){ // decrementar a data
$date_day = $date_day->sub(new DateInterval(sprintf("P%dD", abs($ofs))));
}
$day = $date_day->format("D");
$day[0] = strtoupper($day[0]);
$this->iDayAbb[$aLocale][]= $day[0];
$this->iShortDay[$aLocale][]= $day;
}
for($i=1; $i<=12; ++$i) {
list($short ,$full) = explode('|', strftime("%b|%B",strtotime("2001-$i-01")));
/* Apenas obtem nome completo e abreviado dos meses */
$date_month = new DateTimeImmutable();
list($short ,$full) = explode('|', $date_month->format('M|F'));
$this->iShortMonth[$aLocale][] = ucfirst($short);
$this->iMonthName [$aLocale][] = ucfirst($full);
}
@ -410,7 +425,6 @@ class DateLocale {
return TRUE;
}
function GetDayAbb() {
return $this->iDayAbb[$this->iLocale];
}

2
include/jpgraph/jpgraph_errhandler.inc.php

@ -155,7 +155,7 @@ class JpGraphException extends Exception {
}
$errobj->Raise($this->getMessage());
}
static public function defaultHandler(Exception $exception) {
static public function defaultHandler(Throwable $exception) {
global $__jpg_OldHandler;
if( $exception instanceof JpGraphException ) {
$exception->Stroke();

Loading…
Cancel
Save