View | Details | Raw Unified | Return to bug 12758
Collapse All | Expand All

(-)a/Koha/XSLT/Loader.pm (-1 / +68 lines)
Line 0 Link Here
0
- 
1
package Koha::XSLT::Loader;
2
3
# Copyright 2022 Rijksmuseum
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
=head1 NAME
21
22
Koha::XSLT::Loader - Helper module to resolve issues with https stylesheets
23
24
=head1 SYNOPSIS
25
26
    Koha::XSLT::Loader->load( $filename, $string ); # returns { string => $xslt_code }
27
        # where the $xslt_code will no longer contain https references
28
29
=head1 DESCRIPTION
30
31
    TODO Add some nice text
32
33
=cut
34
35
use Modern::Perl;
36
37
use base qw(Class::Accessor);
38
39
=head1 METHODS
40
41
=head2 load
42
43
sub load {
44
    my ( $class, $filename, $code ) = @_;
45
46
    # TODO If you got code, check for https refs. If so, get them and
47
    # turn into local file references. Cache them?
48
    # Always return a string here.
49
50
    # TODO If you got filename, get the code. And go back to step 1.
51
52
#    my $https_code = $self->_https_workaround( $filename, $code );
53
#    return $https_code || $_[1]?
54
#        { 'string' => $https_code // $_[1] }: { 'location' => $_[0]//'' };
55
}
56
57
58
59
#sub _https_workaround { # Routine added for bug 12758 (part 1)
60
#    my ( $self, $file, $code ) = @_;
61
#    return if $file!~/^https/i;
62
#    require LWP::UserAgent;
63
#    my $ua = LWP::UserAgent->new( ssl_opts => { verify_hostname => 0 } );
64
#    my $resp = $ua->get( $file );
65
#    return $resp->decoded_content if $resp->is_success; #undef otherwise
66
#}
67
68
1;

Return to bug 12758