Bug fixes
[tpope-extra.git] / drupal / modules / cvsfilter.module
1 <?php
2 // $Id$
3 // -*- php -*- vim: ft=php
4
5 function cvsfilter_help($section) {
6   switch ($section) {
7     case 'admin/system/modules#description':
8       return t("Automatically points cvs: style URLs at the appropriate location.");
9   }
10 }
11
12 function cvsfilter_filter($op, $text = "") {
13   switch ($op) {
14     case "name":
15       return t("CVS Filter");
16     case "settings":
17       return form_group(t("URL Filter"), t("CVS Filter is enabled.  This means that cvs: style URLs will automatically be pointed at the appropriate location."));
18     case "process":
19       //$text = " " . $text . " ";
20       $text = preg_replace("/<a href=\"cvs:\/\/([^\"\/]*)\/?([^\"]*)\">/i", '<a href="http://sexygeek.us/cgi-bin/cvsweb/\2?cvsroot=\1">', $text);
21       $text = preg_replace("/<a href=\"cvs:([^\"]*)\">/i", '<a href="http://sexygeek.us/cgi-bin/cvsweb/\1?cvsroot=tpope">', $text);
22 //      $text = preg_replace("<([ \n\r\t\(])([A-Za-z0-9._-]+@[A-Za-z0-9._-]+\.[A-Za-z]{2,4})([.,]?)(?=[ \n\r\t\)])>i", '\1<a href="mailto:\2">\2</a>\3', $text);
23 //      $text = preg_replace("<([ \n\r\t\(])(www\.[a-zA-Z0-9@:%_~#?&=.,/;-]*[a-zA-Z0-9@:%_~#\&=/;-])([.,?]?)(?=[ \n\r\t\)])>i", '\1<a href="http://\2">\2</a>\3', $text);
24       //$text = substr($text, 1, -1);
25       return $text;
26     default:
27       return $text;
28   }
29   return $text;
30 }
31
32
33 ?>