Slideshow Gallery - Version 1.1

Version Description

  • ADDED: "THIS POST" added to the TinyMCE dialog to insert a shortcode for a slideshow of the current post
  • IMPROVED: Some CSS improvements to the slideshow
  • ADDED: Thickbox to show images in overlay. Can be turned On/Off
  • FIXED: Fixed all thumbnails not preloading on first load
  • FIXED: Slide HREF in IE
  • ADDED: Spinner loading indicator to show the slideshow is loading up
  • ADDED: "Link" column in the "Manage Slides" section
  • FIXED: Load Thickbox on the 'Manage Slides' page for the enlargements
  • ADDED: Ability to upload an image when saving a slide rather than specifying a URL
  • ADDED: Row actions in the 'Manage Slides' section
Download this release

Release Info

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

Code changes from version 1.0.5 to 1.1

css/gallery-css.php CHANGED
@@ -1,32 +1,34 @@
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
- #slideshow-wrapper { width:<?php echo ((int) $styles['width'] - 6); ?>px; background:<?php echo $styles['background']; ?>; padding:2px; border:<?php echo $styles['border']; ?>; margin:25px auto; display:none; }
11
- #slideshow-wrapper * { margin:0; padding:0; }
12
- #fullsize { position:relative; z-index:1; overflow:hidden; width:<?php echo ((int) $styles['width'] - 6); ?>px; height:<?php echo $styles['height']; ?>px; }
13
- #information { position:absolute; bottom:0; width:<?php echo ((int) $styles['width'] - 6); ?>px; height:0; background:<?php echo $styles['infobackground']; ?>; color:<?php echo $styles['infocolor']; ?>; overflow:hidden; z-index:200; opacity:.7; filter:alpha(opacity=70); }
14
- #information h3 { color:<?php echo $styles['infocolor']; ?>; padding:4px 8px 3px; font-size:14px; }
15
- #information p { color:<?php echo $styles['infocolor']; ?>; padding:0 8px 8px; }
16
- #image { width:<?php echo ((int) $styles['width'] - 6); ?>px; }
17
- <?php if (empty($styles['resizeimages']) || $styles['resizeimages'] == "Y") : ?>#image img { position:absolute; border:none; width:<?php echo ((int) $styles['width'] - 6); ?>px; height:auto; }<?php else : ?>#image img { position:absolute; border:none; width:auto; }<?php endif; ?>
18
- .imgnav { position:absolute; width:25%; height:<?php echo ((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:<?php echo ((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:<?php echo $styles['background']; ?>; position:relative; width:<?php echo ((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:4px; -webkit-border-radius:4px; float:left !important; }
 
 
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 !important; color:#fff; }
9
+ #slideshow span { display:none; }
10
+ #slideshow-wrapper { position:relative; width:<?php echo ((int) $styles['width'] - 6); ?>px; background:<?php echo $styles['background']; ?>; padding:2px; border:<?php echo $styles['border']; ?>; margin:0; display:none; }
11
+ #slideshow-wrapper * { margin:0; padding:0; }
12
+ #fullsize { position:relative; z-index:1; overflow:hidden; width:<?php echo ((int) $styles['width'] - 8); ?>px; height:<?php echo ((int) $styles['height'] - 6); ?>px; border:1px #CCC solid; }
13
+ #information { font-family:Verdana, Arial, Helvetica, sans-serif !important; position:absolute; bottom:0; width:<?php echo ((int) $styles['width'] - 6); ?>px; height:0; background:<?php echo $styles['infobackground']; ?>; color:<?php echo $styles['infocolor']; ?>; overflow:hidden; z-index:200; opacity:.7; filter:alpha(opacity=70); }
14
+ #information h3 { color:<?php echo $styles['infocolor']; ?>; padding:4px 8px 3px; margin:0 !important; font-size:16px; font-weight:bold; }
15
+ #information p { color:<?php echo $styles['infocolor']; ?>; padding:0 8px 8px; margin:0 !important; font-size: 14px; font-weight:normal; }
16
+ #image { width:<?php echo ((int) $styles['width'] - 6); ?>px; no-repeat; }
17
+ <?php if (empty($styles['resizeimages']) || $styles['resizeimages'] == "Y") : ?>#image img { position:absolute; border:none; width:<?php echo ((int) $styles['width'] - 8); ?>px; height:auto; }<?php else : ?>#image img { position:absolute; border:none; width:auto; }<?php endif; ?>
18
+ .imgnav { position:absolute; width:25%; height:<?php echo ((int) $styles['height'] + 8); ?>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; zoom:1; background-color:#ffffff; height:<?php echo ((int) $styles['height'] + 8); ?>px; width:50%; left:25%; right:20%; z-index:999; opacity:0; filter:alpha(opacity=0); }
22
+ .linkhover { background:transparent url('../images/link.gif') center center no-repeat !important; text-indent:-9999px; opacity:.4 !important; filter:alpha(opacity=40) !important; }
23
+ #thumbnails { background:<?php echo $styles['background']; ?>; }
24
+ .thumbstop { margin-bottom:8px !important; }
25
+ .thumbsbot { margin-top:8px !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:<?php echo $styles['background']; ?>; position:relative; width:<?php echo ((int) $styles['width'] - 57); ?>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:4px; -webkit-border-radius:4px; float:left !important; }
33
+ #spinner { position:relative; top:50%; left:45%; }
34
+ #spinner img {border:none;}
helpers/db.php CHANGED
@@ -1,288 +1,292 @@
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
-
136
- if (empty($this -> data -> uselink) || $this -> data -> uselink == "N") {
137
- $this -> data -> link = "";
138
- }
139
- break;
140
- }
141
-
142
- //the MySQL query
143
- $query = (empty($this -> data -> id)) ? $this -> insert_query($this -> model) : $this -> update_query($this -> model);
144
- echo $query;
145
- //return false;
146
-
147
- if ($wpdb -> query($query)) {
148
- $this -> insertid = $insertid = (empty($this -> data -> id)) ? $wpdb -> insert_id : $this -> data -> id;
149
- return true;
150
- }
151
- }
152
-
153
- return false;
154
- }
155
-
156
- function save_field($field = null, $value = null, $conditions = array()) {
157
- if (!empty($this -> model)) {
158
- global $wpdb;
159
-
160
- if (!empty($field)) {
161
- $query = "UPDATE `" . $this -> table . "` SET `" . $field . "` = '" . $value . "'";
162
-
163
- if (!empty($conditions) && is_array($conditions)) {
164
- $query .= " WHERE";
165
- $c = 1;
166
-
167
- foreach ($conditions as $ckey => $cval) {
168
- $query .= " `" . $ckey . "` = '" . $cval . "'";
169
-
170
- if ($c < count($conditions)) {
171
- $query .= " AND";
172
- }
173
-
174
- $c++;
175
- }
176
- }
177
-
178
- if ($wpdb -> query($query)) {
179
- return true;
180
- }
181
- }
182
- }
183
-
184
- return false;
185
- }
186
-
187
- function delete($record_id = '') {
188
- global $wpdb;
189
-
190
- if (!empty($record_id) && $record = $this -> find(array('id' => $record_id))) {
191
- $query = "DELETE FROM `" . $this -> table . "` WHERE `id` = '" . $record_id . "' LIMIT 1";
192
-
193
- if ($wpdb -> query($query)) {
194
- //do nothing...
195
- return true;
196
- }
197
- }
198
-
199
- return false;
200
- }
201
-
202
- function insert_query($model = '') {
203
- if (!empty($model)) {
204
- global $wpdb;
205
-
206
- if (!empty($this -> data)) {
207
- if (empty($this -> data -> id)) {
208
- $query1 = "INSERT INTO `" . $this -> table . "` (";
209
- $query2 = "";
210
- $c = 1;
211
- unset($this -> fields['key']);
212
-
213
- foreach (array_keys($this -> fields) as $field) {
214
- if (!empty($this -> data -> {$field}) || $this -> data -> {$field} == "0") {
215
- if (is_array($this -> data -> {$field}) || is_object($this -> data -> {$field})) {
216
- $value = serialize($this -> data -> {$field});
217
- } else {
218
- $value = mysql_escape_string($this -> data -> {$field});
219
- }
220
-
221
- $query1 .= "`" . $field . "`";
222
- $query2 .= "'" . $value . "'";
223
-
224
- if ($c < count($this -> fields)) {
225
- $query1 .= ", ";
226
- $query2 .= ", ";
227
- }
228
- }
229
-
230
- $c++;
231
- }
232
-
233
- $query1 .= ") VALUES (";
234
- $query = $query1 . "" . $query2 . ");";
235
-
236
- return $query;
237
- } else {
238
- $query = $this -> update_query($model);
239
-
240
- return $query;
241
- }
242
- }
243
- }
244
-
245
- return false;
246
- }
247
-
248
- function update_query($model = '') {
249
- if (!empty($model)) {
250
- global $wpdb;
251
-
252
- if (!empty($this -> data)) {
253
- $query = "UPDATE `" . $this -> table . "` SET ";
254
- $c = 1;
255
-
256
- unset($this -> fields['id']);
257
- unset($this -> fields['key']);
258
- unset($this -> fields['created']);
259
-
260
- foreach (array_keys($this -> fields) as $field) {
261
- //if (!empty($this -> data -> {$field}) || $this -> data -> {$field} == "0") {
262
- if (is_array($this -> data -> {$field}) || is_object($this -> data -> {$field})) {
263
- $value = serialize($this -> data -> {$field});
264
- } else {
265
- $value = mysql_escape_string($this -> data -> {$field});
266
- }
267
-
268
- $query .= "`" . $field . "` = '" . $value . "'";
269
-
270
- if ($c < count($this -> fields)) {
271
- $query .= ", ";
272
- }
273
- //}
274
-
275
- $c++;
276
- }
277
-
278
- $query .= " WHERE `id` = '" . $this -> data -> id . "' LIMIT 1";
279
-
280
- return $query;
281
- }
282
- }
283
-
284
- return false;
285
- }
286
- }
287
-
 
 
 
 
288
  ?>
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
+ if ($this -> data -> type == "file") {
135
+ //$this -> data -> image = $_FILES['image_file']['name'];
136
+ } else {
137
+ $this -> data -> image = basename($this -> data -> image_url);
138
+ }
139
+
140
+ if (empty($this -> data -> uselink) || $this -> data -> uselink == "N") {
141
+ $this -> data -> link = "";
142
+ }
143
+ break;
144
+ }
145
+
146
+ //the MySQL query
147
+ $query = (empty($this -> data -> id)) ? $this -> insert_query($this -> model) : $this -> update_query($this -> model);
148
+ //echo $query;
149
+ //return false;
150
+
151
+ if ($wpdb -> query($query)) {
152
+ $this -> insertid = $insertid = (empty($this -> data -> id)) ? $wpdb -> insert_id : $this -> data -> id;
153
+ return true;
154
+ }
155
+ }
156
+
157
+ return false;
158
+ }
159
+
160
+ function save_field($field = null, $value = null, $conditions = array()) {
161
+ if (!empty($this -> model)) {
162
+ global $wpdb;
163
+
164
+ if (!empty($field)) {
165
+ $query = "UPDATE `" . $this -> table . "` SET `" . $field . "` = '" . $value . "'";
166
+
167
+ if (!empty($conditions) && is_array($conditions)) {
168
+ $query .= " WHERE";
169
+ $c = 1;
170
+
171
+ foreach ($conditions as $ckey => $cval) {
172
+ $query .= " `" . $ckey . "` = '" . $cval . "'";
173
+
174
+ if ($c < count($conditions)) {
175
+ $query .= " AND";
176
+ }
177
+
178
+ $c++;
179
+ }
180
+ }
181
+
182
+ if ($wpdb -> query($query)) {
183
+ return true;
184
+ }
185
+ }
186
+ }
187
+
188
+ return false;
189
+ }
190
+
191
+ function delete($record_id = '') {
192
+ global $wpdb;
193
+
194
+ if (!empty($record_id) && $record = $this -> find(array('id' => $record_id))) {
195
+ $query = "DELETE FROM `" . $this -> table . "` WHERE `id` = '" . $record_id . "' LIMIT 1";
196
+
197
+ if ($wpdb -> query($query)) {
198
+ //do nothing...
199
+ return true;
200
+ }
201
+ }
202
+
203
+ return false;
204
+ }
205
+
206
+ function insert_query($model = '') {
207
+ if (!empty($model)) {
208
+ global $wpdb;
209
+
210
+ if (!empty($this -> data)) {
211
+ if (empty($this -> data -> id)) {
212
+ $query1 = "INSERT INTO `" . $this -> table . "` (";
213
+ $query2 = "";
214
+ $c = 1;
215
+ unset($this -> fields['key']);
216
+
217
+ foreach (array_keys($this -> fields) as $field) {
218
+ if (!empty($this -> data -> {$field}) || $this -> data -> {$field} == "0") {
219
+ if (is_array($this -> data -> {$field}) || is_object($this -> data -> {$field})) {
220
+ $value = serialize($this -> data -> {$field});
221
+ } else {
222
+ $value = mysql_escape_string($this -> data -> {$field});
223
+ }
224
+
225
+ $query1 .= "`" . $field . "`";
226
+ $query2 .= "'" . $value . "'";
227
+
228
+ if ($c < count($this -> fields)) {
229
+ $query1 .= ", ";
230
+ $query2 .= ", ";
231
+ }
232
+ }
233
+
234
+ $c++;
235
+ }
236
+
237
+ $query1 .= ") VALUES (";
238
+ $query = $query1 . "" . $query2 . ");";
239
+
240
+ return $query;
241
+ } else {
242
+ $query = $this -> update_query($model);
243
+
244
+ return $query;
245
+ }
246
+ }
247
+ }
248
+
249
+ return false;
250
+ }
251
+
252
+ function update_query($model = '') {
253
+ if (!empty($model)) {
254
+ global $wpdb;
255
+
256
+ if (!empty($this -> data)) {
257
+ $query = "UPDATE `" . $this -> table . "` SET ";
258
+ $c = 1;
259
+
260
+ unset($this -> fields['id']);
261
+ unset($this -> fields['key']);
262
+ unset($this -> fields['created']);
263
+
264
+ foreach (array_keys($this -> fields) as $field) {
265
+ //if (!empty($this -> data -> {$field}) || $this -> data -> {$field} == "0") {
266
+ if (is_array($this -> data -> {$field}) || is_object($this -> data -> {$field})) {
267
+ $value = serialize($this -> data -> {$field});
268
+ } else {
269
+ $value = mysql_escape_string($this -> data -> {$field});
270
+ }
271
+
272
+ $query .= "`" . $field . "` = '" . $value . "'";
273
+
274
+ if ($c < count($this -> fields)) {
275
+ $query .= ", ";
276
+ }
277
+ //}
278
+
279
+ $c++;
280
+ }
281
+
282
+ $query .= " WHERE `id` = '" . $this -> data -> id . "' LIMIT 1";
283
+
284
+ return $query;
285
+ }
286
+ }
287
+
288
+ return false;
289
+ }
290
+ }
291
+
292
  ?>
helpers/html.php CHANGED
@@ -1,177 +1,176 @@
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="<?php echo $class; ?>" rel="<?php echo $rel; ?>" <?php echo (!empty($onclick)) ? 'onclick="' . $onclick . '"' : ''; ?> href="<?php echo $href; ?>" target="<?php echo $target; ?>" title="<?php echo $title; ?>"><?php echo $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
  ?>
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="<?php echo $class; ?>" rel="<?php echo $rel; ?>" <?php echo (!empty($onclick)) ? 'onclick="' . $onclick . '"' : ''; ?> href="<?php echo $href; ?>" target="<?php echo $target; ?>" title="<?php echo $title; ?>"><?php echo $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 = null) {
85
+ if ($mn = $this -> strip_mn($name)) {
86
+ $value = $this -> {$mn[1]} -> data -> {$mn[2]};
87
+
88
+ return $value;
89
+ }
90
+
91
+ return false;
92
+ }
93
+
94
+ function retainquery($add = '') {
95
+ $url = $_SERVER['REQUEST_URI'];
96
+
97
+ if (($urls = @explode("?", $url)) !== false) {
98
+ if (!empty($urls[1])) {
99
+ if (!empty($add)) {
100
+ if (($adds = explode("&", str_replace("&amp;", "&", $add))) !== false) {
101
+ foreach ($adds as $qstring) {
102
+ if (($qparts = @explode("=", $qstring)) !== false) {
103
+ if (!empty($qparts[0])) {
104
+ if (preg_match("/\&?" . $qparts[0] . "\=([0-9a-z+]*)/i", $urls[1], $matches)) {
105
+ $urls[1] = preg_replace("/\&?" . $qparts[0] . "\=([0-9a-z+]*)/i", "", $urls[1]);
106
+ }
107
+ }
108
+ }
109
+ }
110
+ }
111
+ }
112
+ }
113
+ }
114
+
115
+ $urls[1] = preg_replace("/\&?" . $this -> pre . "message\=([0-9a-z+]*)/i", "", $urls[1]);
116
+ $url = $urls[0];
117
+ $url .= '?';
118
+ $url .= (empty($urls[1])) ? '' : $urls[1] . '&amp;';
119
+ $url .= $add;
120
+
121
+ return preg_replace("/\?(\&)?/si", "?", $url);
122
+ }
123
+
124
+ function strip_ext($filename = '', $return = 'ext') {
125
+ if (!empty($filename)) {
126
+ $extArray = split("[/\\.]", $filename);
127
+
128
+ if ($return == 'ext') {
129
+ $p = count($extArray) - 1;
130
+ $extension = $extArray[$p];
131
+ return $extension;
132
+ } else {
133
+ $p = count($extArray) - 2;
134
+ $filename = $extArray[$p];
135
+ return $filename;
136
+ }
137
+ }
138
+
139
+ return false;
140
+ }
141
+
142
+ function strip_mn($name = '') {
143
+ if (!empty($name)) {
144
+ if (preg_match("/^(.*?)\.(.*?)$/si", $name, $matches)) {
145
+ return $matches;
146
+ }
147
+ }
148
+
149
+ return false;
150
+ }
151
+
152
+ function gen_date($format = "Y-m-d H:i:s", $time = false) {
153
+ $time = (empty($time)) ? time() : $time;
154
+ $date = date($format, $time);
155
+
156
+ return $date;
157
+ }
158
+
159
+ function array_to_object($array = array()) {
160
+ //type casting...
161
+ return (object) $array;
162
+ }
163
+
164
+ function sanitize($string = '', $sep = '-') {
165
+ if (!empty($string)) {
166
+ $string = ereg_replace("[^0-9a-z" . $sep . "]", "", strtolower(str_replace(" ", $sep, $string)));
167
+ $string = preg_replace("/" . $sep . "[" . $sep . "]*/i", $sep, $string);
168
+
169
+ return $string;
170
+ }
171
+
172
+ return false;
173
+ }
174
+ }
175
+
 
176
  ?>
helpers/metabox.php CHANGED
@@ -1,25 +1,29 @@
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
  ?>
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' . DS . 'settings-submit', false, true, 'admin');
14
+ }
15
+
16
+ function settings_general() {
17
+ $this -> render('metaboxes' . DS . 'settings-general', false, true, 'admin');
18
+ }
19
+
20
+ function settings_linksimages() {
21
+ $this -> render('metaboxes' . DS . 'settings-linksimages', false, true, 'admin');
22
+ }
23
+
24
+ function settings_styles() {
25
+ $this -> render('metaboxes' . DS . 'settings-styles', false, true, 'admin');
26
+ }
27
+ }
28
+
29
  ?>
js/_notes/dwsync.xml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <dwsync>
3
+ <file name="gallery.js" server="wpplugins.biz/public_html/" local="129345028956508987" remote="129345028800000000" />
4
+ </dwsync>
js/gallery.js CHANGED
@@ -1,180 +1,208 @@
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
-
27
- if(this.thumbs){
28
- var u=tid(this.left), r=tid(this.right);
29
- u.onmouseover=new Function('TINY.scroll.init("'+this.thumbs+'",-1,'+this.scrollSpeed+')');
30
- u.onmouseout=r.onmouseout=new Function('TINY.scroll.cl("'+this.thumbs+'")');
31
- r.onmouseover=new Function('TINY.scroll.init("'+this.thumbs+'",1,'+this.scrollSpeed+')');
32
- this.p=tid(this.thumbs)
33
- }
34
-
35
- for(i;i<this.l;i++){
36
- this.a[i]={};
37
- var h=m[i], a=this.a[i];
38
- a.t= tag('h3',h)[0].innerHTML;
39
- a.d= tag('p',h)[0].innerHTML;
40
- a.l= tag('a',h)[0]? tag('a',h)[0].href:'';
41
- a.p= tag('span',h)[0].innerHTML;
42
- if(this.thumbs){
43
- var g = tag('img',h)[0];
44
- this.p.appendChild(g);
45
- w+=parseInt(g.offsetWidth);
46
- if(i!=this.l-1){
47
- g.style.marginRight=this.spacing+'px';
48
- w+=this.spacing
49
- }
50
- this.p.style.width=w+'px';
51
- g.style.opacity=this.thumbOpacity/100;
52
- g.style.filter='alpha(opacity='+this.thumbOpacity+')';
53
- g.onmouseover=new Function('TINY.alpha.set(this,100,5)');
54
- g.onmouseout=new Function('TINY.alpha.set(this,'+this.thumbOpacity+',5)');
55
- g.onclick=new Function(this.n+'.pr('+i+',1)')
56
- }
57
- }
58
- if(b&&f){
59
- b=tid(b);
60
- f=tid(f);
61
- b.style.opacity=f.style.opacity=this.navOpacity/100;
62
- b.style.filter=f.style.filter='alpha(opacity='+this.navOpacity+')';
63
- b.onmouseover=f.onmouseover=new Function('TINY.alpha.set(this,'+this.navHover+',5)');
64
- b.onmouseout=f.onmouseout=new Function('TINY.alpha.set(this,'+this.navOpacity+',5)');
65
- b.onclick=new Function(this.n+'.mv(-1,1)');
66
- f.onclick=new Function(this.n+'.mv(1,1)')
67
- }
68
- this.auto?this.is(0,0):this.is(0,1)
69
- },
70
- mv:function(d,c){
71
- var t=this.c+d;
72
- this.c=t=t<0?this.l-1:t>this.l-1?0:t;
73
- this.pr(t,c)
74
- },
75
- pr:function(t,c){
76
- clearTimeout(this.lt);
77
- if(c){
78
- clearTimeout(this.at)
79
- }
80
- this.c=t;
81
- this.is(t,c)
82
- },
83
- is:function(s,c){
84
- if(this.info){
85
- TINY.height.set(this.r,1,this.infoSpeed/2,-1)
86
- }
87
- var i=new Image();
88
- i.style.opacity=0;
89
- i.style.filter='alpha(opacity=0)';
90
- this.i=i;
91
- i.onload=new Function(this.n+'.le('+s+','+c+')');
92
- i.src=this.a[s].p;
93
- if(this.thumbs){
94
- var a= tag('img',this.p), l=a.length, x=0;
95
- for(x;x<l;x++){
96
- a[x].style.borderColor=x!=s?'':this.active
97
- }
98
- }
99
- },
100
- le:function(s,c){
101
- this.f.appendChild(this.i);
102
- var w=this.o-parseInt(this.i.offsetWidth);
103
- if(w>0){
104
- var l=Math.floor(w/2);
105
- this.i.style.borderLeft=l+'px solid '+this.letterbox;
106
- this.i.style.borderRight=(w-l)+'px solid '+this.letterbox
107
- }
108
- TINY.alpha.set(this.i,100,this.imgSpeed);
109
- var n=new Function(this.n+'.nf('+s+')');
110
- this.lt=setTimeout(n,this.imgSpeed*100);
111
- if(!c){
112
- this.at=setTimeout(new Function(this.n+'.mv(1,0)'),this.speed*1000)
113
- }
114
- if(this.a[s].l != ""){
115
- this.q.onclick = new Function('window.location="'+this.a[s].l+'"');
116
- this.q.onmouseover = new Function('this.className="'+this.link+'"');
117
- this.q.onmouseout = new Function('this.className=""');
118
- this.q.style.cursor = 'pointer';
119
- }else{
120
- this.q.onclick=this.q.onmouseover=null;
121
- this.q.style.cursor='default';
122
- }
123
- var m= tag('img',this.f);
124
- if(m.length > 2){
125
- this.f.removeChild(m[0])
126
- }
127
- },
128
- nf:function(s){
129
- if(this.info){
130
- s=this.a[s];
131
- tag('h3',this.r)[0].innerHTML=s.t;
132
- tag('p',this.r)[0].innerHTML=s.d;
133
- this.r.style.height='auto';
134
- var h=parseInt(this.r.offsetHeight);
135
- this.r.style.height=0;
136
- TINY.height.set(this.r,h,this.infoSpeed,0)
137
- }
138
- }
139
- };
140
-
141
- TINY.scroll=function(){
142
- return{
143
- init:function(e,d,s){
144
- e=typeof e=='object'?e: tid(e); var p=e.style.left||TINY.style.val(e,'left'); e.style.left=p;
145
- var l=d==1?parseInt(e.offsetWidth)-parseInt(e.parentNode.offsetWidth):0; e.si=setInterval(function(){TINY.scroll.mv(e,l,d,s)},20)
146
- },
147
- mv:function(e,l,d,s){
148
- 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'}
149
- },
150
- cl:function(e){e=typeof e=='object'?e: tid(e); clearInterval(e.si)}
151
- }
152
- }();
153
-
154
- TINY.height=function(){
155
- return{
156
- set:function(e,h,s,d){
157
- e=typeof e=='object'?e:tid(e); var oh=e.offsetHeight, ho=e.style.height||TINY.style.val(e,'height');
158
- 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)
159
- },
160
- tw:function(e,h,ho,hd,s){
161
- var oh=e.offsetHeight-ho;
162
- if(oh == h){clearInterval(e.si)}else{if(oh!=h){e.style.height=oh+(Math.ceil(Math.abs(h-oh)/s)*hd)+'px'}}
163
- }
164
- }
165
- }();
166
-
167
- TINY.alpha=function(){
168
- return{
169
- set:function(e,a,s){
170
- e=typeof e=='object'?e:tid(e); var o=e.style.opacity||TINY.style.val(e,'opacity'),
171
- 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)
172
- },
173
- tw:function(e,a,d,s){
174
- var o=Math.round(e.style.opacity*100);
175
- 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+')'}
176
- }
177
- }
178
- }();
179
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
  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)}}}();
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
+
27
+ if(this.thumbs){
28
+ var u=tid(this.left), r=tid(this.right);
29
+ u.onmouseover=new Function('TINY.scroll.init("'+this.thumbs+'",-1,'+this.scrollSpeed+')');
30
+ u.onmouseout=r.onmouseout=new Function('TINY.scroll.cl("'+this.thumbs+'")');
31
+ r.onmouseover=new Function('TINY.scroll.init("'+this.thumbs+'",1,'+this.scrollSpeed+')');
32
+ this.p=tid(this.thumbs)
33
+ }
34
+
35
+ for(i;i<this.l;i++){
36
+ this.a[i]={};
37
+ var h=m[i], a=this.a[i];
38
+ a.t= tag('h3',h)[0].innerHTML;
39
+ a.d= tag('p',h)[0].innerHTML;
40
+ a.l= tag('a',h)[0]? tag('a',h)[0].href:'';
41
+ a.p= tag('span',h)[0].innerHTML;
42
+ if(this.thumbs){
43
+ var g = tag('img',h)[0];
44
+ this.p.appendChild(g);
45
+ w+=parseInt(g.offsetWidth);
46
+ if(i!=this.l-1){
47
+ g.style.marginRight=this.spacing+'px';
48
+ w+=this.spacing
49
+ }
50
+ this.p.style.width=w+'px';
51
+ g.style.opacity=this.thumbOpacity/100;
52
+ g.style.filter='alpha(opacity='+this.thumbOpacity+')';
53
+ g.onmouseover=new Function('TINY.alpha.set(this,100,5)');
54
+ g.onmouseout=new Function('TINY.alpha.set(this,'+this.thumbOpacity+',5)');
55
+ g.onclick=new Function(this.n+'.pr('+i+',1)')
56
+ }
57
+ }
58
+ if(b&&f){
59
+ b=tid(b);
60
+ f=tid(f);
61
+ b.style.opacity=f.style.opacity=this.navOpacity/100;
62
+ b.style.filter=f.style.filter='alpha(opacity='+this.navOpacity+')';
63
+ b.onmouseover=f.onmouseover=new Function('TINY.alpha.set(this,'+this.navHover+',5)');
64
+ b.onmouseout=f.onmouseout=new Function('TINY.alpha.set(this,'+this.navOpacity+',5)');
65
+ b.onclick=new Function(this.n+'.mv(-1,1)');
66
+ f.onclick=new Function(this.n+'.mv(1,1)');
67
+ }
68
+ this.auto?this.is(0,0):this.is(0,1)
69
+ },
70
+ mv:function(d,c){
71
+ var t=this.c+d;
72
+ this.c=t=t<0?this.l-1:t>this.l-1?0:t;
73
+ this.pr(t,c)
74
+ },
75
+ pr:function(t,c){
76
+ clearTimeout(this.lt);
77
+ if(c){
78
+ clearTimeout(this.at)
79
+ }
80
+ this.c=t;
81
+ this.is(t,c)
82
+ },
83
+ is:function(s,c){
84
+ if(this.info){
85
+ TINY.height.set(this.r,1,this.infoSpeed/2,-1)
86
+ }
87
+ var i=new Image();
88
+ i.style.opacity=0;
89
+ i.style.filter='alpha(opacity=0)';
90
+ this.i=i;
91
+ i.onload=new Function(this.n+'.le('+s+','+c+')');
92
+ i.src=this.a[s].p;
93
+ if(this.thumbs){
94
+ var a= tag('img',this.p), l=a.length, x=0;
95
+ for(x;x<l;x++){
96
+ a[x].style.borderColor=x!=s?'':this.active
97
+ }
98
+ }
99
+ },
100
+ le:function(s,c){
101
+ this.f.appendChild(this.i);
102
+ var w=this.o-parseInt(this.i.offsetWidth);
103
+ if(w>0){
104
+ var l=Math.floor(w/2);
105
+ this.i.style.borderLeft=l+'px solid ' + this.letterbox;
106
+ this.i.style.borderRight=(w-l)+'px solid ' + this.letterbox
107
+ }
108
+ TINY.alpha.set(this.i,100,this.imgSpeed);
109
+ var n=new Function(this.n+'.nf('+s+')');
110
+ this.lt=setTimeout(n,this.imgSpeed*100);
111
+ if(!c){
112
+ this.at=setTimeout(new Function(this.n+'.mv(1,0)'),this.speed*1000)
113
+ }
114
+ if(this.a[s].l != ""){
115
+ //this.q.onclick = new Function('window.location="' + this.a[s].l + '"');
116
+ //this.q.onclick = new Function('tb_show("test", "' + this.a[s].l + '", "' + this.a[s].l + '")');
117
+
118
+ var baseURL = this.a[s].l;
119
+ var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
120
+ var urlType = baseURL.toLowerCase().match(urlString);
121
+
122
+ if (this.imagesthickbox == "true" && (urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp')) {
123
+ this.q.onclick = new Function('tb_show("' + this.a[s].t + '", "' + this.a[s].l + '", "slideshow")');
124
+ } else {
125
+ this.q.onclick = new Function('window.location="' + this.a[s].l + '"');
126
+ }
127
+
128
+ this.q.onmouseover = new Function('this.className="' + this.linkclass + '"');
129
+ this.q.onmouseout = new Function('this.className=""');
130
+ this.q.style.cursor = 'pointer';
131
+ }else{
132
+ this.q.onclick=this.q.onmouseover=null;
133
+ this.q.style.cursor='default';
134
+ }
135
+ var m= tag('img',this.f);
136
+ if(m.length > 2){
137
+ this.f.removeChild(m[0])
138
+ }
139
+ },
140
+ nf:function(s){
141
+ if(this.info){
142
+ s=this.a[s];
143
+ tag('h3',this.r)[0].innerHTML=s.t;
144
+ tag('p',this.r)[0].innerHTML=s.d;
145
+ this.r.style.height='auto';
146
+ var h=parseInt(this.r.offsetHeight);
147
+ this.r.style.height=0;
148
+ TINY.height.set(this.r,h,this.infoSpeed,0)
149
+ }
150
+ }
151
+ };
152
+
153
+ TINY.scroll=function(){
154
+ return{
155
+ init:function(e,d,s){
156
+ e=typeof e=='object'?e: tid(e); var p=e.style.left||TINY.style.val(e,'left'); e.style.left=p;
157
+
158
+ /**
159
+ * Issue #1: Bugfix for newer versions of firefox and possibly other browsers.
160
+ * The issue here was, that the thumbnail bar didn't stop scrolling to the left if the
161
+ * summed up width of thumbs was smaller than the width of the bar. Fixed this by calculating the
162
+ * absolute sum of the offsets. Secondly I've added the constraint that there is no scrolling at
163
+ * all if there are not enough thumbnails in the bar. Might be nice to hide the arrows at the sides
164
+ * then, but I couldn't figure out how to achive this in a finite amount of time ;)
165
+ */
166
+
167
+ var l = (d==1) ? Math.abs(parseInt(e.offsetWidth)-parseInt(e.parentNode.offsetWidth)) : 0;
168
+
169
+ // constraint for scrolling
170
+ if ((e.childNodes.length+1)*e.firstChild.width > e.parentNode.offsetWidth) {
171
+ e.si=setInterval(function(){
172
+ TINY.scroll.mv(e,l,d,s)},20);
173
+ }
174
+ },
175
+ mv:function(e,l,d,s){
176
+ 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'}
177
+ },
178
+ cl:function(e){e=typeof e=='object'?e: tid(e); clearInterval(e.si)}
179
+ }
180
+ }();
181
+
182
+ TINY.height=function(){
183
+ return{
184
+ set:function(e,h,s,d){
185
+ e=typeof e=='object'?e:tid(e); var oh=e.offsetHeight, ho=e.style.height||TINY.style.val(e,'height');
186
+ 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)
187
+ },
188
+ tw:function(e,h,ho,hd,s){
189
+ var oh=e.offsetHeight-ho;
190
+ if(oh == h){clearInterval(e.si)}else{if(oh!=h){e.style.height=oh+(Math.ceil(Math.abs(h-oh)/s)*hd)+'px'}}
191
+ }
192
+ }
193
+ }();
194
+
195
+ TINY.alpha=function(){
196
+ return{
197
+ set:function(e,a,s){
198
+ e=typeof e=='object'?e:tid(e); var o=e.style.opacity||TINY.style.val(e,'opacity'),
199
+ 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)
200
+ },
201
+ tw:function(e,a,d,s){
202
+ var o=Math.round(e.style.opacity*100);
203
+ 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+')'}
204
+ }
205
+ }
206
+ }();
207
+
208
  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)}}}();
js/settings-editor.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ jQuery(document).ready(function() {
2
+ jQuery(".if-js-closed").removeClass("if-js-closed").addClass("closed");
3
+ postboxes.add_postbox_toggles("slideshow_page_gallery-settings");
4
+ });
js/tinymce/_notes/dwsync.xml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <dwsync>
3
+ <file name="dialog.php" server="wpplugins.biz/public_html/" local="129345063849544754" remote="129345063600000000" />
4
+ </dwsync>
js/tinymce/dialog.php ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ error_reporting(0);
4
+ @ini_set('display_errors', 0);
5
+
6
+ if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); }
7
+
8
+ $root = __FILE__;
9
+ for ($i = 0; $i < 6; $i++) $root = dirname($root);
10
+
11
+ if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); }
12
+ require_once($root . DS . 'wp-config.php');
13
+ require_once(ABSPATH . 'wp-admin' . DS . 'admin-functions.php');
14
+
15
+ if(!current_user_can('edit_posts')) die;
16
+ do_action('admin_init');
17
+
18
+ ?>
19
+
20
+
21
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
22
+ <html xmlns="http://www.w3.org/1999/xhtml">
23
+ <head>
24
+ <title><?php _e('Insert a slideshow', "slideshow-gallery"); ?></title>
25
+ <script language="javascript" type="text/javascript" src="<?php bloginfo('wpurl'); ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
26
+ <script language="javascript" type="text/javascript" src="<?php bloginfo('wpurl'); ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
27
+ <script language="javascript" type="text/javascript" src="<?php bloginfo('wpurl'); ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
28
+ <script language="javascript" type="text/javascript" src="<?php bloginfo('wpurl'); ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
29
+ <script language="javascript" type="text/javascript" src="<?php bloginfo('wpurl'); ?>/wp-includes/js/jquery/jquery.js"></script>
30
+ <script language="javascript" type="text/javascript">
31
+
32
+ var _self = tinyMCEPopup;
33
+
34
+ function insertTag () {
35
+ var slideshow_type = jQuery('input[name="slideshow_type"]:checked').val();
36
+
37
+ if (slideshow_type == "post") {
38
+ var post_id = jQuery('#post_id').val();
39
+ var exclude = jQuery('#exclude').val();
40
+
41
+ if (post_id == "th") { var tag = '[slideshow'; }
42
+ else { var tag = '[slideshow post_id="' + post_id + '"'; }
43
+
44
+ if (exclude == "") {
45
+ tag += ']';
46
+ } else {
47
+ tag += ' exclude="' + exclude + '"]';
48
+ }
49
+ } else if (slideshow_type == "custom") {
50
+ var tag = '[slideshow custom=true]';
51
+ }
52
+
53
+ if(window.tinyMCE) {
54
+ window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, tag);
55
+ tinyMCEPopup.editor.execCommand('mceRepaint');
56
+ tinyMCEPopup.close();
57
+ }
58
+
59
+ }
60
+
61
+ function closePopup () {
62
+ tinyMCEPopup.close();
63
+ }
64
+ </script>
65
+
66
+ <style type="text/css">
67
+ table th { vertical-align: top; }
68
+ .panel_wrapper { border-top: 1px solid #909B9C; }
69
+ .panel_wrapper div.current { height:auto !important; }
70
+ #product-menu { width: 180px; }
71
+ </style>
72
+
73
+ </head>
74
+ <body>
75
+
76
+ <div id="wpwrap">
77
+
78
+ <form onsubmit="insertTag(); return false;" action="#">
79
+ <div class="panel_wrapper">
80
+ <label style="font-weight:bold; cursor:pointer;"><input onclick="jQuery('#post_div').show();" type="radio" name="slideshow_type" value="post" id="type_post" /> <?php _e('Images From a Post', "slideshow-gallery"); ?></label><br/>
81
+ <label style="font-weight:bold; cursor:pointer;"><input onclick="jQuery('#post_div').hide();" type="radio" name="slideshow_type" value="custom" id="type_custom" /> <?php _e('Custom Added Slides', "slideshow-gallery"); ?></label>
82
+
83
+ <div id="post_div" style="display:none;">
84
+ <p>
85
+ <label for="post_id" style="font-weight:bold;"><?php _e('Post', "slideshow-gallery"); ?>:</label><br/>
86
+ <?php if ($posts = get_posts(array('orderby' => "post_title", 'order' => "ASC", 'post_type' => "post", 'post_status' => ""))) : ?>
87
+ <select name="post_id" id="post_id">
88
+ <option value="">- <?php _e('Select a Post', "slideshow-gallery"); ?></option>
89
+ <option value="th"><?php _e('THIS POST', "slideshow-gallery"); ?></option>
90
+ <?php foreach ($posts as $post) : ?>
91
+ <option value="<?php echo $post -> ID; ?>"><?php echo $post -> post_title; ?></option>
92
+ <?php endforeach; ?>
93
+ </select>
94
+ <?php endif; ?>
95
+ </p>
96
+
97
+ <p>
98
+ <label style="font-weight:bold;"><?php _e('Exclude', "slideshow-gallery"); ?>:</label><br/>
99
+ <input type="text" name="exclude" value="" id="exclude" /><br/>
100
+ <small><?php _e('comma separated IDs of attachments to exclude', "slideshow-gallery"); ?></small>
101
+ </p>
102
+ </div>
103
+
104
+ <?php /*
105
+ <table border="0" cellpadding="4" cellspacing="0">
106
+ <tbody>
107
+ <tr>
108
+ <th nowrap="nowrap"><label for="category-menu"><?php _e("Category", 'wp-checkout'); ?></label></th>
109
+ <td>
110
+ <select id="category-menu" name="category" onchange="changeCategory();">
111
+ <option value="">- <?php _e('Select Category', 'wp-checkout'); ?></option>
112
+ <?php if ($categories = $Category -> select()) : ?>
113
+ <?php foreach ($categories as $cat_id => $cat_title) : ?>
114
+ <option value="<?php echo $cat_id; ?>"><?php echo $cat_title; ?></option>
115
+ <?php endforeach; ?>
116
+ <?php endif; ?>
117
+ </select>
118
+ </td>
119
+ </tr>
120
+ <tr id="product-selector">
121
+ <th nowrap="nowrap"><label for="product-menu"><?php _e("Product", 'wp-checkout'); ?></label></th>
122
+ <td><select id="product-menu" name="product" size="7"></select></td>
123
+ </tr>
124
+ </tbody>
125
+ </table>
126
+ */ ?>
127
+ </div>
128
+
129
+ <div class="mceActionPanel">
130
+ <div style="float: left">
131
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="closePopup()"/>
132
+ </div>
133
+
134
+ <div style="float: right">
135
+ <input type="button" id="insert" name="insert" value="{#insert}" onclick="insertTag()" />
136
+ </div>
137
+ </div>
138
+ </form>
139
+ </div>
140
+
141
+ <script type="text/javascript">
142
+
143
+ </script>
144
+
145
+ </body>
146
+ </html>
js/tinymce/editor_plugin.js ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Slideshow Gallery TinyMCE Plugin
3
+ * @author Tribulant Software
4
+ */
5
+
6
+ (function() {
7
+ // Load plugin specific language pack
8
+ tinymce.PluginManager.requireLangPack("gallery");
9
+
10
+ tinymce.create('tinymce.plugins.gallery', {
11
+ init: function(ed, url) {
12
+ ed.addCommand('mcegallery', function() {
13
+ ed.windowManager.open({
14
+ file : url + '/dialog.php',
15
+ width : 320,
16
+ height : 230,
17
+ inline : 1
18
+ }, {
19
+ plugin_url : url // Plugin absolute URL
20
+ });
21
+ });
22
+
23
+ // Register example button
24
+ ed.addButton('gallery', {
25
+ title : 'gallery.desc',
26
+ cmd : 'mcegallery',
27
+ image : url + '/gallery.png'
28
+ });
29
+
30
+ // Add a node change handler, selects the button in the UI when a image is selected
31
+ /*ed.onNodeChange.add(function(ed, cm, n) {
32
+ cm.setActive('Checkout', n.nodeName == 'IMG');
33
+ });*/
34
+
35
+
36
+ },
37
+ createControl : function(n, cm) {
38
+ return null;
39
+ },
40
+
41
+ /**
42
+ * Returns information about the plugin as a name/value array.
43
+ * The current keys are longname, author, authorurl, infourl and version.
44
+ *
45
+ * @return {Object} Name/value array containing information about the plugin.
46
+ */
47
+ getInfo : function() {
48
+ return {
49
+ longname : 'Slideshow Gallery TinyMCE Plugin',
50
+ author : 'Tribulant Software',
51
+ authorurl : 'http://tribulant.com',
52
+ infourl : 'http://tribulant.com',
53
+ version : "1.0"
54
+ };
55
+ }
56
+ });
57
+
58
+ // Register plugin
59
+ tinymce.PluginManager.add('gallery', tinymce.plugins.gallery);
60
+ })();
js/tinymce/error_log ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ [31-May-2010 10:49:16] PHP Notice: Undefined variable: swDefaultTld in /home/tribunet/subdomains/dev/httpdocs/wp-content/plugins/wp-whois/vendors/samswhois/samswhois.inc.php on line 138
2
+ [31-May-2010 10:49:16] PHP Notice: Undefined variable: number in /home/tribunet/subdomains/dev/httpdocs/wp-content/plugins/wp-whois/vendors/samswhois/samswhois.inc.php on line 241
3
+ [31-May-2010 10:49:16] PHP Notice: Undefined variable: swForm in /home/tribunet/subdomains/dev/httpdocs/wp-content/plugins/wp-whois/vendors/samswhois/samswhois.inc.php on line 246
4
+ [31-May-2010 10:49:16] PHP Notice: Undefined index: page in /home/tribunet/subdomains/dev/httpdocs/wp-content/themes/Simplism/functions.php on line 112
js/tinymce/gallery.png ADDED
Binary file
js/tinymce/langs/en.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ tinyMCE.addI18n("en.gallery",{
2
+ title : "Insert a slideshow",
3
+ desc : "Insert a slideshow"
4
+ });
models/slide.php CHANGED
@@ -1,99 +1,154 @@
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
- 'uselink' => "ENUM('Y','N') NOT NULL DEFAULT 'N'",
20
- 'link' => "VARCHAR(200) NOT NULL DEFAULT ''",
21
- 'order' => "INT(11) NOT NULL DEFAULT '0'",
22
- 'created' => "DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'",
23
- 'modified' => "DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'",
24
- 'key' => "PRIMARY KEY (`id`)",
25
- );
26
-
27
- function GallerySlide($data = array()) {
28
- global $wpdb;
29
- $this -> table = $wpdb -> prefix . strtolower($this -> pre) . "_" . $this -> controller;
30
- $this -> check_table($this -> model);
31
-
32
- if (!empty($data)) {
33
- foreach ($data as $dkey => $dval) {
34
- $this -> {$dkey} = $dval;
35
- }
36
- }
37
-
38
- return true;
39
- }
40
-
41
- function defaults() {
42
- $defaults = array(
43
- 'order' => 0,
44
- 'created' => GalleryHtmlHelper::gen_date(),
45
- 'modified' => GalleryHtmlHelper::gen_date(),
46
- );
47
-
48
- return $defaults;
49
- }
50
-
51
- function validate($data = null) {
52
- $this -> errors = array();
53
-
54
- if (!empty($data)) {
55
- $data = (empty($data[$this -> model])) ? $data : $data[$this -> model];
56
-
57
- foreach ($data as $dkey => $dval) {
58
- $this -> data -> {$dkey} = stripslashes($dval);
59
- }
60
-
61
- extract($data, EXTR_SKIP);
62
-
63
- if (empty($title)) { $this -> errors['title'] = __('Please fill in a title', $this -> plugin_name); }
64
- if (empty($description)) { $this -> errors['description'] = __('Please fill in a description', $this -> plugin_name); }
65
- if (empty($image_url)) { $this -> errors['image_url'] = __('Please specify an image', $this -> plugin_name); }
66
- else {
67
- if ($image = wp_remote_fopen($image_url)) {
68
- $filename = basename($image_url);
69
- $filepath = ABSPATH . 'wp-content' . DS . 'uploads' . DS . $this -> plugin_name . DS;
70
- $filefull = $filepath . $filename;
71
-
72
- if (!file_exists($filefull)) {
73
- $fh = @fopen($filefull, "w");
74
- @fwrite($fh, $image);
75
- @fclose($fh);
76
-
77
- $name = GalleryHtmlHelper::strip_ext($filename, 'filename');
78
- $ext = GalleryHtmlHelper::strip_ext($filename, 'ext');
79
- $thumbfull = $filepath . $name . '-thumb.' . $ext;
80
- $smallfull = $filepath . $name . '-small.' . $ext;
81
-
82
- image_resize($filefull, $width = null, $height = 75, $crop = false, $append = 'thumb', $dest = null, $quality = 100);
83
- image_resize($filefull, $width = 50, $height = 50, $crop = true, $append = 'small', $dest = null, $quality = 100);
84
-
85
- @chmod($filefull, 0777);
86
- @chmod($thumbfull, 0777);
87
- @chmod($smallfull, 0777);
88
- }
89
- }
90
- }
91
- } else {
92
- $this -> errors[] = __('No data was posted', $this -> plugin_name);
93
- }
94
-
95
- return $this -> errors;
96
- }
97
- }
98
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  ?>
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
+ 'type' => "ENUM('file','url') NOT NULL DEFAULT 'file'",
19
+ 'image_url' => "VARCHAR(200) NOT NULL DEFAULT ''",
20
+ 'uselink' => "ENUM('Y','N') NOT NULL DEFAULT 'N'",
21
+ 'link' => "VARCHAR(200) NOT NULL DEFAULT ''",
22
+ 'order' => "INT(11) NOT NULL DEFAULT '0'",
23
+ 'created' => "DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'",
24
+ 'modified' => "DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'",
25
+ 'key' => "PRIMARY KEY (`id`)",
26
+ );
27
+
28
+ function GallerySlide($data = array()) {
29
+ global $wpdb;
30
+ $this -> table = $wpdb -> prefix . strtolower($this -> pre) . "_" . $this -> controller;
31
+ $this -> check_table($this -> model);
32
+
33
+ if (!empty($data)) {
34
+ foreach ($data as $dkey => $dval) {
35
+ $this -> {$dkey} = $dval;
36
+ }
37
+ }
38
+
39
+ return true;
40
+ }
41
+
42
+ function defaults() {
43
+ $defaults = array(
44
+ 'order' => 0,
45
+ 'created' => GalleryHtmlHelper::gen_date(),
46
+ 'modified' => GalleryHtmlHelper::gen_date(),
47
+ );
48
+
49
+ return $defaults;
50
+ }
51
+
52
+ function validate($data = null) {
53
+ $this -> errors = array();
54
+
55
+ if (!empty($data)) {
56
+ $data = (empty($data[$this -> model])) ? $data : $data[$this -> model];
57
+
58
+ foreach ($data as $dkey => $dval) {
59
+ $this -> data -> {$dkey} = stripslashes($dval);
60
+ }
61
+
62
+ extract($data, EXTR_SKIP);
63
+
64
+ if (empty($title)) { $this -> errors['title'] = __('Please fill in a title', $this -> plugin_name); }
65
+ if (empty($description)) { $this -> errors['description'] = __('Please fill in a description', $this -> plugin_name); }
66
+ if (empty($type)) { $this -> errors['type'] = __('Please select an image type', $this -> plugin_name); }
67
+ elseif ($type == "file") {
68
+ if (!empty($image_oldfile) && empty($_FILES['image_file']['name'])) {
69
+ $imagename = $image_oldfile;
70
+ $imagepath = ABSPATH . "wp-content" . DS . "uploads" . DS . $this -> plugin_name . DS;
71
+ $imagefull = $imagepath . $imagename;
72
+
73
+ $this -> data -> image = $imagename;
74
+ } else {
75
+ if ($_FILES['image_file']['error'] <= 0) {
76
+ $imagename = $_FILES['image_file']['name'];
77
+ $imagepath = ABSPATH . 'wp-content' . DS . 'uploads' . DS . $this -> plugin_name . DS;
78
+ $imagefull = $imagepath . $imagename;
79
+
80
+ if (!is_uploaded_file($_FILES['image_file']['tmp_name'])) { $this -> errors['image_file'] = __('The image did not upload, please try again', $this -> plugin_name); }
81
+ elseif (!move_uploaded_file($_FILES['image_file']['tmp_name'], $imagefull)) { $this -> errors['image_file'] = __('Image could not be moved from TMP to "wp-content/uploads/", please check permissions', $this -> plugin_name); }
82
+ else {
83
+ $this -> data -> image = $imagename;
84
+
85
+ $name = GalleryHtmlHelper::strip_ext($imagename, 'filename');
86
+ $ext = GalleryHtmlHelper::strip_ext($imagename, 'ext');
87
+ $thumbfull = $imagepath . $name . '-thumb.' . $ext;
88
+ $smallfull = $imagepath . $name . '-small.' . $ext;
89
+
90
+ image_resize($imagefull, $width = null, $height = 75, $crop = false, $append = 'thumb', $dest = null, $quality = 100);
91
+ image_resize($imagefull, $width = 50, $height = 50, $crop = true, $append = 'small', $dest = null, $quality = 100);
92
+
93
+ @chmod($imagefull, 0777);
94
+ @chmod($thumbfull, 0777);
95
+ @chmod($smallfull, 0777);
96
+ }
97
+ } else {
98
+ switch ($_FILES['image_file']['error']) {
99
+ case UPLOAD_ERR_INI_SIZE :
100
+ case UPLOAD_ERR_FORM_SIZE :
101
+ $this -> errors['image_file'] = __('The image file is too large', $this -> plugin_name);
102
+ break;
103
+ case UPLOAD_ERR_PARTIAL :
104
+ $this -> errors['image_file'] = __('The image was partially uploaded, please try again', $this -> plugin_name);
105
+ break;
106
+ case UPLOAD_ERR_NO_FILE :
107
+ $this -> errors['image_file'] = __('No image was chosen for uploading, please choose an image', $this -> plugin_name);
108
+ break;
109
+ case UPLOAD_ERR_NO_TMP_DIR :
110
+ $this -> errors['image_file'] = __('No TMP directory has been specified for PHP to use, please ask your hosting provider', $this -> plugin_name);
111
+ break;
112
+ case UPLOAD_ERR_CANT_WRITE :
113
+ $this -> errors['image_file'] = __('Image cannot be written to disc, please ask your hosting provider', $this -> plugin_name);
114
+ break;
115
+ }
116
+ }
117
+ }
118
+ } elseif ($type == "url") {
119
+ if (empty($image_url)) { $this -> errors['image_url'] = __('Please specify an image', $this -> plugin_name); }
120
+ else {
121
+ if ($image = wp_remote_fopen($image_url)) {
122
+ $filename = basename($image_url);
123
+ $filepath = ABSPATH . 'wp-content' . DS . 'uploads' . DS . $this -> plugin_name . DS;
124
+ $filefull = $filepath . $filename;
125
+
126
+ if (!file_exists($filefull)) {
127
+ $fh = @fopen($filefull, "w");
128
+ @fwrite($fh, $image);
129
+ @fclose($fh);
130
+
131
+ $name = GalleryHtmlHelper::strip_ext($filename, 'filename');
132
+ $ext = GalleryHtmlHelper::strip_ext($filename, 'ext');
133
+ $thumbfull = $filepath . $name . '-thumb.' . $ext;
134
+ $smallfull = $filepath . $name . '-small.' . $ext;
135
+
136
+ image_resize($filefull, $width = null, $height = 75, $crop = false, $append = 'thumb', $dest = null, $quality = 100);
137
+ image_resize($filefull, $width = 50, $height = 50, $crop = true, $append = 'small', $dest = null, $quality = 100);
138
+
139
+ @chmod($filefull, 0777);
140
+ @chmod($thumbfull, 0777);
141
+ @chmod($smallfull, 0777);
142
+ }
143
+ }
144
+ }
145
+ }
146
+ } else {
147
+ $this -> errors[] = __('No data was posted', $this -> plugin_name);
148
+ }
149
+
150
+ return $this -> errors;
151
+ }
152
+ }
153
+
154
  ?>
readme.txt CHANGED
@@ -1,67 +1,92 @@
1
- === Slideshow Gallery ===
2
- Contributors: Antonie Potgieter
3
- Donate link: http://tribulant.com/
4
- Tags: wordpress plugins, wordpress slideshow gallery, slides, slideshow, image gallery, images, gallery, featured content, content gallery, javascript, javascript slideshow, slideshow gallery
5
- Requires at least: 2.8
6
- Tested up to: 2.9
7
- Stable tag: 1.0.4
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 with an optional `post_id` parameter to display the gallery images uploaded to that post/page. To hardcode into any PHP file of your WordPress theme, simply use `<?php if (class_exists('Gallery')) { $Gallery = new Gallery(); $Gallery -> slideshow($output = true, $post_id = null); }; ?>`.
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 post_id="X" exclude=""]` to embed a slideshow with the images of a post into your posts/pages or use `[slideshow custom=1]` to embed a slideshow with your custom added slides or `<?php if (class_exists('Gallery')) { $Gallery = new Gallery(); $Gallery -> slideshow($output = true, $post_id = null); }; ?>` 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, but only one slideshow per page.
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
- 5. TinyMCE editor button to insert shortcodes.
43
-
44
- == Changelog ==
45
-
46
- = 1.0 =
47
- * Initial release of the WordPress Slideshow Gallery plugin
48
-
49
- = 1.0.3 =
50
- * ADDED: Default, English language file in the `languages` folder.
51
- * ADDED: Configuration setting to turn On/Off resizing of images via CSS.
52
- * ADDED: Webkit border radius in CSS for thumbnail images.
53
- * ADDED: `post_id` parameter for the `[slideshow]` shortcode to display images from a post/page.
54
- * IMPROVED: Plugin doesn't utilize PHP short open tags anymore.
55
- * COMPATIBILITY: Removed `autoLoad` (introduced in PHP 5) parameter from `class_exists` function for PHP 4 compatibility.
56
- * IMPROVED: Directory separator constant DS from DIRECTORY_SEPARATOR.
57
-
58
- = 1.0.4 =
59
- * COMPATIBILITY: WordPress 2.9
60
- * FIXED: #fullsize z-index to keep below other elements such as drop down menus.
61
-
62
- = 1.0.4 =
63
- * IMPROVED: WordPress 2.9 sortable meta boxes.
64
- * FIXED: `wp_redirect()` fatal error in dashboard.
65
- * ADDED: TinyMCE editor button to quickly insert slideshows into posts/pages.
66
- * ADDED: `exclude` parameter to use in conjunction with the `post_id` parameter to exclude attachments by order.
67
- * CHANGED: Changed `#wrapper` in the HTML markup to `#slideshow-wrapper` due to some theme conflicts.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Slideshow Gallery ===
2
+ Contributors: Antonie Potgieter, Tribulant Software
3
+ Donate link: http://tribulant.com/
4
+ Tags: wordpress plugins, wordpress slideshow gallery, slides, slideshow, image gallery, images, gallery, featured content, content gallery, javascript, javascript slideshow, slideshow gallery
5
+ Requires at least: 2.9
6
+ Tested up to: 3.0.1
7
+ Stable tag: 1.1
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
+ You can easily display multiple galleries throughout your WordPress website displaying your custom added slides or showing slides from WordPress posts.
16
+
17
+ The slideshow is flexible and all aspects can easily be configured.
18
+
19
+ Embedding or hardcoding the slideshow gallery is a breeze. To embed into a post/page, simply insert `[slideshow]` into its content with an optional `post_id` parameter to display the gallery images uploaded to that post/page `[slideshow post_id=123]`. You can also use an `exclude` parameter to exclude certain images by their order in the gallery (comma separated) from the slideshow like this `[slideshow post_id=123 exclude="3,7,9"]`.
20
+
21
+ To hardcode into any PHP file of your WordPress theme, simply use `<?php if (class_exists('Gallery')) { $Gallery = new Gallery(); $Gallery -> slideshow($output = true, $post_id = null); }; ?>`.
22
+
23
+ == Installation ==
24
+
25
+ Installing the WordPress slideshow gallery plugin is very easy. Simply follow the steps below.
26
+
27
+ 1. Extract the package to obtain the `slideshow-gallery` folder
28
+ 1. Upload the `slideshow-gallery` folder to the `/wp-content/plugins/` directory
29
+ 1. Activate the plugin through the 'Plugins' menu in WordPress
30
+ 1. Configure the settings according to your needs through the 'Slideshow' > 'Configuration' menu
31
+ 1. Add and manage your slides in the 'Slideshow' section
32
+ 1. Put `[slideshow post_id="X" exclude=""]` to embed a slideshow with the images of a post into your posts/pages or use `[slideshow custom=1]` to embed a slideshow with your custom added slides or `<?php if (class_exists('Gallery')) { $Gallery = new Gallery(); $Gallery -> slideshow($output = true, $post_id = null); }; ?>` into your WordPress theme
33
+
34
+ == Frequently Asked Questions ==
35
+
36
+ = Can I display/embed multiple instances of the slideshow gallery? =
37
+
38
+ Yes, you can, but only one slideshow per page.
39
+
40
+ = How do I display the images uploaded to a post? =
41
+
42
+ You can embed a slideshow and show the images uploaded to a post with the `post_id` parameter. Like this `[slideshow post_id="123"]`.
43
+
44
+ = Can I exclude certain images from a post in the slideshow? =
45
+
46
+ Yes, you can use the `exclude` parameter to exclude post images by their order in the gallery (comma separated) like this `[slideshow post_id=123 exclude="2,4,8"]`.
47
+
48
+ == Screenshots ==
49
+
50
+ 1. Slideshow gallery with thumbnails at the bottom.
51
+ 2. Slideshow gallery with thumbnails turned OFF.
52
+ 3. Slideshow gallery with thumbnails at the top.
53
+ 4. Different styles/colors.
54
+ 5. TinyMCE editor button to insert shortcodes.
55
+ 6. Turn on Thickbox to show enlarged images in an overlay.
56
+
57
+ == Changelog ==
58
+
59
+ = 1.0 =
60
+ * Initial release of the WordPress Slideshow Gallery plugin
61
+
62
+ = 1.0.3 =
63
+ * ADDED: Default, English language file in the `languages` folder.
64
+ * ADDED: Configuration setting to turn On/Off resizing of images via CSS.
65
+ * ADDED: Webkit border radius in CSS for thumbnail images.
66
+ * ADDED: `post_id` parameter for the `[slideshow]` shortcode to display images from a post/page.
67
+ * IMPROVED: Plugin doesn't utilize PHP short open tags anymore.
68
+ * COMPATIBILITY: Removed `autoLoad` (introduced in PHP 5) parameter from `class_exists` function for PHP 4 compatibility.
69
+ * IMPROVED: Directory separator constant DS from DIRECTORY_SEPARATOR.
70
+
71
+ = 1.0.4 =
72
+ * COMPATIBILITY: WordPress 2.9
73
+ * FIXED: #fullsize z-index to keep below other elements such as drop down menus.
74
+
75
+ = 1.0.4 =
76
+ * IMPROVED: WordPress 2.9 sortable meta boxes.
77
+ * FIXED: `wp_redirect()` fatal error in dashboard.
78
+ * ADDED: TinyMCE editor button to quickly insert slideshows into posts/pages.
79
+ * ADDED: `exclude` parameter to use in conjunction with the `post_id` parameter to exclude attachments by order.
80
+ * CHANGED: Changed `#wrapper` in the HTML markup to `#slideshow-wrapper` due to some theme conflicts.
81
+
82
+ = 1.1 =
83
+ * ADDED: "THIS POST" added to the TinyMCE dialog to insert a shortcode for a slideshow of the current post
84
+ * IMPROVED: Some CSS improvements to the slideshow
85
+ * ADDED: Thickbox to show images in overlay. Can be turned On/Off
86
+ * FIXED: Fixed all thumbnails not preloading on first load
87
+ * FIXED: Slide HREF in IE
88
+ * ADDED: Spinner loading indicator to show the slideshow is loading up
89
+ * ADDED: "Link" column in the "Manage Slides" section
90
+ * FIXED: Load Thickbox on the 'Manage Slides' page for the enlargements
91
+ * ADDED: Ability to upload an image when saving a slide rather than specifying a URL
92
+ * ADDED: Row actions in the 'Manage Slides' section
screenshot-6.png ADDED
Binary file
slideshow-gallery-ajax.php CHANGED
@@ -1,36 +1,39 @@
1
- <?php
2
-
3
- if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); }
4
- require_once($_SERVER['DOCUMENT_ROOT'] . DS . 'wp-config.php');
5
- require_once(ABSPATH . 'wp-admin' . DS . 'admin-functions.php');
6
-
7
- class GalleryAjax extends GalleryPlugin {
8
-
9
- var $safecommands = array('slides_order');
10
-
11
- function GalleryAjax($cmd) {
12
- $this -> register_plugin('slideshow-gallery', __FILE__);
13
-
14
- if (!empty($cmd)) {
15
- if (in_array($cmd, $this -> safecommands) || current_user_can('edit_plugins')) {
16
- if (method_exists($this, $cmd)) {
17
- $this -> $cmd();
18
- }
19
- }
20
- }
21
- }
22
-
23
- function slides_order() {
24
- if (!empty($_REQUEST['item'])) {
25
- foreach ($_REQUEST['item'] as $order => $slide_id) {
26
- $this -> Slide -> save_field('order', $order, array('id' => $slide_id));
27
- }
28
-
29
- ?><br/><div style="color:red;"><?php _e('Slides have been ordered', $this -> plugin_name); ?></div><?php
30
- }
31
- }
32
- }
33
-
34
- $GalleryAjax = new GalleryAjax($_GET['cmd']);
35
-
 
 
 
36
  ?>
1
+ <?php
2
+
3
+ if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); }
4
+
5
+ $root = __FILE__;
6
+ for ($i = 0; $i < 4; $i++) $root = dirname($root);
7
+ require_once($root . DS . 'wp-config.php');
8
+ require_once(ABSPATH . 'wp-admin' . DS . 'admin-functions.php');
9
+
10
+ class GalleryAjax extends GalleryPlugin {
11
+
12
+ var $safecommands = array('slides_order');
13
+
14
+ function GalleryAjax($cmd) {
15
+ $this -> register_plugin('slideshow-gallery', __FILE__);
16
+
17
+ if (!empty($cmd)) {
18
+ if (in_array($cmd, $this -> safecommands) || current_user_can('edit_plugins')) {
19
+ if (method_exists($this, $cmd)) {
20
+ $this -> $cmd();
21
+ }
22
+ }
23
+ }
24
+ }
25
+
26
+ function slides_order() {
27
+ if (!empty($_REQUEST['item'])) {
28
+ foreach ($_REQUEST['item'] as $order => $slide_id) {
29
+ $this -> Slide -> save_field('order', $order, array('id' => $slide_id));
30
+ }
31
+
32
+ ?><br/><div style="color:red;"><?php _e('Slides have been ordered', $this -> plugin_name); ?></div><?php
33
+ }
34
+ }
35
+ }
36
+
37
+ $GalleryAjax = new GalleryAjax($_GET['cmd']);
38
+
39
  ?>
slideshow-gallery-plugin.php CHANGED
@@ -1,503 +1,524 @@
1
- <?php
2
-
3
- class GalleryPlugin {
4
-
5
- var $version = '1.0.5';
6
- var $plugin_name;
7
- var $plugin_base;
8
- var $pre = 'Gallery';
9
- var $debugging = false;
10
- var $menus = array();
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), DS);
18
-
19
- $this -> enqueue_scripts();
20
- $this -> enqueue_styles();
21
-
22
- $this -> initialize_classes();
23
- $this -> initialize_options();
24
-
25
- if (function_exists('load_plugin_textdomain')) {
26
- $currentlocale = get_locale();
27
- if(!empty($currentlocale)) {
28
- $moFile = dirname(__FILE__) . DS . "languages" . DS . $this -> plugin_name . "-" . $currentlocale . ".mo";
29
- if(@file_exists($moFile) && is_readable($moFile)) {
30
- load_textdomain($this -> plugin_name, $moFile);
31
- }
32
- }
33
- }
34
-
35
- if ($this -> debugging == true) {
36
- global $wpdb;
37
- $wpdb -> show_errors();
38
- error_reporting(E_ALL);
39
- @ini_set('display_errors', 1);
40
- }
41
-
42
- return true;
43
- }
44
-
45
- function init_class($name = null, $params = array()) {
46
- if (!empty($name)) {
47
- $name = $this -> pre . $name;
48
-
49
- if (class_exists($name)) {
50
- if ($class = new $name($params)) {
51
- return $class;
52
- }
53
- }
54
- }
55
-
56
- $this -> init_class('Country');
57
-
58
- return false;
59
- }
60
-
61
- function initialize_classes() {
62
- if (!empty($this -> helpers)) {
63
- foreach ($this -> helpers as $helper) {
64
- $hfile = dirname(__FILE__) . DS . 'helpers' . DS . strtolower($helper) . '.php';
65
-
66
- if (file_exists($hfile)) {
67
- require_once($hfile);
68
-
69
- if (empty($this -> {$helper}) || !is_object($this -> {$helper})) {
70
- $classname = $this -> pre . $helper . 'Helper';
71
-
72
- if (class_exists($classname)) {
73
- $this -> {$helper} = new $classname;
74
- }
75
- }
76
- }
77
- }
78
- }
79
-
80
- if (!empty($this -> models)) {
81
- foreach ($this -> models as $model) {
82
- $mfile = dirname(__FILE__) . DS . 'models' . DS . strtolower($model) . '.php';
83
-
84
- if (file_exists($mfile)) {
85
- require_once($mfile);
86
-
87
- if (empty($this -> {$model}) || !is_object($this -> {$model})) {
88
- $classname = $this -> pre . $model;
89
-
90
- if (class_exists($classname)) {
91
- $this -> {$model} = new $classname;
92
- }
93
- }
94
- }
95
- }
96
- }
97
- }
98
-
99
- function initialize_options() {
100
- $styles = array(
101
- 'width' => "450",
102
- 'height' => "250",
103
- 'border' => "1px solid #CCCCCC",
104
- 'background' => "#000000",
105
- 'infobackground' => "#000000",
106
- 'infocolor' => "#FFFFFF",
107
- 'resizeimages' => "Y",
108
- );
109
-
110
- $this -> add_option('styles', $styles);
111
-
112
- //General Settings
113
- $this -> add_option('fadespeed', 10);
114
- $this -> add_option('navopacity', 25);
115
- $this -> add_option('navhover', 70);
116
- $this -> add_option('information', "Y");
117
- $this -> add_option('infospeed', 10);
118
- $this -> add_option('thumbnails', "N");
119
- $this -> add_option('thumbposition', "bottom");
120
- $this -> add_option('thumbopacity', 70);
121
- $this -> add_option('thumbscrollspeed', 5);
122
- $this -> add_option('thumbspacing', 5);
123
- $this -> add_option('thumbactive', "#FFFFFF");
124
- $this -> add_option('autoslide', "Y");
125
- $this -> add_option('autospeed', 10);
126
- }
127
-
128
- function render_msg($message = '') {
129
- $this -> render('msg-top', array('message' => $message), true, 'admin');
130
- }
131
-
132
- function render_err($message = '') {
133
- $this -> render('err-top', array('message' => $message), true, 'admin');
134
- }
135
-
136
- function redirect($location = '', $msgtype = '', $message = '') {
137
- $url = $location;
138
-
139
- if ($msgtype == "message") {
140
- $url .= '&' . $this -> pre . 'updated=true';
141
- } elseif ($msgtype == "error") {
142
- $url .= '&' . $this -> pre . 'error=true';
143
- }
144
-
145
- if (!empty($message)) {
146
- $url .= '&' . $this -> pre . 'message=' . urlencode($message);
147
- }
148
-
149
- ?>
150
-
151
- <script type="text/javascript">
152
- window.location = '<?php echo (empty($url)) ? get_option('home') : $url; ?>';
153
- </script>
154
-
155
- <?php
156
-
157
- flush();
158
- }
159
-
160
- function paginate($model = null, $fields = '*', $sub = null, $conditions = null, $searchterm = null, $per_page = 10, $order = array('modified', "DESC")) {
161
- global $wpdb;
162
-
163
- if (!empty($model)) {
164
- global $paginate;
165
- $paginate = $this -> vendor('Paginate');
166
- $paginate -> table = $this -> {$model} -> table;
167
- $paginate -> sub = (empty($sub)) ? $this -> {$model} -> controller : $sub;
168
- $paginate -> fields = (empty($fields)) ? '*' : $fields;
169
- $paginate -> where = (empty($conditions)) ? false : $conditions;
170
- $paginate -> searchterm = (empty($searchterm)) ? false : $searchterm;
171
- $paginate -> per_page = $per_page;
172
- $paginate -> order = $order;
173
-
174
- $data = $paginate -> start_paging($_GET[$this -> pre . 'page']);
175
-
176
- if (!empty($data)) {
177
- $newdata = array();
178
-
179
- foreach ($data as $record) {
180
- $newdata[] = $this -> init_class($model, $record);
181
- }
182
-
183
- $data = array();
184
- $data[$model] = $newdata;
185
- $data['Paginate'] = $paginate;
186
- }
187
-
188
- return $data;
189
- }
190
-
191
- return false;
192
- }
193
-
194
- function vendor($name = '', $folder = '') {
195
- if (!empty($name)) {
196
- $filename = 'class.' . strtolower($name) . '.php';
197
- $filepath = rtrim(dirname(__FILE__), DS) . DS . 'vendors' . DS . $folder . '';
198
- $filefull = $filepath . $filename;
199
-
200
- if (file_exists($filefull)) {
201
- require_once($filefull);
202
- $class = 'Gallery' . $name;
203
-
204
- if (${$name} = new $class) {
205
- return ${$name};
206
- }
207
- }
208
- }
209
-
210
- return false;
211
- }
212
-
213
- function check_uploaddir() {
214
- $uploaddir = ABSPATH . 'wp-content' . DS . 'uploads' . DS . $this -> plugin_name . DS;
215
-
216
- if (!file_exists($uploaddir)) {
217
- if (@mkdir($uploaddir, 0777)) {
218
- @chmod($uploaddir, 0777);
219
- return true;
220
- } else {
221
- $message = __('Uploads folder named "' . $this -> plugin_name . '" cannot be created inside "wp-content/uploads"', $this -> plugin_name);
222
- $this -> render_msg($message);
223
- }
224
- }
225
-
226
- return false;
227
- }
228
-
229
- function add_action($action, $function = null, $priority = 10, $params = 1) {
230
- if (add_action($action, array($this, (empty($function)) ? $action : $function), $priority, $params)) {
231
- return true;
232
- }
233
-
234
- return false;
235
- }
236
-
237
- function add_filter($filter, $function = null, $priority = 10, $params = 1) {
238
- if (add_filter($filter, array($this, (empty($function)) ? $filter : $function), $priority, $params)) {
239
- return true;
240
- }
241
-
242
- return false;
243
- }
244
-
245
- function enqueue_scripts() {
246
- wp_enqueue_script('jquery');
247
-
248
- if (is_admin()) {
249
- if (!empty($_GET['page'])) {
250
- wp_enqueue_script('autosave');
251
-
252
- if ($_GET['page'] == 'gallery-settings') {
253
- wp_enqueue_script('common');
254
- wp_enqueue_script('wp-lists');
255
- wp_enqueue_script('postbox');
256
-
257
- wp_enqueue_script('settings-editor', '/' . PLUGINDIR . '/' . $this -> plugin_name . '/js/settings-editor.js', array('jquery'), '1.0');
258
- }
259
-
260
- if ($_GET['page'] == "gallery" && $_GET['method'] == "order") {
261
- wp_enqueue_script('jquery-ui-sortable');
262
- }
263
- }
264
-
265
- wp_enqueue_script($this -> plugin_name . 'admin', '/' . PLUGINDIR . '/' . $this -> plugin_name . '/js/admin.js', null, '1.0');
266
- } else {
267
- wp_enqueue_script($this -> plugin_name, '/' . PLUGINDIR . '/' . $this -> plugin_name . '/js/gallery.js', null, '1.0');
268
- }
269
-
270
- return true;
271
- }
272
-
273
- function enqueue_styles() {
274
- $src = '/' . PLUGINDIR . '/' . $this -> plugin_name . '/css/gallery-css.php?1=1';
275
-
276
- if ($styles = $this -> get_option('styles')) {
277
- foreach ($styles as $skey => $sval) {
278
- $src .= "&amp;" . $skey . "=" . urlencode($sval);
279
- }
280
- }
281
-
282
- wp_enqueue_style($this -> plugin_name, $src, null, '1.0', 'screen');
283
-
284
- return true;
285
- }
286
-
287
- function plugin_base() {
288
- return rtrim(dirname(__FILE__), '/');
289
- }
290
-
291
- function url() {
292
- return rtrim(get_bloginfo('wpurl'), '/') . '/' . substr(preg_replace("/\\" . DS . "/si", "/", $this -> plugin_base()), strlen(ABSPATH));
293
- }
294
-
295
- function add_option($name = '', $value = '') {
296
- if (add_option($this -> pre . $name, $value)) {
297
- return true;
298
- }
299
-
300
- return false;
301
- }
302
-
303
- function update_option($name = '', $value = '') {
304
- if (update_option($this -> pre . $name, $value)) {
305
- return true;
306
- }
307
-
308
- return false;
309
- }
310
-
311
- function get_option($name = '', $stripslashes = true) {
312
- if ($option = get_option($this -> pre . $name)) {
313
- if (@unserialize($option) !== false) {
314
- return unserialize($option);
315
- }
316
-
317
- if ($stripslashes == true) {
318
- $option = stripslashes_deep($option);
319
- }
320
-
321
- return $option;
322
- }
323
-
324
- return false;
325
- }
326
-
327
- function debug($var = array()) {
328
- if ($this -> debugging) {
329
- echo '<pre>' . print_r($var, true) . '</pre>';
330
- return true;
331
- }
332
-
333
- return false;
334
- }
335
-
336
- function check_table($model = null) {
337
- global $wpdb;
338
-
339
- if (!empty($model)) {
340
- if (!empty($this -> fields) && is_array($this -> fields)) {
341
- if (!$wpdb -> get_var("SHOW TABLES LIKE '" . $this -> table . "'")) {
342
- $query = "CREATE TABLE `" . $this -> table . "` (";
343
- $c = 1;
344
-
345
- foreach ($this -> fields as $field => $attributes) {
346
- if ($field != "key") {
347
- $query .= "`" . $field . "` " . $attributes . "";
348
- } else {
349
- $query .= "" . $attributes . "";
350
- }
351
-
352
- if ($c < count($this -> fields)) {
353
- $query .= ",";
354
- }
355
-
356
- $c++;
357
- }
358
-
359
- $query .= ") ENGINE=MyISAM AUTO_INCREMENT=1 CHARSET=UTF8;";
360
-
361
- if (!empty($query)) {
362
- $this -> table_query[] = $query;
363
- }
364
- } else {
365
- $field_array = $this -> get_fields($this -> table);
366
-
367
- foreach ($this -> fields as $field => $attributes) {
368
- if ($field != "key") {
369
- $this -> add_field($this -> table, $field, $attributes);
370
- }
371
- }
372
- }
373
-
374
- if (!empty($this -> table_query)) {
375
- require_once(ABSPATH . 'wp-admin' . DS . 'upgrade-functions.php');
376
- dbDelta($this -> table_query, true);
377
- }
378
- }
379
- }
380
-
381
- return false;
382
- }
383
-
384
- function get_fields($table = null) {
385
- global $wpdb;
386
-
387
- if (!empty($table)) {
388
- $fullname = $table;
389
-
390
- if (($tablefields = mysql_list_fields(DB_NAME, $fullname, $wpdb -> dbh)) !== false) {
391
- $columns = mysql_num_fields($tablefields);
392
-
393
- $field_array = array();
394
- for ($i = 0; $i < $columns; $i++) {
395
- $fieldname = mysql_field_name($tablefields, $i);
396
- $field_array[] = $fieldname;
397
- }
398
-
399
- return $field_array;
400
- }
401
- }
402
-
403
- return false;
404
- }
405
-
406
- function delete_field($table = '', $field = '') {
407
- global $wpdb;
408
-
409
- if (!empty($table)) {
410
- if (!empty($field)) {
411
- $query = "ALTER TABLE `" . $wpdb -> prefix . "" . $table . "` DROP `" . $field . "`";
412
-
413
- if ($wpdb -> query($query)) {
414
- return false;
415
- }
416
- }
417
- }
418
-
419
- return false;
420
- }
421
-
422
- function change_field($table = '', $field = '', $newfield = '', $attributes = "TEXT NOT NULL") {
423
- global $wpdb;
424
-
425
- if (!empty($table)) {
426
- if (!empty($field)) {
427
- if (!empty($newfield)) {
428
- $field_array = $this -> get_fields($table);
429
-
430
- if (!in_array($field, $field_array)) {
431
- if ($this -> add_field($table, $newfield)) {
432
- return true;
433
- }
434
- } else {
435
- $query = "ALTER TABLE `" . $table . "` CHANGE `" . $field . "` `" . $newfield . "` " . $attributes . ";";
436
-
437
- if ($wpdb -> query($query)) {
438
- return true;
439
- }
440
- }
441
- }
442
- }
443
- }
444
-
445
- return false;
446
- }
447
-
448
- function add_field($table = '', $field = '', $attributes = "TEXT NOT NULL") {
449
- global $wpdb;
450
-
451
- if (!empty($table)) {
452
- if (!empty($field)) {
453
- $field_array = $this -> get_fields($table);
454
-
455
- if (!empty($field_array)) {
456
- if (!in_array($field, $field_array)) {
457
- $query = "ALTER TABLE `" . $table . "` ADD `" . $field . "` " . $attributes . ";";
458
-
459
- if ($wpdb -> query($query)) {
460
- return true;
461
- }
462
- }
463
- }
464
- }
465
- }
466
-
467
- return false;
468
- }
469
-
470
- function render($file = '', $params = array(), $output = true, $folder = 'admin') {
471
- if (!empty($file)) {
472
- $filename = $file . '.php';
473
- $filepath = $this -> plugin_base() . DS . 'views' . DS . $folder . DS;
474
- $filefull = $filepath . $filename;
475
-
476
- if (file_exists($filefull)) {
477
- if (!empty($params)) {
478
- foreach ($params as $pkey => $pval) {
479
- ${$pkey} = $pval;
480
- }
481
- }
482
-
483
- if ($output == false) {
484
- ob_start();
485
- }
486
-
487
- include($filefull);
488
-
489
- if ($output == false) {
490
- $data = ob_get_clean();
491
- return $data;
492
- } else {
493
- flush();
494
- return true;
495
- }
496
- }
497
- }
498
-
499
- return false;
500
- }
501
- }
502
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
503
  ?>
1
+ <?php
2
+
3
+ class GalleryPlugin {
4
+
5
+ var $version = '1.1';
6
+ var $plugin_name;
7
+ var $plugin_base;
8
+ var $pre = 'Gallery';
9
+
10
+ var $menus = array();
11
+ var $sections = array(
12
+ 'gallery' => 'gallery',
13
+ 'settings' => 'gallery-settings',
14
+ );
15
+
16
+ var $helpers = array('Db', 'Html', 'Form', 'Metabox');
17
+ var $models = array('Slide');
18
+
19
+ var $debugging = false; //set to "true" to turn on debugging
20
+ var $debug_level = 1; //set to 2 for PHP and DB errors or 1 for just DB errors
21
+
22
+ function register_plugin($name, $base) {
23
+ $this -> plugin_name = $name;
24
+ $this -> plugin_base = rtrim(dirname($base), DS);
25
+ $this -> sections = (object) $this -> sections;
26
+
27
+ $this -> enqueue_scripts();
28
+ $this -> enqueue_styles();
29
+
30
+ $this -> initialize_classes();
31
+ $this -> initialize_options();
32
+
33
+ if (function_exists('load_plugin_textdomain')) {
34
+ $currentlocale = get_locale();
35
+ if(!empty($currentlocale)) {
36
+ $moFile = dirname(__FILE__) . DS . "languages" . DS . $this -> plugin_name . "-" . $currentlocale . ".mo";
37
+ if(@file_exists($moFile) && is_readable($moFile)) {
38
+ load_textdomain($this -> plugin_name, $moFile);
39
+ }
40
+ }
41
+ }
42
+
43
+ global $wpdb;
44
+ if ($this -> debugging == true) {
45
+ $wpdb -> show_errors();
46
+ error_reporting(E_ALL ^ E_NOTICE);
47
+ @ini_set('display_errors', 1);
48
+ } else {
49
+ $wpdb -> hide_errors();
50
+ error_reporting(0);
51
+ @ini_set('display_errors', 0);
52
+ }
53
+
54
+ return true;
55
+ }
56
+
57
+ function init_class($name = null, $params = array()) {
58
+ if (!empty($name)) {
59
+ $name = $this -> pre . $name;
60
+
61
+ if (class_exists($name)) {
62
+ if ($class = new $name($params)) {
63
+ return $class;
64
+ }
65
+ }
66
+ }
67
+
68
+ $this -> init_class('Country');
69
+
70
+ return false;
71
+ }
72
+
73
+ function initialize_classes() {
74
+ if (!empty($this -> helpers)) {
75
+ foreach ($this -> helpers as $helper) {
76
+ $hfile = dirname(__FILE__) . DS . 'helpers' . DS . strtolower($helper) . '.php';
77
+
78
+ if (file_exists($hfile)) {
79
+ require_once($hfile);
80
+
81
+ if (empty($this -> {$helper}) || !is_object($this -> {$helper})) {
82
+ $classname = $this -> pre . $helper . 'Helper';
83
+
84
+ if (class_exists($classname)) {
85
+ $this -> {$helper} = new $classname;
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
91
+
92
+ if (!empty($this -> models)) {
93
+ foreach ($this -> models as $model) {
94
+ $mfile = dirname(__FILE__) . DS . 'models' . DS . strtolower($model) . '.php';
95
+
96
+ if (file_exists($mfile)) {
97
+ require_once($mfile);
98
+
99
+ if (empty($this -> {$model}) || !is_object($this -> {$model})) {
100
+ $classname = $this -> pre . $model;
101
+
102
+ if (class_exists($classname)) {
103
+ $this -> {$model} = new $classname;
104
+ }
105
+ }
106
+ }
107
+ }
108
+ }
109
+ }
110
+
111
+ function initialize_options() {
112
+ $styles = array(
113
+ 'width' => "450",
114
+ 'height' => "250",
115
+ 'border' => "1px solid #CCCCCC",
116
+ 'background' => "#000000",
117
+ 'infobackground' => "#000000",
118
+ 'infocolor' => "#FFFFFF",
119
+ 'resizeimages' => "Y",
120
+ );
121
+
122
+ $this -> add_option('styles', $styles);
123
+
124
+ //General Settings
125
+ $this -> add_option('fadespeed', 10);
126
+ $this -> add_option('navopacity', 25);
127
+ $this -> add_option('navhover', 70);
128
+ $this -> add_option('information', "Y");
129
+ $this -> add_option('infospeed', 10);
130
+ $this -> add_option('thumbnails', "N");
131
+ $this -> add_option('thumbposition', "bottom");
132
+ $this -> add_option('thumbopacity', 70);
133
+ $this -> add_option('thumbscrollspeed', 5);
134
+ $this -> add_option('thumbspacing', 5);
135
+ $this -> add_option('thumbactive', "#FFFFFF");
136
+ $this -> add_option('autoslide', "Y");
137
+ $this -> add_option('autospeed', 10);
138
+ $this -> add_option('imagesthickbox', "N");
139
+ }
140
+
141
+ function render_msg($message = '') {
142
+ $this -> render('msg-top', array('message' => $message), true, 'admin');
143
+ }
144
+
145
+ function render_err($message = '') {
146
+ $this -> render('err-top', array('message' => $message), true, 'admin');
147
+ }
148
+
149
+ function redirect($location = '', $msgtype = '', $message = '') {
150
+ $url = $location;
151
+
152
+ if ($msgtype == "message") {
153
+ $url .= '&' . $this -> pre . 'updated=true';
154
+ } elseif ($msgtype == "error") {
155
+ $url .= '&' . $this -> pre . 'error=true';
156
+ }
157
+
158
+ if (!empty($message)) {
159
+ $url .= '&' . $this -> pre . 'message=' . urlencode($message);
160
+ }
161
+
162
+ ?>
163
+
164
+ <script type="text/javascript">
165
+ window.location = '<?php echo (empty($url)) ? get_option('home') : $url; ?>';
166
+ </script>
167
+
168
+ <?php
169
+
170
+ flush();
171
+ }
172
+
173
+ function paginate($model = null, $fields = '*', $sub = null, $conditions = null, $searchterm = null, $per_page = 10, $order = array('modified', "DESC")) {
174
+ global $wpdb;
175
+
176
+ if (!empty($model)) {
177
+ global $paginate;
178
+ $paginate = $this -> vendor('Paginate');
179
+ $paginate -> table = $this -> {$model} -> table;
180
+ $paginate -> sub = (empty($sub)) ? $this -> {$model} -> controller : $sub;
181
+ $paginate -> fields = (empty($fields)) ? '*' : $fields;
182
+ $paginate -> where = (empty($conditions)) ? false : $conditions;
183
+ $paginate -> searchterm = (empty($searchterm)) ? false : $searchterm;
184
+ $paginate -> per_page = $per_page;
185
+ $paginate -> order = $order;
186
+
187
+ $data = $paginate -> start_paging($_GET[$this -> pre . 'page']);
188
+
189
+ if (!empty($data)) {
190
+ $newdata = array();
191
+
192
+ foreach ($data as $record) {
193
+ $newdata[] = $this -> init_class($model, $record);
194
+ }
195
+
196
+ $data = array();
197
+ $data[$model] = $newdata;
198
+ $data['Paginate'] = $paginate;
199
+ }
200
+
201
+ return $data;
202
+ }
203
+
204
+ return false;
205
+ }
206
+
207
+ function vendor($name = '', $folder = '') {
208
+ if (!empty($name)) {
209
+ $filename = 'class.' . strtolower($name) . '.php';
210
+ $filepath = rtrim(dirname(__FILE__), DS) . DS . 'vendors' . DS . $folder . '';
211
+ $filefull = $filepath . $filename;
212
+
213
+ if (file_exists($filefull)) {
214
+ require_once($filefull);
215
+ $class = 'Gallery' . $name;
216
+
217
+ if (${$name} = new $class) {
218
+ return ${$name};
219
+ }
220
+ }
221
+ }
222
+
223
+ return false;
224
+ }
225
+
226
+ function check_uploaddir() {
227
+ $uploaddir = ABSPATH . 'wp-content' . DS . 'uploads' . DS . $this -> plugin_name . DS;
228
+
229
+ if (!file_exists($uploaddir)) {
230
+ if (@mkdir($uploaddir, 0777)) {
231
+ @chmod($uploaddir, 0777);
232
+ return true;
233
+ } else {
234
+ $message = __('Uploads folder named "' . $this -> plugin_name . '" cannot be created inside "wp-content/uploads"', $this -> plugin_name);
235
+ $this -> render_msg($message);
236
+ }
237
+ }
238
+
239
+ return false;
240
+ }
241
+
242
+ function add_action($action, $function = null, $priority = 10, $params = 1) {
243
+ if (add_action($action, array($this, (empty($function)) ? $action : $function), $priority, $params)) {
244
+ return true;
245
+ }
246
+
247
+ return false;
248
+ }
249
+
250
+ function add_filter($filter, $function = null, $priority = 10, $params = 1) {
251
+ if (add_filter($filter, array($this, (empty($function)) ? $filter : $function), $priority, $params)) {
252
+ return true;
253
+ }
254
+
255
+ return false;
256
+ }
257
+
258
+ function enqueue_scripts() {
259
+ wp_enqueue_script('jquery');
260
+
261
+ if (is_admin()) {
262
+ if (!empty($_GET['page']) && in_array($_GET['page'], (array) $this -> sections)) {
263
+ wp_enqueue_script('autosave');
264
+
265
+ if ($_GET['page'] == 'gallery-settings') {
266
+ wp_enqueue_script('common');
267
+ wp_enqueue_script('wp-lists');
268
+ wp_enqueue_script('postbox');
269
+
270
+ wp_enqueue_script('settings-editor', '/' . PLUGINDIR . '/' . $this -> plugin_name . '/js/settings-editor.js', array('jquery'), '1.0');
271
+ }
272
+
273
+ if ($_GET['page'] == "gallery" && $_GET['method'] == "order") {
274
+ wp_enqueue_script('jquery-ui-sortable');
275
+ }
276
+
277
+ add_thickbox();
278
+ }
279
+
280
+ wp_enqueue_script($this -> plugin_name . 'admin', '/' . PLUGINDIR . '/' . $this -> plugin_name . '/js/admin.js', null, '1.0');
281
+ } else {
282
+ wp_enqueue_script($this -> plugin_name, '/' . PLUGINDIR . '/' . $this -> plugin_name . '/js/gallery.js', null, '1.0');
283
+
284
+ if ($this -> get_option('imagesthickbox') == "Y") {
285
+ add_thickbox();
286
+ }
287
+ }
288
+
289
+ return true;
290
+ }
291
+
292
+ function enqueue_styles() {
293
+ if (!is_admin()) {
294
+ $src = '/' . PLUGINDIR . '/' . $this -> plugin_name . '/css/gallery-css.php?1=1';
295
+
296
+ if ($styles = $this -> get_option('styles')) {
297
+ foreach ($styles as $skey => $sval) {
298
+ $src .= "&amp;" . $skey . "=" . urlencode($sval);
299
+ }
300
+ }
301
+
302
+ wp_enqueue_style($this -> plugin_name, $src, null, '1.0', 'screen');
303
+ }
304
+
305
+ return true;
306
+ }
307
+
308
+ function plugin_base() {
309
+ return rtrim(dirname(__FILE__), '/');
310
+ }
311
+
312
+ function url() {
313
+ return rtrim(get_bloginfo('wpurl'), '/') . '/' . substr(preg_replace("/\\" . DS . "/si", "/", $this -> plugin_base()), strlen(ABSPATH));
314
+ }
315
+
316
+ function add_option($name = '', $value = '') {
317
+ if (add_option($this -> pre . $name, $value)) {
318
+ return true;
319
+ }
320
+
321
+ return false;
322
+ }
323
+
324
+ function update_option($name = '', $value = '') {
325
+ if (update_option($this -> pre . $name, $value)) {
326
+ return true;
327
+ }
328
+
329
+ return false;
330
+ }
331
+
332
+ function get_option($name = '', $stripslashes = true) {
333
+ if ($option = get_option($this -> pre . $name)) {
334
+ if (@unserialize($option) !== false) {
335
+ return unserialize($option);
336
+ }
337
+
338
+ if ($stripslashes == true) {
339
+ $option = stripslashes_deep($option);
340
+ }
341
+
342
+ return $option;
343
+ }
344
+
345
+ return false;
346
+ }
347
+
348
+ function debug($var = array()) {
349
+ if ($this -> debugging) {
350
+ echo '<pre>' . print_r($var, true) . '</pre>';
351
+ return true;
352
+ }
353
+
354
+ return false;
355
+ }
356
+
357
+ function check_table($model = null) {
358
+ global $wpdb;
359
+
360
+ if (!empty($model)) {
361
+ if (!empty($this -> fields) && is_array($this -> fields)) {
362
+ if (!$wpdb -> get_var("SHOW TABLES LIKE '" . $this -> table . "'")) {
363
+ $query = "CREATE TABLE `" . $this -> table . "` (";
364
+ $c = 1;
365
+
366
+ foreach ($this -> fields as $field => $attributes) {
367
+ if ($field != "key") {
368
+ $query .= "`" . $field . "` " . $attributes . "";
369
+ } else {
370
+ $query .= "" . $attributes . "";
371
+ }
372
+
373
+ if ($c < count($this -> fields)) {
374
+ $query .= ",";
375
+ }
376
+
377
+ $c++;
378
+ }
379
+
380
+ $query .= ") ENGINE=MyISAM AUTO_INCREMENT=1 CHARSET=UTF8;";
381
+
382
+ if (!empty($query)) {
383
+ $this -> table_query[] = $query;
384
+ }
385
+ } else {
386
+ $field_array = $this -> get_fields($this -> table);
387
+
388
+ foreach ($this -> fields as $field => $attributes) {
389
+ if ($field != "key") {
390
+ $this -> add_field($this -> table, $field, $attributes);
391
+ }
392
+ }
393
+ }
394
+
395
+ if (!empty($this -> table_query)) {
396
+ require_once(ABSPATH . 'wp-admin' . DS . 'upgrade-functions.php');
397
+ dbDelta($this -> table_query, true);
398
+ }
399
+ }
400
+ }
401
+
402
+ return false;
403
+ }
404
+
405
+ function get_fields($table = null) {
406
+ global $wpdb;
407
+
408
+ if (!empty($table)) {
409
+ $fullname = $table;
410
+
411
+ if (($tablefields = mysql_list_fields(DB_NAME, $fullname, $wpdb -> dbh)) !== false) {
412
+ $columns = mysql_num_fields($tablefields);
413
+
414
+ $field_array = array();
415
+ for ($i = 0; $i < $columns; $i++) {
416
+ $fieldname = mysql_field_name($tablefields, $i);
417
+ $field_array[] = $fieldname;
418
+ }
419
+
420
+ return $field_array;
421
+ }
422
+ }
423
+
424
+ return false;
425
+ }
426
+
427
+ function delete_field($table = '', $field = '') {
428
+ global $wpdb;
429
+
430
+ if (!empty($table)) {
431
+ if (!empty($field)) {
432
+ $query = "ALTER TABLE `" . $wpdb -> prefix . "" . $table . "` DROP `" . $field . "`";
433
+
434
+ if ($wpdb -> query($query)) {
435
+ return false;
436
+ }
437
+ }
438
+ }
439
+
440
+ return false;
441
+ }
442
+
443
+ function change_field($table = '', $field = '', $newfield = '', $attributes = "TEXT NOT NULL") {
444
+ global $wpdb;
445
+
446
+ if (!empty($table)) {
447
+ if (!empty($field)) {
448
+ if (!empty($newfield)) {
449
+ $field_array = $this -> get_fields($table);
450
+
451
+ if (!in_array($field, $field_array)) {
452
+ if ($this -> add_field($table, $newfield)) {
453
+ return true;
454
+ }
455
+ } else {
456
+ $query = "ALTER TABLE `" . $table . "` CHANGE `" . $field . "` `" . $newfield . "` " . $attributes . ";";
457
+
458
+ if ($wpdb -> query($query)) {
459
+ return true;
460
+ }
461
+ }
462
+ }
463
+ }
464
+ }
465
+
466
+ return false;
467
+ }
468
+
469
+ function add_field($table = '', $field = '', $attributes = "TEXT NOT NULL") {
470
+ global $wpdb;
471
+
472
+ if (!empty($table)) {
473
+ if (!empty($field)) {
474
+ $field_array = $this -> get_fields($table);
475
+
476
+ if (!empty($field_array)) {
477
+ if (!in_array($field, $field_array)) {
478
+ $query = "ALTER TABLE `" . $table . "` ADD `" . $field . "` " . $attributes . ";";
479
+
480
+ if ($wpdb -> query($query)) {
481
+ return true;
482
+ }
483
+ }
484
+ }
485
+ }
486
+ }
487
+
488
+ return false;
489
+ }
490
+
491
+ function render($file = '', $params = array(), $output = true, $folder = 'admin') {
492
+ if (!empty($file)) {
493
+ $filename = $file . '.php';
494
+ $filepath = $this -> plugin_base() . DS . 'views' . DS . $folder . DS;
495
+ $filefull = $filepath . $filename;
496
+
497
+ if (file_exists($filefull)) {
498
+ if (!empty($params)) {
499
+ foreach ($params as $pkey => $pval) {
500
+ ${$pkey} = $pval;
501
+ }
502
+ }
503
+
504
+ if ($output == false) {
505
+ ob_start();
506
+ }
507
+
508
+ include($filefull);
509
+
510
+ if ($output == false) {
511
+ $data = ob_get_clean();
512
+ return $data;
513
+ } else {
514
+ flush();
515
+ return true;
516
+ }
517
+ }
518
+ }
519
+
520
+ return false;
521
+ }
522
+ }
523
+
524
  ?>
slideshow-gallery.php CHANGED
@@ -1,226 +1,256 @@
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 with an optional <code>post_id</code> parameter. To hardcode into any PHP file of your WordPress theme, simply use <code>&lt;?php if (class_exists('Gallery')) { $Gallery = new Gallery(); $Gallery -> slideshow($output = true, $post_id = null); } ?&gt;</code> and specify the required <code>$post_id</code> parameter accordingly.
9
- Version: 1.0.5
10
- */
11
-
12
- define('DS', DIRECTORY_SEPARATOR);
13
- require_once(dirname(__FILE__) . DS . '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
- //WordPress filter hooks
29
- $this -> add_filter('mce_buttons');
30
- $this -> add_filter('mce_external_plugins');
31
-
32
- add_shortcode('slideshow', array($this, 'embed'));
33
- }
34
-
35
- function admin_menu() {
36
- add_menu_page(__('Slideshow', $this -> plugin_name), __('Slideshow', $this -> plugin_name), 10, "gallery", array($this, 'admin_slides'), $this -> url() . '/images/icon.png');
37
- $this -> menus['gallery'] = add_submenu_page("gallery", __('Manage Slides', $this -> plugin_name), __('Manage Slides', $this -> plugin_name), 10, "gallery", array($this, 'admin_slides'));
38
- $this -> menus['gallery-settings'] = add_submenu_page("gallery", __('Configuration', $this -> plugin_name), __('Configuration', $this -> plugin_name), 10, "gallery-settings", array($this, 'admin_settings'));
39
-
40
- add_action('admin_head-' . $this -> menus['gallery-settings'], array($this, 'admin_head_gallery_settings'));
41
- }
42
-
43
- function admin_head() {
44
- $this -> render('head', false, true, 'admin');
45
- }
46
-
47
- function admin_head_gallery_settings() {
48
- add_meta_box('submitdiv', __('Save Settings', $this -> plugin_name), array($this -> Metabox, "settings_submit"), $this -> menus['gallery-settings'], 'side', 'core');
49
- add_meta_box('generaldiv', __('General Settings', $this -> plugin_name), array($this -> Metabox, "settings_general"), $this -> menus['gallery-settings'], 'normal', 'core');
50
- add_meta_box('stylesdiv', __('Appearance &amp; Styles', $this -> plugin_name), array($this -> Metabox, "settings_styles"), $this -> menus['gallery-settings'], 'normal', 'core');
51
-
52
- do_action('do_meta_boxes', $this -> menus['gallery-settings'], 'normal');
53
- do_action('do_meta_boxes', $this -> menus['gallery-settings'], 'side');
54
- }
55
-
56
- function admin_notices() {
57
- $this -> check_uploaddir();
58
-
59
- if (!empty($_GET[$this -> pre . 'message'])) {
60
- $msg_type = (!empty($_GET[$this -> pre . 'updated'])) ? 'msg' : 'err';
61
- call_user_method('render_' . $msg_type, $this, $_GET[$this -> pre . 'message']);
62
- }
63
- }
64
-
65
- function mce_buttons($buttons) {
66
- array_push($buttons, "separator", "gallery");
67
- return $buttons;
68
- }
69
-
70
- function mce_external_plugins($plugins) {
71
- $plugins['gallery'] = $this -> url() . '/js/tinymce/editor_plugin.js';
72
- return $plugins;
73
- }
74
-
75
- function slideshow($output = true, $post_id = null, $exclude = null) {
76
- global $wpdb;
77
-
78
- if (!empty($post_id) && $post = get_post($post_id)) {
79
- if ($attachments = get_children("post_parent=" . $post -> ID . "&post_type=attachment&post_mime_type=image&orderby=menu_order ASC, ID ASC")) {
80
- if (!empty($exclude)) {
81
- $exclude = array_map('trim', explode(',', $exclude));
82
-
83
- $a = 0;
84
- foreach ($attachments as $id => $attachment) {
85
-
86
- $a++;
87
- if (in_array($a, $exclude)) {
88
- unset($attachments[$id]);
89
- }
90
- }
91
- }
92
-
93
- $content = $this -> render('gallery', array('slides' => $attachments, 'frompost' => true), false, 'default');
94
- }
95
- } else {
96
- $slides = $this -> Slide -> find_all(null, null, array('order', "ASC"));
97
- $content = $this -> render('gallery', array('slides' => $slides, 'frompost' => false), false, 'default');
98
- }
99
-
100
- if ($output) { echo $content; } else { return $content; }
101
- }
102
-
103
- function embed($atts = array(), $content = null) {
104
- //global variables
105
- global $wpdb;
106
-
107
- $defaults = array('post_id' => null, 'exclude' => null, 'custom' => null);
108
- extract(shortcode_atts($defaults, $atts));
109
-
110
- if (!empty($custom)) {
111
- $slides = $this -> Slide -> find_all(null, null, array('order', "ASC"));
112
- $content = $this -> render('gallery', array('slides' => $slides, 'frompost' => false), false, 'default');
113
- } else {
114
- global $post;
115
- $pid = (empty($post_id)) ? $post -> ID : $post_id;
116
-
117
- if (!empty($pid) && $post = get_post($pid)) {
118
- if ($attachments = get_children("post_parent=" . $post -> ID . "&post_type=attachment&post_mime_type=image&orderby=menu_order ASC, ID ASC")) {
119
- if (!empty($exclude)) {
120
- $exclude = array_map('trim', explode(',', $exclude));
121
-
122
- $a = 0;
123
- foreach ($attachments as $id => $attachment) {
124
-
125
- $a++;
126
- if (in_array($a, $exclude)) {
127
- unset($attachments[$id]);
128
- }
129
- }
130
- }
131
-
132
- $content = $this -> render('gallery', array('slides' => $attachments, 'frompost' => true), false, 'default');
133
- }
134
- }
135
- }
136
-
137
- return $content;
138
- }
139
-
140
- function admin_slides() {
141
- switch ($_GET['method']) {
142
- case 'save' :
143
- if (!empty($_POST)) {
144
- if ($this -> Slide -> save($_POST, true)) {
145
- $message = __('Slide has been saved', $this -> plugin_name);
146
- $this -> redirect($this -> url, "message", $message);
147
- } else {
148
- $this -> render('slides' . DS . 'save', false, true, 'admin');
149
- }
150
- } else {
151
- $this -> Db -> model = $this -> Slide -> model;
152
- $this -> Slide -> find(array('id' => $_GET['id']));
153
- $this -> render('slides' . DS . 'save', false, true, 'admin');
154
- }
155
- break;
156
- case 'mass' :
157
- if (!empty($_POST['action'])) {
158
- if (!empty($_POST['Slide']['checklist'])) {
159
- switch ($_POST['action']) {
160
- case 'delete' :
161
- foreach ($_POST['Slide']['checklist'] as $slide_id) {
162
- $this -> Slide -> delete($slide_id);
163
- }
164
-
165
- $message = __('Selected slides have been removed', $this -> plugin_name);
166
- $this -> redirect($this -> url, 'message', $message);
167
- break;
168
- }
169
- } else {
170
- $message = __('No slides were selected', $this -> plugin_name);
171
- $this -> redirect($this -> url, "error", $message);
172
- }
173
- } else {
174
- $message = __('No action was specified', $this -> plugin_name);
175
- $this -> redirect($this -> url, "error", $message);
176
- }
177
- break;
178
- case 'order' :
179
- $slides = $this -> Slide -> find_all(null, null, array('order', "ASC"));
180
- $this -> render('slides' . DS . 'order', array('slides' => $slides), true, 'admin');
181
- break;
182
- default :
183
- $data = $this -> paginate('Slide');
184
- $this -> render('slides' . DS . 'index', array('slides' => $data[$this -> Slide -> model], 'paginate' => $data['Paginate']), true, 'admin');
185
- break;
186
- }
187
- }
188
-
189
- function admin_settings() {
190
- switch ($_GET['method']) {
191
- case 'reset' :
192
- global $wpdb;
193
- $query = "DELETE FROM `" . $wpdb -> prefix . "options` WHERE `option_name` LIKE '" . $this -> pre . "%';";
194
-
195
- if ($wpdb -> query($query)) {
196
- $message = __('All configuration settings have been reset to their defaults', $this -> plugin_name);
197
- $msg_type = 'message';
198
- $this -> render_msg($message);
199
- } else {
200
- $message = __('Configuration settings could not be reset', $this -> plugin_name);
201
- $msg_type = 'error';
202
- $this -> render_err($message);
203
- }
204
-
205
- $this -> redirect($this -> url, $msg_type, $message);
206
- break;
207
- default :
208
- if (!empty($_POST)) {
209
- foreach ($_POST as $pkey => $pval) {
210
- $this -> update_option($pkey, $pval);
211
- }
212
-
213
- $message = __('Configuration has been saved', $this -> plugin_name);
214
- $this -> render_msg($message);
215
- }
216
- break;
217
- }
218
-
219
- $this -> render('settings', false, true, 'admin');
220
- }
221
- }
222
-
223
- //initialize a Gallery object
224
- $Gallery = new Gallery();
225
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  ?>
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 with an optional <code>post_id</code> parameter. To hardcode into any PHP file of your WordPress theme, simply use <code>&lt;?php if (class_exists('Gallery')) { $Gallery = new Gallery(); $Gallery -> slideshow($output = true, $post_id = null); } ?&gt;</code> and specify the required <code>$post_id</code> parameter accordingly.
9
+ Version: 1.1
10
+ */
11
+
12
+ define('DS', DIRECTORY_SEPARATOR);
13
+ require_once(dirname(__FILE__) . DS . '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
+ $this -> referer = (empty($_SERVER['HTTP_REFERER'])) ? $this -> url : $_SERVER['HTTP_REFERER'];
21
+
22
+ $this -> register_plugin('slideshow-gallery', __FILE__);
23
+
24
+ //WordPress action hooks
25
+ $this -> add_action('wp_head');
26
+ $this -> add_action('admin_menu');
27
+ $this -> add_action('admin_head');
28
+ $this -> add_action('admin_notices');
29
+
30
+ //WordPress filter hooks
31
+ $this -> add_filter('mce_buttons');
32
+ $this -> add_filter('mce_external_plugins');
33
+
34
+ add_shortcode('slideshow', array($this, 'embed'));
35
+ }
36
+
37
+ function wp_head() {
38
+ ?>
39
+
40
+ <script type="text/javascript">
41
+ var tb_pathToImage = "<?php echo rtrim(get_bloginfo('wpurl'), '/'); ?>/wp-includes/js/thickbox/loadingAnimation.gif";
42
+ var tb_closeImage = "<?php echo rtrim(get_bloginfo('wpurl'), '/'); ?>/wp-includes/js/thickbox/tb-close.png";
43
+ </script>
44
+
45
+ <?php
46
+ }
47
+
48
+ function admin_menu() {
49
+ add_menu_page(__('Slideshow', $this -> plugin_name), __('Slideshow', $this -> plugin_name), 10, "gallery", array($this, 'admin_slides'), $this -> url() . '/images/icon.png');
50
+ $this -> menus['gallery'] = add_submenu_page("gallery", __('Manage Slides', $this -> plugin_name), __('Manage Slides', $this -> plugin_name), 10, "gallery", array($this, 'admin_slides'));
51
+ $this -> menus['gallery-settings'] = add_submenu_page("gallery", __('Configuration', $this -> plugin_name), __('Configuration', $this -> plugin_name), 10, "gallery-settings", array($this, 'admin_settings'));
52
+
53
+ add_action('admin_head-' . $this -> menus['gallery-settings'], array($this, 'admin_head_gallery_settings'));
54
+ }
55
+
56
+ function admin_head() {
57
+ $this -> render('head', false, true, 'admin');
58
+ }
59
+
60
+ function admin_head_gallery_settings() {
61
+ add_meta_box('submitdiv', __('Save Settings', $this -> plugin_name), array($this -> Metabox, "settings_submit"), $this -> menus['gallery-settings'], 'side', 'core');
62
+ add_meta_box('generaldiv', __('General Settings', $this -> plugin_name), array($this -> Metabox, "settings_general"), $this -> menus['gallery-settings'], 'normal', 'core');
63
+ add_meta_box('linksimagesdiv', __('Links &amp; Images Overlay', $this -> plugin_name), array($this -> Metabox, "settings_linksimages"), $this -> menus['gallery-settings'], 'normal', 'core');
64
+ add_meta_box('stylesdiv', __('Appearance &amp; Styles', $this -> plugin_name), array($this -> Metabox, "settings_styles"), $this -> menus['gallery-settings'], 'normal', 'core');
65
+
66
+ do_action('do_meta_boxes', $this -> menus['gallery-settings'], 'normal');
67
+ do_action('do_meta_boxes', $this -> menus['gallery-settings'], 'side');
68
+ }
69
+
70
+ function admin_notices() {
71
+ $this -> check_uploaddir();
72
+
73
+ if (!empty($_GET[$this -> pre . 'message'])) {
74
+ $msg_type = (!empty($_GET[$this -> pre . 'updated'])) ? 'msg' : 'err';
75
+ call_user_method('render_' . $msg_type, $this, $_GET[$this -> pre . 'message']);
76
+ }
77
+ }
78
+
79
+ function mce_buttons($buttons) {
80
+ array_push($buttons, "separator", "gallery");
81
+ return $buttons;
82
+ }
83
+
84
+ function mce_external_plugins($plugins) {
85
+ $plugins['gallery'] = $this -> url() . '/js/tinymce/editor_plugin.js';
86
+ return $plugins;
87
+ }
88
+
89
+ function slideshow($output = true, $post_id = null, $exclude = null) {
90
+ global $wpdb;
91
+
92
+ if (!empty($post_id) && $post = get_post($post_id)) {
93
+ if ($attachments = get_children("post_parent=" . $post -> ID . "&post_type=attachment&post_mime_type=image&orderby=menu_order ASC, ID ASC")) {
94
+ if (!empty($exclude)) {
95
+ $exclude = array_map('trim', explode(',', $exclude));
96
+
97
+ $a = 0;
98
+ foreach ($attachments as $id => $attachment) {
99
+
100
+ $a++;
101
+ if (in_array($a, $exclude)) {
102
+ unset($attachments[$id]);
103
+ }
104
+ }
105
+ }
106
+
107
+ $content = $this -> render('gallery', array('slides' => $attachments, 'frompost' => true), false, 'default');
108
+ }
109
+ } else {
110
+ $slides = $this -> Slide -> find_all(null, null, array('order', "ASC"));
111
+ $content = $this -> render('gallery', array('slides' => $slides, 'frompost' => false), false, 'default');
112
+ }
113
+
114
+ if ($output) { echo $content; } else { return $content; }
115
+ }
116
+
117
+ function embed($atts = array(), $content = null) {
118
+ //global variables
119
+ global $wpdb;
120
+
121
+ $defaults = array('post_id' => null, 'exclude' => null, 'custom' => null);
122
+ extract(shortcode_atts($defaults, $atts));
123
+
124
+ if (!empty($custom)) {
125
+ $slides = $this -> Slide -> find_all(null, null, array('order', "ASC"));
126
+ $content = $this -> render('gallery', array('slides' => $slides, 'frompost' => false), false, 'default');
127
+ } else {
128
+ global $post;
129
+ $pid = (empty($post_id)) ? $post -> ID : $post_id;
130
+
131
+ if (!empty($pid) && $post = get_post($pid)) {
132
+ if ($attachments = get_children("post_parent=" . $post -> ID . "&post_type=attachment&post_mime_type=image&orderby=menu_order ASC, ID ASC")) {
133
+ if (!empty($exclude)) {
134
+ $exclude = array_map('trim', explode(',', $exclude));
135
+
136
+ $a = 0;
137
+ foreach ($attachments as $id => $attachment) {
138
+
139
+ $a++;
140
+ if (in_array($a, $exclude)) {
141
+ unset($attachments[$id]);
142
+ }
143
+ }
144
+ }
145
+
146
+ $content = $this -> render('gallery', array('slides' => $attachments, 'frompost' => true), false, 'default');
147
+ }
148
+ }
149
+ }
150
+
151
+ return $content;
152
+ }
153
+
154
+ function admin_slides() {
155
+ switch ($_GET['method']) {
156
+ case 'delete' :
157
+ if (!empty($_GET['id'])) {
158
+ if ($this -> Slide -> delete($_GET['id'])) {
159
+ $msg_type = 'message';
160
+ $message = __('Slide has been removed', $this -> plugin_name);
161
+ } else {
162
+ $msg_type = 'error';
163
+ $message = __('Slide cannot be removed', $this -> plugin_name);
164
+ }
165
+ } else {
166
+ $msg_type = 'error';
167
+ $message = __('No slide was specified', $this -> plugin_name);
168
+ }
169
+
170
+ $this -> redirect($this -> referer, $msg_type, $message);
171
+ break;
172
+ case 'save' :
173
+ if (!empty($_POST)) {
174
+ if ($this -> Slide -> save($_POST, true)) {
175
+ $message = __('Slide has been saved', $this -> plugin_name);
176
+ $this -> redirect($this -> url, "message", $message);
177
+ } else {
178
+ $this -> render('slides' . DS . 'save', false, true, 'admin');
179
+ }
180
+ } else {
181
+ $this -> Db -> model = $this -> Slide -> model;
182
+ $this -> Slide -> find(array('id' => $_GET['id']));
183
+ $this -> render('slides' . DS . 'save', false, true, 'admin');
184
+ }
185
+ break;
186
+ case 'mass' :
187
+ if (!empty($_POST['action'])) {
188
+ if (!empty($_POST['Slide']['checklist'])) {
189
+ switch ($_POST['action']) {
190
+ case 'delete' :
191
+ foreach ($_POST['Slide']['checklist'] as $slide_id) {
192
+ $this -> Slide -> delete($slide_id);
193
+ }
194
+
195
+ $message = __('Selected slides have been removed', $this -> plugin_name);
196
+ $this -> redirect($this -> url, 'message', $message);
197
+ break;
198
+ }
199
+ } else {
200
+ $message = __('No slides were selected', $this -> plugin_name);
201
+ $this -> redirect($this -> url, "error", $message);
202
+ }
203
+ } else {
204
+ $message = __('No action was specified', $this -> plugin_name);
205
+ $this -> redirect($this -> url, "error", $message);
206
+ }
207
+ break;
208
+ case 'order' :
209
+ $slides = $this -> Slide -> find_all(null, null, array('order', "ASC"));
210
+ $this -> render('slides' . DS . 'order', array('slides' => $slides), true, 'admin');
211
+ break;
212
+ default :
213
+ $data = $this -> paginate('Slide');
214
+ $this -> render('slides' . DS . 'index', array('slides' => $data[$this -> Slide -> model], 'paginate' => $data['Paginate']), true, 'admin');
215
+ break;
216
+ }
217
+ }
218
+
219
+ function admin_settings() {
220
+ switch ($_GET['method']) {
221
+ case 'reset' :
222
+ global $wpdb;
223
+ $query = "DELETE FROM `" . $wpdb -> prefix . "options` WHERE `option_name` LIKE '" . $this -> pre . "%';";
224
+
225
+ if ($wpdb -> query($query)) {
226
+ $message = __('All configuration settings have been reset to their defaults', $this -> plugin_name);
227
+ $msg_type = 'message';
228
+ $this -> render_msg($message);
229
+ } else {
230
+ $message = __('Configuration settings could not be reset', $this -> plugin_name);
231
+ $msg_type = 'error';
232
+ $this -> render_err($message);
233
+ }
234
+
235
+ $this -> redirect($this -> url, $msg_type, $message);
236
+ break;
237
+ default :
238
+ if (!empty($_POST)) {
239
+ foreach ($_POST as $pkey => $pval) {
240
+ $this -> update_option($pkey, $pval);
241
+ }
242
+
243
+ $message = __('Configuration has been saved', $this -> plugin_name);
244
+ $this -> render_msg($message);
245
+ }
246
+ break;
247
+ }
248
+
249
+ $this -> render('settings', false, true, 'admin');
250
+ }
251
+ }
252
+
253
+ //initialize a Gallery object
254
+ $Gallery = new Gallery();
255
+
256
  ?>
views/admin/slides/index.php CHANGED
@@ -1,70 +1,85 @@
1
- <div class="wrap">
2
- <h2><?php _e('Manage Slides', $this -> plugin_name); ?> <?php echo $this -> Html -> link(__('Add New'), $this -> url . '&amp;method=save', array('class' => "button add-new-h2")); ?></h2>
3
-
4
- <?php if (!empty($slides)) : ?>
5
- <form id="posts-filter" action="<?php echo $this -> url; ?>" method="post">
6
- <ul class="subsubsub">
7
- <li><?php echo $paginate -> allcount; ?> <?php _e('slides', $this -> plugin_name); ?></li>
8
- </ul>
9
- </form>
10
- <?php endif; ?>
11
-
12
- <?php if (!empty($slides)) : ?>
13
- <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="<?php echo $this -> url; ?>&amp;method=mass" method="post">
14
- <div class="tablenav">
15
- <div class="alignleft actions">
16
- <a href="<?php echo $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>
17
-
18
- <select name="action" class="action">
19
- <option value="">- <?php _e('Bulk Actions', $this -> plugin_name); ?> -</option>
20
- <option value="delete"><?php _e('Delete', $this -> plugin_name); ?></option>
21
- </select>
22
- <input type="submit" class="button" value="<?php _e('Apply', $this -> plugin_name); ?>" name="execute" />
23
- </div>
24
- <?php $this -> render('paginate', array('paginate' => $paginate), true, 'admin'); ?>
25
- </div>
26
-
27
- <table class="widefat">
28
- <thead>
29
- <tr>
30
- <th class="check-column"><input type="checkbox" name="checkboxall" id="checkboxall" value="checkboxall" /></th>
31
- <th><?php _e('Image', $this -> plugin_name); ?></th>
32
- <th><?php _e('Title', $this -> plugin_name); ?></th>
33
- <th><?php _e('Date', $this -> plugin_name); ?></th>
34
- <th><?php _e('Order', $this -> plugin_name); ?></th>
35
- </tr>
36
- </thead>
37
- <tfoot>
38
- <tr>
39
- <th class="check-column"><input type="checkbox" name="checkboxall" id="checkboxall" value="checkboxall" /></th>
40
- <th><?php _e('Image', $this -> plugin_name); ?></th>
41
- <th><?php _e('Title', $this -> plugin_name); ?></th>
42
- <th><?php _e('Date', $this -> plugin_name); ?></th>
43
- <th><?php _e('Order', $this -> plugin_name); ?></th>
44
- </tr>
45
- </tfoot>
46
- <tbody>
47
- <?php foreach ($slides as $slide) : ?>
48
- <tr class="<?php echo $class = (empty($class)) ? 'alternate' : ''; ?>">
49
- <th class="check-column"><input type="checkbox" name="Slide[checklist][]" value="<?php echo $slide -> id; ?>" id="checklist<?php echo $slide -> id; ?>" /></th>
50
- <td style="width:75px;">
51
- <?php $image = basename($slide -> image_url); ?>
52
- <a href="<?php echo $this -> Html -> image_url($image); ?>" title="<?php echo $slide -> title; ?>" class="thickbox"><img src="<?php echo $this -> Html -> image_url($this -> Html -> thumbname($image, "small")); ?>" alt="<?php echo $this -> Html -> sanitize($slide -> title); ?>" /></a>
53
- </td>
54
- <td><a class="row-title" href="<?php echo $this -> url; ?>&amp;method=save&amp;id=<?php echo $slide -> id; ?>" title=""><?php echo $slide -> title; ?></a></td>
55
- <td><abbr title="<?php echo $slide -> modified; ?>"><?php echo date("Y-m-d", strtotime($slide -> modified)); ?></abbr></td>
56
- <td><?php echo ((int) $slide -> order + 1); ?></td>
57
- </tr>
58
- <?php endforeach; ?>
59
- </tbody>
60
- </table>
61
-
62
- <div class="tablenav">
63
-
64
- <?php $this -> render('paginate', array('paginate' => $paginate), true, 'admin'); ?>
65
- </div>
66
- </form>
67
- <?php else : ?>
68
- <p style="color:red;"><?php _e('No slides found', $this -> plugin_name); ?></p>
69
- <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  </div>
1
+ <div class="wrap">
2
+ <h2><?php _e('Manage Slides', $this -> plugin_name); ?> <?php echo $this -> Html -> link(__('Add New'), $this -> url . '&amp;method=save', array('class' => "button add-new-h2")); ?></h2>
3
+
4
+ <?php if (!empty($slides)) : ?>
5
+ <form id="posts-filter" action="<?php echo $this -> url; ?>" method="post">
6
+ <ul class="subsubsub">
7
+ <li><?php echo $paginate -> allcount; ?> <?php _e('slides', $this -> plugin_name); ?></li>
8
+ </ul>
9
+ </form>
10
+ <?php endif; ?>
11
+
12
+ <?php if (!empty($slides)) : ?>
13
+ <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="<?php echo $this -> url; ?>&amp;method=mass" method="post">
14
+ <div class="tablenav">
15
+ <div class="alignleft actions">
16
+ <a href="<?php echo $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>
17
+
18
+ <select name="action" class="action">
19
+ <option value="">- <?php _e('Bulk Actions', $this -> plugin_name); ?> -</option>
20
+ <option value="delete"><?php _e('Delete', $this -> plugin_name); ?></option>
21
+ </select>
22
+ <input type="submit" class="button" value="<?php _e('Apply', $this -> plugin_name); ?>" name="execute" />
23
+ </div>
24
+ <?php $this -> render('paginate', array('paginate' => $paginate), true, 'admin'); ?>
25
+ </div>
26
+
27
+ <table class="widefat">
28
+ <thead>
29
+ <tr>
30
+ <th class="check-column"><input type="checkbox" name="checkboxall" id="checkboxall" value="checkboxall" /></th>
31
+ <th><?php _e('Image', $this -> plugin_name); ?></th>
32
+ <th><?php _e('Title', $this -> plugin_name); ?></th>
33
+ <th><?php _e('Link', $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('Link', $this -> plugin_name); ?></th>
44
+ <th><?php _e('Date', $this -> plugin_name); ?></th>
45
+ <th><?php _e('Order', $this -> plugin_name); ?></th>
46
+ </tr>
47
+ </tfoot>
48
+ <tbody>
49
+ <?php foreach ($slides as $slide) : ?>
50
+ <tr class="<?php echo $class = (empty($class)) ? 'alternate' : ''; ?>">
51
+ <th class="check-column"><input type="checkbox" name="Slide[checklist][]" value="<?php echo $slide -> id; ?>" id="checklist<?php echo $slide -> id; ?>" /></th>
52
+ <td style="width:75px;">
53
+ <?php $image = $slide -> image; ?>
54
+ <a href="<?php echo $this -> Html -> image_url($image); ?>" title="<?php echo $slide -> title; ?>" class="thickbox"><img src="<?php echo $this -> Html -> image_url($this -> Html -> thumbname($image, "small")); ?>" alt="<?php echo $this -> Html -> sanitize($slide -> title); ?>" /></a>
55
+ </td>
56
+ <td>
57
+ <a class="row-title" href="<?php echo $this -> url; ?>&amp;method=save&amp;id=<?php echo $slide -> id; ?>" title=""><?php echo $slide -> title; ?></a>
58
+ <div class="row-actions">
59
+ <span class="edit"><?php echo $this -> Html -> link(__('Edit', $this -> plugin_name), "?page=" . $this -> sections -> gallery . "&amp;method=save&amp;id=" . $slide -> id); ?> |</span>
60
+ <span class="delete"><?php echo $this -> Html -> link(__('Delete', $this -> plugin_name), "?page=" . $this -> sections -> gallery . "&amp;method=delete&amp;id=" . $slide -> id, array('class' => "submitdelete", 'onclick' => "if (!confirm('" . __('Are you sure you want to permanently remove this slide?', $this -> plugin_name) . "')) { return false; }")); ?></span>
61
+ </div>
62
+ </td>
63
+ <td>
64
+ <?php if (!empty($slide -> uselink) && $slide -> uselink == "Y") : ?>
65
+ <span style="color:green;"><?php _e('Yes', $this -> plugin_name); ?></span>
66
+ <?php else : ?>
67
+ <span style="color:red;"><?php _e('No', $this -> plugin_name); ?></span>
68
+ <?php endif; ?>
69
+ </td>
70
+ <td><abbr title="<?php echo $slide -> modified; ?>"><?php echo date("Y-m-d", strtotime($slide -> modified)); ?></abbr></td>
71
+ <td><?php echo ((int) $slide -> order + 1); ?></td>
72
+ </tr>
73
+ <?php endforeach; ?>
74
+ </tbody>
75
+ </table>
76
+
77
+ <div class="tablenav">
78
+
79
+ <?php $this -> render('paginate', array('paginate' => $paginate), true, 'admin'); ?>
80
+ </div>
81
+ </form>
82
+ <?php else : ?>
83
+ <p style="color:red;"><?php _e('No slides found', $this -> plugin_name); ?></p>
84
+ <?php endif; ?>
85
  </div>
views/admin/slides/save.php CHANGED
@@ -1,56 +1,118 @@
1
- <div class="wrap">
2
- <h2><?php _e('Save a Slide', $this -> plugin_name); ?></h2>
3
-
4
- <form action="<?php echo $this -> url; ?>&amp;method=save" method="post">
5
- <input type="hidden" name="Slide[id]" value="<?php echo $this -> Slide -> data -> id; ?>" />
6
- <input type="hidden" name="Slide[order]" value="<?php echo $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="<?php echo esc_attr($this -> Slide -> data -> title); ?>" id="Slide.title" />
14
- <?php echo (!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]"><?php echo esc_attr($this -> Slide -> data -> description); ?></textarea>
21
- <?php echo (!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="<?php echo esc_attr($this -> Slide -> data -> image_url); ?>" id="Slide.image_url" />
28
- <?php echo (!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=""><?php _e('Use Link', $this -> plugin_name); ?></label></th>
33
- <td>
34
- <label><input onclick="jQuery('#Slide_uselink_div').show();" <?php echo ($this -> Slide -> data -> uselink == "Y") ? 'checked="checked"' : ''; ?> type="radio" name="Slide[uselink]" value="Y" id="Slide_uselink_Y" /> <?php _e('Yes', $this -> plugin_name); ?></label>
35
- <label><input onclick="jQuery('#Slide_uselink_div').hide();" <?php echo (empty($this -> Slide -> data -> uselink) || $this -> Slide -> data -> uselink == "N") ? 'checked="checked"' : ''; ?> type="radio" name="Slide[uselink]" value="N" id="Slide_uselink_N" /> <?php _e('No', $this -> plugin_name); ?></label>
36
- </td>
37
- </tr>
38
- </tbody>
39
- </table>
40
-
41
- <div id="Slide_uselink_div" style="display:<?php echo ($this -> Slide -> data -> uselink == "Y") ? 'block' : 'none'; ?>;">
42
- <table class="form-table">
43
- <tbody>
44
- <tr>
45
- <th><label for="Slide.link"><?php _e('Link To', $this -> plugin_name); ?></label></th>
46
- <td><input class="widefat" type="text" name="Slide[link]" value="<?php echo esc_attr($this -> Slide -> data -> link); ?>" id="Slide.link" /></td>
47
- </tr>
48
- </tbody>
49
- </table>
50
- </div>
51
-
52
- <p class="submit">
53
- <input class="button-primary" type="submit" name="submit" value="<?php _e('Save Slide', $this -> plugin_name); ?>" />
54
- </p>
55
- </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  </div>
1
+ <div class="wrap">
2
+ <h2><?php _e('Save a Slide', $this -> plugin_name); ?></h2>
3
+
4
+ <form action="<?php echo $this -> url; ?>&amp;method=save" method="post" enctype="multipart/form-data">
5
+ <input type="hidden" name="Slide[id]" value="<?php echo $this -> Slide -> data -> id; ?>" />
6
+ <input type="hidden" name="Slide[order]" value="<?php echo $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="<?php echo esc_attr($this -> Slide -> data -> title); ?>" id="Slide.title" />
14
+ <span class="howto"><?php _e('title/name of your slide as it will be displayed to your users.', $this -> plugin_name); ?></span>
15
+ <?php echo (!empty($this -> Slide -> errors['title'])) ? '<div style="color:red;">' . $this -> Slide -> errors['title'] . '</div>' : ''; ?>
16
+ </td>
17
+ </tr>
18
+ <tr>
19
+ <th><label for="Slide.description"><?php _e('Description', $this -> plugin_name); ?></label></th>
20
+ <td>
21
+ <textarea class="widefat" name="Slide[description]"><?php echo esc_attr($this -> Slide -> data -> description); ?></textarea>
22
+ <span class="howto"><?php _e('description of your slide as it will be displayed to your users below the title.', $this -> plugin_name); ?></span>
23
+ <?php echo (!empty($this -> Slide -> errors['description'])) ? '<div style="color:red;">' . $this -> Slide -> errors['description'] . '</div>' : ''; ?>
24
+ </td>
25
+ </tr>
26
+ <tr>
27
+ <th><label for="Slide.type.file"><?php _e('Image Type', $this -> plugin_name); ?></label></th>
28
+ <td>
29
+ <label><input onclick="jQuery('#typediv_file').show(); jQuery('#typediv_url').hide();" <?php echo (empty($this -> Slide -> data -> type) || $this -> Slide -> data -> type == "file") ? 'checked="checked"' : ''; ?> type="radio" name="Slide[type]" value="file" id="Slide.type.file" /> <?php _e('Upload File (recommended)', $this -> plugin_name); ?></label>
30
+ <label><input onclick="jQuery('#typediv_url').show(); jQuery('#typediv_file').hide();" <?php echo ($this -> Slide -> data -> type == "url") ? 'checked="checked"' : ''; ?> type="radio" name="Slide[type]" value="url" id="Slide.type.url" /> <?php _e('Specify URL', $this -> plugin_name); ?></label>
31
+ <?php echo (!empty($this -> Slide -> errors['type'])) ? '<div style="color:red;">' . $this -> Slide -> errors['type'] . '</div>' : ''; ?>
32
+ <span class="howto"><?php _e('do you want to upload an image or specify a local/remote image URL?', $this -> plugin_name); ?></span>
33
+ </td>
34
+ </tr>
35
+ </tbody>
36
+ </table>
37
+
38
+ <div id="typediv_file" style="display:<?php echo (empty($this -> Slide -> data -> type) || $this -> Slide -> data -> type == "file") ? 'block' : 'none'; ?>;">
39
+ <table class="form-table">
40
+ <tbody>
41
+ <tr>
42
+ <th><label for="Slide.image_file"><?php _e('Choose Image', $this -> plugin_name); ?></label></th>
43
+ <td>
44
+ <input type="file" name="image_file" value="" id="Slide.image_file" />
45
+ <span class="howto"><?php _e('choose your image file from your computer. JPG, PNG, GIF are supported.', $this -> plugin_name); ?></span>
46
+ <?php echo (!empty($this -> Slide -> errors['image_file'])) ? '<div style="color:red;">' . $this -> Slide -> errors['image_file'] . '</div>' : ''; ?>
47
+
48
+ <?php
49
+
50
+ if (!empty($this -> Slide -> data -> type) && $this -> Slide -> data -> type == "file") {
51
+ if (!empty($this -> Slide -> data -> image)) {
52
+ $name = $this -> Html -> strip_ext($this -> Slide -> data -> image, 'filename');
53
+ $ext = $this -> Html -> strip_ext($this -> Slide -> data -> image, 'ext');
54
+
55
+ ?>
56
+
57
+ <input type="hidden" name="Slide[image_oldfile]" value="<?php echo esc_attr(stripslashes($this -> Slide -> data -> image)); ?>" />
58
+ <p><small><?php _e('Current image. Leave the field above blank to keep this image.', $this -> plugin_name); ?></small></p>
59
+ <img src="<?php echo rtrim(get_bloginfo('wpurl'), '/'); ?>/wp-content/uploads/<?php echo $this -> plugin_name; ?>/<?php echo $name; ?>-thumb.<?php echo $ext; ?>" alt="" />
60
+
61
+ <?php
62
+ }
63
+ }
64
+
65
+ ?>
66
+ </td>
67
+ </tr>
68
+ </tbody>
69
+ </table>
70
+ </div>
71
+
72
+ <div id="typediv_url" style="display:<?php echo ($this -> Slide -> data -> type == "url") ? 'block' : 'none'; ?>;">
73
+ <table class="form-table">
74
+ <tbody>
75
+ <tr>
76
+ <th><label for="Slide.image_url"><?php _e('Image URL', $this -> plugin_name); ?></label></th>
77
+ <td>
78
+ <input class="widefat" type="text" name="Slide[image_url]" value="<?php echo esc_attr($this -> Slide -> data -> image_url); ?>" id="Slide.image_url" />
79
+ <span class="howto"><?php _e('Local or remote image location eg. http://domain.com/path/to/image.jpg', $this -> plugin_name); ?></span>
80
+ <?php echo (!empty($this -> Slide -> errors['image_url'])) ? '<div style="color:red;">' . $this -> Slide -> errors['image_url'] . '</div>' : ''; ?>
81
+ </td>
82
+ </tr>
83
+ </tbody>
84
+ </table>
85
+ </div>
86
+
87
+ <table class="form-table">
88
+ <tbody>
89
+ <tr>
90
+ <th><label for="Slide_userlink_N"><?php _e('Use Link', $this -> plugin_name); ?></label></th>
91
+ <td>
92
+ <label><input onclick="jQuery('#Slide_uselink_div').show();" <?php echo ($this -> Slide -> data -> uselink == "Y") ? 'checked="checked"' : ''; ?> type="radio" name="Slide[uselink]" value="Y" id="Slide_uselink_Y" /> <?php _e('Yes', $this -> plugin_name); ?></label>
93
+ <label><input onclick="jQuery('#Slide_uselink_div').hide();" <?php echo (empty($this -> Slide -> data -> uselink) || $this -> Slide -> data -> uselink == "N") ? 'checked="checked"' : ''; ?> type="radio" name="Slide[uselink]" value="N" id="Slide_uselink_N" /> <?php _e('No', $this -> plugin_name); ?></label>
94
+ <span class="howto"><?php _e('set this to Yes to link this slide to a link/URL of your choice.', $this -> plugin_name); ?></span>
95
+ </td>
96
+ </tr>
97
+ </tbody>
98
+ </table>
99
+
100
+ <div id="Slide_uselink_div" style="display:<?php echo ($this -> Slide -> data -> uselink == "Y") ? 'block' : 'none'; ?>;">
101
+ <table class="form-table">
102
+ <tbody>
103
+ <tr>
104
+ <th><label for="Slide.link"><?php _e('Link To', $this -> plugin_name); ?></label></th>
105
+ <td>
106
+ <input class="widefat" type="text" name="Slide[link]" value="<?php echo esc_attr($this -> Slide -> data -> link); ?>" id="Slide.link" />
107
+ <span class="howto"><?php _e('link/URL to go to when a user clicks the slide eg. http://www.domain.com/mypage/', $this -> plugin_name); ?></span>
108
+ </td>
109
+ </tr>
110
+ </tbody>
111
+ </table>
112
+ </div>
113
+
114
+ <p class="submit">
115
+ <input class="button-primary" type="submit" name="submit" value="<?php _e('Save Slide', $this -> plugin_name); ?>" />
116
+ </p>
117
+ </form>
118
  </div>
views/default/gallery.php CHANGED
@@ -1,106 +1,125 @@
1
- <?php if (!empty($slides)) : ?>
2
- <ul id="slideshow" style="display:none;">
3
- <?php if ($frompost) : ?>
4
- <?php foreach ($slides as $slide) : ?>
5
- <li>
6
- <h3><?php echo $slide -> post_title; ?></h3>
7
- <?php $full_image_href = wp_get_attachment_image_src($slide -> ID, 'full', false); ?>
8
- <span><?php echo $full_image_href[0]; ?></span>
9
- <p><?php echo $slide -> post_content; ?></p>
10
- <?php $thumbnail_link = wp_get_attachment_image_src($slide -> ID, 'thumbnail', false); ?>
11
- <?php if ($this -> get_option('thumbnails') == "Y") : ?>
12
- <?php if (!empty($slide -> guid)) : ?>
13
- <a href="<?php echo $slide -> guid; ?>" title="<?php echo $slide -> post_title; ?>"><img style="height:75px;" src="<?php echo $thumbnail_link[0]; ?>" alt="<?php echo $this -> Html -> sanitize($slide -> post_title); ?>" /></a>
14
- <?php else : ?>
15
- <img style="height:75px;" src="<?php echo $thumbnail_link[0]; ?>" alt="<?php echo $this -> Html -> sanitize($slide -> post_title); ?>" />
16
- <?php endif; ?>
17
- <?php else : ?>
18
- <a href="<?php echo $slide -> guid; ?>" title="<?php echo $slide -> post_title; ?>"></a>
19
- <?php endif; ?>
20
- </li>
21
- <?php endforeach; ?>
22
- <?php else : ?>
23
- <?php foreach ($slides as $slide) : ?>
24
- <li>
25
- <h3><?php echo $slide -> title; ?></h3>
26
- <span><?php echo get_bloginfo('wpurl'); ?>/wp-content/uploads/<?php echo $this -> plugin_name; ?>/<?php echo basename($slide -> image_url); ?></span>
27
- <p><?php echo $slide -> description; ?></p>
28
- <?php if ($this -> get_option('thumbnails') == "Y") : ?>
29
- <?php if ($slide -> uselink == "Y" && !empty($slide -> link)) : ?>
30
- <a href="<?php echo $slide -> link; ?>" title="<?php echo $slide -> title; ?>"><img style="height:75px;" src="<?php echo $this -> Html -> image_url($this -> Html -> thumbname(basename($slide -> image_url))); ?>" alt="<?php echo $this -> Html -> sanitize($slide -> title); ?>" /></a>
31
- <?php else : ?>
32
- <img style="height:75px;" src="<?php echo $this -> Html -> image_url($this -> Html -> thumbname(basename($slide -> image_url))); ?>" alt="<?php echo $this -> Html -> sanitize($slide -> title); ?>" />
33
- <?php endif; ?>
34
- <?php else : ?>
35
- <a href="<?php echo $slide -> link; ?>" title="<?php echo $slide -> title; ?>"></a>
36
- <?php endif; ?>
37
- </li>
38
- <?php endforeach; ?>
39
- <?php endif; ?>
40
- </ul>
41
-
42
- <div id="slideshow-wrapper">
43
- <?php if ($this -> get_option('thumbnails') == "Y" && $this -> get_option('thumbposition') == "top") : ?>
44
- <div id="thumbnails" class="thumbstop">
45
- <div id="slideleft" title="<?php _e('Slide Left', $this -> plugin_name); ?>"></div>
46
- <div id="slidearea">
47
- <div id="slider"></div>
48
- </div>
49
- <div id="slideright" title="<?php _e('Slide Right', $this -> plugin_name); ?>"></div>
50
- <br style="clear:both; visibility:hidden; height:1px;" />
51
- </div>
52
- <?php endif; ?>
53
-
54
- <div id="fullsize">
55
- <div id="imgprev" class="imgnav" title="Previous Image"></div>
56
- <div id="imglink"></div>
57
- <div id="imgnext" class="imgnav" title="Next Image"></div>
58
- <div id="image"></div>
59
- <?php if ($this -> get_option('information') == "Y") : ?>
60
- <div id="information">
61
- <h3></h3>
62
- <p></p>
63
- </div>
64
- <?php endif; ?>
65
- </div>
66
-
67
- <?php if ($this -> get_option('thumbnails') == "Y" && $this -> get_option('thumbposition') == "bottom") : ?>
68
- <div id="thumbnails" class="thumbsbot">
69
- <div id="slideleft" title="<?php _e('Slide Left', $this -> plugin_name); ?>"></div>
70
- <div id="slidearea">
71
- <div id="slider"></div>
72
- </div>
73
- <div id="slideright" title="<?php _e('Slide Right', $this -> plugin_name); ?>"></div>
74
- <br style="clear:both; visibility:hidden; height:1px;" />
75
- </div>
76
- <?php endif; ?>
77
- </div>
78
-
79
- <script type="text/javascript">
80
- jQuery.noConflict();
81
- tid('slideshow').style.display = "none";
82
- tid('slideshow-wrapper').style.display = 'block';
83
-
84
- var slideshow = new TINY.slideshow("slideshow");
85
-
86
- jQuery(document).ready(function() {
87
- <?php if ($this -> get_option('autoslide')) : ?>slideshow.auto = true;<?php else : ?>slideshow.auto = false;<?php endif; ?>
88
- slideshow.speed = <?php echo $this -> get_option('autospeed'); ?>;
89
- slideshow.imgSpeed = <?php echo $this -> get_option('fadespeed'); ?>;
90
- slideshow.navOpacity = <?php echo $this -> get_option('navopacity'); ?>;
91
- slideshow.navHover = <?php echo $this -> get_option('navhover'); ?>;
92
- slideshow.letterbox = "#000000";
93
- slideshow.link = "linkhover";
94
- slideshow.info = "<?php echo ($this -> get_option('information') == "Y") ? 'information' : ''; ?>";
95
- slideshow.infoSpeed = <?php echo $this -> get_option('infospeed'); ?>;
96
- slideshow.thumbs = "<?php echo ($this -> get_option('thumbnails') == "Y") ? 'slider' : ''; ?>";
97
- slideshow.thumbOpacity = <?php echo $this -> get_option('thumbopacity'); ?>;
98
- slideshow.left = "slideleft";
99
- slideshow.right = "slideright";
100
- slideshow.scrollSpeed = <?php echo $this -> get_option('thumbscrollspeed'); ?>;
101
- slideshow.spacing = <?php echo $this -> get_option('thumbspacing'); ?>;
102
- slideshow.active = "<?php echo $this -> get_option('thumbactive'); ?>";
103
- slideshow.init("slideshow","image","imgprev","imgnext","imglink");
104
- });
105
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  <?php endif; ?>
1
+ <?php if (!empty($slides)) : ?>
2
+ <ul id="slideshow" style="display:none;">
3
+ <?php if ($frompost) : ?>
4
+ <?php foreach ($slides as $slide) : ?>
5
+ <li>
6
+ <h3><?php echo $slide -> post_title; ?></h3>
7
+ <?php $full_image_href = wp_get_attachment_image_src($slide -> ID, 'full', false); ?>
8
+ <span><?php echo $full_image_href[0]; ?></span>
9
+ <p><?php echo $slide -> post_content; ?></p>
10
+ <?php $thumbnail_link = wp_get_attachment_image_src($slide -> ID, 'thumbnail', false); ?>
11
+ <?php if ($this -> get_option('thumbnails') == "Y") : ?>
12
+ <?php if (!empty($slide -> guid)) : ?>
13
+ <a href="<?php echo $slide -> guid; ?>" title="<?php echo $slide -> post_title; ?>"><img style="height:75px;" src="<?php echo $thumbnail_link[0]; ?>" alt="<?php echo $this -> Html -> sanitize($slide -> post_title); ?>" /></a>
14
+ <?php else : ?>
15
+ <img style="height:75px;" src="<?php echo $thumbnail_link[0]; ?>" alt="<?php echo $this -> Html -> sanitize($slide -> post_title); ?>" />
16
+ <?php endif; ?>
17
+ <?php else : ?>
18
+ <a href="<?php echo $slide -> guid; ?>" title="<?php echo $slide -> post_title; ?>"></a>
19
+ <?php endif; ?>
20
+ </li>
21
+ <?php endforeach; ?>
22
+ <?php else : ?>
23
+ <?php foreach ($slides as $slide) : ?>
24
+ <li>
25
+ <h3><?php echo $slide -> title; ?></h3>
26
+ <span><?php echo rtrim(get_bloginfo('wpurl'), '/'); ?>/wp-content/uploads/<?php echo $this -> plugin_name; ?>/<?php echo $slide -> image; ?></span>
27
+ <p><?php echo $slide -> description; ?></p>
28
+ <?php if ($this -> get_option('thumbnails') == "Y") : ?>
29
+ <?php if ($slide -> uselink == "Y" && !empty($slide -> link)) : ?>
30
+ <a href="<?php echo $slide -> link; ?>" title="<?php echo $slide -> title; ?>"><img style="height:75px;" src="<?php echo $this -> Html -> image_url($this -> Html -> thumbname($slide -> image)); ?>" alt="<?php echo $this -> Html -> sanitize($slide -> title); ?>" /></a>
31
+ <?php else : ?>
32
+ <img style="height:75px;" src="<?php echo $this -> Html -> image_url($this -> Html -> thumbname($slide -> image)); ?>" alt="<?php echo $this -> Html -> sanitize($slide -> title); ?>" />
33
+ <?php endif; ?>
34
+ <?php else : ?>
35
+ <a href="<?php echo $slide -> link; ?>" title="<?php echo $slide -> title; ?>"></a>
36
+ <?php endif; ?>
37
+ </li>
38
+ <?php endforeach; ?>
39
+ <?php endif; ?>
40
+ </ul>
41
+
42
+ <div id="slideshow-wrapper">
43
+ <?php if ($this -> get_option('thumbnails') == "Y" && $this -> get_option('thumbposition') == "top") : ?>
44
+ <div id="thumbnails" class="thumbstop">
45
+ <div id="slideleft" title="<?php _e('Slide Left', $this -> plugin_name); ?>"></div>
46
+ <div id="slidearea">
47
+ <div id="slider"></div>
48
+ </div>
49
+ <div id="slideright" title="<?php _e('Slide Right', $this -> plugin_name); ?>"></div>
50
+ <br style="clear:both; visibility:hidden; height:1px;" />
51
+ </div>
52
+ <?php endif; ?>
53
+
54
+ <div id="fullsize">
55
+ <div id="imgprev" class="imgnav" title="Previous Image"></div>
56
+ <div id="imglink"><!-- link --></div>
57
+ <div id="imgnext" class="imgnav" title="Next Image"></div>
58
+ <div id="image"></div>
59
+ <?php if ($this -> get_option('information') == "Y") : ?>
60
+ <div id="information">
61
+ <h3></h3>
62
+ <p></p>
63
+ </div>
64
+ <?php endif; ?>
65
+ </div>
66
+
67
+ <?php if ($this -> get_option('thumbnails') == "Y" && $this -> get_option('thumbposition') == "bottom") : ?>
68
+ <div id="thumbnails" class="thumbsbot">
69
+ <div id="slideleft" title="<?php _e('Slide Left', $this -> plugin_name); ?>"></div>
70
+ <div id="slidearea">
71
+ <div id="slider"></div>
72
+ </div>
73
+ <div id="slideright" title="<?php _e('Slide Right', $this -> plugin_name); ?>"></div>
74
+ <br style="clear:both; visibility:hidden; height:1px;" />
75
+ </div>
76
+ <?php endif; ?>
77
+ </div>
78
+
79
+ <script type="text/javascript">
80
+ jQuery.noConflict();
81
+ tid('slideshow').style.display = "none";
82
+ tid('slideshow-wrapper').style.display = 'block';
83
+ tid('slideshow-wrapper').style.visibility = 'hidden';
84
+
85
+
86
+ /**
87
+ * issue #2: Bugfix for WebKit. Safari and similar browsers aren't capable to handle jQuery.ready() right. The problem
88
+ * here was, that sometimes the event was fired (if js is not available in browsers cache) too early, so that not all
89
+ * pictures were displayed in the thumbnail bar. I added a timeout to give the browser time to load the pictures.
90
+ * During that time I found it nice to display a spinner icon to give the visitor a hint that "somethings going on there".
91
+ * For this to display correctly I've added some lines to the css file too.
92
+ */
93
+
94
+ // append the spinner
95
+ jQuery("#fullsize").append('<div id="spinner"><img src="<?php echo $this -> url(); ?>/images/spinner.gif"></div>');
96
+ tid('spinner').style.visibility = 'visible';
97
+
98
+ var slideshow = new TINY.slideshow("slideshow");
99
+ jQuery(document).ready(function() {
100
+ // set a timeout before launching the slideshow
101
+ window.setTimeout(function() {
102
+ <?php if ($this -> get_option('autoslide')) : ?>slideshow.auto = true;<?php else : ?>slideshow.auto = false;<?php endif; ?>
103
+ slideshow.speed = <?php echo $this -> get_option('autospeed'); ?>;
104
+ slideshow.imgSpeed = <?php echo $this -> get_option('fadespeed'); ?>;
105
+ slideshow.navOpacity = <?php echo $this -> get_option('navopacity'); ?>;
106
+ slideshow.navHover = <?php echo $this -> get_option('navhover'); ?>;
107
+ slideshow.letterbox = "#000000";
108
+ slideshow.linkclass = "linkhover";
109
+ slideshow.info = "<?php echo ($this -> get_option('information') == "Y") ? 'information' : ''; ?>";
110
+ slideshow.infoSpeed = <?php echo $this -> get_option('infospeed'); ?>;
111
+ slideshow.thumbs = "<?php echo ($this -> get_option('thumbnails') == "Y") ? 'slider' : ''; ?>";
112
+ slideshow.thumbOpacity = <?php echo $this -> get_option('thumbopacity'); ?>;
113
+ slideshow.left = "slideleft";
114
+ slideshow.right = "slideright";
115
+ slideshow.scrollSpeed = <?php echo $this -> get_option('thumbscrollspeed'); ?>;
116
+ slideshow.spacing = <?php echo $this -> get_option('thumbspacing'); ?>;
117
+ slideshow.active = "<?php echo $this -> get_option('thumbactive'); ?>";
118
+ slideshow.imagesthickbox = "<?php echo ($this -> get_option('imagesthickbox') == "Y") ? 'true' : 'false'; ?>";
119
+ jQuery("#spinner").remove();
120
+ slideshow.init("slideshow","image","imgprev","imgnext","imglink");
121
+ tid('slideshow-wrapper').style.visibility = 'visible';
122
+ }, 1000);
123
+ });
124
+ </script>
125
  <?php endif; ?>