updated ctools, panels, date, diff

This commit is contained in:
Bachir Soussi Chiadmi
2017-05-24 19:22:50 +02:00
parent 542ac42fca
commit 9acef9d37e
189 changed files with 2928 additions and 1797 deletions

View File

@@ -9,9 +9,9 @@ stylesheets[all][] = date.css
files[] = date_api.module
files[] = date_api_sql.inc
; Information added by Drupal.org packaging script on 2015-09-08
version = "7.x-2.9"
; Information added by Drupal.org packaging script on 2017-04-07
version = "7.x-2.10"
core = "7.x"
project = "date"
datestamp = "1441727353"
datestamp = "1491562090"

View File

@@ -1833,9 +1833,10 @@ function date_format_interval($date, $granularity = 2, $display_ago = TRUE) {
/**
* A date object for the current time.
*
* @param object $timezone
* (optional) Optionally force time to a specific timezone, defaults to user
* timezone, if set, otherwise site timezone. Defaults to NULL.
* @param object|string|null $timezone
* (optional) PHP DateTimeZone object, string or NULL allowed. Optionally
* force time to a specific timezone, defaults to user timezone, if set,
* otherwise site timezone. Defaults to NULL.
*
* @param bool $reset
* (optional) Static cache reset.
@@ -1844,11 +1845,16 @@ function date_format_interval($date, $granularity = 2, $display_ago = TRUE) {
* The current time as a date object.
*/
function date_now($timezone = NULL, $reset = FALSE) {
if ($reset) {
drupal_static_reset(__FUNCTION__ . $timezone);
$static_var = __FUNCTION__ . $timezone;
if ($timezone instanceof DateTimeZone) {
$static_var = __FUNCTION__ . $timezone->getName();
}
$now = &drupal_static(__FUNCTION__ . $timezone);
if ($reset) {
drupal_static_reset($static_var);
}
$now = &drupal_static($static_var);
if (!isset($now)) {
$now = new DateObject('now', $timezone);
@@ -1920,7 +1926,12 @@ function date_days_in_month($year, $month) {
// Pick a day in the middle of the month to avoid timezone shifts.
$datetime = date_pad($year, 4) . '-' . date_pad($month) . '-15 00:00:00';
$date = new DateObject($datetime);
return $date->format('t');
if ($date->errors) {
return FALSE;
}
else {
return $date->format('t');
}
}
/**
@@ -2075,6 +2086,9 @@ function date_iso_week_range($week, $year) {
date_timezone_set($min_date, date_default_timezone_object());
// Find the first day of the first ISO week in the year.
// If it's already a Monday, date_modify won't add a Monday,
// it will remain the same day. So add a Sunday first, then a Monday.
date_modify($min_date, '+1 Sunday');
date_modify($min_date, '+1 Monday');
// Jump ahead to the desired week for the beginning of the week range.

View File

@@ -111,7 +111,7 @@ function date_default_date($element) {
$format = DATE_FORMAT_DATETIME;
// The text and popup widgets might return less than a full datetime string.
if (strlen($element['#default_value']) < 19) {
if (is_string($element['#default_value']) && strlen($element['#default_value']) < 19) {
switch (strlen($element['#default_value'])) {
case 16:
$format = 'Y-m-d H:i';
@@ -319,7 +319,7 @@ function date_text_element_process($element, &$form_state, $form) {
$element['#tree'] = TRUE;
$element['#theme_wrappers'] = array('date_text');
$element['date']['#value'] = $element['#value']['date'];
$element['date']['#value'] = isset($element['#value']['date']) ? $element['#value']['date'] : '';
$element['date']['#type'] = 'textfield';
$element['date']['#weight'] = !empty($element['date']['#weight']) ? $element['date']['#weight'] : $element['#weight'];
$element['date']['#attributes'] = array('class' => isset($element['#attributes']['class']) ? $element['#attributes']['class'] += array('date-date') : array('date-date'));

View File

@@ -194,6 +194,7 @@ function theme_date_calendar_day($variables) {
function theme_date_time_ago($variables) {
$start_date = $variables['start_date'];
$end_date = $variables['end_date'];
$use_end_date = isset($variables['use_end_date']) ? $variables['use_end_date'] : false;
$interval = !empty($variables['interval']) ? $variables['interval'] : 2;
$display = isset($variables['interval_display']) ? $variables['interval_display'] : 'time ago';
@@ -202,12 +203,20 @@ function theme_date_time_ago($variables) {
return;
}
// We use the end date only when the option is checked.
if ($use_end_date){
$date = date_format($end_date, DATE_FORMAT_UNIX);
}
else {
$date = date_format($start_date, DATE_FORMAT_UNIX);
}
// Time to compare dates to.
$now = date_format(date_now(), DATE_FORMAT_UNIX);
$start = date_format($start_date, DATE_FORMAT_UNIX);
// Will be positive for a datetime in the past (ago), and negative for a datetime in the future (hence).
$time_diff = $now - $start;
$time_diff = $now - $date;
// Uses the same options used by Views format_interval.
switch ($display) {