more module updates

This commit is contained in:
Bachir Soussi Chiadmi
2015-04-20 18:23:59 +02:00
parent 322dd995bf
commit 6737f9faa1
10 changed files with 112 additions and 31 deletions

View File

@@ -55,7 +55,7 @@ function views_rss_core_field_formatter_settings_summary($field, $instance, $vie
unset($image_styles['']);
// Styles could be lost because of enabled/disabled modules that defines
// their styles in code.
if (isset($image_styles[$settings['image_style']])) {
if (!empty($settings['image_style']) && !empty($image_styles[$settings['image_style']])) {
$summary[] = t('Image style: @style', array('@style' => $image_styles[$settings['image_style']]));
}
else {
@@ -101,9 +101,8 @@ function views_rss_core_field_formatter_view($entity_type, $entity, $field, $ins
// Get file size of image preset file (if it has already been created,
// otherwise just create it first and then get file size).
$path = image_style_path($display['settings']['image_style'], $item['uri']);
$real_path = drupal_realpath($path);
if (file_exists($real_path) || image_style_create_derivative($image_style, $item['uri'], $path)) {
$item['filesize'] = filesize($real_path);
if (file_exists($path) || image_style_create_derivative($image_style, $item['uri'], $path)) {
$item['filesize'] = filesize($path);
}
}
elseif ($field['type'] == 'media') {
@@ -122,7 +121,7 @@ function views_rss_core_field_formatter_view($entity_type, $entity, $field, $ins
else {
$uri = file_create_url($item['uri']);
}
// XML element array in format_xml_elements() format.
$rss_element = array(
'key' => 'enclosure',
@@ -138,7 +137,7 @@ function views_rss_core_field_formatter_view($entity_type, $entity, $field, $ins
'#markup' => format_xml_elements(array($rss_element)),
'#rss_element' => $rss_element,
);
}
return $element;
}

View File

@@ -45,6 +45,16 @@ function views_rss_core_preprocess_channel_atom_link(&$variables) {
);
}
/**
* Preprocess function for channel <language> element.
*/
function views_rss_core_preprocess_channel_language(&$variables) {
global $language;
if (empty($variables['elements'][0]['value'])) {
$variables['elements'][0]['value'] = $language->language;
}
}
/**
* Preprocess function for channel <category> element.
*/
@@ -110,7 +120,7 @@ function views_rss_core_preprocess_channel_date(&$variables) {
if (count($variables['view']->result) > 0) {
$max_date = 0;
foreach ($variables['view']->result as $row) {
$key = strtolower($variables['elements'][0]['key']);
$key = $variables['elements'][0]['key'];
if (isset($row->$key) && $row->$key > $max_date) {
$max_date = $row->$key;
}
@@ -194,4 +204,4 @@ function views_rss_core_preprocess_item_source(&$variables) {
$view_title = $variables['view']->get_title();
$variables['elements'][0]['value'] = (!empty($view_title)) ? $view_title : variable_get('site_name', t('Drupal'));
$variables['elements'][0]['attributes'] = array('url' => $url);
}
}

View File

@@ -4,9 +4,9 @@ package = Views
dependencies[] = views_rss
core = "7.x"
; Information added by drupal.org packaging script on 2013-09-11
version = "7.x-2.0-rc3+4-dev"
; Information added by Drupal.org packaging script on 2014-12-23
version = "7.x-2.0-rc4"
core = "7.x"
project = "views_rss"
datestamp = "1378900636"
datestamp = "1419363788"

View File

@@ -60,7 +60,8 @@ function views_rss_core_views_rss_channel_elements() {
'help' => 'http://www.rssboard.org/rss-profile#namespace-elements-atom-link',
);
$elements['language'] = array(
'description' => t('The language the channel is written in. This allows aggregators to group all Italian language sites, for example, on a single page. See list of <a href="@w3c_url">allowable values</a> for this element defined by the W3C.', array(
'preprocess functions' => array('views_rss_core_preprocess_channel_language'),
'description' => t("The language the channel is written in. This allows aggregators to group all Italian language sites, for example, on a single page. See list of <a href='@w3c_url'>allowable values</a> for this element defined by the W3C. If left empty, it will use current site's language.", array(
'@w3c_url' => url('http://www.w3.org/TR/REC-html40/struct/dirlang.html', array('fragment' => 'langcodes')),
)),
'help' => 'http://www.rssboard.org/rss-profile#element-channel-language',
@@ -281,4 +282,4 @@ function views_rss_core_views_rss_options_form_validate($form, &$form_state) {
form_set_error('style_options][channel][core][views_rss_core][docs', t("Not a valid URL."));
}
}
}
}

View File

@@ -4,9 +4,9 @@ package = Views
dependencies[] = views_rss
core = "7.x"
; Information added by drupal.org packaging script on 2013-09-11
version = "7.x-2.0-rc3+4-dev"
; Information added by Drupal.org packaging script on 2014-12-23
version = "7.x-2.0-rc4"
core = "7.x"
project = "views_rss"
datestamp = "1378900636"
datestamp = "1419363788"

View File

@@ -72,6 +72,14 @@ function template_preprocess_views_view_views_rss(&$variables) {
$value = NULL;
}
// Avoid double encoding: the $value might be already encoded here,
// depending on the field configuration/processing, and because we know
// it will be encoded again when the whole feed array will be passed to
// format_xml_elements(), let's make sure we decode it here first.
if (is_string($value)) {
$value = decode_entities($value);
}
// Start building XML channel element array compatible with format_xml_elements().
$rss_elements = array(
array(
@@ -140,6 +148,14 @@ function template_preprocess_views_view_views_rss(&$variables) {
foreach ($item as $module => $module_item_elements) {
foreach ($module_item_elements as $element => $value) {
// Avoid double encoding: the $value might be already encoded here,
// depending on the field configuration/processing, and because we know
// it will be encoded again when the whole feed array will be passed to
// format_xml_elements(), let's make sure we decode it here first.
if (is_string($value)) {
$value = decode_entities($value);
}
// Start building XML element array compatible with format_xml_elements().
$rss_elements = array(
array(
@@ -221,4 +237,4 @@ function template_preprocess_views_view_views_rss(&$variables) {
// Set XML header.
drupal_add_http_header('Content-Type', 'application/rss+xml; charset=utf-8');
}
}

View File

@@ -18,7 +18,10 @@ class views_rss_plugin_style_fields extends views_plugin_style {
$url_options['query'] = $input;
}
$url = url($this->view->get_url(NULL, $path), $url_options);
// Don't add arguments to RSS path if the feed does not support arguments.
$feed_path = !empty($this->display->display_options['arguments']) ? $this->view->get_url(NULL, $path) : $path;
$url = url($feed_path, $url_options);
if ($display->has_path() && !$this->options['feed_settings']['feed_in_links']) {
if (empty($this->preview)) {
drupal_add_feed($url, $title);
@@ -347,7 +350,7 @@ class views_rss_plugin_style_fields extends views_plugin_style {
}
return $errors;
}
/**
* Map views row result to an RSS item.
*/

View File

@@ -7,9 +7,9 @@ files[] = views/views_rss_plugin_style_fields.inc
files[] = views/views_rss_handler_field_user_mail.inc
files[] = views/views_rss_handler_field_term_node_tid.inc
; Information added by drupal.org packaging script on 2013-09-11
version = "7.x-2.0-rc3+4-dev"
; Information added by Drupal.org packaging script on 2014-12-23
version = "7.x-2.0-rc4"
core = "7.x"
project = "views_rss"
datestamp = "1378900636"
datestamp = "1419363788"