1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: Image Preview |
---|
4 | Version: auto |
---|
5 | Description: give an image preview when the mouve is over a thumbnail |
---|
6 | Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid= |
---|
7 | Author: Flop25 |
---|
8 | Author URI: http://www.planete-flop.fr/ |
---|
9 | */ |
---|
10 | |
---|
11 | /** thumbnails.tpl **/ |
---|
12 | add_event_handler('loc_end_index_thumbnails', 'imgpreview_thumbnails'); |
---|
13 | function imgpreview_thumbnails($tpl_thumbnails_var) |
---|
14 | { |
---|
15 | global $template; |
---|
16 | $template->set_prefilter('index_thumbnails', 'imgpreview_prefilter_thumbnails'); |
---|
17 | $template->set_prefilter('stuffs', 'imgpreview_prefilter_thumbnails'); |
---|
18 | /* |
---|
19 | $UrlJs = get_root_url().'plugins/imgpreview/js/imgpreview.js'; |
---|
20 | $UrlCss = get_root_url().'plugins/imgpreview/css/imgpreview.css'; |
---|
21 | $template->append( |
---|
22 | 'head_elements', |
---|
23 | '<script type="text/javascript" src="'.$UrlJs.'"></script>'."\n". |
---|
24 | "\t".'<link rel="stylesheet" type="text/css" href="'.$UrlCss.'">'."\n" |
---|
25 | ); |
---|
26 | $template->append( |
---|
27 | 'footer_elements', |
---|
28 | '<script type="text/javascript" src="'.get_root_url().'plugins/imgpreview/js/init.js"></script>'."\n" |
---|
29 | ); |
---|
30 | */ |
---|
31 | $dir=dirname(__FILE__).'/css_js.tpl'; |
---|
32 | $template->set_filenames(array( |
---|
33 | 'imgpreview_css_js' => realpath($dir), |
---|
34 | ) ); |
---|
35 | //die('_'.realpath($dir).'_'); |
---|
36 | //$imgpreview_css_js = $template->parse('imgpreview_css_js', true); |
---|
37 | $template->assign_var_from_handle('IMGPREVIEW', 'imgpreview_css_js'); |
---|
38 | |
---|
39 | //define('IMGPREVIEW',$imgpreview_css_js); |
---|
40 | //die(IMGPREVIEW); |
---|
41 | return $tpl_thumbnails_var; |
---|
42 | } |
---|
43 | |
---|
44 | function imgpreview_prefilter_thumbnails($content, &$smarty) |
---|
45 | { |
---|
46 | global $template; |
---|
47 | $search = 'href="{$thumbnail.URL}"'; |
---|
48 | |
---|
49 | $replacement = 'href="{$thumbnail.URL}" imgsrc="{$thumbnail.FILE_PATH}"'; |
---|
50 | |
---|
51 | $content= str_replace($search, $replacement, $content); |
---|
52 | |
---|
53 | $content='{$IMGPREVIEW}'.$content; |
---|
54 | return $content; |
---|
55 | } |
---|
56 | ?> |
---|