diff --git a/README.txt b/README.txt
old mode 100644
new mode 100755
diff --git a/pathologic.install b/pathologic.install
old mode 100644
new mode 100755
diff --git a/pathologic.module b/pathologic.module
old mode 100644
new mode 100755
index 22e78ef..15a201e
--- a/pathologic.module
+++ b/pathologic.module
@@ -297,17 +297,35 @@ function _pathologic_replace($matches) {
     }
   }
 
-  $url = url(
-    $parts['path'] === '' ? '<front>' : $parts['path'],
-    array(
-      'query' => $parts['qparts'],
-      'fragment' => isset($parts['fragment']) ? $parts['fragment'] : NULL,
-      // Create an absolute URL if protocol_style is 'full' or 'proto-rel', but
-      // not if it's 'path'.
-      'absolute' => $settings['current_settings']['protocol_style'] !== 'path',
-      'language' => isset($settings['language_list'][$settings['langcode']]) ? $settings['language_list'][$settings['langcode']] : $settings['language_list'][LANGUAGE_NONE],
-    )
-  );
+  // Initialize the url variable.
+  $url = NULL;
+  // Get a list of all modules implementing the hook_pathologic_url().
+  if (($modules = module_implements('pathologic_url'))) {
+    // Loop through the modules until the end is reached or a module constructed
+    // an url.
+    while (!isset($url) && ($module = current($modules)) !== FALSE) {
+      // Invoke the module specific hook_pathologic_url().
+      $url = module_invoke($module, 'pathologic_url', $parts, $settings);
+      // Move to the next module.
+      next($modules);
+    }
+  }
+  // If none of the hook_pathologic_url() implementations constructed an url
+  // then we fallback to the default implementation.
+  if (!isset($url)) {
+    // Construct an URL using the default implementation.
+    $url = url(
+      $parts['path'] === '' ? '<front>' : $parts['path'],
+      array(
+        'query' => $parts['qparts'],
+        'fragment' => isset($parts['fragment']) ? $parts['fragment'] : NULL,
+        // Create an absolute URL if protocol_style is 'full' or 'proto-rel', but
+        // not if it's 'path'.
+        'absolute' => $settings['current_settings']['protocol_style'] !== 'path',
+        'language' => isset($settings['language_list'][$settings['langcode']]) ? $settings['language_list'][$settings['langcode']] : $settings['language_list'][LANGUAGE_NONE],
+      )
+    );
+  }
 
   // If we turned clean URLs on before to create a path to a file, turn them
   // back off.
diff --git a/pathologic.test b/pathologic.test
old mode 100644
new mode 100755
