[3298] | 1 | <?php |
---|
| 2 | |
---|
[5735] | 3 | global $page, $conf, $template, $user; |
---|
[3298] | 4 | |
---|
| 5 | include_once(LIGHTBOX_PATH.'functions.inc.php'); |
---|
| 6 | $params = unserialize($conf['lightbox']); |
---|
| 7 | $conf['lightbox_rel'] = isset($conf['lightbox_rel']) ? ++$conf['lightbox_rel'] : 0; |
---|
[7252] | 8 | $selector = 'a[rel=colorbox'.$conf['lightbox_rel'].']'; |
---|
[3298] | 9 | |
---|
[17139] | 10 | $template->func_combine_script(array('id'=>'jquery.colorbox', 'path'=>'plugins/lightbox/js/jquery.colorbox.js')); |
---|
| 11 | $template->func_combine_script(array('id'=>'core.scripts', 'path'=>'themes/default/js/scripts.js')); |
---|
| 12 | $template->func_combine_css(array('path'=>'plugins/lightbox/theme/'.$params['theme'].'/colorbox.css')); |
---|
[10078] | 13 | $template->block_html_head('',' |
---|
| 14 | <script type="text/javascript"> |
---|
[12704] | 15 | function PWG_Colorbox() { |
---|
[9977] | 16 | jQuery("'.$selector.'").attr("href", function () { |
---|
| 17 | return this.name; |
---|
[3298] | 18 | }); |
---|
[9977] | 19 | jQuery("'.$selector.'").colorbox({ |
---|
| 20 | current: "", |
---|
| 21 | transition: "'.$params['transition'].'", |
---|
| 22 | speed: "'.$params['transition_speed'].'", |
---|
| 23 | initialWidth: "'.(!empty($params['initial_width']) ? $params['initial_width'] : $config_default['initial_width']).'", |
---|
| 24 | initialHeight: "'.(!empty($params['initial_height']) ? $params['initial_height'] : $config_default['initial_height']).'", |
---|
| 25 | width: '.(!empty($params['fixed_width']) ? '"'.$params['fixed_width'].'"' : 'false').', |
---|
| 26 | height: '.(!empty($params['fixed_height']) ? '"'.$params['fixed_height'].'"' : 'false').' |
---|
| 27 | }, |
---|
| 28 | function() { |
---|
| 29 | jQuery.post("'.get_root_url().'plugins/lightbox/save_history.php", { |
---|
| 30 | imgid: this.id, |
---|
| 31 | catid: "'.@$page['category']['id'].'", |
---|
| 32 | section: "'.@$page['section'].'", |
---|
| 33 | tagids: "'.@implode(',', @$page['tag_ids']).'" |
---|
| 34 | }); |
---|
| 35 | }); |
---|
[12704] | 36 | } |
---|
| 37 | jQuery(document).ready(PWG_Colorbox); |
---|
| 38 | jQuery(window).bind("RVTS_loaded", PWG_Colorbox); |
---|
[10078] | 39 | </script> |
---|
[13654] | 40 | <style type="text/css">img.cboxPhoto { max-width: none; }</style> |
---|
[17139] | 41 | '); |
---|
[3298] | 42 | |
---|
| 43 | foreach($tpl_thumbnails_var as $key => $tpl_var) |
---|
| 44 | { |
---|
| 45 | // Image URL for lightbox |
---|
| 46 | if ($newurl = get_lightbox_url($pictures[$key])) |
---|
| 47 | { |
---|
| 48 | $tpl_thumbnails_var[$key]['URL'] .= '" id="img-'.$pictures[$key]['id'].'" name="'.$newurl; |
---|
| 49 | } |
---|
| 50 | else |
---|
| 51 | { |
---|
| 52 | continue; |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | // Title display |
---|
| 56 | if ($params['display_name']) |
---|
| 57 | { |
---|
| 58 | $tpl_thumbnails_var[$key]['URL'] .= '" title="'.get_lightbox_title($pictures[$key], $params['name_link']); |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | // Arrows display |
---|
| 62 | if ($params['display_arrows']) |
---|
| 63 | { |
---|
| 64 | $tpl_thumbnails_var[$key]['URL'] .= '" rel="colorbox'.$conf['lightbox_rel']; |
---|
| 65 | } |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | // Add all items from category |
---|
| 69 | if ($params['display_arrows'] and $params['all_cat'] and !empty($page['navigation_bar'])) |
---|
| 70 | { |
---|
| 71 | $rank_of = array_flip($page['items']); |
---|
| 72 | if ($page['start'] > 0) |
---|
| 73 | { |
---|
| 74 | $selection = array_slice($page['items'], 0, $page['start']); |
---|
| 75 | $template->concat('PLUGIN_INDEX_CONTENT_BEGIN', get_lightbox_extra_pictures($selection, $rank_of, $params['name_link'])); |
---|
| 76 | } |
---|
| 77 | |
---|
| 78 | if (count($page['items']) > $page['start'] + $page['nb_image_page']) |
---|
| 79 | { |
---|
| 80 | $selection = array_slice($page['items'], $page['start'] + $page['nb_image_page']); |
---|
| 81 | $template->concat('PLUGIN_INDEX_CONTENT_END', get_lightbox_extra_pictures($selection, $rank_of, $params['name_link'])); |
---|
| 82 | } |
---|
| 83 | } |
---|
| 84 | |
---|
[7252] | 85 | ?> |
---|