~ubuntu-gr-webteam/ubuntu-gr-website/drupal6-site

« back to all changes in this revision

Viewing changes to sites/all/modules/date/date_api_elements.inc

  • Committer: Thanos Lefteris
  • Date: 2009-07-29 17:46:54 UTC
  • Revision ID: alefteris@gmail.com-20090729174654-pgfr1vtqw8ikvo5r
* Upgraded calendar module
* Upgraded commentrss module
* Upgraded date module
* Upgraded webfm module

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
 
//$Id: date_api_elements.inc,v 1.49.2.1.2.47 2009/03/25 15:31:42 karens Exp $
 
2
//$Id: date_api_elements.inc,v 1.49.2.1.2.50 2009/05/11 02:23:56 karens Exp $
3
3
/**
4
4
 * @file
5
5
 * Date API elements themes and validation.
239
239
  $order = array_flip($granularity);
240
240
 
241
241
  $hours_format  = strpos(strtolower($element['#date_format']), 'a') ? 'g': 'G';
242
 
  $month_function  = strpos($element['#date_format'], 'F') ? 'date_month_names' : 'date_month_names_abbr';
 
242
  $month_function  = strpos($element['#date_format'], 'F') !== FALSE ? 'date_month_names' : 'date_month_names_abbr';
243
243
  $count = 0;
244
244
  $increment = min(intval($element['#date_increment']), 1);
245
245
  foreach ($granularity as $field) {
305
305
      $sub_element[$field]['#theme'] = 'date_textfield_element';
306
306
      $sub_element[$field]['#size'] = 7;
307
307
      if ($element['#date_label_position'] == 'within') {
308
 
        $sub_element[$field]['#options'] = array(
309
 
          '-'. $label => '-'. $label) + $sub_element[$field]['#options'];
 
308
        if (is_array($sub_element[$field]['#options'])) {
 
309
          $sub_element[$field]['#options'] = array(
 
310
            '-'. $label => '-'. $label) + $sub_element[$field]['#options'];
 
311
        }
310
312
        if (empty($sub_element[$field]['#default_value'])) {
311
313
          $sub_element[$field]['#default_value'] = '-'. $label;
312
314
        }
594
596
  $regex2 = str_replace('a', '(am|pm)', $regex2);
595
597
  preg_match('`^'. $regex2 .'$`', $date, $values);
596
598
  array_shift($values);
 
599
  
597
600
  // if we did not find all the values for the patterns in the format, abort
598
601
  if (count($letters) != count($values)) {
599
602
    return  NULL;