| 1 | package MojoMojo::Formatter::Emote; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 26 | ▶ | eval "use Text::Emoticon::MSN"; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 26 | my $eval_res = $@; | |||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | =head2 module_loaded | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | Return true if the module is loaded. | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | =cut | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 124 | ▶ | sub module_loaded { $eval_res ? 0 : 1 } | ||||||||||||||||||||||||||
|
Subroutine
module_loaded: called CC=2 SCAR=7.6
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 26 | 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 | ▶ | sub format_content_order { 95 } | ||||||||||||||||||||||||||
|
Subroutine
format_content_order: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 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 | 124 | ▶ | sub format_content { | ||||||||||||||||||||||||||
|
Subroutine
format_content: called CC=3 SCAR=15.1
Pod
documented
| |||||||||||||||||||||||||||||
| 43 | 124 | my ($class, $content, $c)=@_; | |||||||||||||||||||||||||||
| 44 | 124 | ▶ | return unless $class->module_loaded && $c->pref('enable_emoticons'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$class->module_loaded and $c->pref("enable_emoticons")
MC/DC0%0/2
$class->module_loaded and $c->pref("enable_emoticons")
$class->module_loaded
$c->pref("enable_emoticons")
Truth table33%1/3
A and B
A= $class->module_loadedB= $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 | 26 | 1; | |||||||||||||||||||||||||||