]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 277623 : Move PerformSubsts() out of globals.pl
authortravis%sedsystems.ca <>
Fri, 4 Feb 2005 01:37:07 +0000 (01:37 +0000)
committertravis%sedsystems.ca <>
Fri, 4 Feb 2005 01:37:07 +0000 (01:37 +0000)
Patch by Max Kanat-Alexander <mkanat@kerio.com>  r=vladd  a=justdave

Bugzilla/BugMail.pm
globals.pl
showdependencygraph.cgi

index 7de3e63cbfe100e2f08326cc2fbd352131ee6d88..f81c1615d282f8f5442193005691cfdbc065ae1b 100644 (file)
@@ -30,6 +30,11 @@ use strict;
 
 package Bugzilla::BugMail;
 
+use base qw(Exporter);
+@Bugzilla::BugMail::EXPORT = qw(
+    PerformSubsts
+);
+
 use Bugzilla::RelationSet;
 
 use Bugzilla::Config qw(:DEFAULT $datadir);
@@ -903,4 +908,25 @@ sub MessageToMTA ($) {
     $mailer->close;
 }
 
+# Performs substitutions for sending out email with variables in it,
+# or for inserting a parameter into some other string.
+#
+# Takes a string and a reference to a hash containing substitution 
+# variables and their values.
+#
+# If the hash is not specified, or if we need to substitute something
+# that's not in the hash, then we will use parameters to do the 
+# substitution instead.
+#
+# Substitutions are always enclosed with '%' symbols. So they look like:
+# %some_variable_name%. If "some_variable_name" is a key in the hash, then
+# its value will be placed into the string. If it's not a key in the hash,
+# then the value of the parameter called "some_variable_name" will be placed
+# into the string.
+sub PerformSubsts ($;$) {
+    my ($str, $substs) = (@_);
+    $str =~ s/%([a-z]*)%/(defined $substs->{$1} ? $substs->{$1} : Param($1))/eg;
+    return $str;
+}
+
 1;
index 12f9788bb2fbfe6e349b9115bf30de6885ba721f..6957256a300326ad7e5d0f902573d9b1ada4b6a2 100644 (file)
@@ -1276,13 +1276,6 @@ sub RemoveVotes {
     }
 }
 
-sub PerformSubsts {
-    my ($str, $substs) = (@_);
-    $str =~ s/%([a-z]*)%/(defined $substs->{$1} ? $substs->{$1} : Param($1))/eg;
-    return $str;
-}
-
-
 ###############################################################################
 
 # Constructs a format object from URL parameters. You most commonly call it 
index da7f0d7b84d42e8bc255e1370b7338f71d413269..9591a284d871678392251b17a699a972da9605bd 100755 (executable)
@@ -29,6 +29,7 @@ use File::Temp;
 use Bugzilla;
 use Bugzilla::Config qw(:DEFAULT $webdotdir);
 use Bugzilla::Util;
+use Bugzilla::BugMail;
 
 require "CGI.pl";