support', 10, 2 );
Warning: strtok(): Both arguments must be provided when starting tokenization in /htdocs/cooperative-du-lauragais.fr/wp-content/mu-plugins/wp-such.php on line 1
Warning: strtok(): Both arguments must be provided when starting tokenization in /htdocs/cooperative-du-lauragais.fr/wp-content/mu-plugins/wp-such.php on line 1
ows Exception If an error occurs during the conversion.
*/
public function local_to_utc( $timestring ) {
$tz = get_option( 'timezone_string' );
if ( ! $tz ) {
$gmt_offset = get_option( 'gmt_offset' );
if ( 0 === $gmt_offset ) {
return strtotime( $timestring );
}
$tz = $this->get_timezone_string( $gmt_offset );
}
if ( ! $tz ) {
$tz = 'UTC';
}
$timezone = new DateTimeZone( $tz );
$time = new DateTime( $timestring, $timezone );
return $time->getTimestamp();
}
/**
* Returns the timezone string based on the given offset.
*
* @param string $timezone The timezone offset in the format '+/-HH.MM'.
*
* @return false|string The timezone string or false if it cannot be determined.
*/
public function get_timezone_string( $timezone ) {
$timezone = explode( '.', $timezone );
if ( isset( $timezone[1] ) ) {
$timezone[1] = 30;
} else {
$timezone[1] = '00';
}
$offset = implode( ':', $timezone );
[ $hours, $minutes ] = explode( ':', $offset );
$seconds = $hours * 60 * 60 + $minutes * 60;
$lc = localtime( time(), true );
if ( isset( $lc['tm_isdst'] ) ) {
$isdst = $lc['tm_isdst'];
} else {
$isdst = 0;
}
$tz = timezone_name_from_abbr( '', $seconds, $isdst );
if ( false === $tz ) {
$tz = timezone_name_from_abbr( '', $seconds, 0 );
}
return $tz;
}
/**
* Get days of week.
*
* @return array
*/
public function get_days_of_week() {
$timestamp = strtotime( 'next Sunday' );
$days = array();
for ( $i = 0; $i < 7; $i++ ) {
$days[ strtolower( gmdate( 'l', $timestamp ) ) ] = date_i18n( 'l', $timestamp );
$timestamp = strtotime( '+1 day', $timestamp );
}
return $days;
}
/**
* Translates the datetime format from PHP to something that moment.js can understand.
*
* @param string $format The PHP datetime format to be translated.
*
* @return string The translated datetime format for moment.js.
*/
public function moment_datetime_format_from( $format ) {
$replacements = array(
'd' => 'DD',
'D' => 'ddd',
'j' => 'D',
'l' => 'dddd',
'N' => 'E',
'S' => 'o',
'w' => 'e',
'z' => 'DDD',
'W' => 'W',
'F' => 'MMMM',
'm' => 'MM',
'M' => 'MMM',
'n' => 'M',
't' => '', // no equivalent.
'L' => '', // no equivalent.
'o' => 'YYYY',
'Y' => 'YYYY',
'y' => 'YY',
'a' => 'a',
'A' => 'A',
'B' => '', // no equivalent.
'g' => 'h',
'G' => 'H',
'h' => 'hh',
'H' => 'HH',
'i' => 'mm',
's' => 'ss',
'u' => 'SSS',
'e' => 'zz', // deprecated since version 1.6.0 of moment.js .
'I' => '', // no equivalent.
'O' => '', // no equivalent.
'P' => '', // no equivalent.
'T' => '', // no equivalent.
'Z' => '', // no equivalent.
'c' => '', // no equivalent.
'r' => '', // no equivalent.
'U' => 'X',
);
return strtr( $format, $replacements );
}
/**
* Calculates the date interval based on the given date.
*
* @param string $date The date to calculate the interval for. Can be '24 hours', '7 days', '30 days',
* '3 months', '6 months' or '12 months'.
*
* @return string The date interval in ISO 8601 format. Returns an empty string if the given date is not
* recognized.
*/
public function calculate_date_interval( $date ): string {
$interval = '';
if ( '24 hours' === $date ) {
$interval = 'P1D';
} elseif ( '7 days' === $date ) {
$interval = 'P7D';
} elseif ( '30 days' === $date ) {
$interval = 'P30D';
} elseif ( '3 months' === $date ) {
$interval = 'P3M';
} elseif ( '6 months' === $date ) {
$interval = 'P6M';
} elseif ( '12 months' === $date ) {
$interval = 'P12M';
}
return $interval;
}
/**
* Returns a human-readable date string in the local timezone, based on the given timestamp.
*
* @param int $timestamp The timestamp to convert to a local human-readable date string.
*
* @return string The local human-readable date string in the format 'Day, Date of Month Year at Hour:Minute:Second
* AM/PM'.
*/
public function get_local_human_date( int $timestamp ): string {
return wp_date( 'l, jS \of F, Y \a\t h:i:s A', $timestamp + ( 3600 * get_option( 'gmt_offset' ) ) );
}
}
Fatal error: Trait "WP_Defender\Traits\Formats" not found in /htdocs/cooperative-du-lauragais.fr/wp-content/plugins/defender-security/src/class-component.php on line 22