Prechádzať zdrojové kódy

updated video filter module to handle https on embeded videos

Bachir Soussi Chiadmi 8 rokov pred
rodič
commit
b4acd7d8bb

+ 3 - 1
sites/all/modules/contrib/editor/video_filter/README.txt

@@ -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]

+ 8 - 28
sites/all/modules/contrib/editor/video_filter/editors/ckeditor/README.txt

@@ -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)
-
-   2. Scroll down to the end of the file, right before "};" insert:
-
-      // 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:
+  1. Go to Configuration -> CKEditor (admin/config/content/ckeditor)
+     Click "Edit" on the profile you what to use with the video filter.
 
-          ['Bold','Italic','video_filter']
+  2. Expand "Editor appearance" and go to "Toolbar". Drag the new video_filter
+     button from the "All Buttons" toolbar to the "Used Buttons" toolbar.
 
-          (remember the single quotes).
+  3. Go to "Plugins" on the same page. Enable the video filter plugin.

+ 114 - 10
sites/all/modules/contrib/editor/video_filter/editors/ckeditor/plugin.js

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

+ 3 - 0
sites/all/modules/contrib/editor/video_filter/editors/fckeditor/video_filter/video_filter_dialog.js

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

+ 3 - 0
sites/all/modules/contrib/editor/video_filter/editors/tinymce/video_filter.js

@@ -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);

+ 70 - 0
sites/all/modules/contrib/editor/video_filter/video_filter.api.php

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

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 42 - 18
sites/all/modules/contrib/editor/video_filter/video_filter.codecs.inc


+ 3 - 3
sites/all/modules/contrib/editor/video_filter/video_filter.info

@@ -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"
 

+ 76 - 18
sites/all/modules/contrib/editor/video_filter/video_filter.module

@@ -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 .= '<div class="video-filter"><object class="' . implode(' ', $classes) . '" type="application/x-shockwave-flash" ';
 
-  $output .= 'width="' . $video['width'] . '" height="' . $video['height'] . '" data="' . $video['source'] . '">' . "\n";
+  $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,19 +557,26 @@ function _video_filter_form() {
     '#markup' => $text,
   );
 
-  $form['cancel'] = array(
-    '#type' => 'button',
-    '#value' => t('Cancel'),
-    '#weight' => 98,
-  );
+  return $form;
+}
 
-  $form['insert'] = array(
-    '#type' => 'button',
-    '#value' => t('Insert'),
-    '#weight' => 99,
+/**
+ * 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 $form;
+  return $plugins;
 }
 
 function video_filter_wysiwyg_plugin($editor, $version) {
@@ -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');
   }

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov