echoing TT fix into H::T::E for variable renaming
This commit is contained in:
parent
443c5cf405
commit
4285ee1e9c
2 changed files with 16 additions and 14 deletions
|
|
@ -1,4 +1,5 @@
|
|||
7.3.8
|
||||
- Fixed a template variable rewriting problem with HTML::Template::Expr
|
||||
- Added a attachment_thumbnail option to the CS RSS feed.
|
||||
|
||||
7.3.7
|
||||
|
|
|
|||
|
|
@ -21,21 +21,22 @@ use HTML::Template::Expr;
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub _rewriteVars { # replace dots with underscrores in keys (except in keys that aren't usable as variables (URLs etc.))
|
||||
my $vars = shift;
|
||||
foreach my $key (keys %$vars){
|
||||
my $newKey = $key;
|
||||
$newKey =~ s/\./_/g if $newKey !~ /\//;
|
||||
if(ref $vars->{$key} eq 'HASH'){
|
||||
$vars->{$newKey} = _rewriteVars($vars->{$key});
|
||||
delete $vars->{$key} if($key ne $newKey);
|
||||
}else{
|
||||
if($key ne $newKey){
|
||||
$vars->{$newKey} = $vars->{$key};
|
||||
delete $vars->{$key};
|
||||
my $vars = shift;
|
||||
my $newVars = {};
|
||||
foreach my $key (keys %$vars){
|
||||
my $newKey = $key;
|
||||
$newKey =~ s/\./_/g if $newKey !~ /\//;
|
||||
if ( ref $vars->{$key} eq 'ARRAY') {
|
||||
foreach my $entry (@{$vars->{$key}}) {
|
||||
push(@{$newVars->{$newKey}}, _rewriteVars($entry));
|
||||
}
|
||||
}
|
||||
}
|
||||
return $vars;
|
||||
} elsif(ref $vars->{$key} eq 'HASH') {
|
||||
$newVars->{$newKey} = _rewriteVars($vars->{$key});
|
||||
} else {
|
||||
$newVars->{$newKey} = $vars->{$key};
|
||||
}
|
||||
}
|
||||
return $newVars;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue