summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorburnus%gmx.de <>2003-08-22 22:55:13 +0200
committerburnus%gmx.de <>2003-08-22 22:55:13 +0200
commit115cc7b700979787e2adbb105832f27de4c89f28 (patch)
treecf1e927145dec0439e651b92d32c4a7afeafec98 /Bugzilla
parentd08d7d95cfb5813b08f4c0bbc50cc435f6cf275c (diff)
downloadbugzilla-115cc7b700979787e2adbb105832f27de4c89f28.tar.gz
bugzilla-115cc7b700979787e2adbb105832f27de4c89f28.tar.xz
Bug 139011 - Improve buglist colors further
r,a=justdave
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Template.pm4
-rw-r--r--Bugzilla/Util.pm13
2 files changed, 17 insertions, 0 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index d5cb1afd7..2cb017d17 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -218,6 +218,10 @@ sub create {
# a full URL that may have characters that need encoding.
url_quote => \&Bugzilla::Util::url_quote ,
+ # This filter is similar to url_quote but used a \ instead of a %
+ # as prefix. In addition it replaces a ' ' by a '_'.
+ css_class_quote => \&Bugzilla::Util::css_class_quote ,
+
quoteUrls => \&::quoteUrls ,
bug_link => [ sub {
diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm
index 511ba2592..c0d671744 100644
--- a/Bugzilla/Util.pm
+++ b/Bugzilla/Util.pm
@@ -30,6 +30,7 @@ use strict;
use base qw(Exporter);
@Bugzilla::Util::EXPORT = qw(is_tainted trick_taint detaint_natural
html_quote url_quote value_quote xml_quote
+ css_class_quote
lsearch max min
trim format_time);
@@ -73,6 +74,13 @@ sub url_quote {
return $toencode;
}
+sub css_class_quote {
+ my ($toencode) = (@_);
+ $toencode =~ s/ /_/g;
+ $toencode =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("&#x%x;",ord($1))/eg;
+ return $toencode;
+}
+
sub value_quote {
my ($var) = (@_);
$var =~ s/\&/\&amp;/g;
@@ -260,6 +268,11 @@ replaced with their appropriate HTML entities.
Quotes characters so that they may be included as part of a url.
+=item C<css_class_quote($val)>
+
+Quotes characters so that they may be used as CSS class names. Spaces
+are replaced by underscores.
+
=item C<value_quote($val)>
As well as escaping html like C<html_quote>, this routine converts newlines