Projet

Général

Profil

Révision 599a39cd

Ajouté par Assos Assos il y a environ 3 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/date/date_api/theme/theme.inc
168 168
  return t('Time', array(), array('context' => 'datetime'));
169 169
}
170 170

  
171

  
172 171
/**
173 172
 * Returns HTML for a date block that looks like a mini calendar day.
174 173
 *
......
194 193
function theme_date_time_ago($variables) {
195 194
  $start_date = $variables['start_date'];
196 195
  $end_date = $variables['end_date'];
197
  $use_end_date = isset($variables['use_end_date']) ? $variables['use_end_date'] : false;
196
  $use_end_date = isset($variables['use_end_date']) ? $variables['use_end_date'] : FALSE;
198 197
  $interval = !empty($variables['interval']) ? $variables['interval'] : 2;
199 198
  $display = isset($variables['interval_display']) ? $variables['interval_display'] : 'time ago';
200 199

  
......
204 203
  }
205 204

  
206 205
  // We use the end date only when the option is checked.
207
  if ($use_end_date){
206
  if ($use_end_date) {
208 207
    $date = date_format($end_date, DATE_FORMAT_UNIX);
209 208
  }
210 209
  else {
......
212 211
  }
213 212

  
214 213
  // Time to compare dates to.
215

  
216 214
  $now = date_format(date_now(), DATE_FORMAT_UNIX);
217 215

  
218
  // Will be positive for a datetime in the past (ago), and negative for a datetime in the future (hence).
216
  // Will be positive for a datetime in the past (ago), and negative for a
217
  // datetime in the future (hence).
219 218
  $time_diff = $now - $date;
220 219

  
221 220
  // Uses the same options used by Views format_interval.
......
240 239

  
241 240
    case 'time span':
242 241
      return t(($time_diff < 0 ? '%time hence' : '%time ago'), array('%time' => format_interval(abs($time_diff), $interval)));
243

  
244 242
  }
245 243
}

Formats disponibles : Unified diff