|
|
|
@ -2441,4 +2441,85 @@ function AjustaPerfil() {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* A função strftime foi descontinuada, portanto essa função será chamada. |
|
|
|
|
* Cada chamada será mudada para strftime_ |
|
|
|
|
* Para não precisar modificar cada código, resolvemos mudar apenas o nome. |
|
|
|
|
* |
|
|
|
|
* \warning Essa função não deve ser usado para novos códigos. Deve ser evitado |
|
|
|
|
* strftime e strftime_ |
|
|
|
|
* |
|
|
|
|
* \param format De acordo php.net/manual/en/datatime.format.php |
|
|
|
|
* \param time parâmetro é um int Unix timestamp |
|
|
|
|
* \return mesmo que strftime (função deprecated) |
|
|
|
|
*/ |
|
|
|
|
function strftime_( $format, $timestamp = null ){ |
|
|
|
|
|
|
|
|
|
$date_immutable = new DateTimeImmutable( ); |
|
|
|
|
|
|
|
|
|
if( $timestamp ){ |
|
|
|
|
$date_immutable = $date_immutable->setTimestamp( $timestamp ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* tratar string */ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Converterá a string de strftime(descontinuado) para fomat DataTimeImmutable:format |
|
|
|
|
* Isso será usado para função strftime para converter essa string que não são compatíveis |
|
|
|
|
* |
|
|
|
|
* \param format strftime |
|
|
|
|
* \return retorna a string para DataTimeImmutable |
|
|
|
|
*/ |
|
|
|
|
function convert_format_strftime( $format ){ |
|
|
|
|
|
|
|
|
|
$id = 0; |
|
|
|
|
|
|
|
|
|
/* formato strftime */ |
|
|
|
|
$patterns = array( |
|
|
|
|
/* day */ |
|
|
|
|
'%a', '%A', '%d','%e', '%j','%u', '%w', |
|
|
|
|
/* Week */ |
|
|
|
|
'%U', '%V','%W', |
|
|
|
|
/* Month */ |
|
|
|
|
'%b','%B', '%h','%m' , |
|
|
|
|
/* Year */ |
|
|
|
|
'%C','%g', '%G','%y', '%Y', |
|
|
|
|
/* Time */ |
|
|
|
|
'%H', '%k', '%I', '%l', '%L', '%M', '%p', '%P', '%r', '%R', '%S', |
|
|
|
|
'%T','%X', '%z','%Z' , |
|
|
|
|
/* Time and Date Stamps */ |
|
|
|
|
'%c','%D', '%F','%s', '%x','%n', |
|
|
|
|
'%t','%%' |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
/* valores similares de strftime |
|
|
|
|
* para DateTime |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
$replacements = array( |
|
|
|
|
/* day */ |
|
|
|
|
'D', 'l', 'd', 'j', 'z', 'N', 'w', |
|
|
|
|
/* Week */ |
|
|
|
|
'W', '', '', |
|
|
|
|
/* mounth */ |
|
|
|
|
'M', 'F', 'M', 'm', |
|
|
|
|
/* Year */ |
|
|
|
|
'', 'y', 'o', 'y', 'o', |
|
|
|
|
/* Time */ |
|
|
|
|
'H', 'G', 'h', 'g', 'g', 'i', 'A', 'a', '', '', 'i', |
|
|
|
|
'', '', '', '', |
|
|
|
|
/* Time and Date Stamps */ |
|
|
|
|
'','', '','', '','', |
|
|
|
|
' ','\%' |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo preg_replace( $patterns, $replacements, $format ); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|