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