Changeset 9926 for lang/perl/Moxy/branches
- Timestamp:
- 04/20/08 01:11:02 (5 years ago)
- Location:
- lang/perl/Moxy/branches/CC
- Files:
-
- 2 modified
-
config.yaml (modified) (1 diff)
-
lib/Moxy/Plugin/Filter/FlashUseImgTag.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/Moxy/branches/CC/config.yaml
r9923 r9926 23 23 - module: Filter::CookieCutter 24 24 - module: Filter::HTTPHeader 25 #- module: Filter::FlashUseImgTag25 - module: Filter::FlashUseImgTag 26 26 # - module: Filter::QRCode::Imager 27 27 # - module: Filter::GPS -
lang/perl/Moxy/branches/CC/lib/Moxy/Plugin/Filter/FlashUseImgTag.pm
r5041 r9926 6 6 use HTML::Parser; 7 7 8 sub register{9 my ( $class, $context) = @_;8 sub e: Hook('response_filter_E') { 9 my ( $self, $context, $args ) = @_; 10 10 11 $context->register_hook( 12 response_filter_E => sub { 13 my ( $context, $args ) = @_; 11 # only for html. 12 return unless (($args->{response}->header('Content-Type')||'') =~ /html/); 14 13 15 # only for html. 16 return unless (($args->{response}->header('Content-Type')||'') =~ /html/); 14 my $output = ''; 15 my $parser = HTML::Parser->new( 16 api_version => 3, 17 start_h => [ sub { 18 my ($tagname, $attr, $orig) = @_; 17 19 18 my $output = ''; 19 my $parser = HTML::Parser->new( 20 api_version => 3, 21 start_h => [ sub { 22 my ($tagname, $attr, $orig) = @_; 20 if ($tagname =~ /^img$/i && $attr->{src} =~ /\.swf$/) { 21 $output .= qq| 22 <object data="@{[$attr->{src}]}" width="@{[$attr->{width}]}" height="@{[$attr->{height}]}" 23 type="application/x-shockwave-flash"> 24 <param name="bgcolor" value="#ffffff" /> 25 <param name="loop" value="off" /> 26 <param name="quality" value="high" /> 27 <param name="salign" value="t" /> 28 </object> 29 |; 30 } else { 31 $output .= $orig; 32 return; 33 } 23 34 24 if ($tagname =~ /^img$/i && $attr->{src} =~ /\.swf$/) { 25 $output .= qq| 26 <object data="@{[$attr->{src}]}" width="@{[$attr->{width}]}" height="@{[$attr->{height}]}" 27 type="application/x-shockwave-flash"> 28 <param name="bgcolor" value="#ffffff" /> 29 <param name="loop" value="off" /> 30 <param name="quality" value="high" /> 31 <param name="salign" value="t" /> 32 </object> 33 |; 34 } else { 35 $output .= $orig; 36 return; 37 } 35 }, "tagname, attr, text" ], 36 end_h => [ sub { $output .= shift }, "text"], 37 text_h => [ sub { $output .= shift }, "text"], 38 ); 38 39 39 }, "tagname, attr, text" ], 40 end_h => [ sub { $output .= shift }, "text"], 41 text_h => [ sub { $output .= shift }, "text"], 42 ); 40 $parser->boolean_attribute_value('__BOOLEAN__'); 41 $parser->parse( $args->{response}->content ); 43 42 44 $parser->boolean_attribute_value('__BOOLEAN__'); 45 $parser->parse(${ $args->{content_ref} }); 46 47 ${ $args->{content_ref} } = $output; 48 } 49 ); 43 $args->{response}->content( $output ); 50 44 } 51 45
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)