source: extensions/pdf2tab/picture.php @ 19451

Last change on this file since 19451 was 19332, checked in by julien1311, 11 years ago

add tooltip

  • Property svn:eol-style set to LF
File size: 566 bytes
Line 
1<?php
2add_event_handler('render_element_content','pdf2tab_add_tag_picture',EVENT_HANDLER_PRIORITY_NEUTRAL+10,2);
3
4load_language('plugin.lang', PDF2TAB_PATH);
5
6function pdf2tab_add_tag_picture($content, $element_info) {
7        if (strrchr($element_info['file'], ".") == ".pdf") {
8                preg_match('/<\s*img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i',$content,$match);
9               
10                $content = str_replace($match[0],'<a href="'.$element_info['element_url'].'" target="_blank" title="'.l10n('Open the file in a new tab').'">'.$match[0].'</a>',$content);
11        }
12       
13        return $content;
14}
15?>
Note: See TracBrowser for help on using the repository browser.