? .svn ? 288391.patch Index: robotreplay.info =================================================================== RCS file: /cvs/drupal/contributions/modules/robotreplay/robotreplay.info,v retrieving revision 1.2 diff -u -p -r1.2 robotreplay.info --- robotreplay.info 18 Jun 2007 22:53:56 -0000 1.2 +++ robotreplay.info 18 Aug 2008 08:14:46 -0000 @@ -1,4 +1,5 @@ name = "Robot Replay" description = Adds Robot Replay javascript tracking code to all your site's pages. +core = 6.x project = "nitobi" Index: robotreplay.module =================================================================== RCS file: /cvs/drupal/contributions/modules/robotreplay/robotreplay.module,v retrieving revision 1.1 diff -u -p -r1.1 robotreplay.module --- robotreplay.module 22 May 2007 23:38:11 -0000 1.1 +++ robotreplay.module 18 Aug 2008 08:14:47 -0000 @@ -1,75 +1,58 @@ + * Based on the excellent Google Analytics and Sitemap Drupal modules. + * * @attributes Robot Replay * @attributes Nitobi * @attributes Joe Bowser - * - * Based on the excellent Google Analytics and Sitemap Drupal modules. - * -*/ - -/* * - * implentation of hook_help() - * @param string $section - * @return string */ -function robotreplay_help($section) { - switch ($section) { +/** + * Implentation of hook_help() + */ +function robotreplay_help($path, $arg) { + switch ($path) { case 'admin/settings/robotreplay': - return t(l('Robotreplay.com','http://www.robotreplay.com') . ' is the excellent site tracking tool created by ' . l('Nitobi.com','http://www.nitobi.com')); + return t('Robotreplay.com is the excellent site tracking tool created by Nitobi.com'); } } /** - * implementation of hook_menu - * - * @param string $maycache - * @return array + * Implementation of hook_menu() */ -function robotreplay_menu($maycache) { +function robotreplay_menu() { $items = array(); - if ($maycache) { - $items[] = array( - 'path' => 'admin/settings/robotreplay', - 'title' => t('Robotreplay'), - 'description' => t('Configure the settings used to with your Robotreplay.com account.'), - 'callback' => 'drupal_get_form', - 'callback arguments' => 'robotreplay_admin_settings', - 'access' => user_access('administer site configuration'), - 'type' => MENU_NORMAL_ITEM, - ); - - // We need to create a page for verifying domain ownership - - if (variable_get('robotreplay_verification',FALSE)) { - $items[] = array( - 'path' => variable_get('robotreplay_verification',''), - 'title' => t('Robotreplay'), - 'callback' => 'robotreplay_verification_page', - 'access' => user_access('access content'), - 'type' => MENU_NORMAL_ITEM, + $items['admin/settings/robotreplay'] = array( + 'title' => 'Robotreplay', + 'description' => 'Configure the settings used to with your Robotreplay.com account.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('robotreplay_admin_settings'), + 'access arguments' => array('administer site configuration'), + 'type' => MENU_NORMAL_ITEM, + ); + + // We need to create a page for verifying domain ownership + if ($path = variable_get('robotreplay_verification', FALSE)) { + $items[$path] = array( + 'title' => 'Robotreplay', + 'page callback' => 'robotreplay_verification_page', + 'access arguments' => array('access content'), + 'type' => MENU_CALLBACK, ); - } } return $items; } - /** - * implemntation of hook_header - * + * Implemntation of hook_footer() * Inserts the javascript when the page is being rendered - * - * @param unknown_type $main */ -function robotreplay_footer($main = 0) { +function robotreplay_init() { global $user; // Check if we should track the currently active user's role + // @todo do this with ACLs and hook_permissions() instead $track = 0; foreach($user->roles as $role) { $role = str_replace(' ', '_', $role); @@ -77,25 +60,19 @@ function robotreplay_footer($main = 0) { } // Don't track page views in the admin sections + // @todo this should check for a permission to not be tracked. if ((arg(0) != 'admin') && $track > 0) { // Add any custom code snippets if specified - $script .= ''; + $script = ''; drupal_set_html_head($script); } } + /** * Callback form for admin settings page - * * @return the resulting form object */ function robotreplay_admin_settings() { - - // Here we fetch all of the active role types on the site - // You might not want a log full of your own walk throughs, - // or those of logged in users, etc. - - $result = db_query('SELECT * FROM {role} ORDER BY name'); - $form['roles'] = array( '#type' => 'fieldset', '#title' => t('User Role Tracking'), @@ -103,6 +80,11 @@ function robotreplay_admin_settings() { '#description' => t('Define what user roles should be tracked.') ); + // Here we fetch all of the active role types on the site + // You might not want a log full of your own walk throughs, + // or those of logged in users, etc. + // @todo implement this with hook_permissions instead. See robotreplay_init(). + $result = db_query('SELECT * FROM {role} ORDER BY name'); while ($role = db_fetch_object($result)) { // cannot use empty spaces $role_varname = $string = str_replace(' ', '_', $role->name); @@ -112,24 +94,21 @@ function robotreplay_admin_settings() { '#default_value' => variable_get("robotreplay_track_{$role_varname}", FALSE), ); } - + $form['robotreplay_verification'] = array( '#type' => 'textfield', '#length' => 10, - '#title' => 'Verification URL', + '#title' => 'Verification File Name', '#default_value' => variable_get('robotreplay_verification',''), '#description' => 'Robotreplay.com requires the creation of a .txt file on your domain to prove that you own the domain. Please enter this filename here (including the .txt)'); - -return system_settings_form($form); + return system_settings_form($form); } /** * Displays a blank page with a header 200 to robotreplay.com's verification system. - * */ - function robotreplay_verification_page() { - echo ''; - die; -} \ No newline at end of file + print ''; + die; +}