Lines 114-132
sub output {
Link Here
|
114 |
C4::Context->preference('opaclayoutstylesheet'); |
114 |
C4::Context->preference('opaclayoutstylesheet'); |
115 |
|
115 |
|
116 |
# add variables set via param to $vars for processing |
116 |
# add variables set via param to $vars for processing |
117 |
# and clean any utf8 mess |
|
|
118 |
for my $k ( keys %{ $self->{VARS} } ) { |
117 |
for my $k ( keys %{ $self->{VARS} } ) { |
119 |
$vars->{$k} = $self->{VARS}->{$k}; |
118 |
$vars->{$k} = $self->{VARS}->{$k}; |
120 |
if (ref($vars->{$k}) eq 'ARRAY'){ |
|
|
121 |
utf8_arrayref($vars->{$k}); |
122 |
} |
123 |
elsif (ref($vars->{$k}) eq 'HASH'){ |
124 |
utf8_hashref($vars->{$k}); |
125 |
} |
126 |
else { |
127 |
utf8::encode($vars->{$k}) if utf8::is_utf8($vars->{$k}); |
128 |
} |
129 |
} |
119 |
} |
|
|
120 |
|
130 |
my $data; |
121 |
my $data; |
131 |
binmode( STDOUT, ":utf8" ); |
122 |
binmode( STDOUT, ":utf8" ); |
132 |
$template->process( $self->filename, $vars, \$data ) |
123 |
$template->process( $self->filename, $vars, \$data ) |
Lines 134-169
sub output {
Link Here
|
134 |
return $data; |
125 |
return $data; |
135 |
} |
126 |
} |
136 |
|
127 |
|
137 |
sub utf8_arrayref { |
|
|
138 |
my $arrayref = shift; |
139 |
foreach my $element (@$arrayref){ |
140 |
if (ref($element) eq 'ARRAY'){ |
141 |
utf8_arrayref($element); |
142 |
next; |
143 |
} |
144 |
if (ref($element) eq 'HASH'){ |
145 |
utf8_hashref($element); |
146 |
next; |
147 |
} |
148 |
utf8::encode($element) if utf8::is_utf8($element); |
149 |
} |
150 |
} |
151 |
|
152 |
sub utf8_hashref { |
153 |
my $hashref = shift; |
154 |
for my $key (keys %{$hashref}){ |
155 |
if (ref($hashref->{$key}) eq 'ARRAY'){ |
156 |
utf8_arrayref($hashref->{$key}); |
157 |
next; |
158 |
} |
159 |
if (ref($hashref->{$key}) eq 'HASH'){ |
160 |
utf8_hashref($hashref->{$key}); |
161 |
next; |
162 |
} |
163 |
utf8::encode($hashref->{$key}) if utf8::is_utf8($hashref->{$key}); |
164 |
} |
165 |
} |
166 |
|
167 |
# wrapper method to allow easier transition from HTML template pro to Template Toolkit |
128 |
# wrapper method to allow easier transition from HTML template pro to Template Toolkit |
168 |
sub param { |
129 |
sub param { |
169 |
my $self = shift; |
130 |
my $self = shift; |
170 |
- |
|
|