Index: sites/web/modules/contrib/crazyegg/includes/admin.inc
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- sites/web/modules/contrib/crazyegg/includes/admin.inc	(revision 46027)
+++ sites/web/modules/contrib/crazyegg/includes/admin.inc	(revision )
@@ -3,35 +3,86 @@
 function crazyegg_admin_settings_form() {
   $form = array();
 
-  $form['crazyegg_enabled'] = array(
+  $form['crazyegg'] = array(
+    '#type' => 'vertical_tabs',
+  );
+
+  if (user_access('administer crazy egg')) {
+    $form['crazyegg']['settings'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('General settings'),
+    );
+
+    $form['crazyegg']['settings']['crazyegg_enabled'] = array(
       '#type' => 'radios',
       '#title' => t('Crazy Egg Enabled?'),
       '#options' => array(
-          TRUE => t('Yes'),
-          FALSE => t('No'),
+        TRUE => t('Yes'),
+        FALSE => t('No'),
       ),
       '#default_value' => variable_get('crazyegg_enabled', TRUE),
-  );
+    );
 
-  $form['crazyegg_account_id'] = array(
+    $form['crazyegg']['settings']['crazyegg_account_id'] = array(
       '#type' => 'textfield',
       '#title' => t('Crazy Egg Account ID'),
       '#default_value' => variable_get('crazyegg_account_id', ''),
       '#description' => '(ex. 00111111)',
-  );
+    );
 
-  $account_explanation = '';
-  $account_explanation .= t('This is your numerical CrazyEgg account ID, it is 8 digits long. The easy way to find it is by logging in to your CrazyEgg account and clicking the "What\'s my code" link located at the top of your Dashboard.');
-  $account_explanation .= '<br />';
-  $account_explanation .= t('');
-  $account_explanation .= '<br />';
-  $account_explanation .= l('http://www.crazyegg.com', 'http://www.crazyegg.com', array('attributes' => array('target' => '_blank')));
+    $account_explanation = '';
+    $account_explanation .= t('This is your numerical CrazyEgg account ID, it is 8 digits long. The easy way to find it is by logging in to your CrazyEgg account and clicking the "What\'s my code" link located at the top of your Dashboard.');
+    $account_explanation .= '<br />';
+    $account_explanation .= t('');
+    $account_explanation .= '<br />';
+    $account_explanation .= l('http://www.crazyegg.com', 'http://www.crazyegg.com', array('attributes' => array('target' => '_blank')));
 
-  $form['account_explanation'] = array(
+    $form['crazyegg']['settings']['account_explanation'] = array(
       '#type' => 'item',
       '#title' => t('What Is My Account ID?'),
       '#markup' => $account_explanation,
-  );
+    );
+  }
+
+  if (user_access('administer crazy egg pages')) {
+    $form['crazyegg']['page_settings'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Pages'),
+    );
+
+    $pages = variable_get('crazyegg_pages', '');
+    $visibility = variable_get('crazyegg_visibility_pages', 1);
+
+    // Page specific visibility configurations.
+    $form['crazyegg']['page_settings']['crazyegg_vis_settings'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Pages'),
+      '#collapsible' => TRUE,
+      '#collapsed' => FALSE,
+    );
+
+    $options = array(
+      t('Every page except the listed pages'),
+      t('The listed pages only'),
+    );
+    $description = 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>'));
+
+    $form['crazyegg']['page_settings']['crazyegg_vis_settings']['crazyegg_visibility_pages'] = array(
+      '#type' => 'radios',
+      '#title' => t('Add tracking to specific pages'),
+      '#options' => $options,
+      '#default_value' => $visibility,
+    );
+
+    $form['crazyegg']['page_settings']['crazyegg_vis_settings']['crazyegg_pages'] = array(
+      '#type' => 'textarea',
+      '#title' => t('Pages'),
+      '#title_display' => 'invisible',
+      '#default_value' => $pages,
+      '#description' => $description,
+      '#rows' => 10,
+    );
+  }
 
   return system_settings_form($form);
 }
\ No newline at end of file
Index: sites/web/modules/contrib/crazyegg/crazyegg.module
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- sites/web/modules/contrib/crazyegg/crazyegg.module	(revision 46027)
+++ sites/web/modules/contrib/crazyegg/crazyegg.module	(revision )
@@ -5,10 +5,18 @@
  */
 function crazyegg_permission() {
   return array(
-      'administer crazy egg' => array(
-          'title' => t('Administer Crazy Egg'),
-          'description' => t('Administer account settings and visibility of Crazy Egg on your site.'),
-      ),
+    'administer crazy egg' => array(
+      'title' => t('Administer Crazy Egg'),
+      'description' => t('Administer account settings and visibility of Crazy Egg on your site.'),
+    ),
+    'administer crazy egg pages' => array(
+      'title' => t('Administer Crazy Egg Pages'),
+      'description' => t('Administer on which pages the Crazy Egg script runs'),
+    ),
+    'Access crazy egg settings' => array(
+      'title' => t('Access Crazy Egg Settings'),
+      'description' => t('Access the Crazy Egg settings page.'),
+    ),
   );
 }
 
@@ -17,13 +25,13 @@
  */
 function crazyegg_menu() {
   $items['admin/config/system/crazyegg'] = array(
-      'title' => 'Crazy Egg',
-      'description' => 'Configure Crazy Egg heat maps on your website.',
-      'page callback' => 'drupal_get_form',
-      'page arguments' => array('crazyegg_admin_settings_form'),
+    'title' => 'Crazy Egg',
+    'description' => 'Configure Crazy Egg heat maps on your website.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('crazyegg_admin_settings_form'),
-      'access arguments' => array('administer crazy egg'),
+    'access arguments' => array('Access crazy egg settings'),
-      'type' => MENU_NORMAL_ITEM,
-      'file' => 'includes/admin.inc',
+    'type' => MENU_NORMAL_ITEM,
+    'file' => 'includes/admin.inc',
   );
 
   return $items;
@@ -43,15 +51,13 @@
  * Implements hook_page_alter() to insert JavaScript to the appropriate scope/region of the page.
  */
 function crazyegg_page_alter(&$page) {
-  global $user;
-
   $account_id = variable_get('crazyegg_account_id', '');
   $crazyegg_enabled = variable_get('crazyegg_enabled', TRUE);
 
-  if ($account_id && $crazyegg_enabled) {
+  if ($account_id && $crazyegg_enabled && _crazyegg_visibility_pages()) {
 
     $scope = 'footer';
-    
+
     $account_path = str_pad($account_id, 8, "0", STR_PAD_LEFT);
     $account_path = substr($account_path, 0, 4) . '/' . substr($account_path, 4, 8);
     $account_path = "pages/scripts/" . $account_path . ".js";
@@ -67,4 +73,51 @@
 
     drupal_add_js($script, array('scope' => $scope, 'type' => 'inline'));
   }
+}
+
+/**
+ * Based on visibility setting this function returns TRUE if Crazy Egg script should
+ * be added to the current page and otherwise FALSE.
+ */
+function _crazyegg_visibility_pages() {
+  static $page_match;
+
+  // Cache visibility result if function is called more than once.
+  if (!isset($page_match)) {
+
+    $visibility = variable_get('crazyegg_visibility_pages', 1);
+    $setting_pages = variable_get('crazyegg_pages', '');
+
+    // Match path if necessary.
+    if (!empty($setting_pages)) {
+      // Convert path to lowercase. This allows comparison of the same path
+      // with different case. Ex: /Page, /page, /PAGE.
+      $pages = drupal_strtolower($setting_pages);
+      if ($visibility < 2) {
+        // Convert the Drupal path to lowercase
+        $path = drupal_strtolower(drupal_get_path_alias($_GET['q']));
+        // Compare the lowercase internal and lowercase path alias (if any).
+        $page_match = drupal_match_path($path, $pages);
+        if ($path != $_GET['q']) {
+          $page_match = $page_match || drupal_match_path($_GET['q'], $pages);
+        }
+        // When $visibility has a value of 0, the tracking code is displayed on
+        // all pages except those listed in $pages. When set to 1, it
+        // is displayed only on those pages listed in $pages.
+        $page_match = !($visibility xor $page_match);
+      }
+      else {
+        $page_match = FALSE;
+      }
+    }
+    else {
+      if ($visibility == '1') {
+        $page_match = FALSE;
+      }
+      else {
+        $page_match = TRUE;
+      }
+    }
+  }
+  return $page_match;
 }
\ No newline at end of file
