CDN: perltidy on new/changed code

This commit is contained in:
Randall Schwartz 2009-05-14 00:35:41 +00:00
parent d309dbce6a
commit 2fc4f3b54d
6 changed files with 291 additions and 279 deletions

View file

@ -42,6 +42,18 @@ These methods are available from this class:
=cut
#-------------------------------------------------------------------
=head2 DESTROY ( )
Deconstructor.
=cut
sub DESTROY {
my $self = shift;
undef $self;
}
#-------------------------------------------------------------------
@ -56,28 +68,14 @@ Hex value to convert to guid.
=cut
sub fromHex {
my $self = shift;
my $self = shift;
my $hexId = shift;
my $binId = pack('H2' x 16, unpack('A2' x 16, $hexId));
my $id = substr(encode_base64($binId), 0, 22);
my $binId = pack( 'H2' x 16, unpack( 'A2' x 16, $hexId ) );
my $id = substr( encode_base64($binId), 0, 22 );
$id =~ tr{+/}{_-};
return $id;
}
#-------------------------------------------------------------------
=head2 DESTROY ( )
Deconstructor.
=cut
sub DESTROY {
my $self = shift;
undef $self;
}
#-------------------------------------------------------------------
=head2 getValidator

View file

@ -142,25 +142,28 @@ consecutive slashes in the path part of the URL will be replaced with a single s
=cut
sub extras {
my $self = shift;
my $path = shift;
my $url = $self->session->config->get("extrasURL");
my $self = shift;
my $path = shift;
my $url = $self->session->config->get("extrasURL");
my $cdnCfg = $self->session->config->get('cdn');
if ($cdnCfg and $cdnCfg->{'enabled'} and $cdnCfg->{'extrasCdn'}) {
unless ($path and grep $path =~ m/$_/, @{$cdnCfg->{'extrasExclude'}}) {
if ($cdnCfg->{'extrasSsl'} and
($self->session->env->get('HTTPS') eq 'on' or
$self->session->env->get('SSLPROXY'))) {
$url = $cdnCfg->{'extrasSsl'};
} else {
$url = $cdnCfg->{'extrasCdn'};
}
} # if excluded, stick with regular extrasURL
if ( $cdnCfg and $cdnCfg->{'enabled'} and $cdnCfg->{'extrasCdn'} ) {
unless ( $path and grep $path =~ m/$_/, @{ $cdnCfg->{'extrasExclude'} } ) {
if ($cdnCfg->{'extrasSsl'}
and ( $self->session->env->get('HTTPS') eq 'on'
or $self->session->env->get('SSLPROXY') )
)
{
$url = $cdnCfg->{'extrasSsl'};
}
else {
$url = $cdnCfg->{'extrasCdn'};
}
} # if excluded, stick with regular extrasURL
}
$url .= '/' . $path;
$url =~ s$(?<!:)/{2,}$/$g; ##Remove //, unless it's after a :, which can't be a valid URL character
$url =~ s$(?<!:)/{2,}$/$g; ##Remove //, unless it's after a :, which can't be a valid URL character
return $url;
}
} ## end sub extras
#-------------------------------------------------------------------