From b1dbef857daa446bad3942fa9854fe560e81084f Mon Sep 17 00:00:00 2001
From: Kornel Lugosi <coornail@gmail.com>
Date: Tue, 25 Oct 2011 13:23:49 +0100
Subject: [PATCH] Restrict optimization for certain paths

---
 visual_website_optimizer.module |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/visual_website_optimizer.module b/visual_website_optimizer.module
index 0bdc94e..1b483d6 100644
--- a/visual_website_optimizer.module
+++ b/visual_website_optimizer.module
@@ -20,8 +20,10 @@ function visual_website_optimizer_init() {
   // Grab the ID, but only proceed if it's set to something.
   $vwo_id = variable_get('visual_website_optimizer_id', 'NONE');
   $vwo_onoff = variable_get('visual_website_optimizer_onoff', 'on');
+  $enabled_paths = variable_get('visual_website_optimizer_paths', '*');
+  $path = $_GET['q'];
 
-  if ($vwo_onoff == 'on' && $vwo_id != "NONE") {
+  if ($vwo_onoff == 'on' && $vwo_id != "NONE" && drupal_match_path($path, $enabled_paths)) {
 
     // There are 3 chunks of code, or two files to serve.
     // Need to build a caching and input system for the 2 files version since
@@ -126,6 +128,13 @@ function visual_website_optimizer_setup_form($form_state) {
     '#required' => TRUE,
   );
 
+  $form['visual_website_optimizer_paths'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Enabled paths'),
+    '#default_value' => variable_get('visual_website_optimizer_paths', '*'),
+    '#description' => t('Enter one page per line as Drupal paths. The \'*\' character is a wildcard. Example paths are blog for the blog page and blog/* for every personal blog.'),
+  );
+
   return system_settings_form($form);
 }
 
-- 
1.7.6

