From 91fadb8a97e01afe1208a1b96cfe5deb27829008 Mon Sep 17 00:00:00 2001
From: Gershon Bialer <gershon.bialer@gmail.com>
Date: Tue, 15 Mar 2011 01:55:03 -0500
Subject: [PATCH] Issue #1092924 by gersh: Upgraded to work with Drupal 7

---
 README.txt           |    5 ++++-
 behavior.swfembed.js |   18 +++++++++++-------
 swfembed.info        |    9 ++++++---
 swfembed.module      |   10 +++++-----
 4 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/README.txt b/README.txt
index aba2d3d..fada1da 100644
--- a/README.txt
+++ b/README.txt
@@ -27,6 +27,9 @@ the workings of this module.
 
 AUTHORS AND CREDIT
 
+Gershon Bialer
+http://www.raydash.com
+
 Larry Garfield (PHP)
 http://www.palantir.net/
 
@@ -34,4 +37,4 @@ Matt Butcher (JavaScript and jQuery Plugin)
 http://www.palantir.net/
 
 This module was initially developed by Palantir.net and released to 
-the Drupal community under the GNU General Public License.
\ No newline at end of file
+the Drupal community under the GNU General Public License.
diff --git a/behavior.swfembed.js b/behavior.swfembed.js
index 58c6329..0ab5407 100755
--- a/behavior.swfembed.js
+++ b/behavior.swfembed.js
@@ -2,13 +2,17 @@
  * Behaviors for adding SWF object files into a document.
  * @file
  */
- 
+
+(function($) { 
 /**
  * Check the settings array and embed SWF objects.
  */
-Drupal.behaviors.SWFEmbed = function () {
-  jQuery.each(Drupal.settings.swfembed.swf, function (name, value) {
-    //console.log('inserting ' + name);
-    $('#' + name + ':not(object)').swfEmbed(value.url, value);
-  });
-}
\ No newline at end of file
+  Drupal.behaviors.SWFEmbed = {
+    attach: function(context,settings) {
+       jQuery.each(settings.swfembed.swf, function (name, value) {
+          //console.log('inserting ' + name);
+          $('#' + name + ':not(object)').swfEmbed(value.url, value);
+      });
+    }
+  }
+})(jQuery);
diff --git a/swfembed.info b/swfembed.info
index 8f2713c..0dfcde4 100755
--- a/swfembed.info
+++ b/swfembed.info
@@ -1,5 +1,8 @@
-
 name = SWF Embed
 description = Add SWF (ShockWave Flash) files to your site.
-core = 6.x
-php = 5.x
+core = 7.x
+
+version = "7.0"
+core = "7.x"
+project = "swfembed"
+
diff --git a/swfembed.module b/swfembed.module
index 5a26323..55583cc 100755
--- a/swfembed.module
+++ b/swfembed.module
@@ -36,8 +36,7 @@ function swfembed_add_js() {
 function swfembed_theme($existing, $type, $theme, $path) {
   return array(
     'swfembed_embed' => array(
-      //'function' => 'theme_swfembed_embed',
-      'arguments' => array('swf_object' => NULL),
+      'variables' => array('swf_object' => NULL),
     ),
   );
 }
@@ -48,7 +47,8 @@ function swfembed_theme($existing, $type, $theme, $path) {
  * @param $swf_object
  *   An SWFObject object.
  */
-function theme_swfembed_embed(SWFObject $swf_object) {
+function theme_swfembed_embed($variables) {
+  $swf_object = $variables['swf'];
   static $id_counter = 1;
 
   swfembed_add_js();
@@ -58,7 +58,7 @@ function theme_swfembed_embed(SWFObject $swf_object) {
   $id = 'swf_' . $id_counter++;
 
   $settings['swfembed']['swf'][$id] = $swf_object->toArray();
-  drupal_add_js($settings, 'setting');
+  drupal_add_js($settings, array('type'=>'setting'));
 
   return '<div id="' . $id . '">' . $swf_object->getNoFlash() . '</div>';
 }
@@ -462,4 +462,4 @@ class SWFObject {
     return theme('swfembed_embed', $this);
   }
 
-}
\ No newline at end of file
+}
-- 
1.7.3.4

