diff -u -p -r -N //tmp/opensearchclient/opensearchclient.info modules/opensearchclient/opensearchclient.info
--- /tmp/opensearchclient/opensearchclient.info	1970-01-01 10:00:00.000000000 +1000
+++ modules/opensearchclient/opensearchclient.info	2007-01-10 10:02:49.000000000 +1100
@@ -0,0 +1,5 @@
+; $Id$
+name = OpenSearch client
+description = Allows for searching Opensearch RSS feeds from within Drupal.
+version = "5.x-1.x-dev"
+project = "opensearchclient"
diff -u -p -r -N /tmp/opensearchclient/opensearchclient.module modules/opensearchclient/opensearchclient.module
--- /tmp/opensearchclient/opensearchclient.module	2006-12-12 19:24:56.000000000 +1100
+++ modules/opensearchclient/opensearchclient.module	2007-01-11 10:32:01.000000000 +1100
@@ -12,13 +12,12 @@
 function opensearchclient_help($section) {
   switch ($section) {
     case 'admin/help#opensearchclient':
-      return '<p>'. t('Allows for searching Opensearch RSS feeds from within Drupal. See <a href="http://opensearch.a9.com/">the Opensearch site</a> for more information on Opensearch.'). '</p>';
+      return '<p>'. t('Allows for searching Opensearch RSS feeds from within Drupal. See <a href="http://opensearch.a9.com/">the Opensearch site</a> for more information on Opensearch.'). '</p>'; 
     case 'admin/modules#description':
       return t('An Opensearch RSS client integrated into a Drupal website.');
   }
 }
 
-
 function opensearchclient_perm() {
   return array('configure opensearch feeds');
 }
@@ -35,21 +34,27 @@ function opensearchclient_search($op = '
       $from_page =  intval($_GET['page']);
       $keys = search_get_keys();
 
-      if ($template = variable_get('opensearchclient_template', false))  {
-        // TODO: There are more core params to be handled: http://opensearch.a9.com/spec/1.1/querysyntax/
-        // TODO: "10" as the number of items per page is once again hardcoded here.
-        $url = preg_replace('/{searchTerms}/', urlencode($keys), $template);
-
-        //the page number
-        $url = preg_replace('/{startPage}/', urlencode($from_page+1), $url);
-
-        //the starting index        
-        $url = preg_replace('/{startIndex}/', urlencode(($from_page) * 10), $url);
-       
-        //the language
-        $url = preg_replace('/{language}/', urlencode($locale), $url);
-        $url = preg_replace('/{outputEncoding}/', 'UTF-8', $url);
-        $url = preg_replace('/{count}/', '10', $url);
+      if ($url = variable_get('opensearchclient_template', false))  {
+        // TODO: There are more core params to be handled: 
+        // http://www.opensearch.org/Specifications/OpenSearch/1.1#OpenSearch_URL_template_syntax
+
+        // Define the terms to be replaced and the replacement values. This is done in one array and 
+        // split later to keep the code easier to read
+        $mappings = array('{searchTerms}' => urlencode($keys),
+                          '{startPage}' => urlencode($from_page+1),
+                          '{startIndex}' => urlencode(($from_page) * 10),
+                          '{language}' => urlencode($locale),
+                          '{inputEncoding}' => 'UTF-8',
+                          '{outputEncoding}' => 'UTF-8',
+                          // TODO: "10" as the number of items per page is once again hardcoded here.
+                          '{count}' => '10');
+
+        // Pull out the terms and their replacement values
+        $terms = array_keys($mappings);
+        $replacements = array_values($mappings);
+
+        // Perform the replacement
+        $url = str_replace($terms, $replacements, $url);
       }
       else {
         drupal_set_message(t('OpenSearch client is not configured correctly. Please specify a URL template for searching.'));
@@ -82,9 +87,6 @@ function opensearchclient_search($op = '
 
       $items = array();
 
-      // Get information on other modules that are interested in the RSS results (like Nutch) by calling the 'opensearchclient_bindings' hook
-      $opensearchclient_bindings = opensearchclient_get_module_bindings();
-
       foreach ($rss->items as $key => $item) {
         $items[$key]['link'] = $item['link'];
         //$items[$key]['type'] = t('opensearch');
@@ -99,11 +101,16 @@ function opensearchclient_search($op = '
         $items[$key]['description'] = $item['description'];
         $items[$key]['summary'] = $item['summary'];
 
-        // pass along extra information to hook_search_item based on opensearch_bindings.
-        foreach (array_diff_assoc($item, $items[$key]) as $namespace => $values) {
-          $value = $opensearchclient_bindings[$namespace]($values);
-          if ($value && trim($value) != '') {
-            $items[$key]['extra'][$namespace] = $value;
+       // Get information on other modules that are interested in the RSS results (like Nutch) by calling the 'opensearchclient_bindings' hook
+       $opensearchclient_bindings = opensearchclient_get_module_bindings();
+
+        // pass along extra information to hook_search_item based on opensearch_bindings, if there are some.
+        if (count($opensearchclient_bindings) > 0) {
+          foreach (array_diff_assoc($item, $items[$key]) as $namespace => $values) {
+            $value = $opensearchclient_bindings[$namespace]($values);
+            if ($value && trim($value) != '') {
+              $items[$key]['extra'][$namespace] = $value;
+            }
           }
         }
       }
@@ -112,8 +119,27 @@ function opensearchclient_search($op = '
   }
 }
 
-function opensearchclient_settings() {
+/**
+ * Implementation of hook_menu().
+ */
+function opensearchclient_menu($may_cache) {
+  $items = array (); 
+  if ($may_cache) {
+
+    $items[] = array (
+      'path' => 'admin/settings/opensearchclient',
+      'title' => t('OpenSearch client'),
+      'description' => t('Configure settings for interfacing with an OpenSearch compatible search engine.'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('opensearchclient_admin_settings'),
+      'access' => user_access('configure opensearch feeds'),
+      'type' => MENU_NORMAL_ITEM);  
+  }
+ return $items;
+}
 
+
+function opensearchclient_admin_settings() {
   $form['template'] = array(
     '#type' => 'fieldset',
     '#title' => t('OpenSearch URL template'),
@@ -129,7 +155,7 @@ function opensearchclient_settings() {
     '#type' => 'textfield',
     '#title' => t('Opensearch URL template'),
     '#default_value' => variable_get('opensearchclient_template', ''),
-    '#description' => t('Available placeholders are <code>{searchTerms}</code>, <code>{startPage}</code>, <code>{startIndex}</code>, <code>{language}</code>, <code>{outputEncoding}</code>, <code>{count}</code>'),
+    '#description' => t('Available placeholders are <code>{searchTerms}</code>, <code>{startPage}</code>, <code>{startIndex}</code>, <code>{language}</code>, <code>{inputEncoding}</code>, <code>{outputEncoding}</code>, <code>{count}</code>'),
     // #maxlength defaults to 128, which is too short too often. Setting higher.
     '#maxlength' => 256, 
   );
@@ -139,7 +165,8 @@ function opensearchclient_settings() {
     '#value' => variable_get('opensearch_magpie_cache_dir', file_directory_path(). '/magpiecache'),
     '#after_build' => array('opensearch_check_magpie_cache_dir'),
   );
-  return $form;
+
+  return system_settings_form($form);
 }
 
 function opensearch_check_magpie_cache_dir($form_element) {
