From 37722eca39874bb6abdcd120e3e458bd62dea62b Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Wed, 5 Jul 2017 11:43:18 -0700 Subject: Bug 1377933 - Remove trailing whitespace from all perl files --- Bugzilla/Template.pm | 56 ++++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'Bugzilla/Template.pm') diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index 5bef599d4..1ad735067 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -17,7 +17,7 @@ use Bugzilla::Bug; use Bugzilla::Constants; use Bugzilla::Hook; use Bugzilla::Install::Requirements; -use Bugzilla::Install::Util qw(install_string template_include_path +use Bugzilla::Install::Util qw(install_string template_include_path include_languages); use Bugzilla::Keyword; use Bugzilla::Util; @@ -84,7 +84,7 @@ sub _load_constants { sub _include_path { my $lang = shift || ''; my $cache = Bugzilla->request_cache; - $cache->{"template_include_path_$lang"} ||= + $cache->{"template_include_path_$lang"} ||= template_include_path({ language => $lang }); return $cache->{"template_include_path_$lang"}; } @@ -180,19 +180,19 @@ sub quoteUrls { if (ref($replace) eq 'CODE') { $text =~ s/$match/($things[$count++] = $replace->({matches => [ $1, $2, $3, $4, - $5, $6, $7, $8, + $5, $6, $7, $8, $9, $10]})) && ("\x{FDD2}" . ($count-1) . "\x{FDD3}")/egx; } else { - $text =~ s/$match/($things[$count++] = $replace) + $text =~ s/$match/($things[$count++] = $replace) && ("\x{FDD2}" . ($count-1) . "\x{FDD3}")/egx; } } # Provide tooltips for full bug links (Bug 74355) my $urlbase_re = '(' . join('|', - map { qr/$_/ } grep($_, Bugzilla->params->{'urlbase'}, + map { qr/$_/ } grep($_, Bugzilla->params->{'urlbase'}, Bugzilla->params->{'sslbase'})) . ')'; $text =~ s~\b(${urlbase_re}\Qshow_bug.cgi?id=\E([0-9]+)(\#c([0-9]+))?)\b ~($things[$count++] = $bug_link_func->($3, $1, { comment_num => $5, user => $user })) && @@ -327,7 +327,7 @@ sub get_bug_link { my $template = Bugzilla->template_inner; my $linkified; - $template->process('bug/link.html.tmpl', + $template->process('bug/link.html.tmpl', { bug => $bug, link_text => $link_text, %$options }, \$linkified); return $linkified; } @@ -556,7 +556,7 @@ sub _concatenate_js { # YUI dependency resolution sub yui_resolve_deps { my ($yui, $yui_deps) = @_; - + my @yui_resolved; foreach my $yui_name (@$yui) { my $deps = $yui_deps->{$yui_name} || []; @@ -584,8 +584,8 @@ use Template::Stash; # Allow keys to start with an underscore or a dot. $Template::Stash::PRIVATE = undef; -# Add "contains***" methods to list variables that search for one or more -# items in a list and return boolean values representing whether or not +# Add "contains***" methods to list variables that search for one or more +# items in a list and return boolean values representing whether or not # one/all/any item(s) were found. $Template::Stash::LIST_OPS->{ contains } = sub { @@ -600,7 +600,7 @@ $Template::Stash::LIST_OPS->{ contains } = $Template::Stash::LIST_OPS->{ containsany } = sub { my ($list, $items) = @_; - foreach my $item (@$items) { + foreach my $item (@$items) { if (ref $item && $item->isa('Bugzilla::Object')) { return 1 if grep($_->id == $item->id, @$list); } else { @@ -619,14 +619,14 @@ $Template::Stash::LIST_OPS->{ clone } = # Allow us to still get the scalar if we use the list operation ".0" on it, # as we often do for defaults in query.cgi and other places. -$Template::Stash::SCALAR_OPS->{ 0 } = +$Template::Stash::SCALAR_OPS->{ 0 } = sub { return $_[0]; }; # Add a "truncate" method to the Template Toolkit's "scalar" object # that truncates a string to a certain length. -$Template::Stash::SCALAR_OPS->{ truncate } = +$Template::Stash::SCALAR_OPS->{ truncate } = sub { my ($string, $length, $ellipsis) = @_; return $string if !$length || length($string) <= $length; @@ -676,7 +676,7 @@ sub create { my $config = { # Colon-separated list of directories containing templates. - INCLUDE_PATH => $opts{'include_path'} + INCLUDE_PATH => $opts{'include_path'} || _include_path($opts{'language'}), # allow PERL/RAWPERL because doing so can boost performance @@ -757,7 +757,7 @@ sub create { return $var; }, - # Sadly, different to the above. See http://www.json.org/ + # Sadly, different to the above. See http://www.json.org/ # for details. json => sub { my ($var) = @_; @@ -768,7 +768,7 @@ sub create { $var =~ s/\t/\\t/g; return $var; }, - + # Converts data to base64 base64 => sub { my ($data) = @_; @@ -778,14 +778,14 @@ sub create { # Strips out control characters excepting whitespace strip_control_chars => sub { my ($data) = @_; - # Only run for utf8 to avoid issues with other multibyte encodings + # Only run for utf8 to avoid issues with other multibyte encodings # that may be reassigning meaning to ascii characters. if (Bugzilla->params->{'utf8'}) { $data =~ s/(?![\t\r\n])[[:cntrl:]]//g; } return $data; }, - + # HTML collapses newlines in element attributes to a single space, # so form elements which may have whitespace (ie comments) need # to be encoded using @@ -873,7 +873,7 @@ sub create { if ($data < 1024) { return "$data bytes"; - } + } else { my $u; foreach $u ('GB', 'MB', 'KB') { @@ -919,7 +919,7 @@ sub create { } else { $output = $var; } - + $output =~ s/(.{75,75})/$1\n /g; return $output; @@ -964,7 +964,7 @@ sub create { }, 1], # We force filtering of every variable in key security-critical - # places; we have a none filter for people to use when they + # places; we have a none filter for people to use when they # really, really don't want a variable to be changed. none => sub { return $_[0]; } , }, @@ -1039,7 +1039,7 @@ sub create { 'urlbase' => sub { return Bugzilla::Util::correct_urlbase(); }, # Allow templates to access docs url with users' preferred language - 'docs_urlbase' => sub { + 'docs_urlbase' => sub { my $language = Bugzilla->current_language; my $docs_urlbase = Bugzilla->params->{'docs_urlbase'}; $docs_urlbase =~ s/\%lang\%/$language/; @@ -1152,7 +1152,7 @@ sub create { : 'Bugzilla::Template::Context'; Bugzilla::Hook::process('template_before_create', { config => $config }); - my $template = $class->new($config) + my $template = $class->new($config) || die("Template creation failed: " . $class->error()); # BMO - hook for defining new vmethods, etc @@ -1184,10 +1184,10 @@ sub precompile_templates { # into data/deleteme/. if (-e $cache_dir) { my $deleteme = "$datadir/deleteme"; - + print STDERR "\n\n", - install_string('template_removal_failed', - { deleteme => $deleteme, + install_string('template_removal_failed', + { deleteme => $deleteme, template_cache => $cache_dir }), "\n\n"; mkpath($deleteme); my $random = generate_random_password(); @@ -1218,7 +1218,7 @@ sub precompile_templates { } # Under mod_perl, we look for templates using the absolute path of the - # template directory, which causes Template Toolkit to look for their + # template directory, which causes Template Toolkit to look for their # *compiled* versions using the full absolute path under the data/template # directory. (Like data/template/var/www/html/bugzilla/.) To avoid # re-compiling templates under mod_perl, we symlink to the @@ -1267,8 +1267,8 @@ sub _do_template_symlink { # Check if the directory exists, because if there are no extensions, # there won't be an "data/template/extensions" directory to link to. if (-d $target) { - # We use abs2rel so that the symlink will look like - # "../../../../template" which works, while just + # We use abs2rel so that the symlink will look like + # "../../../../template" which works, while just # "data/template/template/" doesn't work. my $relative_target = File::Spec->abs2rel($target, $container); -- cgit v1.2.3-24-g4f1b