Slideshow Gallery - Version 1.0

Version Description

Download this release

Release Info

Developer contrid
Plugin Icon 128x128 Slideshow Gallery
Version 1.0
Comparing to
See all releases

Version 1.0

Files changed (65) hide show
  1. css/gallery-css.php +32 -0
  2. helpers/db.php +282 -0
  3. helpers/form.php +89 -0
  4. helpers/html.php +177 -0
  5. helpers/metabox.php +25 -0
  6. images/icon.png +0 -0
  7. images/left.gif +0 -0
  8. images/link.gif +0 -0
  9. images/right.gif +0 -0
  10. images/scroll-left.gif +0 -0
  11. images/scroll-right.gif +0 -0
  12. js/admin.js +22 -0
  13. js/gallery.js +178 -0
  14. models/slide.php +98 -0
  15. slideshow-gallery-ajax.php +35 -0
  16. slideshow-gallery-plugin.php +472 -0
  17. slideshow-gallery.php +161 -0
  18. trunk/css/gallery-css.php +32 -0
  19. trunk/helpers/db.php +282 -0
  20. trunk/helpers/form.php +89 -0
  21. trunk/helpers/html.php +177 -0
  22. trunk/helpers/metabox.php +25 -0
  23. trunk/images/icon.png +0 -0
  24. trunk/images/left.gif +0 -0
  25. trunk/images/link.gif +0 -0
  26. trunk/images/right.gif +0 -0
  27. trunk/images/scroll-left.gif +0 -0
  28. trunk/images/scroll-right.gif +0 -0
  29. trunk/js/admin.js +22 -0
  30. trunk/js/gallery.js +178 -0
  31. trunk/models/slide.php +98 -0
  32. trunk/readme.txt +46 -0
  33. trunk/screenshot-1.png +0 -0
  34. trunk/screenshot-2.png +0 -0
  35. trunk/screenshot-3.png +0 -0
  36. trunk/screenshot-4.png +0 -0
  37. trunk/slideshow-gallery-ajax.php +35 -0
  38. trunk/slideshow-gallery-plugin.php +472 -0
  39. trunk/slideshow-gallery.php +161 -0
  40. trunk/vendors/class.paginate.php +216 -0
  41. trunk/views/admin/err-top.php +5 -0
  42. trunk/views/admin/head.php +3 -0
  43. trunk/views/admin/metaboxes/settings-general.php +126 -0
  44. trunk/views/admin/metaboxes/settings-styles.php +44 -0
  45. trunk/views/admin/metaboxes/settings-submit.php +17 -0
  46. trunk/views/admin/msg-top.php +5 -0
  47. trunk/views/admin/paginate.php +5 -0
  48. trunk/views/admin/settings.php +28 -0
  49. trunk/views/admin/slides/index.php +68 -0
  50. trunk/views/admin/slides/order.php +49 -0
  51. trunk/views/admin/slides/save.php +42 -0
  52. trunk/views/default/gallery.php +85 -0
  53. vendors/class.paginate.php +216 -0
  54. views/admin/err-top.php +5 -0
  55. views/admin/head.php +3 -0
  56. views/admin/metaboxes/settings-general.php +126 -0
  57. views/admin/metaboxes/settings-styles.php +44 -0
  58. views/admin/metaboxes/settings-submit.php +17 -0
  59. views/admin/msg-top.php +5 -0
  60. views/admin/paginate.php +5 -0
  61. views/admin/settings.php +28 -0
  62. views/admin/slides/index.php +68 -0
  63. views/admin/slides/order.php +49 -0
  64. views/admin/slides/save.php +42 -0
  65. views/default/gallery.php +85 -0
css/gallery-css.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php header("Content-Type: text/css"); ?>
2
+
3
+ <?php $styles = array(); ?>
4
+ <?php foreach ($_GET as $skey => $sval) : ?>
5
+ <?php $styles[$skey] = urldecode($sval); ?>
6
+ <?php endforeach; ?>
7
+
8
+ #slideshow { list-style:none; color:#fff; }
9
+ #slideshow span { display:none; }
10
+ #wrapper { width:<?= ((int) $styles['width'] - 6); ?>px; background:<?= $styles['background']; ?>; padding:2px; border:<?= $styles['border']; ?>; margin:25px auto; display:none; }
11
+ #wrapper * { margin:0; padding:0; }
12
+ #fullsize { position:relative; overflow:hidden; width:<?= ((int) $styles['width'] - 6); ?>px; height:<?= $styles['height']; ?>px; }
13
+ #information { position:absolute; bottom:0; width:<?= ((int) $styles['width'] - 6); ?>px; height:0; background:<?= $styles['infobackground']; ?>; color:<?= $styles['infocolor']; ?>; overflow:hidden; z-index:200; opacity:.7; filter:alpha(opacity=70); }
14
+ #information h3 { color:<?= $styles['infocolor']; ?>; padding:4px 8px 3px; font-size:14px; }
15
+ #information p { color:<?= $styles['infocolor']; ?>; padding:0 8px 8px; }
16
+ #image { width:<?= ((int) $styles['width'] - 6); ?>px; }
17
+ #image img { position:absolute; border:none; z-index:25; width:<?= ((int) $styles['width'] - 6); ?>px; }
18
+ .imgnav { position:absolute; width:25%; height:<?= ((int) $styles['height'] + 6); ?>px; cursor:pointer; z-index:150; }
19
+ #imgprev { left:0; background:url('../images/left.gif') left center no-repeat; }
20
+ #imgnext { right:0; background:url('../images/right.gif') right center no-repeat; }
21
+ #imglink { position:absolute; height:<?= ((int) $styles['height'] + 6); ?>px; width:100%; z-index:100; opacity:.4; filter:alpha(opacity=40); }
22
+ .linkhover { background:url('../images/link.gif') center center no-repeat; }
23
+ #thumbnails { }
24
+ .thumbstop { margin-bottom:15px !important; }
25
+ .thumbsbot { margin-top:15px !important; }
26
+ #slideleft { float:left; width:20px; height:81px; background:url('../images/scroll-left.gif') center center no-repeat; background-color:#222; }
27
+ #slideleft:hover { background-color:#333; }
28
+ #slideright { float:right; width:20px; height:81px; background:#222 url('../images/scroll-right.gif') center center no-repeat; }
29
+ #slideright:hover { background-color:#333; }
30
+ #slidearea { float:left; background:<?= $styles['background']; ?>; position:relative; width:<?= ((int) $styles['width'] - 55); ?>px; margin-left:5px; height:81px; overflow:hidden; }
31
+ #slider { position:absolute; left:0; height:81px; }
32
+ #slider img { cursor:pointer; border:1px solid #666; padding:2px; -moz-border-radius-bottomleft:4px; -moz-border-radius-bottomright:4px; -moz-border-radius-topleft:4px; -moz-border-radius-topright:4px; }
helpers/db.php ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class GalleryDbHelper extends GalleryPlugin {
4
+
5
+ var $name = 'Db';
6
+
7
+ function find($conditions = array(), $fields = false, $order = array('id', "DESC"), $assign = true, $atts = array()) {
8
+ global $wpdb;
9
+
10
+ $newfields = "*";
11
+
12
+ if (!empty($fields)) {
13
+ if (is_array($fields)) {
14
+ $newfields = "";
15
+ $f = 1;
16
+
17
+ foreach ($fields as $field) {
18
+ $newfields .= "`" . $field . "`";
19
+
20
+ if ($f < count($fields)) {
21
+ $newfields .= ", ";
22
+ }
23
+
24
+ $f++;
25
+ }
26
+ } else {
27
+ $newfields = $fields;
28
+ }
29
+ }
30
+
31
+ $query = "SELECT " . $newfields . " FROM `" . $this -> table . "`";
32
+
33
+ if (!empty($conditions) && is_array($conditions)) {
34
+ $query .= " WHERE";
35
+ $c = 1;
36
+
37
+ foreach ($conditions as $ckey => $cval) {
38
+ $query .= " `" . $ckey . "` = '" . $cval . "'";
39
+
40
+ if ($c < count($conditions)) {
41
+ $query .= " AND";
42
+ }
43
+
44
+ $c++;
45
+ }
46
+ }
47
+
48
+ $order = (empty($order)) ? array('id', "DESC") : $order;
49
+ list($ofield, $odir) = $order;
50
+ $query .= " ORDER BY `" . $ofield . "` " . $odir . "";
51
+ $query .= " LIMIT 1";
52
+
53
+ if ($record = $wpdb -> get_row($query)) {
54
+ if (!empty($record)) {
55
+ $data = $this -> init_class($this -> model, $record);
56
+
57
+ if ($assign == true) {
58
+ $this -> data = $data;
59
+ }
60
+
61
+ return $data;
62
+ }
63
+ }
64
+
65
+ return false;
66
+ }
67
+
68
+ function find_all($conditions = array(), $fields = false, $order = array('id', "DESC"), $limit = false, $assign = false, $distinct = false) {
69
+ global $wpdb;
70
+
71
+ $newfields = "*";
72
+ if (!empty($fields) && !is_array($fields)) { $newfields = $fields; }
73
+ $distinct = (!empty($distinct)) ? "DISTINCT " : "";
74
+
75
+ $query = "SELECT " . $distinct . $newfields . " FROM `" . $this -> table . "`";
76
+
77
+ if (!empty($conditions) && is_array($conditions)) {
78
+ $query .= " WHERE";
79
+ $c = 1;
80
+
81
+ foreach ($conditions as $ckey => $cval) {
82
+ $query .= " `" . $ckey . "` = '" . $cval . "'";
83
+
84
+ if ($c < count($conditions)) {
85
+ $query .= " AND";
86
+ }
87
+
88
+ $c++;
89
+ }
90
+ }
91
+
92
+ $order = (empty($order)) ? array('id', "DESC") : $order;
93
+ list($ofield, $odir) = $order;
94
+ $query .= " ORDER BY `" . $ofield . "` " . $odir . "";
95
+ $query .= (empty($limit)) ? '' : " LIMIT " . $limit . "";
96
+
97
+ if ($records = $wpdb -> get_results($query)) {
98
+ if (!empty($records)) {
99
+ $data = array();
100
+
101
+ foreach ($records as $record) {
102
+ $data[] = $this -> init_class($this -> model, $record);
103
+ }
104
+
105
+ if ($assign == true) {
106
+ $this -> data = $data;
107
+ }
108
+
109
+ return $data;
110
+ }
111
+ }
112
+
113
+ return false;
114
+ }
115
+
116
+ function save($data = null, $validate = true) {
117
+ global $wpdb;
118
+
119
+ $defaults = (method_exists($this, 'defaults')) ? $this -> defaults() : false;
120
+ $data = (empty($data[$this -> model])) ? $data : $data[$this -> model];
121
+
122
+ $r = wp_parse_args($data, $defaults);
123
+ $this -> data = GalleryHtmlHelper::array_to_object($r);
124
+
125
+ if ($validate == true) {
126
+ if (method_exists($this, 'validate')) {
127
+ $this -> validate($r);
128
+ }
129
+ }
130
+
131
+ if (empty($this -> errors)) {
132
+ switch ($this -> model) {
133
+ case 'Slide' :
134
+ $this -> data -> image = basename($this -> data -> image_url);
135
+ break;
136
+ }
137
+
138
+ //the MySQL query
139
+ $query = (empty($this -> data -> id)) ? $this -> insert_query($this -> model) : $this -> update_query($this -> model);
140
+
141
+ if ($wpdb -> query($query)) {
142
+ $this -> insertid = $insertid = (empty($this -> data -> id)) ? $wpdb -> insert_id : $this -> data -> id;
143
+ return true;
144
+ }
145
+ }
146
+
147
+ return false;
148
+ }
149
+
150
+ function save_field($field = null, $value = null, $conditions = array()) {
151
+ if (!empty($this -> model)) {
152
+ global $wpdb;
153
+
154
+ if (!empty($field)) {
155
+ $query = "UPDATE `" . $this -> table . "` SET `" . $field . "` = '" . $value . "'";
156
+
157
+ if (!empty($conditions) && is_array($conditions)) {
158
+ $query .= " WHERE";
159
+ $c = 1;
160
+
161
+ foreach ($conditions as $ckey => $cval) {
162
+ $query .= " `" . $ckey . "` = '" . $cval . "'";
163
+
164
+ if ($c < count($conditions)) {
165
+ $query .= " AND";
166
+ }
167
+
168
+ $c++;
169
+ }
170
+ }
171
+
172
+ if ($wpdb -> query($query)) {
173
+ return true;
174
+ }
175
+ }
176
+ }
177
+
178
+ return false;
179
+ }
180
+
181
+ function delete($record_id = '') {
182
+ global $wpdb;
183
+
184
+ if (!empty($record_id) && $record = $this -> find(array('id' => $record_id))) {
185
+ $query = "DELETE FROM `" . $this -> table . "` WHERE `id` = '" . $record_id . "' LIMIT 1";
186
+
187
+ if ($wpdb -> query($query)) {
188
+ //do nothing...
189
+ return true;
190
+ }
191
+ }
192
+
193
+ return false;
194
+ }
195
+
196
+ function insert_query($model = '') {
197
+ if (!empty($model)) {
198
+ global $wpdb;
199
+
200
+ if (!empty($this -> data)) {
201
+ if (empty($this -> data -> id)) {
202
+ $query1 = "INSERT INTO `" . $this -> table . "` (";
203
+ $query2 = "";
204
+ $c = 1;
205
+ unset($this -> fields['key']);
206
+
207
+ foreach (array_keys($this -> fields) as $field) {
208
+ if (!empty($this -> data -> {$field}) || $this -> data -> {$field} == "0") {
209
+ if (is_array($this -> data -> {$field}) || is_object($this -> data -> {$field})) {
210
+ $value = serialize($this -> data -> {$field});
211
+ } else {
212
+ $value = mysql_escape_string($this -> data -> {$field});
213
+ }
214
+
215
+ $query1 .= "`" . $field . "`";
216
+ $query2 .= "'" . $value . "'";
217
+
218
+ if ($c < count($this -> fields)) {
219
+ $query1 .= ", ";
220
+ $query2 .= ", ";
221
+ }
222
+ }
223
+
224
+ $c++;
225
+ }
226
+
227
+ $query1 .= ") VALUES (";
228
+ $query = $query1 . "" . $query2 . ");";
229
+
230
+ return $query;
231
+ } else {
232
+ $query = $this -> update_query($model);
233
+
234
+ return $query;
235
+ }
236
+ }
237
+ }
238
+
239
+ return false;
240
+ }
241
+
242
+ function update_query($model = '') {
243
+ if (!empty($model)) {
244
+ global $wpdb;
245
+
246
+ if (!empty($this -> data)) {
247
+ $query = "UPDATE `" . $this -> table . "` SET ";
248
+ $c = 1;
249
+
250
+ unset($this -> fields['id']);
251
+ unset($this -> fields['key']);
252
+ unset($this -> fields['created']);
253
+
254
+ foreach (array_keys($this -> fields) as $field) {
255
+ //if (!empty($this -> data -> {$field}) || $this -> data -> {$field} == "0") {
256
+ if (is_array($this -> data -> {$field}) || is_object($this -> data -> {$field})) {
257
+ $value = serialize($this -> data -> {$field});
258
+ } else {
259
+ $value = mysql_escape_string($this -> data -> {$field});
260
+ }
261
+
262
+ $query .= "`" . $field . "` = '" . $value . "'";
263
+
264
+ if ($c < count($this -> fields)) {
265
+ $query .= ", ";
266
+ }
267
+ //}
268
+
269
+ $c++;
270
+ }
271
+
272
+ $query .= " WHERE `id` = '" . $this -> data -> id . "' LIMIT 1";
273
+
274
+ return $query;
275
+ }
276
+ }
277
+
278
+ return false;
279
+ }
280
+ }
281
+
282
+ ?>
helpers/form.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class GalleryFormHelper extends GalleryPlugin {
4
+
5
+ function hidden($name = '', $args = array()) {
6
+ global $wpcoHtml;
7
+
8
+ $defaults = array(
9
+ 'value' => (empty($args['value'])) ? $this -> Html -> field_value($name) : $args['value'],
10
+ );
11
+
12
+ $r = wp_parse_args($args, $defaults);
13
+ extract($r, EXTR_SKIP);
14
+
15
+ ob_start();
16
+
17
+ ?><input type="hidden" name="<?= $this -> Html -> field_name($name); ?>" value="<?= $value; ?>" id="<?= $name; ?>" /><?php
18
+
19
+ $hidden = ob_get_clean();
20
+ return $hidden;
21
+ }
22
+
23
+ function text($name = '', $args = array()) {
24
+ $defaults = array(
25
+ 'id' => (empty($args['id'])) ? $name : $args['id'],
26
+ 'width' => '100%',
27
+ 'class' => "widefat",
28
+ 'error' => true,
29
+ 'value' => (empty($args['value'])) ? GalleryHtmlHelper::field_value($name) : $args['value'],
30
+ 'autocomplete' => "on",
31
+ );
32
+
33
+ $r = wp_parse_args($args, $defaults);
34
+ extract($r, EXTR_SKIP);
35
+
36
+ $this -> debug($this);
37
+ echo $this -> Html -> field_value($name);
38
+
39
+ ob_start();
40
+
41
+ ?><input class="<?= $class; ?>" type="text" autocomplete="<?= $autocomplete; ?>" style="width:<?= $width; ?>" name="<?= $this -> Html -> field_name($name); ?>" value="<?= $value; ?>" id="<?= $id; ?>" /><?php
42
+
43
+ if ($error == true) {
44
+ echo $this -> Html -> field_error($name);
45
+ }
46
+
47
+ $text = ob_get_clean();
48
+ return $text;
49
+ }
50
+
51
+ function textarea($name = '', $args = array()) {
52
+ $defaults = array(
53
+ 'error' => true,
54
+ 'width' => '100%',
55
+ 'class' => "widefat",
56
+ 'rows' => 4,
57
+ 'cols' => "100%",
58
+ );
59
+
60
+ $r = wp_parse_args($args, $defaults);
61
+ extract($r, EXTR_SKIP);
62
+
63
+ ob_start();
64
+
65
+ ?><textarea class="<?= $class; ?>" name="<?= $this -> Html -> field_name($name); ?>" rows="<?= $rows; ?>" style="width:<?= $width; ?>;" cols="<?= $cols; ?>" id="<?= $name; ?>"><?= $this -> Html -> field_value($name); ?></textarea><?php
66
+
67
+ if ($error == true) {
68
+ echo $this -> Html -> field_error($name);
69
+ }
70
+
71
+ $textarea = ob_get_clean();
72
+ return $textarea;
73
+ }
74
+
75
+ function submit($name = '', $args = array()) {
76
+ $defaults = array('class' => "button-primary");
77
+ $r = wp_parse_args($args, $defaults);
78
+ extract($r, EXTR_SKIP);
79
+
80
+ ob_start();
81
+
82
+ ?><input class="<?= $class; ?>" type="submit" name="<?= $this -> Html -> sanitize($name); ?>" value="<?= $name; ?>" /><?php
83
+
84
+ $submit = ob_get_clean();
85
+ return $submit;
86
+ }
87
+ }
88
+
89
+ ?>
helpers/html.php ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class GalleryHtmlHelper extends GalleryPlugin {
4
+
5
+ function link($name = '', $href = '/', $args = array()) {
6
+ $defaults = array(
7
+ 'title' => (empty($args['title'])) ? $title : $args['title'],
8
+ 'target' => "_self",
9
+ 'class' => "wpco",
10
+ 'rel' => "",
11
+ 'onclick' => "",
12
+ );
13
+
14
+ $r = wp_parse_args($args, $defaults);
15
+ extract($r, EXTR_SKIP);
16
+
17
+ ob_start();
18
+
19
+ ?><a class="<?= $class; ?>" rel="<?= $rel; ?>" <?= (!empty($onclick)) ? 'onclick="' . $onclick . '"' : ''; ?> href="<?= $href; ?>" target="<?= $target; ?>" title="<?= $title; ?>"><?= $name; ?></a><?php
20
+
21
+ $link = ob_get_clean();
22
+ return $link;
23
+ }
24
+
25
+ function filename($url = null) {
26
+ if (!empty($url)) {
27
+ return basename($url);
28
+ }
29
+
30
+ return false;
31
+ }
32
+
33
+ function thumbname($filename = null, $append = "thumb") {
34
+ if (!empty($filename)) {
35
+ $name = $this -> strip_ext($filename, "name");
36
+ $ext = $this -> strip_ext($filename, "ext");
37
+
38
+ return $name . '-' . $append . '.' . $ext;
39
+ }
40
+
41
+ return false;
42
+ }
43
+
44
+ function image_url($filename = null) {
45
+ if (!empty($filename)) {
46
+ return get_option('siteurl') . '/wp-content/uploads/slideshow-gallery/' . $filename;
47
+ }
48
+
49
+ return false;
50
+ }
51
+
52
+ function field_name($name = '') {
53
+ if (!empty($name)) {
54
+ if ($mn = $this -> strip_mn($name)) {
55
+ return $mn[1] . '[' . $mn[2] . ']';
56
+ }
57
+ }
58
+
59
+ return $name;
60
+ }
61
+
62
+ function field_error($name = '', $el = "p") {
63
+ if (!empty($name)) {
64
+ if ($mn = $this -> strip_mn($name)) {
65
+ $errors = array();
66
+
67
+ switch ($mn[1]) {
68
+ case 'Slide' :
69
+ $errors = GallerySlide::validate($_POST);
70
+ break;
71
+ }
72
+
73
+ if (!empty($errors[$mn[2]])) {
74
+ $error = '<' . $el . ' class="' . $this -> pre . 'error">' . $errors[$mn[2]] . '</' . $el . '>';
75
+
76
+ return $error;
77
+ }
78
+ }
79
+ }
80
+
81
+ return false;
82
+ }
83
+
84
+ function field_value($name = '') {
85
+ if ($mn = $this -> strip_mn($name)) {
86
+
87
+ $value = $this -> {$mn[1]} -> data -> {$mn[2]};
88
+
89
+ return $value;
90
+ }
91
+
92
+ return false;
93
+ }
94
+
95
+ function retainquery($add = '') {
96
+ $url = $_SERVER['REQUEST_URI'];
97
+
98
+ if (($urls = @explode("?", $url)) !== false) {
99
+ if (!empty($urls[1])) {
100
+ if (!empty($add)) {
101
+ if (($adds = explode("&", str_replace("&amp;", "&", $add))) !== false) {
102
+ foreach ($adds as $qstring) {
103
+ if (($qparts = @explode("=", $qstring)) !== false) {
104
+ if (!empty($qparts[0])) {
105
+ if (preg_match("/\&?" . $qparts[0] . "\=([0-9a-z+]*)/i", $urls[1], $matches)) {
106
+ $urls[1] = preg_replace("/\&?" . $qparts[0] . "\=([0-9a-z+]*)/i", "", $urls[1]);
107
+ }
108
+ }
109
+ }
110
+ }
111
+ }
112
+ }
113
+ }
114
+ }
115
+
116
+ $urls[1] = preg_replace("/\&?" . $this -> pre . "message\=([0-9a-z+]*)/i", "", $urls[1]);
117
+ $url = $urls[0];
118
+ $url .= '?';
119
+ $url .= (empty($urls[1])) ? '' : $urls[1] . '&amp;';
120
+ $url .= $add;
121
+
122
+ return preg_replace("/\?(\&)?/si", "?", $url);
123
+ }
124
+
125
+ function strip_ext($filename = '', $return = 'ext') {
126
+ if (!empty($filename)) {
127
+ $extArray = split("[/\\.]", $filename);
128
+
129
+ if ($return == 'ext') {
130
+ $p = count($extArray) - 1;
131
+ $extension = $extArray[$p];
132
+ return $extension;
133
+ } else {
134
+ $p = count($extArray) - 2;
135
+ $filename = $extArray[$p];
136
+ return $filename;
137
+ }
138
+ }
139
+
140
+ return false;
141
+ }
142
+
143
+ function strip_mn($name = '') {
144
+ if (!empty($name)) {
145
+ if (preg_match("/^(.*?)\.(.*?)$/si", $name, $matches)) {
146
+ return $matches;
147
+ }
148
+ }
149
+
150
+ return false;
151
+ }
152
+
153
+ function gen_date($format = "Y-m-d H:i:s", $time = false) {
154
+ $time = (empty($time)) ? time() : $time;
155
+ $date = date($format, $time);
156
+
157
+ return $date;
158
+ }
159
+
160
+ function array_to_object($array = array()) {
161
+ //type casting...
162
+ return (object) $array;
163
+ }
164
+
165
+ function sanitize($string = '', $sep = '-') {
166
+ if (!empty($string)) {
167
+ $string = ereg_replace("[^0-9a-z" . $sep . "]", "", strtolower(str_replace(" ", $sep, $string)));
168
+ $string = preg_replace("/" . $sep . "[" . $sep . "]*/i", $sep, $string);
169
+
170
+ return $string;
171
+ }
172
+
173
+ return false;
174
+ }
175
+ }
176
+
177
+ ?>
helpers/metabox.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class GalleryMetaboxHelper extends GalleryPlugin {
4
+
5
+ var $name = 'Metabox';
6
+
7
+ function GalleryMetaboxHelper() {
8
+ $url = explode("&", $_SERVER['REQUEST_URI']);
9
+ $this -> url = $url[0];
10
+ }
11
+
12
+ function settings_submit() {
13
+ $this -> render('metaboxes/settings-submit', false, true, 'admin');
14
+ }
15
+
16
+ function settings_general() {
17
+ $this -> render('metaboxes/settings-general', false, true, 'admin');
18
+ }
19
+
20
+ function settings_styles() {
21
+ $this -> render('metaboxes/settings-styles', false, true, 'admin');
22
+ }
23
+ }
24
+
25
+ ?>
images/icon.png ADDED
Binary file
images/left.gif ADDED
Binary file
images/link.gif ADDED
Binary file
images/right.gif ADDED
Binary file
images/scroll-left.gif ADDED
Binary file
images/scroll-right.gif ADDED
Binary file
js/admin.js ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function(){
2
+ jQuery("input[id*=checkboxall]").click(function() {
3
+ var checked_status = this.checked;
4
+ jQuery("input[id*=checklist]").each(function() {
5
+ this.checked = checked_status;
6
+ });
7
+ });
8
+
9
+ jQuery("input[id*=checkinvert]").click(function() {
10
+ this.checked = false;
11
+
12
+ jQuery("input[id*=checklist]").each(function() {
13
+ var status = this.checked;
14
+
15
+ if (status == true) {
16
+ this.checked = false;
17
+ } else {
18
+ this.checked = true;
19
+ }
20
+ });
21
+ });
22
+ });
js/gallery.js ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var TINY={};
2
+
3
+ function tid(i){return document.getElementById(i)}
4
+ function tag(e,p){p=p||document; return p.getElementsByTagName(e)}
5
+
6
+ TINY.slideshow=function(n){
7
+ this.infoSpeed=this.imgSpeed=this.speed=10;
8
+ this.thumbOpacity=this.navHover=70;
9
+ this.navOpacity=25;
10
+ this.scrollSpeed=5;
11
+ this.letterbox='#000';
12
+ this.n=n;
13
+ this.c=0;
14
+ this.a=[]
15
+ };
16
+
17
+ TINY.slideshow.prototype={
18
+ init:function(s,z,b,f,q){
19
+ s=tid(s);
20
+ var m= tag('li',s), i=0, w=0;
21
+ this.l=m.length;
22
+ this.q=tid(q);
23
+ this.f=tid(z);
24
+ this.r=tid(this.info);
25
+ this.o=parseInt(TINY.style.val(z,'width'));
26
+ if(this.thumbs){
27
+ var u=tid(this.left), r=tid(this.right);
28
+ u.onmouseover=new Function('TINY.scroll.init("'+this.thumbs+'",-1,'+this.scrollSpeed+')');
29
+ u.onmouseout=r.onmouseout=new Function('TINY.scroll.cl("'+this.thumbs+'")');
30
+ r.onmouseover=new Function('TINY.scroll.init("'+this.thumbs+'",1,'+this.scrollSpeed+')');
31
+ this.p=tid(this.thumbs)
32
+ }
33
+ for(i;i<this.l;i++){
34
+ this.a[i]={};
35
+ var h=m[i], a=this.a[i];
36
+ a.t= tag('h3',h)[0].innerHTML;
37
+ a.d= tag('p',h)[0].innerHTML;
38
+ a.l= tag('a',h)[0]? tag('a',h)[0].href:'';
39
+ a.p= tag('span',h)[0].innerHTML;
40
+ if(this.thumbs){
41
+ var g= tag('img',h)[0];
42
+ this.p.appendChild(g);
43
+ w+=parseInt(g.offsetWidth);
44
+ if(i!=this.l-1){
45
+ g.style.marginRight=this.spacing+'px';
46
+ w+=this.spacing
47
+ }
48
+ this.p.style.width=w+'px';
49
+ g.style.opacity=this.thumbOpacity/100;
50
+ g.style.filter='alpha(opacity='+this.thumbOpacity+')';
51
+ g.onmouseover=new Function('TINY.alpha.set(this,100,5)');
52
+ g.onmouseout=new Function('TINY.alpha.set(this,'+this.thumbOpacity+',5)');
53
+ g.onclick=new Function(this.n+'.pr('+i+',1)')
54
+ }
55
+ }
56
+ if(b&&f){
57
+ b=tid(b);
58
+ f=tid(f);
59
+ b.style.opacity=f.style.opacity=this.navOpacity/100;
60
+ b.style.filter=f.style.filter='alpha(opacity='+this.navOpacity+')';
61
+ b.onmouseover=f.onmouseover=new Function('TINY.alpha.set(this,'+this.navHover+',5)');
62
+ b.onmouseout=f.onmouseout=new Function('TINY.alpha.set(this,'+this.navOpacity+',5)');
63
+ b.onclick=new Function(this.n+'.mv(-1,1)');
64
+ f.onclick=new Function(this.n+'.mv(1,1)')
65
+ }
66
+ this.auto?this.is(0,0):this.is(0,1)
67
+ },
68
+ mv:function(d,c){
69
+ var t=this.c+d;
70
+ this.c=t=t<0?this.l-1:t>this.l-1?0:t;
71
+ this.pr(t,c)
72
+ },
73
+ pr:function(t,c){
74
+ clearTimeout(this.lt);
75
+ if(c){
76
+ clearTimeout(this.at)
77
+ }
78
+ this.c=t;
79
+ this.is(t,c)
80
+ },
81
+ is:function(s,c){
82
+ if(this.info){
83
+ TINY.height.set(this.r,1,this.infoSpeed/2,-1)
84
+ }
85
+ var i=new Image();
86
+ i.style.opacity=0;
87
+ i.style.filter='alpha(opacity=0)';
88
+ this.i=i;
89
+ i.onload=new Function(this.n+'.le('+s+','+c+')');
90
+ i.src=this.a[s].p;
91
+ if(this.thumbs){
92
+ var a= tag('img',this.p), l=a.length, x=0;
93
+ for(x;x<l;x++){
94
+ a[x].style.borderColor=x!=s?'':this.active
95
+ }
96
+ }
97
+ },
98
+ le:function(s,c){
99
+ this.f.appendChild(this.i);
100
+ var w=this.o-parseInt(this.i.offsetWidth);
101
+ if(w>0){
102
+ var l=Math.floor(w/2);
103
+ this.i.style.borderLeft=l+'px solid '+this.letterbox;
104
+ this.i.style.borderRight=(w-l)+'px solid '+this.letterbox
105
+ }
106
+ TINY.alpha.set(this.i,100,this.imgSpeed);
107
+ var n=new Function(this.n+'.nf('+s+')');
108
+ this.lt=setTimeout(n,this.imgSpeed*100);
109
+ if(!c){
110
+ this.at=setTimeout(new Function(this.n+'.mv(1,0)'),this.speed*1000)
111
+ }
112
+ if(this.a[s].l!=''){
113
+ this.q.onclick=new Function('window.location="'+this.a[s].l+'"');
114
+ this.q.onmouseover=new Function('this.className="'+this.link+'"');
115
+ this.q.onmouseout=new Function('this.className=""');
116
+ this.q.style.cursor='pointer'
117
+ }else{
118
+ this.q.onclick=this.q.onmouseover=null;
119
+ this.q.style.cursor='default'
120
+ }
121
+ var m= tag('img',this.f);
122
+ if(m.length>2){
123
+ this.f.removeChild(m[0])
124
+ }
125
+ },
126
+ nf:function(s){
127
+ if(this.info){
128
+ s=this.a[s];
129
+ tag('h3',this.r)[0].innerHTML=s.t;
130
+ tag('p',this.r)[0].innerHTML=s.d;
131
+ this.r.style.height='auto';
132
+ var h=parseInt(this.r.offsetHeight);
133
+ this.r.style.height=0;
134
+ TINY.height.set(this.r,h,this.infoSpeed,0)
135
+ }
136
+ }
137
+ };
138
+
139
+ TINY.scroll=function(){
140
+ return{
141
+ init:function(e,d,s){
142
+ e=typeof e=='object'?e: tid(e); var p=e.style.left||TINY.style.val(e,'left'); e.style.left=p;
143
+ var l=d==1?parseInt(e.offsetWidth)-parseInt(e.parentNode.offsetWidth):0; e.si=setInterval(function(){TINY.scroll.mv(e,l,d,s)},20)
144
+ },
145
+ mv:function(e,l,d,s){
146
+ var c=parseInt(e.style.left); if(c==l){TINY.scroll.cl(e)}else{var i=Math.abs(l+c); i=i<s?i:s; var n=c-i*d; e.style.left=n+'px'}
147
+ },
148
+ cl:function(e){e=typeof e=='object'?e: tid(e); clearInterval(e.si)}
149
+ }
150
+ }();
151
+
152
+ TINY.height=function(){
153
+ return{
154
+ set:function(e,h,s,d){
155
+ e=typeof e=='object'?e:tid(e); var oh=e.offsetHeight, ho=e.style.height||TINY.style.val(e,'height');
156
+ ho=oh-parseInt(ho); var hd=oh-ho>h?-1:1; clearInterval(e.si); e.si=setInterval(function(){TINY.height.tw(e,h,ho,hd,s)},20)
157
+ },
158
+ tw:function(e,h,ho,hd,s){
159
+ var oh=e.offsetHeight-ho;
160
+ if(oh==h){clearInterval(e.si)}else{if(oh!=h){e.style.height=oh+(Math.ceil(Math.abs(h-oh)/s)*hd)+'px'}}
161
+ }
162
+ }
163
+ }();
164
+
165
+ TINY.alpha=function(){
166
+ return{
167
+ set:function(e,a,s){
168
+ e=typeof e=='object'?e:tid(e); var o=e.style.opacity||TINY.style.val(e,'opacity'),
169
+ d=a>o*100?1:-1; e.style.opacity=o; clearInterval(e.ai); e.ai=setInterval(function(){TINY.alpha.tw(e,a,d,s)},20)
170
+ },
171
+ tw:function(e,a,d,s){
172
+ var o=Math.round(e.style.opacity*100);
173
+ if(o==a){clearInterval(e.ai)}else{var n=o+Math.ceil(Math.abs(a-o)/s)*d; e.style.opacity=n/100; e.style.filter='alpha(opacity='+n+')'}
174
+ }
175
+ }
176
+ }();
177
+
178
+ TINY.style=function(){return{val:function(e,p){e=typeof e=='object'?e:tid(e); return e.currentStyle?e.currentStyle[p]:document.defaultView.getComputedStyle(e,null).getPropertyValue(p)}}}();
models/slide.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class GallerySlide extends GalleryDbHelper {
4
+
5
+ var $table;
6
+ var $model = 'Slide';
7
+ var $controller = "slides";
8
+ var $plugin_name = 'slideshow-gallery';
9
+
10
+ var $data = array();
11
+ var $errors = array();
12
+
13
+ var $fields = array(
14
+ 'id' => "INT(11) NOT NULL AUTO_INCREMENT",
15
+ 'title' => "VARCHAR(150) NOT NULL DEFAULT ''",
16
+ 'description' => "TEXT NOT NULL",
17
+ 'image' => "VARCHAR(50) NOT NULL DEFAULT ''",
18
+ 'image_url' => "VARCHAR(200) NOT NULL DEFAULT ''",
19
+ 'link' => "VARCHAR(200) NOT NULL DEFAULT ''",
20
+ 'order' => "INT(11) NOT NULL DEFAULT '0'",
21
+ 'created' => "DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'",
22
+ 'modified' => "DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'",
23
+ 'key' => "PRIMARY KEY (`id`)",
24
+ );
25
+
26
+ function GallerySlide($data = array()) {
27
+ global $wpdb;
28
+ $this -> table = $wpdb -> prefix . strtolower($this -> pre) . "_" . $this -> controller;
29
+ $this -> check_table($this -> model);
30
+
31
+ if (!empty($data)) {
32
+ foreach ($data as $dkey => $dval) {
33
+ $this -> {$dkey} = $dval;
34
+ }
35
+ }
36
+
37
+ return true;
38
+ }
39
+
40
+ function defaults() {
41
+ $defaults = array(
42
+ 'order' => 0,
43
+ 'created' => GalleryHtmlHelper::gen_date(),
44
+ 'modified' => GalleryHtmlHelper::gen_date(),
45
+ );
46
+
47
+ return $defaults;
48
+ }
49
+
50
+ function validate($data = null) {
51
+ $this -> errors = array();
52
+
53
+ if (!empty($data)) {
54
+ $data = (empty($data[$this -> model])) ? $data : $data[$this -> model];
55
+
56
+ foreach ($data as $dkey => $dval) {
57
+ $this -> data -> {$dkey} = stripslashes($dval);
58
+ }
59
+
60
+ extract($data, EXTR_SKIP);
61
+
62
+ if (empty($title)) { $this -> errors['title'] = __('Please fill in a title', $this -> plugin_name); }
63
+ if (empty($description)) { $this -> errors['description'] = __('Please fill in a description', $this -> plugin_name); }
64
+ if (empty($image_url)) { $this -> errors['image_url'] = __('Please specify an image', $this -> plugin_name); }
65
+ else {
66
+ if ($image = wp_remote_fopen($image_url)) {
67
+ $filename = basename($image_url);
68
+ $filepath = ABSPATH . 'wp-content/uploads/' . $this -> plugin_name . '/';
69
+ $filefull = $filepath . $filename;
70
+
71
+ if (!file_exists($filefull)) {
72
+ $fh = @fopen($filefull, "w");
73
+ @fwrite($fh, $image);
74
+ @fclose($fh);
75
+
76
+ $name = GalleryHtmlHelper::strip_ext($filename, 'filename');
77
+ $ext = GalleryHtmlHelper::strip_ext($filename, 'ext');
78
+ $thumbfull = $filepath . $name . '-thumb.' . $ext;
79
+ $smallfull = $filepath . $name . '-small.' . $ext;
80
+
81
+ image_resize($filefull, $width = null, $height = 75, $crop = false, $append = 'thumb', $dest = null, $quality = 100);
82
+ image_resize($filefull, $width = 50, $height = 50, $crop = true, $append = 'small', $dest = null, $quality = 100);
83
+
84
+ @chmod($filefull, 0777);
85
+ @chmod($thumbfull, 0777);
86
+ @chmod($smallfull, 0777);
87
+ }
88
+ }
89
+ }
90
+ } else {
91
+ $this -> errors[] = __('No data was posted', $this -> plugin_name);
92
+ }
93
+
94
+ return $this -> errors;
95
+ }
96
+ }
97
+
98
+ ?>
slideshow-gallery-ajax.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ include_once('../../../wp-config.php');
4
+ include_once(ABSPATH . 'wp-admin/admin-functions.php');
5
+
6
+ class GalleryAjax extends GalleryPlugin {
7
+
8
+ var $safecommands = array('slides_order');
9
+
10
+ function GalleryAjax($cmd) {
11
+ $this -> register_plugin('gallery', __FILE__);
12
+
13
+ if (!empty($cmd)) {
14
+ if (in_array($cmd, $this -> safecommands) || current_user_can('edit_plugins')) {
15
+ if (method_exists($this, $cmd)) {
16
+ $this -> $cmd();
17
+ }
18
+ }
19
+ }
20
+ }
21
+
22
+ function slides_order() {
23
+ if (!empty($_REQUEST['item'])) {
24
+ foreach ($_REQUEST['item'] as $order => $slide_id) {
25
+ $this -> Slide -> save_field('order', $order, array('id' => $slide_id));
26
+ }
27
+
28
+ ?><br/><div style="color:red;"><?php _e('Slides have been ordered', $this -> plugin_name); ?></div><?php
29
+ }
30
+ }
31
+ }
32
+
33
+ $GalleryAjax = new GalleryAjax($_GET['cmd']);
34
+
35
+ ?>
slideshow-gallery-plugin.php ADDED
@@ -0,0 +1,472 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class GalleryPlugin {
4
+
5
+ //the plugin internal name
6
+ var $plugin_name;
7
+ //the plugin absolute path
8
+ var $plugin_base;
9
+ var $pre = 'Gallery';
10
+ var $debugging = true;
11
+
12
+ var $helpers = array('Db', 'Html', 'Form', 'Metabox');
13
+ var $models = array('Slide');
14
+
15
+ function register_plugin($name, $base) {
16
+ $this -> plugin_name = $name;
17
+ $this -> plugin_base = rtrim(dirname($base), '/');
18
+
19
+ $this -> enqueue_scripts();
20
+ $this -> enqueue_styles();
21
+
22
+ $this -> initialize_classes();
23
+ $this -> initialize_options();
24
+
25
+ return true;
26
+ }
27
+
28
+ function init_class($name = null, $params = array()) {
29
+ if (!empty($name)) {
30
+ $name = $this -> pre . $name;
31
+
32
+ if (class_exists($name)) {
33
+ if ($class = new $name($params)) {
34
+ return $class;
35
+ }
36
+ }
37
+ }
38
+
39
+ $this -> init_class('Country');
40
+
41
+ return false;
42
+ }
43
+
44
+ function initialize_classes() {
45
+ if (!empty($this -> helpers)) {
46
+ foreach ($this -> helpers as $helper) {
47
+ $hfile = dirname(__FILE__) . '/helpers/' . strtolower($helper) . '.php';
48
+
49
+ if (file_exists($hfile)) {
50
+ require_once($hfile);
51
+
52
+ if (!is_object($this -> {$helper})) {
53
+ $classname = $this -> pre . $helper . 'Helper';
54
+
55
+ if (class_exists($classname, true)) {
56
+ $this -> {$helper} = new $classname;
57
+ }
58
+ }
59
+ }
60
+ }
61
+ }
62
+
63
+ if (!empty($this -> models)) {
64
+ foreach ($this -> models as $model) {
65
+ $mfile = dirname(__FILE__) . '/models/' . strtolower($model) . '.php';
66
+
67
+ if (file_exists($mfile)) {
68
+ require_once($mfile);
69
+
70
+ if (!is_object($this -> {$model})) {
71
+ $classname = $this -> pre . $model;
72
+
73
+ if (class_exists($classname, true)) {
74
+ $this -> {$model} = new $classname;
75
+ }
76
+ }
77
+ }
78
+ }
79
+ }
80
+ }
81
+
82
+ function initialize_options() {
83
+ $styles = array(
84
+ 'width' => "450",
85
+ 'height' => "250",
86
+ 'border' => "1px solid #CCCCCC",
87
+ 'background' => "#000000",
88
+ 'infobackground' => "#000000",
89
+ 'infocolor' => "#FFFFFF",
90
+ );
91
+
92
+ $this -> add_option('styles', $styles);
93
+
94
+ //General Settings
95
+ $this -> add_option('fadespeed', 10);
96
+ $this -> add_option('navopacity', 25);
97
+ $this -> add_option('navhover', 70);
98
+ $this -> add_option('information', "Y");
99
+ $this -> add_option('infospeed', 10);
100
+ $this -> add_option('thumbnails', "N");
101
+ $this -> add_option('thumbposition', "bottom");
102
+ $this -> add_option('thumbopacity', 70);
103
+ $this -> add_option('thumbscrollspeed', 5);
104
+ $this -> add_option('thumbspacing', 5);
105
+ $this -> add_option('thumbactive', "#FFFFFF");
106
+ $this -> add_option('autoslide', "Y");
107
+ $this -> add_option('autospeed', 10);
108
+ }
109
+
110
+ function render_msg($message = '') {
111
+ $this -> render('msg-top', array('message' => $message), true, 'admin');
112
+ }
113
+
114
+ function render_err($message = '') {
115
+ $this -> render('err-top', array('message' => $message), true, 'admin');
116
+ }
117
+
118
+ function redirect($location = '', $msgtype = '', $message = '') {
119
+ $url = $location;
120
+
121
+ if ($msgtype == "message") {
122
+ $url .= '&' . $this -> pre . 'updated=true';
123
+ } elseif ($msgtype == "error") {
124
+ $url .= '&' . $this -> pre . 'error=true';
125
+ }
126
+
127
+ if (!empty($message)) {
128
+ $url .= '&' . $this -> pre . 'message=' . urlencode($message);
129
+ }
130
+
131
+ ?>
132
+
133
+ <script type="text/javascript">
134
+ window.location = '<?= (empty($url)) ? get_option('home') : $url; ?>';
135
+ </script>
136
+
137
+ <?php
138
+
139
+ flush();
140
+ }
141
+
142
+ function paginate($model = null, $fields = '*', $sub = null, $conditions = null, $searchterm = null, $per_page = 10, $order = array('modified', "DESC")) {
143
+ global $wpdb;
144
+
145
+ if (!empty($model)) {
146
+ global $paginate;
147
+ $paginate = $this -> vendor('Paginate');
148
+ $paginate -> table = $this -> {$model} -> table;
149
+ $paginate -> sub = (empty($sub)) ? $this -> {$model} -> controller : $sub;
150
+ $paginate -> fields = (empty($fields)) ? '*' : $fields;
151
+ $paginate -> where = (empty($conditions)) ? false : $conditions;
152
+ $paginate -> searchterm = (empty($searchterm)) ? false : $searchterm;
153
+ $paginate -> per_page = $per_page;
154
+ $paginate -> order = $order;
155
+
156
+ $data = $paginate -> start_paging($_GET[$this -> pre . 'page']);
157
+
158
+ if (!empty($data)) {
159
+ $newdata = array();
160
+
161
+ foreach ($data as $record) {
162
+ $newdata[] = $this -> init_class($model, $record);
163
+ }
164
+
165
+ $data = array();
166
+ $data[$model] = $newdata;
167
+ $data['Paginate'] = $paginate;
168
+ }
169
+
170
+ return $data;
171
+ }
172
+
173
+ return false;
174
+ }
175
+
176
+ function vendor($name = '', $folder = '') {
177
+ if (!empty($name)) {
178
+ $filename = 'class.' . strtolower($name) . '.php';
179
+ $filepath = rtrim(dirname(__FILE__), '/') . '/vendors/' . $folder . '';
180
+ $filefull = $filepath . $filename;
181
+
182
+ if (file_exists($filefull)) {
183
+ require_once($filefull);
184
+ $class = 'Gallery' . $name;
185
+
186
+ if (${$name} = new $class) {
187
+ return ${$name};
188
+ }
189
+ }
190
+ }
191
+
192
+ return false;
193
+ }
194
+
195
+ function check_uploaddir() {
196
+ $uploaddir = ABSPATH . 'wp-content/uploads/' . $this -> plugin_name . '/';
197
+
198
+ if (!file_exists($uploaddir)) {
199
+ if (@mkdir($uploaddir, 0777)) {
200
+ @chmod($uploaddir, 0777);
201
+ return true;
202
+ } else {
203
+ $message = __('Uploads folder named "' . $this -> plugin_name . '" cannot be created inside "wp-content/uploads"', $this -> plugin_name);
204
+ $this -> render_msg($message);
205
+ }
206
+ }
207
+
208
+ return false;
209
+ }
210
+
211
+ function add_action($action, $function = null, $priority = 10, $params = 1) {
212
+ if (add_action($action, array($this, (empty($function)) ? $action : $function), $priority, $params)) {
213
+ return true;
214
+ }
215
+
216
+ return false;
217
+ }
218
+
219
+ function enqueue_scripts() {
220
+ wp_enqueue_script('jquery');
221
+ wp_enqueue_script($this -> plugin_name, '/' . PLUGINDIR . '/' . $this -> plugin_name . '/js/gallery.js', null, "1.0");
222
+
223
+ if (is_admin()) {
224
+ if (!empty($_GET['page'])) {
225
+ if ($_GET['page'] == "slideshow-gallery-settings" || ($_GET['page'] == $this -> plugin_name . ".php" && $_GET['method'] == "order")) {
226
+ wp_enqueue_script('suggest');
227
+ wp_enqueue_script('jquery-ui-tabs');
228
+ wp_enqueue_script('wp-lists');
229
+ wp_enqueue_script('jquery-ui-sortable');
230
+ wp_enqueue_script('postbox');
231
+ wp_enqueue_script('post');
232
+ }
233
+ }
234
+
235
+ wp_enqueue_script($this -> plugin_name . 'admin', '/' . PLUGINDIR . '/' . $this -> plugin_name . '/js/admin.js', null, '1.0');
236
+ add_thickbox();
237
+ }
238
+
239
+ return true;
240
+ }
241
+
242
+ function enqueue_styles() {
243
+ $src = '/' . PLUGINDIR . '/' . $this -> plugin_name . '/css/gallery-css.php?1=1';
244
+
245
+ if ($styles = $this -> get_option('styles')) {
246
+ foreach ($styles as $skey => $sval) {
247
+ $src .= "&amp;" . $skey . "=" . urlencode($sval);
248
+ }
249
+ }
250
+
251
+ wp_enqueue_style($this -> plugin_name, $src, null, '1.0', 'screen');
252
+
253
+ return true;
254
+ }
255
+
256
+ function url() {
257
+ $url = get_option('siteurl') . substr($this -> plugin_base, strlen(realpath(ABSPATH)));
258
+ return $url;
259
+ }
260
+
261
+ function add_option($name = '', $value = '') {
262
+ if (add_option($this -> pre . $name, $value)) {
263
+ return true;
264
+ }
265
+
266
+ return false;
267
+ }
268
+
269
+ function update_option($name = '', $value = '') {
270
+ if (update_option($this -> pre . $name, $value)) {
271
+ return true;
272
+ }
273
+
274
+ return false;
275
+ }
276
+
277
+ function get_option($name = '', $stripslashes = true) {
278
+ if ($option = get_option($this -> pre . $name)) {
279
+ if (@unserialize($option) !== false) {
280
+ return unserialize($option);
281
+ }
282
+
283
+ if ($stripslashes == true) {
284
+ $option = stripslashes_deep($option);
285
+ }
286
+
287
+ return $option;
288
+ }
289
+
290
+ return false;
291
+ }
292
+
293
+ function debug($var = array()) {
294
+ if ($this -> debugging) {
295
+ echo '<pre>' . print_r($var, true) . '</pre>';
296
+ return true;
297
+ }
298
+
299
+ return false;
300
+ }
301
+
302
+ function check_table($model = null) {
303
+ global $wpdb;
304
+
305
+ if (!empty($model)) {
306
+ if (!empty($this -> fields) && is_array($this -> fields)) {
307
+ if (!$wpdb -> get_var("SHOW TABLES LIKE '" . $this -> table . "'")) {
308
+ $query = "CREATE TABLE `" . $this -> table . "` (";
309
+ $c = 1;
310
+
311
+ foreach ($this -> fields as $field => $attributes) {
312
+ if ($field != "key") {
313
+ $query .= "`" . $field . "` " . $attributes . "";
314
+ } else {
315
+ $query .= "" . $attributes . "";
316
+ }
317
+
318
+ if ($c < count($this -> fields)) {
319
+ $query .= ",";
320
+ }
321
+
322
+ $c++;
323
+ }
324
+
325
+ $query .= ") ENGINE=MyISAM AUTO_INCREMENT=1 CHARSET=UTF8;";
326
+
327
+ if (!empty($query)) {
328
+ $this -> table_query[] = $query;
329
+ }
330
+ } else {
331
+ $field_array = $this -> get_fields($this -> table);
332
+
333
+ foreach ($this -> fields as $field => $attributes) {
334
+ if ($field != "key") {
335
+ $this -> add_field($this -> table, $field, $attributes);
336
+ }
337
+ }
338
+ }
339
+
340
+ if (!empty($this -> table_query)) {
341
+ require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
342
+ dbDelta($this -> table_query, true);
343
+ }
344
+ }
345
+ }
346
+
347
+ return false;
348
+ }
349
+
350
+ function get_fields($table = null) {
351
+ global $wpdb;
352
+
353
+ if (!empty($table)) {
354
+ $fullname = $table;
355
+
356
+ if (($tablefields = mysql_list_fields(DB_NAME, $fullname, $wpdb -> dbh)) !== false) {
357
+ $columns = mysql_num_fields($tablefields);
358
+
359
+ $field_array = array();
360
+ for ($i = 0; $i < $columns; $i++) {
361
+ $fieldname = mysql_field_name($tablefields, $i);
362
+ $field_array[] = $fieldname;
363
+ }
364
+
365
+ return $field_array;
366
+ }
367
+ }
368
+
369
+ return false;
370
+ }
371
+
372
+ function delete_field($table = '', $field = '') {
373
+ global $wpdb;
374
+
375
+ if (!empty($table)) {
376
+ if (!empty($field)) {
377
+ $query = "ALTER TABLE `" . $wpdb -> prefix . "" . $table . "` DROP `" . $field . "`";
378
+
379
+ if ($wpdb -> query($query)) {
380
+ return false;
381
+ }
382
+ }
383
+ }
384
+
385
+ return false;
386
+ }
387
+
388
+ function change_field($table = '', $field = '', $newfield = '', $attributes = "TEXT NOT NULL") {
389
+ global $wpdb;
390
+
391
+ if (!empty($table)) {
392
+ if (!empty($field)) {
393
+ if (!empty($newfield)) {
394
+ $field_array = $this -> get_fields($table);
395
+
396
+ if (!in_array($field, $field_array)) {
397
+ if ($this -> add_field($table, $newfield)) {
398
+ return true;
399
+ }
400
+ } else {
401
+ $query = "ALTER TABLE `" . $table . "` CHANGE `" . $field . "` `" . $newfield . "` " . $attributes . ";";
402
+
403
+ if ($wpdb -> query($query)) {
404
+ return true;
405
+ }
406
+ }
407
+ }
408
+ }
409
+ }
410
+
411
+ return false;
412
+ }
413
+
414
+ function add_field($table = '', $field = '', $attributes = "TEXT NOT NULL") {
415
+ global $wpdb;
416
+
417
+ if (!empty($table)) {
418
+ if (!empty($field)) {
419
+ $field_array = $this -> get_fields($table);
420
+
421
+ if (!empty($field_array)) {
422
+ if (!in_array($field, $field_array)) {
423
+ $query = "ALTER TABLE `" . $table . "` ADD `" . $field . "` " . $attributes . ";";
424
+
425
+ if ($wpdb -> query($query)) {
426
+ return true;
427
+ }
428
+ }
429
+ }
430
+ }
431
+ }
432
+
433
+ return false;
434
+ }
435
+
436
+ function render($file = '', $params = array(), $output = true, $folder = 'admin') {
437
+ //the absolute path to the plugin base
438
+ $this -> plugin_base = rtrim(dirname(__FILE__), '/');
439
+
440
+ if (!empty($file)) {
441
+ $filename = $file . '.php';
442
+ $filepath = $this -> plugin_base . '/views/' . $folder . '/';
443
+ $filefull = $filepath . $filename;
444
+
445
+ if (file_exists($filefull)) {
446
+ if (!empty($params)) {
447
+ foreach ($params as $pkey => $pval) {
448
+ ${$pkey} = $pval;
449
+ }
450
+ }
451
+
452
+ if ($output == false) {
453
+ ob_start();
454
+ }
455
+
456
+ include($filefull);
457
+
458
+ if ($output == false) {
459
+ $data = ob_get_clean();
460
+ return $data;
461
+ } else {
462
+ flush();
463
+ return true;
464
+ }
465
+ }
466
+ }
467
+
468
+ return false;
469
+ }
470
+ }
471
+
472
+ ?>
slideshow-gallery.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ Plugin Name: Slideshow Gallery
5
+ Plugin URI: http://wpgallery.tribulant.net
6
+ Author: Antonie Potgieter
7
+ Author URI: http://tribulant.com
8
+ Description: Feature content in a JavaScript powered slideshow gallery showcase on your WordPress website. The slideshow is flexible and all aspects can easily be configured. Embedding or hardcoding the slideshow gallery is a breeze. To embed into a post/page, simply insert <code>[slideshow]</code> into its content. To hardcode into your theme, simply use <code>&lt;?php $Gallery -> slideshow(); ?&gt;</code>.
9
+ Version: 1.0
10
+ */
11
+
12
+ //include the GalleryPlugin class file
13
+ require_once(dirname(__FILE__) . '/slideshow-gallery-plugin.php');
14
+
15
+ class Gallery extends GalleryPlugin {
16
+
17
+ function Gallery() {
18
+ $url = explode("&", $_SERVER['REQUEST_URI']);
19
+ $this -> url = $url[0];
20
+
21
+ $this -> register_plugin('slideshow-gallery', __FILE__);
22
+
23
+ //WordPress action hooks
24
+ $this -> add_action('admin_menu');
25
+ $this -> add_action('admin_head');
26
+ $this -> add_action('admin_notices');
27
+
28
+ add_shortcode('slideshow', array($this, 'embed'));
29
+ }
30
+
31
+ function admin_menu() {
32
+ add_menu_page(__('Slideshow', $this -> plugin_name), __('Slideshow', $this -> plugin_name), 10, basename(__FILE__), array($this, 'admin_slides'), $this -> url() . '/images/icon.png');
33
+ add_submenu_page(basename(__FILE__), __('Configuration', $this -> plugin_name), __('Configuration', $this -> plugin_name), 10, $this -> plugin_name . '-settings', array($this, 'admin_settings'));
34
+ }
35
+
36
+ function admin_head() {
37
+ $this -> render('head', false, true, 'admin');
38
+ }
39
+
40
+ function admin_notices() {
41
+ $this -> check_uploaddir();
42
+
43
+ if (!empty($_GET[$this -> pre . 'message'])) {
44
+ $msg_type = (!empty($_GET[$this -> pre . 'updated'])) ? 'msg' : 'err';
45
+ call_user_method('render_' . $msg_type, $this, $_GET[$this -> pre . 'message']);
46
+ }
47
+ }
48
+
49
+ function slideshow($output = true) {
50
+ if ($slides = $this -> Slide -> find_all(null, null, array('order', "ASC"))) {
51
+ if ($output) {
52
+ $this -> render('gallery', array('slides' => $slides), true, 'default');
53
+ } else {
54
+ $content = $this -> render('gallery', array('slides' => $slides), false, 'default');
55
+ return $content;
56
+ }
57
+ }
58
+
59
+ return false;
60
+ }
61
+
62
+ function embed($atts = array()) {
63
+ $defaults = array();
64
+ extract(shortcode_atts($defaults, $atts));
65
+
66
+ if ($slides = $this -> Slide -> find_all(null, null, array('order', "ASC"))) {
67
+ $content = $this -> render('gallery', array('slides' => $slides), false, 'default');
68
+ }
69
+
70
+ return $content;
71
+ }
72
+
73
+ function admin_slides() {
74
+ switch ($_GET['method']) {
75
+ case 'save' :
76
+ if (!empty($_POST)) {
77
+ if ($this -> Slide -> save($_POST, true)) {
78
+ $message = __('Slide has been saved', $this -> plugin_name);
79
+ $this -> redirect($this -> url, "message", $message);
80
+ } else {
81
+ $this -> render('slides/save', false, true, 'admin');
82
+ }
83
+ } else {
84
+ $this -> Db -> model = $this -> Slide -> model;
85
+ $this -> Slide -> find(array('id' => $_GET['id']));
86
+ $this -> render('slides/save', false, true, 'admin');
87
+ }
88
+ break;
89
+ case 'mass' :
90
+ if (!empty($_POST['action'])) {
91
+ if (!empty($_POST['Slide']['checklist'])) {
92
+ switch ($_POST['action']) {
93
+ case 'delete' :
94
+ $this -> debug($_POST);
95
+
96
+ foreach ($_POST['Slide']['checklist'] as $slide_id) {
97
+ $this -> Slide -> delete($slide_id);
98
+ }
99
+
100
+ $message = __('Selected slides have been removed', $this -> plugin_name);
101
+ $this -> redirect($this -> url, 'message', $message);
102
+ break;
103
+ }
104
+ } else {
105
+ $message = __('No slides were selected', $this -> plugin_name);
106
+ $this -> redirect($this -> url, "error", $message);
107
+ }
108
+ } else {
109
+ $message = __('No action was specified', $this -> plugin_name);
110
+ $this -> redirect($this -> url, "error", $message);
111
+ }
112
+ break;
113
+ case 'order' :
114
+ $slides = $this -> Slide -> find_all(null, null, array('order', "ASC"));
115
+ $this -> render('slides/order', array('slides' => $slides), true, 'admin');
116
+ break;
117
+ default :
118
+ $data = $this -> paginate('Slide');
119
+ $this -> render('slides/index', array('slides' => $data[$this -> Slide -> model], 'paginate' => $data['Paginate']), true, 'admin');
120
+ break;
121
+ }
122
+ }
123
+
124
+ function admin_settings() {
125
+ switch ($_GET['method']) {
126
+ case 'reset' :
127
+ global $wpdb;
128
+ $query = "DELETE FROM `" . $wpdb -> prefix . "options` WHERE `option_name` LIKE '" . $this -> pre . "%';";
129
+
130
+ if ($wpdb -> query($query)) {
131
+ $message = __('All configuration settings have been reset to their defaults', $this -> plugin_name);
132
+ $msg_type = 'message';
133
+ $this -> render_msg($message);
134
+ } else {
135
+ $message = __('Configuration settings could not be reset', $this -> plugin_name);
136
+ $msg_type = 'error';
137
+ $this -> render_err($message);
138
+ }
139
+
140
+ $this -> redirect($this -> url, $msg_type, $message);
141
+ break;
142
+ default :
143
+ if (!empty($_POST)) {
144
+ foreach ($_POST as $pkey => $pval) {
145
+ $this -> update_option($pkey, $pval);
146
+ }
147
+
148
+ $message = __('Configuration has been saved', $this -> plugin_name);
149
+ $this -> render_msg($message);
150
+ }
151
+ break;
152
+ }
153
+
154
+ $this -> render('settings', false, true, 'admin');
155
+ }
156
+ }
157
+
158
+ //initialize a Gallery object
159
+ $Gallery = new Gallery();
160
+
161
+ ?>
trunk/css/gallery-css.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php header("Content-Type: text/css"); ?>
2
+
3
+ <?php $styles = array(); ?>
4
+ <?php foreach ($_GET as $skey => $sval) : ?>
5
+ <?php $styles[$skey] = urldecode($sval); ?>
6
+ <?php endforeach; ?>
7
+
8
+ #slideshow { list-style:none; color:#fff; }
9
+ #slideshow span { display:none; }
10
+ #wrapper { width:<?= ((int) $styles['width'] - 6); ?>px; background:<?= $styles['background']; ?>; padding:2px; border:<?= $styles['border']; ?>; margin:25px auto; display:none; }
11
+ #wrapper * { margin:0; padding:0; }
12
+ #fullsize { position:relative; overflow:hidden; width:<?= ((int) $styles['width'] - 6); ?>px; height:<?= $styles['height']; ?>px; }
13
+ #information { position:absolute; bottom:0; width:<?= ((int) $styles['width'] - 6); ?>px; height:0; background:<?= $styles['infobackground']; ?>; color:<?= $styles['infocolor']; ?>; overflow:hidden; z-index:200; opacity:.7; filter:alpha(opacity=70); }
14
+ #information h3 { color:<?= $styles['infocolor']; ?>; padding:4px 8px 3px; font-size:14px; }
15
+ #information p { color:<?= $styles['infocolor']; ?>; padding:0 8px 8px; }
16
+ #image { width:<?= ((int) $styles['width'] - 6); ?>px; }
17
+ #image img { position:absolute; border:none; z-index:25; width:<?= ((int) $styles['width'] - 6); ?>px; }
18
+ .imgnav { position:absolute; width:25%; height:<?= ((int) $styles['height'] + 6); ?>px; cursor:pointer; z-index:150; }
19
+ #imgprev { left:0; background:url('../images/left.gif') left center no-repeat; }
20
+ #imgnext { right:0; background:url('../images/right.gif') right center no-repeat; }
21
+ #imglink { position:absolute; height:<?= ((int) $styles['height'] + 6); ?>px; width:100%; z-index:100; opacity:.4; filter:alpha(opacity=40); }
22
+ .linkhover { background:url('../images/link.gif') center center no-repeat; }
23
+ #thumbnails { }
24
+ .thumbstop { margin-bottom:15px !important; }
25
+ .thumbsbot { margin-top:15px !important; }
26
+ #slideleft { float:left; width:20px; height:81px; background:url('../images/scroll-left.gif') center center no-repeat; background-color:#222; }
27
+ #slideleft:hover { background-color:#333; }
28
+ #slideright { float:right; width:20px; height:81px; background:#222 url('../images/scroll-right.gif') center center no-repeat; }
29
+ #slideright:hover { background-color:#333; }
30
+ #slidearea { float:left; background:<?= $styles['background']; ?>; position:relative; width:<?= ((int) $styles['width'] - 55); ?>px; margin-left:5px; height:81px; overflow:hidden; }
31
+ #slider { position:absolute; left:0; height:81px; }
32
+ #slider img { cursor:pointer; border:1px solid #666; padding:2px; -moz-border-radius-bottomleft:4px; -moz-border-radius-bottomright:4px; -moz-border-radius-topleft:4px; -moz-border-radius-topright:4px; }
trunk/helpers/db.php ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class GalleryDbHelper extends GalleryPlugin {
4
+
5
+ var $name = 'Db';
6
+
7
+ function find($conditions = array(), $fields = false, $order = array('id', "DESC"), $assign = true, $atts = array()) {
8
+ global $wpdb;
9
+
10
+ $newfields = "*";
11
+
12
+ if (!empty($fields)) {
13
+ if (is_array($fields)) {
14
+ $newfields = "";
15
+ $f = 1;
16
+
17
+ foreach ($fields as $field) {
18
+ $newfields .= "`" . $field . "`";
19
+
20
+ if ($f < count($fields)) {
21
+ $newfields .= ", ";
22
+ }
23
+
24
+ $f++;
25
+ }
26
+ } else {
27
+ $newfields = $fields;
28
+ }
29
+ }
30
+
31
+ $query = "SELECT " . $newfields . " FROM `" . $this -> table . "`";
32
+
33
+ if (!empty($conditions) && is_array($conditions)) {
34
+ $query .= " WHERE";
35
+ $c = 1;
36
+
37
+ foreach ($conditions as $ckey => $cval) {
38
+ $query .= " `" . $ckey . "` = '" . $cval . "'";
39
+
40
+ if ($c < count($conditions)) {
41
+ $query .= " AND";
42
+ }
43
+
44
+ $c++;
45
+ }
46
+ }
47
+
48
+ $order = (empty($order)) ? array('id', "DESC") : $order;
49
+ list($ofield, $odir) = $order;
50
+ $query .= " ORDER BY `" . $ofield . "` " . $odir . "";
51
+ $query .= " LIMIT 1";
52
+
53
+ if ($record = $wpdb -> get_row($query)) {
54
+ if (!empty($record)) {
55
+ $data = $this -> init_class($this -> model, $record);
56
+
57
+ if ($assign == true) {
58
+ $this -> data = $data;
59
+ }
60
+
61
+ return $data;
62
+ }
63
+ }
64
+
65
+ return false;
66
+ }
67
+
68
+ function find_all($conditions = array(), $fields = false, $order = array('id', "DESC"), $limit = false, $assign = false, $distinct = false) {
69
+ global $wpdb;
70
+
71
+ $newfields = "*";
72
+ if (!empty($fields) && !is_array($fields)) { $newfields = $fields; }
73
+ $distinct = (!empty($distinct)) ? "DISTINCT " : "";
74
+
75
+ $query = "SELECT " . $distinct . $newfields . " FROM `" . $this -> table . "`";
76
+
77
+ if (!empty($conditions) && is_array($conditions)) {
78
+ $query .= " WHERE";
79
+ $c = 1;
80
+
81
+ foreach ($conditions as $ckey => $cval) {
82
+ $query .= " `" . $ckey . "` = '" . $cval . "'";
83
+
84
+ if ($c < count($conditions)) {
85
+ $query .= " AND";
86
+ }
87
+
88
+ $c++;
89
+ }
90
+ }
91
+
92
+ $order = (empty($order)) ? array('id', "DESC") : $order;
93
+ list($ofield, $odir) = $order;
94
+ $query .= " ORDER BY `" . $ofield . "` " . $odir . "";
95
+ $query .= (empty($limit)) ? '' : " LIMIT " . $limit . "";
96
+
97
+ if ($records = $wpdb -> get_results($query)) {
98
+ if (!empty($records)) {
99
+ $data = array();
100
+
101
+ foreach ($records as $record) {
102
+ $data[] = $this -> init_class($this -> model, $record);
103
+ }
104
+
105
+ if ($assign == true) {
106
+ $this -> data = $data;
107
+ }
108
+
109
+ return $data;
110
+ }
111
+ }
112
+
113
+ return false;
114
+ }
115
+
116
+ function save($data = null, $validate = true) {
117
+ global $wpdb;
118
+
119
+ $defaults = (method_exists($this, 'defaults')) ? $this -> defaults() : false;
120
+ $data = (empty($data[$this -> model])) ? $data : $data[$this -> model];
121
+
122
+ $r = wp_parse_args($data, $defaults);
123
+ $this -> data = GalleryHtmlHelper::array_to_object($r);
124
+
125
+ if ($validate == true) {
126
+ if (method_exists($this, 'validate')) {
127
+ $this -> validate($r);
128
+ }
129
+ }
130
+
131
+ if (empty($this -> errors)) {
132
+ switch ($this -> model) {
133
+ case 'Slide' :
134
+ $this -> data -> image = basename($this -> data -> image_url);
135
+ break;
136
+ }
137
+
138
+ //the MySQL query
139
+ $query = (empty($this -> data -> id)) ? $this -> insert_query($this -> model) : $this -> update_query($this -> model);
140
+
141
+ if ($wpdb -> query($query)) {
142
+ $this -> insertid = $insertid = (empty($this -> data -> id)) ? $wpdb -> insert_id : $this -> data -> id;
143
+ return true;
144
+ }
145
+ }
146
+
147
+ return false;
148
+ }
149
+
150
+ function save_field($field = null, $value = null, $conditions = array()) {
151
+ if (!empty($this -> model)) {
152
+ global $wpdb;
153
+
154
+ if (!empty($field)) {
155
+ $query = "UPDATE `" . $this -> table . "` SET `" . $field . "` = '" . $value . "'";
156
+
157
+ if (!empty($conditions) && is_array($conditions)) {
158
+ $query .= " WHERE";
159
+ $c = 1;
160
+
161
+ foreach ($conditions as $ckey => $cval) {
162
+ $query .= " `" . $ckey . "` = '" . $cval . "'";
163
+
164
+ if ($c < count($conditions)) {
165
+ $query .= " AND";
166
+ }
167
+
168
+ $c++;
169
+ }
170
+ }
171
+
172
+ if ($wpdb -> query($query)) {
173
+ return true;
174
+ }
175
+ }
176
+ }
177
+
178
+ return false;
179
+ }
180
+
181
+ function delete($record_id = '') {
182
+ global $wpdb;
183
+
184
+ if (!empty($record_id) && $record = $this -> find(array('id' => $record_id))) {
185
+ $query = "DELETE FROM `" . $this -> table . "` WHERE `id` = '" . $record_id . "' LIMIT 1";
186
+
187
+ if ($wpdb -> query($query)) {
188
+ //do nothing...
189
+ return true;
190
+ }
191
+ }
192
+
193
+ return false;
194
+ }
195
+
196
+ function insert_query($model = '') {
197
+ if (!empty($model)) {
198
+ global $wpdb;
199
+
200
+ if (!empty($this -> data)) {
201
+ if (empty($this -> data -> id)) {
202
+ $query1 = "INSERT INTO `" . $this -> table . "` (";
203
+ $query2 = "";
204
+ $c = 1;
205
+ unset($this -> fields['key']);
206
+
207
+ foreach (array_keys($this -> fields) as $field) {
208
+ if (!empty($this -> data -> {$field}) || $this -> data -> {$field} == "0") {
209
+ if (is_array($this -> data -> {$field}) || is_object($this -> data -> {$field})) {
210
+ $value = serialize($this -> data -> {$field});
211
+ } else {
212
+ $value = mysql_escape_string($this -> data -> {$field});
213
+ }
214
+
215
+ $query1 .= "`" . $field . "`";
216
+ $query2 .= "'" . $value . "'";
217
+
218
+ if ($c < count($this -> fields)) {
219
+ $query1 .= ", ";
220
+ $query2 .= ", ";
221
+ }
222
+ }
223
+
224
+ $c++;
225
+ }
226
+
227
+ $query1 .= ") VALUES (";
228
+ $query = $query1 . "" . $query2 . ");";
229
+
230
+ return $query;
231
+ } else {
232
+ $query = $this -> update_query($model);
233
+
234
+ return $query;
235
+ }
236
+ }
237
+ }
238
+
239
+ return false;
240
+ }
241
+
242
+ function update_query($model = '') {
243
+ if (!empty($model)) {
244
+ global $wpdb;
245
+
246
+ if (!empty($this -> data)) {
247
+ $query = "UPDATE `" . $this -> table . "` SET ";
248
+ $c = 1;
249
+
250
+ unset($this -> fields['id']);
251
+ unset($this -> fields['key']);
252
+ unset($this -> fields['created']);
253
+
254
+ foreach (array_keys($this -> fields) as $field) {
255
+ //if (!empty($this -> data -> {$field}) || $this -> data -> {$field} == "0") {
256
+ if (is_array($this -> data -> {$field}) || is_object($this -> data -> {$field})) {
257
+ $value = serialize($this -> data -> {$field});
258
+ } else {
259
+ $value = mysql_escape_string($this -> data -> {$field});
260
+ }
261
+
262
+ $query .= "`" . $field . "` = '" . $value . "'";
263
+
264
+ if ($c < count($this -> fields)) {
265
+ $query .= ", ";
266
+ }
267
+ //}
268
+
269
+ $c++;
270
+ }
271
+
272
+ $query .= " WHERE `id` = '" . $this -> data -> id . "' LIMIT 1";
273
+
274
+ return $query;
275
+ }
276
+ }
277
+
278
+ return false;
279
+ }
280
+ }
281
+
282
+ ?>
trunk/helpers/form.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class GalleryFormHelper extends GalleryPlugin {
4
+
5
+ function hidden($name = '', $args = array()) {
6
+ global $wpcoHtml;
7
+
8
+ $defaults = array(
9
+ 'value' => (empty($args['value'])) ? $this -> Html -> field_value($name) : $args['value'],
10
+ );
11
+
12
+ $r = wp_parse_args($args, $defaults);
13
+ extract($r, EXTR_SKIP);
14
+
15
+ ob_start();
16
+
17
+ ?><input type="hidden" name="<?= $this -> Html -> field_name($name); ?>" value="<?= $value; ?>" id="<?= $name; ?>" /><?php
18
+
19
+ $hidden = ob_get_clean();
20
+ return $hidden;
21
+ }
22
+
23
+ function text($name = '', $args = array()) {
24
+ $defaults = array(
25
+ 'id' => (empty($args['id'])) ? $name : $args['id'],
26
+ 'width' => '100%',
27
+ 'class' => "widefat",
28
+ 'error' => true,
29
+ 'value' => (empty($args['value'])) ? GalleryHtmlHelper::field_value($name) : $args['value'],
30
+ 'autocomplete' => "on",
31
+ );
32
+
33
+ $r = wp_parse_args($args, $defaults);
34
+ extract($r, EXTR_SKIP);
35
+
36
+ $this -> debug($this);
37
+ echo $this -> Html -> field_value($name);
38
+
39
+ ob_start();
40
+
41
+ ?><input class="<?= $class; ?>" type="text" autocomplete="<?= $autocomplete; ?>" style="width:<?= $width; ?>" name="<?= $this -> Html -> field_name($name); ?>" value="<?= $value; ?>" id="<?= $id; ?>" /><?php
42
+
43
+ if ($error == true) {
44
+ echo $this -> Html -> field_error($name);
45
+ }
46
+
47
+ $text = ob_get_clean();
48
+ return $text;
49
+ }
50
+
51
+ function textarea($name = '', $args = array()) {
52
+ $defaults = array(
53
+ 'error' => true,
54
+ 'width' => '100%',
55
+ 'class' => "widefat",
56
+ 'rows' => 4,
57
+ 'cols' => "100%",
58
+ );
59
+
60
+ $r = wp_parse_args($args, $defaults);
61
+ extract($r, EXTR_SKIP);
62
+
63
+ ob_start();
64
+
65
+ ?><textarea class="<?= $class; ?>" name="<?= $this -> Html -> field_name($name); ?>" rows="<?= $rows; ?>" style="width:<?= $width; ?>;" cols="<?= $cols; ?>" id="<?= $name; ?>"><?= $this -> Html -> field_value($name); ?></textarea><?php
66
+
67
+ if ($error == true) {
68
+ echo $this -> Html -> field_error($name);
69
+ }
70
+
71
+ $textarea = ob_get_clean();
72
+ return $textarea;
73
+ }
74
+
75
+ function submit($name = '', $args = array()) {
76
+ $defaults = array('class' => "button-primary");
77
+ $r = wp_parse_args($args, $defaults);
78
+ extract($r, EXTR_SKIP);
79
+
80
+ ob_start();
81
+
82
+ ?><input class="<?= $class; ?>" type="submit" name="<?= $this -> Html -> sanitize($name); ?>" value="<?= $name; ?>" /><?php
83
+
84
+ $submit = ob_get_clean();
85
+ return $submit;
86
+ }
87
+ }
88
+
89
+ ?>
trunk/helpers/html.php ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class GalleryHtmlHelper extends GalleryPlugin {
4
+
5
+ function link($name = '', $href = '/', $args = array()) {
6
+ $defaults = array(
7
+ 'title' => (empty($args['title'])) ? $title : $args['title'],
8
+ 'target' => "_self",
9
+ 'class' => "wpco",
10
+ 'rel' => "",
11
+ 'onclick' => "",
12
+ );
13
+
14
+ $r = wp_parse_args($args, $defaults);
15
+ extract($r, EXTR_SKIP);
16
+
17
+ ob_start();
18
+
19
+ ?><a class="<?= $class; ?>" rel="<?= $rel; ?>" <?= (!empty($onclick)) ? 'onclick="' . $onclick . '"' : ''; ?> href="<?= $href; ?>" target="<?= $target; ?>" title="<?= $title; ?>"><?= $name; ?></a><?php
20
+
21
+ $link = ob_get_clean();
22
+ return $link;
23
+ }
24
+
25
+ function filename($url = null) {
26
+ if (!empty($url)) {
27
+ return basename($url);
28
+ }
29
+
30
+ return false;
31
+ }
32
+
33
+ function thumbname($filename = null, $append = "thumb") {
34
+ if (!empty($filename)) {
35
+ $name = $this -> strip_ext($filename, "name");
36
+ $ext = $this -> strip_ext($filename, "ext");
37
+
38
+ return $name . '-' . $append . '.' . $ext;
39
+ }
40
+
41
+ return false;
42
+ }
43
+
44
+ function image_url($filename = null) {
45
+ if (!empty($filename)) {
46
+ return get_option('siteurl') . '/wp-content/uploads/slideshow-gallery/' . $filename;
47
+ }
48
+
49
+ return false;
50
+ }
51
+
52
+ function field_name($name = '') {
53
+ if (!empty($name)) {
54
+ if ($mn = $this -> strip_mn($name)) {
55
+ return $mn[1] . '[' . $mn[2] . ']';
56
+ }
57
+ }
58
+
59
+ return $name;
60
+ }
61
+
62
+ function field_error($name = '', $el = "p") {
63
+ if (!empty($name)) {
64
+ if ($mn = $this -> strip_mn($name)) {
65
+ $errors = array();
66
+
67
+ switch ($mn[1]) {
68
+ case 'Slide' :
69
+ $errors = GallerySlide::validate($_POST);
70
+ break;
71
+ }
72
+
73
+ if (!empty($errors[$mn[2]])) {
74
+ $error = '<' . $el . ' class="' . $this -> pre . 'error">' . $errors[$mn[2]] . '</' . $el . '>';
75
+
76
+ return $error;
77
+ }
78
+ }
79
+ }
80
+
81
+ return false;
82
+ }
83
+
84
+ function field_value($name = '') {
85
+ if ($mn = $this -> strip_mn($name)) {
86
+
87
+ $value = $this -> {$mn[1]} -> data -> {$mn[2]};
88
+
89
+ return $value;
90
+ }
91
+
92
+ return false;
93
+ }
94
+
95
+ function retainquery($add = '') {
96
+ $url = $_SERVER['REQUEST_URI'];
97
+
98
+ if (($urls = @explode("?", $url)) !== false) {
99
+ if (!empty($urls[1])) {
100
+ if (!empty($add)) {
101
+ if (($adds = explode("&", str_replace("&amp;", "&", $add))) !== false) {
102
+ foreach ($adds as $qstring) {
103
+ if (($qparts = @explode("=", $qstring)) !== false) {
104
+ if (!empty($qparts[0])) {
105
+ if (preg_match("/\&?" . $qparts[0] . "\=([0-9a-z+]*)/i", $urls[1], $matches)) {
106
+ $urls[1] = preg_replace("/\&?" . $qparts[0] . "\=([0-9a-z+]*)/i", "", $urls[1]);
107
+ }
108
+ }
109
+ }
110
+ }
111
+ }
112
+ }
113
+ }
114
+ }
115
+
116
+ $urls[1] = preg_replace("/\&?" . $this -> pre . "message\=([0-9a-z+]*)/i", "", $urls[1]);
117
+ $url = $urls[0];
118
+ $url .= '?';
119
+ $url .= (empty($urls[1])) ? '' : $urls[1] . '&amp;';
120
+ $url .= $add;
121
+
122
+ return preg_replace("/\?(\&)?/si", "?", $url);
123
+ }
124
+
125
+ function strip_ext($filename = '', $return = 'ext') {
126
+ if (!empty($filename)) {
127
+ $extArray = split("[/\\.]", $filename);
128
+
129
+ if ($return == 'ext') {
130
+ $p = count($extArray) - 1;
131
+ $extension = $extArray[$p];
132
+ return $extension;
133
+ } else {
134
+ $p = count($extArray) - 2;
135
+ $filename = $extArray[$p];
136
+ return $filename;
137
+ }
138
+ }
139
+
140
+ return false;
141
+ }
142
+
143
+ function strip_mn($name = '') {
144
+ if (!empty($name)) {
145
+ if (preg_match("/^(.*?)\.(.*?)$/si", $name, $matches)) {
146
+ return $matches;
147
+ }
148
+ }
149
+
150
+ return false;
151
+ }
152
+
153
+ function gen_date($format = "Y-m-d H:i:s", $time = false) {
154
+ $time = (empty($time)) ? time() : $time;
155
+ $date = date($format, $time);
156
+
157
+ return $date;
158
+ }
159
+
160
+ function array_to_object($array = array()) {
161
+ //type casting...
162
+ return (object) $array;
163
+ }
164
+
165
+ function sanitize($string = '', $sep = '-') {
166
+ if (!empty($string)) {
167
+ $string = ereg_replace("[^0-9a-z" . $sep . "]", "", strtolower(str_replace(" ", $sep, $string)));
168
+ $string = preg_replace("/" . $sep . "[" . $sep . "]*/i", $sep, $string);
169
+
170
+ return $string;
171
+ }
172
+
173
+ return false;
174
+ }
175
+ }
176
+
177
+ ?>
trunk/helpers/metabox.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class GalleryMetaboxHelper extends GalleryPlugin {
4
+
5
+ var $name = 'Metabox';
6
+
7
+ function GalleryMetaboxHelper() {
8
+ $url = explode("&", $_SERVER['REQUEST_URI']);
9
+ $this -> url = $url[0];
10
+ }
11
+
12
+ function settings_submit() {
13
+ $this -> render('metaboxes/settings-submit', false, true, 'admin');
14
+ }
15
+
16
+ function settings_general() {
17
+ $this -> render('metaboxes/settings-general', false, true, 'admin');
18
+ }
19
+
20
+ function settings_styles() {
21
+ $this -> render('metaboxes/settings-styles', false, true, 'admin');
22
+ }
23
+ }
24
+
25
+ ?>
trunk/images/icon.png ADDED
Binary file
trunk/images/left.gif ADDED
Binary file
trunk/images/link.gif ADDED
Binary file
trunk/images/right.gif ADDED
Binary file
trunk/images/scroll-left.gif ADDED
Binary file
trunk/images/scroll-right.gif ADDED
Binary file
trunk/js/admin.js ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function(){
2
+ jQuery("input[id*=checkboxall]").click(function() {
3
+ var checked_status = this.checked;
4
+ jQuery("input[id*=checklist]").each(function() {
5
+ this.checked = checked_status;
6
+ });
7
+ });
8
+
9
+ jQuery("input[id*=checkinvert]").click(function() {
10
+ this.checked = false;
11
+
12
+ jQuery("input[id*=checklist]").each(function() {
13
+ var status = this.checked;
14
+
15
+ if (status == true) {
16
+ this.checked = false;
17
+ } else {
18
+ this.checked = true;
19
+ }
20
+ });
21
+ });
22
+ });
trunk/js/gallery.js ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var TINY={};
2
+
3
+ function tid(i){return document.getElementById(i)}
4
+ function tag(e,p){p=p||document; return p.getElementsByTagName(e)}
5
+
6
+ TINY.slideshow=function(n){
7
+ this.infoSpeed=this.imgSpeed=this.speed=10;
8
+ this.thumbOpacity=this.navHover=70;
9
+ this.navOpacity=25;
10
+ this.scrollSpeed=5;
11
+ this.letterbox='#000';
12
+ this.n=n;
13
+ this.c=0;
14
+ this.a=[]
15
+ };
16
+
17
+ TINY.slideshow.prototype={
18
+ init:function(s,z,b,f,q){
19
+ s=tid(s);
20
+ var m= tag('li',s), i=0, w=0;
21
+ this.l=m.length;
22
+ this.q=tid(q);
23
+ this.f=tid(z);
24
+ this.r=tid(this.info);
25
+ this.o=parseInt(TINY.style.val(z,'width'));
26
+ if(this.thumbs){
27
+ var u=tid(this.left), r=tid(this.right);
28
+ u.onmouseover=new Function('TINY.scroll.init("'+this.thumbs+'",-1,'+this.scrollSpeed+')');
29
+ u.onmouseout=r.onmouseout=new Function('TINY.scroll.cl("'+this.thumbs+'")');
30
+ r.onmouseover=new Function('TINY.scroll.init("'+this.thumbs+'",1,'+this.scrollSpeed+')');
31
+ this.p=tid(this.thumbs)
32
+ }
33
+ for(i;i<this.l;i++){
34
+ this.a[i]={};
35
+ var h=m[i], a=this.a[i];
36
+ a.t= tag('h3',h)[0].innerHTML;
37
+ a.d= tag('p',h)[0].innerHTML;
38
+ a.l= tag('a',h)[0]? tag('a',h)[0].href:'';
39
+ a.p= tag('span',h)[0].innerHTML;
40
+ if(this.thumbs){
41
+ var g= tag('img',h)[0];
42
+ this.p.appendChild(g);
43
+ w+=parseInt(g.offsetWidth);
44
+ if(i!=this.l-1){
45
+ g.style.marginRight=this.spacing+'px';
46
+ w+=this.spacing
47
+ }
48
+ this.p.style.width=w+'px';
49
+ g.style.opacity=this.thumbOpacity/100;
50
+ g.style.filter='alpha(opacity='+this.thumbOpacity+')';
51
+ g.onmouseover=new Function('TINY.alpha.set(this,100,5)');
52
+ g.onmouseout=new Function('TINY.alpha.set(this,'+this.thumbOpacity+',5)');
53
+ g.onclick=new Function(this.n+'.pr('+i+',1)')
54
+ }
55
+ }
56
+ if(b&&f){
57
+ b=tid(b);
58
+ f=tid(f);
59
+ b.style.opacity=f.style.opacity=this.navOpacity/100;
60
+ b.style.filter=f.style.filter='alpha(opacity='+this.navOpacity+')';
61
+ b.onmouseover=f.onmouseover=new Function('TINY.alpha.set(this,'+this.navHover+',5)');
62
+ b.onmouseout=f.onmouseout=new Function('TINY.alpha.set(this,'+this.navOpacity+',5)');
63
+ b.onclick=new Function(this.n+'.mv(-1,1)');
64
+ f.onclick=new Function(this.n+'.mv(1,1)')
65
+ }
66
+ this.auto?this.is(0,0):this.is(0,1)
67
+ },
68
+ mv:function(d,c){
69
+ var t=this.c+d;
70
+ this.c=t=t<0?this.l-1:t>this.l-1?0:t;
71
+ this.pr(t,c)
72
+ },
73
+ pr:function(t,c){
74
+ clearTimeout(this.lt);
75
+ if(c){
76
+ clearTimeout(this.at)
77
+ }
78
+ this.c=t;
79
+ this.is(t,c)
80
+ },
81
+ is:function(s,c){
82
+ if(this.info){
83
+ TINY.height.set(this.r,1,this.infoSpeed/2,-1)
84
+ }
85
+ var i=new Image();
86
+ i.style.opacity=0;
87
+ i.style.filter='alpha(opacity=0)';
88
+ this.i=i;
89
+ i.onload=new Function(this.n+'.le('+s+','+c+')');
90
+ i.src=this.a[s].p;
91
+ if(this.thumbs){
92
+ var a= tag('img',this.p), l=a.length, x=0;
93
+ for(x;x<l;x++){
94
+ a[x].style.borderColor=x!=s?'':this.active
95
+ }
96
+ }
97
+ },
98
+ le:function(s,c){
99
+ this.f.appendChild(this.i);
100
+ var w=this.o-parseInt(this.i.offsetWidth);
101
+ if(w>0){
102
+ var l=Math.floor(w/2);
103
+ this.i.style.borderLeft=l+'px solid '+this.letterbox;
104
+ this.i.style.borderRight=(w-l)+'px solid '+this.letterbox
105
+ }
106
+ TINY.alpha.set(this.i,100,this.imgSpeed);
107
+ var n=new Function(this.n+'.nf('+s+')');
108
+ this.lt=setTimeout(n,this.imgSpeed*100);
109
+ if(!c){
110
+ this.at=setTimeout(new Function(this.n+'.mv(1,0)'),this.speed*1000)
111
+ }
112
+ if(this.a[s].l!=''){
113
+ this.q.onclick=new Function('window.location="'+this.a[s].l+'"');
114
+ this.q.onmouseover=new Function('this.className="'+this.link+'"');
115
+ this.q.onmouseout=new Function('this.className=""');
116
+ this.q.style.cursor='pointer'
117
+ }else{
118
+ this.q.onclick=this.q.onmouseover=null;
119
+ this.q.style.cursor='default'
120
+ }
121
+ var m= tag('img',this.f);
122
+ if(m.length>2){
123
+ this.f.removeChild(m[0])
124
+ }
125
+ },
126
+ nf:function(s){
127
+ if(this.info){
128
+ s=this.a[s];
129
+ tag('h3',this.r)[0].innerHTML=s.t;
130
+ tag('p',this.r)[0].innerHTML=s.d;
131
+ this.r.style.height='auto';
132
+ var h=parseInt(this.r.offsetHeight);
133
+ this.r.style.height=0;
134
+ TINY.height.set(this.r,h,this.infoSpeed,0)
135
+ }
136
+ }
137
+ };
138
+
139
+ TINY.scroll=function(){
140
+ return{
141
+ init:function(e,d,s){
142
+ e=typeof e=='object'?e: tid(e); var p=e.style.left||TINY.style.val(e,'left'); e.style.left=p;
143
+ var l=d==1?parseInt(e.offsetWidth)-parseInt(e.parentNode.offsetWidth):0; e.si=setInterval(function(){TINY.scroll.mv(e,l,d,s)},20)
144
+ },
145
+ mv:function(e,l,d,s){
146
+ var c=parseInt(e.style.left); if(c==l){TINY.scroll.cl(e)}else{var i=Math.abs(l+c); i=i<s?i:s; var n=c-i*d; e.style.left=n+'px'}
147
+ },
148
+ cl:function(e){e=typeof e=='object'?e: tid(e); clearInterval(e.si)}
149
+ }
150
+ }();
151
+
152
+ TINY.height=function(){
153
+ return{
154
+ set:function(e,h,s,d){
155
+ e=typeof e=='object'?e:tid(e); var oh=e.offsetHeight, ho=e.style.height||TINY.style.val(e,'height');
156
+ ho=oh-parseInt(ho); var hd=oh-ho>h?-1:1; clearInterval(e.si); e.si=setInterval(function(){TINY.height.tw(e,h,ho,hd,s)},20)
157
+ },
158
+ tw:function(e,h,ho,hd,s){
159
+ var oh=e.offsetHeight-ho;
160
+ if(oh==h){clearInterval(e.si)}else{if(oh!=h){e.style.height=oh+(Math.ceil(Math.abs(h-oh)/s)*hd)+'px'}}
161
+ }
162
+ }
163
+ }();
164
+
165
+ TINY.alpha=function(){
166
+ return{
167
+ set:function(e,a,s){
168
+ e=typeof e=='object'?e:tid(e); var o=e.style.opacity||TINY.style.val(e,'opacity'),
169
+ d=a>o*100?1:-1; e.style.opacity=o; clearInterval(e.ai); e.ai=setInterval(function(){TINY.alpha.tw(e,a,d,s)},20)
170
+ },
171
+ tw:function(e,a,d,s){
172
+ var o=Math.round(e.style.opacity*100);
173
+ if(o==a){clearInterval(e.ai)}else{var n=o+Math.ceil(Math.abs(a-o)/s)*d; e.style.opacity=n/100; e.style.filter='alpha(opacity='+n+')'}
174
+ }
175
+ }
176
+ }();
177
+
178
+ TINY.style=function(){return{val:function(e,p){e=typeof e=='object'?e:tid(e); return e.currentStyle?e.currentStyle[p]:document.defaultView.getComputedStyle(e,null).getPropertyValue(p)}}}();
trunk/models/slide.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class GallerySlide extends GalleryDbHelper {
4
+
5
+ var $table;
6
+ var $model = 'Slide';
7
+ var $controller = "slides";
8
+ var $plugin_name = 'slideshow-gallery';
9
+
10
+ var $data = array();
11
+ var $errors = array();
12
+
13
+ var $fields = array(
14
+ 'id' => "INT(11) NOT NULL AUTO_INCREMENT",
15
+ 'title' => "VARCHAR(150) NOT NULL DEFAULT ''",
16
+ 'description' => "TEXT NOT NULL",
17
+ 'image' => "VARCHAR(50) NOT NULL DEFAULT ''",
18
+ 'image_url' => "VARCHAR(200) NOT NULL DEFAULT ''",
19
+ 'link' => "VARCHAR(200) NOT NULL DEFAULT ''",
20
+ 'order' => "INT(11) NOT NULL DEFAULT '0'",
21
+ 'created' => "DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'",
22
+ 'modified' => "DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'",
23
+ 'key' => "PRIMARY KEY (`id`)",
24
+ );
25
+
26
+ function GallerySlide($data = array()) {
27
+ global $wpdb;
28
+ $this -> table = $wpdb -> prefix . strtolower($this -> pre) . "_" . $this -> controller;
29
+ $this -> check_table($this -> model);
30
+
31
+ if (!empty($data)) {
32
+ foreach ($data as $dkey => $dval) {
33
+ $this -> {$dkey} = $dval;
34
+ }
35
+ }
36
+
37
+ return true;
38
+ }
39
+
40
+ function defaults() {
41
+ $defaults = array(
42
+ 'order' => 0,
43
+ 'created' => GalleryHtmlHelper::gen_date(),
44
+ 'modified' => GalleryHtmlHelper::gen_date(),
45
+ );
46
+
47
+ return $defaults;
48
+ }
49
+
50
+ function validate($data = null) {
51
+ $this -> errors = array();
52
+
53
+ if (!empty($data)) {
54
+ $data = (empty($data[$this -> model])) ? $data : $data[$this -> model];
55
+
56
+ foreach ($data as $dkey => $dval) {
57
+ $this -> data -> {$dkey} = stripslashes($dval);
58
+ }
59
+
60
+ extract($data, EXTR_SKIP);
61
+
62
+ if (empty($title)) { $this -> errors['title'] = __('Please fill in a title', $this -> plugin_name); }
63
+ if (empty($description)) { $this -> errors['description'] = __('Please fill in a description', $this -> plugin_name); }
64
+ if (empty($image_url)) { $this -> errors['image_url'] = __('Please specify an image', $this -> plugin_name); }
65
+ else {
66
+ if ($image = wp_remote_fopen($image_url)) {
67
+ $filename = basename($image_url);
68
+ $filepath = ABSPATH . 'wp-content/uploads/' . $this -> plugin_name . '/';
69
+ $filefull = $filepath . $filename;
70
+
71
+ if (!file_exists($filefull)) {
72
+ $fh = @fopen($filefull, "w");
73
+ @fwrite($fh, $image);
74
+ @fclose($fh);
75
+
76
+ $name = GalleryHtmlHelper::strip_ext($filename, 'filename');
77
+ $ext = GalleryHtmlHelper::strip_ext($filename, 'ext');
78
+ $thumbfull = $filepath . $name . '-thumb.' . $ext;
79
+ $smallfull = $filepath . $name . '-small.' . $ext;
80
+
81
+ image_resize($filefull, $width = null, $height = 75, $crop = false, $append = 'thumb', $dest = null, $quality = 100);
82
+ image_resize($filefull, $width = 50, $height = 50, $crop = true, $append = 'small', $dest = null, $quality = 100);
83
+
84
+ @chmod($filefull, 0777);
85
+ @chmod($thumbfull, 0777);
86
+ @chmod($smallfull, 0777);
87
+ }
88
+ }
89
+ }
90
+ } else {
91
+ $this -> errors[] = __('No data was posted', $this -> plugin_name);
92
+ }
93
+
94
+ return $this -> errors;
95
+ }
96
+ }
97
+
98
+ ?>
trunk/readme.txt ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Slideshow Gallery ===
2
+ Contributors: Antonie Potgieter
3
+ Donate link: http://tribulant.com/
4
+ Tags: slideshow, gallery, featured content, content gallery, javascript, javascript slideshow, slideshow gallery
5
+ Requires at least: 2.8
6
+ Tested up to: 2.8.4
7
+ Stable tag: 1.0
8
+
9
+ Feature content in a JavaScript powered slideshow gallery showcase on your WordPress website
10
+
11
+ == Description ==
12
+
13
+ Feature content in a JavaScript powered slideshow gallery showcase on your WordPress website.
14
+
15
+ The slideshow is flexible and all aspects can easily be configured.
16
+
17
+ Embedding or hardcoding the slideshow gallery is a breeze. To embed into a post/page, simply insert `[slideshow]` into its content. To hardcode into your theme, simply use `<?php $Gallery -> slideshow(); ?>`.
18
+
19
+ == Installation ==
20
+
21
+ Installing the WordPress slideshow gallery plugin is very easy. Simply follow the steps below.
22
+
23
+ 1. Extract the package to obtain the `slideshow-gallery` folder
24
+ 1. Upload the `slideshow-gallery` folder to the `/wp-content/plugins/` directory
25
+ 1. Activate the plugin through the 'Plugins' menu in WordPress
26
+ 1. Configure the settings according to your needs through the 'Slideshow' > 'Configuration' menu
27
+ 1. Add and manage your slides in the 'Slideshow' section
28
+ 1. Put `[slideshow]` into your posts/pages or `<?php $Gallery -> slideshow(); ?>` into your WordPress theme
29
+
30
+ == Frequently Asked Questions ==
31
+
32
+ = Can I display/embed multiple instances of the slideshow gallery? =
33
+
34
+ Yes, you can
35
+
36
+ == Screenshots ==
37
+
38
+ 1. Slideshow gallery with thumbnails at the bottom
39
+ 2. Slideshow gallery with thumbnails turned OFF
40
+ 3. Slideshow gallery with thumbnails at the top
41
+ 4. Different styles/colors
42
+
43
+ == Changelog ==
44
+
45
+ = 1.0 =
46
+ * Initial release of the WordPress Slideshow Gallery plugin
trunk/screenshot-1.png ADDED
Binary file
trunk/screenshot-2.png ADDED
Binary file
trunk/screenshot-3.png ADDED
Binary file
trunk/screenshot-4.png ADDED
Binary file
trunk/slideshow-gallery-ajax.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ include_once('../../../wp-config.php');
4
+ include_once(ABSPATH . 'wp-admin/admin-functions.php');
5
+
6
+ class GalleryAjax extends GalleryPlugin {
7
+
8
+ var $safecommands = array('slides_order');
9
+
10
+ function GalleryAjax($cmd) {
11
+ $this -> register_plugin('gallery', __FILE__);
12
+
13
+ if (!empty($cmd)) {
14
+ if (in_array($cmd, $this -> safecommands) || current_user_can('edit_plugins')) {
15
+ if (method_exists($this, $cmd)) {
16
+ $this -> $cmd();
17
+ }
18
+ }
19
+ }
20
+ }
21
+
22
+ function slides_order() {
23
+ if (!empty($_REQUEST['item'])) {
24
+ foreach ($_REQUEST['item'] as $order => $slide_id) {
25
+ $this -> Slide -> save_field('order', $order, array('id' => $slide_id));
26
+ }
27
+
28
+ ?><br/><div style="color:red;"><?php _e('Slides have been ordered', $this -> plugin_name); ?></div><?php
29
+ }
30
+ }
31
+ }
32
+
33
+ $GalleryAjax = new GalleryAjax($_GET['cmd']);
34
+
35
+ ?>
trunk/slideshow-gallery-plugin.php ADDED
@@ -0,0 +1,472 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class GalleryPlugin {
4
+
5
+ //the plugin internal name
6
+ var $plugin_name;
7
+ //the plugin absolute path
8
+ var $plugin_base;
9
+ var $pre = 'Gallery';
10
+ var $debugging = true;
11
+
12
+ var $helpers = array('Db', 'Html', 'Form', 'Metabox');
13
+ var $models = array('Slide');
14
+
15
+ function register_plugin($name, $base) {
16
+ $this -> plugin_name = $name;
17
+ $this -> plugin_base = rtrim(dirname($base), '/');
18
+
19
+ $this -> enqueue_scripts();
20
+ $this -> enqueue_styles();
21
+
22
+ $this -> initialize_classes();
23
+ $this -> initialize_options();
24
+
25
+ return true;
26
+ }
27
+
28
+ function init_class($name = null, $params = array()) {
29
+ if (!empty($name)) {
30
+ $name = $this -> pre . $name;
31
+
32
+ if (class_exists($name)) {
33
+ if ($class = new $name($params)) {
34
+ return $class;
35
+ }
36
+ }
37
+ }
38
+
39
+ $this -> init_class('Country');
40
+
41
+ return false;
42
+ }
43
+
44
+ function initialize_classes() {
45
+ if (!empty($this -> helpers)) {
46
+ foreach ($this -> helpers as $helper) {
47
+ $hfile = dirname(__FILE__) . '/helpers/' . strtolower($helper) . '.php';
48
+
49
+ if (file_exists($hfile)) {
50
+ require_once($hfile);
51
+
52
+ if (!is_object($this -> {$helper})) {
53
+ $classname = $this -> pre . $helper . 'Helper';
54
+
55
+ if (class_exists($classname, true)) {
56
+ $this -> {$helper} = new $classname;
57
+ }
58
+ }
59
+ }
60
+ }
61
+ }
62
+
63
+ if (!empty($this -> models)) {
64
+ foreach ($this -> models as $model) {
65
+ $mfile = dirname(__FILE__) . '/models/' . strtolower($model) . '.php';
66
+
67
+ if (file_exists($mfile)) {
68
+ require_once($mfile);
69
+
70
+ if (!is_object($this -> {$model})) {
71
+ $classname = $this -> pre . $model;
72
+
73
+ if (class_exists($classname, true)) {
74
+ $this -> {$model} = new $classname;
75
+ }
76
+ }
77
+ }
78
+ }
79
+ }
80
+ }
81
+
82
+ function initialize_options() {
83
+ $styles = array(
84
+ 'width' => "450",
85
+ 'height' => "250",
86
+ 'border' => "1px solid #CCCCCC",
87
+ 'background' => "#000000",
88
+ 'infobackground' => "#000000",
89
+ 'infocolor' => "#FFFFFF",
90
+ );
91
+
92
+ $this -> add_option('styles', $styles);
93
+
94
+ //General Settings
95
+ $this -> add_option('fadespeed', 10);
96
+ $this -> add_option('navopacity', 25);
97
+ $this -> add_option('navhover', 70);
98
+ $this -> add_option('information', "Y");
99
+ $this -> add_option('infospeed', 10);
100
+ $this -> add_option('thumbnails', "N");
101
+ $this -> add_option('thumbposition', "bottom");
102
+ $this -> add_option('thumbopacity', 70);
103
+ $this -> add_option('thumbscrollspeed', 5);
104
+ $this -> add_option('thumbspacing', 5);
105
+ $this -> add_option('thumbactive', "#FFFFFF");
106
+ $this -> add_option('autoslide', "Y");
107
+ $this -> add_option('autospeed', 10);
108
+ }
109
+
110
+ function render_msg($message = '') {
111
+ $this -> render('msg-top', array('message' => $message), true, 'admin');
112
+ }
113
+
114
+ function render_err($message = '') {
115
+ $this -> render('err-top', array('message' => $message), true, 'admin');
116
+ }
117
+
118
+ function redirect($location = '', $msgtype = '', $message = '') {
119
+ $url = $location;
120
+
121
+ if ($msgtype == "message") {
122
+ $url .= '&' . $this -> pre . 'updated=true';
123
+ } elseif ($msgtype == "error") {
124
+ $url .= '&' . $this -> pre . 'error=true';
125
+ }
126
+
127
+ if (!empty($message)) {
128
+ $url .= '&' . $this -> pre . 'message=' . urlencode($message);
129
+ }
130
+
131
+ ?>
132
+
133
+ <script type="text/javascript">
134
+ window.location = '<?= (empty($url)) ? get_option('home') : $url; ?>';
135
+ </script>
136
+
137
+ <?php
138
+
139
+ flush();
140
+ }
141
+
142
+ function paginate($model = null, $fields = '*', $sub = null, $conditions = null, $searchterm = null, $per_page = 10, $order = array('modified', "DESC")) {
143
+ global $wpdb;
144
+
145
+ if (!empty($model)) {
146
+ global $paginate;
147
+ $paginate = $this -> vendor('Paginate');
148
+ $paginate -> table = $this -> {$model} -> table;
149
+ $paginate -> sub = (empty($sub)) ? $this -> {$model} -> controller : $sub;
150
+ $paginate -> fields = (empty($fields)) ? '*' : $fields;
151
+ $paginate -> where = (empty($conditions)) ? false : $conditions;
152
+ $paginate -> searchterm = (empty($searchterm)) ? false : $searchterm;
153
+ $paginate -> per_page = $per_page;
154
+ $paginate -> order = $order;
155
+
156
+ $data = $paginate -> start_paging($_GET[$this -> pre . 'page']);
157
+
158
+ if (!empty($data)) {
159
+ $newdata = array();
160
+
161
+ foreach ($data as $record) {
162
+ $newdata[] = $this -> init_class($model, $record);
163
+ }
164
+
165
+ $data = array();
166
+ $data[$model] = $newdata;
167
+ $data['Paginate'] = $paginate;
168
+ }
169
+
170
+ return $data;
171
+ }
172
+
173
+ return false;
174
+ }
175
+
176
+ function vendor($name = '', $folder = '') {
177
+ if (!empty($name)) {
178
+ $filename = 'class.' . strtolower($name) . '.php';
179
+ $filepath = rtrim(dirname(__FILE__), '/') . '/vendors/' . $folder . '';
180
+ $filefull = $filepath . $filename;
181
+
182
+ if (file_exists($filefull)) {
183
+ require_once($filefull);
184
+ $class = 'Gallery' . $name;
185
+
186
+ if (${$name} = new $class) {
187
+ return ${$name};
188
+ }
189
+ }
190
+ }
191
+
192
+ return false;
193
+ }
194
+
195
+ function check_uploaddir() {
196
+ $uploaddir = ABSPATH . 'wp-content/uploads/' . $this -> plugin_name . '/';
197
+
198
+ if (!file_exists($uploaddir)) {
199
+ if (@mkdir($uploaddir, 0777)) {
200
+ @chmod($uploaddir, 0777);
201
+ return true;
202
+ } else {
203
+ $message = __('Uploads folder named "' . $this -> plugin_name . '" cannot be created inside "wp-content/uploads"', $this -> plugin_name);
204
+ $this -> render_msg($message);
205
+ }
206
+ }
207
+
208
+ return false;
209
+ }
210
+
211
+ function add_action($action, $function = null, $priority = 10, $params = 1) {
212
+ if (add_action($action, array($this, (empty($function)) ? $action : $function), $priority, $params)) {
213
+ return true;
214
+ }
215
+
216
+ return false;
217
+ }
218
+
219
+ function enqueue_scripts() {
220
+ wp_enqueue_script('jquery');
221
+ wp_enqueue_script($this -> plugin_name, '/' . PLUGINDIR . '/' . $this -> plugin_name . '/js/gallery.js', null, "1.0");
222
+
223
+ if (is_admin()) {
224
+ if (!empty($_GET['page'])) {
225
+ if ($_GET['page'] == "slideshow-gallery-settings" || ($_GET['page'] == $this -> plugin_name . ".php" && $_GET['method'] == "order")) {
226
+ wp_enqueue_script('suggest');
227
+ wp_enqueue_script('jquery-ui-tabs');
228
+ wp_enqueue_script('wp-lists');
229
+ wp_enqueue_script('jquery-ui-sortable');
230
+ wp_enqueue_script('postbox');
231
+ wp_enqueue_script('post');
232
+ }
233
+ }
234
+
235
+ wp_enqueue_script($this -> plugin_name . 'admin', '/' . PLUGINDIR . '/' . $this -> plugin_name . '/js/admin.js', null, '1.0');
236
+ add_thickbox();
237
+ }
238
+
239
+ return true;
240
+ }
241
+
242
+ function enqueue_styles() {
243
+ $src = '/' . PLUGINDIR . '/' . $this -> plugin_name . '/css/gallery-css.php?1=1';
244
+
245
+ if ($styles = $this -> get_option('styles')) {
246
+ foreach ($styles as $skey => $sval) {
247
+ $src .= "&amp;" . $skey . "=" . urlencode($sval);
248
+ }
249
+ }
250
+
251
+ wp_enqueue_style($this -> plugin_name, $src, null, '1.0', 'screen');
252
+
253
+ return true;
254
+ }
255
+
256
+ function url() {
257
+ $url = get_option('siteurl') . substr($this -> plugin_base, strlen(realpath(ABSPATH)));
258
+ return $url;
259
+ }
260
+
261
+ function add_option($name = '', $value = '') {
262
+ if (add_option($this -> pre . $name, $value)) {
263
+ return true;
264
+ }
265
+
266
+ return false;
267
+ }
268
+
269
+ function update_option($name = '', $value = '') {
270
+ if (update_option($this -> pre . $name, $value)) {
271
+ return true;
272
+ }
273
+
274
+ return false;
275
+ }
276
+
277
+ function get_option($name = '', $stripslashes = true) {
278
+ if ($option = get_option($this -> pre . $name)) {
279
+ if (@unserialize($option) !== false) {
280
+ return unserialize($option);
281
+ }
282
+
283
+ if ($stripslashes == true) {
284
+ $option = stripslashes_deep($option);
285
+ }
286
+
287
+ return $option;
288
+ }
289
+
290
+ return false;
291
+ }
292
+
293
+ function debug($var = array()) {
294
+ if ($this -> debugging) {
295
+ echo '<pre>' . print_r($var, true) . '</pre>';
296
+ return true;
297
+ }
298
+
299
+ return false;
300
+ }
301
+
302
+ function check_table($model = null) {
303
+ global $wpdb;
304
+
305
+ if (!empty($model)) {
306
+ if (!empty($this -> fields) && is_array($this -> fields)) {
307
+ if (!$wpdb -> get_var("SHOW TABLES LIKE '" . $this -> table . "'")) {
308
+ $query = "CREATE TABLE `" . $this -> table . "` (";
309
+ $c = 1;
310
+
311
+ foreach ($this -> fields as $field => $attributes) {
312
+ if ($field != "key") {
313
+ $query .= "`" . $field . "` " . $attributes . "";
314
+ } else {
315
+ $query .= "" . $attributes . "";
316
+ }
317
+
318
+ if ($c < count($this -> fields)) {
319
+ $query .= ",";
320
+ }
321
+
322
+ $c++;
323
+ }
324
+
325
+ $query .= ") ENGINE=MyISAM AUTO_INCREMENT=1 CHARSET=UTF8;";
326
+
327
+ if (!empty($query)) {
328
+ $this -> table_query[] = $query;
329
+ }
330
+ } else {
331
+ $field_array = $this -> get_fields($this -> table);
332
+
333
+ foreach ($this -> fields as $field => $attributes) {
334
+ if ($field != "key") {
335
+ $this -> add_field($this -> table, $field, $attributes);
336
+ }
337
+ }
338
+ }
339
+
340
+ if (!empty($this -> table_query)) {
341
+ require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
342
+ dbDelta($this -> table_query, true);
343
+ }
344
+ }
345
+ }
346
+
347
+ return false;
348
+ }
349
+
350
+ function get_fields($table = null) {
351
+ global $wpdb;
352
+
353
+ if (!empty($table)) {
354
+ $fullname = $table;
355
+
356
+ if (($tablefields = mysql_list_fields(DB_NAME, $fullname, $wpdb -> dbh)) !== false) {
357
+ $columns = mysql_num_fields($tablefields);
358
+
359
+ $field_array = array();
360
+ for ($i = 0; $i < $columns; $i++) {
361
+ $fieldname = mysql_field_name($tablefields, $i);
362
+ $field_array[] = $fieldname;
363
+ }
364
+
365
+ return $field_array;
366
+ }
367
+ }
368
+
369
+ return false;
370
+ }
371
+
372
+ function delete_field($table = '', $field = '') {
373
+ global $wpdb;
374
+
375
+ if (!empty($table)) {
376
+ if (!empty($field)) {
377
+ $query = "ALTER TABLE `" . $wpdb -> prefix . "" . $table . "` DROP `" . $field . "`";
378
+
379
+ if ($wpdb -> query($query)) {
380
+ return false;
381
+ }
382
+ }
383
+ }
384
+
385
+ return false;
386
+ }
387
+
388
+ function change_field($table = '', $field = '', $newfield = '', $attributes = "TEXT NOT NULL") {
389
+ global $wpdb;
390
+
391
+ if (!empty($table)) {
392
+ if (!empty($field)) {
393
+ if (!empty($newfield)) {
394
+ $field_array = $this -> get_fields($table);
395
+
396
+ if (!in_array($field, $field_array)) {
397
+ if ($this -> add_field($table, $newfield)) {
398
+ return true;
399
+ }
400
+ } else {
401
+ $query = "ALTER TABLE `" . $table . "` CHANGE `" . $field . "` `" . $newfield . "` " . $attributes . ";";
402
+
403
+ if ($wpdb -> query($query)) {
404
+ return true;
405
+ }
406
+ }
407
+ }
408
+ }
409
+ }
410
+
411
+ return false;
412
+ }
413
+
414
+ function add_field($table = '', $field = '', $attributes = "TEXT NOT NULL") {
415
+ global $wpdb;
416
+
417
+ if (!empty($table)) {
418
+ if (!empty($field)) {
419
+ $field_array = $this -> get_fields($table);
420
+
421
+ if (!empty($field_array)) {
422
+ if (!in_array($field, $field_array)) {
423
+ $query = "ALTER TABLE `" . $table . "` ADD `" . $field . "` " . $attributes . ";";
424
+
425
+ if ($wpdb -> query($query)) {
426
+ return true;
427
+ }
428
+ }
429
+ }
430
+ }
431
+ }
432
+
433
+ return false;
434
+ }
435
+
436
+ function render($file = '', $params = array(), $output = true, $folder = 'admin') {
437
+ //the absolute path to the plugin base
438
+ $this -> plugin_base = rtrim(dirname(__FILE__), '/');
439
+
440
+ if (!empty($file)) {
441
+ $filename = $file . '.php';
442
+ $filepath = $this -> plugin_base . '/views/' . $folder . '/';
443
+ $filefull = $filepath . $filename;
444
+
445
+ if (file_exists($filefull)) {
446
+ if (!empty($params)) {
447
+ foreach ($params as $pkey => $pval) {
448
+ ${$pkey} = $pval;
449
+ }
450
+ }
451
+
452
+ if ($output == false) {
453
+ ob_start();
454
+ }
455
+
456
+ include($filefull);
457
+
458
+ if ($output == false) {
459
+ $data = ob_get_clean();
460
+ return $data;
461
+ } else {
462
+ flush();
463
+ return true;
464
+ }
465
+ }
466
+ }
467
+
468
+ return false;
469
+ }
470
+ }
471
+
472
+ ?>
trunk/slideshow-gallery.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ Plugin Name: Slideshow Gallery
5
+ Plugin URI: http://wpgallery.tribulant.net
6
+ Author: Antonie Potgieter
7
+ Author URI: http://tribulant.com
8
+ Description: Feature content in a JavaScript powered slideshow gallery showcase on your WordPress website. The slideshow is flexible and all aspects can easily be configured. Embedding or hardcoding the slideshow gallery is a breeze. To embed into a post/page, simply insert <code>[slideshow]</code> into its content. To hardcode into your theme, simply use <code>&lt;?php $Gallery -> slideshow(); ?&gt;</code>.
9
+ Version: 1.0
10
+ */
11
+
12
+ //include the GalleryPlugin class file
13
+ require_once(dirname(__FILE__) . '/slideshow-gallery-plugin.php');
14
+
15
+ class Gallery extends GalleryPlugin {
16
+
17
+ function Gallery() {
18
+ $url = explode("&", $_SERVER['REQUEST_URI']);
19
+ $this -> url = $url[0];
20
+
21
+ $this -> register_plugin('slideshow-gallery', __FILE__);
22
+
23
+ //WordPress action hooks
24
+ $this -> add_action('admin_menu');
25
+ $this -> add_action('admin_head');
26
+ $this -> add_action('admin_notices');
27
+
28
+ add_shortcode('slideshow', array($this, 'embed'));
29
+ }
30
+
31
+ function admin_menu() {
32
+ add_menu_page(__('Slideshow', $this -> plugin_name), __('Slideshow', $this -> plugin_name), 10, basename(__FILE__), array($this, 'admin_slides'), $this -> url() . '/images/icon.png');
33
+ add_submenu_page(basename(__FILE__), __('Configuration', $this -> plugin_name), __('Configuration', $this -> plugin_name), 10, $this -> plugin_name . '-settings', array($this, 'admin_settings'));
34
+ }
35
+
36
+ function admin_head() {
37
+ $this -> render('head', false, true, 'admin');
38
+ }
39
+
40
+ function admin_notices() {
41
+ $this -> check_uploaddir();
42
+
43
+ if (!empty($_GET[$this -> pre . 'message'])) {
44
+ $msg_type = (!empty($_GET[$this -> pre . 'updated'])) ? 'msg' : 'err';
45
+ call_user_method('render_' . $msg_type, $this, $_GET[$this -> pre . 'message']);
46
+ }
47
+ }
48
+
49
+ function slideshow($output = true) {
50
+ if ($slides = $this -> Slide -> find_all(null, null, array('order', "ASC"))) {
51
+ if ($output) {
52
+ $this -> render('gallery', array('slides' => $slides), true, 'default');
53
+ } else {
54
+ $content = $this -> render('gallery', array('slides' => $slides), false, 'default');
55
+ return $content;
56
+ }
57
+ }
58
+
59
+ return false;
60
+ }
61
+
62
+ function embed($atts = array()) {
63
+ $defaults = array();
64
+ extract(shortcode_atts($defaults, $atts));
65
+
66
+ if ($slides = $this -> Slide -> find_all(null, null, array('order', "ASC"))) {
67
+ $content = $this -> render('gallery', array('slides' => $slides), false, 'default');
68
+ }
69
+
70
+ return $content;
71
+ }
72
+
73
+ function admin_slides() {
74
+ switch ($_GET['method']) {
75
+ case 'save' :
76
+ if (!empty($_POST)) {
77
+ if ($this -> Slide -> save($_POST, true)) {
78
+ $message = __('Slide has been saved', $this -> plugin_name);
79
+ $this -> redirect($this -> url, "message", $message);
80
+ } else {
81
+ $this -> render('slides/save', false, true, 'admin');
82
+ }
83
+ } else {
84
+ $this -> Db -> model = $this -> Slide -> model;
85
+ $this -> Slide -> find(array('id' => $_GET['id']));
86
+ $this -> render('slides/save', false, true, 'admin');
87
+ }
88
+ break;
89
+ case 'mass' :
90
+ if (!empty($_POST['action'])) {
91
+ if (!empty($_POST['Slide']['checklist'])) {
92
+ switch ($_POST['action']) {
93
+ case 'delete' :
94
+ $this -> debug($_POST);
95
+
96
+ foreach ($_POST['Slide']['checklist'] as $slide_id) {
97
+ $this -> Slide -> delete($slide_id);
98
+ }
99
+
100
+ $message = __('Selected slides have been removed', $this -> plugin_name);
101
+ $this -> redirect($this -> url, 'message', $message);
102
+ break;
103
+ }
104
+ } else {
105
+ $message = __('No slides were selected', $this -> plugin_name);
106
+ $this -> redirect($this -> url, "error", $message);
107
+ }
108
+ } else {
109
+ $message = __('No action was specified', $this -> plugin_name);
110
+ $this -> redirect($this -> url, "error", $message);
111
+ }
112
+ break;
113
+ case 'order' :
114
+ $slides = $this -> Slide -> find_all(null, null, array('order', "ASC"));
115
+ $this -> render('slides/order', array('slides' => $slides), true, 'admin');
116
+ break;
117
+ default :
118
+ $data = $this -> paginate('Slide');
119
+ $this -> render('slides/index', array('slides' => $data[$this -> Slide -> model], 'paginate' => $data['Paginate']), true, 'admin');
120
+ break;
121
+ }
122
+ }
123
+
124
+ function admin_settings() {
125
+ switch ($_GET['method']) {
126
+ case 'reset' :
127
+ global $wpdb;
128
+ $query = "DELETE FROM `" . $wpdb -> prefix . "options` WHERE `option_name` LIKE '" . $this -> pre . "%';";
129
+
130
+ if ($wpdb -> query($query)) {
131
+ $message = __('All configuration settings have been reset to their defaults', $this -> plugin_name);
132
+ $msg_type = 'message';
133
+ $this -> render_msg($message);
134
+ } else {
135
+ $message = __('Configuration settings could not be reset', $this -> plugin_name);
136
+ $msg_type = 'error';
137
+ $this -> render_err($message);
138
+ }
139
+
140
+ $this -> redirect($this -> url, $msg_type, $message);
141
+ break;
142
+ default :
143
+ if (!empty($_POST)) {
144
+ foreach ($_POST as $pkey => $pval) {
145
+ $this -> update_option($pkey, $pval);
146
+ }
147
+
148
+ $message = __('Configuration has been saved', $this -> plugin_name);
149
+ $this -> render_msg($message);
150
+ }
151
+ break;
152
+ }
153
+
154
+ $this -> render('settings', false, true, 'admin');
155
+ }
156
+ }
157
+
158
+ //initialize a Gallery object
159
+ $Gallery = new Gallery();
160
+
161
+ ?>
trunk/vendors/class.paginate.php ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class GalleryPaginate extends GalleryPlugin {
4
+
5
+ /**
6
+ * DB table name to paginate on
7
+ *
8
+ */
9
+ var $table = '';
10
+
11
+ /**
12
+ * Fields for SELECT query
13
+ * Only these fields will be fetched.
14
+ * Use asterix for all available fields
15
+ *
16
+ */
17
+ var $fields = '*';
18
+
19
+ /**
20
+ * Current page
21
+ *
22
+ */
23
+ var $page = 1;
24
+
25
+ /**
26
+ * Records to show per page
27
+ *
28
+ */
29
+ var $per_page = 10;
30
+
31
+ /**
32
+ * WHERE conditions
33
+ * This should be an array
34
+ *
35
+ */
36
+ var $where = '';
37
+
38
+ /**
39
+ * ORDER condition
40
+ *
41
+ */
42
+ var $order = array('modified', "DESC");
43
+
44
+ var $plugin_url = '';
45
+ var $sub = '';
46
+ var $parent = '';
47
+
48
+ var $allcount = 0;
49
+ var $allRecords = array();
50
+
51
+ var $pagination = '';
52
+
53
+ function GalleryPaginate($table = '', $fields = '', $sub = '', $parent = '') {
54
+ $this -> sub = $sub;
55
+ $this -> parentd = $parent;
56
+
57
+ if (!empty($table)) {
58
+ $this -> table = $table;
59
+ }
60
+
61
+ if (!empty($fields)) {
62
+ $this -> fields = $fields;
63
+ }
64
+ }
65
+
66
+ function start_paging($page = '') {
67
+ global $wpdb;
68
+
69
+ $page = (empty($page)) ? 1 : $page;
70
+
71
+ if (!empty($page)) {
72
+ $this -> page = $page;
73
+ }
74
+
75
+ if (!empty($this -> fields)) {
76
+ if (is_array($this -> fields)) {
77
+ $this -> fields = implode(", ", $this -> fields);
78
+ }
79
+ }
80
+
81
+ $query = "SELECT " . $this -> fields . " FROM `" . $this -> table . "`";
82
+ $countquery = "SELECT COUNT(*) FROM `" . $this -> table . "`";
83
+
84
+ //check if some conditions where passed.
85
+ if (!empty($this -> where)) {
86
+ //append the "WHERE" command to the query
87
+ $query .= " WHERE";
88
+ $countquery .= " WHERE";
89
+ $c = 1;
90
+
91
+ foreach ($this -> where as $key => $val) {
92
+ if (!empty($val) && is_array($val)) {
93
+ $k = 1;
94
+
95
+ foreach ($val as $vkey => $vval) {
96
+ if (eregi("LIKE", $val)) {
97
+ $query .= " `" . $key . "` " . $vval . "";
98
+ $countquery .= " `" . $key . "` " . $vval . "";
99
+ } elseif (preg_match("/SE (.*)/si", $vval, $vmatches)) {
100
+ if (!empty($vmatches[1])) {
101
+ $query .= " `" . $key . "` <= " . $vmatches[1] . "";
102
+ $countquery .= " `" . $key . "` <= " . $vmatches[1] . "";;
103
+ }
104
+ } elseif (preg_match("/LE (.*)/si", $vval, $vmatches)) {
105
+ if (!empty($vmatches[1])) {
106
+ $query .= " `" . $key . "` >= " . $vmatches[1] . "";
107
+ $countquery .= " `" . $key . "` >= " . $vmatches[1] . "";
108
+ }
109
+ } else {
110
+ $query .= " `" . $key . "` = '" . $vval . "'";
111
+ $countquery .= " `" . $key . "` = '" . $vval . "'";
112
+ }
113
+
114
+ if ($k < count($val)) {
115
+ $query .= " AND";
116
+ $countquery .= " AND";
117
+ }
118
+
119
+ $k++;
120
+ $vmatches = false;
121
+ }
122
+ } else {
123
+ if (eregi("LIKE", $val)) {
124
+ $query .= " `" . $key . "` " . $val . "";
125
+ $countquery .= " `" . $key . "` " . $val . "";
126
+ } elseif (preg_match("/SE (.*)/si", $val, $vmatches)) {
127
+ if (!empty($vmatches[1])) {
128
+ $query .= " `" . $key . "` <= " . $vmatches[1] . "";
129
+ $countquery .= " `" . $key . "` <= " . $vmatches[1] . "";
130
+ }
131
+ } elseif (preg_match("/LE (.*)/si", $val, $vmatches)) {
132
+ if (!empty($vmatches[1])) {
133
+ $query .= " `" . $key . "` >= " . $vmatches[1] . "";
134
+ $countquery .= " `" . $key . "` >= " . $vmatches[1] . "";
135
+ }
136
+ } else {
137
+ $query .= " `" . $key . "` = '" . $val . "'";
138
+ $countquery .= " `" . $key . "` = '" . $val . "'";
139
+ }
140
+
141
+ if ($c < count($this -> where)) {
142
+ $query .= " AND";
143
+ $countquery .= " AND";
144
+ }
145
+
146
+ $c++;
147
+ $vmatches = false;
148
+ }
149
+ }
150
+ }
151
+
152
+ $r = 1;
153
+
154
+ $this -> doberecords();
155
+ list($osortby, $osort) = $this -> order;
156
+ $query .= " ORDER BY `" . $osortby . "` " . $osort . " LIMIT " . $this -> begRecord . " , " . $this -> per_page . ";";
157
+ //echo $query;
158
+
159
+ $records = $wpdb -> get_results($query);
160
+ $records_count = count($records);
161
+ $allRecordsCount = $this -> allcount = $wpdb -> get_var($countquery);
162
+ $totalpagescount = round($records_count/$this -> per_page);
163
+
164
+ $pageparam = (!empty($this -> sub) && $this -> sub == "N") ? '' : 'page=' . $this -> pre . $this -> sub . '&amp;';
165
+ $pageparam = '';
166
+ $search = (empty($this -> searchterm)) ? '' : '&amp;' . $this -> pre . 'searchterm=' . urlencode($this -> searchterm);
167
+
168
+ if (count($records) < $allRecordsCount) {
169
+ $p = 1;
170
+ $k = 1;
171
+ $n = $this -> page;
172
+
173
+ $add_prev = $pageparam . $this -> pre . 'page=' . ($this -> page - 1) . $search . '';
174
+ $add_next = $pageparam . $this -> pre . 'page=' . ($this -> page + 1) . $search . '';
175
+
176
+ $this -> pagination .= '<span class="displaying-num">' . __('Displaying', $this -> plugin_name) . ' ' . ($this -> begRecord + 1) . ' - ' . ($this -> begRecord + count($records)) . ' ' . __('of', $this -> plugin_name) . ' ' . $allRecordsCount . '</span>';
177
+
178
+ if ($this -> page > 1) {
179
+ $this -> pagination .= '<a class="prev page-numbers" href="' . GalleryHtmlHelper::retainquery($add_prev) . '" title="' . __('Previous Page', $this -> plugin_name) . '">&laquo;</a>';
180
+ }
181
+
182
+ while ($p <= $allRecordsCount) {
183
+ $add_numbers = $pageparam . $this -> pre . 'page=' . ($k) . $search . '';
184
+
185
+ if ($k >= ($this -> page - 5) && $k <= ($this -> page + 5)) {
186
+ if ($k != $this -> page) {
187
+ $this -> pagination .= '<a class="page-numbers" href="' . GalleryHtmlHelper::retainquery($add_numbers) . '" title="' . __('Page', $this -> plugin_name) . ' ' . $k . '">' . $k . '</a>';
188
+ } else {
189
+ $this -> pagination .= '<span class="page-numbers current">' . $k . '</span>';
190
+ }
191
+ }
192
+
193
+ $p = $p + $this -> per_page;
194
+ $k++;
195
+ }
196
+
197
+ if ((count($records) + $this -> begRecord) < $allRecordsCount) {
198
+ $this -> pagination .= '<a class="next page-numbers" href="' . GalleryHtmlHelper::retainquery($add_next) . '" title="' . __('Next Page', $this -> plugin_name) . '">&raquo;</a>';
199
+ }
200
+ }
201
+
202
+ return $records;
203
+ }
204
+
205
+ function doberecords() {
206
+ if ($this -> page > 1) {
207
+ $this -> begRecord = (($this -> page * $this -> per_page) - ($this -> per_page));
208
+ } else {
209
+ $this -> begRecord = 0;
210
+ }
211
+
212
+ $this -> endRecord = $this -> begRecord + $this -> per_page;
213
+ }
214
+ }
215
+
216
+ ?>
trunk/views/admin/err-top.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php if (!empty($message)) : ?>
2
+ <div class="error fade">
3
+ <p><?= $message; ?></p>
4
+ </div>
5
+ <?php endif; ?>
trunk/views/admin/head.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <script type="text/javascript">
2
+ var GalleryAjax = "<?= $this -> url(); ?>/<?= $this -> plugin_name; ?>-ajax.php";
3
+ </script>
trunk/views/admin/metaboxes/settings-general.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <table class="form-table">
2
+ <tbody>
3
+ <tr>
4
+ <th><label for="autoslideY"><?php _e('Auto Slide', $this -> plugin_name); ?></label></th>
5
+ <td>
6
+ <label><input onclick="jQuery('#autoslide_div').show();" <?= ($this -> get_option('autoslide') == "Y") ? 'checked="checked"' : ''; ?> type="radio" name="autoslide" value="Y" id="autoslideY" /> <?php _e('Yes', $this -> plugin_name); ?></label>
7
+ <label><input onclick="jQuery('#autoslide_div').hide();" <?= ($this -> get_option('autoslide') == "N") ? 'checked="checked"' : ''; ?> type="radio" name="autoslide" value="N" id="autoslideN" /> <?php _e('No', $this -> plugin_name); ?></label>
8
+ </td>
9
+ </tr>
10
+ </tbody>
11
+ </table>
12
+
13
+ <div id="autoslide_div" style="display:<?= ($this -> get_option('autoslide') == "Y") ? 'block' : 'none'; ?>;">
14
+ <table class="form-table">
15
+ <tbody>
16
+ <tr>
17
+ <th><label for="autospeed"><?php _e('Auto Speed', $this -> plugin_name); ?></label></th>
18
+ <td>
19
+ <input type="text" style="width:45px;" name="autospeed" value="<?= $this -> get_option('autospeed'); ?>" id="autospeed" /> <?php _e('speed', $this -> plugin_name); ?>
20
+ <span class="howto"><?php _e('default:10', $this -> plugin_name); ?><br/><?php _e('lower number for shorter interval between images', $this -> plugin_name); ?></span>
21
+ </td>
22
+ </tr>
23
+ </tbody>
24
+ </table>
25
+ </div>
26
+
27
+ <table class="form-table">
28
+ <tbody>
29
+ <tr>
30
+ <th><label for="fadespeed"><?php _e('Image Fading Speed', $this -> plugin_name); ?></label></th>
31
+ <td>
32
+ <input style="width:45px;" type="text" name="fadespeed" value="<?= $this -> get_option('fadespeed'); ?>" id="fadespeed" />
33
+ <span class="howto"><?php _e('default:10 recommended:1-20', $this -> plugin_name); ?><br/><?php _e('lower number for quicker fading of images', $this -> plugin_name); ?></span>
34
+ </td>
35
+ </tr>
36
+ <tr>
37
+ <th><label for="navopacity"><?php _e('Navigation Default Opacity', $this -> plugin_name); ?></label></th>
38
+ <td>
39
+ <input type="text" name="navopacity" value="<?= $this -> get_option('navopacity'); ?>" id="navopacity" style="width:45px;" /> <?php _e('&#37; <!-- percentage -->', $this -> plugin_name); ?>
40
+ <span class="howto"><?php _e('opacity of the prev/next buttons by default', $this -> plugin_name); ?></span>
41
+ </td>
42
+ </tr>
43
+ <tr>
44
+ <th><label for="navhover"><?php _e('Navigation Hover Opacity', $this -> plugin_name); ?></label></th>
45
+ <td>
46
+ <input type="text" name="navhover" value="<?= $this -> get_option('navhover'); ?>" id="navhover" style="width:45px;" /> <?php _e('&#37; <!-- percentage -->', $this -> plugin_name); ?>
47
+ <span class="howto"><?php _e('opacity of the prev/next buttons when they are hovered', $this -> plugin_name); ?></span>
48
+ </td>
49
+ </tr>
50
+ <tr>
51
+ <th><label for="informationY"><?php _e('Show Information', $this -> plugin_name); ?></label></th>
52
+ <td>
53
+ <label><input onclick="jQuery('#information_div').show();" <?= ($this -> get_option('information') == "Y") ? 'checked="checked"' : ''; ?> type="radio" name="information" value="Y" id="informationY" /> <?php _e('Yes', $this -> plugin_name); ?></label>
54
+ <label><input onclick="jQuery('#information_div').hide();" <?= ($this -> get_option('information') == "N") ? 'checked="checked"' : ''; ?> type="radio" name="information" value="N" id="informationN" /> <?php _e('No', $this -> plugin_name); ?></label>
55
+ </td>
56
+ </tr>
57
+ </tbody>
58
+ </table>
59
+
60
+ <div id="information_div" style="display:<?= ($this -> get_option('information') == "Y") ? 'block' : 'none'; ?>;">
61
+ <table class="form-table">
62
+ <tbody>
63
+ <tr>
64
+ <th><label for="infospeed"><?php _e('Information Speed', $this -> plugin_name); ?></label></th>
65
+ <td>
66
+ <input type="text" style="width:45px;" name="infospeed" value="<?= $this -> get_option('infospeed'); ?>" id="infospeed" />
67
+ <span class="howto"><?php _e('speed at which the information will slide in', $this -> plugin_name); ?></span>
68
+ </td>
69
+ </tr>
70
+ </tbody>
71
+ </table>
72
+ </div>
73
+
74
+ <table class="form-table">
75
+ <tbody>
76
+ <tr>
77
+ <th><label for="thumbnailsN"><?php _e('Show Thumbnails', $this -> plugin_name); ?></label></th>
78
+ <td>
79
+ <label><input onclick="jQuery('#thumbnails_div').show();" <?= ($this -> get_option('thumbnails') == "Y") ? 'checked="checked"' : ''; ?> type="radio" name="thumbnails" value="Y" id="thumbnailsY" /> <?php _e('Yes', $this -> plugin_name); ?></label>
80
+ <label><input onclick="jQuery('#thumbnails_div').hide();" <?= ($this -> get_option('thumbnails') == "N") ? 'checked="checked"' : ''; ?> type="radio" name="thumbnails" value="N" id="thumbnailsN" /> <?php _e('No', $this -> plugin_name); ?></label>
81
+ </td>
82
+ </tr>
83
+ </tbody>
84
+ </table>
85
+
86
+ <div id="thumbnails_div" style="display:<?= ($this -> get_option('thumbnails') == "Y") ? 'block' : 'none'; ?>;">
87
+ <table class="form-table">
88
+ <tbody>
89
+ <tr>
90
+ <th><label for="thubmpositionbottom"><?php _e('Thumbnails Position', $this -> plugin_name); ?></label></th>
91
+ <td>
92
+ <label><input <?= ($this -> get_option('thumbposition') == "top") ? 'checked="checked"' : ''; ?> type="radio" name="thumbposition" value="top" id="thumbpositiontop" /> <?php _e('Top', $this -> plugin_name); ?></label>
93
+ <label><input <?= ($this -> get_option('thumbposition') == "bottom") ? 'checked="checked"' : ''; ?> type="radio" name="thumbposition" value="bottom" id="thumbpositionbottom" /> <?php _e('Bottom', $this -> plugin_name); ?></label>
94
+ </td>
95
+ </tr>
96
+ <tr>
97
+ <th><label for="thumbopacity"><?php _e('Thumbnail Opacity', $this -> plugin_name); ?></label></th>
98
+ <td>
99
+ <input style="width:45px;" type="text" name="thumbopacity" value="<?= $this -> get_option('thumbopacity'); ?>" id="thumbopacity" /> <?php _e('&#37; <!-- percentage -->', $this -> plugin_name); ?>
100
+ <span class="howto"><?php _e('default opacity of thumbnails when they are not hovered', $this -> plugin_name); ?></span>
101
+ </td>
102
+ </tr>
103
+ <tr>
104
+ <th><label for="thumbactive"><?php _e('Thumbnail Active Border', $this -> plugin_name); ?></label></th>
105
+ <td>
106
+ <input style="width:65px;" type="text" name="thumbactive" value="<?= $this -> get_option('thumbactive'); ?>" id="thumbactive" />
107
+ <span class="howto"><?php _e('border color (hexidecimal) for the active image thumbnail. default:#FFFFFF', $this -> plugin_name); ?></span>
108
+ </td>
109
+ </tr>
110
+ <tr>
111
+ <th><label for="thumbscrollspeed"><?php _e('Thumbnails Scroll Speed', $this -> plugin_name); ?></label></th>
112
+ <td>
113
+ <input style="width:45px;" name="thumbscrollspeed" value="<?= $this -> get_option('thumbscrollspeed'); ?>" id="thumbscrollspeed" /> <?php _e('speed', $this -> plugin_name); ?>
114
+ <span class="howto"><?php _e('default:5 recommended:1-20', $this -> plugin_name); ?></span>
115
+ </td>
116
+ </tr>
117
+ <tr>
118
+ <th><label for=""><?php _e('Thumbnail Spacing', $this -> plugin_name); ?></label></th>
119
+ <td>
120
+ <input type="text" style="width:45px;" name="thumbspacing" value="<?= $this -> get_option('thumbspacing'); ?>" id="thumbspacing" /> <?php _e('px', $this -> plugin_name); ?>
121
+ <span class="howto"><?php _e('horizontal margin/spacing between thumbnails', $this -> plugin_name); ?></span>
122
+ </td>
123
+ </tr>
124
+ </tbody>
125
+ </table>
126
+ </div>
trunk/views/admin/metaboxes/settings-styles.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $styles = $this -> get_option('styles'); ?>
2
+
3
+ <table class="form-table">
4
+ <tbody>
5
+ <tr>
6
+ <th><label for="styles.width"><?php _e('Gallery Width', $this -> plugin_name); ?></label></th>
7
+ <td>
8
+ <input style="width:45px;" id="styles.width" type="text" name="styles[width]" value="<?= $styles['width']; ?>" /> <?php _e('px', $this -> plugin_name); ?>
9
+ <span class="howto"><?php _e('width of the slideshow gallery', $this -> plugin_name); ?></span>
10
+ </td>
11
+ </tr>
12
+ <tr>
13
+ <th><label for="styles.height"><?php _e('Gallery Height', $this -> plugin_name); ?></label></th>
14
+ <td>
15
+ <input style="width:45px;" id="styles.height" type="text" name="styles[height]" value="<?= $styles['height']; ?>" /> <?php _e('px', $this -> plugin_name); ?>
16
+ <span class="howto"><?php _e('height of the slideshow gallery', $this -> plugin_name); ?></span>
17
+ </td>
18
+ </tr>
19
+ <tr>
20
+ <th><label for="styles.border"><?php _e('Slideshow Border', $this -> plugin_name); ?></label></th>
21
+ <td>
22
+ <input type="text" name="styles[border]" value="<?= $styles['border']; ?>" id="styles.border" style="width:145px;" />
23
+ </td>
24
+ </tr>
25
+ <tr>
26
+ <th><label for="styles.background"><?php _e('Slideshow Background', $this -> plugin_name); ?></label></th>
27
+ <td>
28
+ <input type="text" name="styles[background]" value="<?= $styles['background']; ?>" id="styles.background" style="width:65px;" />
29
+ </td>
30
+ </tr>
31
+ <tr>
32
+ <th><label for="styles.infobackground"><?php _e('Information Background', $this -> plugin_name); ?></label></th>
33
+ <td>
34
+ <input type="text" name="styles[infobackground]" value="<?= $styles['infobackground']; ?>" id="styles.infobackground" style="width:65px;" />
35
+ </td>
36
+ </tr>
37
+ <tr>
38
+ <th><label for="styles.infocolor"><?php _e('Information Text Color', $this -> plugin_name); ?></label></th>
39
+ <td>
40
+ <input type="text" name="styles[infocolor]" value="<?= $styles['infocolor']; ?>" id="styles.infocolor" style="width:65px;" />
41
+ </td>
42
+ </tr>
43
+ </tbody>
44
+ </table>
trunk/views/admin/metaboxes/settings-submit.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="submitbox" id="submitpost">
2
+ <div id="minor-publishing">
3
+ <div id="misc-publishing-actions">
4
+ <div class="misc-pub-section">
5
+ <ul>
6
+ <li><a href="<?= $this -> url; ?>&amp;method=reset" title="<?php _e('Reset all configuration settings to their default values', $this -> plugin_name); ?>" onclick="if (!confirm('<?php _e('Are you sure you wish to reset all configuration settings?', $this -> plugin_name); ?>')) { return false; }"><?php _e('Reset to Defaults', $this -> plugin_name); ?></a></li>
7
+ </ul>
8
+ </div>
9
+ </div>
10
+ </div>
11
+ <div id="major-publishing-actions">
12
+ <div id="publishing-action">
13
+ <input class="button-primary" type="submit" name="save" value="<?php _e('Save Configuration', $this -> plugin_name); ?>" />
14
+ </div>
15
+ <br class="clear" />
16
+ </div>
17
+ </div>
trunk/views/admin/msg-top.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php if (!empty($message)) : ?>
2
+ <div class="updated fade">
3
+ <p><?= $message; ?></p>
4
+ </div>
5
+ <?php endif; ?>
trunk/views/admin/paginate.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php if (!empty($paginate -> pagination)) : ?>
2
+ <div class="tablenav-pages">
3
+ <?= $paginate -> pagination; ?>
4
+ </div>
5
+ <?php endif; ?>
trunk/views/admin/settings.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ add_meta_box('submitdiv', __('Save Settings', $this -> plugin_name), array($this -> Metabox, "settings_submit"), 'post', 'side', 'core');
4
+ add_meta_box('generaldiv', __('General Settings', $this -> plugin_name), array($this -> Metabox, "settings_general"), 'post', 'normal', 'core');
5
+ add_meta_box('stylesdiv', __('Styles', $this -> plugin_name), array($this -> Metabox, "settings_styles"), 'post', 'normal', 'core');
6
+
7
+ //WordPress security measurements for calls
8
+ wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
9
+ wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
10
+
11
+ ?>
12
+
13
+ <div class="wrap">
14
+ <h2><?php _e('Configuration Settings', $this -> plugin_name); ?></h2>
15
+
16
+ <form action="<?= $this -> url; ?>" method="post">
17
+ <div id="poststuff" class="metabox-holder has-right-sidebar">
18
+ <div id="side-info-column" class="inner-sidebar">
19
+ <?php do_meta_boxes('post', 'side', $post); ?>
20
+ </div>
21
+ <div id="post-body" class="has-sidebar">
22
+ <div id="post-body-content" class="has-sidebar-content">
23
+ <?php do_meta_boxes('post', 'normal', $post); ?>
24
+ </div>
25
+ </div>
26
+ </div>
27
+ </form>
28
+ </div>
trunk/views/admin/slides/index.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <h2><?php _e('Manage Slides', $this -> plugin_name); ?> (<?= $this -> Html -> link(__('add new'), $this -> url . '&amp;method=save'); ?>)</h2>
3
+
4
+ <?php if (!empty($slides)) : ?>
5
+ <form id="posts-filter" action="<?= $this -> url; ?>" method="post">
6
+ <ul class="subsubsub">
7
+ <li><?= $paginate -> allcount; ?> <?php _e('slides', $this -> plugin_name); ?></li>
8
+ </ul>
9
+
10
+
11
+ </form>
12
+ <?php endif; ?>
13
+
14
+ <form onsubmit="if (!confirm('<?php _e('Are you sure you wish to execute this action on the selected slides?', $this -> plugin_name); ?>')) { return false; }" action="<?= $this -> url; ?>&amp;method=mass" method="post">
15
+ <div class="tablenav">
16
+ <div class="alignleft actions">
17
+ <a href="<?= $this -> url; ?>&amp;method=order" title="<?php _e('Order all your slides', $this -> plugin_name); ?>" class="button"><?php _e('Order Slides', $this -> plugin_name); ?></a>
18
+
19
+ <select name="action" class="action">
20
+ <option value="">- <?php _e('Bulk Actions', $this -> plugin_name); ?> -</option>
21
+ <option value="delete"><?php _e('Delete', $this -> plugin_name); ?></option>
22
+ </select>
23
+ <input type="submit" class="button" value="<?php _e('Apply', $this -> plugin_name); ?>" name="execute" />
24
+ </div>
25
+ <?php $this -> render('paginate', array('paginate' => $paginate), true, 'admin'); ?>
26
+ </div>
27
+
28
+ <table class="widefat">
29
+ <thead>
30
+ <tr>
31
+ <th class="check-column"><input type="checkbox" name="checkboxall" id="checkboxall" value="checkboxall" /></th>
32
+ <th><?php _e('Image', $this -> plugin_name); ?></th>
33
+ <th><?php _e('Title', $this -> plugin_name); ?></th>
34
+ <th><?php _e('Date', $this -> plugin_name); ?></th>
35
+ <th><?php _e('Order', $this -> plugin_name); ?></th>
36
+ </tr>
37
+ </thead>
38
+ <tfoot>
39
+ <tr>
40
+ <th class="check-column"><input type="checkbox" name="checkboxall" id="checkboxall" value="checkboxall" /></th>
41
+ <th><?php _e('Image', $this -> plugin_name); ?></th>
42
+ <th><?php _e('Title', $this -> plugin_name); ?></th>
43
+ <th><?php _e('Date', $this -> plugin_name); ?></th>
44
+ <th><?php _e('Order', $this -> plugin_name); ?></th>
45
+ </tr>
46
+ </tfoot>
47
+ <tbody>
48
+ <?php foreach ($slides as $slide) : ?>
49
+ <tr class="<?= $class = (empty($class)) ? 'alternate' : ''; ?>">
50
+ <th class="check-column"><input type="checkbox" name="Slide[checklist][]" value="<?= $slide -> id; ?>" id="checklist<?= $slide -> id; ?>" /></th>
51
+ <td style="width:75px;">
52
+ <?php $image = basename($slide -> image_url); ?>
53
+ <a href="<?= $this -> Html -> image_url($image); ?>" title="<?= $slide -> title; ?>" class="thickbox"><img src="<?= $this -> Html -> image_url($this -> Html -> thumbname($image, "small")); ?>" alt="<?= $this -> Html -> sanitize($slide -> title); ?>" /></a>
54
+ </td>
55
+ <td><a class="row-title" href="<?= $this -> url; ?>&amp;method=save&amp;id=<?= $slide -> id; ?>" title=""><?= $slide -> title; ?></a></td>
56
+ <td><abbr title="<?= $slide -> modified; ?>"><?= date("Y-m-d", strtotime($slide -> modified)); ?></abbr></td>
57
+ <td><?= ((int) $slide -> order + 1); ?></td>
58
+ </tr>
59
+ <?php endforeach; ?>
60
+ </tbody>
61
+ </table>
62
+
63
+ <div class="tablenav">
64
+
65
+ <?php $this -> render('paginate', array('paginate' => $paginate), true, 'admin'); ?>
66
+ </div>
67
+ </form>
68
+ </div>
trunk/views/admin/slides/order.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <h2><?php _e('Order Slides', $this -> plugin_name); ?></h2>
3
+
4
+ <div style="float:none;" class="subsubsub">
5
+ <a href="<?= $this -> url; ?>"><?php _e('&larr; Manage All Slides', $this -> plugin_name); ?></a>
6
+ </div>
7
+
8
+ <?php if (!empty($slides)) : ?>
9
+ <ul id="slidelist">
10
+ <?php foreach ($slides as $slide) : ?>
11
+ <li class="lineitem" id="item_<?= $slide -> id; ?>">
12
+ <span><img src="<?= $this -> Html -> image_url($this -> Html -> thumbname($slide -> image, "small")); ?>" alt="<?= $this -> Html -> sanitize($slide -> title); ?>" /></span>
13
+ <?= $slide -> title; ?>
14
+ </li>
15
+ <?php endforeach; ?>
16
+ </ul>
17
+
18
+ <div id="slidemessage"></div>
19
+
20
+ <script type="text/javascript">
21
+ jQuery(document).ready(function() {
22
+ jQuery("ul#slidelist").sortable({
23
+ start: function(request) {
24
+ jQuery("#slidemessage").slideUp();
25
+ },
26
+ stop: function(request) {
27
+ jQuery("#slidemessage").load(GalleryAjax + "?cmd=slides_order", jQuery("ul#slidelist").sortable('serialize')).slideDown("slow");
28
+ },
29
+ axis: "y"
30
+ });
31
+ });
32
+ </script>
33
+
34
+ <style type="text/css">
35
+ #slidelist li.lineitem {
36
+ list-style: none;
37
+ margin: 3px 0px !important;
38
+ padding: 2px 5px 2px 5px;
39
+ background-color: #F1F1F1 !important;
40
+ border:1px solid #B2B2B2;
41
+ cursor: move;
42
+ vertical-align: middle !important;
43
+ display: block;
44
+ }
45
+ </style>
46
+ <?php else : ?>
47
+ <p style="color:red;"><?php _e('No slides found', $this -> plugin_name); ?></p>
48
+ <?php endif; ?>
49
+ </div>
trunk/views/admin/slides/save.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <h2><?php _e('Save a Slide', $this -> plugin_name); ?></h2>
3
+
4
+ <form action="<?= $this -> url; ?>&amp;method=save" method="post">
5
+ <input type="hidden" name="Slide[id]" value="<?= $this -> Slide -> data -> id; ?>" />
6
+ <input type="hidden" name="Slide[order]" value="<?= $this -> Slide -> data -> order; ?>" />
7
+
8
+ <table class="form-table">
9
+ <tbody>
10
+ <tr>
11
+ <th><label for="Slide.title"><?php _e('Title', $this -> plugin_name); ?></label></th>
12
+ <td>
13
+ <input class="widefat" type="text" name="Slide[title]" value="<?= esc_attr($this -> Slide -> data -> title); ?>" id="Slide.title" />
14
+ <?= (!empty($this -> Slide -> errors['title'])) ? '<div style="color:red;">' . $this -> Slide -> errors['title'] . '</div>' : ''; ?>
15
+ </td>
16
+ </tr>
17
+ <tr>
18
+ <th><label for="Slide.description"><?php _e('Description', $this -> plugin_name); ?></label></th>
19
+ <td>
20
+ <textarea class="widefat" name="Slide[description]"><?= esc_attr($this -> Slide -> data -> description); ?></textarea>
21
+ <?= (!empty($this -> Slide -> errors['description'])) ? '<div style="color:red;">' . $this -> Slide -> errors['description'] . '</div>' : ''; ?>
22
+ </td>
23
+ </tr>
24
+ <tr>
25
+ <th><label for="Slide.image_url"><?php _e('Image URL', $this -> plugin_name); ?></th>
26
+ <td>
27
+ <input class="widefat" type="text" name="Slide[image_url]" value="<?= esc_attr($this -> Slide -> data -> image_url); ?>" id="Slide.image_url" />
28
+ <?= (!empty($this -> Slide -> errors['image_url'])) ? '<div style="color:red;">' . $this -> Slide -> errors['image_url'] . '</div>' : ''; ?>
29
+ </td>
30
+ </tr>
31
+ <tr>
32
+ <th><label for="Slide.link"><?php _e('Link To', $this -> plugin_name); ?></label></th>
33
+ <td><input class="widefat" type="text" name="Slide[link]" value="<?= esc_attr($this -> Slide -> data -> link); ?>" id="Slide.link" /></td>
34
+ </tr>
35
+ </tbody>
36
+ </table>
37
+
38
+ <p class="submit">
39
+ <input class="button-primary" type="submit" name="submit" value="<?php _e('Save Slide', $this -> plugin_name); ?>" />
40
+ </p>
41
+ </form>
42
+ </div>
trunk/views/default/gallery.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (!empty($slides)) : ?>
2
+ <ul id="slideshow" style="display:none;">
3
+ <?php foreach ($slides as $slide) : ?>
4
+ <li>
5
+ <h3><?= $slide -> title; ?></h3>
6
+ <span><?= get_option('siteurl'); ?>/wp-content/uploads/<?= $this -> plugin_name; ?>/<?= basename($slide -> image_url); ?></span>
7
+ <p><?= $slide -> description; ?></p>
8
+ <?php if ($this -> get_option('thumbnails') == "Y") : ?>
9
+ <?php if (!empty($slide -> link)) : ?>
10
+ <a href="<?= $slide -> link; ?>" title="<?= $slide -> title; ?>"><img src="<?= $this -> Html -> image_url($this -> Html -> thumbname(basename($slide -> image_url))); ?>" alt="<?= $this -> Html -> sanitize($slide -> title); ?>" /></a>
11
+ <?php else : ?>
12
+ <img src="<?= $this -> Html -> image_url($this -> Html -> thumbname(basename($slide -> image_url))); ?>" alt="<?= $this -> Html -> sanitize($slide -> title); ?>" />
13
+ <?php endif; ?>
14
+ <?php else : ?>
15
+ <a href="<?= $slide -> link; ?>" title="<?= $slide -> title; ?>"></a>
16
+ <?php endif; ?>
17
+ </li>
18
+ <?php endforeach; ?>
19
+ </ul>
20
+
21
+ <div id="wrapper">
22
+ <?php if ($this -> get_option('thumbnails') == "Y" && $this -> get_option('thumbposition') == "top") : ?>
23
+ <div id="thumbnails" class="thumbstop">
24
+ <div id="slideleft" title="<?php _e('Slide Left', $this -> plugin_name); ?>"></div>
25
+ <div id="slidearea">
26
+ <div id="slider"></div>
27
+ </div>
28
+ <div id="slideright" title="<?php _e('Slide Right', $this -> plugin_name); ?>"></div>
29
+ <br style="clear:both; visibility:hidden; height:1px;" />
30
+ </div>
31
+ <?php endif; ?>
32
+
33
+ <div id="fullsize">
34
+ <div id="imgprev" class="imgnav" title="Previous Image"></div>
35
+ <div id="imglink"></div>
36
+ <div id="imgnext" class="imgnav" title="Next Image"></div>
37
+ <div id="image"></div>
38
+ <?php if ($this -> get_option('information') == "Y") : ?>
39
+ <div id="information">
40
+ <h3></h3>
41
+ <p></p>
42
+ </div>
43
+ <?php endif; ?>
44
+ </div>
45
+
46
+ <?php if ($this -> get_option('thumbnails') == "Y" && $this -> get_option('thumbposition') == "bottom") : ?>
47
+ <div id="thumbnails" class="thumbsbot">
48
+ <div id="slideleft" title="<?php _e('Slide Left', $this -> plugin_name); ?>"></div>
49
+ <div id="slidearea">
50
+ <div id="slider"></div>
51
+ </div>
52
+ <div id="slideright" title="<?php _e('Slide Right', $this -> plugin_name); ?>"></div>
53
+ <br style="clear:both; visibility:hidden; height:1px;" />
54
+ </div>
55
+ <?php endif; ?>
56
+ </div>
57
+
58
+ <script type="text/javascript">
59
+ jQuery.noConflict();
60
+ tid('slideshow').style.display = "none";
61
+ tid('wrapper').style.display = 'block';
62
+
63
+ var slideshow = new TINY.slideshow("slideshow");
64
+
65
+ jQuery(document).ready(function() {
66
+ <?php if ($this -> get_option('autoslide')) : ?>slideshow.auto = true;<?php else : ?>slideshow.auto = false;<?php endif; ?>
67
+ slideshow.speed = <?= $this -> get_option('autospeed'); ?>;
68
+ slideshow.imgSpeed = <?= $this -> get_option('fadespeed'); ?>;
69
+ slideshow.navOpacity = <?= $this -> get_option('navopacity'); ?>;
70
+ slideshow.navHover = <?= $this -> get_option('navhover'); ?>;
71
+ slideshow.letterbox = "#000000";
72
+ slideshow.link = "linkhover";
73
+ slideshow.info = "<?= ($this -> get_option('information') == "Y") ? 'information' : ''; ?>";
74
+ slideshow.infoSpeed = <?= $this -> get_option('infospeed'); ?>;
75
+ slideshow.thumbs = "<?= ($this -> get_option('thumbnails') == "Y") ? 'slider' : ''; ?>";
76
+ slideshow.thumbOpacity = <?= $this -> get_option('thumbopacity'); ?>;
77
+ slideshow.left = "slideleft";
78
+ slideshow.right = "slideright";
79
+ slideshow.scrollSpeed = <?= $this -> get_option('thumbscrollspeed'); ?>;
80
+ slideshow.spacing = <?= $this -> get_option('thumbspacing'); ?>;
81
+ slideshow.active = "<?= $this -> get_option('thumbactive'); ?>";
82
+ slideshow.init("slideshow","image","imgprev","imgnext","imglink");
83
+ });
84
+ </script>
85
+ <?php endif; ?>
vendors/class.paginate.php ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class GalleryPaginate extends GalleryPlugin {
4
+
5
+ /**
6
+ * DB table name to paginate on
7
+ *
8
+ */
9
+ var $table = '';
10
+
11
+ /**
12
+ * Fields for SELECT query
13
+ * Only these fields will be fetched.
14
+ * Use asterix for all available fields
15
+ *
16
+ */
17
+ var $fields = '*';
18
+
19
+ /**
20
+ * Current page
21
+ *
22
+ */
23
+ var $page = 1;
24
+
25
+ /**
26
+ * Records to show per page
27
+ *
28
+ */
29
+ var $per_page = 10;
30
+
31
+ /**
32
+ * WHERE conditions
33
+ * This should be an array
34
+ *
35
+ */
36
+ var $where = '';
37
+
38
+ /**
39
+ * ORDER condition
40
+ *
41
+ */
42
+ var $order = array('modified', "DESC");
43
+
44
+ var $plugin_url = '';
45
+ var $sub = '';
46
+ var $parent = '';
47
+
48
+ var $allcount = 0;
49
+ var $allRecords = array();
50
+
51
+ var $pagination = '';
52
+
53
+ function GalleryPaginate($table = '', $fields = '', $sub = '', $parent = '') {
54
+ $this -> sub = $sub;
55
+ $this -> parentd = $parent;
56
+
57
+ if (!empty($table)) {
58
+ $this -> table = $table;
59
+ }
60
+
61
+ if (!empty($fields)) {
62
+ $this -> fields = $fields;
63
+ }
64
+ }
65
+
66
+ function start_paging($page = '') {
67
+ global $wpdb;
68
+
69
+ $page = (empty($page)) ? 1 : $page;
70
+
71
+ if (!empty($page)) {
72
+ $this -> page = $page;
73
+ }
74
+
75
+ if (!empty($this -> fields)) {
76
+ if (is_array($this -> fields)) {
77
+ $this -> fields = implode(", ", $this -> fields);
78
+ }
79
+ }
80
+
81
+ $query = "SELECT " . $this -> fields . " FROM `" . $this -> table . "`";
82
+ $countquery = "SELECT COUNT(*) FROM `" . $this -> table . "`";
83
+
84
+ //check if some conditions where passed.
85
+ if (!empty($this -> where)) {
86
+ //append the "WHERE" command to the query
87
+ $query .= " WHERE";
88
+ $countquery .= " WHERE";
89
+ $c = 1;
90
+
91
+ foreach ($this -> where as $key => $val) {
92
+ if (!empty($val) && is_array($val)) {
93
+ $k = 1;
94
+
95
+ foreach ($val as $vkey => $vval) {
96
+ if (eregi("LIKE", $val)) {
97
+ $query .= " `" . $key . "` " . $vval . "";
98
+ $countquery .= " `" . $key . "` " . $vval . "";
99
+ } elseif (preg_match("/SE (.*)/si", $vval, $vmatches)) {
100
+ if (!empty($vmatches[1])) {
101
+ $query .= " `" . $key . "` <= " . $vmatches[1] . "";
102
+ $countquery .= " `" . $key . "` <= " . $vmatches[1] . "";;
103
+ }
104
+ } elseif (preg_match("/LE (.*)/si", $vval, $vmatches)) {
105
+ if (!empty($vmatches[1])) {
106
+ $query .= " `" . $key . "` >= " . $vmatches[1] . "";
107
+ $countquery .= " `" . $key . "` >= " . $vmatches[1] . "";
108
+ }
109
+ } else {
110
+ $query .= " `" . $key . "` = '" . $vval . "'";
111
+ $countquery .= " `" . $key . "` = '" . $vval . "'";
112
+ }
113
+
114
+ if ($k < count($val)) {
115
+ $query .= " AND";
116
+ $countquery .= " AND";
117
+ }
118
+
119
+ $k++;
120
+ $vmatches = false;
121
+ }
122
+ } else {
123
+ if (eregi("LIKE", $val)) {
124
+ $query .= " `" . $key . "` " . $val . "";
125
+ $countquery .= " `" . $key . "` " . $val . "";
126
+ } elseif (preg_match("/SE (.*)/si", $val, $vmatches)) {
127
+ if (!empty($vmatches[1])) {
128
+ $query .= " `" . $key . "` <= " . $vmatches[1] . "";
129
+ $countquery .= " `" . $key . "` <= " . $vmatches[1] . "";
130
+ }
131
+ } elseif (preg_match("/LE (.*)/si", $val, $vmatches)) {
132
+ if (!empty($vmatches[1])) {
133
+ $query .= " `" . $key . "` >= " . $vmatches[1] . "";
134
+ $countquery .= " `" . $key . "` >= " . $vmatches[1] . "";
135
+ }
136
+ } else {
137
+ $query .= " `" . $key . "` = '" . $val . "'";
138
+ $countquery .= " `" . $key . "` = '" . $val . "'";
139
+ }
140
+
141
+ if ($c < count($this -> where)) {
142
+ $query .= " AND";
143
+ $countquery .= " AND";
144
+ }
145
+
146
+ $c++;
147
+ $vmatches = false;
148
+ }
149
+ }
150
+ }
151
+
152
+ $r = 1;
153
+
154
+ $this -> doberecords();
155
+ list($osortby, $osort) = $this -> order;
156
+ $query .= " ORDER BY `" . $osortby . "` " . $osort . " LIMIT " . $this -> begRecord . " , " . $this -> per_page . ";";
157
+ //echo $query;
158
+
159
+ $records = $wpdb -> get_results($query);
160
+ $records_count = count($records);
161
+ $allRecordsCount = $this -> allcount = $wpdb -> get_var($countquery);
162
+ $totalpagescount = round($records_count/$this -> per_page);
163
+
164
+ $pageparam = (!empty($this -> sub) && $this -> sub == "N") ? '' : 'page=' . $this -> pre . $this -> sub . '&amp;';
165
+ $pageparam = '';
166
+ $search = (empty($this -> searchterm)) ? '' : '&amp;' . $this -> pre . 'searchterm=' . urlencode($this -> searchterm);
167
+
168
+ if (count($records) < $allRecordsCount) {
169
+ $p = 1;
170
+ $k = 1;
171
+ $n = $this -> page;
172
+
173
+ $add_prev = $pageparam . $this -> pre . 'page=' . ($this -> page - 1) . $search . '';
174
+ $add_next = $pageparam . $this -> pre . 'page=' . ($this -> page + 1) . $search . '';
175
+
176
+ $this -> pagination .= '<span class="displaying-num">' . __('Displaying', $this -> plugin_name) . ' ' . ($this -> begRecord + 1) . ' - ' . ($this -> begRecord + count($records)) . ' ' . __('of', $this -> plugin_name) . ' ' . $allRecordsCount . '</span>';
177
+
178
+ if ($this -> page > 1) {
179
+ $this -> pagination .= '<a class="prev page-numbers" href="' . GalleryHtmlHelper::retainquery($add_prev) . '" title="' . __('Previous Page', $this -> plugin_name) . '">&laquo;</a>';
180
+ }
181
+
182
+ while ($p <= $allRecordsCount) {
183
+ $add_numbers = $pageparam . $this -> pre . 'page=' . ($k) . $search . '';
184
+
185
+ if ($k >= ($this -> page - 5) && $k <= ($this -> page + 5)) {
186
+ if ($k != $this -> page) {
187
+ $this -> pagination .= '<a class="page-numbers" href="' . GalleryHtmlHelper::retainquery($add_numbers) . '" title="' . __('Page', $this -> plugin_name) . ' ' . $k . '">' . $k . '</a>';
188
+ } else {
189
+ $this -> pagination .= '<span class="page-numbers current">' . $k . '</span>';
190
+ }
191
+ }
192
+
193
+ $p = $p + $this -> per_page;
194
+ $k++;
195
+ }
196
+
197
+ if ((count($records) + $this -> begRecord) < $allRecordsCount) {
198
+ $this -> pagination .= '<a class="next page-numbers" href="' . GalleryHtmlHelper::retainquery($add_next) . '" title="' . __('Next Page', $this -> plugin_name) . '">&raquo;</a>';
199
+ }
200
+ }
201
+
202
+ return $records;
203
+ }
204
+
205
+ function doberecords() {
206
+ if ($this -> page > 1) {
207
+ $this -> begRecord = (($this -> page * $this -> per_page) - ($this -> per_page));
208
+ } else {
209
+ $this -> begRecord = 0;
210
+ }
211
+
212
+ $this -> endRecord = $this -> begRecord + $this -> per_page;
213
+ }
214
+ }
215
+
216
+ ?>
views/admin/err-top.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php if (!empty($message)) : ?>
2
+ <div class="error fade">
3
+ <p><?= $message; ?></p>
4
+ </div>
5
+ <?php endif; ?>
views/admin/head.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <script type="text/javascript">
2
+ var GalleryAjax = "<?= $this -> url(); ?>/<?= $this -> plugin_name; ?>-ajax.php";
3
+ </script>
views/admin/metaboxes/settings-general.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <table class="form-table">
2
+ <tbody>
3
+ <tr>
4
+ <th><label for="autoslideY"><?php _e('Auto Slide', $this -> plugin_name); ?></label></th>
5
+ <td>
6
+ <label><input onclick="jQuery('#autoslide_div').show();" <?= ($this -> get_option('autoslide') == "Y") ? 'checked="checked"' : ''; ?> type="radio" name="autoslide" value="Y" id="autoslideY" /> <?php _e('Yes', $this -> plugin_name); ?></label>
7
+ <label><input onclick="jQuery('#autoslide_div').hide();" <?= ($this -> get_option('autoslide') == "N") ? 'checked="checked"' : ''; ?> type="radio" name="autoslide" value="N" id="autoslideN" /> <?php _e('No', $this -> plugin_name); ?></label>
8
+ </td>
9
+ </tr>
10
+ </tbody>
11
+ </table>
12
+
13
+ <div id="autoslide_div" style="display:<?= ($this -> get_option('autoslide') == "Y") ? 'block' : 'none'; ?>;">
14
+ <table class="form-table">
15
+ <tbody>
16
+ <tr>
17
+ <th><label for="autospeed"><?php _e('Auto Speed', $this -> plugin_name); ?></label></th>
18
+ <td>
19
+ <input type="text" style="width:45px;" name="autospeed" value="<?= $this -> get_option('autospeed'); ?>" id="autospeed" /> <?php _e('speed', $this -> plugin_name); ?>
20
+ <span class="howto"><?php _e('default:10', $this -> plugin_name); ?><br/><?php _e('lower number for shorter interval between images', $this -> plugin_name); ?></span>
21
+ </td>
22
+ </tr>
23
+ </tbody>
24
+ </table>
25
+ </div>
26
+
27
+ <table class="form-table">
28
+ <tbody>
29
+ <tr>
30
+ <th><label for="fadespeed"><?php _e('Image Fading Speed', $this -> plugin_name); ?></label></th>
31
+ <td>
32
+ <input style="width:45px;" type="text" name="fadespeed" value="<?= $this -> get_option('fadespeed'); ?>" id="fadespeed" />
33
+ <span class="howto"><?php _e('default:10 recommended:1-20', $this -> plugin_name); ?><br/><?php _e('lower number for quicker fading of images', $this -> plugin_name); ?></span>
34
+ </td>
35
+ </tr>
36
+ <tr>
37
+ <th><label for="navopacity"><?php _e('Navigation Default Opacity', $this -> plugin_name); ?></label></th>
38
+ <td>
39
+ <input type="text" name="navopacity" value="<?= $this -> get_option('navopacity'); ?>" id="navopacity" style="width:45px;" /> <?php _e('&#37; <!-- percentage -->', $this -> plugin_name); ?>
40
+ <span class="howto"><?php _e('opacity of the prev/next buttons by default', $this -> plugin_name); ?></span>
41
+ </td>
42
+ </tr>
43
+ <tr>
44
+ <th><label for="navhover"><?php _e('Navigation Hover Opacity', $this -> plugin_name); ?></label></th>
45
+ <td>
46
+ <input type="text" name="navhover" value="<?= $this -> get_option('navhover'); ?>" id="navhover" style="width:45px;" /> <?php _e('&#37; <!-- percentage -->', $this -> plugin_name); ?>
47
+ <span class="howto"><?php _e('opacity of the prev/next buttons when they are hovered', $this -> plugin_name); ?></span>
48
+ </td>
49
+ </tr>
50
+ <tr>
51
+ <th><label for="informationY"><?php _e('Show Information', $this -> plugin_name); ?></label></th>
52
+ <td>
53
+ <label><input onclick="jQuery('#information_div').show();" <?= ($this -> get_option('information') == "Y") ? 'checked="checked"' : ''; ?> type="radio" name="information" value="Y" id="informationY" /> <?php _e('Yes', $this -> plugin_name); ?></label>
54
+ <label><input onclick="jQuery('#information_div').hide();" <?= ($this -> get_option('information') == "N") ? 'checked="checked"' : ''; ?> type="radio" name="information" value="N" id="informationN" /> <?php _e('No', $this -> plugin_name); ?></label>
55
+ </td>
56
+ </tr>
57
+ </tbody>
58
+ </table>
59
+
60
+ <div id="information_div" style="display:<?= ($this -> get_option('information') == "Y") ? 'block' : 'none'; ?>;">
61
+ <table class="form-table">
62
+ <tbody>
63
+ <tr>
64
+ <th><label for="infospeed"><?php _e('Information Speed', $this -> plugin_name); ?></label></th>
65
+ <td>
66
+ <input type="text" style="width:45px;" name="infospeed" value="<?= $this -> get_option('infospeed'); ?>" id="infospeed" />
67
+ <span class="howto"><?php _e('speed at which the information will slide in', $this -> plugin_name); ?></span>
68
+ </td>
69
+ </tr>
70
+ </tbody>
71
+ </table>
72
+ </div>
73
+
74
+ <table class="form-table">
75
+ <tbody>
76
+ <tr>
77
+ <th><label for="thumbnailsN"><?php _e('Show Thumbnails', $this -> plugin_name); ?></label></th>
78
+ <td>
79
+ <label><input onclick="jQuery('#thumbnails_div').show();" <?= ($this -> get_option('thumbnails') == "Y") ? 'checked="checked"' : ''; ?> type="radio" name="thumbnails" value="Y" id="thumbnailsY" /> <?php _e('Yes', $this -> plugin_name); ?></label>
80
+ <label><input onclick="jQuery('#thumbnails_div').hide();" <?= ($this -> get_option('thumbnails') == "N") ? 'checked="checked"' : ''; ?> type="radio" name="thumbnails" value="N" id="thumbnailsN" /> <?php _e('No', $this -> plugin_name); ?></label>
81
+ </td>
82
+ </tr>
83
+ </tbody>
84
+ </table>
85
+
86
+ <div id="thumbnails_div" style="display:<?= ($this -> get_option('thumbnails') == "Y") ? 'block' : 'none'; ?>;">
87
+ <table class="form-table">
88
+ <tbody>
89
+ <tr>
90
+ <th><label for="thubmpositionbottom"><?php _e('Thumbnails Position', $this -> plugin_name); ?></label></th>
91
+ <td>
92
+ <label><input <?= ($this -> get_option('thumbposition') == "top") ? 'checked="checked"' : ''; ?> type="radio" name="thumbposition" value="top" id="thumbpositiontop" /> <?php _e('Top', $this -> plugin_name); ?></label>
93
+ <label><input <?= ($this -> get_option('thumbposition') == "bottom") ? 'checked="checked"' : ''; ?> type="radio" name="thumbposition" value="bottom" id="thumbpositionbottom" /> <?php _e('Bottom', $this -> plugin_name); ?></label>
94
+ </td>
95
+ </tr>
96
+ <tr>
97
+ <th><label for="thumbopacity"><?php _e('Thumbnail Opacity', $this -> plugin_name); ?></label></th>
98
+ <td>
99
+ <input style="width:45px;" type="text" name="thumbopacity" value="<?= $this -> get_option('thumbopacity'); ?>" id="thumbopacity" /> <?php _e('&#37; <!-- percentage -->', $this -> plugin_name); ?>
100
+ <span class="howto"><?php _e('default opacity of thumbnails when they are not hovered', $this -> plugin_name); ?></span>
101
+ </td>
102
+ </tr>
103
+ <tr>
104
+ <th><label for="thumbactive"><?php _e('Thumbnail Active Border', $this -> plugin_name); ?></label></th>
105
+ <td>
106
+ <input style="width:65px;" type="text" name="thumbactive" value="<?= $this -> get_option('thumbactive'); ?>" id="thumbactive" />
107
+ <span class="howto"><?php _e('border color (hexidecimal) for the active image thumbnail. default:#FFFFFF', $this -> plugin_name); ?></span>
108
+ </td>
109
+ </tr>
110
+ <tr>
111
+ <th><label for="thumbscrollspeed"><?php _e('Thumbnails Scroll Speed', $this -> plugin_name); ?></label></th>
112
+ <td>
113
+ <input style="width:45px;" name="thumbscrollspeed" value="<?= $this -> get_option('thumbscrollspeed'); ?>" id="thumbscrollspeed" /> <?php _e('speed', $this -> plugin_name); ?>
114
+ <span class="howto"><?php _e('default:5 recommended:1-20', $this -> plugin_name); ?></span>
115
+ </td>
116
+ </tr>
117
+ <tr>
118
+ <th><label for=""><?php _e('Thumbnail Spacing', $this -> plugin_name); ?></label></th>
119
+ <td>
120
+ <input type="text" style="width:45px;" name="thumbspacing" value="<?= $this -> get_option('thumbspacing'); ?>" id="thumbspacing" /> <?php _e('px', $this -> plugin_name); ?>
121
+ <span class="howto"><?php _e('horizontal margin/spacing between thumbnails', $this -> plugin_name); ?></span>
122
+ </td>
123
+ </tr>
124
+ </tbody>
125
+ </table>
126
+ </div>
views/admin/metaboxes/settings-styles.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $styles = $this -> get_option('styles'); ?>
2
+
3
+ <table class="form-table">
4
+ <tbody>
5
+ <tr>
6
+ <th><label for="styles.width"><?php _e('Gallery Width', $this -> plugin_name); ?></label></th>
7
+ <td>
8
+ <input style="width:45px;" id="styles.width" type="text" name="styles[width]" value="<?= $styles['width']; ?>" /> <?php _e('px', $this -> plugin_name); ?>
9
+ <span class="howto"><?php _e('width of the slideshow gallery', $this -> plugin_name); ?></span>
10
+ </td>
11
+ </tr>
12
+ <tr>
13
+ <th><label for="styles.height"><?php _e('Gallery Height', $this -> plugin_name); ?></label></th>
14
+ <td>
15
+ <input style="width:45px;" id="styles.height" type="text" name="styles[height]" value="<?= $styles['height']; ?>" /> <?php _e('px', $this -> plugin_name); ?>
16
+ <span class="howto"><?php _e('height of the slideshow gallery', $this -> plugin_name); ?></span>
17
+ </td>
18
+ </tr>
19
+ <tr>
20
+ <th><label for="styles.border"><?php _e('Slideshow Border', $this -> plugin_name); ?></label></th>
21
+ <td>
22
+ <input type="text" name="styles[border]" value="<?= $styles['border']; ?>" id="styles.border" style="width:145px;" />
23
+ </td>
24
+ </tr>
25
+ <tr>
26
+ <th><label for="styles.background"><?php _e('Slideshow Background', $this -> plugin_name); ?></label></th>
27
+ <td>
28
+ <input type="text" name="styles[background]" value="<?= $styles['background']; ?>" id="styles.background" style="width:65px;" />
29
+ </td>
30
+ </tr>
31
+ <tr>
32
+ <th><label for="styles.infobackground"><?php _e('Information Background', $this -> plugin_name); ?></label></th>
33
+ <td>
34
+ <input type="text" name="styles[infobackground]" value="<?= $styles['infobackground']; ?>" id="styles.infobackground" style="width:65px;" />
35
+ </td>
36
+ </tr>
37
+ <tr>
38
+ <th><label for="styles.infocolor"><?php _e('Information Text Color', $this -> plugin_name); ?></label></th>
39
+ <td>
40
+ <input type="text" name="styles[infocolor]" value="<?= $styles['infocolor']; ?>" id="styles.infocolor" style="width:65px;" />
41
+ </td>
42
+ </tr>
43
+ </tbody>
44
+ </table>
views/admin/metaboxes/settings-submit.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="submitbox" id="submitpost">
2
+ <div id="minor-publishing">
3
+ <div id="misc-publishing-actions">
4
+ <div class="misc-pub-section">
5
+ <ul>
6
+ <li><a href="<?= $this -> url; ?>&amp;method=reset" title="<?php _e('Reset all configuration settings to their default values', $this -> plugin_name); ?>" onclick="if (!confirm('<?php _e('Are you sure you wish to reset all configuration settings?', $this -> plugin_name); ?>')) { return false; }"><?php _e('Reset to Defaults', $this -> plugin_name); ?></a></li>
7
+ </ul>
8
+ </div>
9
+ </div>
10
+ </div>
11
+ <div id="major-publishing-actions">
12
+ <div id="publishing-action">
13
+ <input class="button-primary" type="submit" name="save" value="<?php _e('Save Configuration', $this -> plugin_name); ?>" />
14
+ </div>
15
+ <br class="clear" />
16
+ </div>
17
+ </div>
views/admin/msg-top.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php if (!empty($message)) : ?>
2
+ <div class="updated fade">
3
+ <p><?= $message; ?></p>
4
+ </div>
5
+ <?php endif; ?>
views/admin/paginate.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php if (!empty($paginate -> pagination)) : ?>
2
+ <div class="tablenav-pages">
3
+ <?= $paginate -> pagination; ?>
4
+ </div>
5
+ <?php endif; ?>
views/admin/settings.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ add_meta_box('submitdiv', __('Save Settings', $this -> plugin_name), array($this -> Metabox, "settings_submit"), 'post', 'side', 'core');
4
+ add_meta_box('generaldiv', __('General Settings', $this -> plugin_name), array($this -> Metabox, "settings_general"), 'post', 'normal', 'core');
5
+ add_meta_box('stylesdiv', __('Styles', $this -> plugin_name), array($this -> Metabox, "settings_styles"), 'post', 'normal', 'core');
6
+
7
+ //WordPress security measurements for calls
8
+ wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
9
+ wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
10
+
11
+ ?>
12
+
13
+ <div class="wrap">
14
+ <h2><?php _e('Configuration Settings', $this -> plugin_name); ?></h2>
15
+
16
+ <form action="<?= $this -> url; ?>" method="post">
17
+ <div id="poststuff" class="metabox-holder has-right-sidebar">
18
+ <div id="side-info-column" class="inner-sidebar">
19
+ <?php do_meta_boxes('post', 'side', $post); ?>
20
+ </div>
21
+ <div id="post-body" class="has-sidebar">
22
+ <div id="post-body-content" class="has-sidebar-content">
23
+ <?php do_meta_boxes('post', 'normal', $post); ?>
24
+ </div>
25
+ </div>
26
+ </div>
27
+ </form>
28
+ </div>
views/admin/slides/index.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <h2><?php _e('Manage Slides', $this -> plugin_name); ?> (<?= $this -> Html -> link(__('add new'), $this -> url . '&amp;method=save'); ?>)</h2>
3
+
4
+ <?php if (!empty($slides)) : ?>
5
+ <form id="posts-filter" action="<?= $this -> url; ?>" method="post">
6
+ <ul class="subsubsub">
7
+ <li><?= $paginate -> allcount; ?> <?php _e('slides', $this -> plugin_name); ?></li>
8
+ </ul>
9
+
10
+
11
+ </form>
12
+ <?php endif; ?>
13
+
14
+ <form onsubmit="if (!confirm('<?php _e('Are you sure you wish to execute this action on the selected slides?', $this -> plugin_name); ?>')) { return false; }" action="<?= $this -> url; ?>&amp;method=mass" method="post">
15
+ <div class="tablenav">
16
+ <div class="alignleft actions">
17
+ <a href="<?= $this -> url; ?>&amp;method=order" title="<?php _e('Order all your slides', $this -> plugin_name); ?>" class="button"><?php _e('Order Slides', $this -> plugin_name); ?></a>
18
+
19
+ <select name="action" class="action">
20
+ <option value="">- <?php _e('Bulk Actions', $this -> plugin_name); ?> -</option>
21
+ <option value="delete"><?php _e('Delete', $this -> plugin_name); ?></option>
22
+ </select>
23
+ <input type="submit" class="button" value="<?php _e('Apply', $this -> plugin_name); ?>" name="execute" />
24
+ </div>
25
+ <?php $this -> render('paginate', array('paginate' => $paginate), true, 'admin'); ?>
26
+ </div>
27
+
28
+ <table class="widefat">
29
+ <thead>
30
+ <tr>
31
+ <th class="check-column"><input type="checkbox" name="checkboxall" id="checkboxall" value="checkboxall" /></th>
32
+ <th><?php _e('Image', $this -> plugin_name); ?></th>
33
+ <th><?php _e('Title', $this -> plugin_name); ?></th>
34
+ <th><?php _e('Date', $this -> plugin_name); ?></th>
35
+ <th><?php _e('Order', $this -> plugin_name); ?></th>
36
+ </tr>
37
+ </thead>
38
+ <tfoot>
39
+ <tr>
40
+ <th class="check-column"><input type="checkbox" name="checkboxall" id="checkboxall" value="checkboxall" /></th>
41
+ <th><?php _e('Image', $this -> plugin_name); ?></th>
42
+ <th><?php _e('Title', $this -> plugin_name); ?></th>
43
+ <th><?php _e('Date', $this -> plugin_name); ?></th>
44
+ <th><?php _e('Order', $this -> plugin_name); ?></th>
45
+ </tr>
46
+ </tfoot>
47
+ <tbody>
48
+ <?php foreach ($slides as $slide) : ?>
49
+ <tr class="<?= $class = (empty($class)) ? 'alternate' : ''; ?>">
50
+ <th class="check-column"><input type="checkbox" name="Slide[checklist][]" value="<?= $slide -> id; ?>" id="checklist<?= $slide -> id; ?>" /></th>
51
+ <td style="width:75px;">
52
+ <?php $image = basename($slide -> image_url); ?>
53
+ <a href="<?= $this -> Html -> image_url($image); ?>" title="<?= $slide -> title; ?>" class="thickbox"><img src="<?= $this -> Html -> image_url($this -> Html -> thumbname($image, "small")); ?>" alt="<?= $this -> Html -> sanitize($slide -> title); ?>" /></a>
54
+ </td>
55
+ <td><a class="row-title" href="<?= $this -> url; ?>&amp;method=save&amp;id=<?= $slide -> id; ?>" title=""><?= $slide -> title; ?></a></td>
56
+ <td><abbr title="<?= $slide -> modified; ?>"><?= date("Y-m-d", strtotime($slide -> modified)); ?></abbr></td>
57
+ <td><?= ((int) $slide -> order + 1); ?></td>
58
+ </tr>
59
+ <?php endforeach; ?>
60
+ </tbody>
61
+ </table>
62
+
63
+ <div class="tablenav">
64
+
65
+ <?php $this -> render('paginate', array('paginate' => $paginate), true, 'admin'); ?>
66
+ </div>
67
+ </form>
68
+ </div>
views/admin/slides/order.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <h2><?php _e('Order Slides', $this -> plugin_name); ?></h2>
3
+
4
+ <div style="float:none;" class="subsubsub">
5
+ <a href="<?= $this -> url; ?>"><?php _e('&larr; Manage All Slides', $this -> plugin_name); ?></a>
6
+ </div>
7
+
8
+ <?php if (!empty($slides)) : ?>
9
+ <ul id="slidelist">
10
+ <?php foreach ($slides as $slide) : ?>
11
+ <li class="lineitem" id="item_<?= $slide -> id; ?>">
12
+ <span><img src="<?= $this -> Html -> image_url($this -> Html -> thumbname($slide -> image, "small")); ?>" alt="<?= $this -> Html -> sanitize($slide -> title); ?>" /></span>
13
+ <?= $slide -> title; ?>
14
+ </li>
15
+ <?php endforeach; ?>
16
+ </ul>
17
+
18
+ <div id="slidemessage"></div>
19
+
20
+ <script type="text/javascript">
21
+ jQuery(document).ready(function() {
22
+ jQuery("ul#slidelist").sortable({
23
+ start: function(request) {
24
+ jQuery("#slidemessage").slideUp();
25
+ },
26
+ stop: function(request) {
27
+ jQuery("#slidemessage").load(GalleryAjax + "?cmd=slides_order", jQuery("ul#slidelist").sortable('serialize')).slideDown("slow");
28
+ },
29
+ axis: "y"
30
+ });
31
+ });
32
+ </script>
33
+
34
+ <style type="text/css">
35
+ #slidelist li.lineitem {
36
+ list-style: none;
37
+ margin: 3px 0px !important;
38
+ padding: 2px 5px 2px 5px;
39
+ background-color: #F1F1F1 !important;
40
+ border:1px solid #B2B2B2;
41
+ cursor: move;
42
+ vertical-align: middle !important;
43
+ display: block;
44
+ }
45
+ </style>
46
+ <?php else : ?>
47
+ <p style="color:red;"><?php _e('No slides found', $this -> plugin_name); ?></p>
48
+ <?php endif; ?>
49
+ </div>
views/admin/slides/save.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <h2><?php _e('Save a Slide', $this -> plugin_name); ?></h2>
3
+
4
+ <form action="<?= $this -> url; ?>&amp;method=save" method="post">
5
+ <input type="hidden" name="Slide[id]" value="<?= $this -> Slide -> data -> id; ?>" />
6
+ <input type="hidden" name="Slide[order]" value="<?= $this -> Slide -> data -> order; ?>" />
7
+
8
+ <table class="form-table">
9
+ <tbody>
10
+ <tr>
11
+ <th><label for="Slide.title"><?php _e('Title', $this -> plugin_name); ?></label></th>
12
+ <td>
13
+ <input class="widefat" type="text" name="Slide[title]" value="<?= esc_attr($this -> Slide -> data -> title); ?>" id="Slide.title" />
14
+ <?= (!empty($this -> Slide -> errors['title'])) ? '<div style="color:red;">' . $this -> Slide -> errors['title'] . '</div>' : ''; ?>
15
+ </td>
16
+ </tr>
17
+ <tr>
18
+ <th><label for="Slide.description"><?php _e('Description', $this -> plugin_name); ?></label></th>
19
+ <td>
20
+ <textarea class="widefat" name="Slide[description]"><?= esc_attr($this -> Slide -> data -> description); ?></textarea>
21
+ <?= (!empty($this -> Slide -> errors['description'])) ? '<div style="color:red;">' . $this -> Slide -> errors['description'] . '</div>' : ''; ?>
22
+ </td>
23
+ </tr>
24
+ <tr>
25
+ <th><label for="Slide.image_url"><?php _e('Image URL', $this -> plugin_name); ?></th>
26
+ <td>
27
+ <input class="widefat" type="text" name="Slide[image_url]" value="<?= esc_attr($this -> Slide -> data -> image_url); ?>" id="Slide.image_url" />
28
+ <?= (!empty($this -> Slide -> errors['image_url'])) ? '<div style="color:red;">' . $this -> Slide -> errors['image_url'] . '</div>' : ''; ?>
29
+ </td>
30
+ </tr>
31
+ <tr>
32
+ <th><label for="Slide.link"><?php _e('Link To', $this -> plugin_name); ?></label></th>
33
+ <td><input class="widefat" type="text" name="Slide[link]" value="<?= esc_attr($this -> Slide -> data -> link); ?>" id="Slide.link" /></td>
34
+ </tr>
35
+ </tbody>
36
+ </table>
37
+
38
+ <p class="submit">
39
+ <input class="button-primary" type="submit" name="submit" value="<?php _e('Save Slide', $this -> plugin_name); ?>" />
40
+ </p>
41
+ </form>
42
+ </div>
views/default/gallery.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (!empty($slides)) : ?>
2
+ <ul id="slideshow" style="display:none;">
3
+ <?php foreach ($slides as $slide) : ?>
4
+ <li>
5
+ <h3><?= $slide -> title; ?></h3>
6
+ <span><?= get_option('siteurl'); ?>/wp-content/uploads/<?= $this -> plugin_name; ?>/<?= basename($slide -> image_url); ?></span>
7
+ <p><?= $slide -> description; ?></p>
8
+ <?php if ($this -> get_option('thumbnails') == "Y") : ?>
9
+ <?php if (!empty($slide -> link)) : ?>
10
+ <a href="<?= $slide -> link; ?>" title="<?= $slide -> title; ?>"><img src="<?= $this -> Html -> image_url($this -> Html -> thumbname(basename($slide -> image_url))); ?>" alt="<?= $this -> Html -> sanitize($slide -> title); ?>" /></a>
11
+ <?php else : ?>
12
+ <img src="<?= $this -> Html -> image_url($this -> Html -> thumbname(basename($slide -> image_url))); ?>" alt="<?= $this -> Html -> sanitize($slide -> title); ?>" />
13
+ <?php endif; ?>
14
+ <?php else : ?>
15
+ <a href="<?= $slide -> link; ?>" title="<?= $slide -> title; ?>"></a>
16
+ <?php endif; ?>
17
+ </li>
18
+ <?php endforeach; ?>
19
+ </ul>
20
+
21
+ <div id="wrapper">
22
+ <?php if ($this -> get_option('thumbnails') == "Y" && $this -> get_option('thumbposition') == "top") : ?>
23
+ <div id="thumbnails" class="thumbstop">
24
+ <div id="slideleft" title="<?php _e('Slide Left', $this -> plugin_name); ?>"></div>
25
+ <div id="slidearea">
26
+ <div id="slider"></div>
27
+ </div>
28
+ <div id="slideright" title="<?php _e('Slide Right', $this -> plugin_name); ?>"></div>
29
+ <br style="clear:both; visibility:hidden; height:1px;" />
30
+ </div>
31
+ <?php endif; ?>
32
+
33
+ <div id="fullsize">
34
+ <div id="imgprev" class="imgnav" title="Previous Image"></div>
35
+ <div id="imglink"></div>
36
+ <div id="imgnext" class="imgnav" title="Next Image"></div>
37
+ <div id="image"></div>
38
+ <?php if ($this -> get_option('information') == "Y") : ?>
39
+ <div id="information">
40
+ <h3></h3>
41
+ <p></p>
42
+ </div>
43
+ <?php endif; ?>
44
+ </div>
45
+
46
+ <?php if ($this -> get_option('thumbnails') == "Y" && $this -> get_option('thumbposition') == "bottom") : ?>
47
+ <div id="thumbnails" class="thumbsbot">
48
+ <div id="slideleft" title="<?php _e('Slide Left', $this -> plugin_name); ?>"></div>
49
+ <div id="slidearea">
50
+ <div id="slider"></div>
51
+ </div>
52
+ <div id="slideright" title="<?php _e('Slide Right', $this -> plugin_name); ?>"></div>
53
+ <br style="clear:both; visibility:hidden; height:1px;" />
54
+ </div>
55
+ <?php endif; ?>
56
+ </div>
57
+
58
+ <script type="text/javascript">
59
+ jQuery.noConflict();
60
+ tid('slideshow').style.display = "none";
61
+ tid('wrapper').style.display = 'block';
62
+
63
+ var slideshow = new TINY.slideshow("slideshow");
64
+
65
+ jQuery(document).ready(function() {
66
+ <?php if ($this -> get_option('autoslide')) : ?>slideshow.auto = true;<?php else : ?>slideshow.auto = false;<?php endif; ?>
67
+ slideshow.speed = <?= $this -> get_option('autospeed'); ?>;
68
+ slideshow.imgSpeed = <?= $this -> get_option('fadespeed'); ?>;
69
+ slideshow.navOpacity = <?= $this -> get_option('navopacity'); ?>;
70
+ slideshow.navHover = <?= $this -> get_option('navhover'); ?>;
71
+ slideshow.letterbox = "#000000";
72
+ slideshow.link = "linkhover";
73
+ slideshow.info = "<?= ($this -> get_option('information') == "Y") ? 'information' : ''; ?>";
74
+ slideshow.infoSpeed = <?= $this -> get_option('infospeed'); ?>;
75
+ slideshow.thumbs = "<?= ($this -> get_option('thumbnails') == "Y") ? 'slider' : ''; ?>";
76
+ slideshow.thumbOpacity = <?= $this -> get_option('thumbopacity'); ?>;
77
+ slideshow.left = "slideleft";
78
+ slideshow.right = "slideright";
79
+ slideshow.scrollSpeed = <?= $this -> get_option('thumbscrollspeed'); ?>;
80
+ slideshow.spacing = <?= $this -> get_option('thumbspacing'); ?>;
81
+ slideshow.active = "<?= $this -> get_option('thumbactive'); ?>";
82
+ slideshow.init("slideshow","image","imgprev","imgnext","imglink");
83
+ });
84
+ </script>
85
+ <?php endif; ?>