Index: cleanpager.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cleanpager/cleanpager.module,v
retrieving revision 1.2
diff -u -p -r1.2 cleanpager.module
--- cleanpager.module	4 Apr 2008 07:16:52 -0000	1.2
+++ cleanpager.module	9 Jul 2008 05:57:12 -0000
@@ -1,4 +1,5 @@
 <?php
+// $Id$
 
 /**
  * Implementation of hook_menu()
@@ -13,7 +14,11 @@ function cleanpager_menu($may_cache) {  
     'description' => t('Global configuration of Clean Pagination functionality.'),
     'type' => MENU_NORMAL_ITEM,
   );  
-  
+  if (cleanpager_check_match()) {
+    if (variable_get('cleanpager_use_seo_links', '') == 1) {
+      drupal_add_js(drupal_get_path('module', 'cleanpager') . '/cleanpager.js');
+    }
+  }
   return $items;
 }
 
@@ -27,7 +32,7 @@ function cleanpager_admin_settings() {
     '#description' => 'Set which pages to apply clean pagination to. Put each page on a new line and use the full page name, without a leading slash. Probably the easiest way to test this out to to create a view with only 1 or 2 nodes per page and add the URL to this list. An example how you would type a page is "admin/content/node".',
     '#type' => 'textarea',
     '#rows' => '7',
-    '#default_value' => variable_get('cleanpager_pages',''),
+    '#default_value' => variable_get('cleanpager_pages', ''),
   );  
   
   $form['cleanpager_use_seo_links']= array(
@@ -44,15 +49,12 @@ function cleanpager_admin_settings() {
  * Implementation of hook_perm()
  */
 function cleanpager_perm() {
-  return array("cleanpage administer",);
+  return array("cleanpage administer");
 }
 
 function cleanpager_init() {
   if (cleanpager_check_match()) {
-    if (variable_get('cleanpager_use_seo_links', '') == 1) {
-      drupal_add_js(drupal_get_path('module','cleanpager') .'/cleanpager.js');
-    }
-    $url_array = explode('/',$_GET['q']);
+    $url_array = explode('/', $_GET['q']);
     $page = end($url_array);
     array_pop($url_array);
     
@@ -68,13 +70,13 @@ function cleanpager_init() {
  * Checks if the page should use clean pagination
  */
 function cleanpager_check_match() {
-  $matches = variable_get('cleanpager_pages','');
+  $matches = variable_get('cleanpager_pages', '');
   if (trim($matches) != '') {
-    $matches = explode("\n",$matches);
-    foreach($matches as $match) {
+    $matches = explode("\n", $matches);
+    foreach ($matches as $match) {
       $match = trim($match);
-      $match = str_replace('/','\\/',$match);
-      if (preg_match('/'. $match . '([0-9]*)/',$_GET['q'])) {
+      $match = str_replace('/', '\\/', $match);
+      if (preg_match('/'. $match . '([0-9]*)/', $_GET['q'])) {
         return true;
         break;
       }
@@ -101,7 +103,7 @@ function phptemplate_pager_link($text, $
     if ($_GET['page'] > 0) {
       array_pop($arguments);
     }
-    $pre_page_q = implode('/',$arguments);
+    $pre_page_q = implode('/', $arguments);
     //echo $pre_page_q;
     $q .= $pre_page_q;
     if ($new_page) {
@@ -136,7 +138,7 @@ function phptemplate_pager_link($text, $
       $attributes['title'] = t('Go to page @number', array('@number' => $text));
     }
     if (is_numeric($text) && $q && variable_get('cleanpager_use_seo_links', '') == 1) {
-      $text = 'Visit '. $pre_page_q . ' Page ' . ($new_page+1);
+      $text = 'Visit '. $pre_page_q . ' Page ' . ($new_page + 1);
     }
   }
   return l($text, $q, $attributes, count($query) ? implode('&', $query) : NULL);
