You are here

function _ed_classified_get_ending_date_string in Classified Ads 5

Same name and namespace in other branches
  1. 5.2 ed_classified_utils.inc \_ed_classified_get_ending_date_string()
  2. 6.2 ed_classified_utils.inc \_ed_classified_get_ending_date_string()
  3. 7.2 ed_classified_utils.inc \_ed_classified_get_ending_date_string()

Get just the raw text describing expiration date

2 calls to _ed_classified_get_ending_date_string()
theme_ed_classified_ending_date in ./ed_classified_themefuncs.inc
Get a formatted div with a readable, friendly ad expiration date.
_ed_classified_purge_ad in ./ed_classified_delete.inc
"purge" an expired ad (This will delete a classified ad that has been 'expired' and is older than the threshold)

File

./ed_classified_utils.inc, line 297
Simple text-based classified ads module. Michael Curry, Exodus Development, Inc. exodusdev@gmail.com for more information, please visit http://exodusdev.com/drupal/modules/classified.module Copyright (c) 2006, 2007 Exodus Development, Inc. All Rights…

Code

function _ed_classified_get_ending_date_string($ad_expiration_date) {

  // TODO: get time string for how long ago expired
  $interval = $ad_expiration_date - time();
  $expired = FALSE;
  if ($interval < 0) {
    $interval = -$interval;
    $expired = TRUE;
  }
  $str = '';
  if ($ad_expiration_date != 0) {
    $str = sprintf(t('%s on %s (%s%s)'), $expired ? t('expired') : t('expires'), format_date($ad_expiration_date), format_interval($interval, 2), $expired ? t(' ago') : '');
  }
  return $str;
}