more module updates
This commit is contained in:
parent
322dd995bf
commit
6737f9faa1
@ -55,7 +55,7 @@ function views_rss_core_field_formatter_settings_summary($field, $instance, $vie
|
|||||||
unset($image_styles['']);
|
unset($image_styles['']);
|
||||||
// Styles could be lost because of enabled/disabled modules that defines
|
// Styles could be lost because of enabled/disabled modules that defines
|
||||||
// their styles in code.
|
// 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']]));
|
$summary[] = t('Image style: @style', array('@style' => $image_styles[$settings['image_style']]));
|
||||||
}
|
}
|
||||||
else {
|
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,
|
// Get file size of image preset file (if it has already been created,
|
||||||
// otherwise just create it first and then get file size).
|
// otherwise just create it first and then get file size).
|
||||||
$path = image_style_path($display['settings']['image_style'], $item['uri']);
|
$path = image_style_path($display['settings']['image_style'], $item['uri']);
|
||||||
$real_path = drupal_realpath($path);
|
if (file_exists($path) || image_style_create_derivative($image_style, $item['uri'], $path)) {
|
||||||
if (file_exists($real_path) || image_style_create_derivative($image_style, $item['uri'], $path)) {
|
$item['filesize'] = filesize($path);
|
||||||
$item['filesize'] = filesize($real_path);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($field['type'] == 'media') {
|
elseif ($field['type'] == 'media') {
|
||||||
@ -122,7 +121,7 @@ function views_rss_core_field_formatter_view($entity_type, $entity, $field, $ins
|
|||||||
else {
|
else {
|
||||||
$uri = file_create_url($item['uri']);
|
$uri = file_create_url($item['uri']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// XML element array in format_xml_elements() format.
|
// XML element array in format_xml_elements() format.
|
||||||
$rss_element = array(
|
$rss_element = array(
|
||||||
'key' => 'enclosure',
|
'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)),
|
'#markup' => format_xml_elements(array($rss_element)),
|
||||||
'#rss_element' => $rss_element,
|
'#rss_element' => $rss_element,
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
return $element;
|
return $element;
|
||||||
}
|
}
|
||||||
|
@ -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.
|
* Preprocess function for channel <category> element.
|
||||||
*/
|
*/
|
||||||
@ -110,7 +120,7 @@ function views_rss_core_preprocess_channel_date(&$variables) {
|
|||||||
if (count($variables['view']->result) > 0) {
|
if (count($variables['view']->result) > 0) {
|
||||||
$max_date = 0;
|
$max_date = 0;
|
||||||
foreach ($variables['view']->result as $row) {
|
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) {
|
if (isset($row->$key) && $row->$key > $max_date) {
|
||||||
$max_date = $row->$key;
|
$max_date = $row->$key;
|
||||||
}
|
}
|
||||||
@ -194,4 +204,4 @@ function views_rss_core_preprocess_item_source(&$variables) {
|
|||||||
$view_title = $variables['view']->get_title();
|
$view_title = $variables['view']->get_title();
|
||||||
$variables['elements'][0]['value'] = (!empty($view_title)) ? $view_title : variable_get('site_name', t('Drupal'));
|
$variables['elements'][0]['value'] = (!empty($view_title)) ? $view_title : variable_get('site_name', t('Drupal'));
|
||||||
$variables['elements'][0]['attributes'] = array('url' => $url);
|
$variables['elements'][0]['attributes'] = array('url' => $url);
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,9 @@ package = Views
|
|||||||
dependencies[] = views_rss
|
dependencies[] = views_rss
|
||||||
core = "7.x"
|
core = "7.x"
|
||||||
|
|
||||||
; Information added by drupal.org packaging script on 2013-09-11
|
; Information added by Drupal.org packaging script on 2014-12-23
|
||||||
version = "7.x-2.0-rc3+4-dev"
|
version = "7.x-2.0-rc4"
|
||||||
core = "7.x"
|
core = "7.x"
|
||||||
project = "views_rss"
|
project = "views_rss"
|
||||||
datestamp = "1378900636"
|
datestamp = "1419363788"
|
||||||
|
|
||||||
|
@ -60,7 +60,8 @@ function views_rss_core_views_rss_channel_elements() {
|
|||||||
'help' => 'http://www.rssboard.org/rss-profile#namespace-elements-atom-link',
|
'help' => 'http://www.rssboard.org/rss-profile#namespace-elements-atom-link',
|
||||||
);
|
);
|
||||||
$elements['language'] = array(
|
$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')),
|
'@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',
|
'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."));
|
form_set_error('style_options][channel][core][views_rss_core][docs', t("Not a valid URL."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,9 @@ package = Views
|
|||||||
dependencies[] = views_rss
|
dependencies[] = views_rss
|
||||||
core = "7.x"
|
core = "7.x"
|
||||||
|
|
||||||
; Information added by drupal.org packaging script on 2013-09-11
|
; Information added by Drupal.org packaging script on 2014-12-23
|
||||||
version = "7.x-2.0-rc3+4-dev"
|
version = "7.x-2.0-rc4"
|
||||||
core = "7.x"
|
core = "7.x"
|
||||||
project = "views_rss"
|
project = "views_rss"
|
||||||
datestamp = "1378900636"
|
datestamp = "1419363788"
|
||||||
|
|
||||||
|
@ -72,6 +72,14 @@ function template_preprocess_views_view_views_rss(&$variables) {
|
|||||||
$value = NULL;
|
$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().
|
// Start building XML channel element array compatible with format_xml_elements().
|
||||||
$rss_elements = array(
|
$rss_elements = array(
|
||||||
array(
|
array(
|
||||||
@ -140,6 +148,14 @@ function template_preprocess_views_view_views_rss(&$variables) {
|
|||||||
foreach ($item as $module => $module_item_elements) {
|
foreach ($item as $module => $module_item_elements) {
|
||||||
foreach ($module_item_elements as $element => $value) {
|
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().
|
// Start building XML element array compatible with format_xml_elements().
|
||||||
$rss_elements = array(
|
$rss_elements = array(
|
||||||
array(
|
array(
|
||||||
@ -221,4 +237,4 @@ function template_preprocess_views_view_views_rss(&$variables) {
|
|||||||
|
|
||||||
// Set XML header.
|
// Set XML header.
|
||||||
drupal_add_http_header('Content-Type', 'application/rss+xml; charset=utf-8');
|
drupal_add_http_header('Content-Type', 'application/rss+xml; charset=utf-8');
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,10 @@ class views_rss_plugin_style_fields extends views_plugin_style {
|
|||||||
$url_options['query'] = $input;
|
$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 ($display->has_path() && !$this->options['feed_settings']['feed_in_links']) {
|
||||||
if (empty($this->preview)) {
|
if (empty($this->preview)) {
|
||||||
drupal_add_feed($url, $title);
|
drupal_add_feed($url, $title);
|
||||||
@ -347,7 +350,7 @@ class views_rss_plugin_style_fields extends views_plugin_style {
|
|||||||
}
|
}
|
||||||
return $errors;
|
return $errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map views row result to an RSS item.
|
* Map views row result to an RSS item.
|
||||||
*/
|
*/
|
||||||
|
@ -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_user_mail.inc
|
||||||
files[] = views/views_rss_handler_field_term_node_tid.inc
|
files[] = views/views_rss_handler_field_term_node_tid.inc
|
||||||
|
|
||||||
; Information added by drupal.org packaging script on 2013-09-11
|
; Information added by Drupal.org packaging script on 2014-12-23
|
||||||
version = "7.x-2.0-rc3+4-dev"
|
version = "7.x-2.0-rc4"
|
||||||
core = "7.x"
|
core = "7.x"
|
||||||
project = "views_rss"
|
project = "views_rss"
|
||||||
datestamp = "1378900636"
|
datestamp = "1419363788"
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ function views_rss_media_field_formatter_info() {
|
|||||||
$formatters = array(
|
$formatters = array(
|
||||||
'media_content' => array(
|
'media_content' => array(
|
||||||
'label' => t('RSS <media:content> element'),
|
'label' => t('RSS <media:content> element'),
|
||||||
'field types' => array('image', 'file', 'video'),
|
'field types' => array('image', 'file', 'video', 'video_embed_field'),
|
||||||
'settings' => array(
|
'settings' => array(
|
||||||
'image_style' => '',
|
'image_style' => '',
|
||||||
'group_multiple_values' => 0,
|
'group_multiple_values' => 0,
|
||||||
@ -38,7 +38,9 @@ function views_rss_media_field_formatter_settings_form($field, $instance, $view_
|
|||||||
$display = $instance['display'][$view_mode];
|
$display = $instance['display'][$view_mode];
|
||||||
$settings = $display['settings'];
|
$settings = $display['settings'];
|
||||||
|
|
||||||
if ($field['type'] == 'image') {
|
$element = array();
|
||||||
|
|
||||||
|
if ($field['type'] == 'image' || $field['type'] == 'file') {
|
||||||
$image_styles = image_style_options(FALSE);
|
$image_styles = image_style_options(FALSE);
|
||||||
$element['image_style'] = array(
|
$element['image_style'] = array(
|
||||||
'#title' => t('Image style'),
|
'#title' => t('Image style'),
|
||||||
@ -85,7 +87,9 @@ function views_rss_media_field_formatter_settings_form($field, $instance, $view_
|
|||||||
// hash_file() function used to generate file hashes
|
// hash_file() function used to generate file hashes
|
||||||
// is available only in PHP versions >= 5.1.2.
|
// is available only in PHP versions >= 5.1.2.
|
||||||
// @see http://www.php.net/manual/en/function.hash-file.php
|
// @see http://www.php.net/manual/en/function.hash-file.php
|
||||||
if (version_compare(phpversion(), '5.1.2') >= 0) {
|
// Also, no hash support for Video Embed fields, as these are not
|
||||||
|
// stored locally, not possible then to calculate hashes for them.
|
||||||
|
if ($field['type'] != 'video_embed_field' && version_compare(phpversion(), '5.1.2') >= 0) {
|
||||||
|
|
||||||
$element['generate_hash'] = array(
|
$element['generate_hash'] = array(
|
||||||
'#title' => t('Generate hash values for files'),
|
'#title' => t('Generate hash values for files'),
|
||||||
@ -126,7 +130,7 @@ function views_rss_media_field_formatter_settings_summary($field, $instance, $vi
|
|||||||
|
|
||||||
$summary = array();
|
$summary = array();
|
||||||
|
|
||||||
if ($field['type'] == 'image') {
|
if ($field['type'] == 'image' || $field['type'] == 'file') {
|
||||||
$image_styles = image_style_options(FALSE);
|
$image_styles = image_style_options(FALSE);
|
||||||
// Unset possible 'No defined styles' option.
|
// Unset possible 'No defined styles' option.
|
||||||
unset($image_styles['']);
|
unset($image_styles['']);
|
||||||
@ -169,13 +173,18 @@ function views_rss_media_field_formatter_view($entity_type, $entity, $field, $in
|
|||||||
|
|
||||||
foreach ($items as $delta => $item) {
|
foreach ($items as $delta => $item) {
|
||||||
|
|
||||||
|
if ($field['type'] == 'video_embed_field') {
|
||||||
|
$url = $item['video_url'];
|
||||||
|
$item['video_data'] = unserialize($item['video_data']);
|
||||||
|
}
|
||||||
|
|
||||||
// When generating a thumbnail for a video file,
|
// When generating a thumbnail for a video file,
|
||||||
// let's process only thumbnail image details.
|
// let's process only thumbnail image details.
|
||||||
if ($item['type'] == 'video' && $display['type'] == 'media_thumbnail') {
|
if ($item['type'] == 'video' && $display['type'] == 'media_thumbnail') {
|
||||||
$item = (array) $item['thumbnailfile'];
|
$item = (array) $item['thumbnailfile'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($display['type'] == 'media_content' || $display['type'] == 'media_thumbnail') {
|
if (($display['type'] == 'media_content' || $display['type'] == 'media_thumbnail') && $field['type'] != 'video_embed_field') {
|
||||||
|
|
||||||
// Inside a view item may contain NULL data. In that case, just return.
|
// Inside a view item may contain NULL data. In that case, just return.
|
||||||
if (empty($item['fid'])) {
|
if (empty($item['fid'])) {
|
||||||
@ -207,10 +216,14 @@ function views_rss_media_field_formatter_view($entity_type, $entity, $field, $in
|
|||||||
'key' => 'media:content',
|
'key' => 'media:content',
|
||||||
'attributes' => array(
|
'attributes' => array(
|
||||||
'url' => $url,
|
'url' => $url,
|
||||||
'fileSize' => $item['filesize'],
|
|
||||||
'type' => $item['filemime'],
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
if (!empty($item['filesize'])) {
|
||||||
|
$rss_element['attributes']['fileSize'] = $item['filesize'];
|
||||||
|
}
|
||||||
|
if (!empty($item['filemime'])) {
|
||||||
|
$rss_element['attributes']['type'] = $item['filemime'];
|
||||||
|
}
|
||||||
if (!empty($display['settings']['medium'])) {
|
if (!empty($display['settings']['medium'])) {
|
||||||
$rss_element['attributes']['medium'] = $display['settings']['medium'];
|
$rss_element['attributes']['medium'] = $display['settings']['medium'];
|
||||||
}
|
}
|
||||||
@ -256,6 +269,45 @@ function views_rss_media_field_formatter_view($entity_type, $entity, $field, $in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Additional properties for Video Embed fields.
|
||||||
|
if ($field['type'] == 'video_embed_field') {
|
||||||
|
if (!empty($item['video_data']['media$group']['media$content'][0])) {
|
||||||
|
$rss_element['attributes'] += $item['video_data']['media$group']['media$content'][0];
|
||||||
|
}
|
||||||
|
if (!empty($item['video_data']['media$group']['media$title'])) {
|
||||||
|
$rss_element['value'][] = array(
|
||||||
|
'key' => 'media:title',
|
||||||
|
'value' => $item['video_data']['media$group']['media$title'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!empty($item['video_data']['media$group']['media$description'])) {
|
||||||
|
$rss_element['value'][] = array(
|
||||||
|
'key' => 'media:description',
|
||||||
|
'value' => $item['video_data']['media$group']['media$description'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!empty($item['video_data']['media$group']['media$thumbnail'][0])) {
|
||||||
|
$rss_element['value'][] = array(
|
||||||
|
'key' => 'media:thumbnail',
|
||||||
|
'attributes' => $item['video_data']['media$group']['media$thumbnail'][0],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!empty($item['video_data']['media$group']['media$category'])) {
|
||||||
|
foreach ($item['video_data']['media$group']['media$category'] as $category) {
|
||||||
|
$rss_element['value'][] = array(
|
||||||
|
'key' => 'media:category',
|
||||||
|
'value' => $category,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!empty($item['video_data']['media$group']['media$keywords'])) {
|
||||||
|
$rss_element['value'][] = array(
|
||||||
|
'key' => 'media:keywords',
|
||||||
|
'value' => implode(', ', $item['video_data']['media$group']['media$keywords']),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Generate file hash for <media:hash> element.
|
// Generate file hash for <media:hash> element.
|
||||||
// hash_file() function used to generate file hashes
|
// hash_file() function used to generate file hashes
|
||||||
// is available only in PHP versions >= 5.1.2.
|
// is available only in PHP versions >= 5.1.2.
|
||||||
|
@ -12,9 +12,9 @@ project = "views_rss_media"
|
|||||||
datestamp = "1344474923"
|
datestamp = "1344474923"
|
||||||
|
|
||||||
|
|
||||||
; Information added by drupal.org packaging script on 2013-09-11
|
; Information added by Drupal.org packaging script on 2014-10-15
|
||||||
version = "7.x-1.x-dev"
|
version = "7.x-1.x-dev"
|
||||||
core = "7.x"
|
core = "7.x"
|
||||||
project = "views_rss_media"
|
project = "views_rss_media"
|
||||||
datestamp = "1378900668"
|
datestamp = "1413385143"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user