ran security updates on contrib modules

ctools, video_embed_field, migrate, views_bulk_operations
This commit is contained in:
Bachir Soussi Chiadmi
2015-09-17 14:44:25 +02:00
parent 5d30d9bcee
commit f7cd9c0858
94 changed files with 1242 additions and 413 deletions

View File

@@ -13,7 +13,7 @@ $plugin = array(
'access' => 'administer video styles',
// Define the menu item.
'menu' => array(
'menu prefix' => 'admin/config/media',
'menu prefix' => 'admin/config/media/vef',
'menu item' => 'vef_video_styles',
'menu title' => 'Video Embed Styles',
'menu description' => 'Administer Video Embed Field\'s video styles.',

View File

@@ -6,9 +6,9 @@ configure = admin/config/media/vef_video_styles
dependencies[] = "video_embed_field"
; Information added by Drupal.org packaging script on 2015-04-17
version = "7.x-2.0-beta8+7-dev"
; Information added by Drupal.org packaging script on 2015-09-07
version = "7.x-2.0-beta11"
core = "7.x"
project = "video_embed_field"
datestamp = "1429278491"
datestamp = "1441639440"

View File

@@ -24,6 +24,7 @@ function video_embed_brightcove_video_embed_handler_info() {
'defaults' => array(
'width' => 640,
'height' => 360,
'class' => '',
),
);
@@ -57,6 +58,13 @@ function video_embed_brightcove_form($defaults) {
'#default_value' => $defaults['height'],
);
$form['class'] = array(
'#type' => 'textfield',
'#title' => t('Player CSS class'),
'#description' => t('CSS class to add to the player'),
'#default_value' => $defaults['class'],
);
return $form;
}
@@ -83,7 +91,7 @@ function video_embed_brightcove_handle_video($url, $settings) {
if (isset($parameters['id']) && isset($parameters['key'])) {
// Embed code.
$embed = '<object id="myExperience" class="BrightcoveExperience">
$embed = '<object class="@class" id="myExperience" class="BrightcoveExperience">
<param name="bgcolor" value="#FFFFFF" />
<param name="width" value="@width" />
<param name="height" value="@height" />
@@ -100,6 +108,7 @@ function video_embed_brightcove_handle_video($url, $settings) {
'!key' => $parameters['key'],
'@width' => $settings['width'],
'@height' => $settings['height'],
'@class' => $settings['class'],
'!videoplayer' => $parameters['player'],
));
@@ -152,7 +161,7 @@ function _video_embed_brightcove_get_video_properties($url) {
$string = "/(.*){$component['start']}(.*){$component['finish']}/";
preg_match($string, $url, $matches);
if ($matches && !empty($matches[2])) {
$return[$key] = $matches[2];
$return[$key] = check_plain($matches[2]);
}
}
return $return;

View File

@@ -5,9 +5,9 @@ package = Media
configure = admin/config/media/vef_video_styles
dependencies[] = "video_embed_field"
; Information added by Drupal.org packaging script on 2015-04-17
version = "7.x-2.0-beta8+7-dev"
; Information added by Drupal.org packaging script on 2015-09-07
version = "7.x-2.0-beta11"
core = "7.x"
project = "video_embed_field"
datestamp = "1429278491"
datestamp = "1441639440"

View File

@@ -25,6 +25,7 @@ function video_embed_facebook_video_embed_handler_info() {
'defaults' => array(
'width' => 640,
'height' => 360,
'class' => '',
),
);
@@ -57,6 +58,13 @@ function video_embed_facebook_form($defaults) {
'#default_value' => $defaults['height'],
);
$form['class'] = array(
'#type' => 'textfield',
'#title' => t('Player CSS class'),
'#description' => t('CSS class to add to the player'),
'#default_value' => $defaults['class'],
);
return $form;
}
@@ -90,12 +98,13 @@ function video_embed_facebook_handle_video($url, $settings) {
if ($id) {
// Our embed code.
$embed='<iframe src="//www.facebook.com/video/embed?video_id=!id" width="!width" height="!height"></iframe> ';
$embed='<iframe class="@class" src="//www.facebook.com/video/embed?video_id=!id" width="@width" height="@height"></iframe> ';
// Use format_string to replace our placeholders with the settings values.
$embed = format_string($embed, array(
'!id' => $id,
'!width' => $settings['width'],
'!height' => $settings['height'],
'@width' => $settings['width'],
'@height' => $settings['height'],
'@class' => $settings['class'],
));
$video = array(
@@ -137,10 +146,10 @@ function video_embed_facebook_handle_thumbnail($url) {
function _video_embed_facebook_get_video_id($url) {
// Parse_url is an easy way to break a url into its components.
$matches = array();
preg_match('/(.*)?[v|video_id]=([^&#]*)/', $url, $matches);
preg_match('/(?:.*)(?:v=|video_id=|videos\/|videos\/v.\.\d+\/)(\d+).*/', $url, $matches);
// If the v or video_id get parameters are set, return it.
if ($matches && !empty($matches[2])) {
return $matches[2];
if ($matches && !empty($matches[1])) {
return check_plain($matches[1]);
}
// Otherwise return false.
return FALSE;

View File

@@ -32,3 +32,15 @@ function video_embed_field_video_style_form(&$form, &$form_state) {
return $form;
}
/**
* VEF settings page form callback.
*/
function video_embed_field_settings_form($form, &$form_state) {
$form['video_embed_field_youtube_v3_api_key'] = array(
'#type' => 'textfield',
'#title' => t('Youtube v3 API key'),
'#default_value' => variable_get('video_embed_field_youtube_v3_api_key', ''),
);
return system_settings_form($form);
}

View File

@@ -454,7 +454,7 @@ function video_embed_field_field_formatter_view($entity_type, $entity, $field, $
if (isset($item['description']) && $item['description'] && $settings['description'] && $instance['settings']['description_field']) {
$description = array(
'#prefix' => '<div class="video-embed-description">',
'#markup' => $item['description'],
'#markup' => check_plain($item['description']),
'#suffix' => '</div>',
);
$alt = $item['description'];

View File

@@ -38,6 +38,7 @@ function video_embed_field_video_embed_handler_info() {
'modestbranding' => 0,
'theme' => 'dark',
'iv_load_policy' => 1,
'class' => '',
),
);
@@ -46,6 +47,7 @@ function video_embed_field_video_embed_handler_info() {
'function' => 'video_embed_field_handle_vimeo',
'thumbnail_function' => 'video_embed_field_handle_vimeo_thumbnail',
'thumbnail_default' => drupal_get_path('module', 'video_embed_field') . '/img/vimeo.jpg',
'data_function' => '_video_embed_field_get_vimeo_data',
'form' => 'video_embed_field_handler_vimeo_form',
'form_validate' => 'video_embed_field_handler_vimeo_form_validate',
'domains' => array(
@@ -61,6 +63,7 @@ function video_embed_field_video_embed_handler_info() {
'autoplay' => 0,
'loop' => 0,
'froogaloop' => 0,
'class' => ''
),
);
@@ -146,7 +149,7 @@ function _video_embed_field_get_youtube_id($url) {
$id = substr($url, $pos);
}
}
return $id;
return check_plain($id);
}
/**
@@ -163,16 +166,21 @@ function _video_embed_field_get_youtube_id($url) {
function video_embed_field_handle_youtube($url, $settings) {
$output = array();
// Grab the minutes and seconds, and just convert it down to seconds.
preg_match('/#t=((?P<min>\d+)m)?((?P<sec>\d+)s)?/', $url, $matches);
// Give it some default data in case there is no #t=...
$matches += array(
"min" => 0,
"sec" => 0,
);
$time = ($matches["min"] * 60) + $matches["sec"];
$settings['start'] = $time;
if(preg_match('/#t=((?P<min>\d+)m)?((?P<sec>\d+)s)?((?P<tinsec>\d+))?/', $url, $matches)){
if(isset($matches['tinsec'])){
$settings['start'] = $matches['tinsec']; // url already in form #t=125 for 2 minutes and 5 seconds
} else {
// url in form #t=2m5s or with other useless data, this is why we still keep adding the default data..
// give it some default data in case there is no #t=...
$matches += array(
"min" => 0,
"sec" => 0,
);
if ($time = ($matches["min"] * 60) + $matches["sec"]) {
$settings['start'] = $time;
}
}
}
$id = _video_embed_field_get_youtube_id($url);
if (!$id) {
@@ -180,11 +188,16 @@ function video_embed_field_handle_youtube($url, $settings) {
$output['#markup'] = l($url, $url);
return $output;
}
// Add class to variable to avoid adding it to URL param string.
$class = $settings['class'];
unset($settings['class']);
// Construct the embed code.
$settings['wmode'] = 'opaque';
$settings_str = _video_embed_code_get_settings_str($settings);
$settings_str = urlencode(_video_embed_code_get_settings_str($settings));
$output['#markup'] = '<iframe width="' . check_plain($settings['width']) . '" height="' . check_plain($settings['height']) . '" src="//www.youtube.com/embed/' . $id . '?' . $settings_str . '" frameborder="0" allowfullscreen></iframe>';
$output['#markup'] = '<iframe class="' . check_plain($class) . '" width="' . check_plain($settings['width']) . '" height="' . check_plain($settings['height']) . '" src="//www.youtube.com/embed/' . $id . '?' . $settings_str . '" frameborder="0" allowfullscreen></iframe>';
return $output;
}
@@ -243,11 +256,17 @@ function video_embed_field_handle_youtube_data($url) {
$id = _video_embed_field_get_youtube_id($url);
if ($id) {
$response = drupal_http_request('http://gdata.youtube.com/feeds/api/videos/' . $id . '?v=2&alt=json');
$options['v'] = 3;
$options['key'] = variable_get('video_embed_field_youtube_v3_api_key', '');
$options['part'] = 'snippet';
$options['id'] = $id;
$response = drupal_http_request(url('https://www.googleapis.com/youtube/v3/videos', array('query' => $options)));
if (!isset($response->error)) {
$data = json_decode($response->data);
$data = isset($data->entry) ? (array) $data->entry : (array) $data->feed;
return _video_embed_field_clean_up_youtube_data($data);
return _video_embed_field_clean_up_youtube_data($data->items);
}
}
@@ -401,6 +420,13 @@ function video_embed_field_handler_youtube_form($defaults) {
'#default_value' => $defaults['autohide'],
);
$form['class'] = array(
'#type' => 'textfield',
'#title' => t('Player CSS class'),
'#description' => t('CSS class to add to the player'),
'#default_value' => $defaults['class'],
);
return $form;
}
@@ -489,10 +515,14 @@ function video_embed_field_handle_vimeo($url, $settings) {
}
unset($settings['froogaloop']);
// Add class to variable to avoid adding it to URL param string.
$class = $settings['class'];
unset($settings['class']);
$settings_str = _video_embed_code_get_settings_str($settings);
return array(
'#markup' => '<iframe id="' . $settings['player_id'] . '" width="' . check_plain($settings['width']) . '" height="' . check_plain($settings['height']) . '" src="//player.vimeo.com/video/' . $id .
'#markup' => '<iframe class="' . check_plain($class) . '" id="' . $settings['player_id'] . '" width="' . check_plain($settings['width']) . '" height="' . check_plain($settings['height']) . '" src="//player.vimeo.com/video/' . $id .
'?' . $settings_str . '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowfullscreen></iframe>',
);
}
@@ -616,6 +646,13 @@ function video_embed_field_handler_vimeo_form($defaults) {
'#default_value' => $defaults['loop'],
);
$form['class'] = array(
'#type' => 'textfield',
'#title' => t('Player CSS class'),
'#description' => t('CSS class to add to the player'),
'#default_value' => $defaults['class'],
);
return $form;
}

View File

@@ -2,7 +2,7 @@ name = "Video Embed Field"
description = "Expose a field type for embedding videos from youtube or vimeo."
core = 7.x
package = Media
configure = admin/config/media/vef_video_styles
configure = admin/config/media/vef
files[] = video_embed_field.migrate.inc
files[] = views/handlers/views_embed_field_views_handler_field_thumbnail_path.inc
@@ -10,9 +10,9 @@ files[] = views/handlers/views_embed_field_views_handler_field_thumbnail_path.in
dependencies[] = ctools
dependencies[] = image
; Information added by Drupal.org packaging script on 2015-04-17
version = "7.x-2.0-beta8+7-dev"
; Information added by Drupal.org packaging script on 2015-09-07
version = "7.x-2.0-beta11"
core = "7.x"
project = "video_embed_field"
datestamp = "1429278491"
datestamp = "1441639440"

View File

@@ -96,6 +96,13 @@ function video_embed_field_schema() {
return $schema;
}
/**
* Implements hook_uninstall().
*/
function video_embed_field_uninstall() {
variable_del('video_embed_field_youtube_api_key');
}
/**
* Adds an optional description form.
*/
@@ -363,3 +370,22 @@ function video_embed_field_update_7009() {
return t('Updated default instance settings');
}
/**
* Update styles with empty class parameter.
*/
function video_embed_field_update_7010() {
drupal_get_schema('vef_video_styles', TRUE);
ctools_include('export');
$styles = ctools_export_load_object('vef_video_styles');
foreach ($styles as $style) {
foreach ($style->data as &$provider) {
if (!isset($provider['class'])) {
$provider['class'] = '';
}
}
ctools_export_crud_save('vef_video_styles', $style);
}
return 'Parameter class added to existing styles';
}

View File

@@ -93,6 +93,26 @@ function video_embed_field_menu() {
'type' => MENU_CALLBACK,
);
$items['admin/config/media/vef'] = array(
'title' => 'Video Embed Field',
'description' => 'Video Embed Field configuration',
'page callback' => 'system_admin_menu_block_page',
'access arguments' => array('administer video styles'),
'file' => 'system.admin.inc',
'file path' => drupal_get_path('module', 'system'),
'type' => MENU_NORMAL_ITEM,
);
$items['admin/config/media/vef/settings'] = array(
'title' => 'Settings',
'description' => 'Video Embed Field module settings',
'page callback' => 'drupal_get_form',
'page arguments' => array('video_embed_field_settings_form'),
'file' => 'video_embed_field.admin.inc',
'access arguments' => array('administer video styles'),
'type' => MENU_NORMAL_ITEM,
);
return $items;
}
@@ -577,15 +597,7 @@ function _video_embed_field_get_provider_domains() {
* An array containing the allowed video domains.
*/
function _video_embed_field_get_instance_provider_domains($instance) {
$domains = _video_embed_field_get_provider_domains();
foreach ($domains as $domain => $provider) {
if (empty($instance['settings']['allowed_providers'][$provider])) {
unset($domains[$domain]);
}
}
return $domains;
return array_intersect(_video_embed_field_get_provider_domains(), $instance['settings']['allowed_providers']);
}
/**