-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.php
77 lines (61 loc) · 1.96 KB
/
index.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
<?php
//page_add_script (site_prefix () . '/js/jquery-1.3.2.min.js');
page_add_script (site_prefix () . '/js/rollover.js');
if (! $parameters['description']) {
$parameters['description'] = 'yes';
}
if (! $parameters['delay']) {
$parameters['delay'] = 12;
}
if (! $parameters['effect']) {
$parameters['effect'] = 'fade';
}
loader_import ('saf.File.Directory');
$d = new Dir ('pix/' . $parameters['path']);
$res = array ();
foreach ($d->readAll () as $file) {
if (strpos ($file, '.') === 0) {
continue;
}
$info = pathinfo ($file);
$info['name'] = preg_replace ('/\.' . $info['extension'] . '$/', '', $info['basename']);
list ($info['display_title'], $info['description']) = split (' - ', $info['name']);
$info['display_title'] = ucwords (preg_replace ('/[^a-zA-Z0-9]+/', ' ', $info['display_title']));
unset ($info['dirname']);
unset ($info['basename']);
if (empty ($info['description'])) {
$info['description'] = $info['display_title'];
}
$res[] = (object) $info;
}
$valid = appconf ('valid');
foreach (array_keys ($res) as $k) {
if (! in_array (strtolower ($res[$k]->extension), $valid)) {
unset ($res[$k]);
}
}
if ($parameters['title'] && $box['context'] == 'action') {
page_title ($parameters['title']);
}
// atleast 2 images need to be present in the directory
$first = $parameters['path'] . '/' . $res[0]->name . '.' . $res[0]->extension;
$second = $parameters['path'] . '/' . $res[1]->name . '.' . $res[1]->extension;
// remove first two element because they are given with firstimg and secondimg parameters
unset($res[0]);
unset($res[1]);
sort($res);
template_simple_register ('effect', $parameters['effect']);
template_simple_register ('results', $res);
template_simple_register ('first', array_shift ($res));
echo template_simple (
'pixslideeffect.spt',
array (
'path' => $parameters['path'],
'total' => count ($res) + 1,
'desc' => $parameters['descriptions'],
'delay' => $parameters['delay'],
'firstimg' => $first,
'secondimg' => $second
)
);
?>