Skip to content

Commit

Permalink
Update class-event.php
Browse files Browse the repository at this point in the history
- applied WPCS updates
- transient time in easy to read format shared by Mike
  • Loading branch information
deshabhishek007 committed Jan 25, 2024
1 parent b633e5b commit 5dc82b1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions includes/core/classes/class-event.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public static function get_post_type_registration_args(): array {
public static function get_post_meta_registration_args(): array {
return array(
'_online_event_link' => array(
'auth_callback' => function() {
'auth_callback' => function () {
return current_user_can( 'edit_posts' );
},
'sanitize_callback' => 'sanitize_url',
Expand Down Expand Up @@ -399,11 +399,10 @@ protected function get_formatted_datetime(
string $which = 'start',
bool $local = true
): string {
$cache_key = 'formatted_datetime_' . md5( $format . $which . ( $local ? 'local' : 'gmt' ) );

$cache_key = 'formatted_datetime_' . md5($format . $which . ($local ? 'local' : 'gmt'));

$cached_date = get_transient($cache_key);
if ($cached_date !== false) {
$cached_date = get_transient( $cache_key );
if ( false !== $cached_date ) {
return $cached_date;
}

Expand All @@ -427,7 +426,8 @@ protected function get_formatted_datetime(
$date = wp_date( $format, $ts, $tz );
}

set_transient($cache_key, $date, 43200);
set_transient( $cache_key, $date, HOUR_IN_SECONDS * 12 );

return (string) $date;
}

Expand Down Expand Up @@ -877,7 +877,7 @@ public function save_datetimes( array $params ): bool {
$retval = false;
$fields = array_filter(
$params,
function( $key ) {
function ( $key ) {
return in_array(
$key,
array(
Expand Down

0 comments on commit 5dc82b1

Please sign in to comment.