NextGEN Gallery – WordPress Gallery Plugin - Version 1.9.12

Version Description

  • 02.15.2013 =
  • Fixed: jQuery Conflict Detection was trying to dequeue irremovable scripts
Download this release

Release Info

Developer photocrati
Plugin Icon 128x128 NextGEN Gallery – WordPress Gallery Plugin
Version 1.9.12
Comparing to
See all releases

Code changes from version 1.9.11 to 1.9.12

admin/admin.php CHANGED
@@ -99,13 +99,16 @@ class nggAdminPanel{
99
  $jquery_url = includes_url('js/jquery/jquery.js');
100
  $html = implode('', array(
101
  "<script type='text/javascript' src='{$jquery_url}'></script>\n",
102
- "<script type='text/javascript'>window.onerror = function(msg, url, line){
103
- console.log(msg);
104
- if (window.location.search.length > 0) {
105
- window.location.search += '&skipjs[{$skipjs_count}]='+url;
106
- }
107
- else {
108
- window.location.search = '?skipjs[{$skipjs_count}]='+url;
 
 
 
109
  }
110
  return true;
111
  };</script>\n",
99
  $jquery_url = includes_url('js/jquery/jquery.js');
100
  $html = implode('', array(
101
  "<script type='text/javascript' src='{$jquery_url}'></script>\n",
102
+ "<script type='text/javascript'>
103
+ window.onerror = function(msg, url, line){
104
+ if (url.match(/\.js$|\.js\?/)) {
105
+ if (window.location.search.length > 0) {
106
+ if (window.location.search.indexOf(url) == -1)
107
+ window.location.search += '&skipjs[{$skipjs_count}]='+url;
108
+ }
109
+ else {
110
+ window.location.search = '?skipjs[{$skipjs_count}]='+url;
111
+ }
112
  }
113
  return true;
114
  };</script>\n",
admin/css/menu.css CHANGED
@@ -1,3 +1,3 @@
1
- #icon-nextgen-gallery {
2
- background:url("../images/nextgen_32_grey.png") no-repeat scroll 1px 1px transparent;
3
  }
1
+ #icon-nextgen-gallery {
2
+ background:url("../images/nextgen_32_grey.png") no-repeat scroll 1px 1px transparent;
3
  }
admin/css/nggColorPicker.css CHANGED
@@ -1,14 +1,14 @@
1
- #colorSelector{
2
- background:transparent url(../images/select.png) repeat scroll 0 0;
3
- height:36px;
4
- position:relative;
5
- width:36px;
6
- }
7
- #colorSelector div{
8
- background:transparent url(../images/select.png) repeat scroll center center;
9
- height:30px;
10
- left:3px;
11
- position:absolute;
12
- top:3px;
13
- width:30px;
14
  }
1
+ #colorSelector{
2
+ background:transparent url(../images/select.png) repeat scroll 0 0;
3
+ height:36px;
4
+ position:relative;
5
+ width:36px;
6
+ }
7
+ #colorSelector div{
8
+ background:transparent url(../images/select.png) repeat scroll center center;
9
+ height:30px;
10
+ left:3px;
11
+ position:absolute;
12
+ top:3px;
13
+ width:30px;
14
  }
admin/css/nggadmin.css CHANGED
@@ -1,412 +1,412 @@
1
- /*
2
- ** NextGEN Gallery Style for Wordpress 3.3
3
- */
4
-
5
- /* SETTINGS FOR Overview Gallery */
6
-
7
- #newversion {
8
- border-color:#CCCCCC;
9
- border-style:solid;
10
- border-width:1px;
11
- margin-right:7px;
12
- margin-top:10px;
13
- padding:2px;
14
- }
15
-
16
- .ngg-dashboard-widget ul.settings span {
17
- padding-left : 10px;
18
- color:#2583AD;
19
- font-weight:bold;
20
- }
21
-
22
- .ngg-overview .postbox .handlediv {
23
- float:right;
24
- height:24px;
25
- width:24px;
26
- }
27
-
28
- .warning {
29
- color: #9F6000;
30
- background-color: #FEEFB3;
31
- border: 1px solid;
32
- margin: 5px 0px;
33
- padding:5px;
34
- }
35
-
36
- #donator_message {
37
- margin:5px 0 15px;
38
- background-color:#BDE5F8;
39
- border-color:#00529B;
40
- -moz-border-radius-bottomleft:3px;
41
- -moz-border-radius-bottomright:3px;
42
- -moz-border-radius-topleft:3px;
43
- -moz-border-radius-topright:3px;
44
- border-style:solid;
45
- border-width:1px;
46
- margin:5px 15px 2px;
47
- padding:0 0.6em;
48
- }
49
-
50
- #donator_message p{
51
- line-height:1;
52
- margin:0.5em 0;
53
- padding:2px;
54
- padding-bottom:10px;
55
- }
56
-
57
- #donator_message span{
58
- padding-top:10px;
59
- float:right;
60
- }
61
-
62
- #plugin_check img {
63
- float: right;
64
- }
65
-
66
- #plugin_check p.message {
67
- font-size: 90%;
68
- color: #666;
69
- }
70
- /* SETTING FOR FLASH UPLOAD BUTTON */
71
- .swfupload {
72
- position:absolute;
73
- z-index:1;
74
- vertical-align:top;
75
- }
76
-
77
- /* SETTINGS FOR THE OPTIONS TABLE */
78
- .ngg-options th {
79
- width:22%;
80
- }
81
-
82
- a.switch-expert {
83
- text-decoration:none;
84
- }
85
-
86
- /* WATERMARK */
87
- #wm-preview {
88
- float:right;
89
- font-size:90%;
90
- width:35%;
91
- border-color:#EBEBEB rgb(204, 204, 204) rgb(204, 204, 204) rgb(235, 235, 235);
92
- border-style:solid;
93
- border-width:1px;
94
- margin-bottom:10px;
95
- margin-left:10px;
96
- margin-right:8px;
97
- padding:2px;
98
- }
99
- #wm-preview h3{
100
- background:#F9F9F9 none repeat scroll 0%;
101
- font-size:14px;
102
- font-weight:bold;
103
- margin:0pt 0pt 10px;
104
- padding:8px 5px;
105
- }
106
-
107
- #wm-position {
108
- width:100%;
109
- margin-left:40px;
110
- }
111
-
112
- .wm-table {
113
- border-collapse:collapse;
114
- margin-top:1em;
115
- width: 60%;
116
- clear:none;
117
- }
118
- .wm-table td {
119
- border-bottom:8px solid #FFFFFF;
120
- line-height:20px;
121
- margin-bottom:9px;
122
- padding:10px;
123
- }
124
- .wm-table th {
125
- border-bottom:8px solid #FFFFFF;
126
- padding:10px;
127
- text-align:left;
128
- }
129
- .wm-table tr {
130
- background:#F9F9F9 none repeat scroll 0%;
131
- }
132
-
133
- /* SETTINGS FOR MANAGE TABLE */
134
-
135
- div#poststuff #gallerydiv {
136
- cursor:pointer;
137
- }
138
-
139
- p#ngg-inlinebutton {
140
- float:right;
141
- margin:0pt;
142
- position:relative;
143
- top:-25pt;
144
- }
145
-
146
- .fixed tbody th.column-cb {
147
- padding:7px 0 22px;
148
- }
149
-
150
- .fixed .column-thumbnail{
151
- width:85px;
152
- }
153
-
154
- .fixed .column-thumbnail img{
155
- max-height:80px;
156
- max-width:80px;
157
- }
158
-
159
- .fixed .column-id {
160
- width: 5em;
161
- }
162
-
163
- .fixed .column-title {
164
- width: 25%;
165
- }
166
-
167
- .fixed .column-description {
168
- width: 40%;
169
- }
170
-
171
- .fixed .column-exclude, .fixed .column-action, .fixed .column-delete {
172
- width: 10%;
173
- }
174
-
175
- /* SETTINGS FOR PROGRESS BAR */
176
-
177
- div .progressborder {
178
- border:1px solid #DDDDDD;
179
- display: block;
180
- height: 30px;
181
- background-color: #464646;
182
- width: 100%;
183
- margin-top: 15px;
184
- margin-bottom: 15px;
185
- -moz-border-radius: 5px;
186
- -webkit-border-radius: 5px;
187
- border-radius: 5px;
188
- }
189
-
190
- div .progressbar {
191
- border: medium none ;
192
- display: block;
193
- height: 30px;
194
- background-color: #D54E21;
195
- width: 0%;
196
- -moz-border-radius: 5px;
197
- -webkit-border-radius: 5px;
198
- border-radius: 5px;
199
- }
200
-
201
- div .progressbar span {
202
- display: inline;
203
- position: absolute;
204
- color: white;
205
- font-weight: bold;
206
- padding: 5px 0 0 5px;
207
- }
208
-
209
- .show_details
210
- {
211
- height: 16px;
212
- line-height: 20px;
213
- overflow: hidden;
214
- min-width: 8em;
215
- padding: 3px;
216
- cursor:pointer;
217
- }
218
-
219
- .show_details span
220
- {
221
- border-bottom:1px solid #999;
222
- white-space:pre;
223
- }
224
- .show_details:hover
225
- {
226
- height: auto;
227
- overflow: visible;
228
- border: 1px solid #999;
229
- }
230
-
231
- /* SETTINGS FOR ALBUM PAGE */
232
-
233
- .albumnav select[name="act_album"] {
234
- width:150px;
235
- }
236
-
237
- .albumnav span {
238
- padding-left: 50px;
239
- }
240
-
241
- div .groupItem
242
- {
243
- cursor: move;
244
- width: 295px;
245
- padding: 5px;
246
- line-height: 1.5;
247
- }
248
-
249
- div .innerhandle {
250
- background-color:#FBFBFB;
251
- }
252
-
253
- .groupItem .item_top
254
- {
255
- background-color:#2683AE;
256
- color: #FFFFFF;
257
- font-weight:bold;
258
- line-height: 28px;
259
- height: 28px;
260
- padding: 0 5px;
261
- -moz-border-radius: 3px;
262
- -khtml-border-radius: 3px;
263
- -webkit-border-radius: 3px;
264
- border-radius: 3px;
265
- }
266
-
267
- .groupItem .album_obj
268
- {
269
- background-color:#D54E21;
270
- }
271
-
272
- .groupItem .item_top a
273
- {
274
- color:#FFFFFF;
275
- float:right;
276
- text-decoration: none;
277
- }
278
-
279
- .groupItem .item_top a:hover
280
- {
281
- color:#FFFFFF;
282
- }
283
-
284
- .itemContent {
285
- border-color:#DFDFDF;
286
- border-style:none solid solid;
287
- border-width:0 1px 1px;
288
- padding:2px 0 20px 2px;
289
- }
290
-
291
- .itemContent p {
292
- border: 0;
293
- margin: 0;
294
- padding: 0;
295
- }
296
-
297
- .inlinepicture
298
- {
299
- float:left;
300
- display:inline;
301
- margin:0pt;
302
- padding:0pt 3px 1px;
303
- }
304
-
305
- .inlinepicture img
306
- {
307
- margin:3px;
308
- max-height:60px;
309
- }
310
-
311
- .sort_placeholder
312
- {
313
- border:1px dashed #bba !important;
314
- margin: 5px;
315
- background: #F9F9F9;
316
- }
317
-
318
- .container {
319
- margin-top: 10px;
320
- }
321
-
322
- .target-album {
323
- margin:10px 685px 10px 10px;
324
- }
325
-
326
- .widget-right {
327
- float:right;
328
- margin:0pt 10px;
329
- width:315px;
330
- }
331
-
332
- .widget-holder {
333
- min-height: 400px;
334
- padding-top:1px;
335
- }
336
-
337
- .target {
338
- background-color:#F1F1F1;
339
- }
340
-
341
- div.widget-top h3 {
342
- text-align:center;
343
- line-height:25px;
344
- margin: 0;
345
- padding: 5px 12px;
346
- font-size: 13px;
347
- }
348
-
349
- div.widget-top {
350
- text-shadow:0 1px 0 #FFFFFF;
351
- background-repeat: repeat-x;
352
- background-position: 0 0;
353
- font-size: 13px;
354
- }
355
-
356
- .ui-autocomplete-start { background-position: 99% center; }
357
-
358
- /* SETTINGS FOR SORT GALLERY */
359
-
360
- #sortGallery {
361
- position:relative;
362
- }
363
-
364
- p#sortButton{
365
- margin:0;
366
- position:absolute;
367
- right:0;
368
- top:0;
369
- }
370
-
371
- .imageBox,.imageBoxHighlighted{
372
- width:130px; /* Total width of each image box */
373
- height:160px; /* Total height of each image box */
374
- float:left;
375
- overflow: hidden;
376
- text-overflow: ellipsis;
377
- padding: 5px;
378
- }
379
- .imageBox_theImage{
380
- width:110px; /* Width of image */
381
- height:125px; /* Height of image */
382
-
383
- background-position: center;
384
- background-repeat: no-repeat;
385
- margin: 0 auto;
386
- margin-bottom:2px;
387
- }
388
-
389
- .imageBox_label{ /* Title of images - both selected and not selected */
390
- text-align:center;
391
- font-family: arial;
392
- font-size:11px;
393
- padding-top:2px;
394
- margin: 0 auto;
395
- }
396
-
397
- /* UPGRADE PAGE */
398
-
399
- .error_inline {
400
- background:#FFEBE8 none repeat scroll 0%;
401
- border:1px solid #CC0000;
402
- margin:5px auto;
403
- padding:10px;
404
- }
405
-
406
- /* ABOUT PAGE */
407
- .ngg-list {
408
- font-size:11px;
409
- margin-left:15px;
410
- list-style-position:inside;
411
- list-style-type:disc;
412
- }
1
+ /*
2
+ ** NextGEN Gallery Style for Wordpress 3.3
3
+ */
4
+
5
+ /* SETTINGS FOR Overview Gallery */
6
+
7
+ #newversion {
8
+ border-color:#CCCCCC;
9
+ border-style:solid;
10
+ border-width:1px;
11
+ margin-right:7px;
12
+ margin-top:10px;
13
+ padding:2px;
14
+ }
15
+
16
+ .ngg-dashboard-widget ul.settings span {
17
+ padding-left : 10px;
18
+ color:#2583AD;
19
+ font-weight:bold;
20
+ }
21
+
22
+ .ngg-overview .postbox .handlediv {
23
+ float:right;
24
+ height:24px;
25
+ width:24px;
26
+ }
27
+
28
+ .warning {
29
+ color: #9F6000;
30
+ background-color: #FEEFB3;
31
+ border: 1px solid;
32
+ margin: 5px 0px;
33
+ padding:5px;
34
+ }
35
+
36
+ #donator_message {
37
+ margin:5px 0 15px;
38
+ background-color:#BDE5F8;
39
+ border-color:#00529B;
40
+ -moz-border-radius-bottomleft:3px;
41
+ -moz-border-radius-bottomright:3px;
42
+ -moz-border-radius-topleft:3px;
43
+ -moz-border-radius-topright:3px;
44
+ border-style:solid;
45
+ border-width:1px;
46
+ margin:5px 15px 2px;
47
+ padding:0 0.6em;
48
+ }
49
+
50
+ #donator_message p{
51
+ line-height:1;
52
+ margin:0.5em 0;
53
+ padding:2px;
54
+ padding-bottom:10px;
55
+ }
56
+
57
+ #donator_message span{
58
+ padding-top:10px;
59
+ float:right;
60
+ }
61
+
62
+ #plugin_check img {
63
+ float: right;
64
+ }
65
+
66
+ #plugin_check p.message {
67
+ font-size: 90%;
68
+ color: #666;
69
+ }
70
+ /* SETTING FOR FLASH UPLOAD BUTTON */
71
+ .swfupload {
72
+ position:absolute;
73
+ z-index:1;
74
+ vertical-align:top;
75
+ }
76
+
77
+ /* SETTINGS FOR THE OPTIONS TABLE */
78
+ .ngg-options th {
79
+ width:22%;
80
+ }
81
+
82
+ a.switch-expert {
83
+ text-decoration:none;
84
+ }
85
+
86
+ /* WATERMARK */
87
+ #wm-preview {
88
+ float:right;
89
+ font-size:90%;
90
+ width:35%;
91
+ border-color:#EBEBEB rgb(204, 204, 204) rgb(204, 204, 204) rgb(235, 235, 235);
92
+ border-style:solid;
93
+ border-width:1px;
94
+ margin-bottom:10px;
95
+ margin-left:10px;
96
+ margin-right:8px;
97
+ padding:2px;
98
+ }
99
+ #wm-preview h3{
100
+ background:#F9F9F9 none repeat scroll 0%;
101
+ font-size:14px;
102
+ font-weight:bold;
103
+ margin:0pt 0pt 10px;
104
+ padding:8px 5px;
105
+ }
106
+
107
+ #wm-position {
108
+ width:100%;
109
+ margin-left:40px;
110
+ }
111
+
112
+ .wm-table {
113
+ border-collapse:collapse;
114
+ margin-top:1em;
115
+ width: 60%;
116
+ clear:none;
117
+ }
118
+ .wm-table td {
119
+ border-bottom:8px solid #FFFFFF;
120
+ line-height:20px;
121
+ margin-bottom:9px;
122
+ padding:10px;
123
+ }
124
+ .wm-table th {
125
+ border-bottom:8px solid #FFFFFF;
126
+ padding:10px;
127
+ text-align:left;
128
+ }
129
+ .wm-table tr {
130
+ background:#F9F9F9 none repeat scroll 0%;
131
+ }
132
+
133
+ /* SETTINGS FOR MANAGE TABLE */
134
+
135
+ div#poststuff #gallerydiv {
136
+ cursor:pointer;
137
+ }
138
+
139
+ p#ngg-inlinebutton {
140
+ float:right;
141
+ margin:0pt;
142
+ position:relative;
143
+ top:-25pt;
144
+ }
145
+
146
+ .fixed tbody th.column-cb {
147
+ padding:7px 0 22px;
148
+ }
149
+
150
+ .fixed .column-thumbnail{
151
+ width:85px;
152
+ }
153
+
154
+ .fixed .column-thumbnail img{
155
+ max-height:80px;
156
+ max-width:80px;
157
+ }
158
+
159
+ .fixed .column-id {
160
+ width: 5em;
161
+ }
162
+
163
+ .fixed .column-title {
164
+ width: 25%;
165
+ }
166
+
167
+ .fixed .column-description {
168
+ width: 40%;
169
+ }
170
+
171
+ .fixed .column-exclude, .fixed .column-action, .fixed .column-delete {
172
+ width: 10%;
173
+ }
174
+
175
+ /* SETTINGS FOR PROGRESS BAR */
176
+
177
+ div .progressborder {
178
+ border:1px solid #DDDDDD;
179
+ display: block;
180
+ height: 30px;
181
+ background-color: #464646;
182
+ width: 100%;
183
+ margin-top: 15px;
184
+ margin-bottom: 15px;
185
+ -moz-border-radius: 5px;
186
+ -webkit-border-radius: 5px;
187
+ border-radius: 5px;
188
+ }
189
+
190
+ div .progressbar {
191
+ border: medium none ;
192
+ display: block;
193
+ height: 30px;
194
+ background-color: #D54E21;
195
+ width: 0%;
196
+ -moz-border-radius: 5px;
197
+ -webkit-border-radius: 5px;
198
+ border-radius: 5px;
199
+ }
200
+
201
+ div .progressbar span {
202
+ display: inline;
203
+ position: absolute;
204
+ color: white;
205
+ font-weight: bold;
206
+ padding: 5px 0 0 5px;
207
+ }
208
+
209
+ .show_details
210
+ {
211
+ height: 16px;
212
+ line-height: 20px;
213
+ overflow: hidden;
214
+ min-width: 8em;
215
+ padding: 3px;
216
+ cursor:pointer;
217
+ }
218
+
219
+ .show_details span
220
+ {
221
+ border-bottom:1px solid #999;
222
+ white-space:pre;
223
+ }
224
+ .show_details:hover
225
+ {
226
+ height: auto;
227
+ overflow: visible;
228
+ border: 1px solid #999;
229
+ }
230
+
231
+ /* SETTINGS FOR ALBUM PAGE */
232
+
233
+ .albumnav select[name="act_album"] {
234
+ width:150px;
235
+ }
236
+
237
+ .albumnav span {
238
+ padding-left: 50px;
239
+ }
240
+
241
+ div .groupItem
242
+ {
243
+ cursor: move;
244
+ width: 295px;
245
+ padding: 5px;
246
+ line-height: 1.5;
247
+ }
248
+
249
+ div .innerhandle {
250
+ background-color:#FBFBFB;
251
+ }
252
+
253
+ .groupItem .item_top
254
+ {
255
+ background-color:#2683AE;
256
+ color: #FFFFFF;
257
+ font-weight:bold;
258
+ line-height: 28px;
259
+ height: 28px;
260
+ padding: 0 5px;
261
+ -moz-border-radius: 3px;
262
+ -khtml-border-radius: 3px;
263
+ -webkit-border-radius: 3px;
264
+ border-radius: 3px;
265
+ }
266
+
267
+ .groupItem .album_obj
268
+ {
269
+ background-color:#D54E21;
270
+ }
271
+
272
+ .groupItem .item_top a
273
+ {
274
+ color:#FFFFFF;
275
+ float:right;
276
+ text-decoration: none;
277
+ }
278
+
279
+ .groupItem .item_top a:hover
280
+ {
281
+ color:#FFFFFF;
282
+ }
283
+
284
+ .itemContent {
285
+ border-color:#DFDFDF;
286
+ border-style:none solid solid;
287
+ border-width:0 1px 1px;
288
+ padding:2px 0 20px 2px;
289
+ }
290
+
291
+ .itemContent p {
292
+ border: 0;
293
+ margin: 0;
294
+ padding: 0;
295
+ }
296
+
297
+ .inlinepicture
298
+ {
299
+ float:left;
300
+ display:inline;
301
+ margin:0pt;
302
+ padding:0pt 3px 1px;
303
+ }
304
+
305
+ .inlinepicture img
306
+ {
307
+ margin:3px;
308
+ max-height:60px;
309
+ }
310
+
311
+ .sort_placeholder
312
+ {
313
+ border:1px dashed #bba !important;
314
+ margin: 5px;
315
+ background: #F9F9F9;
316
+ }
317
+
318
+ .container {
319
+ margin-top: 10px;
320
+ }
321
+
322
+ .target-album {
323
+ margin:10px 685px 10px 10px;
324
+ }
325
+
326
+ .widget-right {
327
+ float:right;
328
+ margin:0pt 10px;
329
+ width:315px;
330
+ }
331
+
332
+ .widget-holder {
333
+ min-height: 400px;
334
+ padding-top:1px;
335
+ }
336
+
337
+ .target {
338
+ background-color:#F1F1F1;
339
+ }
340
+
341
+ div.widget-top h3 {
342
+ text-align:center;
343
+ line-height:25px;
344
+ margin: 0;
345
+ padding: 5px 12px;
346
+ font-size: 13px;
347
+ }
348
+
349
+ div.widget-top {
350
+ text-shadow:0 1px 0 #FFFFFF;
351
+ background-repeat: repeat-x;
352
+ background-position: 0 0;
353
+ font-size: 13px;
354
+ }
355
+
356
+ .ui-autocomplete-start { background-position: 99% center; }
357
+
358
+ /* SETTINGS FOR SORT GALLERY */
359
+
360
+ #sortGallery {
361
+ position:relative;
362
+ }
363
+
364
+ p#sortButton{
365
+ margin:0;
366
+ position:absolute;
367
+ right:0;
368
+ top:0;
369
+ }
370
+
371
+ .imageBox,.imageBoxHighlighted{
372
+ width:130px; /* Total width of each image box */
373
+ height:160px; /* Total height of each image box */
374
+ float:left;
375
+ overflow: hidden;
376
+ text-overflow: ellipsis;
377
+ padding: 5px;
378
+ }
379
+ .imageBox_theImage{
380
+ width:110px; /* Width of image */
381
+ height:125px; /* Height of image */
382
+
383
+ background-position: center;
384
+ background-repeat: no-repeat;
385
+ margin: 0 auto;
386
+ margin-bottom:2px;
387
+ }
388
+
389
+ .imageBox_label{ /* Title of images - both selected and not selected */
390
+ text-align:center;
391
+ font-family: arial;
392
+ font-size:11px;
393
+ padding-top:2px;
394
+ margin: 0 auto;
395
+ }
396
+
397
+ /* UPGRADE PAGE */
398
+
399
+ .error_inline {
400
+ background:#FFEBE8 none repeat scroll 0%;
401
+ border:1px solid #CC0000;
402
+ margin:5px auto;
403
+ padding:10px;
404
+ }
405
+
406
+ /* ABOUT PAGE */
407
+ .ngg-list {
408
+ font-size:11px;
409
+ margin-left:15px;
410
+ list-style-position:inside;
411
+ list-style-type:disc;
412
+ }
admin/css/tags-admin.css CHANGED
@@ -1,10 +1,10 @@
1
- .ngg_wrap .auto_list{width:98%;margin:3px 0;padding:3px 5px;}
2
- .ngg_wrap .list_tags {width:240px;vertical-align:top;}
3
- .ngg_wrap .forms_manage {vertical-align:top;}
4
- .ngg_wrap .forms_manage h3 {margin-bottom:5px;}
5
- .ngg_wrap .forms_manage .form-table {margin-top:0;}
6
- .ngg_wrap .sort_order h3 {margin:0;}
7
- .ngg_wrap #ajax_area_tagslist {}
8
- .ngg_wrap #ajax_area_tagslist ul{list-style:square;margin:10px 0 10px 20px;padding:0;}
9
- .ngg_wrap #ajax_area_tagslist ul li{margin:0;padding:0;line-height:1.4;}
10
  .ngg_wrap #ajax_area_tagslist ul li span{cursor:pointer;}
1
+ .ngg_wrap .auto_list{width:98%;margin:3px 0;padding:3px 5px;}
2
+ .ngg_wrap .list_tags {width:240px;vertical-align:top;}
3
+ .ngg_wrap .forms_manage {vertical-align:top;}
4
+ .ngg_wrap .forms_manage h3 {margin-bottom:5px;}
5
+ .ngg_wrap .forms_manage .form-table {margin-top:0;}
6
+ .ngg_wrap .sort_order h3 {margin:0;}
7
+ .ngg_wrap #ajax_area_tagslist {}
8
+ .ngg_wrap #ajax_area_tagslist ul{list-style:square;margin:10px 0 10px 20px;padding:0;}
9
+ .ngg_wrap #ajax_area_tagslist ul li{margin:0;padding:0;line-height:1.4;}
10
  .ngg_wrap #ajax_area_tagslist ul li span{cursor:pointer;}
admin/js/colorpicker/css/colorpicker.css CHANGED
@@ -1,161 +1,161 @@
1
- .colorpicker {
2
- width: 356px;
3
- height: 176px;
4
- overflow: hidden;
5
- position: absolute;
6
- background: url(../images/colorpicker_background.png);
7
- font-family: Arial, Helvetica, sans-serif;
8
- display: none;
9
- }
10
- .colorpicker_color {
11
- width: 150px;
12
- height: 150px;
13
- left: 14px;
14
- top: 13px;
15
- position: absolute;
16
- background: #f00;
17
- overflow: hidden;
18
- cursor: crosshair;
19
- }
20
- .colorpicker_color div {
21
- position: absolute;
22
- top: 0;
23
- left: 0;
24
- width: 150px;
25
- height: 150px;
26
- background: url(../images/colorpicker_overlay.png);
27
- }
28
- .colorpicker_color div div {
29
- position: absolute;
30
- top: 0;
31
- left: 0;
32
- width: 11px;
33
- height: 11px;
34
- overflow: hidden;
35
- background: url(../images/colorpicker_select.gif);
36
- margin: -5px 0 0 -5px;
37
- }
38
- .colorpicker_hue {
39
- position: absolute;
40
- top: 13px;
41
- left: 171px;
42
- width: 35px;
43
- height: 150px;
44
- cursor: n-resize;
45
- }
46
- .colorpicker_hue div {
47
- position: absolute;
48
- width: 35px;
49
- height: 9px;
50
- overflow: hidden;
51
- background: url(../images/colorpicker_indic.gif) left top;
52
- margin: -4px 0 0 0;
53
- left: 0px;
54
- }
55
- .colorpicker_new_color {
56
- position: absolute;
57
- width: 60px;
58
- height: 30px;
59
- left: 213px;
60
- top: 13px;
61
- background: #f00;
62
- }
63
- .colorpicker_current_color {
64
- position: absolute;
65
- width: 60px;
66
- height: 30px;
67
- left: 283px;
68
- top: 13px;
69
- background: #f00;
70
- }
71
- .colorpicker input {
72
- background-color: transparent;
73
- border: 1px solid transparent;
74
- position: absolute;
75
- font-size: 10px;
76
- font-family: Arial, Helvetica, sans-serif;
77
- color: #898989;
78
- top: 4px;
79
- right: 11px;
80
- text-align: right;
81
- margin: 0;
82
- padding: 0;
83
- height: 13px;
84
- }
85
- .colorpicker_hex {
86
- position: absolute;
87
- width: 72px;
88
- height: 22px;
89
- background: url(../images/colorpicker_hex.png) top;
90
- left: 212px;
91
- top: 142px;
92
- }
93
- .colorpicker_hex input {
94
- right: 6px;
95
- }
96
- .colorpicker_field {
97
- height: 22px;
98
- width: 62px;
99
- background-position: top;
100
- position: absolute;
101
- }
102
- .colorpicker_field span {
103
- position: absolute;
104
- width: 12px;
105
- height: 22px;
106
- overflow: hidden;
107
- top: 0;
108
- right: 0;
109
- cursor: n-resize;
110
- }
111
- .colorpicker_rgb_r {
112
- background-image: url(../images/colorpicker_rgb_r.png);
113
- top: 52px;
114
- left: 212px;
115
- }
116
- .colorpicker_rgb_g {
117
- background-image: url(../images/colorpicker_rgb_g.png);
118
- top: 82px;
119
- left: 212px;
120
- }
121
- .colorpicker_rgb_b {
122
- background-image: url(../images/colorpicker_rgb_b.png);
123
- top: 112px;
124
- left: 212px;
125
- }
126
- .colorpicker_hsb_h {
127
- background-image: url(../images/colorpicker_hsb_h.png);
128
- top: 52px;
129
- left: 282px;
130
- }
131
- .colorpicker_hsb_s {
132
- background-image: url(../images/colorpicker_hsb_s.png);
133
- top: 82px;
134
- left: 282px;
135
- }
136
- .colorpicker_hsb_b {
137
- background-image: url(../images/colorpicker_hsb_b.png);
138
- top: 112px;
139
- left: 282px;
140
- }
141
- .colorpicker_submit {
142
- position: absolute;
143
- width: 22px;
144
- height: 22px;
145
- background: url(../images/colorpicker_submit.png) top;
146
- left: 322px;
147
- top: 142px;
148
- overflow: hidden;
149
- }
150
- .colorpicker_focus {
151
- background-position: center;
152
- }
153
- .colorpicker_hex.colorpicker_focus {
154
- background-position: bottom;
155
- }
156
- .colorpicker_submit.colorpicker_focus {
157
- background-position: bottom;
158
- }
159
- .colorpicker_slider {
160
- background-position: bottom;
161
- }
1
+ .colorpicker {
2
+ width: 356px;
3
+ height: 176px;
4
+ overflow: hidden;
5
+ position: absolute;
6
+ background: url(../images/colorpicker_background.png);
7
+ font-family: Arial, Helvetica, sans-serif;
8
+ display: none;
9
+ }
10
+ .colorpicker_color {
11
+ width: 150px;
12
+ height: 150px;
13
+ left: 14px;
14
+ top: 13px;
15
+ position: absolute;
16
+ background: #f00;
17
+ overflow: hidden;
18
+ cursor: crosshair;
19
+ }
20
+ .colorpicker_color div {
21
+ position: absolute;
22
+ top: 0;
23
+ left: 0;
24
+ width: 150px;
25
+ height: 150px;
26
+ background: url(../images/colorpicker_overlay.png);
27
+ }
28
+ .colorpicker_color div div {
29
+ position: absolute;
30
+ top: 0;
31
+ left: 0;
32
+ width: 11px;
33
+ height: 11px;
34
+ overflow: hidden;
35
+ background: url(../images/colorpicker_select.gif);
36
+ margin: -5px 0 0 -5px;
37
+ }
38
+ .colorpicker_hue {
39
+ position: absolute;
40
+ top: 13px;
41
+ left: 171px;
42
+ width: 35px;
43
+ height: 150px;
44
+ cursor: n-resize;
45
+ }
46
+ .colorpicker_hue div {
47
+ position: absolute;
48
+ width: 35px;
49
+ height: 9px;
50
+ overflow: hidden;
51
+ background: url(../images/colorpicker_indic.gif) left top;
52
+ margin: -4px 0 0 0;
53
+ left: 0px;
54
+ }
55
+ .colorpicker_new_color {
56
+ position: absolute;
57
+ width: 60px;
58
+ height: 30px;
59
+ left: 213px;
60
+ top: 13px;
61
+ background: #f00;
62
+ }
63
+ .colorpicker_current_color {
64
+ position: absolute;
65
+ width: 60px;
66
+ height: 30px;
67
+ left: 283px;
68
+ top: 13px;
69
+ background: #f00;
70
+ }
71
+ .colorpicker input {
72
+ background-color: transparent;
73
+ border: 1px solid transparent;
74
+ position: absolute;
75
+ font-size: 10px;
76
+ font-family: Arial, Helvetica, sans-serif;
77
+ color: #898989;
78
+ top: 4px;
79
+ right: 11px;
80
+ text-align: right;
81
+ margin: 0;
82
+ padding: 0;
83
+ height: 13px;
84
+ }
85
+ .colorpicker_hex {
86
+ position: absolute;
87
+ width: 72px;
88
+ height: 22px;
89
+ background: url(../images/colorpicker_hex.png) top;
90
+ left: 212px;
91
+ top: 142px;
92
+ }
93
+ .colorpicker_hex input {
94
+ right: 6px;
95
+ }
96
+ .colorpicker_field {
97
+ height: 22px;
98
+ width: 62px;
99
+ background-position: top;
100
+ position: absolute;
101
+ }
102
+ .colorpicker_field span {
103
+ position: absolute;
104
+ width: 12px;
105
+ height: 22px;
106
+ overflow: hidden;
107
+ top: 0;
108
+ right: 0;
109
+ cursor: n-resize;
110
+ }
111
+ .colorpicker_rgb_r {
112
+ background-image: url(../images/colorpicker_rgb_r.png);
113
+ top: 52px;
114
+ left: 212px;
115
+ }
116
+ .colorpicker_rgb_g {
117
+ background-image: url(../images/colorpicker_rgb_g.png);
118
+ top: 82px;
119
+ left: 212px;
120
+ }
121
+ .colorpicker_rgb_b {
122
+ background-image: url(../images/colorpicker_rgb_b.png);
123
+ top: 112px;
124
+ left: 212px;
125
+ }
126
+ .colorpicker_hsb_h {
127
+ background-image: url(../images/colorpicker_hsb_h.png);
128
+ top: 52px;
129
+ left: 282px;
130
+ }
131
+ .colorpicker_hsb_s {
132
+ background-image: url(../images/colorpicker_hsb_s.png);
133
+ top: 82px;
134
+ left: 282px;
135
+ }
136
+ .colorpicker_hsb_b {
137
+ background-image: url(../images/colorpicker_hsb_b.png);
138
+ top: 112px;
139
+ left: 282px;
140
+ }
141
+ .colorpicker_submit {
142
+ position: absolute;
143
+ width: 22px;
144
+ height: 22px;
145
+ background: url(../images/colorpicker_submit.png) top;
146
+ left: 322px;
147
+ top: 142px;
148
+ overflow: hidden;
149
+ }
150
+ .colorpicker_focus {
151
+ background-position: center;
152
+ }
153
+ .colorpicker_hex.colorpicker_focus {
154
+ background-position: bottom;
155
+ }
156
+ .colorpicker_submit.colorpicker_focus {
157
+ background-position: bottom;
158
+ }
159
+ .colorpicker_slider {
160
+ background-position: bottom;
161
+ }
admin/js/colorpicker/js/colorpicker.js CHANGED
@@ -1,484 +1,484 @@
1
- /**
2
- *
3
- * Color picker
4
- * Author: Stefan Petre www.eyecon.ro
5
- *
6
- * Dual licensed under the MIT and GPL licenses
7
- *
8
- */
9
- (function ($) {
10
- var ColorPicker = function () {
11
- var
12
- ids = {},
13
- inAction,
14
- charMin = 65,
15
- visible,
16
- tpl = '<div class="colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_submit"></div></div>',
17
- defaults = {
18
- eventName: 'click',
19
- onShow: function () {},
20
- onBeforeShow: function(){},
21
- onHide: function () {},
22
- onChange: function () {},
23
- onSubmit: function () {},
24
- color: 'ff0000',
25
- livePreview: true,
26
- flat: false
27
- },
28
- fillRGBFields = function (hsb, cal) {
29
- var rgb = HSBToRGB(hsb);
30
- $(cal).data('colorpicker').fields
31
- .eq(1).val(rgb.r).end()
32
- .eq(2).val(rgb.g).end()
33
- .eq(3).val(rgb.b).end();
34
- },
35
- fillHSBFields = function (hsb, cal) {
36
- $(cal).data('colorpicker').fields
37
- .eq(4).val(hsb.h).end()
38
- .eq(5).val(hsb.s).end()
39
- .eq(6).val(hsb.b).end();
40
- },
41
- fillHexFields = function (hsb, cal) {
42
- $(cal).data('colorpicker').fields
43
- .eq(0).val(HSBToHex(hsb)).end();
44
- },
45
- setSelector = function (hsb, cal) {
46
- $(cal).data('colorpicker').selector.css('backgroundColor', '#' + HSBToHex({h: hsb.h, s: 100, b: 100}));
47
- $(cal).data('colorpicker').selectorIndic.css({
48
- left: parseInt(150 * hsb.s/100, 10),
49
- top: parseInt(150 * (100-hsb.b)/100, 10)
50
- });
51
- },
52
- setHue = function (hsb, cal) {
53
- $(cal).data('colorpicker').hue.css('top', parseInt(150 - 150 * hsb.h/360, 10));
54
- },
55
- setCurrentColor = function (hsb, cal) {
56
- $(cal).data('colorpicker').currentColor.css('backgroundColor', '#' + HSBToHex(hsb));
57
- },
58
- setNewColor = function (hsb, cal) {
59
- $(cal).data('colorpicker').newColor.css('backgroundColor', '#' + HSBToHex(hsb));
60
- },
61
- keyDown = function (ev) {
62
- var pressedKey = ev.charCode || ev.keyCode || -1;
63
- if ((pressedKey > charMin && pressedKey <= 90) || pressedKey == 32) {
64
- return false;
65
- }
66
- var cal = $(this).parent().parent();
67
- if (cal.data('colorpicker').livePreview === true) {
68
- change.apply(this);
69
- }
70
- },
71
- change = function (ev) {
72
- var cal = $(this).parent().parent(), col;
73
- if (this.parentNode.className.indexOf('_hex') > 0) {
74
- cal.data('colorpicker').color = col = HexToHSB(fixHex(this.value));
75
- } else if (this.parentNode.className.indexOf('_hsb') > 0) {
76
- cal.data('colorpicker').color = col = fixHSB({
77
- h: parseInt(cal.data('colorpicker').fields.eq(4).val(), 10),
78
- s: parseInt(cal.data('colorpicker').fields.eq(5).val(), 10),
79
- b: parseInt(cal.data('colorpicker').fields.eq(6).val(), 10)
80
- });
81
- } else {
82
- cal.data('colorpicker').color = col = RGBToHSB(fixRGB({
83
- r: parseInt(cal.data('colorpicker').fields.eq(1).val(), 10),
84
- g: parseInt(cal.data('colorpicker').fields.eq(2).val(), 10),
85
- b: parseInt(cal.data('colorpicker').fields.eq(3).val(), 10)
86
- }));
87
- }
88
- if (ev) {
89
- fillRGBFields(col, cal.get(0));
90
- fillHexFields(col, cal.get(0));
91
- fillHSBFields(col, cal.get(0));
92
- }
93
- setSelector(col, cal.get(0));
94
- setHue(col, cal.get(0));
95
- setNewColor(col, cal.get(0));
96
- cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col)]);
97
- },
98
- blur = function (ev) {
99
- var cal = $(this).parent().parent();
100
- cal.data('colorpicker').fields.parent().removeClass('colorpicker_focus');
101
- },
102
- focus = function () {
103
- charMin = this.parentNode.className.indexOf('_hex') > 0 ? 70 : 65;
104
- $(this).parent().parent().data('colorpicker').fields.parent().removeClass('colorpicker_focus');
105
- $(this).parent().addClass('colorpicker_focus');
106
- },
107
- downIncrement = function (ev) {
108
- var field = $(this).parent().find('input').focus();
109
- var current = {
110
- el: $(this).parent().addClass('colorpicker_slider'),
111
- max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255),
112
- y: ev.pageY,
113
- field: field,
114
- val: parseInt(field.val(), 10),
115
- preview: $(this).parent().parent().data('colorpicker').livePreview
116
- };
117
- $(document).bind('mouseup', current, upIncrement);
118
- $(document).bind('mousemove', current, moveIncrement);
119
- },
120
- moveIncrement = function (ev) {
121
- ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY - ev.data.y, 10))));
122
- if (ev.data.preview) {
123
- change.apply(ev.data.field.get(0), [true]);
124
- }
125
- return false;
126
- },
127
- upIncrement = function (ev) {
128
- change.apply(ev.data.field.get(0), [true]);
129
- ev.data.el.removeClass('colorpicker_slider').find('input').focus();
130
- $(document).unbind('mouseup', upIncrement);
131
- $(document).unbind('mousemove', moveIncrement);
132
- return false;
133
- },
134
- downHue = function (ev) {
135
- var current = {
136
- cal: $(this).parent(),
137
- y: $(this).offset().top
138
- };
139
- current.preview = current.cal.data('colorpicker').livePreview;
140
- $(document).bind('mouseup', current, upHue);
141
- $(document).bind('mousemove', current, moveHue);
142
- },
143
- moveHue = function (ev) {
144
- change.apply(
145
- ev.data.cal.data('colorpicker')
146
- .fields
147
- .eq(4)
148
- .val(parseInt(360*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.y))))/150, 10))
149
- .get(0),
150
- [ev.data.preview]
151
- );
152
- return false;
153
- },
154
- upHue = function (ev) {
155
- fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
156
- fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
157
- $(document).unbind('mouseup', upHue);
158
- $(document).unbind('mousemove', moveHue);
159
- return false;
160
- },
161
- downSelector = function (ev) {
162
- var current = {
163
- cal: $(this).parent(),
164
- pos: $(this).offset()
165
- };
166
- current.preview = current.cal.data('colorpicker').livePreview;
167
- $(document).bind('mouseup', current, upSelector);
168
- $(document).bind('mousemove', current, moveSelector);
169
- },
170
- moveSelector = function (ev) {
171
- change.apply(
172
- ev.data.cal.data('colorpicker')
173
- .fields
174
- .eq(6)
175
- .val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.pos.top))))/150, 10))
176
- .end()
177
- .eq(5)
178
- .val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - ev.data.pos.left))))/150, 10))
179
- .get(0),
180
- [ev.data.preview]
181
- );
182
- return false;
183
- },
184
- upSelector = function (ev) {
185
- fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
186
- fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
187
- $(document).unbind('mouseup', upSelector);
188
- $(document).unbind('mousemove', moveSelector);
189
- return false;
190
- },
191
- enterSubmit = function (ev) {
192
- $(this).addClass('colorpicker_focus');
193
- },
194
- leaveSubmit = function (ev) {
195
- $(this).removeClass('colorpicker_focus');
196
- },
197
- clickSubmit = function (ev) {
198
- var cal = $(this).parent();
199
- var col = cal.data('colorpicker').color;
200
- cal.data('colorpicker').origColor = col;
201
- setCurrentColor(col, cal.get(0));
202
- cal.data('colorpicker').onSubmit(col, HSBToHex(col), HSBToRGB(col), cal.data('colorpicker').el);
203
- },
204
- show = function (ev) {
205
- var cal = $('#' + $(this).data('colorpickerId'));
206
- cal.data('colorpicker').onBeforeShow.apply(this, [cal.get(0)]);
207
- var pos = $(this).offset();
208
- var viewPort = getViewport();
209
- var top = pos.top + this.offsetHeight;
210
- var left = pos.left;
211
- if (top + 176 > viewPort.t + viewPort.h) {
212
- top -= this.offsetHeight + 176;
213
- }
214
- if (left + 356 > viewPort.l + viewPort.w) {
215
- left -= 356;
216
- }
217
- cal.css({left: left + 'px', top: top + 'px'});
218
- if (cal.data('colorpicker').onShow.apply(this, [cal.get(0)]) != false) {
219
- cal.show();
220
- }
221
- $(document).bind('mousedown', {cal: cal}, hide);
222
- return false;
223
- },
224
- hide = function (ev) {
225
- if (!isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) {
226
- if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
227
- ev.data.cal.hide();
228
- }
229
- $(document).unbind('mousedown', hide);
230
- }
231
- },
232
- isChildOf = function(parentEl, el, container) {
233
- if (parentEl == el) {
234
- return true;
235
- }
236
- if (parentEl.contains) {
237
- return parentEl.contains(el);
238
- }
239
- if ( parentEl.compareDocumentPosition ) {
240
- return !!(parentEl.compareDocumentPosition(el) & 16);
241
- }
242
- var prEl = el.parentNode;
243
- while(prEl && prEl != container) {
244
- if (prEl == parentEl)
245
- return true;
246
- prEl = prEl.parentNode;
247
- }
248
- return false;
249
- },
250
- getViewport = function () {
251
- var m = document.compatMode == 'CSS1Compat';
252
- return {
253
- l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
254
- t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop),
255
- w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth),
256
- h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight)
257
- };
258
- },
259
- fixHSB = function (hsb) {
260
- return {
261
- h: Math.min(360, Math.max(0, hsb.h)),
262
- s: Math.min(100, Math.max(0, hsb.s)),
263
- b: Math.min(100, Math.max(0, hsb.b))
264
- };
265
- },
266
- fixRGB = function (rgb) {
267
- return {
268
- r: Math.min(255, Math.max(0, rgb.r)),
269
- g: Math.min(255, Math.max(0, rgb.g)),
270
- b: Math.min(255, Math.max(0, rgb.b))
271
- };
272
- },
273
- fixHex = function (hex) {
274
- var len = 6 - hex.length;
275
- if (len > 0) {
276
- var o = [];
277
- for (var i=0; i<len; i++) {
278
- o.push('0');
279
- }
280
- o.push(hex);
281
- hex = o.join('');
282
- }
283
- return hex;
284
- },
285
- HexToRGB = function (hex) {
286
- var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
287
- return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
288
- },
289
- HexToHSB = function (hex) {
290
- return RGBToHSB(HexToRGB(hex));
291
- },
292
- RGBToHSB = function (rgb) {
293
- var hsb = {
294
- h: 0,
295
- s: 0,
296
- b: 0
297
- };
298
- var min = Math.min(rgb.r, rgb.g, rgb.b);
299
- var max = Math.max(rgb.r, rgb.g, rgb.b);
300
- var delta = max - min;
301
- hsb.b = max;
302
- if (max != 0) {
303
-
304
- }
305
- hsb.s = max != 0 ? 255 * delta / max : 0;
306
- if (hsb.s != 0) {
307
- if (rgb.r == max) {
308
- hsb.h = (rgb.g - rgb.b) / delta;
309
- } else if (rgb.g == max) {
310
- hsb.h = 2 + (rgb.b - rgb.r) / delta;
311
- } else {
312
- hsb.h = 4 + (rgb.r - rgb.g) / delta;
313
- }
314
- } else {
315
- hsb.h = -1;
316
- }
317
- hsb.h *= 60;
318
- if (hsb.h < 0) {
319
- hsb.h += 360;
320
- }
321
- hsb.s *= 100/255;
322
- hsb.b *= 100/255;
323
- return hsb;
324
- },
325
- HSBToRGB = function (hsb) {
326
- var rgb = {};
327
- var h = Math.round(hsb.h);
328
- var s = Math.round(hsb.s*255/100);
329
- var v = Math.round(hsb.b*255/100);
330
- if(s == 0) {
331
- rgb.r = rgb.g = rgb.b = v;
332
- } else {
333
- var t1 = v;
334
- var t2 = (255-s)*v/255;
335
- var t3 = (t1-t2)*(h%60)/60;
336
- if(h==360) h = 0;
337
- if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3}
338
- else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3}
339
- else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3}
340
- else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3}
341
- else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3}
342
- else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3}
343
- else {rgb.r=0; rgb.g=0; rgb.b=0}
344
- }
345
- return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)};
346
- },
347
- RGBToHex = function (rgb) {
348
- var hex = [
349
- rgb.r.toString(16),
350
- rgb.g.toString(16),
351
- rgb.b.toString(16)
352
- ];
353
- $.each(hex, function (nr, val) {
354
- if (val.length == 1) {
355
- hex[nr] = '0' + val;
356
- }
357
- });
358
- return hex.join('');
359
- },
360
- HSBToHex = function (hsb) {
361
- return RGBToHex(HSBToRGB(hsb));
362
- },
363
- restoreOriginal = function () {
364
- var cal = $(this).parent();
365
- var col = cal.data('colorpicker').origColor;
366
- cal.data('colorpicker').color = col;
367
- fillRGBFields(col, cal.get(0));
368
- fillHexFields(col, cal.get(0));
369
- fillHSBFields(col, cal.get(0));
370
- setSelector(col, cal.get(0));
371
- setHue(col, cal.get(0));
372
- setNewColor(col, cal.get(0));
373
- };
374
- return {
375
- init: function (opt) {
376
- opt = $.extend({}, defaults, opt||{});
377
- if (typeof opt.color == 'string') {
378
- opt.color = HexToHSB(opt.color);
379
- } else if (opt.color.r != undefined && opt.color.g != undefined && opt.color.b != undefined) {
380
- opt.color = RGBToHSB(opt.color);
381
- } else if (opt.color.h != undefined && opt.color.s != undefined && opt.color.b != undefined) {
382
- opt.color = fixHSB(opt.color);
383
- } else {
384
- return this;
385
- }
386
- return this.each(function () {
387
- if (!$(this).data('colorpickerId')) {
388
- var options = $.extend({}, opt);
389
- options.origColor = opt.color;
390
- var id = 'collorpicker_' + parseInt(Math.random() * 1000);
391
- $(this).data('colorpickerId', id);
392
- var cal = $(tpl).attr('id', id);
393
- if (options.flat) {
394
- cal.appendTo(this).show();
395
- } else {
396
- cal.appendTo(document.body);
397
- }
398
- options.fields = cal
399
- .find('input')
400
- .bind('keyup', keyDown)
401
- .bind('change', change)
402
- .bind('blur', blur)
403
- .bind('focus', focus);
404
- cal
405
- .find('span').bind('mousedown', downIncrement).end()
406
- .find('>div.colorpicker_current_color').bind('click', restoreOriginal);
407
- options.selector = cal.find('div.colorpicker_color').bind('mousedown', downSelector);
408
- options.selectorIndic = options.selector.find('div div');
409
- options.el = this;
410
- options.hue = cal.find('div.colorpicker_hue div');
411
- cal.find('div.colorpicker_hue').bind('mousedown', downHue);
412
- options.newColor = cal.find('div.colorpicker_new_color');
413
- options.currentColor = cal.find('div.colorpicker_current_color');
414
- cal.data('colorpicker', options);
415
- cal.find('div.colorpicker_submit')
416
- .bind('mouseenter', enterSubmit)
417
- .bind('mouseleave', leaveSubmit)
418
- .bind('click', clickSubmit);
419
- fillRGBFields(options.color, cal.get(0));
420
- fillHSBFields(options.color, cal.get(0));
421
- fillHexFields(options.color, cal.get(0));
422
- setHue(options.color, cal.get(0));
423
- setSelector(options.color, cal.get(0));
424
- setCurrentColor(options.color, cal.get(0));
425
- setNewColor(options.color, cal.get(0));
426
- if (options.flat) {
427
- cal.css({
428
- position: 'relative',
429
- display: 'block'
430
- });
431
- } else {
432
- $(this).bind(options.eventName, show);
433
- }
434
- }
435
- });
436
- },
437
- showPicker: function() {
438
- return this.each( function () {
439
- if ($(this).data('colorpickerId')) {
440
- show.apply(this);
441
- }
442
- });
443
- },
444
- hidePicker: function() {
445
- return this.each( function () {
446
- if ($(this).data('colorpickerId')) {
447
- $('#' + $(this).data('colorpickerId')).hide();
448
- }
449
- });
450
- },
451
- setColor: function(col) {
452
- if (typeof col == 'string') {
453
- col = HexToHSB(col);
454
- } else if (col.r != undefined && col.g != undefined && col.b != undefined) {
455
- col = RGBToHSB(col);
456
- } else if (col.h != undefined && col.s != undefined && col.b != undefined) {
457
- col = fixHSB(col);
458
- } else {
459
- return this;
460
- }
461
- return this.each(function(){
462
- if ($(this).data('colorpickerId')) {
463
- var cal = $('#' + $(this).data('colorpickerId'));
464
- cal.data('colorpicker').color = col;
465
- cal.data('colorpicker').origColor = col;
466
- fillRGBFields(col, cal.get(0));
467
- fillHSBFields(col, cal.get(0));
468
- fillHexFields(col, cal.get(0));
469
- setHue(col, cal.get(0));
470
- setSelector(col, cal.get(0));
471
- setCurrentColor(col, cal.get(0));
472
- setNewColor(col, cal.get(0));
473
- }
474
- });
475
- }
476
- };
477
- }();
478
- $.fn.extend({
479
- ColorPicker: ColorPicker.init,
480
- ColorPickerHide: ColorPicker.hidePicker,
481
- ColorPickerShow: ColorPicker.showPicker,
482
- ColorPickerSetColor: ColorPicker.setColor
483
- });
484
  })(jQuery)
1
+ /**
2
+ *
3
+ * Color picker
4
+ * Author: Stefan Petre www.eyecon.ro
5
+ *
6
+ * Dual licensed under the MIT and GPL licenses
7
+ *
8
+ */
9
+ (function ($) {
10
+ var ColorPicker = function () {
11
+ var
12
+ ids = {},
13
+ inAction,
14
+ charMin = 65,
15
+ visible,
16
+ tpl = '<div class="colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_submit"></div></div>',
17
+ defaults = {
18
+ eventName: 'click',
19
+ onShow: function () {},
20
+ onBeforeShow: function(){},
21
+ onHide: function () {},
22
+ onChange: function () {},
23
+ onSubmit: function () {},
24
+ color: 'ff0000',
25
+ livePreview: true,
26
+ flat: false
27
+ },
28
+ fillRGBFields = function (hsb, cal) {
29
+ var rgb = HSBToRGB(hsb);
30
+ $(cal).data('colorpicker').fields
31
+ .eq(1).val(rgb.r).end()
32
+ .eq(2).val(rgb.g).end()
33
+ .eq(3).val(rgb.b).end();
34
+ },
35
+ fillHSBFields = function (hsb, cal) {
36
+ $(cal).data('colorpicker').fields
37
+ .eq(4).val(hsb.h).end()
38
+ .eq(5).val(hsb.s).end()
39
+ .eq(6).val(hsb.b).end();
40
+ },
41
+ fillHexFields = function (hsb, cal) {
42
+ $(cal).data('colorpicker').fields
43
+ .eq(0).val(HSBToHex(hsb)).end();
44
+ },
45
+ setSelector = function (hsb, cal) {
46
+ $(cal).data('colorpicker').selector.css('backgroundColor', '#' + HSBToHex({h: hsb.h, s: 100, b: 100}));
47
+ $(cal).data('colorpicker').selectorIndic.css({
48
+ left: parseInt(150 * hsb.s/100, 10),
49
+ top: parseInt(150 * (100-hsb.b)/100, 10)
50
+ });
51
+ },
52
+ setHue = function (hsb, cal) {
53
+ $(cal).data('colorpicker').hue.css('top', parseInt(150 - 150 * hsb.h/360, 10));
54
+ },
55
+ setCurrentColor = function (hsb, cal) {
56
+ $(cal).data('colorpicker').currentColor.css('backgroundColor', '#' + HSBToHex(hsb));
57
+ },
58
+ setNewColor = function (hsb, cal) {
59
+ $(cal).data('colorpicker').newColor.css('backgroundColor', '#' + HSBToHex(hsb));
60
+ },
61
+ keyDown = function (ev) {
62
+ var pressedKey = ev.charCode || ev.keyCode || -1;
63
+ if ((pressedKey > charMin && pressedKey <= 90) || pressedKey == 32) {
64
+ return false;
65
+ }
66
+ var cal = $(this).parent().parent();
67
+ if (cal.data('colorpicker').livePreview === true) {
68
+ change.apply(this);
69
+ }
70
+ },
71
+ change = function (ev) {
72
+ var cal = $(this).parent().parent(), col;
73
+ if (this.parentNode.className.indexOf('_hex') > 0) {
74
+ cal.data('colorpicker').color = col = HexToHSB(fixHex(this.value));
75
+ } else if (this.parentNode.className.indexOf('_hsb') > 0) {
76
+ cal.data('colorpicker').color = col = fixHSB({
77
+ h: parseInt(cal.data('colorpicker').fields.eq(4).val(), 10),
78
+ s: parseInt(cal.data('colorpicker').fields.eq(5).val(), 10),
79
+ b: parseInt(cal.data('colorpicker').fields.eq(6).val(), 10)
80
+ });
81
+ } else {
82
+ cal.data('colorpicker').color = col = RGBToHSB(fixRGB({
83
+ r: parseInt(cal.data('colorpicker').fields.eq(1).val(), 10),
84
+ g: parseInt(cal.data('colorpicker').fields.eq(2).val(), 10),
85
+ b: parseInt(cal.data('colorpicker').fields.eq(3).val(), 10)
86
+ }));
87
+ }
88
+ if (ev) {
89
+ fillRGBFields(col, cal.get(0));
90
+ fillHexFields(col, cal.get(0));
91
+ fillHSBFields(col, cal.get(0));
92
+ }
93
+ setSelector(col, cal.get(0));
94
+ setHue(col, cal.get(0));
95
+ setNewColor(col, cal.get(0));
96
+ cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col)]);
97
+ },
98
+ blur = function (ev) {
99
+ var cal = $(this).parent().parent();
100
+ cal.data('colorpicker').fields.parent().removeClass('colorpicker_focus');
101
+ },
102
+ focus = function () {
103
+ charMin = this.parentNode.className.indexOf('_hex') > 0 ? 70 : 65;
104
+ $(this).parent().parent().data('colorpicker').fields.parent().removeClass('colorpicker_focus');
105
+ $(this).parent().addClass('colorpicker_focus');
106
+ },
107
+ downIncrement = function (ev) {
108
+ var field = $(this).parent().find('input').focus();
109
+ var current = {
110
+ el: $(this).parent().addClass('colorpicker_slider'),
111
+ max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255),
112
+ y: ev.pageY,
113
+ field: field,
114
+ val: parseInt(field.val(), 10),
115
+ preview: $(this).parent().parent().data('colorpicker').livePreview
116
+ };
117
+ $(document).bind('mouseup', current, upIncrement);
118
+ $(document).bind('mousemove', current, moveIncrement);
119
+ },
120
+ moveIncrement = function (ev) {
121
+ ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY - ev.data.y, 10))));
122
+ if (ev.data.preview) {
123
+ change.apply(ev.data.field.get(0), [true]);
124
+ }
125
+ return false;
126
+ },
127
+ upIncrement = function (ev) {
128
+ change.apply(ev.data.field.get(0), [true]);
129
+ ev.data.el.removeClass('colorpicker_slider').find('input').focus();
130
+ $(document).unbind('mouseup', upIncrement);
131
+ $(document).unbind('mousemove', moveIncrement);
132
+ return false;
133
+ },
134
+ downHue = function (ev) {
135
+ var current = {
136
+ cal: $(this).parent(),
137
+ y: $(this).offset().top
138
+ };
139
+ current.preview = current.cal.data('colorpicker').livePreview;
140
+ $(document).bind('mouseup', current, upHue);
141
+ $(document).bind('mousemove', current, moveHue);
142
+ },
143
+ moveHue = function (ev) {
144
+ change.apply(
145
+ ev.data.cal.data('colorpicker')
146
+ .fields
147
+ .eq(4)
148
+ .val(parseInt(360*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.y))))/150, 10))
149
+ .get(0),
150
+ [ev.data.preview]
151
+ );
152
+ return false;
153
+ },
154
+ upHue = function (ev) {
155
+ fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
156
+ fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
157
+ $(document).unbind('mouseup', upHue);
158
+ $(document).unbind('mousemove', moveHue);
159
+ return false;
160
+ },
161
+ downSelector = function (ev) {
162
+ var current = {
163
+ cal: $(this).parent(),
164
+ pos: $(this).offset()
165
+ };
166
+ current.preview = current.cal.data('colorpicker').livePreview;
167
+ $(document).bind('mouseup', current, upSelector);
168
+ $(document).bind('mousemove', current, moveSelector);
169
+ },
170
+ moveSelector = function (ev) {
171
+ change.apply(
172
+ ev.data.cal.data('colorpicker')
173
+ .fields
174
+ .eq(6)
175
+ .val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.pos.top))))/150, 10))
176
+ .end()
177
+ .eq(5)
178
+ .val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - ev.data.pos.left))))/150, 10))
179
+ .get(0),
180
+ [ev.data.preview]
181
+ );
182
+ return false;
183
+ },
184
+ upSelector = function (ev) {
185
+ fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
186
+ fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
187
+ $(document).unbind('mouseup', upSelector);
188
+ $(document).unbind('mousemove', moveSelector);
189
+ return false;
190
+ },
191
+ enterSubmit = function (ev) {
192
+ $(this).addClass('colorpicker_focus');
193
+ },
194
+ leaveSubmit = function (ev) {
195
+ $(this).removeClass('colorpicker_focus');
196
+ },
197
+ clickSubmit = function (ev) {
198
+ var cal = $(this).parent();
199
+ var col = cal.data('colorpicker').color;
200
+ cal.data('colorpicker').origColor = col;
201
+ setCurrentColor(col, cal.get(0));
202
+ cal.data('colorpicker').onSubmit(col, HSBToHex(col), HSBToRGB(col), cal.data('colorpicker').el);
203
+ },
204
+ show = function (ev) {
205
+ var cal = $('#' + $(this).data('colorpickerId'));
206
+ cal.data('colorpicker').onBeforeShow.apply(this, [cal.get(0)]);
207
+ var pos = $(this).offset();
208
+ var viewPort = getViewport();
209
+ var top = pos.top + this.offsetHeight;
210
+ var left = pos.left;
211
+ if (top + 176 > viewPort.t + viewPort.h) {
212
+ top -= this.offsetHeight + 176;
213
+ }
214
+ if (left + 356 > viewPort.l + viewPort.w) {
215
+ left -= 356;
216
+ }
217
+ cal.css({left: left + 'px', top: top + 'px'});
218
+ if (cal.data('colorpicker').onShow.apply(this, [cal.get(0)]) != false) {
219
+ cal.show();
220
+ }
221
+ $(document).bind('mousedown', {cal: cal}, hide);
222
+ return false;
223
+ },
224
+ hide = function (ev) {
225
+ if (!isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) {
226
+ if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
227
+ ev.data.cal.hide();
228
+ }
229
+ $(document).unbind('mousedown', hide);
230
+ }
231
+ },
232
+ isChildOf = function(parentEl, el, container) {
233
+ if (parentEl == el) {
234
+ return true;
235
+ }
236
+ if (parentEl.contains) {
237
+ return parentEl.contains(el);
238
+ }
239
+ if ( parentEl.compareDocumentPosition ) {
240
+ return !!(parentEl.compareDocumentPosition(el) & 16);
241
+ }
242
+ var prEl = el.parentNode;
243
+ while(prEl && prEl != container) {
244
+ if (prEl == parentEl)
245
+ return true;
246
+ prEl = prEl.parentNode;
247
+ }
248
+ return false;
249
+ },
250
+ getViewport = function () {
251
+ var m = document.compatMode == 'CSS1Compat';
252
+ return {
253
+ l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
254
+ t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop),
255
+ w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth),
256
+ h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight)
257
+ };
258
+ },
259
+ fixHSB = function (hsb) {
260
+ return {
261
+ h: Math.min(360, Math.max(0, hsb.h)),
262
+ s: Math.min(100, Math.max(0, hsb.s)),
263
+ b: Math.min(100, Math.max(0, hsb.b))
264
+ };
265
+ },
266
+ fixRGB = function (rgb) {
267
+ return {
268
+ r: Math.min(255, Math.max(0, rgb.r)),
269
+ g: Math.min(255, Math.max(0, rgb.g)),
270
+ b: Math.min(255, Math.max(0, rgb.b))
271
+ };
272
+ },
273
+ fixHex = function (hex) {
274
+ var len = 6 - hex.length;
275
+ if (len > 0) {
276
+ var o = [];
277
+ for (var i=0; i<len; i++) {
278
+ o.push('0');
279
+ }
280
+ o.push(hex);
281
+ hex = o.join('');
282
+ }
283
+ return hex;
284
+ },
285
+ HexToRGB = function (hex) {
286
+ var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
287
+ return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
288
+ },
289
+ HexToHSB = function (hex) {
290
+ return RGBToHSB(HexToRGB(hex));
291
+ },
292
+ RGBToHSB = function (rgb) {
293
+ var hsb = {
294
+ h: 0,
295
+ s: 0,
296
+ b: 0
297
+ };
298
+ var min = Math.min(rgb.r, rgb.g, rgb.b);
299
+ var max = Math.max(rgb.r, rgb.g, rgb.b);
300
+ var delta = max - min;
301
+ hsb.b = max;
302
+ if (max != 0) {
303
+
304
+ }
305
+ hsb.s = max != 0 ? 255 * delta / max : 0;
306
+ if (hsb.s != 0) {
307
+ if (rgb.r == max) {
308
+ hsb.h = (rgb.g - rgb.b) / delta;
309
+ } else if (rgb.g == max) {
310
+ hsb.h = 2 + (rgb.b - rgb.r) / delta;
311
+ } else {
312
+ hsb.h = 4 + (rgb.r - rgb.g) / delta;
313
+ }
314
+ } else {
315
+ hsb.h = -1;
316
+ }
317
+ hsb.h *= 60;
318
+ if (hsb.h < 0) {
319
+ hsb.h += 360;
320
+ }
321
+ hsb.s *= 100/255;
322
+ hsb.b *= 100/255;
323
+ return hsb;
324
+ },
325
+ HSBToRGB = function (hsb) {
326
+ var rgb = {};
327
+ var h = Math.round(hsb.h);
328
+ var s = Math.round(hsb.s*255/100);
329
+ var v = Math.round(hsb.b*255/100);
330
+ if(s == 0) {
331
+ rgb.r = rgb.g = rgb.b = v;
332
+ } else {
333
+ var t1 = v;
334
+ var t2 = (255-s)*v/255;
335
+ var t3 = (t1-t2)*(h%60)/60;
336
+ if(h==360) h = 0;
337
+ if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3}
338
+ else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3}
339
+ else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3}
340
+ else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3}
341
+ else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3}
342
+ else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3}
343
+ else {rgb.r=0; rgb.g=0; rgb.b=0}
344
+ }
345
+ return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)};
346
+ },
347
+ RGBToHex = function (rgb) {
348
+ var hex = [
349
+ rgb.r.toString(16),
350
+ rgb.g.toString(16),
351
+ rgb.b.toString(16)
352
+ ];
353
+ $.each(hex, function (nr, val) {
354
+ if (val.length == 1) {
355
+ hex[nr] = '0' + val;
356
+ }
357
+ });
358
+ return hex.join('');
359
+ },
360
+ HSBToHex = function (hsb) {
361
+ return RGBToHex(HSBToRGB(hsb));
362
+ },
363
+ restoreOriginal = function () {
364
+ var cal = $(this).parent();
365
+ var col = cal.data('colorpicker').origColor;
366
+ cal.data('colorpicker').color = col;
367
+ fillRGBFields(col, cal.get(0));
368
+ fillHexFields(col, cal.get(0));
369
+ fillHSBFields(col, cal.get(0));
370
+ setSelector(col, cal.get(0));
371
+ setHue(col, cal.get(0));
372
+ setNewColor(col, cal.get(0));
373
+ };
374
+ return {
375
+ init: function (opt) {
376
+ opt = $.extend({}, defaults, opt||{});
377
+ if (typeof opt.color == 'string') {
378
+ opt.color = HexToHSB(opt.color);
379
+ } else if (opt.color.r != undefined && opt.color.g != undefined && opt.color.b != undefined) {
380
+ opt.color = RGBToHSB(opt.color);
381
+ } else if (opt.color.h != undefined && opt.color.s != undefined && opt.color.b != undefined) {
382
+ opt.color = fixHSB(opt.color);
383
+ } else {
384
+ return this;
385
+ }
386
+ return this.each(function () {
387
+ if (!$(this).data('colorpickerId')) {
388
+ var options = $.extend({}, opt);
389
+ options.origColor = opt.color;
390
+ var id = 'collorpicker_' + parseInt(Math.random() * 1000);
391
+ $(this).data('colorpickerId', id);
392
+ var cal = $(tpl).attr('id', id);
393
+ if (options.flat) {
394
+ cal.appendTo(this).show();
395
+ } else {
396
+ cal.appendTo(document.body);
397
+ }
398
+ options.fields = cal
399
+ .find('input')
400
+ .bind('keyup', keyDown)
401
+ .bind('change', change)
402
+ .bind('blur', blur)
403
+ .bind('focus', focus);
404
+ cal
405
+ .find('span').bind('mousedown', downIncrement).end()
406
+ .find('>div.colorpicker_current_color').bind('click', restoreOriginal);
407
+ options.selector = cal.find('div.colorpicker_color').bind('mousedown', downSelector);
408
+ options.selectorIndic = options.selector.find('div div');
409
+ options.el = this;
410
+ options.hue = cal.find('div.colorpicker_hue div');
411
+ cal.find('div.colorpicker_hue').bind('mousedown', downHue);
412
+ options.newColor = cal.find('div.colorpicker_new_color');
413
+ options.currentColor = cal.find('div.colorpicker_current_color');
414
+ cal.data('colorpicker', options);
415
+ cal.find('div.colorpicker_submit')
416
+ .bind('mouseenter', enterSubmit)
417
+ .bind('mouseleave', leaveSubmit)
418
+ .bind('click', clickSubmit);
419
+ fillRGBFields(options.color, cal.get(0));
420
+ fillHSBFields(options.color, cal.get(0));
421
+ fillHexFields(options.color, cal.get(0));
422
+ setHue(options.color, cal.get(0));
423
+ setSelector(options.color, cal.get(0));
424
+ setCurrentColor(options.color, cal.get(0));
425
+ setNewColor(options.color, cal.get(0));
426
+ if (options.flat) {
427
+ cal.css({
428
+ position: 'relative',
429
+ display: 'block'
430
+ });
431
+ } else {
432
+ $(this).bind(options.eventName, show);
433
+ }
434
+ }
435
+ });
436
+ },
437
+ showPicker: function() {
438
+ return this.each( function () {
439
+ if ($(this).data('colorpickerId')) {
440
+ show.apply(this);
441
+ }
442
+ });
443
+ },
444
+ hidePicker: function() {
445
+ return this.each( function () {
446
+ if ($(this).data('colorpickerId')) {
447
+ $('#' + $(this).data('colorpickerId')).hide();
448
+ }
449
+ });
450
+ },
451
+ setColor: function(col) {
452
+ if (typeof col == 'string') {
453
+ col = HexToHSB(col);
454
+ } else if (col.r != undefined && col.g != undefined && col.b != undefined) {
455
+ col = RGBToHSB(col);
456
+ } else if (col.h != undefined && col.s != undefined && col.b != undefined) {
457
+ col = fixHSB(col);
458
+ } else {
459
+ return this;
460
+ }
461
+ return this.each(function(){
462
+ if ($(this).data('colorpickerId')) {
463
+ var cal = $('#' + $(this).data('colorpickerId'));
464
+ cal.data('colorpicker').color = col;
465
+ cal.data('colorpicker').origColor = col;
466
+ fillRGBFields(col, cal.get(0));
467
+ fillHSBFields(col, cal.get(0));
468
+ fillHexFields(col, cal.get(0));
469
+ setHue(col, cal.get(0));
470
+ setSelector(col, cal.get(0));
471
+ setCurrentColor(col, cal.get(0));
472
+ setNewColor(col, cal.get(0));
473
+ }
474
+ });
475
+ }
476
+ };
477
+ }();
478
+ $.fn.extend({
479
+ ColorPicker: ColorPicker.init,
480
+ ColorPickerHide: ColorPicker.hidePicker,
481
+ ColorPickerShow: ColorPicker.showPicker,
482
+ ColorPickerSetColor: ColorPicker.setColor
483
+ });
484
  })(jQuery)
admin/js/jqueryFileTree/jqueryFileTree.css CHANGED
@@ -1,81 +1,81 @@
1
- #file_browser {
2
- border: 2px solid #999;
3
- height: 200px;
4
- overflow: auto;
5
- padding: 4px 8px;
6
- background: #fff;
7
- margin: 4px 0px;
8
- width: 350px;
9
- position:relative;
10
- display:none;
11
- }
12
- .browsefiles {margin-left:5px;}
13
-
14
- ul.jqueryDirTree {
15
- font-family: Verdana, sans-serif;
16
- font-size: 11px;
17
- line-height: 18px;
18
- padding: 0px;
19
- margin: 0px;
20
- }
21
-
22
- ul.jqueryDirTree li {
23
- list-style: none;
24
- padding: 2px 0px;
25
- padding-left: 20px;
26
- margin: 0px;
27
- white-space: nowrap;
28
- }
29
-
30
- ul.jqueryDirTree a {
31
- color: #333;
32
- text-decoration: none;
33
- display: block;
34
- padding: 0px 2px;
35
- }
36
-
37
- ul.jqueryDirTree a:hover {
38
- background: #bdf;
39
- }
40
- ul.jqueryDirTree li.active a {
41
- background: #bdf;
42
- }
43
- ul.jqueryDirTree li.active li a {
44
- background: none;
45
- }
46
- ul.jqueryDirTree li.active li a:hover {
47
- background: #bdf;
48
- }
49
-
50
- /* Core Styles */
51
- .jqueryDirTree li.directory { background: url(images/directory.png) left top no-repeat; }
52
- .jqueryDirTree li.expanded { background: url(images/folder_open.png) left top no-repeat; }
53
- .jqueryDirTree li.file { background: url(images/file.png) left top no-repeat; }
54
- .jqueryDirTree li.wait { background: url(images/spinner.gif) left top no-repeat; }
55
- /* File Extensions*/
56
- .jqueryDirTree li.ext_3gp { background: url(images/film.png) left top no-repeat; }
57
- .jqueryDirTree li.ext_avi { background: url(images/film.png) left top no-repeat; }
58
- .jqueryDirTree li.ext_bat { background: url(images/application.png) left top no-repeat; }
59
- .jqueryDirTree li.ext_bmp { background: url(images/picture.png) left top no-repeat; }
60
- .jqueryDirTree li.ext_com { background: url(images/application.png) left top no-repeat; }
61
- .jqueryDirTree li.ext_exe { background: url(images/application.png) left top no-repeat; }
62
- .jqueryDirTree li.ext_gif { background: url(images/picture.png) left top no-repeat; }
63
- .jqueryDirTree li.ext_fla { background: url(images/flash.png) left top no-repeat; }
64
- .jqueryDirTree li.ext_jpg { background: url(images/picture.png) left top no-repeat; }
65
- .jqueryDirTree li.ext_jpeg { background: url(images/picture.png) left top no-repeat; }
66
- .jqueryDirTree li.ext_m4p { background: url(images/music.png) left top no-repeat; }
67
- .jqueryDirTree li.ext_mov { background: url(images/film.png) left top no-repeat; }
68
- .jqueryDirTree li.ext_mp3 { background: url(images/music.png) left top no-repeat; }
69
- .jqueryDirTree li.ext_mp4 { background: url(images/film.png) left top no-repeat; }
70
- .jqueryDirTree li.ext_mpg { background: url(images/film.png) left top no-repeat; }
71
- .jqueryDirTree li.ext_mpeg { background: url(images/film.png) left top no-repeat; }
72
- .jqueryDirTree li.ext_ogg { background: url(images/music.png) left top no-repeat; }
73
- .jqueryDirTree li.ext_pcx { background: url(images/picture.png) left top no-repeat; }
74
- .jqueryDirTree li.ext_pdf { background: url(images/pdf.png) left top no-repeat; }
75
- .jqueryDirTree li.ext_png { background: url(images/picture.png) left top no-repeat; }
76
- .jqueryDirTree li.ext_swf { background: url(images/flash.png) left top no-repeat; }
77
- .jqueryDirTree li.ext_tif { background: url(images/picture.png) left top no-repeat; }
78
- .jqueryDirTree li.ext_tiff { background: url(images/picture.png) left top no-repeat; }
79
- .jqueryDirTree li.ext_wav { background: url(images/music.png) left top no-repeat; }
80
- .jqueryDirTree li.ext_wmv { background: url(images/film.png) left top no-repeat; }
81
  .jqueryDirTree li.ext_zip { background: url(images/zip.png) left top no-repeat; }
1
+ #file_browser {
2
+ border: 2px solid #999;
3
+ height: 200px;
4
+ overflow: auto;
5
+ padding: 4px 8px;
6
+ background: #fff;
7
+ margin: 4px 0px;
8
+ width: 350px;
9
+ position:relative;
10
+ display:none;
11
+ }
12
+ .browsefiles {margin-left:5px;}
13
+
14
+ ul.jqueryDirTree {
15
+ font-family: Verdana, sans-serif;
16
+ font-size: 11px;
17
+ line-height: 18px;
18
+ padding: 0px;
19
+ margin: 0px;
20
+ }
21
+
22
+ ul.jqueryDirTree li {
23
+ list-style: none;
24
+ padding: 2px 0px;
25
+ padding-left: 20px;
26
+ margin: 0px;
27
+ white-space: nowrap;
28
+ }
29
+
30
+ ul.jqueryDirTree a {
31
+ color: #333;
32
+ text-decoration: none;
33
+ display: block;
34
+ padding: 0px 2px;
35
+ }
36
+
37
+ ul.jqueryDirTree a:hover {
38
+ background: #bdf;
39
+ }
40
+ ul.jqueryDirTree li.active a {
41
+ background: #bdf;
42
+ }
43
+ ul.jqueryDirTree li.active li a {
44
+ background: none;
45
+ }
46
+ ul.jqueryDirTree li.active li a:hover {
47
+ background: #bdf;
48
+ }
49
+
50
+ /* Core Styles */
51
+ .jqueryDirTree li.directory { background: url(images/directory.png) left top no-repeat; }
52
+ .jqueryDirTree li.expanded { background: url(images/folder_open.png) left top no-repeat; }
53
+ .jqueryDirTree li.file { background: url(images/file.png) left top no-repeat; }
54
+ .jqueryDirTree li.wait { background: url(images/spinner.gif) left top no-repeat; }
55
+ /* File Extensions*/
56
+ .jqueryDirTree li.ext_3gp { background: url(images/film.png) left top no-repeat; }
57
+ .jqueryDirTree li.ext_avi { background: url(images/film.png) left top no-repeat; }
58
+ .jqueryDirTree li.ext_bat { background: url(images/application.png) left top no-repeat; }
59
+ .jqueryDirTree li.ext_bmp { background: url(images/picture.png) left top no-repeat; }
60
+ .jqueryDirTree li.ext_com { background: url(images/application.png) left top no-repeat; }
61
+ .jqueryDirTree li.ext_exe { background: url(images/application.png) left top no-repeat; }
62
+ .jqueryDirTree li.ext_gif { background: url(images/picture.png) left top no-repeat; }
63
+ .jqueryDirTree li.ext_fla { background: url(images/flash.png) left top no-repeat; }
64
+ .jqueryDirTree li.ext_jpg { background: url(images/picture.png) left top no-repeat; }
65
+ .jqueryDirTree li.ext_jpeg { background: url(images/picture.png) left top no-repeat; }
66
+ .jqueryDirTree li.ext_m4p { background: url(images/music.png) left top no-repeat; }
67
+ .jqueryDirTree li.ext_mov { background: url(images/film.png) left top no-repeat; }
68
+ .jqueryDirTree li.ext_mp3 { background: url(images/music.png) left top no-repeat; }
69
+ .jqueryDirTree li.ext_mp4 { background: url(images/film.png) left top no-repeat; }
70
+ .jqueryDirTree li.ext_mpg { background: url(images/film.png) left top no-repeat; }
71
+ .jqueryDirTree li.ext_mpeg { background: url(images/film.png) left top no-repeat; }
72
+ .jqueryDirTree li.ext_ogg { background: url(images/music.png) left top no-repeat; }
73
+ .jqueryDirTree li.ext_pcx { background: url(images/picture.png) left top no-repeat; }
74
+ .jqueryDirTree li.ext_pdf { background: url(images/pdf.png) left top no-repeat; }
75
+ .jqueryDirTree li.ext_png { background: url(images/picture.png) left top no-repeat; }
76
+ .jqueryDirTree li.ext_swf { background: url(images/flash.png) left top no-repeat; }
77
+ .jqueryDirTree li.ext_tif { background: url(images/picture.png) left top no-repeat; }
78
+ .jqueryDirTree li.ext_tiff { background: url(images/picture.png) left top no-repeat; }
79
+ .jqueryDirTree li.ext_wav { background: url(images/music.png) left top no-repeat; }
80
+ .jqueryDirTree li.ext_wmv { background: url(images/film.png) left top no-repeat; }
81
  .jqueryDirTree li.ext_zip { background: url(images/zip.png) left top no-repeat; }
admin/js/ngg.autocomplete.js CHANGED
@@ -1,77 +1,77 @@
1
- /*
2
- * Implementation of jQuery UI Autocomplete
3
- * see http://jqueryui.com/demos/autocomplete/
4
- * Version: 1.0.1
5
- * Author : Alex Rabe
6
- *
7
- */
8
- jQuery.fn.nggAutocomplete = function ( args ) {
9
-
10
- var defaults = { type: 'image',
11
- domain: '',
12
- limit: 50 };
13
-
14
- var s = jQuery.extend( {}, defaults, args);
15
-
16
- var settings = { method: 'autocomplete',
17
- type: s.type,
18
- format: 'json',
19
- callback: 'json',
20
- limit: s.limit };
21
-
22
- var obj = this.selector;
23
- var id = jQuery(this).attr('id');
24
- var cache = {}, lastXhr;
25
-
26
- // get current value of drop down field
27
- var c_text = jQuery(obj + ' :selected').text();
28
- var c_val = jQuery(obj).val();
29
- // IE7 / IE 8 didnt get often the correct width
30
- if (s.width == undefined)
31
- var c_width = jQuery(this).width();
32
- else
33
- var c_width = s.width;
34
- //hide first the drop down field
35
- jQuery(obj).hide();
36
- jQuery(obj).after('<input name="' + id + '_ac" type="text" id="' + id + '_ac"/>');
37
- // Fill up current value & style
38
- jQuery(obj + "_ac").val(c_text);
39
- jQuery(obj + "_ac").css('width', c_width);
40
- // Add the dropdown icon
41
- jQuery(obj + "_ac").addClass('ui-autocomplete-start')
42
- jQuery(obj + "_ac").autocomplete({
43
- source: function( request, response ) {
44
- var term = request.term;
45
- if ( term in cache ) {
46
- response( cache[ term ] );
47
- return;
48
- }
49
- // adding more $_GET parameter
50
- request = jQuery.extend( {}, settings, request);
51
- lastXhr = jQuery.getJSON( s.domain, request, function( data, status, xhr ) {
52
- // add term to cache
53
- cache[ term ] = data;
54
- if ( xhr === lastXhr )
55
- response( data );
56
- });
57
- },
58
- minLength: 0,
59
- select: function( event, ui ) {
60
- // adding this to the dropdown list
61
- jQuery(obj).append( new Option(ui.item.label, ui.item.id) );
62
- // now select it
63
- jQuery(obj).val(ui.item.id);
64
- jQuery(obj + "_ac").removeClass('ui-autocomplete-start');
65
- }
66
- });
67
-
68
- jQuery(obj + "_ac").click(function() {
69
-
70
- var search = jQuery(obj + "_ac").val();
71
- // if the value is prefilled, we pass a empty string
72
- if ( search == c_text)
73
- search = '';
74
- // pass empty string as value to search for, displaying all results
75
- jQuery(obj + "_ac").autocomplete('search', search );
76
- });
77
- }
1
+ /*
2
+ * Implementation of jQuery UI Autocomplete
3
+ * see http://jqueryui.com/demos/autocomplete/
4
+ * Version: 1.0.1
5
+ * Author : Alex Rabe
6
+ *
7
+ */
8
+ jQuery.fn.nggAutocomplete = function ( args ) {
9
+
10
+ var defaults = { type: 'image',
11
+ domain: '',
12
+ limit: 50 };
13
+
14
+ var s = jQuery.extend( {}, defaults, args);
15
+
16
+ var settings = { method: 'autocomplete',
17
+ type: s.type,
18
+ format: 'json',
19
+ callback: 'json',
20
+ limit: s.limit };
21
+
22
+ var obj = this.selector;
23
+ var id = jQuery(this).attr('id');
24
+ var cache = {}, lastXhr;
25
+
26
+ // get current value of drop down field
27
+ var c_text = jQuery(obj + ' :selected').text();
28
+ var c_val = jQuery(obj).val();
29
+ // IE7 / IE 8 didnt get often the correct width
30
+ if (s.width == undefined)
31
+ var c_width = jQuery(this).width();
32
+ else
33
+ var c_width = s.width;
34
+ //hide first the drop down field
35
+ jQuery(obj).hide();
36
+ jQuery(obj).after('<input name="' + id + '_ac" type="text" id="' + id + '_ac"/>');
37
+ // Fill up current value & style
38
+ jQuery(obj + "_ac").val(c_text);
39
+ jQuery(obj + "_ac").css('width', c_width);
40
+ // Add the dropdown icon
41
+ jQuery(obj + "_ac").addClass('ui-autocomplete-start')
42
+ jQuery(obj + "_ac").autocomplete({
43
+ source: function( request, response ) {
44
+ var term = request.term;
45
+ if ( term in cache ) {
46
+ response( cache[ term ] );
47
+ return;
48
+ }
49
+ // adding more $_GET parameter
50
+ request = jQuery.extend( {}, settings, request);
51
+ lastXhr = jQuery.getJSON( s.domain, request, function( data, status, xhr ) {
52
+ // add term to cache
53
+ cache[ term ] = data;
54
+ if ( xhr === lastXhr )
55
+ response( data );
56
+ });
57
+ },
58
+ minLength: 0,
59
+ select: function( event, ui ) {
60
+ // adding this to the dropdown list
61
+ jQuery(obj).append( new Option(ui.item.label, ui.item.id) );
62
+ // now select it
63
+ jQuery(obj).val(ui.item.id);
64
+ jQuery(obj + "_ac").removeClass('ui-autocomplete-start');
65
+ }
66
+ });
67
+
68
+ jQuery(obj + "_ac").click(function() {
69
+
70
+ var search = jQuery(obj + "_ac").val();
71
+ // if the value is prefilled, we pass a empty string
72
+ if ( search == c_text)
73
+ search = '';
74
+ // pass empty string as value to search for, displaying all results
75
+ jQuery(obj + "_ac").autocomplete('search', search );
76
+ });
77
+ }
admin/js/plupload.handler.js CHANGED
@@ -1,244 +1,244 @@
1
- /**
2
- * NextGEN Gallery - plupload Handlers
3
- *
4
- * Built on top of the plupload library
5
- * http://www.plupload.com version 1.4.2
6
- *
7
- * version 1.0.0
8
- */
9
-
10
- // on load change the upload to plupload
11
- function initUploader() {
12
-
13
- jQuery(document).ready(function($){
14
-
15
- /* Not working in chrome, needs rework
16
- var dropElm = jQuery('#' + uploader.settings.drop_element);
17
- if (dropElm.length && uploader.features.dragdrop) {
18
- dropElm.bind('dragenter', function() {
19
- jQuery(this).css('border', '3px dashed #cccccc');
20
- });
21
- dropElm.bind('dragout drop', function() {
22
- jQuery(this).css('border', 'none');
23
- });
24
- }*/
25
-
26
- // enable or disable the resize feature
27
- jQuery('#image_resize').bind('change', function() {
28
- var arg = jQuery(this).prop('checked');
29
- setResize( arg );
30
-
31
- if ( arg )
32
- setUserSetting('ngg_upload_resize', '1');
33
- else
34
- deleteUserSetting('ngg_upload_resize');
35
- });
36
-
37
- // get user settings from cookie
38
- setResize( getUserSetting('ngg_upload_resize', false) );
39
-
40
- if ( uploader.features.dragdrop )
41
- jQuery('.ngg-dragdrop-info').show();
42
-
43
- jQuery("#uploadimage_btn").after("<input class='button-primary' type='button' name='uploadimage' id='plupload_btn' value='" + uploader.settings.i18n.upload + "' />")
44
- .remove();
45
- jQuery("#plupload_btn").click( function() { uploader.start(); } );
46
- });
47
- }
48
-
49
- // called when a file is added
50
- function fileQueued( fileObj ) {
51
- debug('[FilesAdded]', fileObj);
52
-
53
- filesize = " (" + plupload.formatSize(fileObj.size) + ") ";
54
- jQuery("#txtFileName").val(fileObj.name);
55
- jQuery("#uploadQueue")
56
- .append("<div id='" + fileObj.id + "' class='nggUploadItem'> [<a href=''>" + uploader.settings.i18n.remove + "</a>] " + fileObj.name + filesize + "</div>")
57
- .children("div:last").slideDown("slow")
58
- .end();
59
- jQuery('#' + fileObj.id + ' a').click(function(e) {
60
- jQuery('#' + fileObj.id).remove();
61
- uploader.removeFile(fileObj);
62
- e.preventDefault();
63
- });
64
- }
65
-
66
- // called before the uploads start
67
- function uploadStart(fileObj) {
68
- debug('[uploadStart]');
69
- nggProgressBar.init(nggAjaxOptions);
70
- // check if a gallery is selected
71
- if (jQuery('#galleryselect').val() > "0") {
72
- debug('[gallery selected]');
73
- // update the selected gallery in the post_params
74
- uploader.settings.multipart_params.galleryselect = jQuery('#galleryselect').val();
75
- } else {
76
- debug('[gallery not selected]');
77
- jQuery('#uploadimage_form').prepend("<input type=\"hidden\" name=\"swf_callback\" value=\"-1\">");
78
- jQuery("#uploadimage_form").submit();
79
- }
80
- return true;
81
- }
82
-
83
- // called during the upload progress
84
- function uploadProgress(fileObj, bytesDone, bytesTotal) {
85
- var percent = Math.ceil((bytesDone / bytesTotal) * 100);
86
- debug('[uploadProgress]', fileObj.name + ' : ' + percent + "%");
87
- nggProgressBar.increase( percent );
88
- jQuery("#progressbar span").text(percent + "% - " + fileObj.name);
89
- }
90
-
91
- // called when all files are uploaded
92
- function uploadComplete(fileObj) {
93
- debug('[uploadComplete]');
94
-
95
- // Upload the next file until queue is empty
96
- if ( uploader.total.queued == 0) {
97
- //TODO: we submit here no error code
98
- jQuery('#uploadimage_form').prepend("<input type=\"hidden\" name=\"swf_callback\" value=\"0\">");
99
- nggProgressBar.finished();
100
- jQuery("#uploadimage_form").submit();
101
- }
102
- }
103
-
104
- // called when the file is uploaded
105
- function uploadSuccess(fileObj, serverData) {
106
- debug('[uploadSuccess]', serverData);
107
-
108
- if (serverData.response != 0)
109
- nggProgressBar.addNote("<strong>ERROR</strong>: " + fileObj.name + " : " + serverData.response);
110
-
111
- jQuery("#" + fileObj.id).hide("slow");
112
- jQuery("#" + fileObj.id).remove();
113
- }
114
-
115
- function cancelUpload() {
116
- uploader.stop();
117
- jQuery.each(uploader.files, function(i,file) {
118
- if (file.status == plupload.STOPPED)
119
- jQuery('#' + file.id).remove();
120
- });
121
- }
122
-
123
- function uploadError(fileObj, errorCode, message) {
124
- debug('[uploadError]', errorCode, message);
125
- switch (errorCode) {
126
- case plupload.FAILED:
127
- error_name = fileObj.name + " : " + pluploadL10n.upload_failed;
128
- break;
129
- case plupload.FILE_EXTENSION_ERROR:
130
- error_name = fileObj.name + " : " + pluploadL10n.invalid_filetype;
131
- break;
132
- case plupload.FILE_SIZE_ERROR:
133
- error_name = fileObj.name + " : " + pluploadL10n.upload_limit_exceeded;
134
- break;
135
- case plupload.IMAGE_FORMAT_ERROR:
136
- error_name = fileObj.name + " : " + pluploadL10n.not_an_image;
137
- break;
138
- case plupload.IMAGE_MEMORY_ERROR:
139
- error_name = fileObj.name + " : " + pluploadL10n.image_memory_exceeded;
140
- break;
141
- case plupload.IMAGE_DIMENSIONS_ERROR:
142
- error_name = fileObj.name + " : " + pluploadL10n.image_dimensions_exceeded;
143
- break;
144
- case plupload.GENERIC_ERROR:
145
- error_name = pluploadL10n.upload_failed;
146
- break;
147
- case plupload.IO_ERROR:
148
- error_name = pluploadL10n.io_error;
149
- break;
150
- case plupload.HTTP_ERROR:
151
- error_name = pluploadL10n.http_error;
152
- break;
153
- case plupload.INIT_ERROR:
154
- /* what should we do in this case ? */
155
- //switchUploader(0);
156
- //jQuery('.upload-html-bypass').hide();
157
- break;
158
- case plupload.SECURITY_ERROR:
159
- error_name = pluploadL10n.security_error;
160
- break;
161
- case plupload.UPLOAD_ERROR.UPLOAD_STOPPED:
162
- case plupload.UPLOAD_ERROR.FILE_CANCELLED:
163
- break;
164
- default:
165
- FileError(fileObj, pluploadL10n.default_error);
166
- }
167
- nggProgressBar.addNote("<strong>ERROR " + error_name + " </strong>: " + message);
168
- jQuery("#" + fileObj.id).hide("slow");
169
- jQuery("#" + fileObj.id).remove();
170
- }
171
-
172
- // client side resize feature
173
- function setResize(arg) {
174
- if ( arg ) {
175
- debug('[enable resize]');
176
- if ( uploader.features.jpgresize )
177
- uploader.settings['resize'] = { width: resize_width, height: resize_height, quality: 100 };
178
- else
179
- uploader.settings.multipart_params.image_resize = true;
180
- } else {
181
- debug('[disable resize]');
182
- delete(uploader.settings.resize);
183
- delete(uploader.settings.multipart_params.image_resize);
184
- }
185
- }
186
-
187
- function debug() {
188
- if ( uploader.settings.debug ) {
189
- plupload.each(arguments, function(message) {
190
- var exceptionMessage, exceptionValues = [];
191
-
192
- // Check for an exception object and print it nicely
193
- if (typeof message === "object" && typeof message.name === "string" && typeof message.message === "string") {
194
- for (var key in message) {
195
- if (message.hasOwnProperty(key)) {
196
- exceptionValues.push(key + ": " + message[key]);
197
- }
198
- }
199
- exceptionMessage = exceptionValues.join("\n") || "";
200
- exceptionValues = exceptionMessage.split("\n");
201
- exceptionMessage = "EXCEPTION: " + exceptionValues.join("\nEXCEPTION: ");
202
- if (window.console)
203
- console.log(exceptionMessage);
204
- else
205
- debugConsole(exceptionMessage);
206
- } else {
207
- if (window.console)
208
- console.log(message);
209
- else
210
- debugConsole(message);
211
- }
212
- });
213
- }
214
- };
215
-
216
- function debugConsole(message) {
217
- var console, documentForm;
218
-
219
- try {
220
- console = document.getElementById("plupload_Console");
221
-
222
- if (!console) {
223
- documentForm = document.createElement("form");
224
- document.getElementsByTagName("body")[0].appendChild(documentForm);
225
-
226
- console = document.createElement("textarea");
227
- console.id = "plupload_Console";
228
- console.style.fontFamily = "monospace";
229
- console.setAttribute("wrap", "off");
230
- console.wrap = "off";
231
- console.style.overflow = "auto";
232
- console.style.width = "99%";
233
- console.style.height = "350px";
234
- console.style.margin = "5px";
235
- documentForm.appendChild(console);
236
- }
237
-
238
- console.value += message + "\n";
239
-
240
- console.scrollTop = console.scrollHeight - console.clientHeight;
241
- } catch (ex) {
242
- alert("Exception: " + ex.name + " Message: " + ex.message);
243
- }
244
- };
1
+ /**
2
+ * NextGEN Gallery - plupload Handlers
3
+ *
4
+ * Built on top of the plupload library
5
+ * http://www.plupload.com version 1.4.2
6
+ *
7
+ * version 1.0.0
8
+ */
9
+
10
+ // on load change the upload to plupload
11
+ function initUploader() {
12
+
13
+ jQuery(document).ready(function($){
14
+
15
+ /* Not working in chrome, needs rework
16
+ var dropElm = jQuery('#' + uploader.settings.drop_element);
17
+ if (dropElm.length && uploader.features.dragdrop) {
18
+ dropElm.bind('dragenter', function() {
19
+ jQuery(this).css('border', '3px dashed #cccccc');
20
+ });
21
+ dropElm.bind('dragout drop', function() {
22
+ jQuery(this).css('border', 'none');
23
+ });
24
+ }*/
25
+
26
+ // enable or disable the resize feature
27
+ jQuery('#image_resize').bind('change', function() {
28
+ var arg = jQuery(this).prop('checked');
29
+ setResize( arg );
30
+
31
+ if ( arg )
32
+ setUserSetting('ngg_upload_resize', '1');
33
+ else
34
+ deleteUserSetting('ngg_upload_resize');
35
+ });
36
+
37
+ // get user settings from cookie
38
+ setResize( getUserSetting('ngg_upload_resize', false) );
39
+
40
+ if ( uploader.features.dragdrop )
41
+ jQuery('.ngg-dragdrop-info').show();
42
+
43
+ jQuery("#uploadimage_btn").after("<input class='button-primary' type='button' name='uploadimage' id='plupload_btn' value='" + uploader.settings.i18n.upload + "' />")
44
+ .remove();
45
+ jQuery("#plupload_btn").click( function() { uploader.start(); } );
46
+ });
47
+ }
48
+
49
+ // called when a file is added
50
+ function fileQueued( fileObj ) {
51
+ debug('[FilesAdded]', fileObj);
52
+
53
+ filesize = " (" + plupload.formatSize(fileObj.size) + ") ";
54
+ jQuery("#txtFileName").val(fileObj.name);
55
+ jQuery("#uploadQueue")
56
+ .append("<div id='" + fileObj.id + "' class='nggUploadItem'> [<a href=''>" + uploader.settings.i18n.remove + "</a>] " + fileObj.name + filesize + "</div>")
57
+ .children("div:last").slideDown("slow")
58
+ .end();
59
+ jQuery('#' + fileObj.id + ' a').click(function(e) {
60
+ jQuery('#' + fileObj.id).remove();
61
+ uploader.removeFile(fileObj);
62
+ e.preventDefault();
63
+ });
64
+ }
65
+
66
+ // called before the uploads start
67
+ function uploadStart(fileObj) {
68
+ debug('[uploadStart]');
69
+ nggProgressBar.init(nggAjaxOptions);
70
+ // check if a gallery is selected
71
+ if (jQuery('#galleryselect').val() > "0") {
72
+ debug('[gallery selected]');
73
+ // update the selected gallery in the post_params
74
+ uploader.settings.multipart_params.galleryselect = jQuery('#galleryselect').val();
75
+ } else {
76
+ debug('[gallery not selected]');
77
+ jQuery('#uploadimage_form').prepend("<input type=\"hidden\" name=\"swf_callback\" value=\"-1\">");
78
+ jQuery("#uploadimage_form").submit();
79
+ }
80
+ return true;
81
+ }
82
+
83
+ // called during the upload progress
84
+ function uploadProgress(fileObj, bytesDone, bytesTotal) {
85
+ var percent = Math.ceil((bytesDone / bytesTotal) * 100);
86
+ debug('[uploadProgress]', fileObj.name + ' : ' + percent + "%");
87
+ nggProgressBar.increase( percent );
88
+ jQuery("#progressbar span").text(percent + "% - " + fileObj.name);
89
+ }
90
+
91
+ // called when all files are uploaded
92
+ function uploadComplete(fileObj) {
93
+ debug('[uploadComplete]');
94
+
95
+ // Upload the next file until queue is empty
96
+ if ( uploader.total.queued == 0) {
97
+ //TODO: we submit here no error code
98
+ jQuery('#uploadimage_form').prepend("<input type=\"hidden\" name=\"swf_callback\" value=\"0\">");
99
+ nggProgressBar.finished();
100
+ jQuery("#uploadimage_form").submit();
101
+ }
102
+ }
103
+
104
+ // called when the file is uploaded
105
+ function uploadSuccess(fileObj, serverData) {
106
+ debug('[uploadSuccess]', serverData);
107
+
108
+ if (serverData.response != 0)
109
+ nggProgressBar.addNote("<strong>ERROR</strong>: " + fileObj.name + " : " + serverData.response);
110
+
111
+ jQuery("#" + fileObj.id).hide("slow");
112
+ jQuery("#" + fileObj.id).remove();
113
+ }
114
+
115
+ function cancelUpload() {
116
+ uploader.stop();
117
+ jQuery.each(uploader.files, function(i,file) {
118
+ if (file.status == plupload.STOPPED)
119
+ jQuery('#' + file.id).remove();
120
+ });
121
+ }
122
+
123
+ function uploadError(fileObj, errorCode, message) {
124
+ debug('[uploadError]', errorCode, message);
125
+ switch (errorCode) {
126
+ case plupload.FAILED:
127
+ error_name = fileObj.name + " : " + pluploadL10n.upload_failed;
128
+ break;
129
+ case plupload.FILE_EXTENSION_ERROR:
130
+ error_name = fileObj.name + " : " + pluploadL10n.invalid_filetype;
131
+ break;
132
+ case plupload.FILE_SIZE_ERROR:
133
+ error_name = fileObj.name + " : " + pluploadL10n.upload_limit_exceeded;
134
+ break;
135
+ case plupload.IMAGE_FORMAT_ERROR:
136
+ error_name = fileObj.name + " : " + pluploadL10n.not_an_image;
137
+ break;
138
+ case plupload.IMAGE_MEMORY_ERROR:
139
+ error_name = fileObj.name + " : " + pluploadL10n.image_memory_exceeded;
140
+ break;
141
+ case plupload.IMAGE_DIMENSIONS_ERROR:
142
+ error_name = fileObj.name + " : " + pluploadL10n.image_dimensions_exceeded;
143
+ break;
144
+ case plupload.GENERIC_ERROR:
145
+ error_name = pluploadL10n.upload_failed;
146
+ break;
147
+ case plupload.IO_ERROR:
148
+ error_name = pluploadL10n.io_error;
149
+ break;
150
+ case plupload.HTTP_ERROR:
151
+ error_name = pluploadL10n.http_error;
152
+ break;
153
+ case plupload.INIT_ERROR:
154
+ /* what should we do in this case ? */
155
+ //switchUploader(0);
156
+ //jQuery('.upload-html-bypass').hide();
157
+ break;
158
+ case plupload.SECURITY_ERROR:
159
+ error_name = pluploadL10n.security_error;
160
+ break;
161
+ case plupload.UPLOAD_ERROR.UPLOAD_STOPPED:
162
+ case plupload.UPLOAD_ERROR.FILE_CANCELLED:
163
+ break;
164
+ default:
165
+ FileError(fileObj, pluploadL10n.default_error);
166
+ }
167
+ nggProgressBar.addNote("<strong>ERROR " + error_name + " </strong>: " + message);
168
+ jQuery("#" + fileObj.id).hide("slow");
169
+ jQuery("#" + fileObj.id).remove();
170
+ }
171
+
172
+ // client side resize feature
173
+ function setResize(arg) {
174
+ if ( arg ) {
175
+ debug('[enable resize]');
176
+ if ( uploader.features.jpgresize )
177
+ uploader.settings['resize'] = { width: resize_width, height: resize_height, quality: 100 };
178
+ else
179
+ uploader.settings.multipart_params.image_resize = true;
180
+ } else {
181
+ debug('[disable resize]');
182
+ delete(uploader.settings.resize);
183
+ delete(uploader.settings.multipart_params.image_resize);
184
+ }
185
+ }
186
+
187
+ function debug() {
188
+ if ( uploader.settings.debug ) {
189
+ plupload.each(arguments, function(message) {
190
+ var exceptionMessage, exceptionValues = [];
191
+
192
+ // Check for an exception object and print it nicely
193
+ if (typeof message === "object" && typeof message.name === "string" && typeof message.message === "string") {
194
+ for (var key in message) {
195
+ if (message.hasOwnProperty(key)) {
196
+ exceptionValues.push(key + ": " + message[key]);
197
+ }
198
+ }
199
+ exceptionMessage = exceptionValues.join("\n") || "";
200
+ exceptionValues = exceptionMessage.split("\n");
201
+ exceptionMessage = "EXCEPTION: " + exceptionValues.join("\nEXCEPTION: ");
202
+ if (window.console)
203
+ console.log(exceptionMessage);
204
+ else
205
+ debugConsole(exceptionMessage);
206
+ } else {
207
+ if (window.console)
208
+ console.log(message);
209
+ else
210
+ debugConsole(message);
211
+ }
212
+ });
213
+ }
214
+ };
215
+
216
+ function debugConsole(message) {
217
+ var console, documentForm;
218
+
219
+ try {
220
+ console = document.getElementById("plupload_Console");
221
+
222
+ if (!console) {
223
+ documentForm = document.createElement("form");
224
+ document.getElementsByTagName("body")[0].appendChild(documentForm);
225
+
226
+ console = document.createElement("textarea");
227
+ console.id = "plupload_Console";
228
+ console.style.fontFamily = "monospace";
229
+ console.setAttribute("wrap", "off");
230
+ console.wrap = "off";
231
+ console.style.overflow = "auto";
232
+ console.style.width = "99%";
233
+ console.style.height = "350px";
234
+ console.style.margin = "5px";
235
+ documentForm.appendChild(console);
236
+ }
237
+
238
+ console.value += message + "\n";
239
+
240
+ console.scrollTop = console.scrollHeight - console.clientHeight;
241
+ } catch (ex) {
242
+ alert("Exception: " + ex.name + " Message: " + ex.message);
243
+ }
244
+ };
admin/publish.php CHANGED
@@ -1,64 +1,64 @@
1
- <?php
2
-
3
- require_once( dirname( dirname(__FILE__) ) . '/ngg-config.php');
4
- require_once( NGGALLERY_ABSPATH . '/lib/image.php' );
5
-
6
- if ( !is_user_logged_in() )
7
- die(__('Cheatin&#8217; uh?'));
8
-
9
- if ( !current_user_can('NextGEN Manage gallery') )
10
- die(__('Cheatin&#8217; uh?'));
11
-
12
- if ( !current_user_can( 'publish_posts' ) )
13
- die(__('Cheatin&#8217; uh?'));
14
-
15
- global $wpdb;
16
-
17
- $id = (int) $_GET['id'];
18
-
19
- // let's get the image data
20
- $picture = nggdb::find_image($id);
21
-
22
- // use defaults the first time
23
- $width = empty ($ngg->options['publish_width']) ? $ngg->options['thumbwidth'] : $ngg->options['publish_width'];
24
- $height = empty ($ngg->options['publish_height']) ? $ngg->options['thumbheight'] : $ngg->options['publish_height'];
25
- $align = empty ($ngg->options['publish_align']) ? 'none' : $ngg->options['publish_align'];
26
-
27
- ?>
28
-
29
- <form id="form-publish-post" method="POST" accept-charset="utf-8">
30
- <?php wp_nonce_field('publish-post') ?>
31
- <input type="hidden" name="page" value="publish-post" />
32
- <input type="hidden" name="pid" value="<?php echo $picture->pid; ?>" />
33
- <table width="100%" border="0" cellspacing="3" cellpadding="3" >
34
- <tr valign="top">
35
- <th align="left"><?php _e('Post title','nggallery') ?></th>
36
- <td><input type="text" size="70" name="post_title" value="<?php echo esc_attr( $picture->alttext); ?>" />
37
- <br /><small><?php _e('Enter the post title ','nggallery') ?></small></td>
38
- </tr>
39
- <tr valign="top">
40
- <th align="left"><?php _e('Width x height (in pixel)','nggallery') ?></th>
41
- <td><input type="text" size="5" maxlength="5" name="width" value="<?php echo $width; ?>" /> x <input type="text" size="5" maxlength="5" name="height" value="<?php echo $height; ?>" />
42
- <br /><small><?php _e('Size of the image','nggallery') ?></small></td>
43
- </tr>
44
- <tr valign="top">
45
- <th align="left"><?php _e('Alignment','nggallery') ?></th>
46
- <td><input type="radio" value="none" <?php checked('none', $align); ?> id="image-align-none" name="align"/>
47
- <label class="align" for="image-align-none"><?php _e('None','nggallery'); ?></label>
48
- <input type="radio" value="left" <?php checked('left', $align); ?> id="image-align-left" name="align"/>
49
- <label class="align" for="image-align-left"><?php _e('Left','nggallery'); ?></label>
50
- <input type="radio" value="center" <?php checked('center', $align); ?> id="image-align-center" name="align"/>
51
- <label class="align" for="image-align-center"><?php _e('Center','nggallery'); ?></label>
52
- <input type="radio" value="right" <?php checked('right', $align); ?> id="image-align-right" name="align"/>
53
- <label class="align" for="image-align-right"><?php _e('Right','nggallery'); ?></label>
54
- </td>
55
- </tr>
56
- <tr align="right">
57
- <td colspan="2" class="submit">
58
- <input class="button-primary" type="submit" name="publish" value="<?php _e('Publish', 'nggallery');?>" />
59
- &nbsp;
60
- <input class="button-secondary" type="submit" name="draft" value="&nbsp;<?php _e('Draft', 'nggallery'); ?>&nbsp;" />
61
- </td>
62
- </tr>
63
- </table>
64
  </form>
1
+ <?php
2
+
3
+ require_once( dirname( dirname(__FILE__) ) . '/ngg-config.php');
4
+ require_once( NGGALLERY_ABSPATH . '/lib/image.php' );
5
+
6
+ if ( !is_user_logged_in() )
7
+ die(__('Cheatin&#8217; uh?'));
8
+
9
+ if ( !current_user_can('NextGEN Manage gallery') )
10
+ die(__('Cheatin&#8217; uh?'));
11
+
12
+ if ( !current_user_can( 'publish_posts' ) )
13
+ die(__('Cheatin&#8217; uh?'));
14
+
15
+ global $wpdb;
16
+
17
+ $id = (int) $_GET['id'];
18
+
19
+ // let's get the image data
20
+ $picture = nggdb::find_image($id);
21
+
22
+ // use defaults the first time
23
+ $width = empty ($ngg->options['publish_width']) ? $ngg->options['thumbwidth'] : $ngg->options['publish_width'];
24
+ $height = empty ($ngg->options['publish_height']) ? $ngg->options['thumbheight'] : $ngg->options['publish_height'];
25
+ $align = empty ($ngg->options['publish_align']) ? 'none' : $ngg->options['publish_align'];
26
+
27
+ ?>
28
+
29
+ <form id="form-publish-post" method="POST" accept-charset="utf-8">
30
+ <?php wp_nonce_field('publish-post') ?>
31
+ <input type="hidden" name="page" value="publish-post" />
32
+ <input type="hidden" name="pid" value="<?php echo $picture->pid; ?>" />
33
+ <table width="100%" border="0" cellspacing="3" cellpadding="3" >
34
+ <tr valign="top">
35
+ <th align="left"><?php _e('Post title','nggallery') ?></th>
36
+ <td><input type="text" size="70" name="post_title" value="<?php echo esc_attr( $picture->alttext); ?>" />
37
+ <br /><small><?php _e('Enter the post title ','nggallery') ?></small></td>
38
+ </tr>
39
+ <tr valign="top">
40
+ <th align="left"><?php _e('Width x height (in pixel)','nggallery') ?></th>
41
+ <td><input type="text" size="5" maxlength="5" name="width" value="<?php echo $width; ?>" /> x <input type="text" size="5" maxlength="5" name="height" value="<?php echo $height; ?>" />
42
+ <br /><small><?php _e('Size of the image','nggallery') ?></small></td>
43
+ </tr>
44
+ <tr valign="top">
45
+ <th align="left"><?php _e('Alignment','nggallery') ?></th>
46
+ <td><input type="radio" value="none" <?php checked('none', $align); ?> id="image-align-none" name="align"/>
47
+ <label class="align" for="image-align-none"><?php _e('None','nggallery'); ?></label>
48
+ <input type="radio" value="left" <?php checked('left', $align); ?> id="image-align-left" name="align"/>
49
+ <label class="align" for="image-align-left"><?php _e('Left','nggallery'); ?></label>
50
+ <input type="radio" value="center" <?php checked('center', $align); ?> id="image-align-center" name="align"/>
51
+ <label class="align" for="image-align-center"><?php _e('Center','nggallery'); ?></label>
52
+ <input type="radio" value="right" <?php checked('right', $align); ?> id="image-align-right" name="align"/>
53
+ <label class="align" for="image-align-right"><?php _e('Right','nggallery'); ?></label>
54
+ </td>
55
+ </tr>
56
+ <tr align="right">
57
+ <td colspan="2" class="submit">
58
+ <input class="button-primary" type="submit" name="publish" value="<?php _e('Publish', 'nggallery');?>" />
59
+ &nbsp;
60
+ <input class="button-secondary" type="submit" name="draft" value="&nbsp;<?php _e('Draft', 'nggallery'); ?>&nbsp;" />
61
+ </td>
62
+ </tr>
63
+ </table>
64
  </form>
changelog.txt CHANGED
@@ -1,5 +1,9 @@
1
  NextGEN Gallery
2
  by Photocrati Media
 
 
 
 
3
  = V1.9.11 - 02.12.2013 =
4
  * NEW: Added the ability to detect JQuery conflicts on NGG Admin Pages and auto-resolve
5
  * Changed: Added "nggalbum" shortcode. Use this when Jetpack is installed.
1
  NextGEN Gallery
2
  by Photocrati Media
3
+
4
+ = V1.9.12 - 02.15.2013 =
5
+ * Fixed: jQuery Conflict Detection was trying to dequeue irremovable scripts
6
+
7
  = V1.9.11 - 02.12.2013 =
8
  * NEW: Added the ability to detect JQuery conflicts on NGG Admin Pages and auto-resolve
9
  * Changed: Added "nggalbum" shortcode. Use this when Jetpack is installed.
lib/multisite.php CHANGED
@@ -1,57 +1,57 @@
1
- <?php
2
- /**
3
- * Main PHP Class for Multisite setup
4
- *
5
- * @author Alex Rabe
6
- *
7
- *
8
- */
9
- class nggWPMU{
10
-
11
- /**
12
- * Check the Quota under WPMU. Only needed for this case
13
- *
14
- * @class nggWPMU
15
- * @return bool $result
16
- */
17
- function check_quota() {
18
- if ( get_site_option( 'upload_space_check_disabled' ) )
19
- return false;
20
-
21
- if ( (is_multisite()) && nggWPMU::wpmu_enable_function('wpmuQuotaCheck'))
22
- if( $error = upload_is_user_over_quota( false ) ) {
23
- nggGallery::show_error( __( 'Sorry, you have used your space allocation. Please delete some files to upload more files.','nggallery' ) );
24
- return true;
25
- }
26
- return false;
27
- }
28
-
29
- /**
30
- * Check for site admin
31
- *
32
- * @return
33
- */
34
- function wpmu_site_admin() {
35
-
36
- if ( function_exists('is_super_admin') )
37
- if ( is_super_admin() )
38
- return true;
39
-
40
- return false;
41
- }
42
-
43
- /**
44
- * Check for site wide options
45
- *
46
- * @param string $value
47
- * @return value
48
- */
49
- function wpmu_enable_function($value) {
50
- if (is_multisite()) {
51
- $ngg_options = get_site_option('ngg_options');
52
- return $ngg_options[$value];
53
- }
54
- // if this is not WPMU, enable it !
55
- return true;
56
- }
57
- }
1
+ <?php
2
+ /**
3
+ * Main PHP Class for Multisite setup
4
+ *
5
+ * @author Alex Rabe
6
+ *
7
+ *
8
+ */
9
+ class nggWPMU{
10
+
11
+ /**
12
+ * Check the Quota under WPMU. Only needed for this case
13
+ *
14
+ * @class nggWPMU
15
+ * @return bool $result
16
+ */
17
+ function check_quota() {
18
+ if ( get_site_option( 'upload_space_check_disabled' ) )
19
+ return false;
20
+
21
+ if ( (is_multisite()) && nggWPMU::wpmu_enable_function('wpmuQuotaCheck'))
22
+ if( $error = upload_is_user_over_quota( false ) ) {
23
+ nggGallery::show_error( __( 'Sorry, you have used your space allocation. Please delete some files to upload more files.','nggallery' ) );
24
+ return true;
25
+ }
26
+ return false;
27
+ }
28
+
29
+ /**
30
+ * Check for site admin
31
+ *
32
+ * @return
33
+ */
34
+ function wpmu_site_admin() {
35
+
36
+ if ( function_exists('is_super_admin') )
37
+ if ( is_super_admin() )
38
+ return true;
39
+
40
+ return false;
41
+ }
42
+
43
+ /**
44
+ * Check for site wide options
45
+ *
46
+ * @param string $value
47
+ * @return value
48
+ */
49
+ function wpmu_enable_function($value) {
50
+ if (is_multisite()) {
51
+ $ngg_options = get_site_option('ngg_options');
52
+ return $ngg_options[$value];
53
+ }
54
+ // if this is not WPMU, enable it !
55
+ return true;
56
+ }
57
+ }
nggallery.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.nextgen-gallery.com/
5
  Description: A NextGENeration Photo Gallery for WordPress
6
  Author: Photocrati
7
  Author URI: http://www.photocrati.com/
8
- Version: 1.9.11
9
 
10
  Copyright (c) 2007-2011 by Alex Rabe & NextGEN DEV-Team
11
  Copyright (c) 2012 Photocrati Media
@@ -45,7 +45,7 @@ if (!class_exists('E_Clean_Exit')) {
45
  if (!class_exists('nggLoader')) {
46
  class nggLoader {
47
 
48
- var $version = '1.9.11';
49
  var $dbversion = '1.8.1';
50
  var $minimum_WP = '3.5';
51
  var $donators = 'http://www.nextgen-gallery.com/donators.php';
5
  Description: A NextGENeration Photo Gallery for WordPress
6
  Author: Photocrati
7
  Author URI: http://www.photocrati.com/
8
+ Version: 1.9.12
9
 
10
  Copyright (c) 2007-2011 by Alex Rabe & NextGEN DEV-Team
11
  Copyright (c) 2012 Photocrati Media
45
  if (!class_exists('nggLoader')) {
46
  class nggLoader {
47
 
48
+ var $version = '1.9.12';
49
  var $dbversion = '1.8.1';
50
  var $minimum_WP = '3.5';
51
  var $donators = 'http://www.nextgen-gallery.com/donators.php';
readme.txt CHANGED
@@ -202,6 +202,9 @@ For more information, feel free to visit the official website for the NextGEN Ga
202
 
203
  == Changelog ==
204
 
 
 
 
205
  = V1.9.11 - 02.12.2013 =
206
  * NEW: Added the ability to detect JQuery conflicts on NGG Admin Pages and auto-resolve
207
  * Changed: Added "nggalbum" shortcode. Use this when Jetpack is installed.
202
 
203
  == Changelog ==
204
 
205
+ = V1.9.12 - 02.15.2013 =
206
+ * Fixed: jQuery Conflict Detection was trying to dequeue irremovable scripts
207
+
208
  = V1.9.11 - 02.12.2013 =
209
  * NEW: Added the ability to detect JQuery conflicts on NGG Admin Pages and auto-resolve
210
  * Changed: Added "nggalbum" shortcode. Use this when Jetpack is installed.
xml/ajax.php CHANGED
@@ -1,40 +1,40 @@
1
- <?php
2
- // see http://codex.wordpress.org/AJAX_in_Plugins
3
-
4
- // check if we have all needed parameter
5
- if ( !defined('ABSPATH') || (!isset($_GET['galleryid']) || !is_numeric($_GET['galleryid'])) || (!isset($_GET['p']) || !is_numeric($_GET['p'])) || !isset($_GET['type'])){
6
- // if it's not ajax request, back to main page
7
- if($_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest')
8
- header('Location: http://'. $_SERVER['HTTP_HOST']);
9
- die();
10
- }
11
-
12
- switch ($_GET['type']) {
13
- case 'gallery':
14
-
15
- // get the navigation page
16
- set_query_var('nggpage', intval($_GET['nggpage']));
17
-
18
- // get the current page/post id
19
- set_query_var('pageid', intval($_GET['p']));
20
- set_query_var('show', 'gallery');
21
- $GLOBALS['id'] = intval($_GET['p']);
22
-
23
- echo nggShowGallery( intval($_GET['galleryid']) );
24
-
25
- break;
26
- case 'browser':
27
-
28
- // which image should be shown ?
29
- set_query_var('pid', intval($_GET['pid']));
30
-
31
- // get the current page/post id
32
- set_query_var('pageid', intval($_GET['p']));
33
- $GLOBALS['id'] = intval($_GET['p']);
34
-
35
- echo nggShowImageBrowser( intval($_GET['galleryid']) );
36
-
37
- break;
38
- default:
39
- echo 'Wrong request type specified.';
40
  }
1
+ <?php
2
+ // see http://codex.wordpress.org/AJAX_in_Plugins
3
+
4
+ // check if we have all needed parameter
5
+ if ( !defined('ABSPATH') || (!isset($_GET['galleryid']) || !is_numeric($_GET['galleryid'])) || (!isset($_GET['p']) || !is_numeric($_GET['p'])) || !isset($_GET['type'])){
6
+ // if it's not ajax request, back to main page
7
+ if($_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest')
8
+ header('Location: http://'. $_SERVER['HTTP_HOST']);
9
+ die();
10
+ }
11
+
12
+ switch ($_GET['type']) {
13
+ case 'gallery':
14
+
15
+ // get the navigation page
16
+ set_query_var('nggpage', intval($_GET['nggpage']));
17
+
18
+ // get the current page/post id
19
+ set_query_var('pageid', intval($_GET['p']));
20
+ set_query_var('show', 'gallery');
21
+ $GLOBALS['id'] = intval($_GET['p']);
22
+
23
+ echo nggShowGallery( intval($_GET['galleryid']) );
24
+
25
+ break;
26
+ case 'browser':
27
+
28
+ // which image should be shown ?
29
+ set_query_var('pid', intval($_GET['pid']));
30
+
31
+ // get the current page/post id
32
+ set_query_var('pageid', intval($_GET['p']));
33
+ $GLOBALS['id'] = intval($_GET['p']);
34
+
35
+ echo nggShowImageBrowser( intval($_GET['galleryid']) );
36
+
37
+ break;
38
+ default:
39
+ echo 'Wrong request type specified.';
40
  }
xml/json.php CHANGED
@@ -1,275 +1,275 @@
1
- <?php
2
- /**
3
- * REST Application Programming Interface PHP class for the WordPress plugin NextGEN Gallery
4
- * Should emulate some kind of Flickr JSON callback : ?callback=json&format=json&api_key=1234567890&method=search&term=myterm
5
- *
6
- * @version 1.1.0
7
- * @author Alex Rabe
8
- *
9
- * @require PHP 5.2.0 or higher
10
- *
11
- */
12
-
13
- class nggAPI {
14
-
15
- /**
16
- * $_GET Variables
17
- *
18
- * @since 1.5.0
19
- * @access private
20
- * @var string
21
- */
22
- var $format = false; // $_GET['format'] : Return a XML oder JSON output
23
- var $api_key = false; // $_GET['api_key'] : Protect the access via a random key (required if user is not logged into backend)
24
- var $method = false; // $_GET['method'] : search | gallery | image | album | tag | autocomplete
25
- var $term = false; // $_GET['term'] : The search term (required for method search | tag)
26
- var $id = false; // $_GET['id'] : object id (required for method gallery | image | album )
27
- var $limit = false; // $_GET['limit'] : maximum of images which we request
28
- var $type = false; // $_GET['type'] : gallery | image | album (required for method autocomplete)
29
-
30
- /**
31
- * Contain the final output
32
- *
33
- * @since 1.5.0
34
- * @access private
35
- * @var string
36
- */
37
- var $output = '';
38
-
39
- /**
40
- * Holds the requested information as array
41
- *
42
- * @since 1.5.0
43
- * @access private
44
- * @var array
45
- */
46
- var $result = '';
47
-
48
- /**
49
- * Init the variables
50
- *
51
- */
52
- function __construct() {
53
-
54
- if ( !defined('ABSPATH') )
55
- die('You are not allowed to call this page directly.');
56
-
57
- if ( !function_exists('json_encode') )
58
- wp_die('Json_encode not available. You need to use PHP 5.2');
59
-
60
- // Read the parameter on init
61
- $this->format = isset($_GET['format']) ? strtolower( $_GET['format'] ) : false;
62
- $this->api_key = isset($_GET['api_key'])? $_GET['api_key'] : false;
63
- $this->method = isset($_GET['method']) ? strtolower( $_GET['method'] ) : false;
64
- $this->term = isset($_GET['term']) ? urldecode( $_GET['term'] ) : false;
65
- $this->id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
66
- $this->limit = isset($_GET['limit']) ? (int) $_GET['limit'] : 0;
67
- $this->type = isset($_GET['type']) ? strtolower( $_GET['type'] ) : false;
68
- $this->result = array();
69
- $this->list = false;
70
-
71
- $this->start_process();
72
- $this->render_output();
73
- }
74
-
75
- function start_process() {
76
-
77
- global $ngg;
78
-
79
- if ( !$this->valid_access() )
80
- return;
81
-
82
- switch ( $this->method ) {
83
- case 'search' :
84
- //search for some images
85
- $this->result['images'] = array_merge( (array) nggdb::search_for_images( $this->term ), (array) nggTags::find_images_for_tags( $this->term , 'ASC' ));
86
- break;
87
- case 'album' :
88
- //search for some album //TODO : Get images for each gallery, could end in a big db query
89
- $this->result['album'] = nggdb::find_album( $this->id );
90
- break;
91
- case 'gallery' :
92
- //search for some gallery
93
- $this->result['images'] = ($this->id == 0) ? nggdb::find_last_images( 0 , 100 ) : nggdb::get_gallery( $this->id, $ngg->options['galSort'], $ngg->options['galSortDir'], true, 0, 0, true );
94
- break;
95
- case 'image' :
96
- //search for some image
97
- $this->result['images'] = nggdb::find_image( $this->id );
98
- break;
99
- case 'tag' :
100
- //search for images based on tags
101
- $this->result['images'] = nggTags::find_images_for_tags( $this->term , 'ASC' );
102
- break;
103
- case 'recent' :
104
- //search for images based on tags
105
- $this->result['images'] = nggdb::find_last_images( 0 , $this->limit );
106
- break;
107
- case 'autocomplete' :
108
- //return images, galleries or albums for autocomplete drop down list
109
- return $this->autocomplete();
110
- break;
111
- case 'version' :
112
- $this->result = array ('stat' => 'ok', 'version' => $ngg->version);
113
- return;
114
- break;
115
- default :
116
- $this->result = array ('stat' => 'fail', 'code' => '98', 'message' => 'Method not known.');
117
- return false;
118
- break;
119
- }
120
-
121
- // result should be fine
122
- $this->result['stat'] = 'ok';
123
- }
124
-
125
- function valid_access() {
126
-
127
- // if we are logged in, then we can go on
128
- if ( is_user_logged_in() )
129
- return true;
130
-
131
- //TODO:Implement an API KEY check later
132
- if ($this->api_key != false)
133
- return true;
134
-
135
- $this->result = array ('stat' => 'fail', 'code' => '99', 'message' => 'Insufficient permissions. Method requires read privileges; none granted.');
136
- return false;
137
- }
138
-
139
- /**
140
- * return search result for autocomplete request from backend
141
- *
142
- * @since 1.7.0
143
- * @return void
144
- */
145
- function autocomplete() {
146
- global $nggdb;
147
-
148
- switch ( $this->type ) {
149
- case 'image' :
150
-
151
- // return the last entries in case of an empty search string
152
- if ( empty($this->term) )
153
- $list = $nggdb->find_last_images(0, $this->limit, false);
154
- else
155
- $list = $nggdb->search_for_images($this->term, $this->limit);
156
-
157
- if( is_array($list) ) {
158
- foreach($list as $image) {
159
- // reorder result to array-object
160
- $obj = new stdClass();
161
- $obj->id = $image->pid;
162
- $name = ( empty($image->alttext) ? $image->filename : $image->alttext );
163
- //TODO : need to rework save/load
164
- $name = stripslashes( htmlspecialchars_decode($name, ENT_QUOTES));
165
- $obj->label = $image->pid . ' - ' . $name;
166
- $obj->value = $name;
167
- $this->result[] = $obj;
168
- }
169
- }
170
-
171
- return $this->result;
172
- break;
173
- case 'gallery' :
174
-
175
- if ( empty($this->term) )
176
- $list = $nggdb->find_all_galleries('gid', 'DESC', false, $this->limit );
177
- else
178
- $list = $nggdb->search_for_galleries($this->term, $this->limit);
179
-
180
- if( is_array($list) ) {
181
- foreach($list as $gallery) {
182
- // reorder result to array-object
183
- $obj = new stdClass();
184
- $obj->id = $gallery->gid;
185
- $name = ( empty($gallery->title) ) ? $gallery->name : $gallery->title;
186
- $name = stripslashes( htmlspecialchars_decode($name, ENT_QUOTES));
187
- $obj->label = $gallery->gid . ' - ' . $name;
188
- $obj->value = $name;
189
- $this->result[] = $obj;
190
- }
191
- }
192
- return $this->result;
193
- break;
194
- case 'album' :
195
-
196
- if ( empty($this->term) )
197
- $list = $nggdb->find_all_album('id', 'DESC', $this->limit );
198
- else
199
- $list = $nggdb->search_for_albums($this->term, $this->limit);
200
-
201
- if( is_array($list) ) {
202
- foreach($list as $album) {
203
- // reorder result to array-object
204
- $obj = new stdClass();
205
- $obj->id = $album->id;
206
- $album->name = stripslashes( htmlspecialchars_decode($album->name, ENT_QUOTES));
207
- $obj->label = $album->id . ' - ' . $album->name;
208
- $obj->value = $album->name;
209
- $this->result[] = $obj;
210
- }
211
- }
212
- return $this->result;
213
- break;
214
- default :
215
- $this->result = array ('stat' => 'fail', 'code' => '98', 'message' => 'Type not known.');
216
- return false;
217
- break;
218
- }
219
- }
220
-
221
- /**
222
- * Iterates through a multidimensional array
223
- *
224
- * @author Boris Glumpler
225
- * @param array $arr
226
- * @return void
227
- */
228
- function create_xml_array( &$arr )
229
- {
230
- $xml = '';
231
-
232
- if( is_object( $arr ) )
233
- $arr = get_object_vars( $arr );
234
-
235
- foreach( (array)$arr as $k => $v ) {
236
- if( is_object( $v ) )
237
- $v = get_object_vars( $v );
238
- //nodes must contain letters
239
- if( is_numeric( $k ) )
240
- $k = 'id-'.$k;
241
- if( is_array( $v ) )
242
- $xml .= "<$k>\n". $this->create_xml_array( $v ). "</$k>\n";
243
- else
244
- $xml .= "<$k>$v</$k>\n";
245
- }
246
-
247
- return $xml;
248
- }
249
-
250
- function render_output() {
251
-
252
- if ($this->format == 'json') {
253
- header('Content-Type: application/json; charset=' . get_option('blog_charset'), true);
254
- $this->output = json_encode($this->result);
255
- } else {
256
- header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
257
- $this->output = "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>\n";
258
- $this->output .= "<nextgen-gallery>" . $this->create_xml_array( $this->result ) . "</nextgen-gallery>\n";
259
- }
260
-
261
- }
262
-
263
- /**
264
- * PHP5 style destructor and will run when the class is finished.
265
- *
266
- * @return output
267
- */
268
- function __destruct() {
269
- echo $this->output;
270
- }
271
-
272
- }
273
-
274
- // let's use it
275
- $nggAPI = new nggAPI;
1
+ <?php
2
+ /**
3
+ * REST Application Programming Interface PHP class for the WordPress plugin NextGEN Gallery
4
+ * Should emulate some kind of Flickr JSON callback : ?callback=json&format=json&api_key=1234567890&method=search&term=myterm
5
+ *
6
+ * @version 1.1.0
7
+ * @author Alex Rabe
8
+ *
9
+ * @require PHP 5.2.0 or higher
10
+ *
11
+ */
12
+
13
+ class nggAPI {
14
+
15
+ /**
16
+ * $_GET Variables
17
+ *
18
+ * @since 1.5.0
19
+ * @access private
20
+ * @var string
21
+ */
22
+ var $format = false; // $_GET['format'] : Return a XML oder JSON output
23
+ var $api_key = false; // $_GET['api_key'] : Protect the access via a random key (required if user is not logged into backend)
24
+ var $method = false; // $_GET['method'] : search | gallery | image | album | tag | autocomplete
25
+ var $term = false; // $_GET['term'] : The search term (required for method search | tag)
26
+ var $id = false; // $_GET['id'] : object id (required for method gallery | image | album )
27
+ var $limit = false; // $_GET['limit'] : maximum of images which we request
28
+ var $type = false; // $_GET['type'] : gallery | image | album (required for method autocomplete)
29
+
30
+ /**
31
+ * Contain the final output
32
+ *
33
+ * @since 1.5.0
34
+ * @access private
35
+ * @var string
36
+ */
37
+ var $output = '';
38
+
39
+ /**
40
+ * Holds the requested information as array
41
+ *
42
+ * @since 1.5.0
43
+ * @access private
44
+ * @var array
45
+ */
46
+ var $result = '';
47
+
48
+ /**
49
+ * Init the variables
50
+ *
51
+ */
52
+ function __construct() {
53
+
54
+ if ( !defined('ABSPATH') )
55
+ die('You are not allowed to call this page directly.');
56
+
57
+ if ( !function_exists('json_encode') )
58
+ wp_die('Json_encode not available. You need to use PHP 5.2');
59
+
60
+ // Read the parameter on init
61
+ $this->format = isset($_GET['format']) ? strtolower( $_GET['format'] ) : false;
62
+ $this->api_key = isset($_GET['api_key'])? $_GET['api_key'] : false;
63
+ $this->method = isset($_GET['method']) ? strtolower( $_GET['method'] ) : false;
64
+ $this->term = isset($_GET['term']) ? urldecode( $_GET['term'] ) : false;
65
+ $this->id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
66
+ $this->limit = isset($_GET['limit']) ? (int) $_GET['limit'] : 0;
67
+ $this->type = isset($_GET['type']) ? strtolower( $_GET['type'] ) : false;
68
+ $this->result = array();
69
+ $this->list = false;
70
+
71
+ $this->start_process();
72
+ $this->render_output();
73
+ }
74
+
75
+ function start_process() {
76
+
77
+ global $ngg;
78
+
79
+ if ( !$this->valid_access() )
80
+ return;
81
+
82
+ switch ( $this->method ) {
83
+ case 'search' :
84
+ //search for some images
85
+ $this->result['images'] = array_merge( (array) nggdb::search_for_images( $this->term ), (array) nggTags::find_images_for_tags( $this->term , 'ASC' ));
86
+ break;
87
+ case 'album' :
88
+ //search for some album //TODO : Get images for each gallery, could end in a big db query
89
+ $this->result['album'] = nggdb::find_album( $this->id );
90
+ break;
91
+ case 'gallery' :
92
+ //search for some gallery
93
+ $this->result['images'] = ($this->id == 0) ? nggdb::find_last_images( 0 , 100 ) : nggdb::get_gallery( $this->id, $ngg->options['galSort'], $ngg->options['galSortDir'], true, 0, 0, true );
94
+ break;
95
+ case 'image' :
96
+ //search for some image
97
+ $this->result['images'] = nggdb::find_image( $this->id );
98
+ break;
99
+ case 'tag' :
100
+ //search for images based on tags
101
+ $this->result['images'] = nggTags::find_images_for_tags( $this->term , 'ASC' );
102
+ break;
103
+ case 'recent' :
104
+ //search for images based on tags
105
+ $this->result['images'] = nggdb::find_last_images( 0 , $this->limit );
106
+ break;
107
+ case 'autocomplete' :
108
+ //return images, galleries or albums for autocomplete drop down list
109
+ return $this->autocomplete();
110
+ break;
111
+ case 'version' :
112
+ $this->result = array ('stat' => 'ok', 'version' => $ngg->version);
113
+ return;
114
+ break;
115
+ default :
116
+ $this->result = array ('stat' => 'fail', 'code' => '98', 'message' => 'Method not known.');
117
+ return false;
118
+ break;
119
+ }
120
+
121
+ // result should be fine
122
+ $this->result['stat'] = 'ok';
123
+ }
124
+
125
+ function valid_access() {
126
+
127
+ // if we are logged in, then we can go on
128
+ if ( is_user_logged_in() )
129
+ return true;
130
+
131
+ //TODO:Implement an API KEY check later
132
+ if ($this->api_key != false)
133
+ return true;
134
+
135
+ $this->result = array ('stat' => 'fail', 'code' => '99', 'message' => 'Insufficient permissions. Method requires read privileges; none granted.');
136
+ return false;
137
+ }
138
+
139
+ /**
140
+ * return search result for autocomplete request from backend
141
+ *
142
+ * @since 1.7.0
143
+ * @return void
144
+ */
145
+ function autocomplete() {
146
+ global $nggdb;
147
+
148
+ switch ( $this->type ) {
149
+ case 'image' :
150
+
151
+ // return the last entries in case of an empty search string
152
+ if ( empty($this->term) )
153
+ $list = $nggdb->find_last_images(0, $this->limit, false);
154
+ else
155
+ $list = $nggdb->search_for_images($this->term, $this->limit);
156
+
157
+ if( is_array($list) ) {
158
+ foreach($list as $image) {
159
+ // reorder result to array-object
160
+ $obj = new stdClass();
161
+ $obj->id = $image->pid;
162
+ $name = ( empty($image->alttext) ? $image->filename : $image->alttext );
163
+ //TODO : need to rework save/load
164
+ $name = stripslashes( htmlspecialchars_decode($name, ENT_QUOTES));
165
+ $obj->label = $image->pid . ' - ' . $name;
166
+ $obj->value = $name;
167
+ $this->result[] = $obj;
168
+ }
169
+ }
170
+
171
+ return $this->result;
172
+ break;
173
+ case 'gallery' :
174
+
175
+ if ( empty($this->term) )
176
+ $list = $nggdb->find_all_galleries('gid', 'DESC', false, $this->limit );
177
+ else
178
+ $list = $nggdb->search_for_galleries($this->term, $this->limit);
179
+
180
+ if( is_array($list) ) {
181
+ foreach($list as $gallery) {
182
+ // reorder result to array-object
183
+ $obj = new stdClass();
184
+ $obj->id = $gallery->gid;
185
+ $name = ( empty($gallery->title) ) ? $gallery->name : $gallery->title;
186
+ $name = stripslashes( htmlspecialchars_decode($name, ENT_QUOTES));
187
+ $obj->label = $gallery->gid . ' - ' . $name;
188
+ $obj->value = $name;
189
+ $this->result[] = $obj;
190
+ }
191
+ }
192
+ return $this->result;
193
+ break;
194
+ case 'album' :
195
+
196
+ if ( empty($this->term) )
197
+ $list = $nggdb->find_all_album('id', 'DESC', $this->limit );
198
+ else
199
+ $list = $nggdb->search_for_albums($this->term, $this->limit);
200
+
201
+ if( is_array($list) ) {
202
+ foreach($list as $album) {
203
+ // reorder result to array-object
204
+ $obj = new stdClass();
205
+ $obj->id = $album->id;
206
+ $album->name = stripslashes( htmlspecialchars_decode($album->name, ENT_QUOTES));
207
+ $obj->label = $album->id . ' - ' . $album->name;
208
+ $obj->value = $album->name;
209
+ $this->result[] = $obj;
210
+ }
211
+ }
212
+ return $this->result;
213
+ break;
214
+ default :
215
+ $this->result = array ('stat' => 'fail', 'code' => '98', 'message' => 'Type not known.');
216
+ return false;
217
+ break;
218
+ }
219
+ }
220
+
221
+ /**
222
+ * Iterates through a multidimensional array
223
+ *
224
+ * @author Boris Glumpler
225
+ * @param array $arr
226
+ * @return void
227
+ */
228
+ function create_xml_array( &$arr )
229
+ {
230
+ $xml = '';
231
+
232
+ if( is_object( $arr ) )
233
+ $arr = get_object_vars( $arr );
234
+
235
+ foreach( (array)$arr as $k => $v ) {
236
+ if( is_object( $v ) )
237
+ $v = get_object_vars( $v );
238
+ //nodes must contain letters
239
+ if( is_numeric( $k ) )
240
+ $k = 'id-'.$k;
241
+ if( is_array( $v ) )
242
+ $xml .= "<$k>\n". $this->create_xml_array( $v ). "</$k>\n";
243
+ else
244
+ $xml .= "<$k>$v</$k>\n";
245
+ }
246
+
247
+ return $xml;
248
+ }
249
+
250
+ function render_output() {
251
+
252
+ if ($this->format == 'json') {
253
+ header('Content-Type: application/json; charset=' . get_option('blog_charset'), true);
254
+ $this->output = json_encode($this->result);
255
+ } else {
256
+ header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
257
+ $this->output = "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>\n";
258
+ $this->output .= "<nextgen-gallery>" . $this->create_xml_array( $this->result ) . "</nextgen-gallery>\n";
259
+ }
260
+
261
+ }
262
+
263
+ /**
264
+ * PHP5 style destructor and will run when the class is finished.
265
+ *
266
+ * @return output
267
+ */
268
+ function __destruct() {
269
+ echo $this->output;
270
+ }
271
+
272
+ }
273
+
274
+ // let's use it
275
+ $nggAPI = new nggAPI;