| 1 | package App::ZofCMS::Plugin::AntiSpamMailTo; | ||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||
| 6 | 2 | our $VERSION = '1.001010'; # VERSION | |||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use HTML::Entities; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | sub new { bless {}, shift } | ||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | sub process { | ||||||||||||||||||||||||||||||
|
Subroutine
process: called CC=12 SCAR=32.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 13 | 1 | my ( $self, $template, $config ) = @_[0,1,3]; | |||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||
| 15 | return | ||||||||||||||||||||||||||||||||
| 16 | unless $template->{plug_anti_spam_mailto} | ||||||||||||||||||||||||||||||||
| 17 | 1 | ▶ | or $config->conf->{plug_anti_spam_mailto}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$template->{"plug_anti_spam_mailto"} or $config->conf->{"plug_anti_spam_mailto"}
MC/DC0%0/2
$template->{"plug_anti_spam_mailto"} or $config->conf->{"plug_anti_spam_mailto"}
$template->{"plug_anti_spam_mailto"}
$config->conf->{"plug_anti_spam_mailto"}
Truth table33%1/3
A or B
A= $template->{"plug_anti_spam_mailto"}B= $config->conf->{"plug_anti_spam_mailto"}
| |||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||
| 19 | 1 | my $c_data = delete $config->conf->{plug_anti_spam_mailto}; | |||||||||||||||||||||||||||||||
| 20 | 1 | my $t_data = delete $template->{plug_anti_spam_mailto}; | |||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||
| 22 | 1 | my $data; | |||||||||||||||||||||||||||||||
| 23 | 1 | ▶ | if ( defined $c_data and defined $t_data ) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
defined $c_data and defined $t_data
MC/DC0%0/2
defined $c_data and defined $t_data
defined $c_data
defined $t_data
Truth table33%1/3
A and B
A= defined $c_dataB= defined $t_data
| |||||||||||||||||||||||||||||||||
| 24 | 1 | ▶ | if ( ref $c_data ne ref $t_data ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 25 | 0 | $data = $t_data; | |||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||
| 27 | else { | ||||||||||||||||||||||||||||||||
| 28 | 1 | ▶ | $data = ref $t_data eq 'ARRAY' | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 29 | ? $data = [ @$t_data, @$c_data ] | ||||||||||||||||||||||||||||||||
| 30 | : ref $t_data eq 'HASH' | ||||||||||||||||||||||||||||||||
| 31 | ? $data = { %$c_data, %$t_data } | ||||||||||||||||||||||||||||||||
| 32 | : [ $t_data, $c_data ]; | ||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||
| 35 | elsif ( defined $t_data ) { | ||||||||||||||||||||||||||||||||
| 36 | 0 | $data = $t_data; | |||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||
| 38 | else { | ||||||||||||||||||||||||||||||||
| 39 | 0 | $data = $c_data; | |||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||
| 42 | 1 | ▶ | if ( ref $data eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 43 | 0 | $data = { | |||||||||||||||||||||||||||||||
| 44 | map +( "mailto_$_" => $data->[$_] ), | ||||||||||||||||||||||||||||||||
| 45 | 0.. $#$data | ||||||||||||||||||||||||||||||||
| 46 | }; | ||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||
| 48 | elsif ( not ref $data ) { | ||||||||||||||||||||||||||||||||
| 49 | 0 | $data = { 'mailto' => $data }; | |||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||
| 52 | encode_entities $_, '\w\W' | ||||||||||||||||||||||||||||||||
| 53 | 1 | for values %$data; | |||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||
| 55 | 1 | @{ $template->{t} }{ keys %$data } = values %$data; | |||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||
| 57 | 1 | return 1; | |||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||
| 60 | 2 | 1; | |||||||||||||||||||||||||||||||
| 61 | __END__ | ||||||||||||||||||||||||||||||||