--- service_links.admin.inc	2011-10-04 16:43:33.000000000 +0200
+++ service_links.admin.inc	2011-10-04 19:30:17.843394000 +0200
@@ -147,6 +147,57 @@
     '#description' => t('When to display the services after the content text.'),
   );
 
+  $form['page_match'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Page specific visibility settings'),
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE,
+  );
+  $access = user_access('use PHP for service visibility');
+  $visibility = variable_get('service_links_visibility_for_node', SERVICE_LINKS_VISIBILITY_NOT_LISTED);
+  $pages = variable_get('service_links_page_match_for_node', '');
+  if ($visibility == SERVICE_LINKS_VISIBILITY_PHP && !$access) {
+    $form['page_match'] = array(
+      'service_links_visibility_for_node' => array(
+        '#type' => 'value', 
+        '#value' => SERVICE_LINKS_VISIBILITY_PHP,
+      ),
+      'service_links_page_match_for_node' => array(
+        '#type' => 'value',
+        '#value' => $pages,
+      ),
+    );
+  }
+  else {
+    $options = array(
+      SERVICE_LINKS_VISIBILITY_NOT_LISTED => t('All pages except those listed'),
+      SERVICE_LINKS_VISIBILITY_ONLY_LISTED => t('Only the listed pages'),
+    );
+    $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>'));
+
+    if (module_exists('php') && $access) {
+      $options += array(SERVICE_LINKS_VISIBILITY_PHP => t('Pages on which this PHP code returns <code>TRUE</code> (experts only)'));
+      $title = t('Pages or PHP code');
+      $description .= ' ' . 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 ?>'));
+    }
+    else {
+      $title = t('Pages');
+    }
+
+    $form['page_match']['service_links_visibility_for_node'] = array(
+      '#type' => 'radios',
+      '#title' => t('Show Service Links on specific pages'),
+      '#options' => $options,
+      '#default_value' => $visibility,
+    );
+    $form['page_match']['service_links_page_match_for_node'] = array(
+      '#type' => 'textarea',
+      '#title' => $title,
+      '#default_value' => $pages,
+      '#description' => $description,
+    );
+  }
+
   $form['how_to_show_the_links'] = array(
     '#type' => 'fieldset',
     '#collapsible' => TRUE,
--- service_links.module	2011-10-04 16:43:33.000000000 +0200
+++ service_links.module	2011-10-04 19:24:07.405480000 +0200
@@ -34,6 +34,10 @@
 define('SERVICE_LINKS_TAG_TITLE_OVERRIDE', 1);
 define('SERVICE_LINKS_TAG_TITLE_TOKEN', 2);
 
+define('SERVICE_LINKS_VISIBILITY_NOT_LISTED', 0);
+define('SERVICE_LINKS_VISIBILITY_ONLY_LISTED', 1);
+define('SERVICE_LINKS_VISIBILITY_PHP', 2);
+
 /**
  * Implements hook_help().
  */
@@ -70,6 +74,9 @@
       'title' => t('Access to Service Links'),
       //'description' => t('Allow users to act with the services loaded'),
     ),
+    'use PHP for service visibility' => array(
+      'title' => t('Use PHP for Service visibility'),
+    ),
   );
 }
 
@@ -562,7 +569,14 @@
 
   // On Drupal 7 this tag should be filled before the split otherwise will be lost.
   $service['link'] = str_replace('<front-page>', $settings['subst']['front-page'], $service['link']);
-  $service['url'] = preg_split('/\?/', $service['link']);
+
+  if (strpos($service['link'], '=') === FALSE) {
+    $service['url'] = array($service['link']);
+  }
+  else {
+    $service['url'] = preg_split('/\?/', $service['link']);
+  }
+
   if (count($service['url']) > 1) {
     $service['url'][1] = service_links_get_query($service['url'][1]);
     $service['url'][1] = str_replace($settings['tag'], $settings['subst'], $service['url'][1]);
@@ -814,6 +828,10 @@
   $category_type = FALSE;
   global $user;
 
+  if (!_service_links_match_path()) {
+    return FALSE;
+  }
+
   if (in_array(strtolower(arg(0)), array('print', 'printpdf', 'printmail'))) {
     return FALSE;
   }
@@ -843,6 +861,50 @@
 }
 
 /**
+ * Match the current path with the list or the code
+ * inserted in the configuration page.
+ */
+function _service_links_match_path() {
+  static $page_match;
+
+  if (isset($page_match)) {
+    return $page_match;
+  }
+
+  $pages = variable_get('service_links_page_match_for_node', '');
+  $visibility = variable_get('service_links_visibility_for_node', SERVICE_LINKS_VISIBILITY_NOT_LISTED);
+  if (!empty($pages)) {
+    // Convert path to lowercase. This allows comparison of the same path
+    // with different case. Ex: /Page, /page, /PAGE.
+    $pages = drupal_strtolower($pages);
+
+    if ($visibility < SERVICE_LINKS_VISIBILITY_PHP) {
+      $path = drupal_strtolower(drupal_get_path_alias($_GET['q']));
+      // Compare with the internal and 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 links are 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);
+    }
+    elseif (module_exists('php')) {
+      $page_match = php_eval($pages);
+    }
+    else {
+      $page_match = FALSE;
+    }
+  }
+  else {
+    $page_match = TRUE;
+  }
+
+  return $page_match;
+}
+
+/**
  * Load the static settings and keep clear the render function.
  */
 function _service_links_load_settings() {
