all contrib module security updates done

This commit is contained in:
2020-09-24 22:47:32 +02:00
parent 7d87153100
commit 0fbb9c4610
1612 changed files with 116663 additions and 32269 deletions
+144 -11
View File
@@ -74,7 +74,10 @@ function theme_date_display_combination($variables) {
$attributes = $variables['attributes'];
$rdf_mapping = $variables['rdf_mapping'];
$add_rdf = $variables['add_rdf'];
$microdata = $variables['microdata'];
$add_microdata = $variables['add_microdata'];
$precision = date_granularity_precision($field['settings']['granularity']);
$show_remaining_days = $variables['show_remaining_days'];
$output = '';
@@ -119,10 +122,12 @@ function theme_date_display_combination($variables) {
$date1 = $dates['value']['formatted'];
$date2 = $date1;
break;
case 'value2':
$date2 = $dates['value2']['formatted'];
$date1 = $date2;
break;
default:
$date1 = $dates['value']['formatted'];
$date2 = $dates['value2']['formatted'];
@@ -149,6 +154,20 @@ function theme_date_display_combination($variables) {
$has_time_string = FALSE;
}
// Check remaining days.
$show_remaining_days = '';
if (!empty($variables['show_remaining_days'])) {
$remaining_days = floor((strtotime($variables['dates']['value']['formatted_iso'])
- strtotime('now')) / (24 * 3600));
// Show remaining days only for future events.
if ($remaining_days >= 0) {
$show_remaining_days = theme('date_display_remaining', array(
'remaining_days' => $remaining_days,
));
}
}
// No date values, display nothing.
if (empty($date1) && empty($date2)) {
$output .= '';
@@ -162,7 +181,10 @@ function theme_date_display_combination($variables) {
'attributes' => $attributes,
'rdf_mapping' => $rdf_mapping,
'add_rdf' => $add_rdf,
'microdata' => $microdata,
'add_microdata' => $add_microdata,
'dates' => $dates,
'show_remaining_days' => $show_remaining_days,
));
}
// Same day, different times, don't repeat the date but show both Start and
@@ -179,7 +201,10 @@ function theme_date_display_combination($variables) {
'attributes' => $attributes,
'rdf_mapping' => $rdf_mapping,
'add_rdf' => $add_rdf,
'microdata' => $microdata,
'add_microdata' => $add_microdata,
'dates' => $dates,
'show_remaining_days' => $show_remaining_days,
));
$replaced = str_replace($time1, $time, $date1);
$output .= theme('date_display_single', array(
@@ -200,7 +225,10 @@ function theme_date_display_combination($variables) {
'attributes' => $attributes,
'rdf_mapping' => $rdf_mapping,
'add_rdf' => $add_rdf,
'microdata' => $microdata,
'add_microdata' => $add_microdata,
'dates' => $dates,
'show_remaining_days' => $show_remaining_days,
));
}
@@ -211,7 +239,7 @@ function theme_date_display_combination($variables) {
* Template preprocess function for displaying a single date.
*/
function template_preprocess_date_display_single(&$variables) {
if ($variables['add_rdf']) {
if ($variables['add_rdf'] || !empty($variables['add_microdata'])) {
// Pass along the rdf mapping for this field, if any. Add some default rdf
// attributes that will be used if not overridden by attributes passed in.
$rdf_mapping = $variables['rdf_mapping'];
@@ -222,6 +250,24 @@ function template_preprocess_date_display_single(&$variables) {
);
$variables['attributes'] = $variables['attributes'] + $base_attributes;
}
// Pass along microdata attributes, or set display to false if none are set.
if (!empty($variables['add_microdata'])) {
// Because the Entity API integration for Date has a variable data
// structure depending on whether there is an end value, the attributes
// could be attached to the field or to the value property.
if (!empty($variables['microdata']['#attributes']['itemprop'])) {
$variables['microdata']['value']['#attributes'] = $variables['microdata']['#attributes'];
}
// Add the machine readable time using the content attribute.
if (!empty($variables['microdata']['value']['#attributes'])) {
$variables['microdata']['value']['#attributes']['content'] = $variables['dates']['value']['formatted_iso'];
}
else {
$variables['add_microdata'] = FALSE;
}
}
}
/**
@@ -231,9 +277,17 @@ function theme_date_display_single($variables) {
$date = $variables['date'];
$timezone = $variables['timezone'];
$attributes = $variables['attributes'];
$show_remaining_days = isset($variables['show_remaining_days']) ? $variables['show_remaining_days'] : '';
// Wrap the result with the attributes.
return '<span class="date-display-single"' . drupal_attributes($attributes) . '>' . $date . $timezone . '</span>';
$output = '<span class="date-display-single"' . drupal_attributes($attributes) . '>' . $date . $timezone . '</span>';
if (!empty($variables['add_microdata'])) {
$output .= '<meta' . drupal_attributes($variables['microdata']['value']['#attributes']) . '/>';
}
// Add remaining message and return.
return $output . $show_remaining_days;
}
/**
@@ -247,7 +301,6 @@ function template_preprocess_date_display_range(&$variables) {
if ($variables['add_rdf']) {
// Pass along the rdf mapping for this field, if any. Add some default rdf
// attributes that will be used if not overridden by attributes passed in.
$rdf_mapping = $variables['rdf_mapping'];
$dates = $variables['dates'];
$base_attributes = array(
'property' => array('dc:date'),
@@ -261,6 +314,17 @@ function template_preprocess_date_display_range(&$variables) {
$variables['attributes_end']['property'][$delta] = str_replace('start', 'end', $property);
}
}
// Pass along microdata attributes, or set display to false if none are set.
if ($variables['add_microdata']) {
if (!empty($variables['microdata']['value']['#attributes'])) {
$variables['microdata']['value']['#attributes']['content'] = $variables['dates']['value']['formatted_iso'];
$variables['microdata']['value2']['#attributes']['content'] = $variables['dates']['value2']['formatted_iso'];
}
else {
$variables['add_microdata'] = FALSE;
}
}
}
/**
@@ -272,12 +336,26 @@ function theme_date_display_range($variables) {
$timezone = $variables['timezone'];
$attributes_start = $variables['attributes_start'];
$attributes_end = $variables['attributes_end'];
$show_remaining_days = $variables['show_remaining_days'];
$start_date = '<span class="date-display-start"' . drupal_attributes($attributes_start) . '>' . $date1 . '</span>';
$end_date = '<span class="date-display-end"' . drupal_attributes($attributes_end) . '>' . $date2 . $timezone . '</span>';
// If microdata attributes for the start date property have been passed in,
// add the microdata in meta tags.
if (!empty($variables['add_microdata'])) {
$start_date .= '<meta' . drupal_attributes($variables['microdata']['value']['#attributes']) . '/>';
$end_date .= '<meta' . drupal_attributes($variables['microdata']['value2']['#attributes']) . '/>';
}
// Wrap the result with the attributes.
return t('!start-date to !end-date', array(
'!start-date' => '<span class="date-display-start"' . drupal_attributes($attributes_start) . '>' . $date1 . '</span>',
'!end-date' => '<span class="date-display-end"' . drupal_attributes($attributes_end) . '>' . $date2 . $timezone . '</span>',
));
$output = '<span class="date-display-range">' . t('!start-date to !end-date', array(
'!start-date' => $start_date,
'!end-date' => $end_date,
)) . '</span>';
// Add remaining message and return.
return $output . $show_remaining_days;
}
/**
@@ -300,6 +378,8 @@ function theme_date_display_interval($variables) {
'end_date' => $dates['value2']['local']['object'],
'interval' => $options['interval'],
'interval_display' => $options['interval_display'],
'use_end_date' => !empty($options['use_end_date']) ?
$options['use_end_date'] : FALSE,
);
if ($return = theme('date_time_ago', $time_ago_vars)) {
@@ -320,12 +400,16 @@ function theme_date_combo($variables) {
// Group start/end items together in fieldset.
$fieldset = array(
'#title' => t($element['#title']) . ' ' . ($element['#delta'] > 0 ? intval($element['#delta'] + 1) : ''),
'#title' => field_filter_xss(t($element['#title'])) . ($element['#delta'] > 0 ? ' ' . intval($element['#delta'] + 1) : ''),
'#value' => '',
'#description' => !empty($element['#fieldset_description']) ? $element['#fieldset_description'] : '',
'#attributes' => array(),
'#description' => !empty($element['#description']) ? $element['#description'] : '',
'#attributes' => array('class' => array('date-combo')),
'#children' => $element['#children'],
);
// Add marker to required date fields.
if ($element['#required']) {
$fieldset['#title'] .= " " . theme('form_required_marker');
}
return theme('fieldset', array('element' => $fieldset));
}
@@ -340,7 +424,11 @@ function theme_date_text_parts($variables) {
$rows[] = drupal_render($element[$key]);
}
else {
$rows[] = array($part, drupal_render($element[$key][0]), drupal_render($element[$key][1]));
$rows[] = array(
$part,
drupal_render($element[$key][0]),
drupal_render($element[$key][1]),
);
}
}
if ($element['year']['#type'] == 'hidden') {
@@ -352,4 +440,49 @@ function theme_date_text_parts($variables) {
}
}
/**
* Render a date combo as a form element.
*/
function theme_date_form_element($variables) {
$element = &$variables['element'];
// Detect whether element is multiline.
$count = preg_match_all('`<(?:div|span)\b[^>]* class="[^"]*\b(?:date-no-float|date-clear)\b`', $element['#children'], $matches, PREG_OFFSET_CAPTURE);
$multiline = FALSE;
if ($count > 1) {
$multiline = TRUE;
}
elseif ($count) {
$before = substr($element['#children'], 0, $matches[0][0][1]);
if (preg_match('`<(?:div|span)\b[^>]* class="[^"]*\bdate-float\b`', $before)) {
$multiline = TRUE;
}
}
// Detect if there is more than one subfield.
$count = count(explode('<label', $element['#children'])) - 1;
if ($count == 1) {
$element['#title_display'] = 'none';
}
// Wrap children with a div and add an extra class if element is multiline.
$element['#children'] = '<div class="date-form-element-content'. ($multiline ? ' date-form-element-content-multiline' : '') .'">'. $element['#children'] .'</div>';
return theme('form_element', $variables);
}
/**
* Returns HTML for remaining message.
*/
function theme_date_display_remaining($variables) {
$remaining_days = $variables['remaining_days'];
$output = '';
$show_remaining_text = t('The upcoming date less then 1 day.');
if ($remaining_days) {
$show_remaining_text = format_plural($remaining_days, 'To event remaining 1 day', 'To event remaining @count days');
}
return '<div class="date-display-remaining"><span class="date-display-remaining">' . $show_remaining_text . '</span></div>';
}
/** @} End of addtogroup themeable */