| 1 | package CGI::FCKeditor; | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | our $VERSION = '0.02'; | |||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=16.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | my $self = { | |||||||||||||||||||||||||||||||||||||||||||||
| 10 | name => undef, | ||||||||||||||||||||||||||||||||||||||||||||||
| 11 | base => undef, | ||||||||||||||||||||||||||||||||||||||||||||||
| 12 | width => '100%', | ||||||||||||||||||||||||||||||||||||||||||||||
| 13 | height => '500', | ||||||||||||||||||||||||||||||||||||||||||||||
| 14 | set => undef, | ||||||||||||||||||||||||||||||||||||||||||||||
| 15 | value => undef, | ||||||||||||||||||||||||||||||||||||||||||||||
| 16 | fck => undef, | ||||||||||||||||||||||||||||||||||||||||||||||
| 17 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | bless($self, $class); | |||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | my ($name,$base,$set,$value) =@_; | |||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | ▶ | $self->set_name($name || 'fck'); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$name || 'fck'
MC/DC0%0/1
$name || 'fck'
$name
Truth table50%1/2
A
A= $name
| |||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 1 | ▶ | $self->set_base($base || 'FCKeditor'); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$base || 'FCKeditor'
MC/DC0%0/1
$base || 'FCKeditor'
$base
Truth table50%1/2
A
A= $base
| |||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 1 | ▶ | $self->set_set($set || 'Default'); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$set || 'Default'
MC/DC0%0/1
$set || 'Default'
$set
Truth table50%1/2
A
A= $set
| |||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | ▶ | $self->set_value($value || ''); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$value || ''
MC/DC0%0/1
$value || ''
$value
Truth table50%1/2
A
A= $value
| |||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 3 | ▶ | sub set_name { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_name: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 30 | 3 | ▶ | if (@_) { $self->{name} = shift } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 3 | return $self->{name}; | |||||||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 3 | ▶ | sub set_base { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_base: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 36 | 3 | ▶ | if (@_) { $self->{base} = shift } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 3 | return $self->{base}; | |||||||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 2 | ▶ | sub set_width { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_width: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 42 | 2 | ▶ | if (@_) { $self->{width} = shift } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 2 | return $self->{width}; | |||||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 2 | ▶ | sub set_height { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_height: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 48 | 2 | ▶ | if (@_) { $self->{height} = shift } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 2 | return $self->{height}; | |||||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 3 | ▶ | sub set_set { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_set: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 54 | 3 | ▶ | if (@_) { $self->{set} = shift } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 3 | return $self->{set}; | |||||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 3 | ▶ | sub set_value { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_value: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 60 | 3 | ▶ | if (@_) { $self->{value} = shift } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 3 | return $self->{value}; | |||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 1 | ▶ | sub fck { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fck: called CC=12 SCAR=32.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 66 | 1 | my $value = $self->{value}; | |||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||
| 68 | #For HTML Convert | ||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 1 | $value =~ s/&/&/g; # & | |||||||||||||||||||||||||||||||||||||||||||||
| 70 | 1 | $value =~ s/\"/"/g; # " | |||||||||||||||||||||||||||||||||||||||||||||
| 71 | 1 | $value =~ s/\'/'/g; # ' | |||||||||||||||||||||||||||||||||||||||||||||
| 72 | 1 | $value =~ s/</</g; # < | |||||||||||||||||||||||||||||||||||||||||||||
| 73 | 1 | $value =~ s/>/>/g; # > | |||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||
| 75 | #Browser Check | ||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 1 | ▶ | unless ($ENV{'HTTP_USER_AGENT'}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 1 | $ENV{'HTTP_USER_AGENT'} = 'test'; | |||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 1 | my $sAgent = $ENV{'HTTP_USER_AGENT'}; | |||||||||||||||||||||||||||||||||||||||||||||
| 80 | 1 | my $iVersion = undef; | |||||||||||||||||||||||||||||||||||||||||||||
| 81 | 1 | my $uFlag = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 82 | 1 | ▶ | if(($sAgent =~ /MSIE/i) && !($sAgent =~ /mac/i) && !($sAgent =~ /Opera/i)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
$sAgent =~ /MSIE/i and not $sAgent =~ /mac/i and not $sAgent =~ /Opera/i
$sAgent =~ /MSIE/i and not $sAgent =~ /mac/i
MC/DC0%0/3
$sAgent =~ /MSIE/i and not $sAgent =~ /mac/i and not $sAgent =~ /Opera/i
$sAgent =~ /MSIE/i
not $sAgent =~ /mac/i
not $sAgent =~ /Opera/i
Truth table25%1/4
A and not(B) and not(C)
A= $sAgent =~ /MSIE/iB= not $sAgent =~ /mac/iC= not $sAgent =~ /Opera/i
| |||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | $iVersion = substr($sAgent,index($sAgent,'MSIE') + 5,3); | |||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | if ($iVersion >= 5.5){ | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | $uFlag++; | |||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } elsif($sAgent =~ /Gecko\//i) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | $iVersion = substr($sAgent,index($sAgent,'Gecko/') + 6,8); | |||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | if ($iVersion >= 20030210){ | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | $uFlag++; | |||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||
| 94 | #Start Form Render | ||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 1 | my $name = $self->{name}; | |||||||||||||||||||||||||||||||||||||||||||||
| 96 | 1 | my $base = $self->{base}; | |||||||||||||||||||||||||||||||||||||||||||||
| 97 | 1 | my $width = $self->{width}; | |||||||||||||||||||||||||||||||||||||||||||||
| 98 | 1 | my $height = $self->{height}; | |||||||||||||||||||||||||||||||||||||||||||||
| 99 | 1 | my $set = $self->{set}; | |||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 1 | my $Html = '<div>'; | |||||||||||||||||||||||||||||||||||||||||||||
| 102 | 1 | ▶ | if($uFlag) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | my $Link = $base . "editor/fckeditor.html?InstanceName=$name"; | |||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | ▶ | if($set ne '') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | $Link .= "&Toolbar=$set"; | |||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 107 | #// Render the linked hidden field. | ||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | $Html .= "<input type=\"hidden\" id=\"$name\" name=\"$name\" value=\"$value\" style=\"display:none\" />" ; | |||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||
| 110 | #// Render the configurations hidden field. | ||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | my $wk = $name."___Config"; | |||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | $Html .= "<input type=\"hidden\" id=\"$wk\" value=\"\" style=\"display:none\" />" ; | |||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||
| 114 | #// Render the editor IFRAME. | ||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | $wk = $name."___Frame"; | |||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | $Html .= "<iframe id=\"$wk\" src=\"$Link\" width=\"$width\" height=\"$height\" frameborder=\"0\" scrolling=\"no\"></iframe>"; | |||||||||||||||||||||||||||||||||||||||||||||
| 117 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 1 | my $WidthCSS = undef; | |||||||||||||||||||||||||||||||||||||||||||||
| 119 | 1 | my $HeightCSS = undef; | |||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 1 | ▶ | if($width =~ /\%/g){ | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 1 | $WidthCSS = $width; | |||||||||||||||||||||||||||||||||||||||||||||
| 123 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | $WidthCSS = $width . 'px'; | |||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 1 | ▶ | if($height =~ /\%/g){ | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | $HeightCSS = $height; | |||||||||||||||||||||||||||||||||||||||||||||
| 128 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 1 | $HeightCSS = $height . 'px'; | |||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 1 | $Html .= "<textarea name=\"$name\" rows=\"4\" cols=\"40\" style=\"width: $WidthCSS; height: $HeightCSS\">$value</textarea>"; | |||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 1 | $Html .= '</div>'; | |||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 1 | $self->{fck} = $Html; | |||||||||||||||||||||||||||||||||||||||||||||
| 136 | 1 | return $self->{fck}; | |||||||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 140 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||