Changeset 19295


Ignore:
Timestamp:
Dec 6, 2012, 12:15:39 AM (11 years ago)
Author:
julien1311
Message:

manage picture.php
language files

Location:
extensions/pdf2tab
Files:
11 added
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/pdf2tab/picture.php

    r19287 r19295  
    11<?php
    2 add_event_handler('loc_after_page_header', 'pdf2tab_picture');
     2add_event_handler('render_element_content','pdf2tab_add_tag_picture',EVENT_HANDLER_PRIORITY_NEUTRAL+10,2);
    33
    4 function pdf2tab_picture() {
    5         global $template;
     4function pdf2tab_add_tag_picture($content, $element_info) {
     5        preg_match('/<\s*img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i',$content,$match);
    66       
    7         $template->set_prefilter('picture_content', 'pdf2tab_add_tag_picture');
     7        $content = str_replace($match[0],'<a href="'.$element_info['element_url'].'" target="_blank">'.$match[0].'</a>',$content);
    88       
    9         $template->set_filename('pdf2tab_template_picture', dirname(__FILE__).'/template/pdf2tab_picture.tpl');
    10         $template->concat('PLUGIN_INDEX_CONTENT_END', $template->parse('pdf2tab_template_picture', true));
    11 }
    12 
    13 function pdf2tab_add_tag_picture($content, &$smarty) {
    14         global $template;
    15        
    16         $search = 'id="theMainImage"';
    17        
    18         $replacement = 'id="theMainImage" pdf2tab="{$thumbnail.path}"';
    19         $content= str_replace($search, $replacement, $content);
    20 
    219        return $content;
    2210}
Note: See TracChangeset for help on using the changeset viewer.