-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfunctions.inc.php
executable file
·86 lines (74 loc) · 2.59 KB
/
functions.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
// Return picture lightbox picture URL for known extension
function get_lightbox_url($picture)
{
global $conf, $pwg_loaded_plugins;
$ext = strtolower(get_extension($picture['file']));
if (!empty($pwg_loaded_plugins['gvideo']) and $picture['is_gvideo'])
{
return get_root_url().'plugins/lightbox/get_content.php?imgid='.$picture['id'];
}else if(!empty($pwg_loaded_plugins['piwigo-videojs']) and vjs_valid_extension(pathinfo($picture['path'])['extension']) ){
//print_r(vjs_valid_extension(pathinfo($picture['path'])['extension']));
return get_root_url().'plugins/lightbox/get_content.php?imgid='.$picture['id'];
}else if (in_array($ext, $conf['picture_ext']))
{
return DerivativeImage::url(IMG_LARGE, new SrcImage($picture));
}
return false;
}
// Return lightbox title
function get_lightbox_title($picture, $name_link)
{
global $conf, $user;
if (isset($picture['name']) and $picture['name'] != '')
{
$name = trigger_change('render_element_description', $picture['name']);
}
else
{
$name = str_replace('_', ' ', get_filename_wo_extension($picture['file']));
}
if ($name_link == 'picture')
{
$url = duplicate_picture_url(
array(
'image_id' => $picture['id'],
'image_file' => $picture['file']
),
array('start')
);
return htmlspecialchars('<a href="'.$url.'">'.$name.'</a>');
}
elseif ($name_link == 'high')
{
$src_image = new SrcImage($picture);
if ($src_image->is_original() and 'true' == $user['enabled_high'])
{
$name.= ' ('.l10n('Display').' '.l10n('Original').')';
return htmlspecialchars('<a href="javascript:phpWGOpenWindow(\''.$src_image->get_url().'\',\'\',\'scrollbars=yes,toolbar=no,status=no,resizable=yes\')" rel="nofollow">'.$name.'</a>');
}
}
return $name;
}
// Return extra picture for multipage category
function get_lightbox_extra_pictures($selection, $rank_of, $name_link)
{
global $conf;
$query = 'SELECT * FROM '.IMAGES_TABLE.' WHERE id IN ('.implode(',', $selection).');';
$result = pwg_query($query);
$pictures = array();
while ($row = pwg_db_fetch_assoc($result))
{
$row['rank'] = $rank_of[ $row['id'] ];
array_push($pictures, $row);
}
usort($pictures, 'rank_compare');
$content = '<div class="thumbnails" style="display: none;">'."\n";
foreach ($pictures as $picture)
{
$content .= '<a href="#" id="img-'.$picture['id'].'" name="'.get_lightbox_url($picture).'" title="'.get_lightbox_title($picture, $name_link).'" rel="colorbox'.$conf['lightbox_rel'].'"></a>'."\n";
}
$content .= '</div>'."\n";
return $content;
}
?>