Created
November 18, 2009 08:35
-
-
Save sinkovsky/237657 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sub _hdlr_entry_body_has_image { | |
| my($ctx, $args, $cond) = @_; | |
| return 0 if (!$ctx->stash('entry')); | |
| my $entry_text = &MT::Template::Context::_hdlr_entry_body; | |
| my @paragraphs = split(/<p[^>]*>/i, $entry_text); | |
| ## just checking for img tag in the | |
| ## first three paragraphs, skip first array element, | |
| ## because of that element is fake element | |
| ## (because of specialities split function) | |
| foreach (@paragraphs[1..3]) { | |
| return 1 if (/<img[^>]*>/i); | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment