line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MojoMojo::Formatter::Emote; |
2
|
|
|
|
|
|
|
|
3
|
26
|
|
|
26
|
|
11123
|
eval "use Text::Emoticon::MSN"; |
|
26
|
|
|
|
|
33425
|
|
|
26
|
|
|
|
|
197
|
|
4
|
|
|
|
|
|
|
my $eval_res = $@; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head2 module_loaded |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Return true if the module is loaded. |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=cut |
11
|
|
|
|
|
|
|
|
12
|
124
|
50
|
|
124
|
1
|
923
|
sub module_loaded { $eval_res ? 0 : 1 } |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
MojoMojo::Formatter::Emote - MSN Smileys in your text. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 DESCRIPTION |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
This formatter transforms the full range of MSN Smileys into |
23
|
|
|
|
|
|
|
bitmaps on your page, using L<Text::Emoticon::MSN>. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 METHODS |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head2 format_content_order |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Format order can be 1-99. The Emote formatter runs on 95. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
248
|
|
|
248
|
1
|
1526
|
sub format_content_order { 95 } |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 format_content |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Calls the formatter. Takes a ref to the content as well as the |
38
|
|
|
|
|
|
|
context object. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub format_content { |
43
|
124
|
|
|
124
|
1
|
1081
|
my ($class, $content, $c)=@_; |
44
|
124
|
50
|
33
|
|
|
543
|
return unless $class->module_loaded && $c->pref('enable_emoticons'); |
45
|
0
|
|
|
|
|
|
my $emoticon = Text::Emoticon::MSN->new( |
46
|
|
|
|
|
|
|
imgbase => $c->req->base.'/.static/emote', |
47
|
|
|
|
|
|
|
xhtml => 1, strict => 1 |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
# Let textile handle the rest |
50
|
0
|
|
|
|
|
|
$$content = $emoticon->filter( $$content ); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 SEE ALSO |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
L<MojoMojo>, L<Module::Pluggable::Ordered>, L<Text::Emoticon::MSN> |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 AUTHORS |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Marcus Ramberg <mramberg@cpan.org> |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 LICENSE |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
This library is free software. You can redistribute it and/or modify |
64
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |