updated video filter module to handle https on embeded videos

This commit is contained in:
Bachir Soussi Chiadmi 2015-12-20 10:56:50 +01:00
parent 3af02617b4
commit b4acd7d8bb
9 changed files with 333 additions and 88 deletions

View File

@ -1,4 +1,3 @@
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
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
enable the Video Filter button.
To enable CKEditor (standalone) support, please see plugin instructions in:
editors/ckeditor/README.txt
========= Usage =========
Single video: [video:url]

View File

@ -1,35 +1,15 @@
##############################################
## ONLY if you use ckeditor WITHOUT wysiwyg ##
##############################################
############################################################
## ONLY if with the CKEditor module, *NOT* WYSIWYG module ##
############################################################
Installation:
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.
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).
3. Go to "Plugins" on the same page. Enable the video filter plugin.

View File

@ -7,25 +7,126 @@
requires : [],
init: function(editor) {
// Add Button
editor.ui.addButton('video_filter', {
label: 'Video filter',
command: 'video_filter',
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.
editor._.video_filterFnNum = CKEDITOR.tools.addFunction(insert, editor);
if(typeof window.showModalDialog !== 'undefined') {
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) {
@ -49,6 +150,9 @@
if (params.autoplay) {
str += ' autoplay:' + params.autoplay;
}
else {
str += ' autoplay:' + '0';
}
str += ']';
for (var i = 0, len = ranges.length; i < len; i++) {

View File

@ -43,6 +43,9 @@ function Ok() {
if ($('#edit-autoplay').is(':checked')) {
str += ' autoplay:' + $('#edit-autoplay').val();
}
else {
str += ' autoplay:' + '0';
}
str += ']';
oEditor.FCKUndo.SaveUndoStep();

View File

@ -34,6 +34,9 @@ video_filter_dialog = {
if ($('#edit-autoplay').is(':checked')) {
str += ' autoplay:' + $('#edit-autoplay').val();
}
else {
str += ' autoplay:' + '0';
}
str += ']';
ed.execCommand('mceInsertContent', false, str);

View File

@ -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) {}

View File

@ -34,6 +34,15 @@ function video_filter_codec_info() {
'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(
'name' => t('Capped'),
'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',
'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(
@ -205,9 +214,10 @@ function video_filter_codec_info() {
'callback' => 'video_filter_youtube',
'html5_callback' => 'video_filter_youtube_html5',
'regexp' => array(
'/youtube\.com\/watch\?v=([a-z0-9\-_]+)/i',
'/youtube\.com\/watch\?.*?v=([a-z0-9\-_]+)/i',
'/youtu.be\/([a-z0-9\-_]+)/i',
'/youtube\.com\/v\/([a-z0-9\-_]+)/i',
'/youtube\.com\/embed\/([a-z0-9\-_]+)/i',
),
'ratio' => 16 / 9,
'control_bar_height' => 25,
@ -233,7 +243,7 @@ function video_filter_codec_info() {
* @see video_filter_codec_info()
*/
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);
}
@ -290,7 +300,7 @@ function video_filter_bliptv($video) {
}
}
$video['source'] = 'http://blip.tv/play/' . $id;
$video['source'] = '//blip.tv/play/' . $id;
$params = array(
'allowscriptaccess' => 'always',
);
@ -298,13 +308,27 @@ function video_filter_bliptv($video) {
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.
*
* @see video_filter_codec_info()
*/
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);
}
@ -315,7 +339,7 @@ function video_filter_capped($video) {
* @see video_filter_codec_info()
*/
function video_filter_collegehumor($video) {
$video['source'] = 'http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=' . $video['codec']['matches'][1] . '&amp;fullscreen=1';
$video['source'] = '//www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=' . $video['codec']['matches'][1] . '&amp;fullscreen=1';
return video_filter_flash($video);
}
@ -326,7 +350,7 @@ function video_filter_collegehumor($video) {
* @see video_filter_codec_info()
*/
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);
}
@ -354,7 +378,7 @@ function video_filter_flickr_slideshows($video) {
* @see video_filter_codec_info()
*/
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'] = '&amp;photo_id=' . $video['codec']['matches'][2] . '&amp;flickr_show_info_box=true';
@ -373,7 +397,7 @@ function video_filter_gametrailers($video) {
elseif (is_numeric($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);
}
@ -384,7 +408,7 @@ function video_filter_gametrailers($video) {
* @see video_filter_codec_info()
*/
function video_filter_gamevideos($video) {
$video['source'] = 'http://gamevideos.1up.com/swf/gamevideos12.swf?embedded=1&amp;fullscreen=1&amp;autoplay=0&amp;src=http://gamevideos.1up.com/do/videoListXML%3Fid%3D' . $video['codec']['matches'][1];
$video['source'] = '//gamevideos.1up.com/swf/gamevideos12.swf?embedded=1&amp;fullscreen=1&amp;autoplay=0&amp;src=http://gamevideos.1up.com/do/videoListXML%3Fid%3D' . $video['codec']['matches'][1];
return video_filter_flash($video);
}
@ -395,7 +419,7 @@ function video_filter_gamevideos($video) {
* @see video_filter_codec_info()
*/
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);
}
@ -406,7 +430,7 @@ function video_filter_godtube($video) {
* @see video_filter_codec_info()
*/
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);
}
@ -417,7 +441,7 @@ function video_filter_google($video) {
* @see video_filter_codec_info()
*/
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);
}
@ -430,7 +454,7 @@ function video_filter_metacafe($video) {
function video_filter_myspace($video) {
// The last match is the ID we need.
$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);
}
@ -441,7 +465,7 @@ function video_filter_myspace($video) {
* @see video_filter_codec_info()
*/
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];
$set_id = $video['codec']['matches'][2];
@ -457,7 +481,7 @@ function video_filter_picasa_slideshows($video) {
* @see video_filter_codec_info()
*/
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);
}
@ -468,7 +492,7 @@ function video_filter_slideshare($video) {
* @see video_filter_codec_info()
*/
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');
$protocol = $video['codec']['matches'][1];
@ -496,7 +520,7 @@ function video_filter_streamhoster($video) {
* @see video_filter_codec_info()
*/
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] . '&amp;menu=false&amp;frontcolor=ffffff&amp;lightcolor=FF0000&amp;logo=http://www.teachertube.com/www3/images/greylogo.swf&amp;skin=http://www.teachertube.com/embed/overlay.swf&amp;volume=80&amp;controlbar=over&amp;displayclick=link&amp;viral.link=http://www.teachertube.com/viewVideo.php?video_id=' . $video['codec']['matches'][1] . '&amp;stretching=exactfit&amp;plugins=viral-2&amp;viral.callout=none&amp;viral.onpause=false';
@ -509,7 +533,7 @@ function video_filter_teachertube($video) {
* @see video_filter_codec_info()
*/
function video_filter_vimeo($video) {
$video['source'] = 'http://www.vimeo.com/moogaloop.swf?clip_id=' . $video['codec']['matches'][1] . '&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;autoplay=' . $video['autoplay'];
$video['source'] = '//www.vimeo.com/moogaloop.swf?clip_id=' . $video['codec']['matches'][1] . '&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;autoplay=' . $video['autoplay'];
return video_filter_flash($video);
}
@ -520,7 +544,7 @@ function video_filter_vimeo($video) {
* @see video_filter_codec_info()
*/
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);
}
@ -537,7 +561,7 @@ function video_filter_youtube($video) {
'fs' => 'fs=1',
);
$video['source'] = 'http://www.youtube.com/v/' . $video['codec']['matches'][1] . '?' . implode('&amp;', $attributes);
$video['source'] = '//www.youtube.com/v/' . $video['codec']['matches'][1] . '?' . implode('&amp;', $attributes);
$params['wmode'] = 'opaque';
@ -551,11 +575,12 @@ function video_filter_youtube($video) {
*/
function video_filter_youtube_html5($video) {
$attributes = array(
'html5' => 'html5=1',
'rel' => $video['related'] ? 'rel=1' : 'rel=0',
'autoplay' => $video['autoplay'] ? 'autoplay=1' : 'autoplay=0',
'wmode' => 'wmode=opaque',
);
$video['source'] = 'http://www.youtube.com/embed/' . $video['codec']['matches'][1] . '?' . implode('&amp;', $attributes);
$video['source'] = '//www.youtube.com/embed/' . $video['codec']['matches'][1] . '?' . implode('&amp;', $attributes);
return video_filter_iframe($video);
}
@ -571,7 +596,7 @@ function video_filter_youtube_playlist_html5($video) {
'autoplay' => $video['autoplay'] ? 'autoplay=1' : 'autoplay=0',
'wmode' => 'wmode=opaque',
);
$video['source'] = 'http://www.youtube.com/embed/videoseries?list=' . $video['codec']['matches'][1] . '&amp;' . implode('&amp;', $attributes);
$video['source'] = '//www.youtube.com/embed/videoseries?list=' . $video['codec']['matches'][1] . '&amp;' . implode('&amp;', $attributes);
return video_filter_iframe($video);
}
@ -584,9 +609,9 @@ function video_filter_youtube_playlist_html5($video) {
* @see video_filter_codec_info()
*/
function video_filter_wistia_html5($video) {
$video_code = $video['codec']['matches'][6];
$video_code = $video['codec']['matches'][7];
$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.
$endpoint = 'http://fast.wistia.com/oembed';
@ -599,12 +624,12 @@ function video_filter_wistia_html5($video) {
$html = $data['html'];
// 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();
if (preg_match($pattern, $video['source'], $matches)) {
// Replace the oEmbed iframe src with that provided in the token, in order
// 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];
$html = preg_replace($pattern, $replacement, $html);
}

View File

@ -5,9 +5,9 @@ package = Input filters
stylesheets[all][] = video_filter.css
; Information added by drupal.org packaging script on 2012-11-14
version = "7.x-3.1"
; Information added by Drupal.org packaging script on 2015-09-24
version = "7.x-3.1+17-dev"
core = "7.x"
project = "video_filter"
datestamp = "1352915891"
datestamp = "1443119944"

View File

@ -284,9 +284,14 @@ function theme_video_filter_flash($variables) {
$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(
'movie' => $video['source'],
@ -300,7 +305,7 @@ function theme_video_filter_flash($variables) {
$output .= ' <param name="' . $name . '" value="' . $value . '" />' . "\n";
}
$output .= '</object>' . "\n";
$output .= '</object></div>' . "\n";
return $output;
}
@ -312,10 +317,13 @@ function theme_video_filter_flash($variables) {
*/
function theme_video_filter_iframe($variables) {
$video = $variables['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;
}
@ -378,6 +386,15 @@ function video_filter_menu() {
'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;
}
@ -432,7 +449,19 @@ function video_filter_dashboard_page($editor) {
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();
}
@ -492,6 +521,25 @@ function _video_filter_form() {
'#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(
'#type' => 'fieldset',
'#title' => t('Instructions'),
@ -509,21 +557,28 @@ function _video_filter_form() {
'#markup' => $text,
);
$form['cancel'] = array(
'#type' => 'button',
'#value' => t('Cancel'),
'#weight' => 98,
);
$form['insert'] = array(
'#type' => 'button',
'#value' => t('Insert'),
'#weight' => 99,
);
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) {
_video_filter_add_settings('wysiwyg_' . $editor);
@ -582,7 +637,10 @@ function _video_filter_add_settings($editor) {
// Add popup url.
$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');
}