? 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 = '

'. t('Easy way to include Typekit in your site.') .'

'; + $output = '

' . t('Easy way to include Typekit in your site.') . '

'; 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('