0 ? (string) wp_get_attachment_image_url( $id, $size ) : ''; } /** * A Google map of the address, through the embed that needs no API key, * or '' when the owner turned the map off or gave no address. */ public static function map_url(): string { $address = self::address(); if ( '' === $address || ! Settings::get( 'restaurant_map', false ) ) { return ''; } return 'https://maps.google.com/maps?q=' . rawurlencode( $address ) . '&z=15&output=embed'; } /** Directions to the address on Google Maps. */ public static function directions_url(): string { return 'https://www.google.com/maps/search/?api=1&query=' . rawurlencode( self::address() ); } /** * The Google client id when the owner turned on "Sign in with Google", * else ''. */ public static function google_client(): string { return Settings::get( 'google_signin', false ) ? trim( (string) Settings::get( 'gcal_client_id', '' ) ) : ''; } /** * The first day from today a guest can book (no closed weekday or * closed date), so the times show at once. Today when none is found. */ public static function first_open_day(): string { $today = current_time( 'Y-m-d' ); $closed = Availability::closed_days(); $start = (int) strtotime( $today . ' 00:00:00 UTC' ); for ( $i = 0; $i < 366; $i++ ) { $stamp = $start + $i * DAY_IN_SECONDS; $date = gmdate( 'Y-m-d', $stamp ); if ( ! in_array( (int) gmdate( 'w', $stamp ), $closed['weekdays'], true ) && ! in_array( $date, $closed['dates'], true ) ) { return $date; } } return $today; } }