? d7.patch
Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/typekit/README.txt,v
retrieving revision 1.1
diff -u -p -r1.1 README.txt
--- README.txt	1 Oct 2009 22:36:32 -0000	1.1
+++ README.txt	1 Apr 2010 00:17:29 -0000
@@ -4,8 +4,8 @@ This simple module makes it easy to incl
 Installation
 ==================
 * Regular module installation process.
-* Go to admin/settings/typekit to put in your "key"
-  and determine how you want Typekit to showup.
+* Go to admin/config/user-interface/typekit to put in your "key"
+  and determine how you want Typekit to show up.
 
 
 
Index: typekit.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/typekit/typekit.info,v
retrieving revision 1.2
diff -u -p -r1.2 typekit.info
--- typekit.info	1 Oct 2009 22:36:32 -0000	1.2
+++ typekit.info	1 Apr 2010 00:17:29 -0000
@@ -1,4 +1,8 @@
 ; $Id: typekit.info,v 1.2 2009/10/01 22:36:32 zzolo Exp $
 name = "Typekit"
 description = "Makes it easy to include Typekit in your site."
-core = 6.x
+core = 7.x
+
+files[] = typekit.install
+files[] = typekit.module
+files[] = includes/typekit.admin.inc
Index: typekit.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/typekit/typekit.install,v
retrieving revision 1.1
diff -u -p -r1.1 typekit.install
--- typekit.install	1 Oct 2009 22:16:50 -0000	1.1
+++ typekit.install	1 Apr 2010 00:17:29 -0000
@@ -3,27 +3,26 @@
 
 /**
  * @file
- * This file holds the functions for the installing
- * and enabling of the typekit module.
+ * Install, update and uninstall functions for the typekit module.
  *
  * @ingroup typekit
  */
 
 /**
- * Implementation of hook_install().
+ * Implements hook_install().
  */
 function typekit_install() {
   // Do install stuff
 }
 
 /**
- * Implementation of hook_uninstall().
+ * Implements hook_uninstall().
  */
 function typekit_uninstall() {
-  // Get module variables
-  $results = db_query("SELECT v.name FROM {variable} AS v WHERE v.name LIKE '%s%%'", 'typekit_');
-  // Remove variables
-  while ($row = db_fetch_array($results)) {
-    variable_del($row['name']);
+  // Get module variables.
+  $variables = db_query("SELECT name FROM variable WHERE name LIKE :pattern", array(":pattern" => db_like('typekit_') . '%'))->fetchCol();
+  // Remove variables.
+  foreach ($variables as $variable) {
+    variable_del($variable);
   }
 }
Index: typekit.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/typekit/typekit.module,v
retrieving revision 1.3
diff -u -p -r1.3 typekit.module
--- typekit.module	12 Feb 2010 17:05:46 -0000	1.3
+++ typekit.module	1 Apr 2010 00:17:29 -0000
@@ -7,46 +7,48 @@
  */
 
 /**
- * Implementation of hook_help().
+ * Implements hook_help().
  */
 function typekit_help($section) {
   switch ($section) {
     // Help page for Typekit
     case 'admin/help#typekit':
-      $output = '<p>'. t('Easy way to include Typekit in your site.') .'</p>';
+      $output = '<p>' . t('Easy way to include Typekit in your site.') . '</p>';
       return $output;
 
   }
 }
 
 /**
- * Implementation of hook_perm().
+ * Implements hook_permission().
  */
-function typekit_perm() {
-  return array('administer typekit');
+function typekit_permission() {
+  return array('administer typekit' => array(
+      'title' => t('Administer typekit'),
+    ));
 }
 
 /**
- * Implementation of hook_menu().
+ * Implements hook_menu().
  */
 function typekit_menu() {
   $items = array();
 
-  $items['admin/settings/typekit'] = array(
+  $items['admin/config/user-interface/typekit'] = array(
     'title' => 'Typekit',
     'description' => 'Site settings for Typekit.',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('typekit_admin_settings'),
     'access arguments' => array('administer typekit'),
     'file' => 'includes/typekit.admin.inc',
-    'type' => MENU_NORMAL_ITEM
+    'type' => MENU_NORMAL_ITEM,
   );
 
   return $items;
 }
 
 /**
- * Implementation of hook_init().
+ * Implements hook_init().
  */
 function typekit_init() {
   $enabled = variable_get('typekit_enable', TRUE);
@@ -68,8 +70,11 @@ function typekit_init() {
       // is displayed only on those pages listed in $visibility_pages.
       $page_match = !($visibility xor $page_match);
     }
+    elseif (module_exists('php')) {
+      $page_match = php_eval($visibility_pages);
+    }
     else {
-      $page_match = drupal_eval($visibility_pages);
+      $page_match = FALSE;
     }
   }
   else {
@@ -78,13 +83,8 @@ function typekit_init() {
 
   // Check for key
   if (!empty($key) && $page_match && $enabled) {
-    // Include the TypeKit code
-    // Note that drupal_add_js does not allow for external scripts so we work around
-    $script = '
-      var typekitHost = (("https:" == document.location.protocol) ? "https://" : "http://");
-      document.write(unescape("%3Cscript src=\'" + typekitHost + "use.typekit.com/' . check_plain($key) . '.js\' type=\'text/javascript\'%3E%3C/script%3E"));
-      ';
-    drupal_add_js($script, 'inline', 'header');
-    drupal_add_js('try{Typekit.load();}catch(e){}', 'inline', 'header');
+    // Include the TypeKit code.
+    drupal_add_js('http://use.typekit.com/' . check_plain($key) . '.js', 'external');
+    drupal_add_js('try{Typekit.load();}catch(e){};', 'inline');
   }
 }
Index: includes/typekit.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/typekit/includes/typekit.admin.inc,v
retrieving revision 1.3
diff -u -p -r1.3 typekit.admin.inc
--- includes/typekit.admin.inc	12 Feb 2010 17:05:46 -0000	1.3
+++ includes/typekit.admin.inc	1 Apr 2010 00:17:29 -0000
@@ -3,7 +3,7 @@
 
 /**
  * @file
- * This file holds the functions for the typekit Admin settings.
+ * This file holds the functions for the typekit admin settings.
  *
  * @ingroup typekit
  */
@@ -15,7 +15,7 @@
  */
 function typekit_admin_settings() {
   $form = array();
-  $php_access = user_access('use PHP for block visibility');
+  $php_access = module_exists('php') && user_access('use PHP for settings');
   $code = htmlspecialchars('<script type="text/javascript" src="http://use.typekit.com/XXXXXXX.js">');
   $key_description = t('
     This is the key for your site, and TypeKit will not work without it.  This can be found in the embed code that you get for each kit.  It is the name of the JS include file.
@@ -23,23 +23,23 @@ function typekit_admin_settings() {
       !code
     </code>
   ', array('!code' => $code));
-  $visibility_desc = t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>'));
+  $visibility_desc = t("Specify pages by using their paths. Enter one path per line. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>'));
   $visibility_options = array(
-    0 => t('Show on every page except the listed pages.'),
-    1 => t('Show on only the listed pages.'),
+    0 => t('All pages except those listed'),
+    1 => t('Only the listed pages'),
   );
 
-  // Check if use has access to do PHP stuff
+  // Check if user has access to do PHP stuff.
   if ($php_access) {
-    $visibility_options[3] = t('Show if the following PHP code returns <code>TRUE</code> (PHP-mode, experts only).');
-    $visibility_desc .= ' ' . t('If the PHP-mode is chosen, enter PHP code between %php. Note that executing incorrect PHP-code can break your Drupal site.', array('%php' => '<?php ?>'));
+    $visibility_options[3] = t('Pages on which this PHP code returns <code>TRUE</code> (experts only)');
+    $visibility_desc .= ' ' . t('If the PHP option is chosen, enter PHP code between %php. Note that executing incorrect PHP code can break your Drupal site.', array('%php' => '<?php ?>'));
   }
 
   // Enable
   $form['typekit_enable'] = array(
     '#type' => 'checkbox',
     '#title' => t('Enable'),
-    '#description' => t('Enables TypeKit on your site.  On by default'),
+    '#description' => t('Enables TypeKit on your site.  On by default.'),
     '#default_value' => variable_get('typekit_enable', TRUE),
   );
 
@@ -58,7 +58,7 @@ function typekit_admin_settings() {
     '#collapsible' => TRUE,
     '#collapsed' => TRUE,
   );
-  $form['typekit_visibility']['typekit_visibility_settings']['custom'] = array(
+  $form['typekit_visibility']['typekit_visibility_settings'] = array(
     '#type' => 'radios',
     '#title' => t('Custom visibility settings'),
     '#options' => $visibility_options,
@@ -72,6 +72,6 @@ function typekit_admin_settings() {
     '#description' => $visibility_desc,
   );
 
-  // Make a system setting form and return
+  // Make a system settings form and return.
   return system_settings_form($form);
 }
