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