= 5.3 * * See https://developer.wordpress.org/reference/functions/get_date_from_gmt/ */ /* Vars */ $output = ''; $date_format = get_option( 'date_format' ); $time_format = get_option( 'time_format' ); $output_format = $date_format . ' ' . $time_format; $utc_timestamp_converted = date( $output_format, $utc_timestamp ); $output = get_date_from_gmt( $utc_timestamp_converted, $output_format ); return $output; } endif; /** * Get Device name from UUID * * Looks up the given UUID in the Device database table, * and returns the Device Name if found. * * @param string $uuid Device UUID * @return string $output Device name */ if ( ! function_exists( 'bd324_get_device_name_from_uuid' ) ) : function bd324_get_device_name_from_uuid( $uuid ) { global $wpdb; /* Vars */ $output = ''; $table_name = BD0019__DEVICE_DB_TABLE; // Build query $query = $wpdb->prepare( ' SELECT * FROM %i WHERE `uuid` = %s LIMIT 1 ', $table_name, $uuid ); // Now we query the db. $device_data = $wpdb->get_row( $query, ARRAY_A ); $device_name = $device_data['name'] ?? null; // DEBUG if ( BD0019__DEBUG === 1 ) { error_log( sprintf( 'Fetching device name for %s from %s', $uuid, $table_name ) ); } if ( $device_name ) { // DEBUG if ( BD0019__DEBUG === 1 ) { error_log( print_r( $device_name, true ) ); } $output = $device_name; } else { // DEBUG if ( BD0019__DEBUG === 1 ) { error_log( sprintf( 'Device name not found for %s', $uuid, true ) ); error_log( print_r( $device_name, true ) ); $wpdb->print_error(); } return; } return $output; } endif;