| 1 |
<?php
|
| 2 |
// $Id: transcription.module,v 1.9 2008/11/19 17:14:37 grndlvl Exp $
|
| 3 |
|
| 4 |
// Initial code by Jonathan DeLaigle (grndlvl).
|
| 5 |
// Modified by Aaron Winborn for the Media Transcriptions module.
|
| 6 |
|
| 7 |
/**
|
| 8 |
* @file
|
| 9 |
* Gives ability to create snippets of text with time markers for multimedia transcriptions and closed captioning.
|
| 10 |
*/
|
| 11 |
|
| 12 |
/**
|
| 13 |
* Implementation of hook_menu().
|
| 14 |
*/
|
| 15 |
function transcription_menu($maycache) {
|
| 16 |
$items = array();
|
| 17 |
if (!$maycache) {
|
| 18 |
if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'transcription' && !is_null(arg(3))) {
|
| 19 |
$node = node_load(arg(1));
|
| 20 |
if ($node->nid) {
|
| 21 |
$items[] = array('path' => 'node/'. arg(1) .'/transcription/'. arg(3), 'title' => t('Transcription'),
|
| 22 |
'callback' => 'transcription_handler',
|
| 23 |
'callback arguments' => array($node, arg(3)),
|
| 24 |
'access' => node_access('view', $node),
|
| 25 |
'type' => MENU_CALLBACK);
|
| 26 |
}
|
| 27 |
}
|
| 28 |
}
|
| 29 |
return $items;
|
| 30 |
}
|
| 31 |
|
| 32 |
/*******************************************
|
| 33 |
* BEGIN Transcription handlers (TESTING)
|
| 34 |
******************************************/
|
| 35 |
function transcription_handler($node, $type) {
|
| 36 |
$fields = content_fields($field_name = NULL, $node->type);
|
| 37 |
foreach ($fields as $field_name => $field_info) {
|
| 38 |
if ($field_info['type'] == 'transcription') {
|
| 39 |
$transcription_field = $node->$field_name;
|
| 40 |
break;
|
| 41 |
}
|
| 42 |
}
|
| 43 |
if (!empty($transcription_field)) {
|
| 44 |
$handlers = module_invoke_all('transcription_type', $type, $transcription_field, $node);
|
| 45 |
if (empty($handlers[$type])) {
|
| 46 |
$default_handler = transcription_default_type($type, $transcription_field, $node);
|
| 47 |
$output = $default_handler[$type];
|
| 48 |
}
|
| 49 |
else {
|
| 50 |
$output = $handlers[$type];
|
| 51 |
}
|
| 52 |
|
| 53 |
print $output;
|
| 54 |
exit;
|
| 55 |
}
|
| 56 |
return t('There are no transcription fields assigned to this node.');
|
| 57 |
}
|
| 58 |
|
| 59 |
function transcription_default_type($type, $transcriptions, $node) {
|
| 60 |
switch ($type) {
|
| 61 |
case 'jwplayer':
|
| 62 |
require(drupal_get_path('module', 'transcription') .'/handler_types/default_jwplayer.inc');
|
| 63 |
return array('jwplayer' => $output);
|
| 64 |
}
|
| 65 |
}
|
| 66 |
/*******************************************
|
| 67 |
* END Transcription handlers (TESTING)
|
| 68 |
******************************************/
|
| 69 |
|
| 70 |
/**
|
| 71 |
* Implementation of hook_field_info().
|
| 72 |
*/
|
| 73 |
function transcription_field_info() {
|
| 74 |
return array(
|
| 75 |
'transcription' => array('label' => 'Media Transcription'),
|
| 76 |
);
|
| 77 |
}
|
| 78 |
|
| 79 |
/*
|
| 80 |
* Implementation of hook_field_settings().
|
| 81 |
*/
|
| 82 |
function transcription_field_settings($op, $field) {
|
| 83 |
switch ($op) {
|
| 84 |
case 'form':
|
| 85 |
$form = array();
|
| 86 |
$form['transcription_initial_number_multiple'] = array(
|
| 87 |
'#type' => 'select',
|
| 88 |
'#title' => t('Initial number of fields to show'),
|
| 89 |
'#default_value' => isset($field['transcription_initial_number_multiple']) ? $field['transcription_initial_number_multiple'] : '4',
|
| 90 |
'#description' => t('The number of fields to show initial when mulitple values is selected.'),
|
| 91 |
'#options' => range(1, 10),
|
| 92 |
);
|
| 93 |
$options = array(0 => t('Plain text'), 1 => t('Filtered text (user selects input format)'));
|
| 94 |
$form['text_processing'] = array(
|
| 95 |
'#type' => 'radios',
|
| 96 |
'#title' => t('Text processing'),
|
| 97 |
'#default_value' => isset($field['text_processing']) ? $field['text_processing'] : 0,
|
| 98 |
'#options' => $options,
|
| 99 |
);
|
| 100 |
$form['max_length'] = array(
|
| 101 |
'#type' => 'textfield',
|
| 102 |
'#title' => t('Transcription maximum length'),
|
| 103 |
'#default_value' => isset($field['max_length']) ? $field['max_length'] : 0,
|
| 104 |
'#required' => FALSE,
|
| 105 |
'#description' => t('The maximum length of the transcription in characters. Leave blank for an unlimited size.'),
|
| 106 |
);
|
| 107 |
$form['transcription_description'] = array(
|
| 108 |
'#type' => 'textarea',
|
| 109 |
'#title' => t('Transcription description text'),
|
| 110 |
'#default_value' => isset($field['transcription_description']) ? $field['transcription_description'] : '',
|
| 111 |
'#description' => t('The text that will be displayed below the transcription text area.'),
|
| 112 |
);
|
| 113 |
$form['transcription_timemarker_description'] = array(
|
| 114 |
'#type' => 'textarea',
|
| 115 |
'#title' => t('Transcription time marker description text'),
|
| 116 |
'#default_value' => isset($field['transcription_timemarker_description']) ? $field['transcription_timemarker_description'] : 'Time marker can be entered as an integer that represents seconds, a string in HH:MM:SS format or a string in MM:SS format.',
|
| 117 |
'#description' => t('The text that will be displayed below the transcription time marker input field.'),
|
| 118 |
);
|
| 119 |
return $form;
|
| 120 |
|
| 121 |
case 'save':
|
| 122 |
return array('text_processing', 'transcription_description', 'transcription_timemarker_description', 'max_length', 'transcription_initial_number_multiple');
|
| 123 |
|
| 124 |
case 'database columns':
|
| 125 |
$columns = array(
|
| 126 |
'transcription' => array('type' => 'varchar', 'not null' => TRUE, 'default' => "''", 'sortable' => TRUE),
|
| 127 |
'format' => array('type' => 'int', 'length' => 10, 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
|
| 128 |
'begin_timemarker' => array('type' => 'int(5)', 'not null' => TRUE, 'default' => 0, 'sortable' => TRUE),
|
| 129 |
'end_timemarker' => array('type' => 'int(5)', 'not null' => TRUE, 'default' => 0, 'sortable' => TRUE),
|
| 130 |
);
|
| 131 |
if ($field['max_length'] == 0 || $field['max_length'] > 255) {
|
| 132 |
$columns['transcription']['type'] = 'longtext';
|
| 133 |
}
|
| 134 |
else {
|
| 135 |
$columns['transcription']['length'] = $field['max_length'];
|
| 136 |
}
|
| 137 |
|
| 138 |
if ($field['text_processing'] == 0) {
|
| 139 |
unset($columns['format']);
|
| 140 |
}
|
| 141 |
|
| 142 |
return $columns;
|
| 143 |
|
| 144 |
case 'filters':
|
| 145 |
return array(
|
| 146 |
'like' => array(
|
| 147 |
'operator' => 'views_handler_operator_like',
|
| 148 |
'handler' => 'views_handler_filter_like',
|
| 149 |
),
|
| 150 |
);
|
| 151 |
}
|
| 152 |
}
|
| 153 |
|
| 154 |
/*
|
| 155 |
* Implementation of the hook_field()
|
| 156 |
*/
|
| 157 |
function transcription_field($op, &$node, $field, &$items, $teaser, $page) {
|
| 158 |
switch ($op) {
|
| 159 |
case 'validate':
|
| 160 |
foreach ($items as $delta => $item) {
|
| 161 |
$time_markers = array('begin', 'end');
|
| 162 |
foreach ($time_markers as $time_marker) {
|
| 163 |
$error_field = $field['field_name'] .']['. $delta .']['. $time_marker .'_timemarker';
|
| 164 |
if ($item[$time_marker .'_timemarker'] != '') {
|
| 165 |
if ($item['transcription'] == '') {
|
| 166 |
form_set_error($field['field_name'] .']['. $delta .'][transcription', t('You cannot have a time marker without a transcription.'));
|
| 167 |
}
|
| 168 |
$decimal = split('\.', $item[$time_marker .'_timemarker']);
|
| 169 |
if (count($decimal) > 1) {
|
| 170 |
form_set_error($error_field, t('Transcription time markers must be represented in seconds as integer, HH:MM:SS, or MM:SS formats only.'));
|
| 171 |
}
|
| 172 |
$time_in_seconds = transcription_convert_to_seconds($item[$time_marker .'_timemarker']);
|
| 173 |
if ($time_in_seconds != -1) {
|
| 174 |
$item[$time_marker .'_timemarker'] = $time_in_seconds;
|
| 175 |
}
|
| 176 |
if (!is_numeric($item[$time_marker .'_timemarker'])) {
|
| 177 |
form_set_error($error_field, t('The value for the %transcription_time_marker must be a time.', array('%transcription_time_marker' => t('Transcription time marker'))));
|
| 178 |
}
|
| 179 |
if ($item[$time_marker .'_timemarker'] > 86400) {
|
| 180 |
form_set_error($error_field, t('The value for the %transcription_time_marker must be less than 24:00:00/8640s.', array('%transcription_time_marker' => t('Transcription time marker'))));
|
| 181 |
}
|
| 182 |
}
|
| 183 |
}
|
| 184 |
}
|
| 185 |
break;
|
| 186 |
case 'submit':
|
| 187 |
foreach ($items as $delta => $item) {
|
| 188 |
$time_markers = array('begin', 'end');
|
| 189 |
foreach ($time_markers as $time_marker) {
|
| 190 |
if ($item[$time_marker .'_timemarker'] != '') {
|
| 191 |
$time_in_seconds = transcription_convert_to_seconds($item[$time_marker .'_timemarker']);
|
| 192 |
if ($time_in_seconds != -1) {
|
| 193 |
$items[$delta][$time_marker .'_timemarker'] = $time_in_seconds;
|
| 194 |
}
|
| 195 |
}
|
| 196 |
}
|
| 197 |
}
|
| 198 |
break;
|
| 199 |
}
|
| 200 |
}
|
| 201 |
|
| 202 |
/**
|
| 203 |
* Implementation of hook_field_formatter_info().
|
| 204 |
*/
|
| 205 |
function transcription_field_formatter_info() {
|
| 206 |
return array(
|
| 207 |
'default' => array(
|
| 208 |
'label' => 'Default',
|
| 209 |
'field types' => array('transcription'),
|
| 210 |
)
|
| 211 |
);
|
| 212 |
}
|
| 213 |
|
| 214 |
/**
|
| 215 |
* Implementation of hook_field_formatter().
|
| 216 |
*/
|
| 217 |
function transcription_field_formatter($field, $item, $formatter, $node) {
|
| 218 |
if (!empty($item['transcription'])) {
|
| 219 |
if ($field['text_processing']) {
|
| 220 |
$item['transcription'] = check_markup($item['transcription'], $item['format'], is_null($node) || isset($node->in_preview));
|
| 221 |
}
|
| 222 |
else {
|
| 223 |
$item['transcription'] = check_plain($item['transcription']);
|
| 224 |
}
|
| 225 |
return theme('transcription', $item);
|
| 226 |
}
|
| 227 |
}
|
| 228 |
|
| 229 |
/**
|
| 230 |
* Implementation of hook_widget_info().
|
| 231 |
*/
|
| 232 |
function transcription_widget_info() {
|
| 233 |
return array(
|
| 234 |
'transcription' => array(
|
| 235 |
'label' => 'Media Transcription',
|
| 236 |
'field types' => array('transcription')
|
| 237 |
)
|
| 238 |
);
|
| 239 |
}
|
| 240 |
|
| 241 |
/**
|
| 242 |
* Implemenation of hook_widget().
|
| 243 |
*/
|
| 244 |
function transcription_widget($op, &$node, $field, &$items) {
|
| 245 |
switch ($op) {
|
| 246 |
case 'form':
|
| 247 |
$form = array();
|
| 248 |
$form[$field['field_name']] = array(
|
| 249 |
'#tree' => true,
|
| 250 |
'#type' => 'fieldset',
|
| 251 |
'#title' => t($field['widget']['label']),
|
| 252 |
'#description' => t($field['widget']['description']),
|
| 253 |
'#collapsible' => true,
|
| 254 |
);
|
| 255 |
if ($field['multiple']) {
|
| 256 |
$delta = 0;
|
| 257 |
foreach ($items as $data) {
|
| 258 |
if ($data['transcription'] != '') {
|
| 259 |
$form[$field['field_name']][$delta] = array(
|
| 260 |
'#type' => 'fieldset',
|
| 261 |
'#title' => t('Media Transcription') .' '. ($delta+1),
|
| 262 |
'#description' => t('In order to add additional fields you must click %submit or %preview.', array('%submit' => t('Submit'), '%preview' => t('Preview'))),
|
| 263 |
'#collapsible' => true,
|
| 264 |
'#collapsed' => true,
|
| 265 |
);
|
| 266 |
$form[$field['field_name']][$delta]['transcription'] = array(
|
| 267 |
'#type' => 'textarea',
|
| 268 |
'#title' => t('Transcription'),
|
| 269 |
'#description' => (isset($field['transcription_description'])) ? check_plain($field['transcription_description']) : '',
|
| 270 |
'#maxlength' => $field['max_length'] ? $field['max_length'] : NULL,
|
| 271 |
'#weight' => -10,
|
| 272 |
'#required' => ($delta == 0) ? $field['required'] : FALSE,
|
| 273 |
'#default_value' => $data['transcription']
|
| 274 |
);
|
| 275 |
if ($field['text_processing']) {
|
| 276 |
$form[$field['field_name']][$delta]['format'] = filter_form($data['format'], $form[$field['field_name']][$delta]['transcription']['#weight'] + 1, array($field['field_name'], $delta, 'format'));
|
| 277 |
}
|
| 278 |
$form[$field['field_name']][$delta]['begin_timemarker'] = array(
|
| 279 |
'#type' => 'textfield',
|
| 280 |
'#title' => t('Begin transcription time marker'),
|
| 281 |
'#description' => (isset($field['transcription_timemarker_description'])) ? check_plain($field['transcription_timemarker_description']) : '',
|
| 282 |
'#required' => ($delta == 0) ? $field['required'] : FALSE,
|
| 283 |
'#size' => 8,
|
| 284 |
'#maxlength' => 8,
|
| 285 |
'#default_value' => $data['begin_timemarker']
|
| 286 |
);
|
| 287 |
$form[$field['field_name']][$delta]['end_timemarker'] = array(
|
| 288 |
'#type' => 'textfield',
|
| 289 |
'#title' => t('End transcription time marker'),
|
| 290 |
'#description' => (isset($field['transcription_timemarker_description'])) ? check_plain($field['transcription_timemarker_description']) : '',
|
| 291 |
'#required' => ($delta == 0) ? $field['required'] : FALSE,
|
| 292 |
'#size' => 8,
|
| 293 |
'#maxlength' => 8,
|
| 294 |
'#default_value' => $data['end_timemarker']
|
| 295 |
);
|
| 296 |
$delta++;
|
| 297 |
}
|
| 298 |
}
|
| 299 |
$range_limit = isset($field['transcription_initial_number_multiple']) ? $field['transcription_initial_number_multiple'] : '4';
|
| 300 |
foreach (range($delta, $delta + $range_limit) as $delta) {
|
| 301 |
$form[$field['field_name']][$delta] = array(
|
| 302 |
'#type' => 'fieldset',
|
| 303 |
'#title' => t('Media Transcription') .' '. ($delta+1),
|
| 304 |
'#description' => t('In order to add additional fields you must click %submit or %preview.', array('%submit' => t('Submit'), '%preview' => t('Preview'))),
|
| 305 |
'#collapsible' => true,
|
| 306 |
'#collapsed' => false,
|
| 307 |
);
|
| 308 |
$form[$field['field_name']][$delta]['transcription'] = array(
|
| 309 |
'#type' => 'textarea',
|
| 310 |
'#title' => t('Transcription'),
|
| 311 |
'#maxlength' => $field['max_length'] ? $field['max_length'] : NULL,
|
| 312 |
'#weight' => -10,
|
| 313 |
'#required' => ($delta == 0) ? $field['required'] : FALSE,
|
| 314 |
'#description' => (isset($field['transcription_description'])) ? check_plain($field['transcription_description']) : '',
|
| 315 |
);
|
| 316 |
if ($field['text_processing']) {
|
| 317 |
$form[$field['field_name']][$delta]['format'] = filter_form($items[$delta]['format'], $form[$field['field_name']][$delta]['transcription']['#weight'] + 1, array($field['field_name'], $delta, 'format'));
|
| 318 |
}
|
| 319 |
$form[$field['field_name']][$delta]['begin_timemarker'] = array(
|
| 320 |
'#type' => 'textfield',
|
| 321 |
'#required' => ($delta == 0) ? $field['required'] : FALSE,
|
| 322 |
'#title' => t('Beginning ranscription time marker'),
|
| 323 |
'#size' => 8,
|
| 324 |
'#maxlength' => 8,
|
| 325 |
'#description' => (isset($field['transcription_timemarker_description'])) ? check_plain($field['transcription_timemarker_description']) : '',
|
| 326 |
);
|
| 327 |
$form[$field['field_name']][$delta]['End_timemarker'] = array(
|
| 328 |
'#type' => 'textfield',
|
| 329 |
'#required' => ($delta == 0) ? $field['required'] : FALSE,
|
| 330 |
'#title' => t('Ending transcription time marker'),
|
| 331 |
'#size' => 8,
|
| 332 |
'#maxlength' => 8,
|
| 333 |
'#description' => (isset($field['transcription_timemarker_description'])) ? check_plain($field['transcription_timemarker_description']) : '',
|
| 334 |
);
|
| 335 |
}
|
| 336 |
}
|
| 337 |
else {
|
| 338 |
$form[$field['field_name']][0]['transcription'] = array(
|
| 339 |
'#type' => 'textarea',
|
| 340 |
'#title' => t('Transcription'),
|
| 341 |
'#description' => (isset($field['transcription_description'])) ? check_plain($field['transcription_description']) : '',
|
| 342 |
'#maxlength' => $field['max_length'] ? $field['max_length'] : NULL,
|
| 343 |
'#weight' => -10,
|
| 344 |
'#default_value' => isset($items[0]['transcription']) ? $items[0]['transcription'] : '',
|
| 345 |
);
|
| 346 |
if ($field['text_processing']) {
|
| 347 |
$form[$field['field_name']][0]['format'] = filter_form($items[0]['format'], $form[$field['field_name']][0]['transcription']['#weight'] + 1, array($field['field_name'], 0, 'format'));
|
| 348 |
}
|
| 349 |
$form[$field['field_name']][0]['begin_timemarker'] = array(
|
| 350 |
'#type' => 'textfield',
|
| 351 |
'#title' => t('Beginning transcription time marker'),
|
| 352 |
'#size' => 8,
|
| 353 |
'#maxlength' => 8,
|
| 354 |
'#description' => (isset($field['transcription_timemarker_description'])) ? check_plain($field['transcription_timemarker_description']) : '',
|
| 355 |
'#default_value' => isset($items[0]['begin_timemarker']) && $items[0]['begin_timemarker'] != 0 ? $items[0]['begin_timemarker'] : '',
|
| 356 |
);
|
| 357 |
$form[$field['field_name']][0]['end_timemarker'] = array(
|
| 358 |
'#type' => 'textfield',
|
| 359 |
'#title' => t('Ending transcription time marker'),
|
| 360 |
'#size' => 8,
|
| 361 |
'#maxlength' => 8,
|
| 362 |
'#description' => (isset($field['transcription_timemarker_description'])) ? check_plain($field['transcription_timemarker_description']) : '',
|
| 363 |
'#default_value' => isset($items[0]['end_timemarker']) && $items[0]['end_timemarker'] != 0 ? $items[0]['end_timemarker'] : '',
|
| 364 |
);
|
| 365 |
}
|
| 366 |
return $form;
|
| 367 |
|
| 368 |
case 'validate':
|
| 369 |
break;
|
| 370 |
|
| 371 |
case 'process form values':
|
| 372 |
if ($field['multiple']) {
|
| 373 |
if ($field['multiple']) {
|
| 374 |
foreach ($items as $delta => $item) {
|
| 375 |
if ($item['transcription'] == '' && $item['begin_timemarker'] == '' && $delta > 0) {
|
| 376 |
unset($items[$delta]);
|
| 377 |
}
|
| 378 |
}
|
| 379 |
}
|
| 380 |
}
|
| 381 |
break;
|
| 382 |
}
|
| 383 |
}
|
| 384 |
|
| 385 |
/********************
|
| 386 |
* Theme functions.
|
| 387 |
*******************/
|
| 388 |
/**
|
| 389 |
* A theme function for outputting a transcription.
|
| 390 |
*
|
| 391 |
* @param $data
|
| 392 |
* An array that contains the transcription text and timemarker.
|
| 393 |
*/
|
| 394 |
function theme_transcription($data) {
|
| 395 |
$output = '';
|
| 396 |
$output .= $data['transcription'];
|
| 397 |
if ($data['begin_timemarker'] != 0 && $data['begin_timemarker'] != '') {
|
| 398 |
$output .= ' <span class="begin">'. theme('transcription_seconds_to_time', $data['begin_timemarker']) .'</span>';
|
| 399 |
}
|
| 400 |
if ($data['end_timemarker'] != 0 && $data['end_timemarker'] != '') {
|
| 401 |
$output .= ' <span class="end">'. theme('transcription_seconds_to_time', $data['end_timemarker']) .'</span>';
|
| 402 |
}
|
| 403 |
return '<p class="transcription">'. $output .'</p>';
|
| 404 |
}
|
| 405 |
|
| 406 |
/**
|
| 407 |
* Display seconds as HH:MM:SS, with leading 0's.
|
| 408 |
*
|
| 409 |
* @param $seconds
|
| 410 |
* The number of seconds to display.
|
| 411 |
*/
|
| 412 |
function theme_transcription_seconds_to_time($seconds) {
|
| 413 |
$unith =3600; // Num of seconds in an Hour...
|
| 414 |
$unitm =60; // Num of seconds in a min...
|
| 415 |
|
| 416 |
$hh = intval($seconds / $unith); // '/' given value by num sec in hour... output = HOURS
|
| 417 |
$ss_remaining = ($seconds - ($hh * 3600)); // '*' number of hours by seconds, then '-' from given value... output = REMAINING seconds
|
| 418 |
|
| 419 |
$mm = intval($ss_remaining / $unitm); // take remaining sec and devide by sec in a min... output = MINS
|
| 420 |
$ss = ($ss_remaining - ($mm * 60)); // '*' number of mins by seconds, then '-' from remaining sec... output = REMAINING seconds.
|
| 421 |
|
| 422 |
$output = '';
|
| 423 |
if ($hh) {
|
| 424 |
$output .= "$hh:";
|
| 425 |
}
|
| 426 |
$output .= check_plain(sprintf("%02d:%02d", $mm, $ss));
|
| 427 |
|
| 428 |
return $output;
|
| 429 |
}
|
| 430 |
|
| 431 |
/*********************
|
| 432 |
* Util functions.
|
| 433 |
*********************/
|
| 434 |
/**
|
| 435 |
* Convert time from field into seconds.
|
| 436 |
*
|
| 437 |
* @param $time
|
| 438 |
* Raw timemarker input from field.
|
| 439 |
*/
|
| 440 |
function transcription_convert_to_seconds($time) {
|
| 441 |
$time_in_seconds = 0;
|
| 442 |
$time_split = split(':', $time);
|
| 443 |
$count = count($time_split);
|
| 444 |
|
| 445 |
// If it is already in seconds then don't do anything.
|
| 446 |
if ($count == 1) return -1;
|
| 447 |
|
| 448 |
foreach ($time_split as $unit) {
|
| 449 |
$count--;
|
| 450 |
// If hours or minutes multiply by appropriate amount.
|
| 451 |
if ($count > 0) {
|
| 452 |
// If it is hours multiply by 36000 if minutes multiply by 60.
|
| 453 |
$time_in_seconds += $unit*(pow(60, $count));
|
| 454 |
}
|
| 455 |
else {
|
| 456 |
// If we are on the seconds unit then we do not need to do anything.
|
| 457 |
$time_in_seconds += $unit;
|
| 458 |
}
|
| 459 |
}
|
| 460 |
|
| 461 |
return $time_in_seconds;
|
| 462 |
}
|
| 463 |
|