line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::SocialMeta::OpenGraph; |
2
|
5
|
|
|
5
|
|
17
|
use Moo; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
22
|
|
3
|
5
|
|
|
5
|
|
937
|
use Carp; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
1862
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.6'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
extends 'HTML::SocialMeta::Base'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# Provider Specific Fields |
10
|
|
|
|
|
|
|
has 'meta_attribute' => ( is => 'ro', default => 'property' ); |
11
|
|
|
|
|
|
|
has 'meta_namespace' => ( is => 'ro', default => 'og' ); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has 'fb_namespace' => ( is => 'rw', lazy => 1, default => q{} ); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has '+card_options' => ( |
16
|
|
|
|
|
|
|
default => sub { |
17
|
|
|
|
|
|
|
return { |
18
|
|
|
|
|
|
|
summary => q(create_thumbnail), |
19
|
|
|
|
|
|
|
featured_image => q(create_article), |
20
|
|
|
|
|
|
|
player => q(create_video), |
21
|
|
|
|
|
|
|
app => q(create_product), |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
}, |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has '+build_fields' => ( |
27
|
|
|
|
|
|
|
default => sub { |
28
|
|
|
|
|
|
|
return { |
29
|
|
|
|
|
|
|
thumbnail => |
30
|
|
|
|
|
|
|
[qw(type title description url image site_name fb_app_id)], |
31
|
|
|
|
|
|
|
article => |
32
|
|
|
|
|
|
|
[qw(type title description url image site_name fb_app_id)], |
33
|
|
|
|
|
|
|
video => [ |
34
|
|
|
|
|
|
|
qw(type site_name url title image description player player_width player_height fb_app_id) |
35
|
|
|
|
|
|
|
], |
36
|
|
|
|
|
|
|
product => [qw(type title image description url fb_app_id)] |
37
|
|
|
|
|
|
|
}; |
38
|
|
|
|
|
|
|
}, |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub create_thumbnail { |
42
|
3
|
|
|
3
|
1
|
22
|
my ($self) = @_; |
43
|
|
|
|
|
|
|
|
44
|
3
|
|
|
|
|
38
|
$self->type('thumbnail'); |
45
|
|
|
|
|
|
|
|
46
|
3
|
|
|
|
|
388
|
return $self->build_meta_tags( $self->type ); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub create_article { |
50
|
4
|
|
|
4
|
1
|
78
|
my ($self) = @_; |
51
|
|
|
|
|
|
|
|
52
|
4
|
|
|
|
|
42
|
$self->type('article'); |
53
|
|
|
|
|
|
|
|
54
|
4
|
|
|
|
|
645
|
return $self->build_meta_tags( $self->type ); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub create_video { |
58
|
3
|
|
|
3
|
1
|
36
|
my ($self) = @_; |
59
|
|
|
|
|
|
|
|
60
|
3
|
|
|
|
|
70
|
$self->type('video'); |
61
|
|
|
|
|
|
|
|
62
|
3
|
|
|
|
|
47
|
return $self->build_meta_tags( $self->type ); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub create_product { |
66
|
3
|
|
|
3
|
1
|
3
|
my ($self) = @_; |
67
|
|
|
|
|
|
|
|
68
|
3
|
|
|
|
|
41
|
$self->type('product'); |
69
|
|
|
|
|
|
|
|
70
|
3
|
|
|
|
|
46
|
return $self->build_meta_tags( $self->type ); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub provider_convert { |
74
|
21
|
|
|
21
|
0
|
19
|
my ( $self, $field ) = @_; |
75
|
|
|
|
|
|
|
|
76
|
21
|
100
|
|
|
|
59
|
if ( $field =~ s{^fb:}{}xms ) { |
77
|
12
|
|
|
|
|
21
|
$field =~ s{:}{_}xms; |
78
|
|
|
|
|
|
|
|
79
|
12
|
|
|
|
|
58
|
return [ { field_type => $field, ignore_meta_namespace => 'fb' } ]; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
9
|
|
|
|
|
21
|
$field =~ s{^player}{video}xms; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
return [ |
85
|
9
|
100
|
|
|
|
30
|
{ field_type => $field . ':url' }, |
86
|
|
|
|
|
|
|
{ field_type => $field . ':secure_url' } |
87
|
|
|
|
|
|
|
] |
88
|
|
|
|
|
|
|
if $field =~ m{^video$}xms; |
89
|
|
|
|
|
|
|
|
90
|
6
|
|
|
|
|
20
|
return [ { field_type => $field } ]; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
# |
94
|
|
|
|
|
|
|
# The End |
95
|
|
|
|
|
|
|
# |
96
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
1; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
__END__ |