Automattic\WooCommerce\Internal\TransientFiles
TransientFilesEngine::get_expiration_date()
Get the expiration date of a transient file based on its file name. The actual existence of the file is NOT checked.
Метод класса: TransientFilesEngine{}
Хуков нет.
Возвращает
Строку|null
. Expiration date formatted as Y-m-d, null if the file name isn't encoding a proper date.
Использование
$result = TransientFilesEngine::get_expiration_date( $filename ) : ?string;
- $filename(строка) (обязательный)
- The name of the transient file to get the expiration date for.
Код TransientFilesEngine::get_expiration_date() TransientFilesEngine::get expiration date WC 9.6.1
public static function get_expiration_date( string $filename ) : ?string { if ( strlen( $filename ) < 7 || ! ctype_xdigit( $filename ) ) { return null; } $expiration_date = sprintf( '%04d-%02d-%02d', hexdec( substr( $filename, 0, 3 ) ), hexdec( substr( $filename, 3, 1 ) ), hexdec( substr( $filename, 4, 2 ) ) ); return TimeUtil::is_valid_date( $expiration_date, 'Y-m-d' ) ? $expiration_date : null; }