--- mantis-pre2/config_defaults_inc.php 2005-09-11 21:24:08.000000000 +1000
+++ mantis-old2/config_defaults_inc.php 2005-11-01 17:44:17.765625000 +1100
@@ -1053,6 +1053,9 @@
# eg: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/mantisbt/mantisbt/
$g_cvs_web = '';
+ # --- Wiki linking ---
+ $g_wiki_link_url = '';
+
# --- Source Control Integration ------
# For open source projects it is expected that the notes be public, however,
diff -uNr mantis-pre2/core/string_api.php mantis-old2/core/string_api.php
--- mantis-pre2/core/string_api.php 2005-08-08 01:29:06.000000000 +1000
+++ mantis-old2/core/string_api.php 2005-12-20 10:24:53.187500000 +1100
@@ -101,6 +101,8 @@
$p_string = string_process_bug_link( $p_string );
$p_string = string_process_bugnote_link( $p_string );
$p_string = string_process_cvs_link( $p_string );
+ $p_string = string_process_wiki_link($p_string);
+ $p_string = string_process_changeset_link($p_string);
return $p_string;
}
@@ -143,6 +145,7 @@
$p_string = string_process_bug_link( $p_string, false );
$p_string = string_process_bugnote_link( $p_string, false );
$p_string = string_process_cvs_link( $p_string, false );
+ $p_string = string_process_wiki_link($p_string, false);
return $p_string;
}
@@ -192,6 +195,54 @@
$p_string );
}
+ # Process the string, returning full HTML links to a wiki, if configured.
+
+ function string_process_wiki_link($string, $fullHTML = true) {
+ if (!config_get('wiki_link_url')) return $string;
+ if ($fullHTML) return preg_replace_callback('/\[\[(([^\]]*?))\]\]/', 'string_process_wiki_link_callback_fullhtml', $string);
+ return preg_replace_callback('/\[\[(([^\]]*?))\]\]/', 'string_process_wiki_link_callback_nohtml', $string);
+
+ }
+
+ # --------------------
+ # Subsitution callback for the regexp in string_process_wiki_link(); HTML version.
+ function string_process_wiki_link_callback_fullhtml($words) {
+ $p_url_text = $words[2];
+ $p_link = config_get('wiki_link_url').$p_url_text;
+ return ''. "$p_url_text". ' ';
+ }
+
+ # --------------------
+ # Subsitution callback for the regexp in string_process_wiki_link(); plaintext version.
+ function string_process_wiki_link_callback_nohtml($words) {
+ $p_url_text = $words[2];
+ $p_link = config_get('wiki_link_url').$p_url_text;
+ return "$p_url_text ($p_link)";
+ }
+
+ # ---------------------
+ # Process 'changeset' links to ViewCVS pages
+ function string_process_changeset_link($string, $fullHTML = true) {
+ if(!config_get('changeset_link_url'))return $string;
+ $re = '/\b(version|revision|rev|changeset)\s+([0-9]+(\.[0-9]+)*)\b/';
+ if($fullHTML)return preg_replace_callback($re,'string_process_changeset_link_callback_fullhtml', $string);
+ return preg_replace_callback($re,'string_process_changeset_link_callback_nohtml', $string);
+ }
+
+ function string_process_changeset_link_callback_fullhtml($words) {
+ $p_link_text = $words[0];
+ $p_changeset = $words[2];
+ $p_url = config_get('changeset_link_url').$p_changeset;
+ return ''. "$p_link_text". " [^]".' ';
+ }
+
+ function string_process_changeset_link_callback_nohtml($words) {
+ $p_link_text = $words[0];
+ $p_changeset = $words[2];
+ $p_url = config_get('changeset_link_url').$p_url_text;
+ return "$p_link_text ($p_url)";
+ }
+
# --------------------
# Process $p_string, looking for bug ID references and creating bug view
# links for them.