source: extensions/File_Uploader/plugin_pdf2tab/include/picture.inc.php @ 24623

Last change on this file since 24623 was 19821, checked in by julien1311, 12 years ago

[file_uploader] pdf2tab update

  • Property svn:eol-style set to LF
File size: 1.2 KB
Line 
1<?php
2add_event_handler('render_element_content','file_uploader_pdf2tab_add_links_picture',EVENT_HANDLER_PRIORITY_NEUTRAL+10,2);
3
4function file_uploader_pdf2tab_add_links_picture($content, $element_info) {
5        global $conf;
6       
7        $conf_file_uploader = unserialize($conf['file_uploader']);
8       
9        if (in_array(strtolower(substr(strrchr($element_info['file'], "."),1)), $conf_file_uploader['pdf2tab_extensions'])) {
10                $content = file_uploader_pdf2tab_add_link_image($content, $element_info);
11                $content = file_uploader_pdf2tab_add_link_beside_image($content, $element_info);
12        }
13       
14        return $content;
15}
16
17function file_uploader_pdf2tab_add_link_image($content, $element_info) {
18        preg_match('/<\s*img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i',$content,$match);
19        $content = str_replace($match[0],'<a href="'.$element_info['element_url'].'" target="_blank" title="'.l10n('file_uploader_pdf2tab_tooltip').'">'.$match[0].'</a>',$content);
20       
21        return $content;
22}
23
24function file_uploader_pdf2tab_add_link_beside_image($content, $element_info) {
25        $content .= '<p class="imageComment"><a href="'.$element_info['element_url'].'" target="_blank" title="'.l10n('file_uploader_pdf2tab_tooltip').'">'.l10n('file_uploader_pdf2tab_tooltip').'</a>';
26       
27        return $content;
28}
29?>
Note: See TracBrowser for help on using the repository browser.