WP User Avatar - Version 1.5

Version Description

  • Add: Ability to disable Gravatar avatars
  • Add: Upload size limiter for Contributors & Subscribers
  • Add: French, German, and Spanish translations
Download this release

Release Info

Developer bangbay
Plugin Icon 128x128 WP User Avatar
Version 1.5
Comparing to
See all releases

Code changes from version 1.0.1 to 1.5

css/jquery.ui.slider.css ADDED
@@ -0,0 +1,1141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! jQuery UI - v1.10.0 - 2013-01-17
2
+ * http://jqueryui.com
3
+ * Includes: jquery.ui.core.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.menu.css, jquery.ui.progressbar.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.slider.css, jquery.ui.spinner.css, jquery.ui.tabs.css, jquery.ui.tooltip.css, jquery.ui.theme.css
4
+ * Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */
5
+
6
+ /* Layout helpers
7
+ ----------------------------------*/
8
+ .ui-helper-hidden {
9
+ display: none;
10
+ }
11
+ .ui-helper-hidden-accessible {
12
+ border: 0;
13
+ clip: rect(0 0 0 0);
14
+ height: 1px;
15
+ margin: -1px;
16
+ overflow: hidden;
17
+ padding: 0;
18
+ position: absolute;
19
+ width: 1px;
20
+ }
21
+ .ui-helper-reset {
22
+ margin: 0;
23
+ padding: 0;
24
+ border: 0;
25
+ outline: 0;
26
+ line-height: 1.3;
27
+ text-decoration: none;
28
+ font-size: 100%;
29
+ list-style: none;
30
+ }
31
+ .ui-helper-clearfix:before,
32
+ .ui-helper-clearfix:after {
33
+ content: "";
34
+ display: table;
35
+ }
36
+ .ui-helper-clearfix:after {
37
+ clear: both;
38
+ }
39
+ .ui-helper-clearfix {
40
+ min-height: 0; /* support: IE7 */
41
+ }
42
+ .ui-helper-zfix {
43
+ width: 100%;
44
+ height: 100%;
45
+ top: 0;
46
+ left: 0;
47
+ position: absolute;
48
+ opacity: 0;
49
+ filter:Alpha(Opacity=0);
50
+ }
51
+
52
+ .ui-front {
53
+ z-index: 100;
54
+ }
55
+
56
+
57
+ /* Interaction Cues
58
+ ----------------------------------*/
59
+ .ui-state-disabled {
60
+ cursor: default !important;
61
+ }
62
+
63
+
64
+ /* Icons
65
+ ----------------------------------*/
66
+
67
+ /* states and images */
68
+ .ui-icon {
69
+ display: block;
70
+ text-indent: -99999px;
71
+ overflow: hidden;
72
+ background-repeat: no-repeat;
73
+ }
74
+
75
+
76
+ /* Misc visuals
77
+ ----------------------------------*/
78
+
79
+ /* Overlays */
80
+ .ui-widget-overlay {
81
+ position: fixed;
82
+ top: 0;
83
+ left: 0;
84
+ width: 100%;
85
+ height: 100%;
86
+ }
87
+
88
+ .ui-accordion .ui-accordion-header {
89
+ display: block;
90
+ cursor: pointer;
91
+ position: relative;
92
+ margin-top: 2px;
93
+ padding: .5em .5em .5em .7em;
94
+ min-height: 0; /* support: IE7 */
95
+ }
96
+ .ui-accordion .ui-accordion-icons {
97
+ padding-left: 2.2em;
98
+ }
99
+ .ui-accordion .ui-accordion-noicons {
100
+ padding-left: .7em;
101
+ }
102
+ .ui-accordion .ui-accordion-icons .ui-accordion-icons {
103
+ padding-left: 2.2em;
104
+ }
105
+ .ui-accordion .ui-accordion-header .ui-accordion-header-icon {
106
+ position: absolute;
107
+ left: .5em;
108
+ top: 50%;
109
+ margin-top: -8px;
110
+ }
111
+ .ui-accordion .ui-accordion-content {
112
+ padding: 1em 2.2em;
113
+ border-top: 0;
114
+ overflow: auto;
115
+ }
116
+
117
+ .ui-autocomplete {
118
+ position: absolute;
119
+ top: 0;
120
+ left: 0;
121
+ cursor: default;
122
+ }
123
+
124
+ .ui-button {
125
+ display: inline-block;
126
+ position: relative;
127
+ padding: 0;
128
+ line-height: normal;
129
+ margin-right: .1em;
130
+ cursor: pointer;
131
+ vertical-align: middle;
132
+ text-align: center;
133
+ overflow: visible; /* removes extra width in IE */
134
+ }
135
+ .ui-button,
136
+ .ui-button:link,
137
+ .ui-button:visited,
138
+ .ui-button:hover,
139
+ .ui-button:active {
140
+ text-decoration: none;
141
+ }
142
+ /* to make room for the icon, a width needs to be set here */
143
+ .ui-button-icon-only {
144
+ width: 2.2em;
145
+ }
146
+ /* button elements seem to need a little more width */
147
+ button.ui-button-icon-only {
148
+ width: 2.4em;
149
+ }
150
+ .ui-button-icons-only {
151
+ width: 3.4em;
152
+ }
153
+ button.ui-button-icons-only {
154
+ width: 3.7em;
155
+ }
156
+
157
+ /* button text element */
158
+ .ui-button .ui-button-text {
159
+ display: block;
160
+ line-height: normal;
161
+ }
162
+ .ui-button-text-only .ui-button-text {
163
+ padding: .4em 1em;
164
+ }
165
+ .ui-button-icon-only .ui-button-text,
166
+ .ui-button-icons-only .ui-button-text {
167
+ padding: .4em;
168
+ text-indent: -9999999px;
169
+ }
170
+ .ui-button-text-icon-primary .ui-button-text,
171
+ .ui-button-text-icons .ui-button-text {
172
+ padding: .4em 1em .4em 2.1em;
173
+ }
174
+ .ui-button-text-icon-secondary .ui-button-text,
175
+ .ui-button-text-icons .ui-button-text {
176
+ padding: .4em 2.1em .4em 1em;
177
+ }
178
+ .ui-button-text-icons .ui-button-text {
179
+ padding-left: 2.1em;
180
+ padding-right: 2.1em;
181
+ }
182
+ /* no icon support for input elements, provide padding by default */
183
+ input.ui-button {
184
+ padding: .4em 1em;
185
+ }
186
+
187
+ /* button icon element(s) */
188
+ .ui-button-icon-only .ui-icon,
189
+ .ui-button-text-icon-primary .ui-icon,
190
+ .ui-button-text-icon-secondary .ui-icon,
191
+ .ui-button-text-icons .ui-icon,
192
+ .ui-button-icons-only .ui-icon {
193
+ position: absolute;
194
+ top: 50%;
195
+ margin-top: -8px;
196
+ }
197
+ .ui-button-icon-only .ui-icon {
198
+ left: 50%;
199
+ margin-left: -8px;
200
+ }
201
+ .ui-button-text-icon-primary .ui-button-icon-primary,
202
+ .ui-button-text-icons .ui-button-icon-primary,
203
+ .ui-button-icons-only .ui-button-icon-primary {
204
+ left: .5em;
205
+ }
206
+ .ui-button-text-icon-secondary .ui-button-icon-secondary,
207
+ .ui-button-text-icons .ui-button-icon-secondary,
208
+ .ui-button-icons-only .ui-button-icon-secondary {
209
+ right: .5em;
210
+ }
211
+
212
+ /* button sets */
213
+ .ui-buttonset {
214
+ margin-right: 7px;
215
+ }
216
+ .ui-buttonset .ui-button {
217
+ margin-left: 0;
218
+ margin-right: -.3em;
219
+ }
220
+
221
+ /* workarounds */
222
+ /* reset extra padding in Firefox, see h5bp.com/l */
223
+ input.ui-button::-moz-focus-inner,
224
+ button.ui-button::-moz-focus-inner {
225
+ border: 0;
226
+ padding: 0;
227
+ }
228
+
229
+ .ui-datepicker {
230
+ width: 17em;
231
+ padding: .2em .2em 0;
232
+ display: none;
233
+ }
234
+ .ui-datepicker .ui-datepicker-header {
235
+ position: relative;
236
+ padding: .2em 0;
237
+ }
238
+ .ui-datepicker .ui-datepicker-prev,
239
+ .ui-datepicker .ui-datepicker-next {
240
+ position: absolute;
241
+ top: 2px;
242
+ width: 1.8em;
243
+ height: 1.8em;
244
+ }
245
+ .ui-datepicker .ui-datepicker-prev-hover,
246
+ .ui-datepicker .ui-datepicker-next-hover {
247
+ top: 1px;
248
+ }
249
+ .ui-datepicker .ui-datepicker-prev {
250
+ left: 2px;
251
+ }
252
+ .ui-datepicker .ui-datepicker-next {
253
+ right: 2px;
254
+ }
255
+ .ui-datepicker .ui-datepicker-prev-hover {
256
+ left: 1px;
257
+ }
258
+ .ui-datepicker .ui-datepicker-next-hover {
259
+ right: 1px;
260
+ }
261
+ .ui-datepicker .ui-datepicker-prev span,
262
+ .ui-datepicker .ui-datepicker-next span {
263
+ display: block;
264
+ position: absolute;
265
+ left: 50%;
266
+ margin-left: -8px;
267
+ top: 50%;
268
+ margin-top: -8px;
269
+ }
270
+ .ui-datepicker .ui-datepicker-title {
271
+ margin: 0 2.3em;
272
+ line-height: 1.8em;
273
+ text-align: center;
274
+ }
275
+ .ui-datepicker .ui-datepicker-title select {
276
+ font-size: 1em;
277
+ margin: 1px 0;
278
+ }
279
+ .ui-datepicker select.ui-datepicker-month-year {
280
+ width: 100%;
281
+ }
282
+ .ui-datepicker select.ui-datepicker-month,
283
+ .ui-datepicker select.ui-datepicker-year {
284
+ width: 49%;
285
+ }
286
+ .ui-datepicker table {
287
+ width: 100%;
288
+ font-size: .9em;
289
+ border-collapse: collapse;
290
+ margin: 0 0 .4em;
291
+ }
292
+ .ui-datepicker th {
293
+ padding: .7em .3em;
294
+ text-align: center;
295
+ font-weight: bold;
296
+ border: 0;
297
+ }
298
+ .ui-datepicker td {
299
+ border: 0;
300
+ padding: 1px;
301
+ }
302
+ .ui-datepicker td span,
303
+ .ui-datepicker td a {
304
+ display: block;
305
+ padding: .2em;
306
+ text-align: right;
307
+ text-decoration: none;
308
+ }
309
+ .ui-datepicker .ui-datepicker-buttonpane {
310
+ background-image: none;
311
+ margin: .7em 0 0 0;
312
+ padding: 0 .2em;
313
+ border-left: 0;
314
+ border-right: 0;
315
+ border-bottom: 0;
316
+ }
317
+ .ui-datepicker .ui-datepicker-buttonpane button {
318
+ float: right;
319
+ margin: .5em .2em .4em;
320
+ cursor: pointer;
321
+ padding: .2em .6em .3em .6em;
322
+ width: auto;
323
+ overflow: visible;
324
+ }
325
+ .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current {
326
+ float: left;
327
+ }
328
+
329
+ /* with multiple calendars */
330
+ .ui-datepicker.ui-datepicker-multi {
331
+ width: auto;
332
+ }
333
+ .ui-datepicker-multi .ui-datepicker-group {
334
+ float: left;
335
+ }
336
+ .ui-datepicker-multi .ui-datepicker-group table {
337
+ width: 95%;
338
+ margin: 0 auto .4em;
339
+ }
340
+ .ui-datepicker-multi-2 .ui-datepicker-group {
341
+ width: 50%;
342
+ }
343
+ .ui-datepicker-multi-3 .ui-datepicker-group {
344
+ width: 33.3%;
345
+ }
346
+ .ui-datepicker-multi-4 .ui-datepicker-group {
347
+ width: 25%;
348
+ }
349
+ .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,
350
+ .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header {
351
+ border-left-width: 0;
352
+ }
353
+ .ui-datepicker-multi .ui-datepicker-buttonpane {
354
+ clear: left;
355
+ }
356
+ .ui-datepicker-row-break {
357
+ clear: both;
358
+ width: 100%;
359
+ font-size: 0;
360
+ }
361
+
362
+ /* RTL support */
363
+ .ui-datepicker-rtl {
364
+ direction: rtl;
365
+ }
366
+ .ui-datepicker-rtl .ui-datepicker-prev {
367
+ right: 2px;
368
+ left: auto;
369
+ }
370
+ .ui-datepicker-rtl .ui-datepicker-next {
371
+ left: 2px;
372
+ right: auto;
373
+ }
374
+ .ui-datepicker-rtl .ui-datepicker-prev:hover {
375
+ right: 1px;
376
+ left: auto;
377
+ }
378
+ .ui-datepicker-rtl .ui-datepicker-next:hover {
379
+ left: 1px;
380
+ right: auto;
381
+ }
382
+ .ui-datepicker-rtl .ui-datepicker-buttonpane {
383
+ clear: right;
384
+ }
385
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button {
386
+ float: left;
387
+ }
388
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,
389
+ .ui-datepicker-rtl .ui-datepicker-group {
390
+ float: right;
391
+ }
392
+ .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,
393
+ .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header {
394
+ border-right-width: 0;
395
+ border-left-width: 1px;
396
+ }
397
+
398
+ .ui-dialog {
399
+ position: absolute;
400
+ top: 0;
401
+ left: 0;
402
+ padding: .2em;
403
+ outline: 0;
404
+ }
405
+ .ui-dialog .ui-dialog-titlebar {
406
+ padding: .4em 1em;
407
+ position: relative;
408
+ }
409
+ .ui-dialog .ui-dialog-title {
410
+ float: left;
411
+ margin: .1em 0;
412
+ white-space: nowrap;
413
+ width: 90%;
414
+ overflow: hidden;
415
+ text-overflow: ellipsis;
416
+ }
417
+ .ui-dialog .ui-dialog-titlebar-close {
418
+ position: absolute;
419
+ right: .3em;
420
+ top: 50%;
421
+ width: 21px;
422
+ margin: -10px 0 0 0;
423
+ padding: 1px;
424
+ height: 20px;
425
+ }
426
+ .ui-dialog .ui-dialog-content {
427
+ position: relative;
428
+ border: 0;
429
+ padding: .5em 1em;
430
+ background: none;
431
+ overflow: auto;
432
+ }
433
+ .ui-dialog .ui-dialog-buttonpane {
434
+ text-align: left;
435
+ border-width: 1px 0 0 0;
436
+ background-image: none;
437
+ margin-top: .5em;
438
+ padding: .3em 1em .5em .4em;
439
+ }
440
+ .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
441
+ float: right;
442
+ }
443
+ .ui-dialog .ui-dialog-buttonpane button {
444
+ margin: .5em .4em .5em 0;
445
+ cursor: pointer;
446
+ }
447
+ .ui-dialog .ui-resizable-se {
448
+ width: 12px;
449
+ height: 12px;
450
+ right: -5px;
451
+ bottom: -5px;
452
+ background-position: 16px 16px;
453
+ }
454
+ .ui-draggable .ui-dialog-titlebar {
455
+ cursor: move;
456
+ }
457
+
458
+ .ui-menu {
459
+ list-style: none;
460
+ padding: 2px;
461
+ margin: 0;
462
+ display: block;
463
+ outline: none;
464
+ }
465
+ .ui-menu .ui-menu {
466
+ margin-top: -3px;
467
+ position: absolute;
468
+ }
469
+ .ui-menu .ui-menu-item {
470
+ margin: 0;
471
+ padding: 0;
472
+ width: 100%;
473
+ }
474
+ .ui-menu .ui-menu-divider {
475
+ margin: 5px -2px 5px -2px;
476
+ height: 0;
477
+ font-size: 0;
478
+ line-height: 0;
479
+ border-width: 1px 0 0 0;
480
+ }
481
+ .ui-menu .ui-menu-item a {
482
+ text-decoration: none;
483
+ display: block;
484
+ padding: 2px .4em;
485
+ line-height: 1.5;
486
+ min-height: 0; /* support: IE7 */
487
+ font-weight: normal;
488
+ }
489
+ .ui-menu .ui-menu-item a.ui-state-focus,
490
+ .ui-menu .ui-menu-item a.ui-state-active {
491
+ font-weight: normal;
492
+ margin: -1px;
493
+ }
494
+
495
+ .ui-menu .ui-state-disabled {
496
+ font-weight: normal;
497
+ margin: .4em 0 .2em;
498
+ line-height: 1.5;
499
+ }
500
+ .ui-menu .ui-state-disabled a {
501
+ cursor: default;
502
+ }
503
+
504
+ /* icon support */
505
+ .ui-menu-icons {
506
+ position: relative;
507
+ }
508
+ .ui-menu-icons .ui-menu-item a {
509
+ position: relative;
510
+ padding-left: 2em;
511
+ }
512
+
513
+ /* left-aligned */
514
+ .ui-menu .ui-icon {
515
+ position: absolute;
516
+ top: .2em;
517
+ left: .2em;
518
+ }
519
+
520
+ /* right-aligned */
521
+ .ui-menu .ui-menu-icon {
522
+ position: static;
523
+ float: right;
524
+ }
525
+
526
+ .ui-progressbar {
527
+ height: 2em;
528
+ text-align: left;
529
+ overflow: hidden;
530
+ }
531
+ .ui-progressbar .ui-progressbar-value {
532
+ margin: -1px;
533
+ height: 100%;
534
+ }
535
+ .ui-progressbar .ui-progressbar-overlay {
536
+ height: 100%;
537
+ filter: alpha(opacity=25);
538
+ opacity: 0.25;
539
+ }
540
+ .ui-progressbar-indeterminate .ui-progressbar-value {
541
+ background-image: none;
542
+ }
543
+
544
+ .ui-resizable {
545
+ position: relative;
546
+ }
547
+ .ui-resizable-handle {
548
+ position: absolute;
549
+ font-size: 0.1px;
550
+ display: block;
551
+ }
552
+ .ui-resizable-disabled .ui-resizable-handle,
553
+ .ui-resizable-autohide .ui-resizable-handle {
554
+ display: none;
555
+ }
556
+ .ui-resizable-n {
557
+ cursor: n-resize;
558
+ height: 7px;
559
+ width: 100%;
560
+ top: -5px;
561
+ left: 0;
562
+ }
563
+ .ui-resizable-s {
564
+ cursor: s-resize;
565
+ height: 7px;
566
+ width: 100%;
567
+ bottom: -5px;
568
+ left: 0;
569
+ }
570
+ .ui-resizable-e {
571
+ cursor: e-resize;
572
+ width: 7px;
573
+ right: -5px;
574
+ top: 0;
575
+ height: 100%;
576
+ }
577
+ .ui-resizable-w {
578
+ cursor: w-resize;
579
+ width: 7px;
580
+ left: -5px;
581
+ top: 0;
582
+ height: 100%;
583
+ }
584
+ .ui-resizable-se {
585
+ cursor: se-resize;
586
+ width: 12px;
587
+ height: 12px;
588
+ right: 1px;
589
+ bottom: 1px;
590
+ }
591
+ .ui-resizable-sw {
592
+ cursor: sw-resize;
593
+ width: 9px;
594
+ height: 9px;
595
+ left: -5px;
596
+ bottom: -5px;
597
+ }
598
+ .ui-resizable-nw {
599
+ cursor: nw-resize;
600
+ width: 9px;
601
+ height: 9px;
602
+ left: -5px;
603
+ top: -5px;
604
+ }
605
+ .ui-resizable-ne {
606
+ cursor: ne-resize;
607
+ width: 9px;
608
+ height: 9px;
609
+ right: -5px;
610
+ top: -5px;
611
+ }
612
+
613
+ .ui-selectable-helper {
614
+ position: absolute;
615
+ z-index: 100;
616
+ border: 1px dotted black;
617
+ }
618
+
619
+ .ui-slider {
620
+ position: relative;
621
+ text-align: left;
622
+ }
623
+ .ui-slider .ui-slider-handle {
624
+ position: absolute;
625
+ z-index: 2;
626
+ width: 1.2em;
627
+ height: 1.2em;
628
+ background: #555;
629
+ cursor: default;
630
+ outline: none;
631
+ }
632
+ .ui-slider .ui-slider-range {
633
+ position: absolute;
634
+ z-index: 1;
635
+ font-size: .7em;
636
+ display: block;
637
+ border: 0;
638
+ background-position: 0 0;
639
+ }
640
+
641
+ /* For IE8 - See #6727 */
642
+ .ui-slider.ui-state-disabled .ui-slider-handle,
643
+ .ui-slider.ui-state-disabled .ui-slider-range {
644
+ filter: inherit;
645
+ }
646
+
647
+ .ui-slider-horizontal {
648
+ height: .8em;
649
+ }
650
+ .ui-slider-horizontal .ui-slider-handle {
651
+ top: -.3em;
652
+ margin-left: -.6em;
653
+ }
654
+ .ui-slider-horizontal .ui-slider-range {
655
+ top: 0;
656
+ height: 100%;
657
+ }
658
+ .ui-slider-horizontal .ui-slider-range-min {
659
+ left: 0;
660
+ }
661
+ .ui-slider-horizontal .ui-slider-range-max {
662
+ right: 0;
663
+ }
664
+
665
+ .ui-slider-vertical {
666
+ width: .8em;
667
+ height: 100px;
668
+ }
669
+ .ui-slider-vertical .ui-slider-handle {
670
+ left: -.3em;
671
+ margin-left: 0;
672
+ margin-bottom: -.6em;
673
+ }
674
+ .ui-slider-vertical .ui-slider-range {
675
+ left: 0;
676
+ width: 100%;
677
+ }
678
+ .ui-slider-vertical .ui-slider-range-min {
679
+ bottom: 0;
680
+ }
681
+ .ui-slider-vertical .ui-slider-range-max {
682
+ top: 0;
683
+ }
684
+
685
+ .ui-spinner {
686
+ position: relative;
687
+ display: inline-block;
688
+ overflow: hidden;
689
+ padding: 0;
690
+ vertical-align: middle;
691
+ }
692
+ .ui-spinner-input {
693
+ border: none;
694
+ background: none;
695
+ color: inherit;
696
+ padding: 0;
697
+ margin: .2em 0;
698
+ vertical-align: middle;
699
+ margin-left: .4em;
700
+ margin-right: 22px;
701
+ }
702
+ .ui-spinner-button {
703
+ width: 16px;
704
+ height: 50%;
705
+ font-size: .5em;
706
+ padding: 0;
707
+ margin: 0;
708
+ text-align: center;
709
+ position: absolute;
710
+ cursor: default;
711
+ display: block;
712
+ overflow: hidden;
713
+ right: 0;
714
+ }
715
+ /* more specificity required here to overide default borders */
716
+ .ui-spinner a.ui-spinner-button {
717
+ border-top: none;
718
+ border-bottom: none;
719
+ border-right: none;
720
+ }
721
+ /* vertical centre icon */
722
+ .ui-spinner .ui-icon {
723
+ position: absolute;
724
+ margin-top: -8px;
725
+ top: 50%;
726
+ left: 0;
727
+ }
728
+ .ui-spinner-up {
729
+ top: 0;
730
+ }
731
+ .ui-spinner-down {
732
+ bottom: 0;
733
+ }
734
+
735
+ /* TR overrides */
736
+ .ui-spinner .ui-icon-triangle-1-s {
737
+ /* need to fix icons sprite */
738
+ background-position: -65px -16px;
739
+ }
740
+
741
+ .ui-tabs {
742
+ position: relative;/* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
743
+ padding: .2em;
744
+ }
745
+ .ui-tabs .ui-tabs-nav {
746
+ margin: 0;
747
+ padding: .2em .2em 0;
748
+ }
749
+ .ui-tabs .ui-tabs-nav li {
750
+ list-style: none;
751
+ float: left;
752
+ position: relative;
753
+ top: 0;
754
+ margin: 1px .2em 0 0;
755
+ border-bottom: 0;
756
+ padding: 0;
757
+ white-space: nowrap;
758
+ }
759
+ .ui-tabs .ui-tabs-nav li a {
760
+ float: left;
761
+ padding: .5em 1em;
762
+ text-decoration: none;
763
+ }
764
+ .ui-tabs .ui-tabs-nav li.ui-tabs-active {
765
+ margin-bottom: -1px;
766
+ padding-bottom: 1px;
767
+ }
768
+ .ui-tabs .ui-tabs-nav li.ui-tabs-active a,
769
+ .ui-tabs .ui-tabs-nav li.ui-state-disabled a,
770
+ .ui-tabs .ui-tabs-nav li.ui-tabs-loading a {
771
+ cursor: text;
772
+ }
773
+ .ui-tabs .ui-tabs-nav li a, /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
774
+ .ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active a {
775
+ cursor: pointer;
776
+ }
777
+ .ui-tabs .ui-tabs-panel {
778
+ display: block;
779
+ border-width: 0;
780
+ padding: 1em 1.4em;
781
+ background: none;
782
+ }
783
+
784
+ .ui-tooltip {
785
+ padding: 8px;
786
+ position: absolute;
787
+ z-index: 9999;
788
+ max-width: 300px;
789
+ -webkit-box-shadow: 0 0 5px #aaa;
790
+ box-shadow: 0 0 5px #aaa;
791
+ }
792
+ body .ui-tooltip {
793
+ border-width: 2px;
794
+ }
795
+
796
+ /* Component containers
797
+ ----------------------------------*/
798
+ .ui-widget {
799
+ font-family: Verdana,Arial,sans-serif/*{ffDefault}*/;
800
+ font-size: 1.1em/*{fsDefault}*/;
801
+ }
802
+ .ui-widget .ui-widget {
803
+ font-size: 1em;
804
+ }
805
+ .ui-widget input,
806
+ .ui-widget select,
807
+ .ui-widget textarea,
808
+ .ui-widget button {
809
+ font-family: Verdana,Arial,sans-serif/*{ffDefault}*/;
810
+ font-size: 1em;
811
+ }
812
+ .ui-widget-content {
813
+ border: 1px solid #aaaaaa/*{borderColorContent}*/;
814
+ color: #222222/*{fcContent}*/;
815
+ }
816
+ .ui-widget-content a {
817
+ color: #222222/*{fcContent}*/;
818
+ }
819
+ .ui-widget-header {
820
+ border: 1px solid #aaaaaa/*{borderColorHeader}*/;
821
+ color: #222222/*{fcHeader}*/;
822
+ font-weight: bold;
823
+ }
824
+ .ui-widget-header a {
825
+ color: #222222/*{fcHeader}*/;
826
+ }
827
+
828
+ /* Interaction states
829
+ ----------------------------------*/
830
+ .ui-state-default,
831
+ .ui-widget-content .ui-state-default,
832
+ .ui-widget-header .ui-state-default {
833
+ border: 1px solid #d3d3d3/*{borderColorDefault}*/;
834
+ font-weight: normal/*{fwDefault}*/;
835
+ color: #555555/*{fcDefault}*/;
836
+ }
837
+ .ui-state-default a,
838
+ .ui-state-default a:link,
839
+ .ui-state-default a:visited {
840
+ color: #555555/*{fcDefault}*/;
841
+ text-decoration: none;
842
+ }
843
+ .ui-state-hover,
844
+ .ui-widget-content .ui-state-hover,
845
+ .ui-widget-header .ui-state-hover,
846
+ .ui-state-focus,
847
+ .ui-widget-content .ui-state-focus,
848
+ .ui-widget-header .ui-state-focus {
849
+ border: 1px solid #999999/*{borderColorHover}*/;
850
+ font-weight: normal/*{fwDefault}*/;
851
+ color: #212121/*{fcHover}*/;
852
+ }
853
+ .ui-state-hover a,
854
+ .ui-state-hover a:hover,
855
+ .ui-state-hover a:link,
856
+ .ui-state-hover a:visited {
857
+ color: #212121/*{fcHover}*/;
858
+ text-decoration: none;
859
+ }
860
+ .ui-state-active,
861
+ .ui-widget-content .ui-state-active,
862
+ .ui-widget-header .ui-state-active {
863
+ border: 1px solid #aaaaaa/*{borderColorActive}*/;
864
+ font-weight: normal/*{fwDefault}*/;
865
+ color: #212121/*{fcActive}*/;
866
+ }
867
+ .ui-state-active a,
868
+ .ui-state-active a:link,
869
+ .ui-state-active a:visited {
870
+ color: #212121/*{fcActive}*/;
871
+ text-decoration: none;
872
+ }
873
+
874
+ /* Interaction Cues
875
+ ----------------------------------*/
876
+ .ui-state-highlight,
877
+ .ui-widget-content .ui-state-highlight,
878
+ .ui-widget-header .ui-state-highlight {
879
+ border: 1px solid #fcefa1/*{borderColorHighlight}*/;
880
+ color: #363636/*{fcHighlight}*/;
881
+ }
882
+ .ui-state-highlight a,
883
+ .ui-widget-content .ui-state-highlight a,
884
+ .ui-widget-header .ui-state-highlight a {
885
+ color: #363636/*{fcHighlight}*/;
886
+ }
887
+ .ui-state-error,
888
+ .ui-widget-content .ui-state-error,
889
+ .ui-widget-header .ui-state-error {
890
+ border: 1px solid #cd0a0a/*{borderColorError}*/;
891
+ color: #cd0a0a/*{fcError}*/;
892
+ }
893
+ .ui-state-error a,
894
+ .ui-widget-content .ui-state-error a,
895
+ .ui-widget-header .ui-state-error a {
896
+ color: #cd0a0a/*{fcError}*/;
897
+ }
898
+ .ui-state-error-text,
899
+ .ui-widget-content .ui-state-error-text,
900
+ .ui-widget-header .ui-state-error-text {
901
+ color: #cd0a0a/*{fcError}*/;
902
+ }
903
+ .ui-priority-primary,
904
+ .ui-widget-content .ui-priority-primary,
905
+ .ui-widget-header .ui-priority-primary {
906
+ font-weight: bold;
907
+ }
908
+ .ui-priority-secondary,
909
+ .ui-widget-content .ui-priority-secondary,
910
+ .ui-widget-header .ui-priority-secondary {
911
+ opacity: .7;
912
+ filter:Alpha(Opacity=70);
913
+ font-weight: normal;
914
+ }
915
+ .ui-state-disabled,
916
+ .ui-widget-content .ui-state-disabled,
917
+ .ui-widget-header .ui-state-disabled {
918
+ opacity: .35;
919
+ filter:Alpha(Opacity=35);
920
+ background-image: none;
921
+ }
922
+ .ui-state-disabled .ui-icon {
923
+ filter:Alpha(Opacity=35); /* For IE8 - See #6059 */
924
+ }
925
+
926
+ /* Icons
927
+ ----------------------------------*/
928
+
929
+ /* states and images */
930
+ .ui-icon {
931
+ width: 16px;
932
+ height: 16px;
933
+ background-position: 16px 16px;
934
+ }
935
+
936
+ /* positioning */
937
+ .ui-icon-carat-1-n { background-position: 0 0; }
938
+ .ui-icon-carat-1-ne { background-position: -16px 0; }
939
+ .ui-icon-carat-1-e { background-position: -32px 0; }
940
+ .ui-icon-carat-1-se { background-position: -48px 0; }
941
+ .ui-icon-carat-1-s { background-position: -64px 0; }
942
+ .ui-icon-carat-1-sw { background-position: -80px 0; }
943
+ .ui-icon-carat-1-w { background-position: -96px 0; }
944
+ .ui-icon-carat-1-nw { background-position: -112px 0; }
945
+ .ui-icon-carat-2-n-s { background-position: -128px 0; }
946
+ .ui-icon-carat-2-e-w { background-position: -144px 0; }
947
+ .ui-icon-triangle-1-n { background-position: 0 -16px; }
948
+ .ui-icon-triangle-1-ne { background-position: -16px -16px; }
949
+ .ui-icon-triangle-1-e { background-position: -32px -16px; }
950
+ .ui-icon-triangle-1-se { background-position: -48px -16px; }
951
+ .ui-icon-triangle-1-s { background-position: -64px -16px; }
952
+ .ui-icon-triangle-1-sw { background-position: -80px -16px; }
953
+ .ui-icon-triangle-1-w { background-position: -96px -16px; }
954
+ .ui-icon-triangle-1-nw { background-position: -112px -16px; }
955
+ .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
956
+ .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
957
+ .ui-icon-arrow-1-n { background-position: 0 -32px; }
958
+ .ui-icon-arrow-1-ne { background-position: -16px -32px; }
959
+ .ui-icon-arrow-1-e { background-position: -32px -32px; }
960
+ .ui-icon-arrow-1-se { background-position: -48px -32px; }
961
+ .ui-icon-arrow-1-s { background-position: -64px -32px; }
962
+ .ui-icon-arrow-1-sw { background-position: -80px -32px; }
963
+ .ui-icon-arrow-1-w { background-position: -96px -32px; }
964
+ .ui-icon-arrow-1-nw { background-position: -112px -32px; }
965
+ .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
966
+ .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
967
+ .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
968
+ .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
969
+ .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
970
+ .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
971
+ .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
972
+ .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
973
+ .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
974
+ .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
975
+ .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
976
+ .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
977
+ .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
978
+ .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
979
+ .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
980
+ .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
981
+ .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
982
+ .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
983
+ .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
984
+ .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
985
+ .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
986
+ .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
987
+ .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
988
+ .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
989
+ .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
990
+ .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
991
+ .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
992
+ .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
993
+ .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
994
+ .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
995
+ .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
996
+ .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
997
+ .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
998
+ .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
999
+ .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
1000
+ .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
1001
+ .ui-icon-arrow-4 { background-position: 0 -80px; }
1002
+ .ui-icon-arrow-4-diag { background-position: -16px -80px; }
1003
+ .ui-icon-extlink { background-position: -32px -80px; }
1004
+ .ui-icon-newwin { background-position: -48px -80px; }
1005
+ .ui-icon-refresh { background-position: -64px -80px; }
1006
+ .ui-icon-shuffle { background-position: -80px -80px; }
1007
+ .ui-icon-transfer-e-w { background-position: -96px -80px; }
1008
+ .ui-icon-transferthick-e-w { background-position: -112px -80px; }
1009
+ .ui-icon-folder-collapsed { background-position: 0 -96px; }
1010
+ .ui-icon-folder-open { background-position: -16px -96px; }
1011
+ .ui-icon-document { background-position: -32px -96px; }
1012
+ .ui-icon-document-b { background-position: -48px -96px; }
1013
+ .ui-icon-note { background-position: -64px -96px; }
1014
+ .ui-icon-mail-closed { background-position: -80px -96px; }
1015
+ .ui-icon-mail-open { background-position: -96px -96px; }
1016
+ .ui-icon-suitcase { background-position: -112px -96px; }
1017
+ .ui-icon-comment { background-position: -128px -96px; }
1018
+ .ui-icon-person { background-position: -144px -96px; }
1019
+ .ui-icon-print { background-position: -160px -96px; }
1020
+ .ui-icon-trash { background-position: -176px -96px; }
1021
+ .ui-icon-locked { background-position: -192px -96px; }
1022
+ .ui-icon-unlocked { background-position: -208px -96px; }
1023
+ .ui-icon-bookmark { background-position: -224px -96px; }
1024
+ .ui-icon-tag { background-position: -240px -96px; }
1025
+ .ui-icon-home { background-position: 0 -112px; }
1026
+ .ui-icon-flag { background-position: -16px -112px; }
1027
+ .ui-icon-calendar { background-position: -32px -112px; }
1028
+ .ui-icon-cart { background-position: -48px -112px; }
1029
+ .ui-icon-pencil { background-position: -64px -112px; }
1030
+ .ui-icon-clock { background-position: -80px -112px; }
1031
+ .ui-icon-disk { background-position: -96px -112px; }
1032
+ .ui-icon-calculator { background-position: -112px -112px; }
1033
+ .ui-icon-zoomin { background-position: -128px -112px; }
1034
+ .ui-icon-zoomout { background-position: -144px -112px; }
1035
+ .ui-icon-search { background-position: -160px -112px; }
1036
+ .ui-icon-wrench { background-position: -176px -112px; }
1037
+ .ui-icon-gear { background-position: -192px -112px; }
1038
+ .ui-icon-heart { background-position: -208px -112px; }
1039
+ .ui-icon-star { background-position: -224px -112px; }
1040
+ .ui-icon-link { background-position: -240px -112px; }
1041
+ .ui-icon-cancel { background-position: 0 -128px; }
1042
+ .ui-icon-plus { background-position: -16px -128px; }
1043
+ .ui-icon-plusthick { background-position: -32px -128px; }
1044
+ .ui-icon-minus { background-position: -48px -128px; }
1045
+ .ui-icon-minusthick { background-position: -64px -128px; }
1046
+ .ui-icon-close { background-position: -80px -128px; }
1047
+ .ui-icon-closethick { background-position: -96px -128px; }
1048
+ .ui-icon-key { background-position: -112px -128px; }
1049
+ .ui-icon-lightbulb { background-position: -128px -128px; }
1050
+ .ui-icon-scissors { background-position: -144px -128px; }
1051
+ .ui-icon-clipboard { background-position: -160px -128px; }
1052
+ .ui-icon-copy { background-position: -176px -128px; }
1053
+ .ui-icon-contact { background-position: -192px -128px; }
1054
+ .ui-icon-image { background-position: -208px -128px; }
1055
+ .ui-icon-video { background-position: -224px -128px; }
1056
+ .ui-icon-script { background-position: -240px -128px; }
1057
+ .ui-icon-alert { background-position: 0 -144px; }
1058
+ .ui-icon-info { background-position: -16px -144px; }
1059
+ .ui-icon-notice { background-position: -32px -144px; }
1060
+ .ui-icon-help { background-position: -48px -144px; }
1061
+ .ui-icon-check { background-position: -64px -144px; }
1062
+ .ui-icon-bullet { background-position: -80px -144px; }
1063
+ .ui-icon-radio-on { background-position: -96px -144px; }
1064
+ .ui-icon-radio-off { background-position: -112px -144px; }
1065
+ .ui-icon-pin-w { background-position: -128px -144px; }
1066
+ .ui-icon-pin-s { background-position: -144px -144px; }
1067
+ .ui-icon-play { background-position: 0 -160px; }
1068
+ .ui-icon-pause { background-position: -16px -160px; }
1069
+ .ui-icon-seek-next { background-position: -32px -160px; }
1070
+ .ui-icon-seek-prev { background-position: -48px -160px; }
1071
+ .ui-icon-seek-end { background-position: -64px -160px; }
1072
+ .ui-icon-seek-start { background-position: -80px -160px; }
1073
+ /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
1074
+ .ui-icon-seek-first { background-position: -80px -160px; }
1075
+ .ui-icon-stop { background-position: -96px -160px; }
1076
+ .ui-icon-eject { background-position: -112px -160px; }
1077
+ .ui-icon-volume-off { background-position: -128px -160px; }
1078
+ .ui-icon-volume-on { background-position: -144px -160px; }
1079
+ .ui-icon-power { background-position: 0 -176px; }
1080
+ .ui-icon-signal-diag { background-position: -16px -176px; }
1081
+ .ui-icon-signal { background-position: -32px -176px; }
1082
+ .ui-icon-battery-0 { background-position: -48px -176px; }
1083
+ .ui-icon-battery-1 { background-position: -64px -176px; }
1084
+ .ui-icon-battery-2 { background-position: -80px -176px; }
1085
+ .ui-icon-battery-3 { background-position: -96px -176px; }
1086
+ .ui-icon-circle-plus { background-position: 0 -192px; }
1087
+ .ui-icon-circle-minus { background-position: -16px -192px; }
1088
+ .ui-icon-circle-close { background-position: -32px -192px; }
1089
+ .ui-icon-circle-triangle-e { background-position: -48px -192px; }
1090
+ .ui-icon-circle-triangle-s { background-position: -64px -192px; }
1091
+ .ui-icon-circle-triangle-w { background-position: -80px -192px; }
1092
+ .ui-icon-circle-triangle-n { background-position: -96px -192px; }
1093
+ .ui-icon-circle-arrow-e { background-position: -112px -192px; }
1094
+ .ui-icon-circle-arrow-s { background-position: -128px -192px; }
1095
+ .ui-icon-circle-arrow-w { background-position: -144px -192px; }
1096
+ .ui-icon-circle-arrow-n { background-position: -160px -192px; }
1097
+ .ui-icon-circle-zoomin { background-position: -176px -192px; }
1098
+ .ui-icon-circle-zoomout { background-position: -192px -192px; }
1099
+ .ui-icon-circle-check { background-position: -208px -192px; }
1100
+ .ui-icon-circlesmall-plus { background-position: 0 -208px; }
1101
+ .ui-icon-circlesmall-minus { background-position: -16px -208px; }
1102
+ .ui-icon-circlesmall-close { background-position: -32px -208px; }
1103
+ .ui-icon-squaresmall-plus { background-position: -48px -208px; }
1104
+ .ui-icon-squaresmall-minus { background-position: -64px -208px; }
1105
+ .ui-icon-squaresmall-close { background-position: -80px -208px; }
1106
+ .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
1107
+ .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
1108
+ .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
1109
+ .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
1110
+ .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
1111
+ .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
1112
+
1113
+
1114
+ /* Misc visuals
1115
+ ----------------------------------*/
1116
+
1117
+ /* Corner radius */
1118
+ .ui-corner-all,
1119
+ .ui-corner-top,
1120
+ .ui-corner-left,
1121
+ .ui-corner-tl {
1122
+ border-top-left-radius: 4px/*{cornerRadius}*/;
1123
+ }
1124
+ .ui-corner-all,
1125
+ .ui-corner-top,
1126
+ .ui-corner-right,
1127
+ .ui-corner-tr {
1128
+ border-top-right-radius: 4px/*{cornerRadius}*/;
1129
+ }
1130
+ .ui-corner-all,
1131
+ .ui-corner-bottom,
1132
+ .ui-corner-left,
1133
+ .ui-corner-bl {
1134
+ border-bottom-left-radius: 4px/*{cornerRadius}*/;
1135
+ }
1136
+ .ui-corner-all,
1137
+ .ui-corner-bottom,
1138
+ .ui-corner-right,
1139
+ .ui-corner-br {
1140
+ border-bottom-right-radius: 4px/*{cornerRadius}*/;
1141
+ }
css/wp-user-avatar.css CHANGED
@@ -1,3 +1,12 @@
1
- .savesend .button { display: none; }
2
- #wp-user-avatar-message { color: #c00; display: none; }
3
- #wp-user-avatar-preview img { max-width: 96px; }
 
 
 
 
 
 
 
 
 
1
+ #wp-user-avatar-errors, #wp-user-avatar-message, #wp-readable-size-error { color: #c00; font-weight: 700; }
2
+ #wp-user-avatar-message, #wp-readable-size-error { display: none; }
3
+ #wp-user-avatar-preview, #wp-user-avatar-thumbnail { display: inline-block; text-align: center; vertical-align: top; }
4
+ #wp-user-avatar-preview { margin-right: 10px; }
5
+ #wp-user-avatar-preview img, #wp-user-avatar-thumbnail img { height: 96px; border: 1px solid #dfdfdf; display: block; }
6
+ .defaultavatarpicker #wp-user-avatar-preview { width: 32px; height: 32px; margin-right: 0; display: inline-block; overflow: hidden; vertical-align: middle; }
7
+ .defaultavatarpicker #wp-user-avatar-preview img { width: 32px; height: auto; border: 0; }
8
+ #edit-wp-user-avatar { padding-left: 15px; }
9
+ #edit-wp-user-avatar #remove-wp-user-avatar { margin-left: 10px; }
10
+ .hide-me, .wp-core-ui .hide-me { display: none; }
11
+ #wp-user-avatar-slider { width: 22.75em; }
12
+ .wpua_label { display: block; }
images/wp-user-avatar-150x150.png ADDED
Binary file
images/wp-user-avatar-300x300.png ADDED
Binary file
images/wp-user-avatar-32x32.png ADDED
Binary file
images/wp-user-avatar-96x96.png ADDED
Binary file
images/wp-user-avatar.png ADDED
Binary file
includes/tinymce.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package WP User Avatar
4
+ * @version 1.5
5
+ */
6
+
7
+ if(!defined('ABSPATH')){
8
+ die(__('You are not allowed to call this page directly.'));
9
+ @header('Content-Type:'.get_option('html_type').';charset='.get_option('blog_charset'));
10
+ }
11
+
12
+ function wpua_myplugin_addbuttons(){
13
+ // Don't bother doing this stuff if the current user lacks permissions
14
+ if(!current_user_can('edit_posts') && !current_user_can('edit_pages')){
15
+ return;
16
+ }
17
+ // Add only in Rich Editor mode
18
+ if(get_user_option('rich_editing') == 'true'){
19
+ add_filter('mce_external_plugins', 'wpua_add_myplugin_tinymce_plugin');
20
+ add_filter('mce_buttons', 'wpua_register_myplugin_button');
21
+ }
22
+ }
23
+ // init process for button control
24
+ add_action('init', 'wpua_myplugin_addbuttons');
25
+
26
+
27
+ function wpua_register_myplugin_button($buttons){
28
+ array_push($buttons, 'separator', 'wpUserAvatar');
29
+ return $buttons;
30
+ }
31
+
32
+ // Load the TinyMCE plugin : editor_plugin.js (wp2.5)
33
+ function wpua_add_myplugin_tinymce_plugin($plugin_array){
34
+ $plugin_array['wpUserAvatar'] = WPUA_URLPATH.'includes/tinymce/editor_plugin.js';
35
+ return $plugin_array;
36
+ }
37
+
38
+ // Call TinyMCE window content via admin-ajax
39
+ function wpua_ajax_tinymce(){
40
+ if(!current_user_can('edit_posts') && !current_user_can('edit_pages')){
41
+ die('You are not allowed to call this page directly.');
42
+ }
43
+ include_once(WPUA_ABSPATH.'includes/tinymce/window.php');
44
+ die();
45
+ }
46
+ add_action('wp_ajax_wp_user_avatar_tinymce', 'wpua_ajax_tinymce');
47
+ ?>
includes/tinymce/editor_plugin.js ADDED
@@ -0,0 +1 @@
 
1
+ (function(){tinymce.PluginManager.requireLangPack('wpUserAvatar');tinymce.create('tinymce.plugins.wpUserAvatar',{init:function(ed,url){ed.addCommand('mceWpUserAvatar',function(){ed.windowManager.open({file:ajaxurl+'?action=wp_user_avatar_tinymce',width:500,height:295,inline:1},{plugin_url:url})});ed.addButton('wpUserAvatar',{title:'Insert WP User Avatar',cmd:'mceWpUserAvatar',image:url+'/../../images/wp-user-avatar-32x32.png'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('wpUserAvatar',n.nodeName=='IMG')})},createControl:function(n,cm){return null},getInfo:function(){return{longname:'WP User Avatar',author:'Bangbay Siboliban',authorurl:'http://siboliban.org/',infourl:'http://wordpress.org/extend/plugins/wp-user-avatar/',version:"1.5"}}});tinymce.PluginManager.add('wpUserAvatar',tinymce.plugins.wpUserAvatar)})();
includes/tinymce/window.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package WP User Avatar
4
+ * @version 1.5
5
+ */
6
+
7
+ if(!defined('ABSPATH')){
8
+ die(__('You are not allowed to call this page directly.'));
9
+ @header('Content-Type:'.get_option('html_type').';charset='.get_option('blog_charset'));
10
+ }
11
+ ?>
12
+ <html xmlns="http://www.w3.org/1999/xhtml">
13
+ <head>
14
+ <title>WP User Avatar</title>
15
+ <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
16
+ <base target="_self" />
17
+ <script type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/jquery/jquery.js"></script>
18
+ <script type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
19
+ <script type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
20
+ <script type="text/javascript">
21
+ function insert_wp_user_avatar(){
22
+ // Custom shortcode values
23
+ var shortcode;
24
+ var user = document.getElementById('wp_user_avatar_user').value;
25
+ var size = document.getElementById('wp_user_avatar_size').value;
26
+ var size_number = document.getElementById('wp_user_avatar_size_number').value;
27
+ var align = document.getElementById('wp_user_avatar_align').value;
28
+ var link = document.getElementById('wp_user_avatar_link').value;
29
+ var link_external = document.getElementById('wp_user_avatar_link_external').value;
30
+ var target = document.getElementById('wp_user_avatar_target').value;
31
+
32
+ // Add tag to shortcode only if not blank
33
+ var user_tag = (user != '') ? ' user="' + user + '"' : '';
34
+ var size_tag = (size != '' && size_number == '') ? ' size="' + size + '"' : '';
35
+ size_tag = (size_number != '') ? ' size="' + size_number + '"' : size_tag;
36
+ var align_tag = (align != '') ? ' align="' + align + '"' : '';
37
+ var link_tag = (link != '' && link_external == '') ? ' link="' + link + '"' : '';
38
+ link_tag = (link_external != '') ? ' link="' + link_external + '"' : link_tag;
39
+ var target_tag = document.getElementById('wp_user_avatar_target').checked && (link_tag != '') ? ' target="' + target + '"' : '';
40
+
41
+ shortcode = "<p>[avatar" + user_tag + size_tag + align_tag + link_tag + target_tag + "]</p>";
42
+
43
+ if(window.tinyMCE){
44
+ window.tinyMCE.execInstanceCommand(window.tinyMCE.activeEditor.id, 'mceInsertContent', false, shortcode);
45
+ tinyMCEPopup.editor.execCommand('mceRepaint');
46
+ tinyMCEPopup.close();
47
+ }
48
+ return;
49
+ }
50
+ </script>
51
+ <style type="text/css">
52
+ form { background: #fff; border: 1px solid #eee; }
53
+ p, h4 { margin: 0; padding: 12px 0 0; }
54
+ h4.center { text-align: center; }
55
+ label { width: 90px; display: inline-block; text-align: right; }
56
+ .mceActionPanel { padding: 7px 0 12px; text-align: center; }
57
+ .mceActionPanel #insert { float: none; width: 180px; margin: 0 auto; }
58
+ </style>
59
+ </head>
60
+ <body id="link" class="wp-core-ui" onload="document.body.style.display='';" style="display:none;">
61
+ <form name="wpUserAvatar" action="#">
62
+ <p><label for="<?php esc_attr_e('wp_user_avatar_user'); ?>"><strong><?php _e('User', 'wp-user-avatar'); ?>:</strong></label>
63
+ <select id="<?php esc_attr_e('wp_user_avatar_user'); ?>" name="<?php esc_attr_e('wp_user_avatar_user'); ?>">
64
+ <option value=""></option>
65
+ <?php $users = get_users(); foreach($users as $user) : ?>
66
+ <option value="<?php echo $user->user_login; ?>"><?php echo $user->display_name; ?></option>
67
+ <?php endforeach; ?>
68
+ </select></p>
69
+
70
+ <h4 class="center"><?php _e('Choose a preset size or enter a number value', 'wp-user-avatar'); ?>.</h4>
71
+
72
+ <p>
73
+ <label for="<?php esc_attr_e('wp_user_avatar_size'); ?>"><strong><?php _e('Size'); ?>:</strong></label>
74
+ <select id="<?php esc_attr_e('wp_user_avatar_size'); ?>" name="<?php esc_attr_e('wp_user_avatar_size'); ?>">
75
+ <option value=""></option>
76
+ <option value="original"><?php _e('Original'); ?></option>
77
+ <option value="large"><?php _e('Large'); ?></option>
78
+ <option value="medium"><?php _e('Medium'); ?></option>
79
+ <option value="thumbnail"><?php _e('Thumbnail'); ?></option>
80
+ </select>
81
+ <?php _e('or', 'wp-user-avatar'); ?>
82
+ <input type="text" size="8" id="<?php esc_attr_e('wp_user_avatar_size_number'); ?>" name="<?php esc_attr_e('wp_user_avatar_size'); ?>" value="" />
83
+ </p>
84
+
85
+ <p><label for="<?php esc_attr_e('wp_user_avatar_align'); ?>"><strong><?php _e('Alignment'); ?>:</strong></label>
86
+ <select id="<?php esc_attr_e('wp_user_avatar_align'); ?>" name="<?php esc_attr_e('wp_user_avatar_align'); ?>">
87
+ <option value=""></option>
88
+ <option value="center"><?php _e('Center'); ?></option>
89
+ <option value="left"><?php _e('Left'); ?></option>
90
+ <option value="right"><?php _e('Right'); ?></option>
91
+ </select></p>
92
+
93
+ <h4 class="center"><?php _e('Link to image file, attachment page, or custom URL', 'wp-user-avatar'); ?>.</h4>
94
+
95
+ <p>
96
+ <label for="<?php esc_attr_e('wp_user_avatar_link'); ?>"><strong><?php _e('Link To'); ?>:</strong></label>
97
+ <select id="<?php esc_attr_e('wp_user_avatar_link'); ?>" name="<?php esc_attr_e('wp_user_avatar_link'); ?>">
98
+ <option value=""></option>
99
+ <option value="file"><?php _e('Image File'); ?></option>
100
+ <option value="attachment"><?php _e('Attachment Page'); ?></option>
101
+ </select>
102
+ </p>
103
+
104
+ <p>
105
+ <label for="<?php esc_attr_e('wp_user_avatar_link_external'); ?>"><?php _e('or', 'wp-user-avatar'); ?></label>
106
+ <input type="text" size="36" id="<?php esc_attr_e('wp_user_avatar_link_external'); ?>" name="<?php esc_attr_e('wp_user_avatar_link_external'); ?>" value="" />
107
+ </p>
108
+
109
+ <p>
110
+ <label for="<?php esc_attr_e('wp_user_avatar_target'); ?>"></label>
111
+ <input type="checkbox" id="<?php esc_attr_e('wp_user_avatar_target'); ?>" name="<?php esc_attr_e('wp_user_avatar_target'); ?>" value="_blank" /> <strong><?php _e('Open link in a new window'); ?></strong>
112
+ </p>
113
+
114
+ <div class="mceActionPanel">
115
+ <input type="submit" id="insert" class="button-primary" name="insert" value="<?php _e('Insert'); ?> <?php _e('WP User Avatar'); ?>" onclick="insert_wp_user_avatar();" />
116
+ </div>
117
+ </form>
118
+ </body>
119
+ </html>
index.html CHANGED
@@ -0,0 +1 @@
 
1
+ <!-- Thanks for using WP User Avatar! -->
js/wp-user-avatar.js CHANGED
@@ -1,11 +1 @@
1
- function setWPUserAvatar(attachment, imageURL){
2
- jQuery('#wp-user-avatar', window.parent.document).val(attachment);
3
- jQuery('#wp-user-avatar-preview', window.parent.document).find('img').attr('src', imageURL).attr('width', '96').removeAttr('height', '');
4
- jQuery('#wp-user-avatar-message', window.parent.document).show();
5
- jQuery('#remove-wp-user-avatar', window.parent.document).show();
6
- if(typeof(wp) != 'undefined'){
7
- wp.media.wpUserAvatar.frame().close()
8
- } else {
9
- window.parent.tb_remove();
10
- }
11
- }
1
+ eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('5 1a(c,d,f){0.7.n={K:5(){r 0.7.u.x.j.o},O:5(a){t b=0.7.u.x;b.j.o=a;b.j.M=2(\'1h.l-1g\').B(\'C\').F(\'G\');H(b.j.o){S(b.j.o,b.j.M);2(\'#I\').L(\'i\')}},s:5(){H(3.8){r 3.8}3.8=0.7({v:\'Q\',1f:[1e 0.7.1d.1c({Y:d+": "+c})]});3.8.h(\'N\',5(){t a=3.v().K(\'m\');A=2(\'#0-4-6\').D();l=0.7.l(A);l.19();a.E(l?[l]:[])},3.8);3.8.h(\'18:17:p\',5(a){3.16(a,{Z:f})},3.8);3.8.v(\'Q\').h(\'p\',3.p);r 3.8},p:5(a){t b=0.7.u.x,m=3.K(\'m\').1b();0.7.n.O(m?m.A:-1)},X:5(){2(\'z\').h(\'i\',\'#E-0-4-6\',5(e){e.J();e.10();0.7.n.s().N()})}};2(0.7.n.X)}5 11(a,b){2(\'z\').h(\'i\',\'#E-0-4-6\',5(e){e.J();12(\'13 14 15: \'+a,b)})}5 S(a,b){2(\'#0-4-6\',9.g.k).D(a);2(\'#0-4-6-P\',9.g.k).B(\'C\').F(\'G\',b).q(\'V\',\'\').q(\'U\',\'\');2(\'#0-4-6-T\',9.g.k).w();2(\'#R-0-4-6\',9.g.k).w();2(\'#0-4-6-W\',9.g.k).y();2(\'#I\',9.g.k).L(\'i\');H(1i(0)!=\'1j\'){0.7.n.s().1k()}1l{9.g.1m()}}5 1n(a){2(\'z\').h(\'i\',\'#R-0-4-6\',5(e){e.J();2(3).y();2(\'#1o-0-4-6, #0-4-6-W\').y();2(\'#0-4-6-P\').B(\'C\').F(\'G\',a).q(\'V\',\'\').q(\'U\',\'\');2(\'#0-4-6\').D(\'\');2(\'#0-4-6-T\').w();2(\'#I\').L(\'i\')})}',62,87,'wp||jQuery|this|user|function|avatar|media|_frame|window|||||||parent|on|click|post|document|attachment|selection|wpUserAvatar|wpUserAvatarId|select|removeAttr|return|frame|var|view|state|show|settings|hide|body|id|find|img|val|add|attr|src|if|wp_user_avatar_radio|preventDefault|get|trigger|wpUserAvatarSrc|open|set|preview|library|remove|setWPUserAvatar|message|height|width|thumbnail|init|title|text|stopPropagation|openThickboxUploader|tb_show|WP|User|Avatar|createSelectToolbar|create|toolbar|fetch|openMediaUploader|single|Library|controller|new|states|info|div|typeof|undefined|close|else|tb_remove|removeWPUserAvatar|edit'.split('|'),0,{}))
 
 
 
 
 
 
 
 
 
 
lang/wp-user-avatar-de_DE.mo ADDED
Binary file
lang/wp-user-avatar-de_DE.po ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # German (de_DE) translation for WP User Avatar.
2
+ # Copyright (C) 2013 Bangbay Siboliban.
3
+ # This file is distributed under the same license as the WP User Avatar package.
4
+ #
5
+ msgid ""
6
+ msgstr ""
7
+ "Project-Id-Version: WP User Avatar 1.5\n"
8
+ "Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
9
+ "POT-Creation-Date: 2013-06-17 00:00-0000\n"
10
+ "PO-Revision-Date: 2013-06-17 00:00-0000\n"
11
+ "Last-Translator: Google Translate\n"
12
+ "Language-Team: Google Translate\n"
13
+ "MIME-Version: 1.0\n"
14
+ "Content-Type: text/plain; charset=UTF-8\n"
15
+ "Content-Transfer-Encoding: 8bit\n"
16
+
17
+ #: wp-user-avatar.php:881
18
+ msgid "Add avatar button to Visual Editor"
19
+ msgstr "In avatar-Taste, um Visueller Editor"
20
+
21
+ #: wp-user-avatar.php:885
22
+ msgid "Allow Contributors &amp; Subscribers to upload avatars"
23
+ msgstr "Erlauben Anbieter & Abonnenten Avatare hochladen"
24
+
25
+ #: wp-user-avatar.php:327
26
+ msgid "Allowed file formats"
27
+ msgstr "Erlaubte Dateiformate"
28
+
29
+ #: wp-user-avatar.php:889
30
+ msgid "Disable Gravatar &mdash; Use only local avatars"
31
+ msgstr "Deaktivieren Gravatar &mdash; Verwenden Sie nur lokale Avatare"
32
+
33
+ #: wp-user-avatar.php:320
34
+ #: wp-user-avatar.php:331
35
+ #: wp-user-avatar.php:500
36
+ #: wp-user-avatar.php:508
37
+ msgid "Edit WP User Avatar"
38
+ msgstr "WP User Avatar bearbeiten"
39
+
40
+ #: wp-user-avatar.php:327
41
+ msgid "JPG, GIF, PNG"
42
+ msgstr "JPG, GIF, PNG"
43
+
44
+ #: wp-user-avatar.php:335
45
+ msgid "Original"
46
+ msgstr "Original"
47
+
48
+ #: wp-user-avatar.php:342
49
+ #: wp-user-avatar.php:508
50
+ msgid "Press %s to save your changes"
51
+ msgstr "Drücken %s um Ihre Änderungen zu speichern"
52
+
53
+ #: wp-user-avatar.php:351
54
+ #: wp-user-avatar.php:500
55
+ msgid "Set WP User Avatar"
56
+ msgstr "WP User Avatar festlegen"
57
+
58
+ #: wp-user-avatar.php:895
59
+ msgid "Upload Size Limit (only for Contributors & Subscribers)"
60
+ msgstr "Hochladen Size Limit (nur für Autoren & Abonnenten)"
61
+
62
+ #: wp-user-avatar.php:899
63
+ msgid "Upload Size Limit cannot be larger than the maximum"
64
+ msgstr "Hochladen Size Limit kann nicht größer sein als die maximale"
65
+
66
+ #: wp-user-avatar.php:875
67
+ #: wp-user-avatar.php:878
68
+ msgid "WP User Avatar Settings"
69
+ msgstr "Einstellungen > WP User Avatar"
70
+
71
+ #: window.php:70
72
+ msgid "Choose a preset size or enter a number value"
73
+ msgstr "Wählen Sie eine voreingestellte Größe oder geben Sie einen Zahlenwert"
74
+
75
+ #: window.php:93
76
+ msgid "Link to image file, attachment page, or custom URL"
77
+ msgstr "Link zur Bild-Datei, Anhang-Seite, oder benutzerdefinierte URL"
78
+
79
+ #: window.php:62
80
+ msgid "User"
81
+ msgstr "Benutzer"
82
+
83
+ #: window.php:81
84
+ #: window.php:105
85
+ msgid "or"
86
+ msgstr "oder"
87
+
88
+ #. Plugin Name of the plugin/theme
89
+ msgid "WP User Avatar"
90
+ msgstr "WP User Avatar"
91
+
92
+ #. Plugin URI of the plugin/theme
93
+ msgid "http://wordpress.org/plugins/wp-user-avatar/"
94
+ msgstr "http://wordpress.org/plugins/wp-user-avatar/"
95
+
96
+ #. Description of the plugin/theme
97
+ msgid "Use any image from your WordPress Media Library as a custom user avatar. Add your own Default Avatar."
98
+ msgstr "Verwenden Sie ein beliebiges Bild in Ihrem WordPress Mediathek als benutzerdefinierte avatar. Fügen Sie Ihre eigenen Standardavatar."
99
+
100
+ #. Author of the plugin/theme
101
+ msgid "Bangbay Siboliban"
102
+ msgstr "Bangbay Siboliban"
103
+
104
+ #. Author URI of the plugin/theme
105
+ msgid "http://siboliban.org/"
106
+ msgstr "http://siboliban.org/"
lang/wp-user-avatar-es_ES.mo ADDED
Binary file
lang/wp-user-avatar-es_ES.po ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Spanish (es_ES) translation for WP User Avatar.
2
+ # Copyright (C) 2013 Bangbay Siboliban.
3
+ # This file is distributed under the same license as the WP User Avatar package.
4
+ #
5
+ msgid ""
6
+ msgstr ""
7
+ "Project-Id-Version: WP User Avatar 1.5\n"
8
+ "Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
9
+ "POT-Creation-Date: 2013-06-17 00:00-0000\n"
10
+ "PO-Revision-Date: 2013-06-17 00:00-0000\n"
11
+ "Last-Translator: Google Translate\n"
12
+ "Language-Team: Google Translate\n"
13
+ "MIME-Version: 1.0\n"
14
+ "Content-Type: text/plain; charset=UTF-8\n"
15
+ "Content-Transfer-Encoding: 8bit\n"
16
+
17
+ #: wp-user-avatar.php:881
18
+ msgid "Add avatar button to Visual Editor"
19
+ msgstr "Agregar botón avatar a Editor visual"
20
+
21
+ #: wp-user-avatar.php:885
22
+ msgid "Allow Contributors &amp; Subscribers to upload avatars"
23
+ msgstr "Permitir colaboradores y suscriptores cargar avatares"
24
+
25
+ #: wp-user-avatar.php:327
26
+ msgid "Allowed file formats"
27
+ msgstr "Formatos de archivo permitidos"
28
+
29
+ #: wp-user-avatar.php:889
30
+ msgid "Disable Gravatar &mdash; Use only local avatars"
31
+ msgstr "Desactivar Gravatar &mdash; Utilice sólo los avatares locales"
32
+
33
+ #: wp-user-avatar.php:320
34
+ #: wp-user-avatar.php:331
35
+ #: wp-user-avatar.php:500
36
+ #: wp-user-avatar.php:508
37
+ msgid "Edit WP User Avatar"
38
+ msgstr "Editar WP User Avatar"
39
+
40
+ #: wp-user-avatar.php:327
41
+ msgid "JPG, GIF, PNG"
42
+ msgstr "JPG, GIF, PNG"
43
+
44
+ #: wp-user-avatar.php:335
45
+ msgid "Original"
46
+ msgstr "Original"
47
+
48
+ #: wp-user-avatar.php:342
49
+ #: wp-user-avatar.php:508
50
+ msgid "Press %s to save your changes"
51
+ msgstr "Presione %s para guardar los cambios"
52
+
53
+ #: wp-user-avatar.php:351
54
+ #: wp-user-avatar.php:500
55
+ msgid "Set WP User Avatar"
56
+ msgstr "Asignar WP User Avatar"
57
+
58
+ #: wp-user-avatar.php:895
59
+ msgid "Upload Size Limit (only for Contributors & Subscribers)"
60
+ msgstr "Sube límite de tamaño (sólo para colaboradores y suscriptores)"
61
+
62
+ #: wp-user-avatar.php:899
63
+ msgid "Upload Size Limit cannot be larger than the maximum"
64
+ msgstr "Sube límite de tamaño no puede ser mayor que el máximo"
65
+
66
+ #: wp-user-avatar.php:875
67
+ #: wp-user-avatar.php:878
68
+ msgid "WP User Avatar Settings"
69
+ msgstr "Ajustes de WP User Avatar"
70
+
71
+ #: window.php:70
72
+ msgid "Choose a preset size or enter a number value"
73
+ msgstr "Elija un tamaño preestablecido o escriba un valor numérico"
74
+
75
+ #: window.php:93
76
+ msgid "Link to image file, attachment page, or custom URL"
77
+ msgstr "Enlazado a archivo de imagen, página de adjuntos o URL personalizada"
78
+
79
+ #: window.php:62
80
+ msgid "User"
81
+ msgstr "Usuario"
82
+
83
+ #: window.php:81
84
+ #: window.php:105
85
+ msgid "or"
86
+ msgstr "o"
87
+
88
+ #. Plugin Name of the plugin/theme
89
+ msgid "WP User Avatar"
90
+ msgstr "WP User Avatar"
91
+
92
+ #. Plugin URI of the plugin/theme
93
+ msgid "http://wordpress.org/plugins/wp-user-avatar/"
94
+ msgstr "http://wordpress.org/plugins/wp-user-avatar/"
95
+
96
+ #. Description of the plugin/theme
97
+ msgid "Use any image from your WordPress Media Library as a custom user avatar. Add your own Default Avatar."
98
+ msgstr "Utilice cualquier imagen en tu Librería multimedia como un avatar de usuario personalizada. Haz tu propia Avatar por defecto."
99
+
100
+ #. Author of the plugin/theme
101
+ msgid "Bangbay Siboliban"
102
+ msgstr "Bangbay Siboliban"
103
+
104
+ #. Author URI of the plugin/theme
105
+ msgid "http://siboliban.org/"
106
+ msgstr "http://siboliban.org/"
lang/wp-user-avatar-fr_FR.mo ADDED
Binary file
lang/wp-user-avatar-fr_FR.po ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # French (fr_FR) translation for WP User Avatar.
2
+ # Copyright (C) 2013 Bangbay Siboliban.
3
+ # This file is distributed under the same license as the WP User Avatar package.
4
+ #
5
+ msgid ""
6
+ msgstr ""
7
+ "Project-Id-Version: WP User Avatar 1.5\n"
8
+ "Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
9
+ "POT-Creation-Date: 2013-06-17 00:00-0000\n"
10
+ "PO-Revision-Date: 2013-06-17 00:00-0000\n"
11
+ "Last-Translator: Google Translate\n"
12
+ "Language-Team: Google Translate\n"
13
+ "MIME-Version: 1.0\n"
14
+ "Content-Type: text/plain; charset=UTF-8\n"
15
+ "Content-Transfer-Encoding: 8bit\n"
16
+
17
+ #: wp-user-avatar.php:881
18
+ msgid "Add avatar button to Visual Editor"
19
+ msgstr "Ajouter bouton avatar sur Éditeur visuel"
20
+
21
+ #: wp-user-avatar.php:885
22
+ msgid "Allow Contributors &amp; Subscribers to upload avatars"
23
+ msgstr "Permettre aux contributeurs et aux abonnés d'envoyer avatars"
24
+
25
+ #: wp-user-avatar.php:327
26
+ msgid "Allowed file formats"
27
+ msgstr "Formats acceptés"
28
+
29
+ #: wp-user-avatar.php:889
30
+ msgid "Disable Gravatar &mdash; Use only local avatars"
31
+ msgstr "Désactiver Gravatar &mdash; Utilisez seulement des avatars locaux"
32
+
33
+ #: wp-user-avatar.php:320
34
+ #: wp-user-avatar.php:331
35
+ #: wp-user-avatar.php:500
36
+ #: wp-user-avatar.php:508
37
+ msgid "Edit WP User Avatar"
38
+ msgstr "Modifier WP User Avatar"
39
+
40
+ #: wp-user-avatar.php:327
41
+ msgid "JPG, GIF, PNG"
42
+ msgstr "JPG, GIF, PNG"
43
+
44
+ #: wp-user-avatar.php:335
45
+ msgid "Original"
46
+ msgstr "Originale"
47
+
48
+ #: wp-user-avatar.php:342
49
+ #: wp-user-avatar.php:508
50
+ msgid "Press %s to save your changes"
51
+ msgstr "Appuyez %s pour enregistrer vos modifications"
52
+
53
+ #: wp-user-avatar.php:351
54
+ #: wp-user-avatar.php:500
55
+ msgid "Set WP User Avatar"
56
+ msgstr "Utiliser WP User Avatar"
57
+
58
+ #: wp-user-avatar.php:895
59
+ msgid "Upload Size Limit (only for Contributors & Subscribers)"
60
+ msgstr "Téléchargez limite de taille (seulement pour les contributeurs et abonnés)"
61
+
62
+ #: wp-user-avatar.php:899
63
+ msgid "Upload Size Limit cannot be larger than the maximum"
64
+ msgstr "Téléchargez la limite de taille ne peut pas être supérieure au maximum"
65
+
66
+ #: wp-user-avatar.php:875
67
+ #: wp-user-avatar.php:878
68
+ msgid "WP User Avatar Settings"
69
+ msgstr "Réglages de WP User Avatar"
70
+
71
+ #: window.php:70
72
+ msgid "Choose a preset size or enter a number value"
73
+ msgstr "Choisissez une taille prédéfinie ou entrez une valeur numérique"
74
+
75
+ #: window.php:93
76
+ msgid "Link to image file, attachment page, or custom URL"
77
+ msgstr "Lier à fichier d'image, page du fichier attaché ou lien personnalisé"
78
+
79
+ #: window.php:62
80
+ msgid "User"
81
+ msgstr "Utilisateur"
82
+
83
+ #: window.php:81
84
+ #: window.php:105
85
+ msgid "or"
86
+ msgstr "ou"
87
+
88
+ #. Plugin Name of the plugin/theme
89
+ msgid "WP User Avatar"
90
+ msgstr "WP User Avatar"
91
+
92
+ #. Plugin URI of the plugin/theme
93
+ msgid "http://wordpress.org/plugins/wp-user-avatar/"
94
+ msgstr "http://wordpress.org/plugins/wp-user-avatar/"
95
+
96
+ #. Description of the plugin/theme
97
+ msgid "Use any image from your WordPress Media Library as a custom user avatar. Add your own Default Avatar."
98
+ msgstr "Utilisez n'importe quelle image dans votre médiathèque WordPress comme un avatar de l'utilisateur personnalisé. Ajoutez votre propre avatar par défaut."
99
+
100
+ #. Author of the plugin/theme
101
+ msgid "Bangbay Siboliban"
102
+ msgstr "Bangbay Siboliban"
103
+
104
+ #. Author URI of the plugin/theme
105
+ msgid "http://siboliban.org/"
106
+ msgstr "http://siboliban.org/"
readme.txt CHANGED
@@ -2,41 +2,45 @@
2
 
3
  Contributors: bangbay
4
  Donate link: http://siboliban.org/donate
5
- Tags: author image, author photo, author avatar, avatar, profile avatar, profile image, profile photo, user avatar, user image, user photo
6
- Requires at least: 3.3
7
- Tested up to: 3.5
8
- Stable tag: 1.0.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
- Use any image from your WordPress Media Library as a custom user avatar.
13
 
14
  == Description ==
15
 
16
- WordPress currently only allows you to use custom avatars that are uploaded through gravatar.com. WP User Avatar enables you to use any photo uploaded into your Media Library as an avatar. This means any image you've uploaded for a page or post is available for you to use as an avatar. No extra folders or image editing functions are necessary.
17
 
18
- To use WP User Avatar in your theme, replace anywhere you use the function get_avatar() with get_wp_user_avatar(). get_wp_user_avatar() accepts the same fields as get_avatar() with added functionality.
19
 
20
- This plugin uses the new Media Uploader introduced in WordPress 3.5, but is also backwards-compatible to WordPress 3.3.
 
 
 
 
 
 
 
21
 
22
  == Installation ==
23
 
24
  1. Download, install, and activate the WP User Avatar plugin.
25
- 2. Choose a profile to edit.
26
- 3. In edit mode, click "Edit WP User Avatar".
27
- 4. Choose an image, then click "Set WP User Avatar".
28
- 5. Click "Update Profile".
29
- 6. In your theme, use the function get_wp_user_avatar() in place of get_avatar().
30
-
31
- == Frequently Asked Questions ==
32
 
33
- = How do I use WP User Avatar? =
34
 
35
- In your theme, replace get_avatar with get_wp_user_avatar().
36
 
37
- **Examples:**
38
-
39
- Within The Loop, you may be using:
40
 
41
  `<?php echo get_avatar(get_the_author_meta('ID'), 96); ?>`
42
 
@@ -44,35 +48,329 @@ Replace this function with:
44
 
45
  `<?php echo get_wp_user_avatar(get_the_author_meta('ID'), 96); ?>`
46
 
47
- You can also use the values "original", "large", "medium", and "thumbnail" for your avatar size:
48
 
49
  `<?php echo get_wp_user_avatar(get_the_author_meta('ID'), 'medium'); ?>`
50
 
51
- On an author page outside of The Loop, you may be using:
 
 
 
 
52
 
53
- `<?php $user = get_user_by('slug', $author_name); echo get_avatar($user->ID, 96); ?>`
 
 
 
 
 
54
 
55
  Replace this function with:
56
 
57
- `<?php $user = get_user_by('slug', $author_name); echo get_wp_user_avatar($user->ID, 96); ?>`
 
 
 
58
 
59
- If you leave the options blank, WP User Avatar will detect whether you're inside or outside The Loop and return the correct avatar in the default 96x96 size:
60
 
61
  `<?php echo get_wp_user_avatar(); ?>`
62
 
63
- get_wp_user_avatar() will also fall back to get_avatar() if no WP User Avatar image is set. For this to work, "Show Avatars" must be checked in your Discussion settings.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
 
65
  == Screenshots ==
66
 
67
- 1. See thumbnails of WP User Avatar in the Users section.
68
- 2. WP User Avatar adds a field to your profile in edit mode.
 
 
 
 
69
 
70
  == Changelog ==
71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  = 1.0.1 =
73
- * Add: CSS classes to image output.
74
 
75
  = 1.0 =
76
  * Initial release
77
 
78
  == Upgrade Notice ==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  Contributors: bangbay
4
  Donate link: http://siboliban.org/donate
5
+ Tags: author image, author photo, author avatar, avatar, bbPress, profile avatar, profile image, user avatar, user image, user photo
6
+ Requires at least: 3.4
7
+ Tested up to: 3.5.1
8
+ Stable tag: 1.5
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
+ Use any image from your WordPress Media Library as a custom user avatar. Add your own Default Avatar.
13
 
14
  == Description ==
15
 
16
+ WordPress currently only allows you to use custom avatars that are uploaded through [Gravatar](http://gravatar.com/). WP User Avatar enables you to use any photo uploaded into your Media Library as an avatar. This means you use the same uploader and library as your posts. No extra folders or image editing functions are necessary.
17
 
18
+ WP User Avatar also lets you:
19
 
20
+ * Upload your own Default Avatar in your WP User Avatar settings.
21
+ * Show the user's [Gravatar](http://gravatar.com/) avatar or Default Avatar if the user doesn't have a WP User Avatar image.
22
+ * Disable [Gravatar](http://gravatar.com/) avatars and use only local avatars.
23
+ * Use the <code>[avatar]</code> shortcode in your posts. The shortcode will work with any theme, whether it has avatar support or not.
24
+ * Allow Contributors and Subscribers to upload their own avatars.
25
+ * Limit upload file size for Contributors and Subscribers.
26
+
27
+ This plugin uses the Media uploader introduced in WordPress 3.5, but is also backwards-compatible to WordPress 3.4. It is also compatible with WordPress Multisite.
28
 
29
  == Installation ==
30
 
31
  1. Download, install, and activate the WP User Avatar plugin.
32
+ 2. On your edit profile page, click "Edit WP User Avatar".
33
+ 3. Choose an image, then click "Set WP User Avatar".
34
+ 4. Click "Update Profile".
35
+ 5. Upload your own Default Avatar in your WP User Avatar settings (optional). You can also allow Contributors & Subscribers to upload avatars and disable Gravatar.
36
+ 6. Choose a theme that has avatar support. In your theme, manually replace <code>get_avatar</code> with <code>get_wp_user_avatar</code> or leave <code>get_avatar</code> as-is. [Read about the differences here](http://wordpress.org/extend/plugins/wp-user-avatar/faq/).
37
+ 7. You can also use the <code>[avatar]</code> shortcode in your posts. The shortcode will work with any theme, whether it has avatar support or not.
 
38
 
39
+ **Example Usage**
40
 
41
+ = Posts =
42
 
43
+ Within [The Loop](http://codex.wordpress.org/The_Loop), you may be using:
 
 
44
 
45
  `<?php echo get_avatar(get_the_author_meta('ID'), 96); ?>`
46
 
48
 
49
  `<?php echo get_wp_user_avatar(get_the_author_meta('ID'), 96); ?>`
50
 
51
+ You can also use the values "original", "large", "medium", or "thumbnail" for your avatar size:
52
 
53
  `<?php echo get_wp_user_avatar(get_the_author_meta('ID'), 'medium'); ?>`
54
 
55
+ You can also add an alignment of "left", "right", or "center":
56
+
57
+ `<?php echo get_wp_user_avatar(get_the_author_meta('ID'), 96, 'left'); ?>`
58
+
59
+ = Author Page =
60
 
61
+ On an author page outside of [The Loop](http://codex.wordpress.org/The_Loop), you may be using:
62
+
63
+ `<?php
64
+ $user = get_user_by('slug', $author_name);
65
+ echo get_avatar($user->ID, 96);
66
+ ?>`
67
 
68
  Replace this function with:
69
 
70
+ `<?php
71
+ $user = get_user_by('slug', $author_name);
72
+ echo get_wp_user_avatar($user->ID, 96);
73
+ ?>`
74
 
75
+ If you leave the options blank, WP User Avatar will detect whether you're inside [The Loop](http://codex.wordpress.org/The_Loop) or on an author page and return the correct avatar in the default 96x96 size:
76
 
77
  `<?php echo get_wp_user_avatar(); ?>`
78
 
79
+ The function <code>get_wp_user_avatar</code> can also fall back to <code>get_avatar</code> if there is no WP User Avatar image. For this to work, "Show Avatars" must be checked in your WP User Avatar settings. When this setting is enabled, you will see the user's [Gravatar](http://gravatar.com/) avatar or Default Avatar.
80
+
81
+ = Comments =
82
+
83
+ For comments, you might have in your template:
84
+
85
+ `<?php echo get_avatar($comment, 32); ?>`
86
+
87
+ Replace this function with:
88
+
89
+ `<?php echo get_wp_user_avatar($comment, 32); ?>`
90
+
91
+ For comments, you must specify the $comment variable.
92
+
93
+ **Other Available Functions**
94
+
95
+ = [avatar] shortcode =
96
+
97
+ You can use the <code>[avatar]</code> shortcode in your posts. It will detect the author of the post or you can specify an author by username. You can specify a size, alignment, and link, but they are optional. For links, you can link to the original image file, attachment page, or a custom URL.
98
+
99
+ `[avatar user="admin" size="medium" align="left" link="file"]`
100
+
101
+ = get_wp_user_avatar_src =
102
+
103
+ Works just like <code>get_wp_user_avatar</code> but returns just the image src. This is useful if you would like to link a thumbnail-sized avatar to a larger version of the image:
104
+
105
+ `<a href="<?php echo get_wp_user_avatar_src($user_id, 'large'); ?>">
106
+ <?php echo get_wp_user_avatar($user_id, 'thumbnail'); ?>
107
+ </a>`
108
+
109
+ = has_wp_user_avatar =
110
+
111
+ Returns true if the user has a WP User Avatar image. You must specify the user ID:
112
+
113
+ `<?php
114
+ if ( has_wp_user_avatar($user_id) ) {
115
+ echo get_wp_user_avatar($user_id, 96);
116
+ } else {
117
+ echo '<img src="my-alternate-image.jpg" />';
118
+ }
119
+ ?>`
120
+
121
+ == Frequently Asked Questions ==
122
+
123
+ = How do I use WP User Avatar? =
124
+
125
+ First, choose a theme that has avatar support. In your theme, you have a choice of manually replacing <code>get_avatar</code> with <code>get_wp_user_avatar</code>, or leaving <code>get_avatar</code> as-is. Here are the differences:
126
+
127
+ = get_wp_user_avatar =
128
+
129
+ 1. Allows you to use the values "original", "large", "medium", or "thumbnail" for your avatar size.
130
+ 2. Doesn't add a fixed width and height to the image if you use the aforementioned values. This will give you more flexibility to resize the image with CSS.
131
+ 3. Optionally adds CSS classes "alignleft", "alignright", or "aligncenter" to position your avatar.
132
+ 4. Shows nothing if the user has no WP User Avatar image.
133
+ 5. Shows the user's [Gravatar](http://gravatar.com/) avatar or Default Avatar only if "Show Avatars" is enabled in your WP User Avatar settings.
134
+
135
+ = get_avatar =
136
+
137
+ 1. Requires you to enable "Show Avatars" in your WP User Avatar settings to show any avatars.
138
+ 2. Accepts only numeric values for your avatar size.
139
+ 3. Always adds a fixed width and height to your image. This may cause problems if you use responsive CSS in your theme.
140
+ 4. Shows the user's [Gravatar](http://gravatar.com/) avatar or Default Avatar if the user doesn't have a WP User Avatar image. (Choosing "Blank" as your Default Avatar still generates a transparent image file.)
141
+ 5. Requires no changes to your theme files if you are currently using <code>get_avatar</code>.
142
+
143
+ [Read more about get_avatar in the WordPress Function Reference](http://codex.wordpress.org/Function_Reference/get_avatar).
144
+
145
+ = Can I create a custom Default Avatar? =
146
+ In your WP User Avatar settings, you can upload your own Default Avatar.
147
+
148
+ = Can I insert WP User Avatar directly into a post? =
149
+
150
+ You can use the <code>[avatar]</code> shortcode in your posts. It will detect the author of the post or you can specify an author by username. You can specify a size, alignment, and link, but they are optional. For links, you can link to the original image file, attachment page, or a custom URL.
151
+
152
+ `[avatar user="admin" size="96" align="left" link="file"]`
153
+
154
+ Outputs:
155
+
156
+ `<a href="{fileURL}" class="wp-user-avatar-link wp-user-avatar-file">
157
+ <img src="{imageURL}" width="96" height="96" class="wp-user-avatar wp-user-avatar-96 alignleft" />
158
+ </a>`
159
+
160
+ = Can Contributors or Subscribers choose their own WP User Avatar image? =
161
+ Yes, if you enable "Allow Contributors & Subscribers to upload avatars" in the WP User Avatar settings. These users will see a slightly different interface because they are allowed only one image upload.
162
+
163
+ = Will WP User Avatar work with comment author avatars? =
164
+
165
+ Yes, for registered users. Non-registered comment authors will show their [Gravatar](http://gravatar.com/) avatars or Default Avatar.
166
+
167
+ = Can I disable all Gravatar avatars? =
168
+
169
+ In your WP User Avatar settings, you can select "Disable Gravatar — Use only local avatars" to disable all [Gravatar](http://gravatar.com/) avatars on your site and replace them with your Default Avatar. This will affect your registered users and non-registered comment authors.
170
+
171
+ = Will WP User Avatar work with bbPress? =
172
+
173
+ Yes!
174
+
175
+ = Will WP User Avatar work with WordPress Multisite? =
176
+
177
+ Yes, however, each site has its own avatar settings. If you set a WP User Avatar image on one site, you have to set it again for different sites in your network.
178
+
179
+ = How can I see which users have an avatar? =
180
+
181
+ For Administrators, WP User Avatar adds a column with avatar thumbnails to your Users list table. If "Show Avatars" is enabled in your WP User Avatar settings, you will see avatars to the left of each username instead of in a new column.
182
+
183
+ = What CSS can I use with WP User Avatar? =
184
+
185
+ WP User Avatar will add the CSS classes "wp-user-avatar" and "wp-user-avatar-{size}" to your image. If you add an alignment, the corresponding alignment class will be added:
186
+
187
+ `<?php echo get_wp_user_avatar($user_id, 96, 'left'); ?>`
188
+
189
+ Outputs:
190
+
191
+ `<img src="{imageURL}" width="96" height="96" class="wp-user-avatar wp-user-avatar-96 alignleft" />`
192
+
193
+ **Note:** "alignleft", "alignright", and aligncenter" are common WordPress CSS classes, but not every theme supports them. Contact the theme author to add those CSS classes.
194
+
195
+ If you use the values "original", "large", "medium", or "thumbnail", no width or height will be added to the image. This will give you more flexibility to resize the image with CSS:
196
+
197
+ `<?php echo get_wp_user_avatar($user_id, 'medium'); ?>`
198
+
199
+ Outputs:
200
+
201
+ `<img src="{imageURL}" class="wp-user-avatar wp-user-avatar-medium" />`
202
+
203
+ **Note:** WordPress adds more CSS classes to the avatar not listed here.
204
+
205
+ If you use the <code>[avatar]</code> shortcode, WP User Avatar will add the CSS class "wp-user-avatar-link" to the link. It will also add CSS classes based on link type.
206
+
207
+ * Image File: wp-user-avatar-file
208
+ * Attachment: wp-user-avatar-attachment
209
+ * Custom URL: wp-user-avatar-custom
210
+
211
+ `[avatar user="admin" size="96" align="left" link="attachment"]`
212
+
213
+ Outputs:
214
+
215
+ `<a href="{attachmentURL}" class="wp-user-avatar-link wp-user-avatar-attachment">
216
+ <img src="{imageURL}" width="96" height="96" class="wp-user-avatar wp-user-avatar-96 alignleft" />
217
+ </a>`
218
+
219
+ = What other functions are available for WP User Avatar? =
220
+ * <code>get_wp_user_avatar_src</code>: retrieves just the image URL
221
+ * <code>has_wp_user_avatar</code>: checks if the user has a WP User Avatar image
222
+ * [See example usage here](http://wordpress.org/extend/plugins/wp-user-avatar/installation/)
223
 
224
  == Screenshots ==
225
 
226
+ 1. WP User Avatar admin settings.
227
+ 2. WP User Avatar lets you upload your own Default Avatar.
228
+ 3. WP User Avatar adds a field to your edit profile page.
229
+ 4. After you've chosen a WP User Avatar image, you will see the option to remove it.
230
+ 5. WP User Avatar adds a button to insert the [avatar] shortcode in the Visual Editor.
231
+ 6. Options for the [avatar] shortcode.
232
 
233
  == Changelog ==
234
 
235
+ = 1.5 =
236
+ * Add: Ability to disable Gravatar avatars
237
+ * Add: Upload size limiter for Contributors & Subscribers
238
+ * Add: French, German, and Spanish translations
239
+
240
+ = 1.4.2 =
241
+ * Bug Fix: Include screen.php for get_current_screen function
242
+
243
+ = 1.4.1 =
244
+ * Bug Fix: Allow multipart data in form
245
+ * Bug Fix: Use wp_die for errors
246
+
247
+ = 1.4 =
248
+ * Add: Uploader for Subscribers and Contributors
249
+ * Add: Media states for avatar images
250
+ * Add: Plugin admin settings
251
+ * Update: Change support only to WP 3.4+
252
+
253
+ = 1.3.6 =
254
+ * Add: Target for link in shortcode
255
+ * Update: Clean up code and add more comments
256
+
257
+ = 1.3.5 =
258
+ * Bug Fix: Swap TinyMCE file locations
259
+
260
+ = 1.3.4 =
261
+ * Update: Change support only to WP 3.3+ because of jQuery 1.7.1 support
262
+
263
+ = 1.3.3 =
264
+ * Update: Shortcode checks for user ID, login, slug, or e-mail address
265
+ * Update: Move jquery to register_script for < WP 3.5
266
+
267
+ = 1.3.2 =
268
+ * Bug Fix: Check for user before setting name in alt tag
269
+ * Update: readme.txt
270
+
271
+ = 1.3.1 =
272
+ * Bug Fix: Rename usermeta only if found
273
+
274
+ = 1.3 =
275
+ * Add: Multisite support
276
+ * Bug Fix: Warnings if no user found
277
+ * Update: Enable action_show_user_profile for any class using show_user_profile hook
278
+
279
+ = 1.2.6 =
280
+ * Bug Fix: options-discussion.php page doesn't show default avatars
281
+
282
+ = 1.2.5 =
283
+ * Bug Fix: Comment author showing wrong avatar
284
+ * Bug Fix: Avatar adds fixed dimensions when non-numeric size is used
285
+ * Update: Use local image for default avatar instead of calling image from Gravatar
286
+
287
+ = 1.2.4 =
288
+ * Bug Fix: Show default avatar when user removes custom avatar
289
+ * Bug Fix: Default Avatar save setting
290
+
291
+ = 1.2.3 =
292
+ * Bug Fix: Show default avatar when user removes custom avatar
293
+ * Bug Fix: Default Avatar save setting
294
+
295
+ = 1.2.2 =
296
+ * Add: Ability for bbPress users to edit avatar on front profile page
297
+ * Add: Link options for shortcode
298
+ * Bug Fix: Show WP User Avatar only to users with upload_files capability
299
+
300
+ = 1.2.1 =
301
+ * Add: TinyMCE button
302
+ * Update: Clean up redundant code
303
+ * Update: Compatibility only back to WordPress 3.3
304
+
305
+ = 1.2 =
306
+ * Add: Default Avatar setting
307
+
308
+ = 1.1.7 =
309
+ * Bug Fix: Change update_usermeta to update_user_meta
310
+
311
+ = 1.1.6 =
312
+ * Bug Fix: Image not showing in user profile edit
313
+
314
+ = 1.1.5a =
315
+ * Update: readme.txt
316
+
317
+ = 1.1.5 =
318
+ * Bug Fix: Remove stray curly bracket
319
+
320
+ = 1.1.4 =
321
+ * Bug Fix: Change get_usermeta to get_user_meta
322
+ * Bug Fix: Non-object warning when retrieving user ID
323
+
324
+ = 1.1.3 =
325
+ * Bug Fix: Comment author with no e-mail address
326
+
327
+ = 1.1.2 =
328
+ * Remove: Unused variables
329
+
330
+ = 1.1.1 =
331
+ * Bug Fix: Capabilities error in comment avatar
332
+
333
+ = 1.1 =
334
+ * Add: Add filter for get_avatar
335
+ * Add: CSS alignment classes
336
+ * Add: Replace comment author avatar
337
+ * Add: Shortcode
338
+ * Update: readme.txt
339
+
340
+ = 1.0.2 =
341
+ * Update: FAQ
342
+ * Remove: CSS that hides "Insert into Post"
343
+
344
  = 1.0.1 =
345
+ * Add: CSS classes to image output
346
 
347
  = 1.0 =
348
  * Initial release
349
 
350
  == Upgrade Notice ==
351
+
352
+ = 1.5 =
353
+ * New Feature: Ability to disable Gravatar avatars
354
+ * New Feature: Upload size limiter for Contributors & Subscribers
355
+ * New Feature: French and German translations
356
+
357
+ = 1.4 =
358
+ * New Feature: Setting to allow all users to upload avatars
359
+ * New Feature: Setting to add or remove Visual Editor button
360
+ * New Feature: Media states for avatar images
361
+ * Notice: WP User Avatar 1.4 only supports WordPress 3.4 and above. If you are using an older version of WordPress, please upgrade your version of WordPress first.
362
+
363
+ = 1.3 =
364
+ * New Feature: Multisite support
365
+
366
+ = 1.2.2 =
367
+ * New Features: Link options for shortcode, bbPress integration
368
+
369
+ = 1.2.1 =
370
+ * New Feature: Shortcode insertion button for Visual Editor
371
+
372
+ = 1.2 =
373
+ * New Feature: Default Avatar customization
374
+
375
+ = 1.1 =
376
+ * New Features: [avatar] shortcode, direct replacement of get_avatar() and comment author avatar, more CSS classes
screenshot-1.png DELETED
Binary file
screenshot-2.png DELETED
Binary file
uninstall.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package WP User Avatar
4
+ * @version 1.5
5
+ */
6
+
7
+ // Remove user metadata and options on plugin delete
8
+ if(!defined('WP_UNINSTALL_PLUGIN')){
9
+ die(__('You are not allowed to call this page directly.'));
10
+ }
11
+
12
+ global $wpdb, $blog_id, $switched;
13
+ $users = get_users();
14
+ // Remove settings for all sites in multisite
15
+ if(is_multisite()){
16
+ $blogs = $wpdb->get_results("SELECT * FROM $wpdb->blogs");
17
+ foreach($users as $user){
18
+ foreach($blogs as $blog){
19
+ delete_user_meta($user->ID, $wpdb->get_blog_prefix($blog->blog_id).'user_avatar');
20
+ }
21
+ }
22
+ foreach($blogs as $blog){
23
+ switch_to_blog($blog->blog_id);
24
+ delete_option('avatar_default_wp_user_avatar');
25
+ delete_option('wp_user_avatar_tinymce');
26
+ delete_option('wp_user_avatar_allow_upload');
27
+ delete_option('wp_user_avatar_default_avatar_updated');
28
+ delete_option('wp_user_avatar_users_updated');
29
+ delete_option('wp_user_avatar_media_updated');
30
+ }
31
+ } else {
32
+ foreach($users as $user){
33
+ delete_user_meta($user->ID, $wpdb->get_blog_prefix($blog_id).'user_avatar');
34
+ }
35
+ delete_option('avatar_default_wp_user_avatar');
36
+ delete_option('wp_user_avatar_tinymce');
37
+ delete_option('wp_user_avatar_allow_upload');
38
+ delete_option('wp_user_avatar_default_avatar_updated');
39
+ delete_option('wp_user_avatar_users_updated');
40
+ delete_option('wp_user_avatar_media_updated');
41
+ }
42
+ // Delete post meta
43
+ delete_post_meta_by_key('_wp_attachment_wp_user_avatar');
44
+ // Reset all default avatars to Mystery Man
45
+ update_option('avatar_default', 'mystery');
46
+ ?>
wp-user-avatar.php CHANGED
@@ -1,225 +1,1019 @@
1
  <?php
2
  /**
3
  * @package WP User Avatar
4
- * @version 1.0.1
5
  */
6
  /*
7
  Plugin Name: WP User Avatar
8
- Plugin URI: http://wordpress.org/extend/plugins/wp-user-avatar/
9
- Description: Use any image from your WordPress Media Library as a custom user avatar.
10
- Version: 1.0.1
11
  Author: Bangbay Siboliban
12
  Author URI: http://siboliban.org/
 
 
 
13
  */
14
 
 
 
 
 
 
15
  // Define paths and variables
16
- define('WP_USER_AVATAR_FOLDER', basename(dirname(__FILE__)));
17
- define('WP_USER_AVATAR_ABSPATH', trailingslashit(str_replace("\\","/", WP_PLUGIN_DIR.'/'.WP_USER_AVATAR_FOLDER)));
18
- define('WP_USER_AVATAR_URLPATH', trailingslashit(plugins_url(WP_USER_AVATAR_FOLDER)));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
- // Remove user metadata on plugin delete
21
- register_uninstall_hook(__FILE__, 'wp_user_avatar_delete_setup');
 
 
 
 
 
 
 
 
22
 
23
- // Remove user metadata
24
- function wp_user_avatar_delete_setup(){
25
- $users = get_users();
26
- foreach($users as $user){
27
- delete_user_meta($user->ID, 'wp_user_avatar');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  }
30
 
31
  // WP User Avatar
32
  if(!class_exists('wp_user_avatar')){
33
  class wp_user_avatar{
34
  function wp_user_avatar(){
35
- add_action('show_user_profile', array('wp_user_avatar','action_show_user_profile'));
36
- add_action('edit_user_profile', array($this,'action_show_user_profile'));
37
- add_action('personal_options_update', array($this,'action_process_option_update'));
38
- add_action('edit_user_profile_update', array($this,'action_process_option_update'));
39
- if(!function_exists('wp_enqueue_media')){
40
- add_filter('attachment_fields_to_edit', array($this, 'add_wp_user_avatar_attachment_field_to_edit'), 10, 2);
41
- }
42
- add_filter('manage_users_columns', array($this, 'add_wp_user_avatar_column'), 10, 1);
43
- add_filter('manage_users_custom_column', array($this, 'show_wp_user_avatar_column'), 10, 3);
44
- add_action('admin_enqueue_scripts', array($this, 'media_upload_scripts'));
45
- }
46
-
47
- // Add to user profile edit
48
- function action_show_user_profile($user){
49
- $wp_user_avatar = get_user_meta($user->ID, 'wp_user_avatar', true);
50
- $hide = empty($wp_user_avatar) ? ' style="display:none;"' : '';
51
- ?>
52
- <h3><?php _e('WP User Avatar') ?></h3>
53
- <table class="form-table">
54
- <tbody>
55
- <tr>
56
- <th><label for="wp_user_avatar"><?php _e('WP User Avatar'); ?></label></th>
57
- <td>
58
- <input type="hidden" name="wp-user-avatar" id="wp-user-avatar" value="<?php echo $wp_user_avatar; ?>" />
59
- <p><button type="button" class="button" id="add-wp-user-avatar"><?php _e('Edit WP User Avatar'); ?></button></p>
60
- <div id="wp-user-avatar-preview">
61
- <p>
62
- <?php
63
- if(!empty($wp_user_avatar)){
64
- echo get_wp_user_avatar($user->ID, 'medium');
65
- } else {
66
- if(get_option('show_avatars') == '1'){
67
- echo get_avatar($user->ID, 96);
68
- } else {
69
- echo '<img src="'.includes_url().'images/blank.gif" alt="" />';
70
- }
71
- }
72
- ?>
73
- </p>
74
- </div>
75
- <p><button type="button" class="button" id="remove-wp-user-avatar"<?php echo $hide; ?>><?php _e('Remove'); ?></button></p>
76
- <p id="wp-user-avatar-message"><?php _e('Press "Update Profile" to save your changes.'); ?></p>
77
- </td>
78
- </tr>
79
- </tbody>
80
- </table>
81
- <script type="text/javascript">
82
- jQuery(function($){
83
- <?php if(function_exists('wp_enqueue_media')) : // Use Backbone uploader for WP 3.5+ ?>
84
- wp.media.wpUserAvatar = {
85
- get: function() {
86
- return wp.media.view.settings.post.wpUserAvatarId;
87
- },
88
- set: function(id) {
89
- var settings = wp.media.view.settings;
90
- settings.post.wpUserAvatarId = id;
91
- settings.post.wpUserAvatarSrc = $('div.attachment-info').find('img').attr('src');
92
- if(settings.post.wpUserAvatarId)
93
- setWPUserAvatar(settings.post.wpUserAvatarId, settings.post.wpUserAvatarSrc);
94
- },
95
- frame: function(){
96
- if(this._frame)
97
- return this._frame;
98
- this._frame = wp.media({
99
- state: 'library',
100
- states: [ new wp.media.controller.Library({ title: "Edit WP User Avatar: <?php echo $user->display_name; ?>" }) ]
101
- });
102
- this._frame.on('open', function(){
103
- var selection = this.state().get('selection');
104
- id = jQuery('#wp-user-avatar').val();
105
- attachment = wp.media.attachment(id);
106
- attachment.fetch();
107
- selection.add(attachment ? [ attachment ] : []);
108
- }, this._frame);
109
- this._frame.on('toolbar:create:select', function(toolbar){
110
- this.createSelectToolbar(toolbar, {
111
- text: 'Set WP User Avatar'
112
- });
113
- }, this._frame);
114
- this._frame.state('library').on('select', this.select);
115
- return this._frame;
116
- },
117
- select: function(id) {
118
- var settings = wp.media.view.settings,
119
- selection = this.get('selection').single();
120
- wp.media.wpUserAvatar.set(selection ? selection.id : -1);
121
- },
122
- init: function() {
123
- $('body').on('click', '#add-wp-user-avatar', function(e){
124
- e.preventDefault();
125
- e.stopPropagation();
126
- wp.media.wpUserAvatar.frame().open();
127
- });
128
- }
129
- };
130
- $(wp.media.wpUserAvatar.init);
131
- <?php else : // Fall back to Thickbox uploader ?>
132
- $('#add-wp-user-avatar').click(function(e){
133
- e.preventDefault();
134
- tb_show('Edit WP User Avatar: <?php echo $user->display_name; ?>', 'media-upload.php?type=image&post_type=user&tab=library&TB_iframe=1');
135
- });
136
- <?php endif; ?>
137
- });
138
- jQuery(function($){
139
- $('#remove-wp-user-avatar').click(function(e){
140
- var gravatar = '<?php echo addslashes(get_avatar($user->ID)); ?>';
141
- if(gravatar == ''){
142
- gravatar = '<img src="<?php echo includes_url().'images/blank.gif'; ?>" alt="" />';
143
  }
144
- e.preventDefault();
145
- $(this).hide();
146
- $('#wp-user-avatar-preview').find('img').replaceWith(gravatar);
147
- $('#wp-user-avatar').val('');
148
- $('#wp-user-avatar-message').show();
149
- });
150
- });
151
- </script>
152
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
  }
 
 
 
 
 
 
 
 
 
 
 
154
  // Update user meta
155
- function action_process_option_update($user_id){
156
- update_user_meta($user_id, 'wp_user_avatar', (isset($_POST['wp-user-avatar']) ? $_POST['wp-user-avatar'] : ''));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  }
158
 
159
- // Add button to attach image
160
- function add_wp_user_avatar_attachment_field_to_edit($fields, $post){
161
  $image = wp_get_attachment_image_src($post->ID, "medium");
162
- $button .= '<button type="button" class="button" id="set-wp-user-avatar-image" onclick="setWPUserAvatar(\''.$post->ID.'\', \''.$image[0].'\')">Set WP User Avatar</button>';
163
  $fields['wp-user-avatar'] = array(
164
- 'label' => __('WP User Avatar'),
165
  'input' => 'html',
166
  'html' => $button
167
  );
168
  return $fields;
169
  }
170
 
171
- // Add column to Users page
172
- function add_wp_user_avatar_column($columns){
173
- return $columns + array('wp-user-avatar' => __('WP User Avatar'));;
 
 
 
 
174
  }
175
 
176
- // Show thumbnail of wp_user_avatar
177
- function show_wp_user_avatar_column($value, $column_name, $user_id){
178
- $wp_user_avatar = get_user_meta($user_id, 'wp_user_avatar', true);
179
- $wp_user_avatar_image = wp_get_attachment_image($wp_user_avatar, array(32,32));
 
 
 
 
 
 
180
  if($column_name == 'wp-user-avatar'){
181
- return $wp_user_avatar_image;
182
  }
183
  }
184
 
185
  // Media uploader
186
- function media_upload_scripts(){
187
- wp_enqueue_script('media-upload');
188
- wp_enqueue_script('thickbox');
189
  if(function_exists('wp_enqueue_media')){
 
190
  wp_enqueue_media();
 
 
 
 
 
 
 
 
 
 
191
  }
192
- wp_enqueue_script('wp-user-avatar', WP_USER_AVATAR_URLPATH.'js/wp-user-avatar.js');
193
- wp_enqueue_style('thickbox');
194
- wp_enqueue_style('wp-user-avatar', WP_USER_AVATAR_URLPATH.'css/wp-user-avatar.css');
195
  }
196
  }
197
- // Initialize wp_user_avatar
198
- global $wp_user_avatar_instance;
199
- $wp_user_avatar_instance = new wp_user_avatar();
200
- }
201
 
202
- // Find wp_user_avatar, show get_avatar if empty
203
- function get_wp_user_avatar($id_or_email = '', $size = '96', $default = '', $alt = ''){
204
- global $post;
205
- $author_name = get_query_var('author_name');
206
- // Find author ID on author page or post
207
- if(!empty($id_or_email)){
208
- $user = is_numeric($id_or_email) ? get_user_by('id', $id_or_email) : get_user_by('email', $id_or_email);
209
- } else {
210
- $user = is_author() ? get_user_by('slug', $author_name) : get_the_author_meta('id');
211
- }
212
- $id_or_email = $user->ID;
213
- $alt = $user->display_name;
214
- $wp_user_avatar_meta = get_the_author_meta('wp_user_avatar', $id_or_email);
215
- if(!empty($wp_user_avatar_meta)){
216
- $get_size = is_numeric($size) ? array($size,$size) : $size;
217
- $wp_user_avatar_image = wp_get_attachment_image_src($wp_user_avatar_meta, $get_size);
218
- $dimensions = is_numeric($size) ? ' width="'.$wp_user_avatar_image[1].'" height="'.$wp_user_avatar_image[2].'"' : '';
219
- $wp_user_avatar = '<img src="'.$wp_user_avatar_image[0].'"'.$dimensions.' alt="'.$alt.'" class="wp-user-avatar wp-user-avatar-'.$size.' avatar avatar-'.$size.' photo" />';
220
- } else {
221
- $wp_user_avatar = get_avatar($id_or_email, $size, $default, $alt);
222
- }
223
- return $wp_user_avatar;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
224
  }
225
  ?>
1
  <?php
2
  /**
3
  * @package WP User Avatar
4
+ * @version 1.5
5
  */
6
  /*
7
  Plugin Name: WP User Avatar
8
+ Plugin URI: http://wordpress.org/plugins/wp-user-avatar/
9
+ Description: Use any image from your WordPress Media Library as a custom user avatar. Add your own Default Avatar.
 
10
  Author: Bangbay Siboliban
11
  Author URI: http://siboliban.org/
12
+ Version: 1.5
13
+ Text Domain: wp-user-avatar
14
+ Domain Path: /lang/
15
  */
16
 
17
+ if(!defined('ABSPATH')){
18
+ die(__('You are not allowed to call this page directly.'));
19
+ @header('Content-Type:'.get_option('html_type').';charset='.get_option('blog_charset'));
20
+ }
21
+
22
  // Define paths and variables
23
+ define('WPUA_VERSION', '1.5');
24
+ define('WPUA_FOLDER', basename(dirname(__FILE__)));
25
+ define('WPUA_ABSPATH', trailingslashit(str_replace('\\', '/', WP_PLUGIN_DIR.'/'.WPUA_FOLDER)));
26
+ define('WPUA_URLPATH', trailingslashit(plugins_url(WPUA_FOLDER)));
27
+
28
+ // Define global variables
29
+ $avatar_default = get_option('avatar_default');
30
+ $wpua_avatar_default = get_option('avatar_default_wp_user_avatar');
31
+ $show_avatars = get_option('show_avatars');
32
+ $wpua_tinymce = get_option('wp_user_avatar_tinymce');
33
+ $wpua_allow_upload = get_option('wp_user_avatar_allow_upload');
34
+ $wpua_disable_gravatar = get_option('wp_user_avatar_disable_gravatar');
35
+ $mustache_original = WPUA_URLPATH.'images/wp-user-avatar.png';
36
+ $mustache_medium = WPUA_URLPATH.'images/wp-user-avatar-300x300.png';
37
+ $mustache_thumbnail = WPUA_URLPATH.'images/wp-user-avatar-150x150.png';
38
+ $mustache_avatar = WPUA_URLPATH.'images/wp-user-avatar-96x96.png';
39
+ $mustache_admin = WPUA_URLPATH.'images/wp-user-avatar-32x32.png';
40
+ $ssl = is_ssl() ? 's' : "";
41
+
42
+ // Check for updates
43
+ $wpua_default_avatar_updated = get_option('wp_user_avatar_default_avatar_updated');
44
+ $wpua_users_updated = get_option('wp_user_avatar_users_updated');
45
+ $wpua_media_updated = get_option('wp_user_avatar_media_updated');
46
+
47
+ // Max upload size
48
+ if(!function_exists('wp_max_upload_size')){
49
+ require_once(ABSPATH.'wp-admin/includes/template.php');
50
+ }
51
+
52
+ // Server upload size limit
53
+ $upload_size_limit = wp_max_upload_size();
54
+ // Convert to KB
55
+ if($upload_size_limit > 1024){
56
+ $upload_size_limit /= 1024;
57
+ }
58
+ $upload_size_limit_with_units = (int) $upload_size_limit.'KB';
59
+
60
+ // User upload size limit
61
+ $wpua_user_upload_size_limit = get_option('wp_user_avatar_upload_size_limit');
62
+ if($wpua_user_upload_size_limit == 0 || $wpua_user_upload_size_limit > wp_max_upload_size()){
63
+ $wpua_user_upload_size_limit = wp_max_upload_size();
64
+ }
65
+ // Value in bytes
66
+ $wpua_upload_size_limit = $wpua_user_upload_size_limit;
67
+ // Convert to KB
68
+ if($wpua_user_upload_size_limit > 1024){
69
+ $wpua_user_upload_size_limit /= 1024;
70
+ }
71
+ $wpua_upload_size_limit_with_units = (int) $wpua_user_upload_size_limit.'KB';
72
+
73
+ // Load add-ons
74
+ if($wpua_tinymce == 1){
75
+ include_once(WPUA_ABSPATH.'includes/tinymce.php');
76
+ }
77
+
78
+ // Load translations
79
+ load_plugin_textdomain('wp-user-avatar', '', WPUA_FOLDER.'/lang');
80
+
81
+ // Initialize default settings
82
+ register_activation_hook(WPUA_ABSPATH.'wp-user-avatar.php', 'wpua_options');
83
+
84
+ // Remove subscribers edit_posts capability
85
+ register_deactivation_hook(WPUA_ABSPATH.'wp-user-avatar.php', 'wpua_deactivate');
86
+
87
+ // Settings saved to wp_options
88
+ function wpua_options(){
89
+ global $wp_user_roles;
90
+ add_option('avatar_default_wp_user_avatar', "");
91
+ add_option('wp_user_avatar_tinymce', '1');
92
+ add_option('wp_user_avatar_allow_upload', '0');
93
+ add_option('wp_user_avatar_disable_gravatar', '0');
94
+ add_option('wp_user_avatar_upload_size_limit', '0');
95
+ }
96
+ add_action('admin_init', 'wpua_options');
97
+
98
+ // Update default avatar to new format
99
+ if(empty($wpua_default_avatar_updated)){
100
+ function wpua_default_avatar(){
101
+ global $avatar_default, $mustache_original, $wpua_avatar_default;
102
+ // If default avatar is the old mustache URL, update it
103
+ if($avatar_default == $mustache_original){
104
+ update_option('avatar_default', 'wp_user_avatar');
105
+ }
106
+ // If user had an image URL as the default avatar, replace with ID instead
107
+ if(!empty($wpua_avatar_default)){
108
+ $wpua_avatar_default_image = wp_get_attachment_image_src($wpua_avatar_default, 'medium');
109
+ if($avatar_default == $wpua_avatar_default_image[0]){
110
+ update_option('avatar_default', 'wp_user_avatar');
111
+ }
112
+ }
113
+ update_option('wp_user_avatar_default_avatar_updated', '1');
114
+ }
115
+ add_action('admin_init', 'wpua_default_avatar');
116
+ }
117
+
118
+ // Rename user meta to match database settings
119
+ if(empty($wpua_users_updated)){
120
+ function wpua_user_meta(){
121
+ global $blog_id, $wpdb;
122
+ $wpua_metakey = $wpdb->get_blog_prefix($blog_id).'user_avatar';
123
+ // If database tables start with something other than wp_
124
+ if($wpua_metakey != 'wp_user_avatar'){
125
+ $users = get_users();
126
+ // Move current user metakeys to new metakeys
127
+ foreach($users as $user){
128
+ $wpua = get_user_meta($user->ID, 'wp_user_avatar', true);
129
+ if(!empty($wpua)){
130
+ update_user_meta($user->ID, $wpua_metakey, $wpua);
131
+ delete_user_meta($user->ID, 'wp_user_avatar');
132
+ }
133
+ }
134
+ }
135
+ update_option('wp_user_avatar_users_updated', '1');
136
+ }
137
+ add_action('admin_init', 'wpua_user_meta');
138
+ }
139
+
140
+ // Add media state to existing avatars
141
+ if(empty($wpua_media_updated)){
142
+ function wpua_media_state(){
143
+ global $blog_id, $wpdb;
144
+ // Find all users with WPUA
145
+ $wpua_metakey = $wpdb->get_blog_prefix($blog_id).'user_avatar';
146
+ $wpuas = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != %d AND meta_value != %d", $wpua_metakey, 0, ""));
147
+ foreach($wpuas as $usermeta){
148
+ add_post_meta($usermeta->meta_value, '_wp_attachment_wp_user_avatar', $usermeta->user_id);
149
+ }
150
+ update_option('wp_user_avatar_media_updated', '1');
151
+ }
152
+ add_action('admin_init', 'wpua_media_state');
153
+ }
154
+
155
+ // Settings for Subscribers
156
+ if($wpua_allow_upload == 1){
157
+ // Allow multipart data in form
158
+ function wpua_add_edit_form_multipart_encoding(){
159
+ echo ' enctype="multipart/form-data"';
160
+ }
161
+ add_action('user_edit_form_tag', 'wpua_add_edit_form_multipart_encoding');
162
+
163
+ // Add enctype with JavaScript as backup
164
+ function wpua_add_edit_form_multipart_encoding_js(){ ?>
165
+ <script type="text/javascript">
166
+ jQuery(function(){
167
+ jQuery('#your-profile').attr('enctype', 'multipart/form-data');
168
+ });
169
+ </script>
170
+ <?php
171
+ }
172
+ add_action('wp_head', 'wpua_add_edit_form_multipart_encoding_js');
173
+
174
+ // Check user role
175
+ function check_user_role($role, $user_id=null){
176
+ global $current_user;
177
+ if(is_numeric($user_id)){
178
+ $user = get_userdata($user_id);
179
+ } else {
180
+ $user = $current_user->ID;
181
+ }
182
+ if(empty($user)){
183
+ return false;
184
+ }
185
+ return in_array($role, (array) $user->roles);
186
+ }
187
+
188
+ // Give subscribers edit_posts capability
189
+ function wpua_subscriber_add_cap(){
190
+ global $blog_id, $wpdb;
191
+ $wp_user_roles = $wpdb->get_blog_prefix($blog_id).'user_roles';
192
+ $user_roles = get_option($wp_user_roles);
193
+ $user_roles['subscriber']['capabilities']['edit_posts'] = true;
194
+ update_option($wp_user_roles, $user_roles);
195
+ }
196
+ add_action('admin_init', 'wpua_subscriber_add_cap');
197
 
198
+ // Remove menu items
199
+ function wpua_subscriber_remove_menu_pages(){
200
+ global $current_user;
201
+ if(check_user_role('subscriber', $current_user->ID)){
202
+ remove_menu_page('edit.php');
203
+ remove_menu_page('edit-comments.php');
204
+ remove_menu_page('tools.php');
205
+ }
206
+ }
207
+ add_action('admin_menu', 'wpua_subscriber_remove_menu_pages');
208
 
209
+ // Remove dashboard items
210
+ function wpua_subscriber_remove_dashboard_widgets(){
211
+ global $current_user;
212
+ if(check_user_role('subscriber', $current_user->ID)){
213
+ remove_meta_box('dashboard_quick_press', 'dashboard', 'side');
214
+ remove_meta_box('dashboard_recent_drafts', 'dashboard', 'side');
215
+ remove_meta_box('dashboard_right_now', 'dashboard', 'normal');
216
+ }
217
+ }
218
+ add_action('wp_dashboard_setup', 'wpua_subscriber_remove_dashboard_widgets');
219
+
220
+ // Restrict access to pages
221
+ function wpua_subscriber_offlimits(){
222
+ global $current_user, $pagenow;
223
+ $offlimits = array('edit.php', 'post-new.php', 'edit-comments.php', 'tools.php');
224
+ if(check_user_role('subscriber', $current_user->ID)){
225
+ if(in_array($pagenow, $offlimits)){
226
+ do_action('admin_page_access_denied');
227
+ wp_die(__('You do not have sufficient permissions to access this page.'));
228
+ }
229
+ }
230
  }
231
+ add_action('admin_init', 'wpua_subscriber_offlimits');
232
+ }
233
+
234
+ // Remove subscribers edit_posts capability
235
+ function wpua_subscriber_remove_cap(){
236
+ global $blog_id, $wpdb;
237
+ $wp_user_roles = $wpdb->get_blog_prefix($blog_id).'user_roles';
238
+ $user_roles = get_option($wp_user_roles);
239
+ unset($user_roles['subscriber']['capabilities']['edit_posts']);
240
+ update_option($wp_user_roles, $user_roles);
241
+ }
242
+
243
+ // On deactivation
244
+ function wpua_deactivate(){
245
+ // Remove subscribers edit_posts capability
246
+ wpua_subscriber_remove_cap();
247
+ // Reset all default avatar to Mystery Man
248
+ update_option('avatar_default', 'mystery');
249
  }
250
 
251
  // WP User Avatar
252
  if(!class_exists('wp_user_avatar')){
253
  class wp_user_avatar{
254
  function wp_user_avatar(){
255
+ global $current_screen, $current_user, $pagenow, $show_avatars, $wpua_allow_upload, $wpua_upload_size_limit;
256
+ // Adds WPUA to profile
257
+ if(current_user_can('upload_files') || ($wpua_allow_upload == 1 && is_user_logged_in())){
258
+ add_action('show_user_profile', array('wp_user_avatar', 'wpua_action_show_user_profile'));
259
+ add_action('edit_user_profile', array($this, 'wpua_action_show_user_profile'));
260
+ add_action('personal_options_update', array($this, 'wpua_action_process_option_update'));
261
+ add_action('edit_user_profile_update', array($this, 'wpua_action_process_option_update'));
262
+ // Prefilter upload size
263
+ if(!current_user_can('upload_files')){
264
+ add_filter('wp_handle_upload_prefilter', array($this, 'wpua_handle_upload_prefilter'), 10, 1);
265
+ }
266
+ if(is_admin()){
267
+ // Adds scripts to admin
268
+ add_action('admin_enqueue_scripts', array($this, 'wpua_media_upload_scripts'));
269
+ // Admin settings
270
+ add_action('admin_menu', 'wpua_admin');
271
+ add_filter('plugin_action_links', array($this, 'wpua_plugin_settings_links'), 10, 2);
272
+ } else {
273
+ if(!function_exists('get_current_screen')){
274
+ require_once(ABSPATH.'wp-admin/includes/screen.php');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
275
  }
276
+ // Adds scripts to front pages
277
+ add_action('wp_enqueue_scripts', array($this, 'wpua_media_upload_scripts'));
278
+ }
279
+ // Only add attachment field for WP 3.4 and older
280
+ if(!function_exists('wp_enqueue_media') && $pagenow == 'media-upload.php'){
281
+ add_filter('attachment_fields_to_edit', array($this, 'wpua_add_attachment_field_to_edit'), 10, 2);
282
+ }
283
+ // Hide column in Users table if default avatars are enabled
284
+ if(is_admin() && $show_avatars != 1){
285
+ add_filter('manage_users_columns', array($this, 'wpua_add_column'), 10, 1);
286
+ add_filter('manage_users_custom_column', array($this, 'wpua_show_column'), 10, 3);
287
+ }
288
+ }
289
+ }
290
+
291
+ // Add to edit user profile
292
+ function wpua_action_show_user_profile($user){
293
+ global $blog_id, $current_user, $show_avatars, $wpdb, $wpua_upload_size_limit_with_units;
294
+ // Get WPUA attachment ID
295
+ $wpua = get_user_meta($user->ID, $wpdb->get_blog_prefix($blog_id).'user_avatar', true);
296
+ // Show remove button if WPUA is set
297
+ $hide_remove = !has_wp_user_avatar($user->ID) ? ' hide-me' : "";
298
+ // If avatars are enabled, get original avatar image or show blank
299
+ $avatar_medium_src = ($show_avatars == 1 && is_admin()) ? wpua_get_avatar_original($user->user_email, 96) : includes_url().'images/blank.gif';
300
+ // Check if user has wp_user_avatar, if not show image from above
301
+ $avatar_medium = has_wp_user_avatar($user->ID) ? get_wp_user_avatar_src($user->ID, 'medium') : $avatar_medium_src;
302
+ // Check if user has wp_user_avatar, if not show image from above
303
+ $avatar_thumbnail = has_wp_user_avatar($user->ID) ? get_wp_user_avatar_src($user->ID, 96) : $avatar_medium_src;
304
+ // Change text on message based on current user
305
+ $profile = ($current_user->ID == $user->ID) ? '&ldquo;'.__('Update Profile').'&rdquo;' : '&ldquo;'.__('Update User').'&rdquo;';
306
+ ?>
307
+ <?php if(class_exists('bbPress') && !is_admin()) : // Add to bbPress profile with same style ?>
308
+ <h2 class="entry-title"><?php _e('WP User Avatar', 'wp-user-avatar'); ?></h2>
309
+ <fieldset class="bbp-form">
310
+ <legend><?php _e('WP User Avatar', 'wp-user-avatar'); ?></legend>
311
+ <?php else : // Add to profile with admin style ?>
312
+ <h3><?php _e('WP User Avatar', 'wp-user-avatar') ?></h3>
313
+ <table class="form-table">
314
+ <tr>
315
+ <th><label for="wp_user_avatar"><?php _e('WP User Avatar', 'wp-user-avatar'); ?></label></th>
316
+ <td>
317
+ <?php endif; ?>
318
+ <input type="hidden" name="wp-user-avatar" id="wp-user-avatar" value="<?php echo $wpua; ?>" />
319
+ <?php if(current_user_can('upload_files')) : // Button to launch Media uploader ?>
320
+ <p><button type="button" class="button" id="add-wp-user-avatar" name="add-wp-user-avatar"><?php _e('Edit WP User Avatar', 'wp-user-avatar'); ?></button></p>
321
+ <?php elseif(!current_user_can('upload_files') && !has_wp_user_avatar($current_user->ID)) : // Upload button ?>
322
+ <input name="wp-user-avatar-file" id="wp-user-avatar-file" type="file" />
323
+ <button type="submit" class="button" id="upload-wp-user-avatar" name="upload-wp-user-avatar" value="<?php _e('Upload'); ?>"><?php _e('Upload'); ?></button>
324
+ <p>
325
+ <?php printf(__( 'Maximum upload file size: %d%s.'), esc_html($wpua_upload_size_limit_with_units ), esc_html('KB')); ?>
326
+ <br />
327
+ <?php _e('Allowed file formats', 'wp-user-avatar'); ?>: <?php _e('JPG, GIF, PNG', 'wp-user-avatar'); ?>
328
+ </p>
329
+ <?php elseif(!current_user_can('upload_files') && has_wp_user_avatar($current_user->ID) && wpua_author($wpua, $current_user->ID)) : // Edit button ?>
330
+ <?php $edit_attachment_link = function_exists('wp_enqueue_media') ? add_query_arg(array('post' => $wpua, 'action' => 'edit'), admin_url('post.php')) : add_query_arg(array('attachment_id' => $wpua, 'action' => 'edit'), admin_url('media.php')) ?>
331
+ <p><button type="button" class="button" id="edit-wp-user-avatar" name="edit-wp-user-avatar" onclick="window.open('<?php echo $edit_attachment_link; ?>', '_self');"><?php _e('Edit WP User Avatar', 'wp-user-avatar'); ?></button></p>
332
+ <?php endif; ?>
333
+ <p id="wp-user-avatar-preview">
334
+ <img src="<?php echo $avatar_medium; ?>" alt="" />
335
+ <?php _e('Original', 'wp-user-avatar'); ?>
336
+ </p>
337
+ <p id="wp-user-avatar-thumbnail">
338
+ <img src="<?php echo $avatar_thumbnail; ?>" alt="" />
339
+ <?php _e('Thumbnail'); ?>
340
+ </p>
341
+ <p><button type="button" class="button<?php echo $hide_remove; ?>" id="remove-wp-user-avatar" name="remove-wp-user-avatar"><?php _e('Remove'); ?></button></p>
342
+ <p id="wp-user-avatar-message"><?php printf(__('Press %s to save your changes', 'wp-user-avatar'), $profile); ?>.</p>
343
+ <?php if(class_exists('bbPress') && !is_admin()) : // Add to bbPress profile with same style ?>
344
+ </fieldset>
345
+ <?php else : // Add to profile with admin style ?>
346
+ </td>
347
+ </tr>
348
+ </table>
349
+ <?php endif; ?>
350
+ <?php echo wpua_js($user->display_name, $avatar_medium_src); // Add JS ?>
351
+ <?php
352
  }
353
+
354
+ // Set upload size limit for users without upload_files capability
355
+ function wpua_handle_upload_prefilter($file){
356
+ global $wpua_upload_size_limit, $wpua_upload_size_limit_with_units;
357
+ $size = $file['size'];
358
+ if($size > $wpua_upload_size_limit){
359
+ $file['error'] = __('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.');
360
+ }
361
+ return $file;
362
+ }
363
+
364
  // Update user meta
365
+ function wpua_action_process_option_update($user_id){
366
+ global $blog_id, $wpdb;
367
+ // Check if user has upload_files capability
368
+ if(current_user_can('upload_files')){
369
+ $wpua_id = isset($_POST['wp-user-avatar']) ? intval($_POST['wp-user-avatar']) : "";
370
+ $wpdb->query($wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_key = %s AND meta_value = %d", '_wp_attachment_wp_user_avatar', $user_id));
371
+ add_post_meta($wpua_id, '_wp_attachment_wp_user_avatar', $user_id);
372
+ update_user_meta($user_id, $wpdb->get_blog_prefix($blog_id).'user_avatar', $wpua_id);
373
+ } else {
374
+ if(isset($_POST['wp-user-avatar']) && empty($_POST['wp-user-avatar'])){
375
+ // Uploads by user
376
+ $attachments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE post_author = %d AND post_type = %s", $user_id, 'attachment'));
377
+ foreach($attachments as $attachment){
378
+ // Delete attachment if not used by another user
379
+ if(!wpua_image($attachment->ID, $user_id)){
380
+ wp_delete_post($attachment->ID);
381
+ }
382
+ }
383
+ update_user_meta($user_id, $wpdb->get_blog_prefix($blog_id).'user_avatar', "");
384
+ }
385
+ // Create attachment from upload
386
+ if(isset($_POST['upload-wp-user-avatar']) && $_POST['upload-wp-user-avatar']){
387
+ if(!function_exists('wp_handle_upload')){
388
+ require_once(ABSPATH.'wp-admin/includes/admin.php');
389
+ require_once(ABSPATH.'wp-admin/includes/file.php');
390
+ }
391
+ $name = $_FILES['wp-user-avatar-file']['name'];
392
+ $file = wp_handle_upload($_FILES['wp-user-avatar-file'], array('test_form' => false));
393
+ $type = $file['type'];
394
+ // Allow only JPG, GIF, PNG
395
+ if($file['error'] || !preg_match('/(jpe?g|gif|png)$/i', $type)){
396
+ if($file['error']){
397
+ wp_die($file['error']);
398
+ } else {
399
+ wp_die(__('Sorry, this file type is not permitted for security reasons.'));
400
+ }
401
+ }
402
+ // Break out file info
403
+ $name_parts = pathinfo($name);
404
+ $name = trim(substr($name, 0, -(1 + strlen($name_parts['extension']))));
405
+ $url = $file['url'];
406
+ $file = $file['file'];
407
+ $title = $name;
408
+ // Use image exif/iptc data for title if possible
409
+ if($image_meta = @wp_read_image_metadata($file)){
410
+ if(trim($image_meta['title']) && !is_numeric(sanitize_title($image_meta['title']))){
411
+ $title = $image_meta['title'];
412
+ }
413
+ }
414
+ // Construct the attachment array
415
+ $attachment = array(
416
+ 'guid' => $url,
417
+ 'post_mime_type' => $type,
418
+ 'post_title' => $title
419
+ );
420
+ // This should never be set as it would then overwrite an existing attachment
421
+ if(isset($attachment['ID'])){
422
+ unset($attachment['ID']);
423
+ }
424
+ // Save the attachment metadata
425
+ $attachment_id = wp_insert_attachment($attachment, $file);
426
+ if(!is_wp_error($attachment_id)){
427
+ require_once(ABSPATH.'wp-admin/includes/image.php');
428
+ wp_update_attachment_metadata($attachment_id, wp_generate_attachment_metadata($attachment_id, $file));
429
+ $wpdb->query($wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_key = %s AND meta_value = %d", '_wp_attachment_wp_user_avatar', $user_id));
430
+ add_post_meta($attachment_id, '_wp_attachment_wp_user_avatar', $user_id);
431
+ update_user_meta($user_id, $wpdb->get_blog_prefix($blog_id).'user_avatar', $attachment_id);
432
+ }
433
+ }
434
+ }
435
  }
436
 
437
+ // Add button to attach image for WP 3.4 and older
438
+ function wpua_add_attachment_field_to_edit($fields, $post){
439
  $image = wp_get_attachment_image_src($post->ID, "medium");
440
+ $button = '<button type="button" class="button" id="set-wp-user-avatar-image" name="set-wp-user-avatar-image" onclick="setWPUserAvatar(\''.$post->ID.'\', \''.$image[0].'\')">'.__('Set WP User Avatar', 'wp-user-avatar').'</button>';
441
  $fields['wp-user-avatar'] = array(
442
+ 'label' => __('WP User Avatar', 'wp-user-avatar'),
443
  'input' => 'html',
444
  'html' => $button
445
  );
446
  return $fields;
447
  }
448
 
449
+ // Add settings link on plugin page
450
+ function wpua_plugin_settings_links($links, $file){
451
+ if(basename($file) == basename(plugin_basename(__FILE__))){
452
+ $settings_link = '<a href="'.add_query_arg(array('page' => 'wp-user-avatar'), admin_url('options-general.php')).'">'.__('Settings').'</a>';
453
+ $links = array_merge($links, array($settings_link));
454
+ }
455
+ return $links;
456
  }
457
 
458
+ // Add column to Users table
459
+ function wpua_add_column($columns){
460
+ return $columns + array('wp-user-avatar' => __('WP User Avatar', 'wp-user-avatar'));
461
+ }
462
+
463
+ // Show thumbnail in Users table
464
+ function wpua_show_column($value, $column_name, $user_id){
465
+ global $blog_id, $wpdb;
466
+ $wpua = get_user_meta($user_id, $wpdb->get_blog_prefix($blog_id).'user_avatar', true);
467
+ $wpua_image = wp_get_attachment_image($wpua, array(32,32));
468
  if($column_name == 'wp-user-avatar'){
469
+ return $wpua_image;
470
  }
471
  }
472
 
473
  // Media uploader
474
+ function wpua_media_upload_scripts(){
475
+ global $pagenow;
 
476
  if(function_exists('wp_enqueue_media')){
477
+ wp_enqueue_script('admin-bar');
478
  wp_enqueue_media();
479
+ } else {
480
+ wp_enqueue_script('media-upload');
481
+ wp_enqueue_script('thickbox');
482
+ wp_enqueue_style('thickbox');
483
+ }
484
+ wp_enqueue_script('jquery');
485
+ wp_enqueue_script('jquery-ui-slider');
486
+ wp_enqueue_script('wp-user-avatar', WPUA_URLPATH.'js/wp-user-avatar.js', "", WPUA_VERSION);
487
+ if($pagenow == 'options-general.php'){
488
+ wp_enqueue_style('wp-user-avatar-jqueryui', WPUA_URLPATH.'css/jquery.ui.slider.css', "", null);
489
  }
490
+ wp_enqueue_style('wp-user-avatar', WPUA_URLPATH.'css/wp-user-avatar.css', "", WPUA_VERSION);
 
 
491
  }
492
  }
 
 
 
 
493
 
494
+ // Uploader scripts
495
+ function wpua_js($section, $avatar_thumb){ ?>
496
+ <script type="text/javascript">
497
+ jQuery(function(){
498
+ <?php if(current_user_can('upload_files')) : ?>
499
+ <?php if(function_exists('wp_enqueue_media')) : // Backbone uploader for WP 3.5+ ?>
500
+ openMediaUploader('<?php echo $section; ?>', "<?php _e('Edit WP User Avatar', 'wp-user-avatar'); ?>", "<?php _e('Set WP User Avatar', 'wp-user-avatar'); ?>");
501
+ <?php else : // Fall back to Thickbox uploader ?>
502
+ openThickboxUploader('<?php echo $section; ?>', '<?php echo get_admin_url(); ?>media-upload.php?post_id=0&type=image&tab=library&TB_iframe=1');
503
+ <?php endif; ?>
504
+ <?php endif; ?>
505
+ removeWPUserAvatar('<?php echo htmlspecialchars_decode($avatar_thumb); ?>');
506
+ });
507
+ </script>
508
+ <?php
509
+ }
510
+
511
+ // Returns true if user has Gravatar-hosted image
512
+ function wpua_has_gravatar($id_or_email, $has_gravatar=false, $user="", $email=""){
513
+ global $ssl;
514
+ if(!is_object($id_or_email) && !empty($id_or_email)){
515
+ // Find user by ID or e-mail address
516
+ $user = is_numeric($id_or_email) ? get_user_by('id', $id_or_email) : get_user_by('email', $id_or_email);
517
+ // Get registered user e-mail address
518
+ $email = !empty($user) ? $user->user_email : "";
519
+ }
520
+ // Check if Gravatar image returns 200 (OK) or 404 (Not Found)
521
+ if(!empty($email)){
522
+ $hash = md5(strtolower(trim($email)));
523
+ $gravatar = 'http'.$ssl.'://www.gravatar.com/avatar/'.$hash.'?d=404';
524
+ $headers = @get_headers($gravatar);
525
+ $has_gravatar = !preg_match("|200|", $headers[0]) ? false : true;
526
+ }
527
+ return $has_gravatar;
528
+ }
529
+
530
+ // Returns true if user has wp_user_avatar
531
+ function has_wp_user_avatar($id_or_email="", $has_wpua=false, $user="", $user_id=""){
532
+ global $blog_id, $wpdb;
533
+ if(!is_object($id_or_email) && !empty($id_or_email)){
534
+ // Find user by ID or e-mail address
535
+ $user = is_numeric($id_or_email) ? get_user_by('id', $id_or_email) : get_user_by('email', $id_or_email);
536
+ // Get registered user ID
537
+ $user_id = !empty($user) ? $user->ID : "";
538
+ }
539
+ $wpua = get_user_meta($user_id, $wpdb->get_blog_prefix($blog_id).'user_avatar', true);
540
+ $has_wpua = !empty($wpua) ? true : false;
541
+ return $has_wpua;
542
+ }
543
+
544
+ // Replace get_avatar only in get_wp_user_avatar
545
+ function wpua_get_avatar_filter($avatar, $id_or_email, $size="", $default="", $alt=""){
546
+ global $avatar_default, $comment, $mustache_admin, $mustache_avatar, $mustache_medium, $mustache_original, $mustache_thumbnail, $post, $wpua_avatar_default, $wpua_disable_gravatar;
547
+ // User has WPUA
548
+ if(is_object($id_or_email)){
549
+ if(!empty($comment->comment_author_email)){
550
+ $avatar = get_wp_user_avatar($comment, $size, $default, $alt);
551
+ } else {
552
+ $avatar = get_wp_user_avatar('unknown@gravatar.com', $size, $default, $alt);
553
+ }
554
+ } else {
555
+ if(has_wp_user_avatar($id_or_email)){
556
+ $avatar = get_wp_user_avatar($id_or_email, $size, $default, $alt);
557
+ // User has Gravatar and Gravatar is not disabled
558
+ } elseif(wpua_has_gravatar($id_or_email) && $wpua_disable_gravatar != 1){
559
+ $avatar = $avatar;
560
+ // User doesn't have WPUA or Gravatar and Default Avatar is wp_user_avatar, show custom Default Avatar
561
+ } elseif($avatar_default == 'wp_user_avatar'){
562
+ // Show custom Default Avatar
563
+ if(!empty($wpua_avatar_default)){
564
+ // Get image
565
+ $wpua_avatar_default_image = wp_get_attachment_image_src($wpua_avatar_default, array($size,$size));
566
+ // Image src
567
+ $default = $wpua_avatar_default_image[0];
568
+ // Add dimensions if numeric size
569
+ $dimensions = ' width="'.$wpua_avatar_default_image[1].'" height="'.$wpua_avatar_default_image[2].'"';
570
+ $defaultcss = "";
571
+ } else {
572
+ // Get mustache image based on numeric size comparison
573
+ if($size > get_option('medium_size_w')){
574
+ $default = $mustache_original;
575
+ } elseif($size <= get_option('medium_size_w') && $size > get_option('thumbnail_size_w')){
576
+ $default = $mustache_medium;
577
+ } elseif($size <= get_option('thumbnail_size_w') && $size > 96){
578
+ $default = $mustache_thumbnail;
579
+ } elseif($size <= 96 && $size > 32){
580
+ $default = $mustache_avatar;
581
+ } elseif($size <= 32){
582
+ $default = $mustache_admin;
583
+ }
584
+ // Add dimensions if numeric size
585
+ $dimensions = ' width="'.$size.'" height="'.$size.'"';
586
+ $defaultcss = ' avatar-default';
587
+ }
588
+ // Construct the img tag
589
+ $avatar = "<img src='".$default."'".$dimensions." alt='".$alt."' class='wp-user-avatar wp-user-avatar-".$size." avatar avatar-".$size." photo'".$defaultcss." />";
590
+ }
591
+ }
592
+ return $avatar;
593
+ }
594
+ add_filter('get_avatar', 'wpua_get_avatar_filter', 10, 6);
595
+
596
+ // Get original avatar, for when user removes wp_user_avatar
597
+ function wpua_get_avatar_original($id_or_email, $size="", $default="", $alt=""){
598
+ global $avatar_default, $mustache_avatar, $wpua_avatar_default, $wpua_disable_gravatar;
599
+ // Remove get_avatar filter
600
+ if(is_admin()){
601
+ remove_filter('get_avatar', 'wpua_get_avatar_filter');
602
+ }
603
+ if($wpua_disable_gravatar != 1){
604
+ // User doesn't have Gravatar and Default Avatar is wp_user_avatar, show custom Default Avatar
605
+ if(!wpua_has_gravatar($id_or_email) && $avatar_default == 'wp_user_avatar'){
606
+ // Show custom Default Avatar
607
+ if(!empty($wpua_avatar_default)){
608
+ $wpua_avatar_default_image = wp_get_attachment_image_src($wpua_avatar_default, array($size,$size));
609
+ $default = $wpua_avatar_default_image[0];
610
+ } else {
611
+ $default = $mustache_avatar;
612
+ }
613
+ } else {
614
+ // Get image from Gravatar, whether it's the user's image or default image
615
+ $wpua_image = get_avatar($id_or_email, $size);
616
+ // Takes the img tag, extracts the src
617
+ $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $wpua_image, $matches, PREG_SET_ORDER);
618
+ $default = $matches [0] [1];
619
+ }
620
+ } else {
621
+ if(!empty($wpua_avatar_default)){
622
+ $wpua_avatar_default_image = wp_get_attachment_image_src($wpua_avatar_default, array($size,$size));
623
+ $default = $wpua_avatar_default_image[0];
624
+ } else {
625
+ $default = $mustache_avatar;
626
+ }
627
+ }
628
+ return $default;
629
+ }
630
+
631
+ // Find WPUA, show get_avatar if empty
632
+ function get_wp_user_avatar($id_or_email="", $size='96', $align="", $alt=""){
633
+ global $avatar_default, $blog_id, $comment, $post, $wpdb;
634
+ // Checks if comment
635
+ if(is_object($id_or_email)){
636
+ // Checks if comment author is registered user by user ID
637
+ if($comment->user_id != 0){
638
+ $id_or_email = $comment->user_id;
639
+ // Checks that comment author isn't anonymous
640
+ } elseif(!empty($comment->comment_author_email)){
641
+ // Checks if comment author is registered user by e-mail address
642
+ $user = get_user_by('email', $comment->comment_author_email);
643
+ // Get registered user info from profile, otherwise e-mail address should be value
644
+ $id_or_email = !empty($user) ? $user->ID : $comment->comment_author_email;
645
+ }
646
+ $alt = $comment->comment_author;
647
+ } else {
648
+ if(!empty($id_or_email)){
649
+ // Find user by ID or e-mail address
650
+ $user = is_numeric($id_or_email) ? get_user_by('id', $id_or_email) : get_user_by('email', $id_or_email);
651
+ } else {
652
+ // Find author's name if id_or_email is empty
653
+ $author_name = get_query_var('author_name');
654
+ if(is_author()){
655
+ // On author page, get user by page slug
656
+ $user = get_user_by('slug', $author_name);
657
+ } else {
658
+ // On post, get user by author meta
659
+ $user_id = get_the_author_meta('ID');
660
+ $user = get_user_by('id', $user_id);
661
+ }
662
+ }
663
+ // Set user's ID and name
664
+ if(!empty($user)){
665
+ $id_or_email = $user->ID;
666
+ $alt = $user->display_name;
667
+ }
668
+ }
669
+ // Checks if user has WPUA
670
+ $wpua_meta = !empty($id_or_email) ? get_the_author_meta($wpdb->get_blog_prefix($blog_id).'user_avatar', $id_or_email) : "";
671
+ // Add alignment class
672
+ $alignclass = !empty($align) ? ' align'.$align : "";
673
+ // User has WPUA, bypass get_avatar
674
+ if(!empty($wpua_meta)){
675
+ // Numeric size use size array
676
+ $get_size = is_numeric($size) ? array($size,$size) : $size;
677
+ // Get image src
678
+ $wpua_image = wp_get_attachment_image_src($wpua_meta, $get_size);
679
+ // Add dimensions to img only if numeric size was specified
680
+ $dimensions = is_numeric($size) ? ' width="'.$wpua_image[1].'" height="'.$wpua_image[2].'"' : "";
681
+ // Construct the img tag
682
+ $avatar = '<img src="'.$wpua_image[0].'"'.$dimensions.' alt="'.$alt.'" class="wp-user-avatar wp-user-avatar-'.$size.$alignclass.' avatar avatar avatar-'.$size.' photo" />';
683
+ } else {
684
+ // Get numeric sizes for non-numeric sizes based on media options
685
+ if($size == 'original' || $size == 'large' || $size == 'medium' || $size == 'thumbnail'){
686
+ $get_size = ($size == 'original') ? get_option('large_size_w') : get_option($size.'_size_w');
687
+ } else {
688
+ // Numeric sizes leave as-is
689
+ $get_size = $size;
690
+ }
691
+ // User with no WPUA uses get_avatar
692
+ $avatar = get_avatar($id_or_email, $get_size, $default="", $alt="");
693
+ // Remove width and height for non-numeric sizes
694
+ if(!is_numeric($size)){
695
+ $avatar = preg_replace("/(width|height)=\'\d*\'\s/", "", $avatar);
696
+ $avatar = preg_replace('/(width|height)=\"\d*\"\s/', "", $avatar);
697
+ $avatar = str_replace('wp-user-avatar wp-user-avatar-'.$get_size.' ', "", $avatar);
698
+ $avatar = str_replace("class='", "class='wp-user-avatar wp-user-avatar-".$size.$alignclass." ", $avatar);
699
+ }
700
+ }
701
+ return $avatar;
702
+ }
703
+
704
+ // Return just the image src
705
+ function get_wp_user_avatar_src($id_or_email, $size="", $align=""){
706
+ $wpua_image_src = "";
707
+ // Gets the avatar img tag
708
+ $wpua_image = get_wp_user_avatar($id_or_email, $size, $align);
709
+ // Takes the img tag, extracts the src
710
+ if(!empty($wpua_image)){
711
+ $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $wpua_image, $matches, PREG_SET_ORDER);
712
+ $wpua_image_src = $matches [0] [1];
713
+ }
714
+ return $wpua_image_src;
715
+ }
716
+
717
+ // Shortcode
718
+ function wpua_shortcode($atts, $content){
719
+ global $blog_id, $wpdb;
720
+ // Set shortcode attributes
721
+ extract(shortcode_atts(array('user' => "", 'size' => '96', 'align' => "", 'link' => "", 'target' => ""), $atts));
722
+ // Find user by ID, login, slug, or e-mail address
723
+ if(!empty($user)){
724
+ $user = is_numeric($user) ? get_user_by('id', $user) : get_user_by('login', $user);
725
+ $user = empty($user) ? get_user_by('slug', $user) : $user;
726
+ $user = empty($user) ? get_user_by('email', $user) : $user;
727
+ }
728
+ // Get user ID
729
+ $id_or_email = !empty($user) ? $user->ID : "";
730
+ // Check if link is set
731
+ if(!empty($link)){
732
+ // CSS class is same as link type, except for URL
733
+ $link_class = $link;
734
+ // Open in new window
735
+ $target_link = !empty($target) ? ' target="'.$target.'"' : "";
736
+ if($link == 'file'){
737
+ // Get image src
738
+ $image_link = get_wp_user_avatar_src($id_or_email, 'original', $align);
739
+ } elseif($link == 'attachment'){
740
+ // Get attachment URL
741
+ $image_link = get_attachment_link(get_the_author_meta($wpdb->get_blog_prefix($blog_id).'user_avatar', $id_or_email));
742
+ } else {
743
+ // URL
744
+ $image_link = $link;
745
+ $link_class = 'custom';
746
+ }
747
+ // Wrap the avatar inside the link
748
+ $avatar = '<a href="'.$image_link.'" class="wp-user-avatar-link wp-user-avatar-'.$link_class.'"'.$target_link.'>'.get_wp_user_avatar($id_or_email, $size, $align).'</a>';
749
+ } else {
750
+ // Get WPUA as normal
751
+ $avatar = get_wp_user_avatar($id_or_email, $size, $align);
752
+ }
753
+ return $avatar;
754
+ }
755
+ add_shortcode('avatar', 'wpua_shortcode');
756
+
757
+ // Add default avatar
758
+ function wpua_add_default_avatar($avatar_list=null){
759
+ global $avatar_default, $mustache_admin, $mustache_medium, $wpua_avatar_default, $wpua_disable_gravatar;
760
+ // Remove get_avatar filter
761
+ remove_filter('get_avatar', 'wpua_get_avatar_filter');
762
+ // Set avatar_list variable
763
+ $avatar_list = "";
764
+ // Set avatar defaults
765
+ $avatar_defaults = array(
766
+ 'mystery' => __('Mystery Man'),
767
+ 'blank' => __('Blank'),
768
+ 'gravatar_default' => __('Gravatar Logo'),
769
+ 'identicon' => __('Identicon (Generated)'),
770
+ 'wavatar' => __('Wavatar (Generated)'),
771
+ 'monsterid' => __('MonsterID (Generated)'),
772
+ 'retro' => __('Retro (Generated)')
773
+ );
774
+ // No Default Avatar, set to Mystery Man
775
+ if(empty($avatar_default)){
776
+ $avatar_default = 'mystery';
777
+ }
778
+ // Take avatar_defaults and get examples for unknown@gravatar.com
779
+ foreach($avatar_defaults as $default_key => $default_name){
780
+ $avatar = get_avatar('unknown@gravatar.com', 32, $default_key);
781
+ $selected = ($avatar_default == $default_key) ? 'checked="checked" ' : "";
782
+ $avatar_list .= "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='".esc_attr($default_key)."' {$selected}/> ";
783
+ $avatar_list .= preg_replace("/src='(.+?)'/", "src='\$1&amp;forcedefault=1'", $avatar);
784
+ $avatar_list .= ' '.$default_name.'</label>';
785
+ $avatar_list .= '<br />';
786
+ }
787
+ // Show remove link if custom Default Avatar is set
788
+ if(!empty($wpua_avatar_default)){
789
+ $avatar_thumb_src = wp_get_attachment_image_src($wpua_avatar_default, array(32,32));
790
+ $avatar_thumb = $avatar_thumb_src[0];
791
+ $hide_remove = "";
792
+ } else {
793
+ $avatar_thumb = $mustache_admin;
794
+ $hide_remove = ' class="hide-me"';
795
+ }
796
+ // Default Avatar is wp_user_avatar, check the radio button next to it
797
+ $selected_avatar = ($avatar_default == 'wp_user_avatar' || $wpua_disable_gravatar == 1) ? ' checked="checked" ' : "";
798
+ // Wrap WPUA in div
799
+ $avatar_thumb_img = '<div id="wp-user-avatar-preview"><img src="'.$avatar_thumb.'" width="32" /></div>';
800
+ // Add WPUA to list
801
+ $wpua_list = "\n\t<label><input type='radio' name='avatar_default' id='wp_user_avatar_radio' value='wp_user_avatar'$selected_avatar /> ";
802
+ $wpua_list .= preg_replace("/src='(.+?)'/", "src='\$1'", $avatar_thumb_img);
803
+ $wpua_list .= ' '.__('WP User Avatar', 'wp-user-avatar').'</label>';
804
+ $wpua_list .= '<p id="edit-wp-user-avatar"><button type="button" class="button" id="add-wp-user-avatar" name="add-wp-user-avatar">'.__('Edit WP User Avatar', 'wp-user-avatar').'</button>';
805
+ $wpua_list .= '<a href="#" id="remove-wp-user-avatar"'.$hide_remove.'>'.__('Remove').'</a></p>';
806
+ $wpua_list .= '<input type="hidden" id="wp-user-avatar" name="avatar_default_wp_user_avatar" value="'.$wpua_avatar_default.'">';
807
+ $wpua_list .= '<p id="wp-user-avatar-message">'.sprintf(__('Press %s to save your changes', 'wp-user-avatar'), '&ldquo;'.__('Save Changes').'&rdquo;').'.</p>';
808
+ $wpua_list .= wpua_js(__('Default Avatar'), $mustache_admin);
809
+ if($wpua_disable_gravatar != 1){
810
+ return $wpua_list.'<div id="wp-avatars">'.$avatar_list.'</div>';
811
+ } else {
812
+ return $wpua_list;
813
+ }
814
+ }
815
+ add_filter('default_avatar_select', 'wpua_add_default_avatar', 10);
816
+
817
+ // Add default avatar_default to whitelist
818
+ function wpua_whitelist_options($whitelist_options){
819
+ $whitelist_options['discussion'][] = 'avatar_default_wp_user_avatar';
820
+ return $whitelist_options;
821
+ }
822
+ add_filter('whitelist_options', 'wpua_whitelist_options', 10);
823
+
824
+ // Add media state
825
+ function wpua_add_media_state($media_states){
826
+ global $post, $wpua_avatar_default;
827
+ $is_wpua = get_post_custom_values('_wp_attachment_wp_user_avatar', $post->ID);
828
+ if(!empty($is_wpua)){
829
+ $media_states[] = __('Avatar');
830
+ }
831
+ if(!empty($wpua_avatar_default) && ($wpua_avatar_default == $post->ID)){
832
+ $media_states[] = __('Default Avatar');
833
+ }
834
+ return apply_filters('wpua_add_media_state', $media_states);
835
+ }
836
+ add_filter('display_media_states', 'wpua_add_media_state', 10, 1);
837
+
838
+ // Check if image is used as WPUA
839
+ function wpua_image($attachment_id, $user_id, $wpua_image=false){
840
+ global $wpdb;
841
+ $wpua = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s AND meta_value != %d", $attachment_id, '_wp_attachment_wp_user_avatar', $user_id));
842
+ if(!empty($wpua)){
843
+ $wpua_image = true;
844
+ }
845
+ return $wpua_image;
846
+ }
847
+
848
+ // Check who owns image
849
+ function wpua_author($attachment_id, $user_id, $wpua_author=false){
850
+ $attachment = get_post($attachment_id);
851
+ if(!empty($attachment) && $attachment->post_author == $user_id){
852
+ $wpua_author = true;
853
+ }
854
+ return $wpua_author;
855
+ }
856
+
857
+ // Admin page
858
+ function wpua_options_page(){
859
+ global $upload_size_limit_with_units, $wpua_allow_upload, $wpua_upload_size_limit, $wpua_upload_size_limit_with_units;
860
+ // Give subscribers edit_posts capability
861
+ if(isset($_GET['settings-updated']) && $_GET['settings-updated'] == 'true' && empty($wpua_allow_upload)){
862
+ wpua_subscriber_remove_cap();
863
+ }
864
+ $hide_size = ($wpua_allow_upload != 1) ? ' class="hide-me"' : "";
865
+
866
+ ?>
867
+ <div class="wrap">
868
+ <?php screen_icon(); ?>
869
+ <h2><?php _e('WP User Avatar', 'wp-user-avatar'); ?></h2>
870
+ <form method="post" action="options.php">
871
+ <?php settings_fields('wpua-settings-group'); ?>
872
+ <?php do_settings_fields('wpua-settings-group', ""); ?>
873
+ <table class="form-table">
874
+ <tr valign="top">
875
+ <th scope="row"><?php _e('WP User Avatar Settings', 'wp-user-avatar'); ?></th>
876
+ <td>
877
+ <fieldset>
878
+ <legend class="screen-reader-text"><span><?php _e('WP User Avatar Settings', 'wp-user-avatar'); ?>/span></legend>
879
+ <label for="wp_user_avatar_tinymce" class="wpua_label">
880
+ <input name="wp_user_avatar_tinymce" type="checkbox" id="wp_user_avatar_tinymce" value="1" <?php checked('1', get_option('wp_user_avatar_tinymce')); ?> />
881
+ <?php _e('Add avatar button to Visual Editor', 'wp-user-avatar'); ?>
882
+ </label>
883
+ <label for="wp_user_avatar_allow_upload" class="wpua_label">
884
+ <input name="wp_user_avatar_allow_upload" type="checkbox" id="wp_user_avatar_allow_upload" value="1" <?php checked('1', get_option('wp_user_avatar_allow_upload')); ?> />
885
+ <?php _e('Allow Contributors &amp; Subscribers to upload avatars', 'wp-user-avatar'); ?>
886
+ </label>
887
+ <label for="wp_user_avatar_disable_gravatar" class="wpua_label">
888
+ <input name="wp_user_avatar_disable_gravatar" type="checkbox" id="wp_user_avatar_disable_gravatar" value="1" <?php checked('1', get_option('wp_user_avatar_disable_gravatar')); ?> />
889
+ <?php _e('Disable Gravatar &mdash; Use only local avatars', 'wp-user-avatar'); ?>
890
+ </label>
891
+ </fieldset>
892
+ </td>
893
+ </tr>
894
+ <tr id="wp-size-upload-limit-settings" valign="top"<?php echo $hide_size; ?>>
895
+ <th scope="row"><label for="wp_user_avatar_upload_size_limit" class="wpua_label"><?php _e('Upload Size Limit (only for Contributors & Subscribers)', 'wp-user-avatar'); ?></label></th>
896
+ <td>
897
+ <input name="wp_user_avatar_upload_size_limit" type="text" id="wp_user_avatar_upload_size_limit" value="<?php echo $wpua_upload_size_limit; ?>" class="regular-text" />
898
+ <span id="wp-readable-size">(<?php echo $wpua_upload_size_limit_with_units; ?>)</span>
899
+ <span id="wp-readable-size-error"><?php _e('Upload Size Limit cannot be larger than the maximum', 'wp-user-avatar'); ?>.</span>
900
+ <div id="wp-user-avatar-slider"></div>
901
+ <script type="text/javascript">
902
+ jQuery(function(){
903
+ // Show size info only if allow uploads is checked
904
+ jQuery('#wp_user_avatar_allow_upload').change(function(){
905
+ jQuery('#wp-size-upload-limit-settings').toggle(jQuery('#wp_user_avatar_allow_upload').is(':checked'));
906
+ });
907
+ // Hide Gravatars if disable Gravatars is checked
908
+ jQuery('#wp_user_avatar_disable_gravatar').change(function(){
909
+ if(jQuery('#wp-avatars').length){
910
+ jQuery('#wp-avatars').toggle(!jQuery('#wp_user_avatar_disable_gravatar').is(':checked'));
911
+ jQuery('#wp_user_avatar_radio').trigger('click');
912
+ }
913
+ jQuery('#wp-user-avatar-message').show();
914
+ });
915
+ // Add size slider
916
+ jQuery('#wp-user-avatar-slider').slider({
917
+ value: <?php echo $wpua_upload_size_limit; ?>,
918
+ min: 0,
919
+ max: <?php echo wp_max_upload_size(); ?>,
920
+ step: 1,
921
+ slide: function(event, ui){
922
+ jQuery('#wp_user_avatar_upload_size_limit').val(ui.value);
923
+ jQuery('#wp-readable-size').html('(' + Math.floor(ui.value / 1024) + 'KB)');
924
+ jQuery('#wp-readable-size-error').hide();
925
+ }
926
+ });
927
+ // Update readable size on keyup
928
+ jQuery('#wp_user_avatar_upload_size_limit').keyup(function(){
929
+ var wpua_upload_size_limit = jQuery(this).val();
930
+ wpua_upload_size_limit = wpua_upload_size_limit.replace(/\D/g, '');
931
+ // jQuery(this).val(wpua_upload_size_limit);
932
+ jQuery('#wp-readable-size').html('(' + Math.floor(wpua_upload_size_limit / 1024) + 'KB)');
933
+ jQuery('#wp-readable-size-error').toggle(wpua_upload_size_limit > <?php echo wp_max_upload_size(); ?>);
934
+ });
935
+ jQuery('#wp_user_avatar_upload_size_limit').val(jQuery('#wp-user-avatar-slider').slider('value'));
936
+ });
937
+ </script>
938
+ <span class="description"><?php printf(__( 'Maximum upload file size: %d%s.'), esc_html(wp_max_upload_size()), esc_html(' bytes ('.$upload_size_limit_with_units.')')); ?></span>
939
+ </td>
940
+ </tr>
941
+ </table>
942
+ <h3 class="title"><?php _e('Avatars'); ?></h3>
943
+ <p><?php _e('An avatar is an image that follows you from weblog to weblog appearing beside your name when you comment on avatar enabled sites. Here you can enable the display of avatars for people who comment on your site.'); ?></p>
944
+ <table class="form-table">
945
+ <tr valign="top">
946
+ <th scope="row"><?php _e('Avatar Display'); ?></th>
947
+ <td>
948
+ <fieldset>
949
+ <legend class="screen-reader-text"><span><?php _e('Avatar Display'); ?></span></legend>
950
+ <label for="show_avatars">
951
+ <input type="checkbox" id="show_avatars" name="show_avatars" value="1" <?php checked('1', get_option('show_avatars')); ?> />
952
+ <?php _e('Show Avatars'); ?>
953
+ </label>
954
+ </fieldset>
955
+ </td>
956
+ </tr>
957
+ <tr valign="top">
958
+ <th scope="row"><?php _e('Maximum Rating'); ?></th>
959
+ <td>
960
+ <fieldset>
961
+ <legend class="screen-reader-text"><span><?php _e('Maximum Rating'); ?></span></legend>
962
+ <?php
963
+ $ratings = array(
964
+ 'G' => __('G &#8212; Suitable for all audiences'),
965
+ 'PG' => __('PG &#8212; Possibly offensive, usually for audiences 13 and above'),
966
+ 'R' => __('R &#8212; Intended for adult audiences above 17'),
967
+ 'X' => __('X &#8212; Even more mature than above')
968
+ );
969
+ foreach ($ratings as $key => $rating) :
970
+ $selected = (get_option('avatar_rating') == $key) ? 'checked="checked"' : "";
971
+ echo "\n\t<label><input type='radio' name='avatar_rating' value='" . esc_attr($key) . "' $selected/> $rating</label><br />";
972
+ endforeach;
973
+ ?>
974
+ </fieldset>
975
+ </td>
976
+ </tr>
977
+ <tr valign="top">
978
+ <th scope="row"><?php _e('Default Avatar') ?></th>
979
+ <td class="defaultavatarpicker">
980
+ <fieldset>
981
+ <legend class="screen-reader-text"><span><?php _e('Default Avatar'); ?></span></legend>
982
+ <?php _e('For users without a custom avatar of their own, you can either display a generic logo or a generated one based on their e-mail address.'); ?><br />
983
+ <?php echo wpua_add_default_avatar(); ?>
984
+ </fieldset>
985
+ </td>
986
+ </tr>
987
+ </table>
988
+ <?php submit_button(); ?>
989
+ </form>
990
+ </div>
991
+ <?php
992
+ }
993
+
994
+ // Whitelist settings
995
+ function wpua_admin_settings(){
996
+ register_setting('wpua-settings-group', 'wp_user_avatar_tinymce', 'intval');
997
+ register_setting('wpua-settings-group', 'wp_user_avatar_allow_upload', 'intval');
998
+ register_setting('wpua-settings-group', 'wp_user_avatar_disable_gravatar', 'intval');
999
+ register_setting('wpua-settings-group', 'wp_user_avatar_upload_size_limit', 'intval');
1000
+ register_setting('wpua-settings-group', 'show_avatars', 'intval');
1001
+ register_setting('wpua-settings-group', 'avatar_rating');
1002
+ register_setting('wpua-settings-group', 'avatar_default');
1003
+ register_setting('wpua-settings-group', 'avatar_default_wp_user_avatar', 'intval');
1004
+ }
1005
+
1006
+ // Add options page and settings
1007
+ function wpua_admin(){
1008
+ add_options_page('WP User Avatar Plugin Settings', 'WP User Avatar', 'manage_options', 'wp-user-avatar', 'wpua_options_page');
1009
+ add_action('admin_init', 'wpua_admin_settings');
1010
+ }
1011
+
1012
+ // Initialize WPUA after other plugins are loaded
1013
+ function wpua_load(){
1014
+ global $wpua_instance;
1015
+ $wpua_instance = new wp_user_avatar();
1016
+ }
1017
+ add_action('plugins_loaded', 'wpua_load');
1018
  }
1019
  ?>