updated video filter module to handle https on embeded videos
This commit is contained in:
parent
3af02617b4
commit
b4acd7d8bb
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
This is a highly flexible and easy extendable filter module to embed any type
|
This is a highly flexible and easy extendable filter module to embed any type
|
||||||
of video in your site using a simple tag. Other modules can add video
|
of video in your site using a simple tag. Other modules can add video
|
||||||
sites/formats (called codecs) using an easy plug-in architecture.
|
sites/formats (called codecs) using an easy plug-in architecture.
|
||||||
@ -22,6 +21,9 @@ processed after that filter.
|
|||||||
To enable WYSIWYG support, go to the WYSIWYG settings for each input format and
|
To enable WYSIWYG support, go to the WYSIWYG settings for each input format and
|
||||||
enable the Video Filter button.
|
enable the Video Filter button.
|
||||||
|
|
||||||
|
To enable CKEditor (standalone) support, please see plugin instructions in:
|
||||||
|
editors/ckeditor/README.txt
|
||||||
|
|
||||||
========= Usage =========
|
========= Usage =========
|
||||||
|
|
||||||
Single video: [video:url]
|
Single video: [video:url]
|
||||||
|
@ -1,35 +1,15 @@
|
|||||||
|
############################################################
|
||||||
##############################################
|
## ONLY if with the CKEditor module, *NOT* WYSIWYG module ##
|
||||||
## ONLY if you use ckeditor WITHOUT wysiwyg ##
|
############################################################
|
||||||
##############################################
|
|
||||||
|
|
||||||
Installation:
|
Installation:
|
||||||
|
|
||||||
Do the following steps to add video_filter button to the CKEditor toolbar:
|
Do the following steps to add video_filter button to the CKEditor toolbar:
|
||||||
|
|
||||||
1. Open ckeditor.config.js (in the ckeditor module root)
|
1. Go to Configuration -> CKEditor (admin/config/content/ckeditor)
|
||||||
|
Click "Edit" on the profile you what to use with the video filter.
|
||||||
|
|
||||||
2. Scroll down to the end of the file, right before "};" insert:
|
2. Expand "Editor appearance" and go to "Toolbar". Drag the new video_filter
|
||||||
|
button from the "All Buttons" toolbar to the "Used Buttons" toolbar.
|
||||||
|
|
||||||
// Video_filter plugin.
|
3. Go to "Plugins" on the same page. Enable the video filter plugin.
|
||||||
config.extraPlugins += (config.extraPlugins ? ',video_filter' : 'video_filter' );
|
|
||||||
CKEDITOR.plugins.addExternal('video_filter', Drupal.settings.basePath + Drupal.settings.video_filter.modulepath + '/editors/ckeditor/');
|
|
||||||
|
|
||||||
3. Add button to the toolbar.
|
|
||||||
|
|
||||||
3.1 Go to Configuration -> CKEditor (admin/config/content/ckeditor)
|
|
||||||
Click "Edit" on the profile you what to use with Linkit.
|
|
||||||
|
|
||||||
3.2 Expand "Editor appearance" and go to "Toolbar".
|
|
||||||
|
|
||||||
The button name is: video_filter
|
|
||||||
For example if you have a toolbar with an array of buttons defined as
|
|
||||||
follows:
|
|
||||||
|
|
||||||
['Bold','Italic']
|
|
||||||
|
|
||||||
simply add the button somewhere in the array:
|
|
||||||
|
|
||||||
['Bold','Italic','video_filter']
|
|
||||||
|
|
||||||
(remember the single quotes).
|
|
||||||
|
@ -7,25 +7,126 @@
|
|||||||
requires : [],
|
requires : [],
|
||||||
|
|
||||||
init: function(editor) {
|
init: function(editor) {
|
||||||
|
|
||||||
// Add Button
|
// Add Button
|
||||||
editor.ui.addButton('video_filter', {
|
editor.ui.addButton('video_filter', {
|
||||||
label: 'Video filter',
|
label: 'Video filter',
|
||||||
command: 'video_filter',
|
command: 'video_filter',
|
||||||
icon: this.path + 'video_filter.png'
|
icon: this.path + 'video_filter.png'
|
||||||
});
|
});
|
||||||
// Add Command
|
|
||||||
editor.addCommand('video_filter', {
|
|
||||||
exec : function () {
|
|
||||||
var path = (Drupal.settings.video_filter.url.wysiwyg_ckeditor) ? Drupal.settings.video_filter.url.wysiwyg_ckeditor : Drupal.settings.video_filter.url.ckeditor
|
|
||||||
var media = window.showModalDialog(path, { 'opener' : window, 'editorname' : editor.name }, "dialogWidth:580px; dialogHeight:480px; center:yes; resizable:yes; help:no;");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Register an extra fucntion, this will be used in the popup.
|
if(typeof window.showModalDialog !== 'undefined') {
|
||||||
editor._.video_filterFnNum = CKEDITOR.tools.addFunction(insert, editor);
|
editor.addCommand('video_filter', {
|
||||||
|
exec : function () {
|
||||||
|
var path = (Drupal.settings.video_filter.url.wysiwyg_ckeditor) ? Drupal.settings.video_filter.url.wysiwyg_ckeditor : Drupal.settings.video_filter.url.ckeditor
|
||||||
|
var media = window.showModalDialog(path, { 'opener' : window, 'editorname' : editor.name }, "dialogWidth:580px; dialogHeight:480px; center:yes; resizable:yes; help:no;");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Register an extra function, this will be used in the popup.
|
||||||
|
editor._.video_filterFnNum = CKEDITOR.tools.addFunction(insert, editor);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
editor.addCommand('video_filter', new CKEDITOR.dialogCommand('video_filterDialog'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
CKEDITOR.dialog.add('video_filterDialog', function( editor ) {
|
||||||
|
var instructions_path = Drupal.settings.video_filter.instructions_url;
|
||||||
|
|
||||||
|
return {
|
||||||
|
title : 'Add Video',
|
||||||
|
minWidth : 600,
|
||||||
|
minHeight : 180,
|
||||||
|
contents : [{
|
||||||
|
id : 'general',
|
||||||
|
label : 'Settings',
|
||||||
|
elements : [
|
||||||
|
{
|
||||||
|
type : 'text',
|
||||||
|
id : 'file_url',
|
||||||
|
label : 'URL',
|
||||||
|
validate : CKEDITOR.dialog.validate.notEmpty( 'The link must have a URL.' ),
|
||||||
|
required : true,
|
||||||
|
commit : function( data )
|
||||||
|
{
|
||||||
|
data.file_url = this.getValue();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type : 'text',
|
||||||
|
id : 'width',
|
||||||
|
label : 'Width',
|
||||||
|
commit : function( data )
|
||||||
|
{
|
||||||
|
data.width = this.getValue();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type : 'text',
|
||||||
|
id : 'height',
|
||||||
|
label : 'Height',
|
||||||
|
commit : function( data )
|
||||||
|
{
|
||||||
|
data.height = this.getValue();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type : 'select',
|
||||||
|
id : 'align',
|
||||||
|
label : 'Align',
|
||||||
|
'default': 'none',
|
||||||
|
items: [
|
||||||
|
['None', ''],
|
||||||
|
['Left', 'left'],
|
||||||
|
['Right', 'right'],
|
||||||
|
['Center', 'center']
|
||||||
|
],
|
||||||
|
commit : function( data )
|
||||||
|
{
|
||||||
|
data.align = this.getValue();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type : 'checkbox',
|
||||||
|
id : 'autoplay',
|
||||||
|
label : 'Autoplay',
|
||||||
|
'default': '',
|
||||||
|
commit : function( data )
|
||||||
|
{
|
||||||
|
data.autoplay = this.getValue() ? 1 : 0;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'html',
|
||||||
|
html: '<iframe src="' + instructions_path + '" style="width:100%; height: 200px;"></iframe>',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
onOk : function()
|
||||||
|
{
|
||||||
|
var dialog = this,
|
||||||
|
data = {},
|
||||||
|
link = editor.document.createElement( 'p' );
|
||||||
|
this.commitContent( data );
|
||||||
|
var str = '[video:' + data.file_url;
|
||||||
|
if (data.width) {
|
||||||
|
str += ' width:' + data.width;
|
||||||
|
}
|
||||||
|
if (data.height) {
|
||||||
|
str += ' height:' + data.height;
|
||||||
|
}
|
||||||
|
if (data.align) {
|
||||||
|
str += ' align:' + data.align;
|
||||||
|
}
|
||||||
|
if (data.autoplay) {
|
||||||
|
str += ' autoplay:' + data.autoplay;
|
||||||
|
}
|
||||||
|
str += ']';
|
||||||
|
link.setHtml( str );
|
||||||
|
editor.insertElement( link );
|
||||||
|
}
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
function insert(params, editor) {
|
function insert(params, editor) {
|
||||||
@ -49,6 +150,9 @@
|
|||||||
if (params.autoplay) {
|
if (params.autoplay) {
|
||||||
str += ' autoplay:' + params.autoplay;
|
str += ' autoplay:' + params.autoplay;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
str += ' autoplay:' + '0';
|
||||||
|
}
|
||||||
str += ']';
|
str += ']';
|
||||||
|
|
||||||
for (var i = 0, len = ranges.length; i < len; i++) {
|
for (var i = 0, len = ranges.length; i < len; i++) {
|
||||||
|
@ -43,6 +43,9 @@ function Ok() {
|
|||||||
if ($('#edit-autoplay').is(':checked')) {
|
if ($('#edit-autoplay').is(':checked')) {
|
||||||
str += ' autoplay:' + $('#edit-autoplay').val();
|
str += ' autoplay:' + $('#edit-autoplay').val();
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
str += ' autoplay:' + '0';
|
||||||
|
}
|
||||||
str += ']';
|
str += ']';
|
||||||
|
|
||||||
oEditor.FCKUndo.SaveUndoStep();
|
oEditor.FCKUndo.SaveUndoStep();
|
||||||
|
@ -34,6 +34,9 @@ video_filter_dialog = {
|
|||||||
if ($('#edit-autoplay').is(':checked')) {
|
if ($('#edit-autoplay').is(':checked')) {
|
||||||
str += ' autoplay:' + $('#edit-autoplay').val();
|
str += ' autoplay:' + $('#edit-autoplay').val();
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
str += ' autoplay:' + '0';
|
||||||
|
}
|
||||||
str += ']';
|
str += ']';
|
||||||
|
|
||||||
ed.execCommand('mceInsertContent', false, str);
|
ed.execCommand('mceInsertContent', false, str);
|
||||||
|
@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Hooks provided by the Video Filter module.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines video codecs and callbacks.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* A video codec described as an associative array that may contain the
|
||||||
|
* following key-value pairs:
|
||||||
|
* - name: Required. A name for the codec.
|
||||||
|
* - sample_url: Required. An example of a URL the codec can handle.
|
||||||
|
* - callback: The function to call to generate embed code for the codec.
|
||||||
|
* Either this or html5_callback must be specified.
|
||||||
|
* - html5_callback: The function to call to generate device agnostic, HTML5
|
||||||
|
* embed code for the codec. Either this or callback must be specified.
|
||||||
|
* - instructions: Instructions for using the codec, to be displayed on the
|
||||||
|
* "Compse tips" page at filter/tips.
|
||||||
|
* - regexp: Required. A regular expression describing URLs the codec can
|
||||||
|
* handle. Multiple regular expressions may be supplied as an array.
|
||||||
|
* $video['codec']['delta'] will be set to the key of the match.
|
||||||
|
* - ratio: Required. A ratio for resizing the video within the dimensions
|
||||||
|
* optionally supplied in the token, expressed as height / width.
|
||||||
|
* - control_bar_height: The pixel height of the video player control bar, if
|
||||||
|
* applicable.
|
||||||
|
*/
|
||||||
|
function hook_codec_info() {
|
||||||
|
$codecs = array();
|
||||||
|
|
||||||
|
$codecs['minimal_example'] = array(
|
||||||
|
'name' => t('Minimal Example'),
|
||||||
|
'sample_url' => 'http://minimal.example.com/uN1qUeId',
|
||||||
|
'callback' => 'MODULE_minimal_example',
|
||||||
|
'regexp' => '/minimal\.example\.com\/([a-z0-9\-_]+)/i',
|
||||||
|
'ratio' => 4 / 3,
|
||||||
|
);
|
||||||
|
|
||||||
|
$codecs['complete_example'] = array(
|
||||||
|
'name' => t('Complete Example'),
|
||||||
|
'sample_url' => 'http://complete.example.com/username/uN1qUeId',
|
||||||
|
'callback' => 'MODULE_complete_example',
|
||||||
|
'html5_callback' => 'MODULE_complete_example_html5',
|
||||||
|
'instructions' => t('Your Complete Example username can be the first URL argument or a sub-subdomain.'),
|
||||||
|
'regexp' => array(
|
||||||
|
'/complete\.example\.com\/([a-z0-9\-_]+)\/([a-z0-9\-_]+)/i',
|
||||||
|
'/([a-z0-9\-_]+)\.complete\.example\.com\/([a-z0-9\-_]+)/i',
|
||||||
|
),
|
||||||
|
'ratio' => 4 / 3,
|
||||||
|
'control_bar_height' => 25,
|
||||||
|
);
|
||||||
|
|
||||||
|
return $codecs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alters the codecs available to Video Filter.
|
||||||
|
*
|
||||||
|
* @param array $codecs
|
||||||
|
*/
|
||||||
|
function hook_video_filter_codec_info_alter(&$codecs) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alters a video's attributes previous to rendering.
|
||||||
|
*
|
||||||
|
* @param array $video
|
||||||
|
*/
|
||||||
|
function hook_video_filter_video_alter(&$video) {}
|
@ -34,6 +34,15 @@ function video_filter_codec_info() {
|
|||||||
'control_bar_height' => 30,
|
'control_bar_height' => 30,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$codecs['candidcareer'] = array(
|
||||||
|
'name' => t('Candid Career'),
|
||||||
|
'sample_url' => 'https://www.candidcareer.com/embed.php?vkey=ed5fdd900a274930252f&shared=CandidCareer&uid=30',
|
||||||
|
'callback' => 'video_filter_candidcareer',
|
||||||
|
'regexp' => '/candidcareer\.com\/embed\.php\?vkey=([a-zA-Z0-9\-_&;]+)shared=([a-zA-Z0-9\-_&;]+)uid=([a-zA-Z0-9\-_&;]+)/',
|
||||||
|
'ratio' => 16 / 9,
|
||||||
|
'control_bar_height' => 20,
|
||||||
|
);
|
||||||
|
|
||||||
$codecs['capped'] = array(
|
$codecs['capped'] = array(
|
||||||
'name' => t('Capped'),
|
'name' => t('Capped'),
|
||||||
'sample_url' => 'http://capped.tv/playeralt.php?vid=some-title',
|
'sample_url' => 'http://capped.tv/playeralt.php?vid=some-title',
|
||||||
@ -196,7 +205,7 @@ function video_filter_codec_info() {
|
|||||||
'sample_url' => 'http://wistia.com/medias/9pj9n6ftlk',
|
'sample_url' => 'http://wistia.com/medias/9pj9n6ftlk',
|
||||||
'callback' => 'video_filter_wistia_html5',
|
'callback' => 'video_filter_wistia_html5',
|
||||||
'html5_callback' => 'video_filter_wistia_html5',
|
'html5_callback' => 'video_filter_wistia_html5',
|
||||||
'regexp' => '@https?://(.+\.)?(wistia\.com|wi\.st)/((m|medias|projects)|embed/(iframe|playlists))/([a-zA-Z0-9]+)@',
|
'regexp' => '@https?://(.+\.)?(wistia\.(com|net)|wi\.st)/((m|medias|projects)|embed/(iframe|playlists))/([a-zA-Z0-9]+)@',
|
||||||
);
|
);
|
||||||
|
|
||||||
$codecs['youtube'] = array(
|
$codecs['youtube'] = array(
|
||||||
@ -205,9 +214,10 @@ function video_filter_codec_info() {
|
|||||||
'callback' => 'video_filter_youtube',
|
'callback' => 'video_filter_youtube',
|
||||||
'html5_callback' => 'video_filter_youtube_html5',
|
'html5_callback' => 'video_filter_youtube_html5',
|
||||||
'regexp' => array(
|
'regexp' => array(
|
||||||
'/youtube\.com\/watch\?v=([a-z0-9\-_]+)/i',
|
'/youtube\.com\/watch\?.*?v=([a-z0-9\-_]+)/i',
|
||||||
'/youtu.be\/([a-z0-9\-_]+)/i',
|
'/youtu.be\/([a-z0-9\-_]+)/i',
|
||||||
'/youtube\.com\/v\/([a-z0-9\-_]+)/i',
|
'/youtube\.com\/v\/([a-z0-9\-_]+)/i',
|
||||||
|
'/youtube\.com\/embed\/([a-z0-9\-_]+)/i',
|
||||||
),
|
),
|
||||||
'ratio' => 16 / 9,
|
'ratio' => 16 / 9,
|
||||||
'control_bar_height' => 25,
|
'control_bar_height' => 25,
|
||||||
@ -233,7 +243,7 @@ function video_filter_codec_info() {
|
|||||||
* @see video_filter_codec_info()
|
* @see video_filter_codec_info()
|
||||||
*/
|
*/
|
||||||
function video_filter_archive($video) {
|
function video_filter_archive($video) {
|
||||||
$video['source'] = 'http://www.archive.org/embed/' . $video['codec']['matches'][1];
|
$video['source'] = '//www.archive.org/embed/' . $video['codec']['matches'][1];
|
||||||
|
|
||||||
return video_filter_iframe($video);
|
return video_filter_iframe($video);
|
||||||
}
|
}
|
||||||
@ -290,7 +300,7 @@ function video_filter_bliptv($video) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$video['source'] = 'http://blip.tv/play/' . $id;
|
$video['source'] = '//blip.tv/play/' . $id;
|
||||||
$params = array(
|
$params = array(
|
||||||
'allowscriptaccess' => 'always',
|
'allowscriptaccess' => 'always',
|
||||||
);
|
);
|
||||||
@ -298,13 +308,27 @@ function video_filter_bliptv($video) {
|
|||||||
return video_filter_flash($video, $params);
|
return video_filter_flash($video, $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback for Candid Career codec.
|
||||||
|
*
|
||||||
|
* @see video_filter_codec_info()
|
||||||
|
*/
|
||||||
|
function video_filter_candidcareer($video) {
|
||||||
|
// Their urls contain & symbols which Drupal is encoding, so decode those.
|
||||||
|
$decoded = decode_entities($video['codec']['matches'][0]);
|
||||||
|
$video['source'] = '//' . $decoded;
|
||||||
|
$video['attributes']['marginwidth'] = 0;
|
||||||
|
$video['attributes']['marginheight'] = 0;
|
||||||
|
return video_filter_iframe($video);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback for Capped codec.
|
* Callback for Capped codec.
|
||||||
*
|
*
|
||||||
* @see video_filter_codec_info()
|
* @see video_filter_codec_info()
|
||||||
*/
|
*/
|
||||||
function video_filter_capped($video) {
|
function video_filter_capped($video) {
|
||||||
$video['source'] = 'http://capped.micksam7.com/playeralt.swf?vid=' . $video['codec']['matches'][1];
|
$video['source'] = '//capped.micksam7.com/playeralt.swf?vid=' . $video['codec']['matches'][1];
|
||||||
|
|
||||||
return video_filter_flash($video);
|
return video_filter_flash($video);
|
||||||
}
|
}
|
||||||
@ -315,7 +339,7 @@ function video_filter_capped($video) {
|
|||||||
* @see video_filter_codec_info()
|
* @see video_filter_codec_info()
|
||||||
*/
|
*/
|
||||||
function video_filter_collegehumor($video) {
|
function video_filter_collegehumor($video) {
|
||||||
$video['source'] = 'http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=' . $video['codec']['matches'][1] . '&fullscreen=1';
|
$video['source'] = '//www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=' . $video['codec']['matches'][1] . '&fullscreen=1';
|
||||||
|
|
||||||
return video_filter_flash($video);
|
return video_filter_flash($video);
|
||||||
}
|
}
|
||||||
@ -326,7 +350,7 @@ function video_filter_collegehumor($video) {
|
|||||||
* @see video_filter_codec_info()
|
* @see video_filter_codec_info()
|
||||||
*/
|
*/
|
||||||
function video_filter_dailymotion($video) {
|
function video_filter_dailymotion($video) {
|
||||||
$video['source'] = 'http://www.dailymotion.com/swf/' . $video['codec']['matches'][1];
|
$video['source'] = '//www.dailymotion.com/swf/' . $video['codec']['matches'][1];
|
||||||
|
|
||||||
return video_filter_flash($video);
|
return video_filter_flash($video);
|
||||||
}
|
}
|
||||||
@ -354,7 +378,7 @@ function video_filter_flickr_slideshows($video) {
|
|||||||
* @see video_filter_codec_info()
|
* @see video_filter_codec_info()
|
||||||
*/
|
*/
|
||||||
function video_filter_flickr_video($video) {
|
function video_filter_flickr_video($video) {
|
||||||
$video['source'] = 'http://www.flickr.com/apps/video/stewart.swf?v=1.161';
|
$video['source'] = '//www.flickr.com/apps/video/stewart.swf?v=1.161';
|
||||||
|
|
||||||
$params['flashvars'] = '&photo_id=' . $video['codec']['matches'][2] . '&flickr_show_info_box=true';
|
$params['flashvars'] = '&photo_id=' . $video['codec']['matches'][2] . '&flickr_show_info_box=true';
|
||||||
|
|
||||||
@ -373,7 +397,7 @@ function video_filter_gametrailers($video) {
|
|||||||
elseif (is_numeric($video['codec']['matches'][2])) {
|
elseif (is_numeric($video['codec']['matches'][2])) {
|
||||||
$match = $video['codec']['matches'][2];
|
$match = $video['codec']['matches'][2];
|
||||||
}
|
}
|
||||||
$video['source'] = 'http://media.mtvnservices.com/embed/mgid:moses:video:gametrailers.com:' . $match;
|
$video['source'] = '//media.mtvnservices.com/embed/mgid:moses:video:gametrailers.com:' . $match;
|
||||||
|
|
||||||
return video_filter_iframe($video);
|
return video_filter_iframe($video);
|
||||||
}
|
}
|
||||||
@ -384,7 +408,7 @@ function video_filter_gametrailers($video) {
|
|||||||
* @see video_filter_codec_info()
|
* @see video_filter_codec_info()
|
||||||
*/
|
*/
|
||||||
function video_filter_gamevideos($video) {
|
function video_filter_gamevideos($video) {
|
||||||
$video['source'] = 'http://gamevideos.1up.com/swf/gamevideos12.swf?embedded=1&fullscreen=1&autoplay=0&src=http://gamevideos.1up.com/do/videoListXML%3Fid%3D' . $video['codec']['matches'][1];
|
$video['source'] = '//gamevideos.1up.com/swf/gamevideos12.swf?embedded=1&fullscreen=1&autoplay=0&src=http://gamevideos.1up.com/do/videoListXML%3Fid%3D' . $video['codec']['matches'][1];
|
||||||
|
|
||||||
return video_filter_flash($video);
|
return video_filter_flash($video);
|
||||||
}
|
}
|
||||||
@ -395,7 +419,7 @@ function video_filter_gamevideos($video) {
|
|||||||
* @see video_filter_codec_info()
|
* @see video_filter_codec_info()
|
||||||
*/
|
*/
|
||||||
function video_filter_godtube($video) {
|
function video_filter_godtube($video) {
|
||||||
$video['source'] = 'http://www.godtube.com/embed/watch/' . $video['codec']['matches'][1];
|
$video['source'] = '//www.godtube.com/embed/watch/' . $video['codec']['matches'][1];
|
||||||
|
|
||||||
return video_filter_iframe($video);
|
return video_filter_iframe($video);
|
||||||
}
|
}
|
||||||
@ -406,7 +430,7 @@ function video_filter_godtube($video) {
|
|||||||
* @see video_filter_codec_info()
|
* @see video_filter_codec_info()
|
||||||
*/
|
*/
|
||||||
function video_filter_google($video) {
|
function video_filter_google($video) {
|
||||||
$video['source'] = 'http://video.google.com/googleplayer.swf?docId=' . $video['codec']['matches'][1];
|
$video['source'] = '//video.google.com/googleplayer.swf?docId=' . $video['codec']['matches'][1];
|
||||||
|
|
||||||
return video_filter_flash($video);
|
return video_filter_flash($video);
|
||||||
}
|
}
|
||||||
@ -417,7 +441,7 @@ function video_filter_google($video) {
|
|||||||
* @see video_filter_codec_info()
|
* @see video_filter_codec_info()
|
||||||
*/
|
*/
|
||||||
function video_filter_metacafe($video) {
|
function video_filter_metacafe($video) {
|
||||||
$video['source'] = 'http://metacafe.com/fplayer/' . $video['codec']['matches'][1] . '/' . $video['codec']['matches'][2] . '.swf';
|
$video['source'] = '//metacafe.com/fplayer/' . $video['codec']['matches'][1] . '/' . $video['codec']['matches'][2] . '.swf';
|
||||||
|
|
||||||
return video_filter_flash($video);
|
return video_filter_flash($video);
|
||||||
}
|
}
|
||||||
@ -430,7 +454,7 @@ function video_filter_metacafe($video) {
|
|||||||
function video_filter_myspace($video) {
|
function video_filter_myspace($video) {
|
||||||
// The last match is the ID we need.
|
// The last match is the ID we need.
|
||||||
$last = count($video['codec']['matches']);
|
$last = count($video['codec']['matches']);
|
||||||
$video['source'] = 'http://mediaservices.myspace.com/services/media/embed.aspx/m=' . $video['codec']['matches'][$last - 1];
|
$video['source'] = '//mediaservices.myspace.com/services/media/embed.aspx/m=' . $video['codec']['matches'][$last - 1];
|
||||||
|
|
||||||
return video_filter_flash($video, $params);
|
return video_filter_flash($video, $params);
|
||||||
}
|
}
|
||||||
@ -441,7 +465,7 @@ function video_filter_myspace($video) {
|
|||||||
* @see video_filter_codec_info()
|
* @see video_filter_codec_info()
|
||||||
*/
|
*/
|
||||||
function video_filter_picasa_slideshows($video) {
|
function video_filter_picasa_slideshows($video) {
|
||||||
$video['source'] = 'http://picasaweb.google.com/s/c/bin/slideshow.swf';
|
$video['source'] = '//picasaweb.google.com/s/c/bin/slideshow.swf';
|
||||||
|
|
||||||
$user_name = $video['codec']['matches'][1];
|
$user_name = $video['codec']['matches'][1];
|
||||||
$set_id = $video['codec']['matches'][2];
|
$set_id = $video['codec']['matches'][2];
|
||||||
@ -457,7 +481,7 @@ function video_filter_picasa_slideshows($video) {
|
|||||||
* @see video_filter_codec_info()
|
* @see video_filter_codec_info()
|
||||||
*/
|
*/
|
||||||
function video_filter_slideshare($video) {
|
function video_filter_slideshare($video) {
|
||||||
$video['source'] = 'http://www.slideshare.net/slideshow/embed_code/' . $video['codec']['matches'][1];
|
$video['source'] = '//www.slideshare.net/slideshow/embed_code/' . $video['codec']['matches'][1];
|
||||||
|
|
||||||
return video_filter_iframe($video);
|
return video_filter_iframe($video);
|
||||||
}
|
}
|
||||||
@ -468,7 +492,7 @@ function video_filter_slideshare($video) {
|
|||||||
* @see video_filter_codec_info()
|
* @see video_filter_codec_info()
|
||||||
*/
|
*/
|
||||||
function video_filter_streamhoster($video) {
|
function video_filter_streamhoster($video) {
|
||||||
$video['source'] = 'http://public.streamhoster.com/Resources/Flash/JWFLVMediaPlayer/mediaplayer.swf';
|
$video['source'] = '//public.streamhoster.com/Resources/Flash/JWFLVMediaPlayer/mediaplayer.swf';
|
||||||
|
|
||||||
$params = array('allowscriptaccess' => 'always');
|
$params = array('allowscriptaccess' => 'always');
|
||||||
$protocol = $video['codec']['matches'][1];
|
$protocol = $video['codec']['matches'][1];
|
||||||
@ -496,7 +520,7 @@ function video_filter_streamhoster($video) {
|
|||||||
* @see video_filter_codec_info()
|
* @see video_filter_codec_info()
|
||||||
*/
|
*/
|
||||||
function video_filter_teachertube($video) {
|
function video_filter_teachertube($video) {
|
||||||
$video['source'] = 'http://www.teachertube.com/embed/player.swf';
|
$video['source'] = '//www.teachertube.com/embed/player.swf';
|
||||||
|
|
||||||
$params['flashvars'] = 'file=http://www.teachertube.com/embedFLV.php?pg=video_' . $video['codec']['matches'][1] . '&menu=false&frontcolor=ffffff&lightcolor=FF0000&logo=http://www.teachertube.com/www3/images/greylogo.swf&skin=http://www.teachertube.com/embed/overlay.swf&volume=80&controlbar=over&displayclick=link&viral.link=http://www.teachertube.com/viewVideo.php?video_id=' . $video['codec']['matches'][1] . '&stretching=exactfit&plugins=viral-2&viral.callout=none&viral.onpause=false';
|
$params['flashvars'] = 'file=http://www.teachertube.com/embedFLV.php?pg=video_' . $video['codec']['matches'][1] . '&menu=false&frontcolor=ffffff&lightcolor=FF0000&logo=http://www.teachertube.com/www3/images/greylogo.swf&skin=http://www.teachertube.com/embed/overlay.swf&volume=80&controlbar=over&displayclick=link&viral.link=http://www.teachertube.com/viewVideo.php?video_id=' . $video['codec']['matches'][1] . '&stretching=exactfit&plugins=viral-2&viral.callout=none&viral.onpause=false';
|
||||||
|
|
||||||
@ -509,7 +533,7 @@ function video_filter_teachertube($video) {
|
|||||||
* @see video_filter_codec_info()
|
* @see video_filter_codec_info()
|
||||||
*/
|
*/
|
||||||
function video_filter_vimeo($video) {
|
function video_filter_vimeo($video) {
|
||||||
$video['source'] = 'http://www.vimeo.com/moogaloop.swf?clip_id=' . $video['codec']['matches'][1] . '&server=www.vimeo.com&fullscreen=1&show_title=1&show_byline=1&show_portrait=0&color=&autoplay=' . $video['autoplay'];
|
$video['source'] = '//www.vimeo.com/moogaloop.swf?clip_id=' . $video['codec']['matches'][1] . '&server=www.vimeo.com&fullscreen=1&show_title=1&show_byline=1&show_portrait=0&color=&autoplay=' . $video['autoplay'];
|
||||||
|
|
||||||
return video_filter_flash($video);
|
return video_filter_flash($video);
|
||||||
}
|
}
|
||||||
@ -520,7 +544,7 @@ function video_filter_vimeo($video) {
|
|||||||
* @see video_filter_codec_info()
|
* @see video_filter_codec_info()
|
||||||
*/
|
*/
|
||||||
function video_filter_vimeo_html5($video) {
|
function video_filter_vimeo_html5($video) {
|
||||||
$video['source'] = 'http://player.vimeo.com/video/' . $video['codec']['matches'][1] . ($video['autoplay'] ? '?autoplay=1' : '');
|
$video['source'] = '//player.vimeo.com/video/' . $video['codec']['matches'][1] . ($video['autoplay'] ? '?autoplay=1' : '');
|
||||||
|
|
||||||
return video_filter_iframe($video);
|
return video_filter_iframe($video);
|
||||||
}
|
}
|
||||||
@ -537,7 +561,7 @@ function video_filter_youtube($video) {
|
|||||||
'fs' => 'fs=1',
|
'fs' => 'fs=1',
|
||||||
);
|
);
|
||||||
|
|
||||||
$video['source'] = 'http://www.youtube.com/v/' . $video['codec']['matches'][1] . '?' . implode('&', $attributes);
|
$video['source'] = '//www.youtube.com/v/' . $video['codec']['matches'][1] . '?' . implode('&', $attributes);
|
||||||
|
|
||||||
$params['wmode'] = 'opaque';
|
$params['wmode'] = 'opaque';
|
||||||
|
|
||||||
@ -551,11 +575,12 @@ function video_filter_youtube($video) {
|
|||||||
*/
|
*/
|
||||||
function video_filter_youtube_html5($video) {
|
function video_filter_youtube_html5($video) {
|
||||||
$attributes = array(
|
$attributes = array(
|
||||||
|
'html5' => 'html5=1',
|
||||||
'rel' => $video['related'] ? 'rel=1' : 'rel=0',
|
'rel' => $video['related'] ? 'rel=1' : 'rel=0',
|
||||||
'autoplay' => $video['autoplay'] ? 'autoplay=1' : 'autoplay=0',
|
'autoplay' => $video['autoplay'] ? 'autoplay=1' : 'autoplay=0',
|
||||||
'wmode' => 'wmode=opaque',
|
'wmode' => 'wmode=opaque',
|
||||||
);
|
);
|
||||||
$video['source'] = 'http://www.youtube.com/embed/' . $video['codec']['matches'][1] . '?' . implode('&', $attributes);
|
$video['source'] = '//www.youtube.com/embed/' . $video['codec']['matches'][1] . '?' . implode('&', $attributes);
|
||||||
|
|
||||||
return video_filter_iframe($video);
|
return video_filter_iframe($video);
|
||||||
}
|
}
|
||||||
@ -571,7 +596,7 @@ function video_filter_youtube_playlist_html5($video) {
|
|||||||
'autoplay' => $video['autoplay'] ? 'autoplay=1' : 'autoplay=0',
|
'autoplay' => $video['autoplay'] ? 'autoplay=1' : 'autoplay=0',
|
||||||
'wmode' => 'wmode=opaque',
|
'wmode' => 'wmode=opaque',
|
||||||
);
|
);
|
||||||
$video['source'] = 'http://www.youtube.com/embed/videoseries?list=' . $video['codec']['matches'][1] . '&' . implode('&', $attributes);
|
$video['source'] = '//www.youtube.com/embed/videoseries?list=' . $video['codec']['matches'][1] . '&' . implode('&', $attributes);
|
||||||
|
|
||||||
return video_filter_iframe($video);
|
return video_filter_iframe($video);
|
||||||
}
|
}
|
||||||
@ -584,9 +609,9 @@ function video_filter_youtube_playlist_html5($video) {
|
|||||||
* @see video_filter_codec_info()
|
* @see video_filter_codec_info()
|
||||||
*/
|
*/
|
||||||
function video_filter_wistia_html5($video) {
|
function video_filter_wistia_html5($video) {
|
||||||
$video_code = $video['codec']['matches'][6];
|
$video_code = $video['codec']['matches'][7];
|
||||||
$matches = $video['codec']['matches'];
|
$matches = $video['codec']['matches'];
|
||||||
$embed_type = ($matches[3] == 'projects' || $matches[5] == 'playlists') ? 'playlists' : 'iframe';
|
$embed_type = ($matches[4] == 'projects' || $matches[6] == 'playlists') ? 'playlists' : 'iframe';
|
||||||
|
|
||||||
// Get embed code via oEmbed.
|
// Get embed code via oEmbed.
|
||||||
$endpoint = 'http://fast.wistia.com/oembed';
|
$endpoint = 'http://fast.wistia.com/oembed';
|
||||||
@ -599,12 +624,12 @@ function video_filter_wistia_html5($video) {
|
|||||||
$html = $data['html'];
|
$html = $data['html'];
|
||||||
|
|
||||||
// See if the video source is already an iframe src.
|
// See if the video source is already an iframe src.
|
||||||
$pattern = '@https?://fast.wistia.com/embed/(iframe|playlists)/[a-zA-Z0-9]+\?+.+@';
|
$pattern = '@https?://fast.wistia.(com|net)/embed/(iframe|playlists)/[a-zA-Z0-9]+\?+.+@';
|
||||||
$matches = array();
|
$matches = array();
|
||||||
if (preg_match($pattern, $video['source'], $matches)) {
|
if (preg_match($pattern, $video['source'], $matches)) {
|
||||||
// Replace the oEmbed iframe src with that provided in the token, in order
|
// Replace the oEmbed iframe src with that provided in the token, in order
|
||||||
// to support embed builder URLs.
|
// to support embed builder URLs.
|
||||||
$pattern = '@https?://fast.wistia.com/embed/(iframe|playlists)/[a-zA-Z0-9]+\?[^"]+@';
|
$pattern = '@https?://fast.wistia.(com|net)/embed/(iframe|playlists)/[a-zA-Z0-9]+\?[^"]+@';
|
||||||
$replacement = $matches[0];
|
$replacement = $matches[0];
|
||||||
$html = preg_replace($pattern, $replacement, $html);
|
$html = preg_replace($pattern, $replacement, $html);
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,9 @@ package = Input filters
|
|||||||
|
|
||||||
stylesheets[all][] = video_filter.css
|
stylesheets[all][] = video_filter.css
|
||||||
|
|
||||||
; Information added by drupal.org packaging script on 2012-11-14
|
; Information added by Drupal.org packaging script on 2015-09-24
|
||||||
version = "7.x-3.1"
|
version = "7.x-3.1+17-dev"
|
||||||
core = "7.x"
|
core = "7.x"
|
||||||
project = "video_filter"
|
project = "video_filter"
|
||||||
datestamp = "1352915891"
|
datestamp = "1443119944"
|
||||||
|
|
||||||
|
@ -284,9 +284,14 @@ function theme_video_filter_flash($variables) {
|
|||||||
|
|
||||||
$classes = video_filter_get_classes($video);
|
$classes = video_filter_get_classes($video);
|
||||||
|
|
||||||
$output .= '<object class="' . implode(' ', $classes) . '" type="application/x-shockwave-flash" ';
|
$attributes = '';
|
||||||
|
if (!empty($video['attributes'])) {
|
||||||
|
$attributes = drupal_attributes($video['attributes']);
|
||||||
|
}
|
||||||
|
|
||||||
$output .= 'width="' . $video['width'] . '" height="' . $video['height'] . '" data="' . $video['source'] . '">' . "\n";
|
$output .= '<div class="video-filter"><object class="' . implode(' ', $classes) . '" type="application/x-shockwave-flash" ';
|
||||||
|
|
||||||
|
$output .= 'width="' . $video['width'] . '" height="' . $video['height'] . '" data="' . $video['source'] . '" ' . $attributes . '>' . "\n";
|
||||||
|
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'movie' => $video['source'],
|
'movie' => $video['source'],
|
||||||
@ -300,7 +305,7 @@ function theme_video_filter_flash($variables) {
|
|||||||
$output .= ' <param name="' . $name . '" value="' . $value . '" />' . "\n";
|
$output .= ' <param name="' . $name . '" value="' . $value . '" />' . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$output .= '</object>' . "\n";
|
$output .= '</object></div>' . "\n";
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
@ -312,10 +317,13 @@ function theme_video_filter_flash($variables) {
|
|||||||
*/
|
*/
|
||||||
function theme_video_filter_iframe($variables) {
|
function theme_video_filter_iframe($variables) {
|
||||||
$video = $variables['video'];
|
$video = $variables['video'];
|
||||||
|
|
||||||
$classes = video_filter_get_classes($video);
|
$classes = video_filter_get_classes($video);
|
||||||
|
$attributes = '';
|
||||||
|
if (!empty($video['attributes'])) {
|
||||||
|
$attributes = drupal_attributes($video['attributes']);
|
||||||
|
}
|
||||||
|
|
||||||
$output = '<iframe src="' . $video['source'] . '" width="' . $video['width'] . '" height="' . $video['height'] . '" class="' . implode(' ', $classes) . '" frameborder="0"></iframe>';
|
$output = '<div class="video-filter"><iframe src="' . $video['source'] . '" width="' . $video['width'] . '" height="' . $video['height'] . '" class="' . implode(' ', $classes) . '" frameborder="0"' . $attributes . '></iframe></div>';
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
@ -378,6 +386,15 @@ function video_filter_menu() {
|
|||||||
'theme callback' => '_video_filter_dashboard_theme',
|
'theme callback' => '_video_filter_dashboard_theme',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$items['video_filter/instructions'] = array(
|
||||||
|
'title' => 'Videofilter instructions',
|
||||||
|
'description' => 'instructions',
|
||||||
|
'page callback' => 'video_filter_instructions_page',
|
||||||
|
'access arguments' => array('access content'),
|
||||||
|
'type' => MENU_CALLBACK,
|
||||||
|
'theme callback' => '_video_filter_dashboard_theme',
|
||||||
|
);
|
||||||
|
|
||||||
return $items;
|
return $items;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -432,7 +449,19 @@ function video_filter_dashboard_page($editor) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
print theme('video_filter_dashboard', array('form' => render(drupal_get_form('_video_filter_form'))));
|
$form = drupal_get_form('_video_filter_form');
|
||||||
|
print theme('video_filter_dashboard', array('form' => render($form)));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the instructions page.
|
||||||
|
*/
|
||||||
|
function video_filter_instructions_page() {
|
||||||
|
module_invoke('admin_menu', 'suppress');
|
||||||
|
|
||||||
|
$form = drupal_get_form('_video_filter_instructions_form');
|
||||||
|
print theme('video_filter_dashboard', array('form' => render($form)));
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -492,6 +521,25 @@ function _video_filter_form() {
|
|||||||
'#weight' => 5,
|
'#weight' => 5,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$form += _video_filter_instructions_form();
|
||||||
|
|
||||||
|
$form['cancel'] = array(
|
||||||
|
'#type' => 'button',
|
||||||
|
'#value' => t('Cancel'),
|
||||||
|
'#weight' => 98,
|
||||||
|
);
|
||||||
|
|
||||||
|
$form['insert'] = array(
|
||||||
|
'#type' => 'button',
|
||||||
|
'#value' => t('Insert'),
|
||||||
|
'#weight' => 99,
|
||||||
|
);
|
||||||
|
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _video_filter_instructions_form() {
|
||||||
|
|
||||||
$form['instructions'] = array(
|
$form['instructions'] = array(
|
||||||
'#type' => 'fieldset',
|
'#type' => 'fieldset',
|
||||||
'#title' => t('Instructions'),
|
'#title' => t('Instructions'),
|
||||||
@ -509,21 +557,28 @@ function _video_filter_form() {
|
|||||||
'#markup' => $text,
|
'#markup' => $text,
|
||||||
);
|
);
|
||||||
|
|
||||||
$form['cancel'] = array(
|
|
||||||
'#type' => 'button',
|
|
||||||
'#value' => t('Cancel'),
|
|
||||||
'#weight' => 98,
|
|
||||||
);
|
|
||||||
|
|
||||||
$form['insert'] = array(
|
|
||||||
'#type' => 'button',
|
|
||||||
'#value' => t('Insert'),
|
|
||||||
'#weight' => 99,
|
|
||||||
);
|
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements hook_ckeditor_plugin().
|
||||||
|
*/
|
||||||
|
function video_filter_ckeditor_plugin() {
|
||||||
|
$plugins = array();
|
||||||
|
$plugins['video_filter'] = array(
|
||||||
|
'name' => 'video_filter',
|
||||||
|
'desc' => t('Plugin to directly embed videos with the video filter module.'),
|
||||||
|
'path' => drupal_get_path('module', 'video_filter') . '/editors/ckeditor/',
|
||||||
|
'buttons' => array(
|
||||||
|
'video_filter' => array(
|
||||||
|
'label' => t('Video filter'),
|
||||||
|
'icon' => 'video_filter.png',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return $plugins;
|
||||||
|
}
|
||||||
|
|
||||||
function video_filter_wysiwyg_plugin($editor, $version) {
|
function video_filter_wysiwyg_plugin($editor, $version) {
|
||||||
_video_filter_add_settings('wysiwyg_' . $editor);
|
_video_filter_add_settings('wysiwyg_' . $editor);
|
||||||
|
|
||||||
@ -582,7 +637,10 @@ function _video_filter_add_settings($editor) {
|
|||||||
|
|
||||||
// Add popup url.
|
// Add popup url.
|
||||||
$settings = array(
|
$settings = array(
|
||||||
'video_filter' => array('url' => array($editor => url('video_filter/dashboard/' . $editor))),
|
'video_filter' => array(
|
||||||
|
'url' => array($editor => url('video_filter/dashboard/' . $editor)),
|
||||||
|
'instructions_url' => url('video_filter/instructions'),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
drupal_add_js($settings, 'setting');
|
drupal_add_js($settings, 'setting');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user