$expiry_date; } /** * Check if a date is in the future. * * @since 1.0.0 * @param string $date_string Date string in MySQL format. * @return bool True if date is in the future, false otherwise. */ function qdr_tss_is_future($date_string) { if (!$date_string || $date_string === '0000-00-00 00:00:00') { return false; } $future_date = strtotime($date_string); $current_time = current_time('timestamp'); return $current_time < $future_date; } /** * Get file status class based on active dates. * * @since 1.0.0 * @param string $active_from Active from date in MySQL format. * @param string $active_to Active to date in MySQL format. * @return string CSS class for status. */ function qdr_tss_get_status_class($active_from, $active_to) { $current_time = current_time('timestamp'); $from_time = strtotime($active_from); $to_time = strtotime($active_to); if ($current_time < $from_time) { return 'qdr-tss-status-pending'; } elseif ($current_time > $to_time) { return 'qdr-tss-status-expired'; } else { return 'qdr-tss-status-active'; } } /** * Get file status label based on active dates. * * @since 1.0.0 * @param string $active_from Active from date in MySQL format. * @param string $active_to Active to date in MySQL format. * @return string Status label. */ function qdr_tss_get_status_label($active_from, $active_to) { $current_time = current_time('timestamp'); $from_time = strtotime($active_from); $to_time = strtotime($active_to); if ($current_time < $from_time) { return __('Pending', 'qdr-temporary-shared-storage'); } elseif ($current_time > $to_time) { return __('Expired', 'qdr-temporary-shared-storage'); } else { return __('Active', 'qdr-temporary-shared-storage'); } }