WP-Members Membership Plugin - Version 3.2.9

Version Description

  • Load jQuery UI and Select2 libraries locally (if they have not already been enqueued).
  • Use (local) template file for default tos field link (can be customized and saved in theme folder).
  • Added new sanitization functions to API: wpmem_sanitize_class() and wpmem_sanitize_array().
  • Review and cleanup of form data sanitization.
  • Improved file/image field upload file type validation.
  • Fixed issue with loading legacy translation files.
  • Added "membership" attribute to [wpmem_logged_in] shortcode (same as "product" attribute, they are interchangeable).
  • Added datepicker for setting user expiration (when membership products are used).
Download this release

Release Info

Developer cbutlerjr
Plugin Icon 128x128 WP-Members Membership Plugin
Version 3.2.9
Comparing to
See all releases

Code changes from version 3.2.8 to 3.2.9

admin/css/jquery-ui.css ADDED
@@ -0,0 +1,1311 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! jQuery UI - v1.12.1 - 2016-09-14
2
+ * http://jqueryui.com
3
+ * Includes: core.css, accordion.css, autocomplete.css, menu.css, button.css, controlgroup.css, checkboxradio.css, datepicker.css, dialog.css, draggable.css, resizable.css, progressbar.css, selectable.css, selectmenu.css, slider.css, sortable.css, spinner.css, tabs.css, tooltip.css, theme.css
4
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Arial%2CHelvetica%2Csans-serif&fsDefault=1em&fwDefault=normal&cornerRadius=3px&bgColorHeader=e9e9e9&bgTextureHeader=flat&borderColorHeader=dddddd&fcHeader=333333&iconColorHeader=444444&bgColorContent=ffffff&bgTextureContent=flat&borderColorContent=dddddd&fcContent=333333&iconColorContent=444444&bgColorDefault=f6f6f6&bgTextureDefault=flat&borderColorDefault=c5c5c5&fcDefault=454545&iconColorDefault=777777&bgColorHover=ededed&bgTextureHover=flat&borderColorHover=cccccc&fcHover=2b2b2b&iconColorHover=555555&bgColorActive=007fff&bgTextureActive=flat&borderColorActive=003eff&fcActive=ffffff&iconColorActive=ffffff&bgColorHighlight=fffa90&bgTextureHighlight=flat&borderColorHighlight=dad55e&fcHighlight=777620&iconColorHighlight=777620&bgColorError=fddfdf&bgTextureError=flat&borderColorError=f1a899&fcError=5f3f3f&iconColorError=cc0000&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=666666&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=5px&offsetTopShadow=0px&offsetLeftShadow=0px&cornerRadiusShadow=8px
5
+ * Copyright jQuery Foundation and other contributors; Licensed MIT */
6
+
7
+ /* Layout helpers
8
+ ----------------------------------*/
9
+ .ui-helper-hidden {
10
+ display: none;
11
+ }
12
+ .ui-helper-hidden-accessible {
13
+ border: 0;
14
+ clip: rect(0 0 0 0);
15
+ height: 1px;
16
+ margin: -1px;
17
+ overflow: hidden;
18
+ padding: 0;
19
+ position: absolute;
20
+ width: 1px;
21
+ }
22
+ .ui-helper-reset {
23
+ margin: 0;
24
+ padding: 0;
25
+ border: 0;
26
+ outline: 0;
27
+ line-height: 1.3;
28
+ text-decoration: none;
29
+ font-size: 100%;
30
+ list-style: none;
31
+ }
32
+ .ui-helper-clearfix:before,
33
+ .ui-helper-clearfix:after {
34
+ content: "";
35
+ display: table;
36
+ border-collapse: collapse;
37
+ }
38
+ .ui-helper-clearfix:after {
39
+ clear: both;
40
+ }
41
+ .ui-helper-zfix {
42
+ width: 100%;
43
+ height: 100%;
44
+ top: 0;
45
+ left: 0;
46
+ position: absolute;
47
+ opacity: 0;
48
+ filter:Alpha(Opacity=0); /* support: IE8 */
49
+ }
50
+
51
+ .ui-front {
52
+ z-index: 100;
53
+ }
54
+
55
+
56
+ /* Interaction Cues
57
+ ----------------------------------*/
58
+ .ui-state-disabled {
59
+ cursor: default !important;
60
+ pointer-events: none;
61
+ }
62
+
63
+
64
+ /* Icons
65
+ ----------------------------------*/
66
+ .ui-icon {
67
+ display: inline-block;
68
+ vertical-align: middle;
69
+ margin-top: -.25em;
70
+ position: relative;
71
+ text-indent: -99999px;
72
+ overflow: hidden;
73
+ background-repeat: no-repeat;
74
+ }
75
+
76
+ .ui-widget-icon-block {
77
+ left: 50%;
78
+ margin-left: -8px;
79
+ display: block;
80
+ }
81
+
82
+ /* Misc visuals
83
+ ----------------------------------*/
84
+
85
+ /* Overlays */
86
+ .ui-widget-overlay {
87
+ position: fixed;
88
+ top: 0;
89
+ left: 0;
90
+ width: 100%;
91
+ height: 100%;
92
+ }
93
+ .ui-accordion .ui-accordion-header {
94
+ display: block;
95
+ cursor: pointer;
96
+ position: relative;
97
+ margin: 2px 0 0 0;
98
+ padding: .5em .5em .5em .7em;
99
+ font-size: 100%;
100
+ }
101
+ .ui-accordion .ui-accordion-content {
102
+ padding: 1em 2.2em;
103
+ border-top: 0;
104
+ overflow: auto;
105
+ }
106
+ .ui-autocomplete {
107
+ position: absolute;
108
+ top: 0;
109
+ left: 0;
110
+ cursor: default;
111
+ }
112
+ .ui-menu {
113
+ list-style: none;
114
+ padding: 0;
115
+ margin: 0;
116
+ display: block;
117
+ outline: 0;
118
+ }
119
+ .ui-menu .ui-menu {
120
+ position: absolute;
121
+ }
122
+ .ui-menu .ui-menu-item {
123
+ margin: 0;
124
+ cursor: pointer;
125
+ /* support: IE10, see #8844 */
126
+ list-style-image: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7");
127
+ }
128
+ .ui-menu .ui-menu-item-wrapper {
129
+ position: relative;
130
+ padding: 3px 1em 3px .4em;
131
+ }
132
+ .ui-menu .ui-menu-divider {
133
+ margin: 5px 0;
134
+ height: 0;
135
+ font-size: 0;
136
+ line-height: 0;
137
+ border-width: 1px 0 0 0;
138
+ }
139
+ .ui-menu .ui-state-focus,
140
+ .ui-menu .ui-state-active {
141
+ margin: -1px;
142
+ }
143
+
144
+ /* icon support */
145
+ .ui-menu-icons {
146
+ position: relative;
147
+ }
148
+ .ui-menu-icons .ui-menu-item-wrapper {
149
+ padding-left: 2em;
150
+ }
151
+
152
+ /* left-aligned */
153
+ .ui-menu .ui-icon {
154
+ position: absolute;
155
+ top: 0;
156
+ bottom: 0;
157
+ left: .2em;
158
+ margin: auto 0;
159
+ }
160
+
161
+ /* right-aligned */
162
+ .ui-menu .ui-menu-icon {
163
+ left: auto;
164
+ right: 0;
165
+ }
166
+ .ui-button {
167
+ padding: .4em 1em;
168
+ display: inline-block;
169
+ position: relative;
170
+ line-height: normal;
171
+ margin-right: .1em;
172
+ cursor: pointer;
173
+ vertical-align: middle;
174
+ text-align: center;
175
+ -webkit-user-select: none;
176
+ -moz-user-select: none;
177
+ -ms-user-select: none;
178
+ user-select: none;
179
+
180
+ /* Support: IE <= 11 */
181
+ overflow: visible;
182
+ }
183
+
184
+ .ui-button,
185
+ .ui-button:link,
186
+ .ui-button:visited,
187
+ .ui-button:hover,
188
+ .ui-button:active {
189
+ text-decoration: none;
190
+ }
191
+
192
+ /* to make room for the icon, a width needs to be set here */
193
+ .ui-button-icon-only {
194
+ width: 2em;
195
+ box-sizing: border-box;
196
+ text-indent: -9999px;
197
+ white-space: nowrap;
198
+ }
199
+
200
+ /* no icon support for input elements */
201
+ input.ui-button.ui-button-icon-only {
202
+ text-indent: 0;
203
+ }
204
+
205
+ /* button icon element(s) */
206
+ .ui-button-icon-only .ui-icon {
207
+ position: absolute;
208
+ top: 50%;
209
+ left: 50%;
210
+ margin-top: -8px;
211
+ margin-left: -8px;
212
+ }
213
+
214
+ .ui-button.ui-icon-notext .ui-icon {
215
+ padding: 0;
216
+ width: 2.1em;
217
+ height: 2.1em;
218
+ text-indent: -9999px;
219
+ white-space: nowrap;
220
+
221
+ }
222
+
223
+ input.ui-button.ui-icon-notext .ui-icon {
224
+ width: auto;
225
+ height: auto;
226
+ text-indent: 0;
227
+ white-space: normal;
228
+ padding: .4em 1em;
229
+ }
230
+
231
+ /* workarounds */
232
+ /* Support: Firefox 5 - 40 */
233
+ input.ui-button::-moz-focus-inner,
234
+ button.ui-button::-moz-focus-inner {
235
+ border: 0;
236
+ padding: 0;
237
+ }
238
+ .ui-controlgroup {
239
+ vertical-align: middle;
240
+ display: inline-block;
241
+ }
242
+ .ui-controlgroup > .ui-controlgroup-item {
243
+ float: left;
244
+ margin-left: 0;
245
+ margin-right: 0;
246
+ }
247
+ .ui-controlgroup > .ui-controlgroup-item:focus,
248
+ .ui-controlgroup > .ui-controlgroup-item.ui-visual-focus {
249
+ z-index: 9999;
250
+ }
251
+ .ui-controlgroup-vertical > .ui-controlgroup-item {
252
+ display: block;
253
+ float: none;
254
+ width: 100%;
255
+ margin-top: 0;
256
+ margin-bottom: 0;
257
+ text-align: left;
258
+ }
259
+ .ui-controlgroup-vertical .ui-controlgroup-item {
260
+ box-sizing: border-box;
261
+ }
262
+ .ui-controlgroup .ui-controlgroup-label {
263
+ padding: .4em 1em;
264
+ }
265
+ .ui-controlgroup .ui-controlgroup-label span {
266
+ font-size: 80%;
267
+ }
268
+ .ui-controlgroup-horizontal .ui-controlgroup-label + .ui-controlgroup-item {
269
+ border-left: none;
270
+ }
271
+ .ui-controlgroup-vertical .ui-controlgroup-label + .ui-controlgroup-item {
272
+ border-top: none;
273
+ }
274
+ .ui-controlgroup-horizontal .ui-controlgroup-label.ui-widget-content {
275
+ border-right: none;
276
+ }
277
+ .ui-controlgroup-vertical .ui-controlgroup-label.ui-widget-content {
278
+ border-bottom: none;
279
+ }
280
+
281
+ /* Spinner specific style fixes */
282
+ .ui-controlgroup-vertical .ui-spinner-input {
283
+
284
+ /* Support: IE8 only, Android < 4.4 only */
285
+ width: 75%;
286
+ width: calc( 100% - 2.4em );
287
+ }
288
+ .ui-controlgroup-vertical .ui-spinner .ui-spinner-up {
289
+ border-top-style: solid;
290
+ }
291
+
292
+ .ui-checkboxradio-label .ui-icon-background {
293
+ box-shadow: inset 1px 1px 1px #ccc;
294
+ border-radius: .12em;
295
+ border: none;
296
+ }
297
+ .ui-checkboxradio-radio-label .ui-icon-background {
298
+ width: 16px;
299
+ height: 16px;
300
+ border-radius: 1em;
301
+ overflow: visible;
302
+ border: none;
303
+ }
304
+ .ui-checkboxradio-radio-label.ui-checkboxradio-checked .ui-icon,
305
+ .ui-checkboxradio-radio-label.ui-checkboxradio-checked:hover .ui-icon {
306
+ background-image: none;
307
+ width: 8px;
308
+ height: 8px;
309
+ border-width: 4px;
310
+ border-style: solid;
311
+ }
312
+ .ui-checkboxradio-disabled {
313
+ pointer-events: none;
314
+ }
315
+ .ui-datepicker {
316
+ width: 17em;
317
+ padding: .2em .2em 0;
318
+ display: none;
319
+ }
320
+ .ui-datepicker .ui-datepicker-header {
321
+ position: relative;
322
+ padding: .2em 0;
323
+ }
324
+ .ui-datepicker .ui-datepicker-prev,
325
+ .ui-datepicker .ui-datepicker-next {
326
+ position: absolute;
327
+ top: 2px;
328
+ width: 1.8em;
329
+ height: 1.8em;
330
+ }
331
+ .ui-datepicker .ui-datepicker-prev-hover,
332
+ .ui-datepicker .ui-datepicker-next-hover {
333
+ top: 1px;
334
+ }
335
+ .ui-datepicker .ui-datepicker-prev {
336
+ left: 2px;
337
+ }
338
+ .ui-datepicker .ui-datepicker-next {
339
+ right: 2px;
340
+ }
341
+ .ui-datepicker .ui-datepicker-prev-hover {
342
+ left: 1px;
343
+ }
344
+ .ui-datepicker .ui-datepicker-next-hover {
345
+ right: 1px;
346
+ }
347
+ .ui-datepicker .ui-datepicker-prev span,
348
+ .ui-datepicker .ui-datepicker-next span {
349
+ display: block;
350
+ position: absolute;
351
+ left: 50%;
352
+ margin-left: -8px;
353
+ top: 50%;
354
+ margin-top: -8px;
355
+ }
356
+ .ui-datepicker .ui-datepicker-title {
357
+ margin: 0 2.3em;
358
+ line-height: 1.8em;
359
+ text-align: center;
360
+ }
361
+ .ui-datepicker .ui-datepicker-title select {
362
+ font-size: 1em;
363
+ margin: 1px 0;
364
+ }
365
+ .ui-datepicker select.ui-datepicker-month,
366
+ .ui-datepicker select.ui-datepicker-year {
367
+ width: 45%;
368
+ }
369
+ .ui-datepicker table {
370
+ width: 100%;
371
+ font-size: .9em;
372
+ border-collapse: collapse;
373
+ margin: 0 0 .4em;
374
+ }
375
+ .ui-datepicker th {
376
+ padding: .7em .3em;
377
+ text-align: center;
378
+ font-weight: bold;
379
+ border: 0;
380
+ }
381
+ .ui-datepicker td {
382
+ border: 0;
383
+ padding: 1px;
384
+ }
385
+ .ui-datepicker td span,
386
+ .ui-datepicker td a {
387
+ display: block;
388
+ padding: .2em;
389
+ text-align: right;
390
+ text-decoration: none;
391
+ }
392
+ .ui-datepicker .ui-datepicker-buttonpane {
393
+ background-image: none;
394
+ margin: .7em 0 0 0;
395
+ padding: 0 .2em;
396
+ border-left: 0;
397
+ border-right: 0;
398
+ border-bottom: 0;
399
+ }
400
+ .ui-datepicker .ui-datepicker-buttonpane button {
401
+ float: right;
402
+ margin: .5em .2em .4em;
403
+ cursor: pointer;
404
+ padding: .2em .6em .3em .6em;
405
+ width: auto;
406
+ overflow: visible;
407
+ }
408
+ .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current {
409
+ float: left;
410
+ }
411
+
412
+ /* with multiple calendars */
413
+ .ui-datepicker.ui-datepicker-multi {
414
+ width: auto;
415
+ }
416
+ .ui-datepicker-multi .ui-datepicker-group {
417
+ float: left;
418
+ }
419
+ .ui-datepicker-multi .ui-datepicker-group table {
420
+ width: 95%;
421
+ margin: 0 auto .4em;
422
+ }
423
+ .ui-datepicker-multi-2 .ui-datepicker-group {
424
+ width: 50%;
425
+ }
426
+ .ui-datepicker-multi-3 .ui-datepicker-group {
427
+ width: 33.3%;
428
+ }
429
+ .ui-datepicker-multi-4 .ui-datepicker-group {
430
+ width: 25%;
431
+ }
432
+ .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,
433
+ .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header {
434
+ border-left-width: 0;
435
+ }
436
+ .ui-datepicker-multi .ui-datepicker-buttonpane {
437
+ clear: left;
438
+ }
439
+ .ui-datepicker-row-break {
440
+ clear: both;
441
+ width: 100%;
442
+ font-size: 0;
443
+ }
444
+
445
+ /* RTL support */
446
+ .ui-datepicker-rtl {
447
+ direction: rtl;
448
+ }
449
+ .ui-datepicker-rtl .ui-datepicker-prev {
450
+ right: 2px;
451
+ left: auto;
452
+ }
453
+ .ui-datepicker-rtl .ui-datepicker-next {
454
+ left: 2px;
455
+ right: auto;
456
+ }
457
+ .ui-datepicker-rtl .ui-datepicker-prev:hover {
458
+ right: 1px;
459
+ left: auto;
460
+ }
461
+ .ui-datepicker-rtl .ui-datepicker-next:hover {
462
+ left: 1px;
463
+ right: auto;
464
+ }
465
+ .ui-datepicker-rtl .ui-datepicker-buttonpane {
466
+ clear: right;
467
+ }
468
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button {
469
+ float: left;
470
+ }
471
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,
472
+ .ui-datepicker-rtl .ui-datepicker-group {
473
+ float: right;
474
+ }
475
+ .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,
476
+ .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header {
477
+ border-right-width: 0;
478
+ border-left-width: 1px;
479
+ }
480
+
481
+ /* Icons */
482
+ .ui-datepicker .ui-icon {
483
+ display: block;
484
+ text-indent: -99999px;
485
+ overflow: hidden;
486
+ background-repeat: no-repeat;
487
+ left: .5em;
488
+ top: .3em;
489
+ }
490
+ .ui-dialog {
491
+ position: absolute;
492
+ top: 0;
493
+ left: 0;
494
+ padding: .2em;
495
+ outline: 0;
496
+ }
497
+ .ui-dialog .ui-dialog-titlebar {
498
+ padding: .4em 1em;
499
+ position: relative;
500
+ }
501
+ .ui-dialog .ui-dialog-title {
502
+ float: left;
503
+ margin: .1em 0;
504
+ white-space: nowrap;
505
+ width: 90%;
506
+ overflow: hidden;
507
+ text-overflow: ellipsis;
508
+ }
509
+ .ui-dialog .ui-dialog-titlebar-close {
510
+ position: absolute;
511
+ right: .3em;
512
+ top: 50%;
513
+ width: 20px;
514
+ margin: -10px 0 0 0;
515
+ padding: 1px;
516
+ height: 20px;
517
+ }
518
+ .ui-dialog .ui-dialog-content {
519
+ position: relative;
520
+ border: 0;
521
+ padding: .5em 1em;
522
+ background: none;
523
+ overflow: auto;
524
+ }
525
+ .ui-dialog .ui-dialog-buttonpane {
526
+ text-align: left;
527
+ border-width: 1px 0 0 0;
528
+ background-image: none;
529
+ margin-top: .5em;
530
+ padding: .3em 1em .5em .4em;
531
+ }
532
+ .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
533
+ float: right;
534
+ }
535
+ .ui-dialog .ui-dialog-buttonpane button {
536
+ margin: .5em .4em .5em 0;
537
+ cursor: pointer;
538
+ }
539
+ .ui-dialog .ui-resizable-n {
540
+ height: 2px;
541
+ top: 0;
542
+ }
543
+ .ui-dialog .ui-resizable-e {
544
+ width: 2px;
545
+ right: 0;
546
+ }
547
+ .ui-dialog .ui-resizable-s {
548
+ height: 2px;
549
+ bottom: 0;
550
+ }
551
+ .ui-dialog .ui-resizable-w {
552
+ width: 2px;
553
+ left: 0;
554
+ }
555
+ .ui-dialog .ui-resizable-se,
556
+ .ui-dialog .ui-resizable-sw,
557
+ .ui-dialog .ui-resizable-ne,
558
+ .ui-dialog .ui-resizable-nw {
559
+ width: 7px;
560
+ height: 7px;
561
+ }
562
+ .ui-dialog .ui-resizable-se {
563
+ right: 0;
564
+ bottom: 0;
565
+ }
566
+ .ui-dialog .ui-resizable-sw {
567
+ left: 0;
568
+ bottom: 0;
569
+ }
570
+ .ui-dialog .ui-resizable-ne {
571
+ right: 0;
572
+ top: 0;
573
+ }
574
+ .ui-dialog .ui-resizable-nw {
575
+ left: 0;
576
+ top: 0;
577
+ }
578
+ .ui-draggable .ui-dialog-titlebar {
579
+ cursor: move;
580
+ }
581
+ .ui-draggable-handle {
582
+ -ms-touch-action: none;
583
+ touch-action: none;
584
+ }
585
+ .ui-resizable {
586
+ position: relative;
587
+ }
588
+ .ui-resizable-handle {
589
+ position: absolute;
590
+ font-size: 0.1px;
591
+ display: block;
592
+ -ms-touch-action: none;
593
+ touch-action: none;
594
+ }
595
+ .ui-resizable-disabled .ui-resizable-handle,
596
+ .ui-resizable-autohide .ui-resizable-handle {
597
+ display: none;
598
+ }
599
+ .ui-resizable-n {
600
+ cursor: n-resize;
601
+ height: 7px;
602
+ width: 100%;
603
+ top: -5px;
604
+ left: 0;
605
+ }
606
+ .ui-resizable-s {
607
+ cursor: s-resize;
608
+ height: 7px;
609
+ width: 100%;
610
+ bottom: -5px;
611
+ left: 0;
612
+ }
613
+ .ui-resizable-e {
614
+ cursor: e-resize;
615
+ width: 7px;
616
+ right: -5px;
617
+ top: 0;
618
+ height: 100%;
619
+ }
620
+ .ui-resizable-w {
621
+ cursor: w-resize;
622
+ width: 7px;
623
+ left: -5px;
624
+ top: 0;
625
+ height: 100%;
626
+ }
627
+ .ui-resizable-se {
628
+ cursor: se-resize;
629
+ width: 12px;
630
+ height: 12px;
631
+ right: 1px;
632
+ bottom: 1px;
633
+ }
634
+ .ui-resizable-sw {
635
+ cursor: sw-resize;
636
+ width: 9px;
637
+ height: 9px;
638
+ left: -5px;
639
+ bottom: -5px;
640
+ }
641
+ .ui-resizable-nw {
642
+ cursor: nw-resize;
643
+ width: 9px;
644
+ height: 9px;
645
+ left: -5px;
646
+ top: -5px;
647
+ }
648
+ .ui-resizable-ne {
649
+ cursor: ne-resize;
650
+ width: 9px;
651
+ height: 9px;
652
+ right: -5px;
653
+ top: -5px;
654
+ }
655
+ .ui-progressbar {
656
+ height: 2em;
657
+ text-align: left;
658
+ overflow: hidden;
659
+ }
660
+ .ui-progressbar .ui-progressbar-value {
661
+ margin: -1px;
662
+ height: 100%;
663
+ }
664
+ .ui-progressbar .ui-progressbar-overlay {
665
+ background: url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw==");
666
+ height: 100%;
667
+ filter: alpha(opacity=25); /* support: IE8 */
668
+ opacity: 0.25;
669
+ }
670
+ .ui-progressbar-indeterminate .ui-progressbar-value {
671
+ background-image: none;
672
+ }
673
+ .ui-selectable {
674
+ -ms-touch-action: none;
675
+ touch-action: none;
676
+ }
677
+ .ui-selectable-helper {
678
+ position: absolute;
679
+ z-index: 100;
680
+ border: 1px dotted black;
681
+ }
682
+ .ui-selectmenu-menu {
683
+ padding: 0;
684
+ margin: 0;
685
+ position: absolute;
686
+ top: 0;
687
+ left: 0;
688
+ display: none;
689
+ }
690
+ .ui-selectmenu-menu .ui-menu {
691
+ overflow: auto;
692
+ overflow-x: hidden;
693
+ padding-bottom: 1px;
694
+ }
695
+ .ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup {
696
+ font-size: 1em;
697
+ font-weight: bold;
698
+ line-height: 1.5;
699
+ padding: 2px 0.4em;
700
+ margin: 0.5em 0 0 0;
701
+ height: auto;
702
+ border: 0;
703
+ }
704
+ .ui-selectmenu-open {
705
+ display: block;
706
+ }
707
+ .ui-selectmenu-text {
708
+ display: block;
709
+ margin-right: 20px;
710
+ overflow: hidden;
711
+ text-overflow: ellipsis;
712
+ }
713
+ .ui-selectmenu-button.ui-button {
714
+ text-align: left;
715
+ white-space: nowrap;
716
+ width: 14em;
717
+ }
718
+ .ui-selectmenu-icon.ui-icon {
719
+ float: right;
720
+ margin-top: 0;
721
+ }
722
+ .ui-slider {
723
+ position: relative;
724
+ text-align: left;
725
+ }
726
+ .ui-slider .ui-slider-handle {
727
+ position: absolute;
728
+ z-index: 2;
729
+ width: 1.2em;
730
+ height: 1.2em;
731
+ cursor: default;
732
+ -ms-touch-action: none;
733
+ touch-action: none;
734
+ }
735
+ .ui-slider .ui-slider-range {
736
+ position: absolute;
737
+ z-index: 1;
738
+ font-size: .7em;
739
+ display: block;
740
+ border: 0;
741
+ background-position: 0 0;
742
+ }
743
+
744
+ /* support: IE8 - See #6727 */
745
+ .ui-slider.ui-state-disabled .ui-slider-handle,
746
+ .ui-slider.ui-state-disabled .ui-slider-range {
747
+ filter: inherit;
748
+ }
749
+
750
+ .ui-slider-horizontal {
751
+ height: .8em;
752
+ }
753
+ .ui-slider-horizontal .ui-slider-handle {
754
+ top: -.3em;
755
+ margin-left: -.6em;
756
+ }
757
+ .ui-slider-horizontal .ui-slider-range {
758
+ top: 0;
759
+ height: 100%;
760
+ }
761
+ .ui-slider-horizontal .ui-slider-range-min {
762
+ left: 0;
763
+ }
764
+ .ui-slider-horizontal .ui-slider-range-max {
765
+ right: 0;
766
+ }
767
+
768
+ .ui-slider-vertical {
769
+ width: .8em;
770
+ height: 100px;
771
+ }
772
+ .ui-slider-vertical .ui-slider-handle {
773
+ left: -.3em;
774
+ margin-left: 0;
775
+ margin-bottom: -.6em;
776
+ }
777
+ .ui-slider-vertical .ui-slider-range {
778
+ left: 0;
779
+ width: 100%;
780
+ }
781
+ .ui-slider-vertical .ui-slider-range-min {
782
+ bottom: 0;
783
+ }
784
+ .ui-slider-vertical .ui-slider-range-max {
785
+ top: 0;
786
+ }
787
+ .ui-sortable-handle {
788
+ -ms-touch-action: none;
789
+ touch-action: none;
790
+ }
791
+ .ui-spinner {
792
+ position: relative;
793
+ display: inline-block;
794
+ overflow: hidden;
795
+ padding: 0;
796
+ vertical-align: middle;
797
+ }
798
+ .ui-spinner-input {
799
+ border: none;
800
+ background: none;
801
+ color: inherit;
802
+ padding: .222em 0;
803
+ margin: .2em 0;
804
+ vertical-align: middle;
805
+ margin-left: .4em;
806
+ margin-right: 2em;
807
+ }
808
+ .ui-spinner-button {
809
+ width: 1.6em;
810
+ height: 50%;
811
+ font-size: .5em;
812
+ padding: 0;
813
+ margin: 0;
814
+ text-align: center;
815
+ position: absolute;
816
+ cursor: default;
817
+ display: block;
818
+ overflow: hidden;
819
+ right: 0;
820
+ }
821
+ /* more specificity required here to override default borders */
822
+ .ui-spinner a.ui-spinner-button {
823
+ border-top-style: none;
824
+ border-bottom-style: none;
825
+ border-right-style: none;
826
+ }
827
+ .ui-spinner-up {
828
+ top: 0;
829
+ }
830
+ .ui-spinner-down {
831
+ bottom: 0;
832
+ }
833
+ .ui-tabs {
834
+ position: relative;/* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
835
+ padding: .2em;
836
+ }
837
+ .ui-tabs .ui-tabs-nav {
838
+ margin: 0;
839
+ padding: .2em .2em 0;
840
+ }
841
+ .ui-tabs .ui-tabs-nav li {
842
+ list-style: none;
843
+ float: left;
844
+ position: relative;
845
+ top: 0;
846
+ margin: 1px .2em 0 0;
847
+ border-bottom-width: 0;
848
+ padding: 0;
849
+ white-space: nowrap;
850
+ }
851
+ .ui-tabs .ui-tabs-nav .ui-tabs-anchor {
852
+ float: left;
853
+ padding: .5em 1em;
854
+ text-decoration: none;
855
+ }
856
+ .ui-tabs .ui-tabs-nav li.ui-tabs-active {
857
+ margin-bottom: -1px;
858
+ padding-bottom: 1px;
859
+ }
860
+ .ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,
861
+ .ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,
862
+ .ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor {
863
+ cursor: text;
864
+ }
865
+ .ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor {
866
+ cursor: pointer;
867
+ }
868
+ .ui-tabs .ui-tabs-panel {
869
+ display: block;
870
+ border-width: 0;
871
+ padding: 1em 1.4em;
872
+ background: none;
873
+ }
874
+ .ui-tooltip {
875
+ padding: 8px;
876
+ position: absolute;
877
+ z-index: 9999;
878
+ max-width: 300px;
879
+ }
880
+ body .ui-tooltip {
881
+ border-width: 2px;
882
+ }
883
+ /* Component containers
884
+ ----------------------------------*/
885
+ .ui-widget {
886
+ font-family: Arial,Helvetica,sans-serif;
887
+ font-size: 1em;
888
+ }
889
+ .ui-widget .ui-widget {
890
+ font-size: 1em;
891
+ }
892
+ .ui-widget input,
893
+ .ui-widget select,
894
+ .ui-widget textarea,
895
+ .ui-widget button {
896
+ font-family: Arial,Helvetica,sans-serif;
897
+ font-size: 1em;
898
+ }
899
+ .ui-widget.ui-widget-content {
900
+ border: 1px solid #c5c5c5;
901
+ }
902
+ .ui-widget-content {
903
+ border: 1px solid #dddddd;
904
+ background: #ffffff;
905
+ color: #333333;
906
+ }
907
+ .ui-widget-content a {
908
+ color: #333333;
909
+ }
910
+ .ui-widget-header {
911
+ border: 1px solid #dddddd;
912
+ background: #e9e9e9;
913
+ color: #333333;
914
+ font-weight: bold;
915
+ }
916
+ .ui-widget-header a {
917
+ color: #333333;
918
+ }
919
+
920
+ /* Interaction states
921
+ ----------------------------------*/
922
+ .ui-state-default,
923
+ .ui-widget-content .ui-state-default,
924
+ .ui-widget-header .ui-state-default,
925
+ .ui-button,
926
+
927
+ /* We use html here because we need a greater specificity to make sure disabled
928
+ works properly when clicked or hovered */
929
+ html .ui-button.ui-state-disabled:hover,
930
+ html .ui-button.ui-state-disabled:active {
931
+ border: 1px solid #c5c5c5;
932
+ background: #f6f6f6;
933
+ font-weight: normal;
934
+ color: #454545;
935
+ }
936
+ .ui-state-default a,
937
+ .ui-state-default a:link,
938
+ .ui-state-default a:visited,
939
+ a.ui-button,
940
+ a:link.ui-button,
941
+ a:visited.ui-button,
942
+ .ui-button {
943
+ color: #454545;
944
+ text-decoration: none;
945
+ }
946
+ .ui-state-hover,
947
+ .ui-widget-content .ui-state-hover,
948
+ .ui-widget-header .ui-state-hover,
949
+ .ui-state-focus,
950
+ .ui-widget-content .ui-state-focus,
951
+ .ui-widget-header .ui-state-focus,
952
+ .ui-button:hover,
953
+ .ui-button:focus {
954
+ border: 1px solid #cccccc;
955
+ background: #ededed;
956
+ font-weight: normal;
957
+ color: #2b2b2b;
958
+ }
959
+ .ui-state-hover a,
960
+ .ui-state-hover a:hover,
961
+ .ui-state-hover a:link,
962
+ .ui-state-hover a:visited,
963
+ .ui-state-focus a,
964
+ .ui-state-focus a:hover,
965
+ .ui-state-focus a:link,
966
+ .ui-state-focus a:visited,
967
+ a.ui-button:hover,
968
+ a.ui-button:focus {
969
+ color: #2b2b2b;
970
+ text-decoration: none;
971
+ }
972
+
973
+ .ui-visual-focus {
974
+ box-shadow: 0 0 3px 1px rgb(94, 158, 214);
975
+ }
976
+ .ui-state-active,
977
+ .ui-widget-content .ui-state-active,
978
+ .ui-widget-header .ui-state-active,
979
+ a.ui-button:active,
980
+ .ui-button:active,
981
+ .ui-button.ui-state-active:hover {
982
+ border: 1px solid #003eff;
983
+ background: #007fff;
984
+ font-weight: normal;
985
+ color: #ffffff;
986
+ }
987
+ .ui-icon-background,
988
+ .ui-state-active .ui-icon-background {
989
+ border: #003eff;
990
+ background-color: #ffffff;
991
+ }
992
+ .ui-state-active a,
993
+ .ui-state-active a:link,
994
+ .ui-state-active a:visited {
995
+ color: #ffffff;
996
+ text-decoration: none;
997
+ }
998
+
999
+ /* Interaction Cues
1000
+ ----------------------------------*/
1001
+ .ui-state-highlight,
1002
+ .ui-widget-content .ui-state-highlight,
1003
+ .ui-widget-header .ui-state-highlight {
1004
+ border: 1px solid #dad55e;
1005
+ background: #fffa90;
1006
+ color: #777620;
1007
+ }
1008
+ .ui-state-checked {
1009
+ border: 1px solid #dad55e;
1010
+ background: #fffa90;
1011
+ }
1012
+ .ui-state-highlight a,
1013
+ .ui-widget-content .ui-state-highlight a,
1014
+ .ui-widget-header .ui-state-highlight a {
1015
+ color: #777620;
1016
+ }
1017
+ .ui-state-error,
1018
+ .ui-widget-content .ui-state-error,
1019
+ .ui-widget-header .ui-state-error {
1020
+ border: 1px solid #f1a899;
1021
+ background: #fddfdf;
1022
+ color: #5f3f3f;
1023
+ }
1024
+ .ui-state-error a,
1025
+ .ui-widget-content .ui-state-error a,
1026
+ .ui-widget-header .ui-state-error a {
1027
+ color: #5f3f3f;
1028
+ }
1029
+ .ui-state-error-text,
1030
+ .ui-widget-content .ui-state-error-text,
1031
+ .ui-widget-header .ui-state-error-text {
1032
+ color: #5f3f3f;
1033
+ }
1034
+ .ui-priority-primary,
1035
+ .ui-widget-content .ui-priority-primary,
1036
+ .ui-widget-header .ui-priority-primary {
1037
+ font-weight: bold;
1038
+ }
1039
+ .ui-priority-secondary,
1040
+ .ui-widget-content .ui-priority-secondary,
1041
+ .ui-widget-header .ui-priority-secondary {
1042
+ opacity: .7;
1043
+ filter:Alpha(Opacity=70); /* support: IE8 */
1044
+ font-weight: normal;
1045
+ }
1046
+ .ui-state-disabled,
1047
+ .ui-widget-content .ui-state-disabled,
1048
+ .ui-widget-header .ui-state-disabled {
1049
+ opacity: .35;
1050
+ filter:Alpha(Opacity=35); /* support: IE8 */
1051
+ background-image: none;
1052
+ }
1053
+ .ui-state-disabled .ui-icon {
1054
+ filter:Alpha(Opacity=35); /* support: IE8 - See #6059 */
1055
+ }
1056
+
1057
+ /* Icons
1058
+ ----------------------------------*/
1059
+
1060
+ /* states and images */
1061
+ .ui-icon {
1062
+ width: 16px;
1063
+ height: 16px;
1064
+ }
1065
+ .ui-icon,
1066
+ .ui-widget-content .ui-icon {
1067
+ background-image: url("images/ui-icons_444444_256x240.png");
1068
+ }
1069
+ .ui-widget-header .ui-icon {
1070
+ background-image: url("images/ui-icons_444444_256x240.png");
1071
+ }
1072
+ .ui-state-hover .ui-icon,
1073
+ .ui-state-focus .ui-icon,
1074
+ .ui-button:hover .ui-icon,
1075
+ .ui-button:focus .ui-icon {
1076
+ background-image: url("images/ui-icons_555555_256x240.png");
1077
+ }
1078
+ .ui-state-active .ui-icon,
1079
+ .ui-button:active .ui-icon {
1080
+ background-image: url("images/ui-icons_ffffff_256x240.png");
1081
+ }
1082
+ .ui-state-highlight .ui-icon,
1083
+ .ui-button .ui-state-highlight.ui-icon {
1084
+ background-image: url("images/ui-icons_777620_256x240.png");
1085
+ }
1086
+ .ui-state-error .ui-icon,
1087
+ .ui-state-error-text .ui-icon {
1088
+ background-image: url("images/ui-icons_cc0000_256x240.png");
1089
+ }
1090
+ .ui-button .ui-icon {
1091
+ background-image: url("images/ui-icons_777777_256x240.png");
1092
+ }
1093
+
1094
+ /* positioning */
1095
+ .ui-icon-blank { background-position: 16px 16px; }
1096
+ .ui-icon-caret-1-n { background-position: 0 0; }
1097
+ .ui-icon-caret-1-ne { background-position: -16px 0; }
1098
+ .ui-icon-caret-1-e { background-position: -32px 0; }
1099
+ .ui-icon-caret-1-se { background-position: -48px 0; }
1100
+ .ui-icon-caret-1-s { background-position: -65px 0; }
1101
+ .ui-icon-caret-1-sw { background-position: -80px 0; }
1102
+ .ui-icon-caret-1-w { background-position: -96px 0; }
1103
+ .ui-icon-caret-1-nw { background-position: -112px 0; }
1104
+ .ui-icon-caret-2-n-s { background-position: -128px 0; }
1105
+ .ui-icon-caret-2-e-w { background-position: -144px 0; }
1106
+ .ui-icon-triangle-1-n { background-position: 0 -16px; }
1107
+ .ui-icon-triangle-1-ne { background-position: -16px -16px; }
1108
+ .ui-icon-triangle-1-e { background-position: -32px -16px; }
1109
+ .ui-icon-triangle-1-se { background-position: -48px -16px; }
1110
+ .ui-icon-triangle-1-s { background-position: -65px -16px; }
1111
+ .ui-icon-triangle-1-sw { background-position: -80px -16px; }
1112
+ .ui-icon-triangle-1-w { background-position: -96px -16px; }
1113
+ .ui-icon-triangle-1-nw { background-position: -112px -16px; }
1114
+ .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
1115
+ .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
1116
+ .ui-icon-arrow-1-n { background-position: 0 -32px; }
1117
+ .ui-icon-arrow-1-ne { background-position: -16px -32px; }
1118
+ .ui-icon-arrow-1-e { background-position: -32px -32px; }
1119
+ .ui-icon-arrow-1-se { background-position: -48px -32px; }
1120
+ .ui-icon-arrow-1-s { background-position: -65px -32px; }
1121
+ .ui-icon-arrow-1-sw { background-position: -80px -32px; }
1122
+ .ui-icon-arrow-1-w { background-position: -96px -32px; }
1123
+ .ui-icon-arrow-1-nw { background-position: -112px -32px; }
1124
+ .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
1125
+ .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
1126
+ .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
1127
+ .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
1128
+ .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
1129
+ .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
1130
+ .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
1131
+ .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
1132
+ .ui-icon-arrowthick-1-n { background-position: 1px -48px; }
1133
+ .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
1134
+ .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
1135
+ .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
1136
+ .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
1137
+ .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
1138
+ .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
1139
+ .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
1140
+ .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
1141
+ .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
1142
+ .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
1143
+ .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
1144
+ .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
1145
+ .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
1146
+ .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
1147
+ .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
1148
+ .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
1149
+ .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
1150
+ .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
1151
+ .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
1152
+ .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
1153
+ .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
1154
+ .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
1155
+ .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
1156
+ .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
1157
+ .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
1158
+ .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
1159
+ .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
1160
+ .ui-icon-arrow-4 { background-position: 0 -80px; }
1161
+ .ui-icon-arrow-4-diag { background-position: -16px -80px; }
1162
+ .ui-icon-extlink { background-position: -32px -80px; }
1163
+ .ui-icon-newwin { background-position: -48px -80px; }
1164
+ .ui-icon-refresh { background-position: -64px -80px; }
1165
+ .ui-icon-shuffle { background-position: -80px -80px; }
1166
+ .ui-icon-transfer-e-w { background-position: -96px -80px; }
1167
+ .ui-icon-transferthick-e-w { background-position: -112px -80px; }
1168
+ .ui-icon-folder-collapsed { background-position: 0 -96px; }
1169
+ .ui-icon-folder-open { background-position: -16px -96px; }
1170
+ .ui-icon-document { background-position: -32px -96px; }
1171
+ .ui-icon-document-b { background-position: -48px -96px; }
1172
+ .ui-icon-note { background-position: -64px -96px; }
1173
+ .ui-icon-mail-closed { background-position: -80px -96px; }
1174
+ .ui-icon-mail-open { background-position: -96px -96px; }
1175
+ .ui-icon-suitcase { background-position: -112px -96px; }
1176
+ .ui-icon-comment { background-position: -128px -96px; }
1177
+ .ui-icon-person { background-position: -144px -96px; }
1178
+ .ui-icon-print { background-position: -160px -96px; }
1179
+ .ui-icon-trash { background-position: -176px -96px; }
1180
+ .ui-icon-locked { background-position: -192px -96px; }
1181
+ .ui-icon-unlocked { background-position: -208px -96px; }
1182
+ .ui-icon-bookmark { background-position: -224px -96px; }
1183
+ .ui-icon-tag { background-position: -240px -96px; }
1184
+ .ui-icon-home { background-position: 0 -112px; }
1185
+ .ui-icon-flag { background-position: -16px -112px; }
1186
+ .ui-icon-calendar { background-position: -32px -112px; }
1187
+ .ui-icon-cart { background-position: -48px -112px; }
1188
+ .ui-icon-pencil { background-position: -64px -112px; }
1189
+ .ui-icon-clock { background-position: -80px -112px; }
1190
+ .ui-icon-disk { background-position: -96px -112px; }
1191
+ .ui-icon-calculator { background-position: -112px -112px; }
1192
+ .ui-icon-zoomin { background-position: -128px -112px; }
1193
+ .ui-icon-zoomout { background-position: -144px -112px; }
1194
+ .ui-icon-search { background-position: -160px -112px; }
1195
+ .ui-icon-wrench { background-position: -176px -112px; }
1196
+ .ui-icon-gear { background-position: -192px -112px; }
1197
+ .ui-icon-heart { background-position: -208px -112px; }
1198
+ .ui-icon-star { background-position: -224px -112px; }
1199
+ .ui-icon-link { background-position: -240px -112px; }
1200
+ .ui-icon-cancel { background-position: 0 -128px; }
1201
+ .ui-icon-plus { background-position: -16px -128px; }
1202
+ .ui-icon-plusthick { background-position: -32px -128px; }
1203
+ .ui-icon-minus { background-position: -48px -128px; }
1204
+ .ui-icon-minusthick { background-position: -64px -128px; }
1205
+ .ui-icon-close { background-position: -80px -128px; }
1206
+ .ui-icon-closethick { background-position: -96px -128px; }
1207
+ .ui-icon-key { background-position: -112px -128px; }
1208
+ .ui-icon-lightbulb { background-position: -128px -128px; }
1209
+ .ui-icon-scissors { background-position: -144px -128px; }
1210
+ .ui-icon-clipboard { background-position: -160px -128px; }
1211
+ .ui-icon-copy { background-position: -176px -128px; }
1212
+ .ui-icon-contact { background-position: -192px -128px; }
1213
+ .ui-icon-image { background-position: -208px -128px; }
1214
+ .ui-icon-video { background-position: -224px -128px; }
1215
+ .ui-icon-script { background-position: -240px -128px; }
1216
+ .ui-icon-alert { background-position: 0 -144px; }
1217
+ .ui-icon-info { background-position: -16px -144px; }
1218
+ .ui-icon-notice { background-position: -32px -144px; }
1219
+ .ui-icon-help { background-position: -48px -144px; }
1220
+ .ui-icon-check { background-position: -64px -144px; }
1221
+ .ui-icon-bullet { background-position: -80px -144px; }
1222
+ .ui-icon-radio-on { background-position: -96px -144px; }
1223
+ .ui-icon-radio-off { background-position: -112px -144px; }
1224
+ .ui-icon-pin-w { background-position: -128px -144px; }
1225
+ .ui-icon-pin-s { background-position: -144px -144px; }
1226
+ .ui-icon-play { background-position: 0 -160px; }
1227
+ .ui-icon-pause { background-position: -16px -160px; }
1228
+ .ui-icon-seek-next { background-position: -32px -160px; }
1229
+ .ui-icon-seek-prev { background-position: -48px -160px; }
1230
+ .ui-icon-seek-end { background-position: -64px -160px; }
1231
+ .ui-icon-seek-start { background-position: -80px -160px; }
1232
+ /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
1233
+ .ui-icon-seek-first { background-position: -80px -160px; }
1234
+ .ui-icon-stop { background-position: -96px -160px; }
1235
+ .ui-icon-eject { background-position: -112px -160px; }
1236
+ .ui-icon-volume-off { background-position: -128px -160px; }
1237
+ .ui-icon-volume-on { background-position: -144px -160px; }
1238
+ .ui-icon-power { background-position: 0 -176px; }
1239
+ .ui-icon-signal-diag { background-position: -16px -176px; }
1240
+ .ui-icon-signal { background-position: -32px -176px; }
1241
+ .ui-icon-battery-0 { background-position: -48px -176px; }
1242
+ .ui-icon-battery-1 { background-position: -64px -176px; }
1243
+ .ui-icon-battery-2 { background-position: -80px -176px; }
1244
+ .ui-icon-battery-3 { background-position: -96px -176px; }
1245
+ .ui-icon-circle-plus { background-position: 0 -192px; }
1246
+ .ui-icon-circle-minus { background-position: -16px -192px; }
1247
+ .ui-icon-circle-close { background-position: -32px -192px; }
1248
+ .ui-icon-circle-triangle-e { background-position: -48px -192px; }
1249
+ .ui-icon-circle-triangle-s { background-position: -64px -192px; }
1250
+ .ui-icon-circle-triangle-w { background-position: -80px -192px; }
1251
+ .ui-icon-circle-triangle-n { background-position: -96px -192px; }
1252
+ .ui-icon-circle-arrow-e { background-position: -112px -192px; }
1253
+ .ui-icon-circle-arrow-s { background-position: -128px -192px; }
1254
+ .ui-icon-circle-arrow-w { background-position: -144px -192px; }
1255
+ .ui-icon-circle-arrow-n { background-position: -160px -192px; }
1256
+ .ui-icon-circle-zoomin { background-position: -176px -192px; }
1257
+ .ui-icon-circle-zoomout { background-position: -192px -192px; }
1258
+ .ui-icon-circle-check { background-position: -208px -192px; }
1259
+ .ui-icon-circlesmall-plus { background-position: 0 -208px; }
1260
+ .ui-icon-circlesmall-minus { background-position: -16px -208px; }
1261
+ .ui-icon-circlesmall-close { background-position: -32px -208px; }
1262
+ .ui-icon-squaresmall-plus { background-position: -48px -208px; }
1263
+ .ui-icon-squaresmall-minus { background-position: -64px -208px; }
1264
+ .ui-icon-squaresmall-close { background-position: -80px -208px; }
1265
+ .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
1266
+ .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
1267
+ .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
1268
+ .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
1269
+ .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
1270
+ .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
1271
+
1272
+
1273
+ /* Misc visuals
1274
+ ----------------------------------*/
1275
+
1276
+ /* Corner radius */
1277
+ .ui-corner-all,
1278
+ .ui-corner-top,
1279
+ .ui-corner-left,
1280
+ .ui-corner-tl {
1281
+ border-top-left-radius: 3px;
1282
+ }
1283
+ .ui-corner-all,
1284
+ .ui-corner-top,
1285
+ .ui-corner-right,
1286
+ .ui-corner-tr {
1287
+ border-top-right-radius: 3px;
1288
+ }
1289
+ .ui-corner-all,
1290
+ .ui-corner-bottom,
1291
+ .ui-corner-left,
1292
+ .ui-corner-bl {
1293
+ border-bottom-left-radius: 3px;
1294
+ }
1295
+ .ui-corner-all,
1296
+ .ui-corner-bottom,
1297
+ .ui-corner-right,
1298
+ .ui-corner-br {
1299
+ border-bottom-right-radius: 3px;
1300
+ }
1301
+
1302
+ /* Overlays */
1303
+ .ui-widget-overlay {
1304
+ background: #aaaaaa;
1305
+ opacity: .3;
1306
+ filter: Alpha(Opacity=30); /* support: IE8 */
1307
+ }
1308
+ .ui-widget-shadow {
1309
+ -webkit-box-shadow: 0px 0px 5px #666666;
1310
+ box-shadow: 0px 0px 5px #666666;
1311
+ }
admin/css/jquery-ui.min.css ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ /*! jQuery UI - v1.12.1 - 2016-09-14
2
+ * http://jqueryui.com
3
+ * Includes: core.css, accordion.css, autocomplete.css, menu.css, button.css, controlgroup.css, checkboxradio.css, datepicker.css, dialog.css, draggable.css, resizable.css, progressbar.css, selectable.css, selectmenu.css, slider.css, sortable.css, spinner.css, tabs.css, tooltip.css, theme.css
4
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Arial%2CHelvetica%2Csans-serif&fsDefault=1em&fwDefault=normal&cornerRadius=3px&bgColorHeader=e9e9e9&bgTextureHeader=flat&borderColorHeader=dddddd&fcHeader=333333&iconColorHeader=444444&bgColorContent=ffffff&bgTextureContent=flat&borderColorContent=dddddd&fcContent=333333&iconColorContent=444444&bgColorDefault=f6f6f6&bgTextureDefault=flat&borderColorDefault=c5c5c5&fcDefault=454545&iconColorDefault=777777&bgColorHover=ededed&bgTextureHover=flat&borderColorHover=cccccc&fcHover=2b2b2b&iconColorHover=555555&bgColorActive=007fff&bgTextureActive=flat&borderColorActive=003eff&fcActive=ffffff&iconColorActive=ffffff&bgColorHighlight=fffa90&bgTextureHighlight=flat&borderColorHighlight=dad55e&fcHighlight=777620&iconColorHighlight=777620&bgColorError=fddfdf&bgTextureError=flat&borderColorError=f1a899&fcError=5f3f3f&iconColorError=cc0000&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=666666&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=5px&offsetTopShadow=0px&offsetLeftShadow=0px&cornerRadiusShadow=8px
5
+ * Copyright jQuery Foundation and other contributors; Licensed MIT */
6
+
7
+ .ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important;pointer-events:none}.ui-icon{display:inline-block;vertical-align:middle;margin-top:-.25em;position:relative;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-icon-block{left:50%;margin-left:-8px;display:block}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-accordion .ui-accordion-header{display:block;cursor:pointer;position:relative;margin:2px 0 0 0;padding:.5em .5em .5em .7em;font-size:100%}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;overflow:auto}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:0}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{margin:0;cursor:pointer;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-item-wrapper{position:relative;padding:3px 1em 3px .4em}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item-wrapper{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0}.ui-button{padding:.4em 1em;display:inline-block;position:relative;line-height:normal;margin-right:.1em;cursor:pointer;vertical-align:middle;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:visible}.ui-button,.ui-button:link,.ui-button:visited,.ui-button:hover,.ui-button:active{text-decoration:none}.ui-button-icon-only{width:2em;box-sizing:border-box;text-indent:-9999px;white-space:nowrap}input.ui-button.ui-button-icon-only{text-indent:0}.ui-button-icon-only .ui-icon{position:absolute;top:50%;left:50%;margin-top:-8px;margin-left:-8px}.ui-button.ui-icon-notext .ui-icon{padding:0;width:2.1em;height:2.1em;text-indent:-9999px;white-space:nowrap}input.ui-button.ui-icon-notext .ui-icon{width:auto;height:auto;text-indent:0;white-space:normal;padding:.4em 1em}input.ui-button::-moz-focus-inner,button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-controlgroup{vertical-align:middle;display:inline-block}.ui-controlgroup > .ui-controlgroup-item{float:left;margin-left:0;margin-right:0}.ui-controlgroup > .ui-controlgroup-item:focus,.ui-controlgroup > .ui-controlgroup-item.ui-visual-focus{z-index:9999}.ui-controlgroup-vertical > .ui-controlgroup-item{display:block;float:none;width:100%;margin-top:0;margin-bottom:0;text-align:left}.ui-controlgroup-vertical .ui-controlgroup-item{box-sizing:border-box}.ui-controlgroup .ui-controlgroup-label{padding:.4em 1em}.ui-controlgroup .ui-controlgroup-label span{font-size:80%}.ui-controlgroup-horizontal .ui-controlgroup-label + .ui-controlgroup-item{border-left:none}.ui-controlgroup-vertical .ui-controlgroup-label + .ui-controlgroup-item{border-top:none}.ui-controlgroup-horizontal .ui-controlgroup-label.ui-widget-content{border-right:none}.ui-controlgroup-vertical .ui-controlgroup-label.ui-widget-content{border-bottom:none}.ui-controlgroup-vertical .ui-spinner-input{width:75%;width:calc( 100% - 2.4em )}.ui-controlgroup-vertical .ui-spinner .ui-spinner-up{border-top-style:solid}.ui-checkboxradio-label .ui-icon-background{box-shadow:inset 1px 1px 1px #ccc;border-radius:.12em;border:none}.ui-checkboxradio-radio-label .ui-icon-background{width:16px;height:16px;border-radius:1em;overflow:visible;border:none}.ui-checkboxradio-radio-label.ui-checkboxradio-checked .ui-icon,.ui-checkboxradio-radio-label.ui-checkboxradio-checked:hover .ui-icon{background-image:none;width:8px;height:8px;border-width:4px;border-style:solid}.ui-checkboxradio-disabled{pointer-events:none}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:45%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-datepicker .ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat;left:.5em;top:.3em}.ui-dialog{position:absolute;top:0;left:0;padding:.2em;outline:0}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 0;white-space:nowrap;width:90%;overflow:hidden;text-overflow:ellipsis}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:20px;margin:-10px 0 0 0;padding:1px;height:20px}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:none;overflow:auto}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin-top:.5em;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-n{height:2px;top:0}.ui-dialog .ui-resizable-e{width:2px;right:0}.ui-dialog .ui-resizable-s{height:2px;bottom:0}.ui-dialog .ui-resizable-w{width:2px;left:0}.ui-dialog .ui-resizable-se,.ui-dialog .ui-resizable-sw,.ui-dialog .ui-resizable-ne,.ui-dialog .ui-resizable-nw{width:7px;height:7px}.ui-dialog .ui-resizable-se{right:0;bottom:0}.ui-dialog .ui-resizable-sw{left:0;bottom:0}.ui-dialog .ui-resizable-ne{right:0;top:0}.ui-dialog .ui-resizable-nw{left:0;top:0}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-draggable-handle{-ms-touch-action:none;touch-action:none}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:0.1px;display:block;-ms-touch-action:none;touch-action:none}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-progressbar{height:2em;text-align:left;overflow:hidden}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%}.ui-progressbar .ui-progressbar-overlay{background:url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw==");height:100%;filter:alpha(opacity=25);opacity:0.25}.ui-progressbar-indeterminate .ui-progressbar-value{background-image:none}.ui-selectable{-ms-touch-action:none;touch-action:none}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black}.ui-selectmenu-menu{padding:0;margin:0;position:absolute;top:0;left:0;display:none}.ui-selectmenu-menu .ui-menu{overflow:auto;overflow-x:hidden;padding-bottom:1px}.ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup{font-size:1em;font-weight:bold;line-height:1.5;padding:2px 0.4em;margin:0.5em 0 0 0;height:auto;border:0}.ui-selectmenu-open{display:block}.ui-selectmenu-text{display:block;margin-right:20px;overflow:hidden;text-overflow:ellipsis}.ui-selectmenu-button.ui-button{text-align:left;white-space:nowrap;width:14em}.ui-selectmenu-icon.ui-icon{float:right;margin-top:0}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default;-ms-touch-action:none;touch-action:none}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider.ui-state-disabled .ui-slider-handle,.ui-slider.ui-state-disabled .ui-slider-range{filter:inherit}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-sortable-handle{-ms-touch-action:none;touch-action:none}.ui-spinner{position:relative;display:inline-block;overflow:hidden;padding:0;vertical-align:middle}.ui-spinner-input{border:none;background:none;color:inherit;padding:.222em 0;margin:.2em 0;vertical-align:middle;margin-left:.4em;margin-right:2em}.ui-spinner-button{width:1.6em;height:50%;font-size:.5em;padding:0;margin:0;text-align:center;position:absolute;cursor:default;display:block;overflow:hidden;right:0}.ui-spinner a.ui-spinner-button{border-top-style:none;border-bottom-style:none;border-right-style:none}.ui-spinner-up{top:0}.ui-spinner-down{bottom:0}.ui-tabs{position:relative;padding:.2em}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:0;margin:1px .2em 0 0;border-bottom-width:0;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav .ui-tabs-anchor{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-active{margin-bottom:-1px;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor{cursor:text}.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:none}.ui-tooltip{padding:8px;position:absolute;z-index:9999;max-width:300px}body .ui-tooltip{border-width:2px}.ui-widget{font-family:Arial,Helvetica,sans-serif;font-size:1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Arial,Helvetica,sans-serif;font-size:1em}.ui-widget.ui-widget-content{border:1px solid #c5c5c5}.ui-widget-content{border:1px solid #ddd;background:#fff;color:#333}.ui-widget-content a{color:#333}.ui-widget-header{border:1px solid #ddd;background:#e9e9e9;color:#333;font-weight:bold}.ui-widget-header a{color:#333}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default,.ui-button,html .ui-button.ui-state-disabled:hover,html .ui-button.ui-state-disabled:active{border:1px solid #c5c5c5;background:#f6f6f6;font-weight:normal;color:#454545}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited,a.ui-button,a:link.ui-button,a:visited.ui-button,.ui-button{color:#454545;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus,.ui-button:hover,.ui-button:focus{border:1px solid #ccc;background:#ededed;font-weight:normal;color:#2b2b2b}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited,a.ui-button:hover,a.ui-button:focus{color:#2b2b2b;text-decoration:none}.ui-visual-focus{box-shadow:0 0 3px 1px rgb(94,158,214)}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active,a.ui-button:active,.ui-button:active,.ui-button.ui-state-active:hover{border:1px solid #003eff;background:#007fff;font-weight:normal;color:#fff}.ui-icon-background,.ui-state-active .ui-icon-background{border:#003eff;background-color:#fff}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#fff;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #dad55e;background:#fffa90;color:#777620}.ui-state-checked{border:1px solid #dad55e;background:#fffa90}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#777620}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #f1a899;background:#fddfdf;color:#5f3f3f}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#5f3f3f}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#5f3f3f}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url("images/ui-icons_444444_256x240.png")}.ui-widget-header .ui-icon{background-image:url("images/ui-icons_444444_256x240.png")}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon,.ui-button:hover .ui-icon,.ui-button:focus .ui-icon{background-image:url("images/ui-icons_555555_256x240.png")}.ui-state-active .ui-icon,.ui-button:active .ui-icon{background-image:url("images/ui-icons_ffffff_256x240.png")}.ui-state-highlight .ui-icon,.ui-button .ui-state-highlight.ui-icon{background-image:url("images/ui-icons_777620_256x240.png")}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url("images/ui-icons_cc0000_256x240.png")}.ui-button .ui-icon{background-image:url("images/ui-icons_777777_256x240.png")}.ui-icon-blank{background-position:16px 16px}.ui-icon-caret-1-n{background-position:0 0}.ui-icon-caret-1-ne{background-position:-16px 0}.ui-icon-caret-1-e{background-position:-32px 0}.ui-icon-caret-1-se{background-position:-48px 0}.ui-icon-caret-1-s{background-position:-65px 0}.ui-icon-caret-1-sw{background-position:-80px 0}.ui-icon-caret-1-w{background-position:-96px 0}.ui-icon-caret-1-nw{background-position:-112px 0}.ui-icon-caret-2-n-s{background-position:-128px 0}.ui-icon-caret-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-65px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-65px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:1px -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:3px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:3px}.ui-widget-overlay{background:#aaa;opacity:.3;filter:Alpha(Opacity=30)}.ui-widget-shadow{-webkit-box-shadow:0 0 5px #666;box-shadow:0 0 5px #666}
admin/css/select2.css ADDED
@@ -0,0 +1,484 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .select2-container {
2
+ box-sizing: border-box;
3
+ display: inline-block;
4
+ margin: 0;
5
+ position: relative;
6
+ vertical-align: middle; }
7
+ .select2-container .select2-selection--single {
8
+ box-sizing: border-box;
9
+ cursor: pointer;
10
+ display: block;
11
+ height: 28px;
12
+ user-select: none;
13
+ -webkit-user-select: none; }
14
+ .select2-container .select2-selection--single .select2-selection__rendered {
15
+ display: block;
16
+ padding-left: 8px;
17
+ padding-right: 20px;
18
+ overflow: hidden;
19
+ text-overflow: ellipsis;
20
+ white-space: nowrap; }
21
+ .select2-container .select2-selection--single .select2-selection__clear {
22
+ position: relative; }
23
+ .select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
24
+ padding-right: 8px;
25
+ padding-left: 20px; }
26
+ .select2-container .select2-selection--multiple {
27
+ box-sizing: border-box;
28
+ cursor: pointer;
29
+ display: block;
30
+ min-height: 32px;
31
+ user-select: none;
32
+ -webkit-user-select: none; }
33
+ .select2-container .select2-selection--multiple .select2-selection__rendered {
34
+ display: inline-block;
35
+ overflow: hidden;
36
+ padding-left: 8px;
37
+ text-overflow: ellipsis;
38
+ white-space: nowrap; }
39
+ .select2-container .select2-search--inline {
40
+ float: left; }
41
+ .select2-container .select2-search--inline .select2-search__field {
42
+ box-sizing: border-box;
43
+ border: none;
44
+ font-size: 100%;
45
+ margin-top: 5px;
46
+ padding: 0; }
47
+ .select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button {
48
+ -webkit-appearance: none; }
49
+
50
+ .select2-dropdown {
51
+ background-color: white;
52
+ border: 1px solid #aaa;
53
+ border-radius: 4px;
54
+ box-sizing: border-box;
55
+ display: block;
56
+ position: absolute;
57
+ left: -100000px;
58
+ width: 100%;
59
+ z-index: 1051; }
60
+
61
+ .select2-results {
62
+ display: block; }
63
+
64
+ .select2-results__options {
65
+ list-style: none;
66
+ margin: 0;
67
+ padding: 0; }
68
+
69
+ .select2-results__option {
70
+ padding: 6px;
71
+ user-select: none;
72
+ -webkit-user-select: none; }
73
+ .select2-results__option[aria-selected] {
74
+ cursor: pointer; }
75
+
76
+ .select2-container--open .select2-dropdown {
77
+ left: 0; }
78
+
79
+ .select2-container--open .select2-dropdown--above {
80
+ border-bottom: none;
81
+ border-bottom-left-radius: 0;
82
+ border-bottom-right-radius: 0; }
83
+
84
+ .select2-container--open .select2-dropdown--below {
85
+ border-top: none;
86
+ border-top-left-radius: 0;
87
+ border-top-right-radius: 0; }
88
+
89
+ .select2-search--dropdown {
90
+ display: block;
91
+ padding: 4px; }
92
+ .select2-search--dropdown .select2-search__field {
93
+ padding: 4px;
94
+ width: 100%;
95
+ box-sizing: border-box; }
96
+ .select2-search--dropdown .select2-search__field::-webkit-search-cancel-button {
97
+ -webkit-appearance: none; }
98
+ .select2-search--dropdown.select2-search--hide {
99
+ display: none; }
100
+
101
+ .select2-close-mask {
102
+ border: 0;
103
+ margin: 0;
104
+ padding: 0;
105
+ display: block;
106
+ position: fixed;
107
+ left: 0;
108
+ top: 0;
109
+ min-height: 100%;
110
+ min-width: 100%;
111
+ height: auto;
112
+ width: auto;
113
+ opacity: 0;
114
+ z-index: 99;
115
+ background-color: #fff;
116
+ filter: alpha(opacity=0); }
117
+
118
+ .select2-hidden-accessible {
119
+ border: 0 !important;
120
+ clip: rect(0 0 0 0) !important;
121
+ height: 1px !important;
122
+ margin: -1px !important;
123
+ overflow: hidden !important;
124
+ padding: 0 !important;
125
+ position: absolute !important;
126
+ width: 1px !important; }
127
+
128
+ .select2-container--default .select2-selection--single {
129
+ background-color: #fff;
130
+ border: 1px solid #aaa;
131
+ border-radius: 4px; }
132
+ .select2-container--default .select2-selection--single .select2-selection__rendered {
133
+ color: #444;
134
+ line-height: 28px; }
135
+ .select2-container--default .select2-selection--single .select2-selection__clear {
136
+ cursor: pointer;
137
+ float: right;
138
+ font-weight: bold; }
139
+ .select2-container--default .select2-selection--single .select2-selection__placeholder {
140
+ color: #999; }
141
+ .select2-container--default .select2-selection--single .select2-selection__arrow {
142
+ height: 26px;
143
+ position: absolute;
144
+ top: 1px;
145
+ right: 1px;
146
+ width: 20px; }
147
+ .select2-container--default .select2-selection--single .select2-selection__arrow b {
148
+ border-color: #888 transparent transparent transparent;
149
+ border-style: solid;
150
+ border-width: 5px 4px 0 4px;
151
+ height: 0;
152
+ left: 50%;
153
+ margin-left: -4px;
154
+ margin-top: -2px;
155
+ position: absolute;
156
+ top: 50%;
157
+ width: 0; }
158
+
159
+ .select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear {
160
+ float: left; }
161
+
162
+ .select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow {
163
+ left: 1px;
164
+ right: auto; }
165
+
166
+ .select2-container--default.select2-container--disabled .select2-selection--single {
167
+ background-color: #eee;
168
+ cursor: default; }
169
+ .select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear {
170
+ display: none; }
171
+
172
+ .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
173
+ border-color: transparent transparent #888 transparent;
174
+ border-width: 0 4px 5px 4px; }
175
+
176
+ .select2-container--default .select2-selection--multiple {
177
+ background-color: white;
178
+ border: 1px solid #aaa;
179
+ border-radius: 4px;
180
+ cursor: text; }
181
+ .select2-container--default .select2-selection--multiple .select2-selection__rendered {
182
+ box-sizing: border-box;
183
+ list-style: none;
184
+ margin: 0;
185
+ padding: 0 5px;
186
+ width: 100%; }
187
+ .select2-container--default .select2-selection--multiple .select2-selection__rendered li {
188
+ list-style: none; }
189
+ .select2-container--default .select2-selection--multiple .select2-selection__placeholder {
190
+ color: #999;
191
+ margin-top: 5px;
192
+ float: left; }
193
+ .select2-container--default .select2-selection--multiple .select2-selection__clear {
194
+ cursor: pointer;
195
+ float: right;
196
+ font-weight: bold;
197
+ margin-top: 5px;
198
+ margin-right: 10px; }
199
+ .select2-container--default .select2-selection--multiple .select2-selection__choice {
200
+ background-color: #e4e4e4;
201
+ border: 1px solid #aaa;
202
+ border-radius: 4px;
203
+ cursor: default;
204
+ float: left;
205
+ margin-right: 5px;
206
+ margin-top: 5px;
207
+ padding: 0 5px; }
208
+ .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
209
+ color: #999;
210
+ cursor: pointer;
211
+ display: inline-block;
212
+ font-weight: bold;
213
+ margin-right: 2px; }
214
+ .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
215
+ color: #333; }
216
+
217
+ .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline {
218
+ float: right; }
219
+
220
+ .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
221
+ margin-left: 5px;
222
+ margin-right: auto; }
223
+
224
+ .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
225
+ margin-left: 2px;
226
+ margin-right: auto; }
227
+
228
+ .select2-container--default.select2-container--focus .select2-selection--multiple {
229
+ border: solid black 1px;
230
+ outline: 0; }
231
+
232
+ .select2-container--default.select2-container--disabled .select2-selection--multiple {
233
+ background-color: #eee;
234
+ cursor: default; }
235
+
236
+ .select2-container--default.select2-container--disabled .select2-selection__choice__remove {
237
+ display: none; }
238
+
239
+ .select2-container--default.select2-container--open.select2-container--above .select2-selection--single, .select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple {
240
+ border-top-left-radius: 0;
241
+ border-top-right-radius: 0; }
242
+
243
+ .select2-container--default.select2-container--open.select2-container--below .select2-selection--single, .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
244
+ border-bottom-left-radius: 0;
245
+ border-bottom-right-radius: 0; }
246
+
247
+ .select2-container--default .select2-search--dropdown .select2-search__field {
248
+ border: 1px solid #aaa; }
249
+
250
+ .select2-container--default .select2-search--inline .select2-search__field {
251
+ background: transparent;
252
+ border: none;
253
+ outline: 0;
254
+ box-shadow: none;
255
+ -webkit-appearance: textfield; }
256
+
257
+ .select2-container--default .select2-results > .select2-results__options {
258
+ max-height: 200px;
259
+ overflow-y: auto; }
260
+
261
+ .select2-container--default .select2-results__option[role=group] {
262
+ padding: 0; }
263
+
264
+ .select2-container--default .select2-results__option[aria-disabled=true] {
265
+ color: #999; }
266
+
267
+ .select2-container--default .select2-results__option[aria-selected=true] {
268
+ background-color: #ddd; }
269
+
270
+ .select2-container--default .select2-results__option .select2-results__option {
271
+ padding-left: 1em; }
272
+ .select2-container--default .select2-results__option .select2-results__option .select2-results__group {
273
+ padding-left: 0; }
274
+ .select2-container--default .select2-results__option .select2-results__option .select2-results__option {
275
+ margin-left: -1em;
276
+ padding-left: 2em; }
277
+ .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
278
+ margin-left: -2em;
279
+ padding-left: 3em; }
280
+ .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
281
+ margin-left: -3em;
282
+ padding-left: 4em; }
283
+ .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
284
+ margin-left: -4em;
285
+ padding-left: 5em; }
286
+ .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
287
+ margin-left: -5em;
288
+ padding-left: 6em; }
289
+
290
+ .select2-container--default .select2-results__option--highlighted[aria-selected] {
291
+ background-color: #5897fb;
292
+ color: white; }
293
+
294
+ .select2-container--default .select2-results__group {
295
+ cursor: default;
296
+ display: block;
297
+ padding: 6px; }
298
+
299
+ .select2-container--classic .select2-selection--single {
300
+ background-color: #f7f7f7;
301
+ border: 1px solid #aaa;
302
+ border-radius: 4px;
303
+ outline: 0;
304
+ background-image: -webkit-linear-gradient(top, white 50%, #eeeeee 100%);
305
+ background-image: -o-linear-gradient(top, white 50%, #eeeeee 100%);
306
+ background-image: linear-gradient(to bottom, white 50%, #eeeeee 100%);
307
+ background-repeat: repeat-x;
308
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
309
+ .select2-container--classic .select2-selection--single:focus {
310
+ border: 1px solid #5897fb; }
311
+ .select2-container--classic .select2-selection--single .select2-selection__rendered {
312
+ color: #444;
313
+ line-height: 28px; }
314
+ .select2-container--classic .select2-selection--single .select2-selection__clear {
315
+ cursor: pointer;
316
+ float: right;
317
+ font-weight: bold;
318
+ margin-right: 10px; }
319
+ .select2-container--classic .select2-selection--single .select2-selection__placeholder {
320
+ color: #999; }
321
+ .select2-container--classic .select2-selection--single .select2-selection__arrow {
322
+ background-color: #ddd;
323
+ border: none;
324
+ border-left: 1px solid #aaa;
325
+ border-top-right-radius: 4px;
326
+ border-bottom-right-radius: 4px;
327
+ height: 26px;
328
+ position: absolute;
329
+ top: 1px;
330
+ right: 1px;
331
+ width: 20px;
332
+ background-image: -webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
333
+ background-image: -o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
334
+ background-image: linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);
335
+ background-repeat: repeat-x;
336
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0); }
337
+ .select2-container--classic .select2-selection--single .select2-selection__arrow b {
338
+ border-color: #888 transparent transparent transparent;
339
+ border-style: solid;
340
+ border-width: 5px 4px 0 4px;
341
+ height: 0;
342
+ left: 50%;
343
+ margin-left: -4px;
344
+ margin-top: -2px;
345
+ position: absolute;
346
+ top: 50%;
347
+ width: 0; }
348
+
349
+ .select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear {
350
+ float: left; }
351
+
352
+ .select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow {
353
+ border: none;
354
+ border-right: 1px solid #aaa;
355
+ border-radius: 0;
356
+ border-top-left-radius: 4px;
357
+ border-bottom-left-radius: 4px;
358
+ left: 1px;
359
+ right: auto; }
360
+
361
+ .select2-container--classic.select2-container--open .select2-selection--single {
362
+ border: 1px solid #5897fb; }
363
+ .select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow {
364
+ background: transparent;
365
+ border: none; }
366
+ .select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b {
367
+ border-color: transparent transparent #888 transparent;
368
+ border-width: 0 4px 5px 4px; }
369
+
370
+ .select2-container--classic.select2-container--open.select2-container--above .select2-selection--single {
371
+ border-top: none;
372
+ border-top-left-radius: 0;
373
+ border-top-right-radius: 0;
374
+ background-image: -webkit-linear-gradient(top, white 0%, #eeeeee 50%);
375
+ background-image: -o-linear-gradient(top, white 0%, #eeeeee 50%);
376
+ background-image: linear-gradient(to bottom, white 0%, #eeeeee 50%);
377
+ background-repeat: repeat-x;
378
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
379
+
380
+ .select2-container--classic.select2-container--open.select2-container--below .select2-selection--single {
381
+ border-bottom: none;
382
+ border-bottom-left-radius: 0;
383
+ border-bottom-right-radius: 0;
384
+ background-image: -webkit-linear-gradient(top, #eeeeee 50%, white 100%);
385
+ background-image: -o-linear-gradient(top, #eeeeee 50%, white 100%);
386
+ background-image: linear-gradient(to bottom, #eeeeee 50%, white 100%);
387
+ background-repeat: repeat-x;
388
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0); }
389
+
390
+ .select2-container--classic .select2-selection--multiple {
391
+ background-color: white;
392
+ border: 1px solid #aaa;
393
+ border-radius: 4px;
394
+ cursor: text;
395
+ outline: 0; }
396
+ .select2-container--classic .select2-selection--multiple:focus {
397
+ border: 1px solid #5897fb; }
398
+ .select2-container--classic .select2-selection--multiple .select2-selection__rendered {
399
+ list-style: none;
400
+ margin: 0;
401
+ padding: 0 5px; }
402
+ .select2-container--classic .select2-selection--multiple .select2-selection__clear {
403
+ display: none; }
404
+ .select2-container--classic .select2-selection--multiple .select2-selection__choice {
405
+ background-color: #e4e4e4;
406
+ border: 1px solid #aaa;
407
+ border-radius: 4px;
408
+ cursor: default;
409
+ float: left;
410
+ margin-right: 5px;
411
+ margin-top: 5px;
412
+ padding: 0 5px; }
413
+ .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove {
414
+ color: #888;
415
+ cursor: pointer;
416
+ display: inline-block;
417
+ font-weight: bold;
418
+ margin-right: 2px; }
419
+ .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover {
420
+ color: #555; }
421
+
422
+ .select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
423
+ float: right; }
424
+
425
+ .select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
426
+ margin-left: 5px;
427
+ margin-right: auto; }
428
+
429
+ .select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
430
+ margin-left: 2px;
431
+ margin-right: auto; }
432
+
433
+ .select2-container--classic.select2-container--open .select2-selection--multiple {
434
+ border: 1px solid #5897fb; }
435
+
436
+ .select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple {
437
+ border-top: none;
438
+ border-top-left-radius: 0;
439
+ border-top-right-radius: 0; }
440
+
441
+ .select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple {
442
+ border-bottom: none;
443
+ border-bottom-left-radius: 0;
444
+ border-bottom-right-radius: 0; }
445
+
446
+ .select2-container--classic .select2-search--dropdown .select2-search__field {
447
+ border: 1px solid #aaa;
448
+ outline: 0; }
449
+
450
+ .select2-container--classic .select2-search--inline .select2-search__field {
451
+ outline: 0;
452
+ box-shadow: none; }
453
+
454
+ .select2-container--classic .select2-dropdown {
455
+ background-color: white;
456
+ border: 1px solid transparent; }
457
+
458
+ .select2-container--classic .select2-dropdown--above {
459
+ border-bottom: none; }
460
+
461
+ .select2-container--classic .select2-dropdown--below {
462
+ border-top: none; }
463
+
464
+ .select2-container--classic .select2-results > .select2-results__options {
465
+ max-height: 200px;
466
+ overflow-y: auto; }
467
+
468
+ .select2-container--classic .select2-results__option[role=group] {
469
+ padding: 0; }
470
+
471
+ .select2-container--classic .select2-results__option[aria-disabled=true] {
472
+ color: grey; }
473
+
474
+ .select2-container--classic .select2-results__option--highlighted[aria-selected] {
475
+ background-color: #3875d7;
476
+ color: white; }
477
+
478
+ .select2-container--classic .select2-results__group {
479
+ cursor: default;
480
+ display: block;
481
+ padding: 6px; }
482
+
483
+ .select2-container--classic.select2-container--open .select2-dropdown {
484
+ border-color: #5897fb; }
admin/css/select2.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
admin/includes/class-wp-members-admin-api.php CHANGED
@@ -1,594 +1,602 @@
1
- <?php
2
- /**
3
- * The WP_Members Admin API Class.
4
- *
5
- * @package WP-Members
6
- * @subpackage WP_Members Admin API Object Class
7
- * @since 3.1.0
8
- */
9
-
10
- // Exit if accessed directly.
11
- if ( ! defined( 'ABSPATH' ) ) {
12
- exit();
13
- }
14
-
15
- class WP_Members_Admin_API {
16
-
17
- /**
18
- * Container for tabs.
19
- *
20
- * @since 3.1.0
21
- * @access public
22
- * @var array
23
- */
24
- public $tabs = array();
25
-
26
- /**
27
- * Container for emails.
28
- *
29
- * @since 3.1.0
30
- * @access public
31
- * @var array
32
- */
33
- public $emails = array();
34
-
35
- /**
36
- * Container for dialogs.
37
- *
38
- * @since 3.1.1
39
- * @access public
40
- * @var array
41
- */
42
- public $dialogs = array();
43
-
44
- /**
45
- * Plugin initialization function.
46
- *
47
- * @since 3.1.0
48
- */
49
- function __construct() {
50
-
51
- // Load dependencies.
52
- $this->load_dependencies();
53
-
54
- // Load admin hooks.
55
- $this->load_hooks();
56
-
57
- // Load default tabs.
58
- $tabs = $this->default_tabs();
59
-
60
- // Load default emails.
61
- $emails = $this->default_emails();
62
-
63
- // Load default dialogs.
64
- $dialogs = $this->default_dialogs();
65
-
66
- global $wpmem;
67
- $wpmem->membership->admin = new WP_Members_Products_Admin();
68
- }
69
-
70
- /**
71
- * Load dependencies.
72
- *
73
- * @since 3.1.0
74
- * @since 3.1.1 Added tab-about.php.
75
- * @since 3.1.7 Loads all admin dependent files.
76
- */
77
- function load_dependencies() {
78
-
79
- include_once( WPMEM_PATH . 'admin/admin.php' );
80
- include_once( WPMEM_PATH . 'admin/users.php' );
81
- include_once( WPMEM_PATH . 'admin/includes/class-wp-members-user-search.php' );
82
- include_once( WPMEM_PATH . 'admin/includes/class-wp-members-products-admin.php' );
83
- include_once( WPMEM_PATH . 'admin/dialogs.php' );
84
- include_once( WPMEM_PATH . 'admin/post.php' );
85
- include_once( WPMEM_PATH . 'admin/includes/api.php' );
86
- include_once( WPMEM_PATH . 'admin/tab-fields.php' ); // Fields tab is used for field reorder (which is ! wpmem-settings).
87
- if ( 'wpmem-settings' == wpmem_get( 'page', false, 'get' ) ) {
88
- include_once( WPMEM_PATH . 'admin/tab-options.php' );
89
- include_once( WPMEM_PATH . 'admin/tab-emails.php' );
90
- include_once( WPMEM_PATH . 'admin/tab-captcha.php' );
91
- include_once( WPMEM_PATH . 'admin/tab-about.php' );
92
- include_once( WPMEM_PATH . 'admin/tab-dialogs.php' );
93
- include_once( WPMEM_PATH . 'admin/tab-dropins.php' );
94
- }
95
- }
96
-
97
- /**
98
- * Load admin.
99
- *
100
- * @since 3.1.0
101
- * @since 3.1.7 Loads all admin hooks.
102
- *
103
- * @global object $wpmem
104
- */
105
- function load_hooks() {
106
-
107
- global $wpmem;
108
-
109
- add_action( 'admin_enqueue_scripts', array( $this, 'dashboard_enqueue_scripts' ) );
110
- add_action( 'wp_ajax_wpmem_a_field_reorder', 'wpmem_a_do_field_reorder' );
111
- add_action( 'user_new_form', 'wpmem_admin_add_new_user' );
112
- add_filter( 'plugin_action_links', array( $this, 'plugin_links' ), 10, 2 );
113
- add_filter( 'wpmem_admin_tabs', 'wpmem_add_about_tab' );
114
-
115
- add_action( 'wpmem_admin_do_tab', 'wpmem_a_options_tab', 1 );
116
- add_action( 'wpmem_admin_do_tab', 'wpmem_a_dialogs_tab', 10 );
117
- add_action( 'wpmem_admin_do_tab', 'wpmem_a_emails_tab', 15 );
118
- add_action( 'wpmem_admin_do_tab', 'wpmem_a_about_tab', 999, 1 );
119
-
120
- // If user has a role that cannot edit users, set profile actions for non-admins.
121
-
122
- // User actions and filters.
123
- add_action( 'user_edit_form_tag', array( 'WP_Members_User_Profile', 'add_multipart' ) );
124
- add_action( 'show_user_profile', array( 'WP_Members_User_Profile', 'profile' ) );
125
- add_action( 'edit_user_profile', array( 'WP_Members_User_Profile', 'profile' ) );
126
- add_action( 'profile_update', array( 'WP_Members_User_Profile', 'update' ) );
127
- add_action( 'edit_user_profile', array( 'WP_Members_User_Profile', '_profile_tabs' ), 99 );
128
-
129
- if ( current_user_can( 'list_users' ) ) {
130
- add_action( 'admin_footer-users.php', 'wpmem_bulk_user_action' );
131
- add_action( 'load-users.php', 'wpmem_users_page_load' );
132
- add_action( 'admin_notices', 'wpmem_users_admin_notices' );
133
- add_filter( 'views_users', 'wpmem_users_views' );
134
- add_filter( 'manage_users_columns', 'wpmem_add_user_column' );
135
- add_filter( 'manage_users_custom_column', 'wpmem_add_user_column_content', 10, 3 );
136
- add_action( 'wpmem_post_register_data', 'wpmem_set_new_user_non_active' );
137
- add_action( 'wpmem_user_activated', 'wpmem_set_activated_user' );
138
- add_action( 'wpmem_user_deactivated', 'wpmem_set_deactivated_user' );
139
- add_filter( 'user_row_actions', 'wpmem_insert_activate_link', 10, 2 );
140
- add_action( 'wpmem_admin_after_profile', array( 'WP_Members_User_Profile', '_show_activate' ), 7 );
141
- add_action( 'wpmem_admin_after_profile', array( 'WP_Members_User_Profile', '_show_expiration' ), 8 );
142
- add_action( 'wpmem_admin_after_profile', array( 'WP_Members_User_Profile', '_show_ip' ), 9 );
143
- if ( 1 == $wpmem->enable_products ) {
144
- add_action( 'wpmem_admin_after_profile', array( 'WP_Members_User_Profile', '_show_product' ), 10 );
145
- }
146
- }
147
-
148
- // If user has a role that can edit posts, add the block/unblock meta boxes and custom post/page columns.
149
- if ( current_user_can( 'edit_posts' ) ) {
150
- // Post actions and filters.
151
- add_action( 'add_meta_boxes', 'wpmem_block_meta_add' );
152
- add_action( 'save_post', 'wpmem_block_meta_save' );
153
- add_filter( 'manage_posts_columns', 'wpmem_post_columns' );
154
- add_action( 'manage_posts_custom_column', 'wpmem_post_columns_content', 10, 2 );
155
- add_filter( 'manage_pages_columns', 'wpmem_post_columns' );
156
- add_action( 'manage_pages_custom_column', 'wpmem_post_columns_content', 10, 2 );
157
- add_action( 'admin_footer-edit.php', 'wpmem_bulk_posts_action' );
158
- add_action( 'load-edit.php', 'wpmem_posts_page_load' );
159
- add_action( 'admin_notices', 'wpmem_posts_admin_notices' );
160
- add_action( 'load-post.php', 'wpmem_load_tinymce' );
161
- add_action( 'load-post-new.php', 'wpmem_load_tinymce' );
162
- }
163
-
164
- if ( ! is_multisite() && current_user_can( 'manage_options' ) ) {
165
- add_action('wp_dashboard_setup', 'butlerblog_dashboard_widget');
166
- }
167
-
168
- } // End of load_hooks()
169
-
170
- /**
171
- * Display admin tabs.
172
- *
173
- * @since 3.1.0
174
- *
175
- * @param string $current The current tab being displayed (default: options).
176
- */
177
- function do_tabs( $current = 'options' ) {
178
-
179
- /**
180
- * Filter the admin tabs for the plugin settings page.
181
- *
182
- * @since 2.8.0
183
- *
184
- * @param array $tabs An array of the tabs to be displayed on the plugin settings page.
185
- */
186
- $this->tabs = apply_filters( 'wpmem_admin_tabs', $this->tabs );
187
-
188
- $links = array();
189
- foreach ( $this->tabs as $tab => $name ) {
190
- $link_args = array( 'page' => 'wpmem-settings', 'tab' => $tab );
191
- $link = add_query_arg( $link_args, admin_url( 'options-general.php' ) );
192
- $class = ( $tab == $current ) ? 'nav-tab nav-tab-active' : 'nav-tab';
193
- $links[] = sprintf( '<a class="%s" href="%s">%s</a>', $class, $link, $name );
194
- }
195
-
196
- echo '<h2 class="nav-tab-wrapper">';
197
- foreach ( $links as $link ) {
198
- echo $link;
199
- }
200
- echo '</h2>';
201
- }
202
-
203
- /**
204
- * Adds custom email dialog to the Emails tab.
205
- *
206
- * @since 3.1.0
207
- *
208
- * @param array $args Settings array for the email.
209
- */
210
- function do_email_input( $args ) { ?>
211
- <tr valign="top"><td colspan="2"><strong><?php echo esc_html( $args['heading'] ); ?></strong></td></tr>
212
- <tr valign="top">
213
- <th scope="row"><?php echo esc_html( $args['subject_label'] ); ?></th>
214
- <td><input type="text" name="<?php echo esc_attr( $args['subject_input'] ); ?>" size="80" value="<?php echo esc_attr( wp_unslash( $args['subject_value'] ) ); ?>"></td>
215
- </tr>
216
- <tr valign="top">
217
- <th scope="row"><?php echo esc_html( $args['body_label'] ); ?></th>
218
- <td><textarea name="<?php echo esc_attr( $args['body_input'] ); ?>" rows="12" cols="50" id="" class="large-text code"><?php echo esc_textarea( wp_unslash( $args['body_value'] ) ); ?></textarea></td>
219
- </tr>
220
- <tr><td colspan="2"><hr /></td></tr><?php
221
- }
222
-
223
- /**
224
- * Saves custom email settings.
225
- *
226
- * @since 3.1.0
227
- *
228
- * @param array $args Settings array for the email.
229
- */
230
- function email_update( $args ) {
231
- $settings = array(
232
- 'subj' => sanitize_text_field( wpmem_get( $args['subject_input'] ) ),
233
- 'body' => wp_kses( wpmem_get( $args['body_input'] ), 'post' ),
234
- );
235
- update_option( $args['name'], $settings, true );
236
- $this->emails[ $args['name'] ]['subject_value'] = $settings['subj'];
237
- $this->emails[ $args['name'] ]['body_value'] = $settings['body'];
238
- return;
239
- }
240
-
241
- /**
242
- * Handles custom email settings.
243
- *
244
- * @since 3.1.0
245
- *
246
- * @param array $args Settings array for the email.
247
- * @return array $args
248
- */
249
- function add_email( $args ) {
250
-
251
- // Get saved settings.
252
- $settings = get_option( $args['name'] );
253
-
254
- $defaults = array(
255
- 'name' => $args['name'],
256
- 'heading' => __( 'Custom email', 'wp-members' ),
257
- 'subject_label' => __( 'Subject', 'wp-members' ),
258
- 'subject_input' => $args['name'] . '_subject',
259
- 'subject_value' => ( $settings ) ? $settings['subj'] : __( 'Subject', 'wp-members' ),
260
- 'body_label' => __( 'Body', 'wp-members' ),
261
- 'body_input' => $args['name'] . '_body',
262
- 'body_value' => ( $settings ) ? $settings['body'] : __( 'Your custom email message content.', 'wp-members' ),
263
- );
264
-
265
- // Merge args with settings.
266
- $args = wp_parse_args( $args, $defaults );
267
-
268
- $this->emails[ $args['name'] ] = $args;
269
-
270
- return $args;
271
- }
272
-
273
- /**
274
- * Adds dialogs to the Dialogs tab.
275
- *
276
- * @since 3.1.1
277
- *
278
- * @param array $args Settings array for the dialog.
279
- */
280
- function do_dialog_input( $args ) { ?>
281
- <tr valign="top">
282
- <th scope="row"><?php echo esc_html( $args['label'] ); ?></th>
283
- <td><textarea name="<?php echo esc_attr( $args['name'] . "_dialog" ); ?>" rows="3" cols="50" id="" class="large-text code"><?php echo esc_textarea( wp_unslash( $args['value'] ) ); ?></textarea></td>
284
- </tr><?php
285
- }
286
-
287
- /**
288
- * Saves custom dialog settings.
289
- *
290
- * @since 3.1.1
291
- */
292
- function dialog_update() {
293
- $settings = array();
294
- foreach ( $this->dialogs as $dialog ) {
295
- if ( isset( $_POST[ $dialog['name'] . '_dialog' ] ) ) {
296
- $settings[ $dialog['name'] ] = wp_kses( $_POST[ $dialog['name'] . '_dialog' ], 'post' );
297
- }
298
- }
299
- update_option( 'wpmembers_dialogs', $settings, true );
300
- // Refresh settings
301
- $this->default_dialogs();
302
- return;
303
- }
304
-
305
- /**
306
- * Handles custom dialog settings.
307
- *
308
- * @since 3.1.1
309
- *
310
- * @param array $args Settings array for the dialog.
311
- * @return array $args
312
- */
313
- function add_dialog( $args ) {
314
- global $wpmem;
315
- if ( is_array( $args ) && isset( $args['label'] ) ) {
316
- $defaults = array(
317
- 'name' => $args['name'],
318
- 'label' => $args['label'],
319
- //'input' => $args['name'] . '_dialog',
320
- 'value' => $args['value'],
321
- //'value' => ( $args['value'] ) ? $args['value'] : $wpmem->get_text( $key ),
322
- );
323
-
324
- // Merge args with settings.
325
- $args = wp_parse_args( $args, $defaults );
326
-
327
- $this->dialogs[ $args['name'] ] = $args;
328
- }
329
-
330
- //return $args;
331
- }
332
-
333
- /**
334
- * Settings for default tabs.
335
- *
336
- * @since 3.1.0
337
- */
338
- function default_tabs() {
339
- $this->tabs = array(
340
- 'options' => 'WP-Members ' . __( 'Options', 'wp-members' ),
341
- 'fields' => __( 'Fields', 'wp-members' ),
342
- 'dialogs' => __( 'Dialogs', 'wp-members' ),
343
- 'emails' => __( 'Emails', 'wp-members' ),
344
- );
345
- }
346
-
347
- /**
348
- * Settings for default emails.
349
- *
350
- * @since 3.1.0
351
- */
352
- function default_emails() {
353
- global $wpmem;
354
-
355
- if ( $wpmem->mod_reg == 0 ) {
356
-
357
- $this->add_email( array(
358
- 'name' => 'wpmembers_email_newreg',
359
- 'heading' => __( "New Registration", 'wp-members' ),
360
- 'subject_input' => 'wpmembers_email_newreg_subj',
361
- 'body_input' => 'wpmembers_email_newreg_body',
362
- ) );
363
-
364
- } else {
365
-
366
- $this->add_email( array(
367
- 'name' => 'wpmembers_email_newmod',
368
- 'heading' => __( "Registration is Moderated", 'wp-members' ),
369
- 'subject_input' => 'wpmembers_email_newmod_subj',
370
- 'body_input' => 'wpmembers_email_newmod_body',
371
- ) );
372
- $this->add_email( array(
373
- 'name' => 'wpmembers_email_appmod',
374
- 'heading' => __( "Registration is Moderated, User is Approved", 'wp-members' ),
375
- 'subject_input' => 'wpmembers_email_appmod_subj',
376
- 'body_input' => 'wpmembers_email_appmod_body',
377
- ) );
378
- }
379
-
380
- $this->add_email( array(
381
- 'name' => 'wpmembers_email_repass',
382
- 'heading' => __( "Password Reset", 'wp-members' ),
383
- 'subject_input' => 'wpmembers_email_repass_subj',
384
- 'body_input' => 'wpmembers_email_repass_body',
385
- ) );
386
-
387
- $this->add_email( array(
388
- 'name' => 'wpmembers_email_getuser',
389
- 'heading' => __( "Retrieve Username", 'wp-members' ),
390
- 'subject_input' => 'wpmembers_email_getuser_subj',
391
- 'body_input' => 'wpmembers_email_getuser_body',
392
- ) );
393
-
394
- if ( $wpmem->notify == 1 ) {
395
- $this->add_email( array(
396
- 'name' => 'wpmembers_email_notify',
397
- 'heading' => __( "Admin Notification", 'wp-members' ),
398
- 'subject_input' => 'wpmembers_email_notify_subj',
399
- 'body_input' => 'wpmembers_email_notify_body',
400
- ) );
401
- }
402
-
403
- }
404
-
405
- /**
406
- * Settings for default dialogs.
407
- *
408
- * @since 3.1.1
409
- */
410
- function default_dialogs() {
411
- global $wpmem;
412
-
413
- /**
414
- * Filter the dialog array to add custom dialogs.
415
- *
416
- * @since 3.1.1
417
- *
418
- * @param array $dialog_array
419
- */
420
- $dialogs = apply_filters( 'wpmem_dialogs', get_option( 'wpmembers_dialogs' ) );
421
-
422
- $dialog_labels = array(
423
- 'restricted_msg' => __( "Restricted post (or page), displays above the login/registration form", 'wp-members' ),
424
- 'user' => __( "Username is taken", 'wp-members' ),
425
- 'email' => __( "Email is registered", 'wp-members' ),
426
- 'success' => __( "Registration completed", 'wp-members' ),
427
- 'editsuccess' => __( "User update", 'wp-members' ),
428
- 'pwdchangerr' => __( "Passwords did not match", 'wp-members' ),
429
- 'pwdchangesuccess' => __( "Password changes", 'wp-members' ),
430
- 'pwdreseterr' => __( "Username or email do not exist when trying to reset forgotten password", 'wp-members' ),
431
- 'pwdresetsuccess' => __( "Password reset", 'wp-members' ),
432
- );
433
-
434
- foreach ( $dialogs as $key => $val ) {
435
- if ( array_key_exists( $key, $dialog_labels ) ) {
436
- $dialogs[ $key ] = array(
437
- 'name' => $key,
438
- 'label' => $dialog_labels[ $key ],
439
- 'value' => $dialogs[ $key ],
440
- );
441
- }
442
- }
443
-
444
- foreach ( $dialogs as $val ) {
445
- $this->add_dialog( $val );
446
- }
447
- }
448
-
449
-
450
- /**
451
- * Get the current form.
452
- *
453
- * @since 3.1.2
454
- *
455
- * @todo Work on multi-form project, no current milestone.
456
- */
457
- function get_form( $form = 'default' ) {
458
- /*
459
- $current_form = ( isset( $_GET['form'] ) ) ? $_GET['form'] : $form;
460
- $wpmem_forms = get_option( 'wpmembers_forms' );
461
- $fields = $wpmem_forms[ $current_form ];
462
- $this->current_form = $current_form;
463
- $this->current_form_fields = $fields;
464
- */
465
- $this->current_form = sanitize_text_field( wpmem_get( 'form', $form, 'get' ) ); //( isset( $_GET['form'] ) ) ? $_GET['form'] : $form;
466
- global $wpmem;
467
- // Add numeric array form fields as associative
468
- //foreach( $wpmem->fields as $field ) {
469
- // $wpmem->fields[ $field[2] ] = $field;
470
- //}
471
- $this->current_form_fields = wpmem_fields();
472
- }
473
-
474
- /**
475
- * Build admin panel form action url.
476
- *
477
- * @since 3.1.8
478
- *
479
- * @global string $pagenow
480
- * @global string $plugin_page
481
- * @global object $wpmem The WP_Members Object.
482
- * @param mixed $args Array of additional arguments|boolean. Default: false.
483
- * @return string $url
484
- */
485
- function form_post_url( $args = false ) {
486
- global $pagenow, $plugin_page, $wpmem;
487
- $tab = sanitize_text_field( wpmem_get( 'tab', false, 'get' ) );
488
- $params = array( 'page' => $plugin_page );
489
- if ( $tab ) {
490
- $params['tab'] = $tab;
491
- }
492
- if ( $args ) {
493
- foreach( $args as $key => $val ) {
494
- $params[ $key ] = $val;
495
- }
496
- }
497
- $url = add_query_arg( $params, admin_url( $pagenow ) );
498
- return esc_url( $url );
499
- }
500
-
501
- /**
502
- * Enqueues the admin javascript and css files.
503
- *
504
- * Replaces wpmem_admin_enqueue_scripts().
505
- * Only loads the js and css on admin screens that use them.
506
- *
507
- * @since 3.1.7
508
- * @since 3.2.0 Moved into admin object, renamed dashboard_enqueue_scripts().
509
- * @since 3.2.1 Load js for post.php hook.
510
- *
511
- * @global object $current_screen
512
- * @global object $wpmem
513
- * @param string $hook The admin screen hook being loaded.
514
- */
515
- function dashboard_enqueue_scripts( $hook ) {
516
- global $current_screen, $wpmem;
517
- if ( 'edit.php' == $hook || 'settings_page_wpmem-settings' == $hook || 'post.php' == $hook || 'post-new.php' == $hook || 'user-edit.php' == $hook || 'profile.php' == $hook ) {
518
- wp_enqueue_style( 'wpmem-admin', WPMEM_DIR . 'admin/css/admin.css', '', WPMEM_VERSION );
519
- }
520
- if ( 'settings_page_wpmem-settings' == $hook || 'post.php' == $hook || 'post-new.php' == $hook ) {
521
- wp_enqueue_script( 'wpmem-admin', WPMEM_DIR . 'admin/js/admin.js', '', WPMEM_VERSION );
522
- }
523
- if ( ( 'post.php' == $hook || 'post-new.php' == $hook ) && 1 == $wpmem->enable_products ) {
524
- wp_register_style( 'select2css', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/css/select2.min.css', false, '4.0.5', 'all' );
525
- wp_register_script( 'select2', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/js/select2.min.js', array( 'jquery' ), '4.0.5', true );
526
- wp_enqueue_style( 'select2css' );
527
- wp_enqueue_script( 'select2' );
528
- }
529
- if ( 'user-edit' == $current_screen->id ) {
530
- wp_enqueue_script( 'jquery' );
531
- wp_enqueue_script( 'jquery-ui-core' ); // enqueue jQuery UI Core
532
- wp_enqueue_script( 'jquery-ui-tabs' ); // enqueue jQuery UI Tabs
533
-
534
- wp_register_style( 'jquery-ui', '//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css' );
535
- wp_enqueue_style( 'jquery-ui' );
536
- }
537
- if ( 'settings_page_wpmem-settings' == $hook ) {
538
- wp_enqueue_script( 'jquery' );
539
- wp_enqueue_script( 'jquery-ui-core' );// enqueue jQuery UI Core
540
- wp_enqueue_script( 'jquery-ui-dialog' );
541
-
542
- wp_register_style( 'jquery-ui', '//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css' );
543
- wp_enqueue_style( 'jquery-ui' );
544
-
545
- }
546
- }
547
-
548
- /**
549
- * Filter to add link to settings from plugin panel.
550
- *
551
- * @since 2.4.0
552
- * @since 3.2.0 Moved to admin API class, renamed from wpmem_admin_plugin_links().
553
- *
554
- * @param array $links
555
- * @param string $file
556
- * @return array $links
557
- */
558
- function plugin_links( $links, $file ) {
559
- static $wpmem_plugin;
560
- if ( ! $wpmem_plugin ) {
561
- $wpmem_plugin = plugin_basename( WPMEM_PATH . '/wp-members.php' );
562
- }
563
- if ( $file == $wpmem_plugin ) {
564
- $settings_link = '<a href="' . add_query_arg( 'page', 'wpmem-settings', 'options-general.php' ) . '">' . __( 'Settings', 'wp-members' ) . '</a>';
565
- $links = array_merge( array( $settings_link ), $links );
566
- }
567
- return $links;
568
- }
569
-
570
- /**
571
- * Returns an array of WordPress reserved terms.
572
- *
573
- * @since 3.0.2
574
- * @since 3.2.3 Moved to WP_Members_Admin_API class.
575
- *
576
- * @return array An array of WordPress reserved terms.
577
- */
578
- function wp_reserved_terms() {
579
- $reserved_terms = array( 'attachment', 'attachment_id', 'author', 'author_name', 'calendar', 'cat', 'category', 'category__and', 'category__in', 'category__not_in', 'category_name', 'comments_per_page', 'comments_popup', 'customize_messenger_channel', 'customized', 'cpage', 'day', 'debug', 'error', 'exact', 'feed', 'fields', 'hour', 'link_category', 'm', 'minute', 'monthnum', 'more', 'name', 'nav_menu', 'nonce', 'nopaging', 'offset', 'order', 'orderby', 'p', 'page', 'page_id', 'paged', 'pagename', 'pb', 'perm', 'post', 'post__in', 'post__not_in', 'post_format', 'post_mime_type', 'post_status', 'post_tag', 'post_type', 'posts', 'posts_per_archive_page', 'posts_per_page', 'preview', 'robots', 'role', 's', 'search', 'second', 'sentence', 'showposts', 'static', 'subpost', 'subpost_id', 'tag', 'tag__and', 'tag__in', 'tag__not_in', 'tag_id', 'tag_slug__and', 'tag_slug__in', 'taxonomy', 'tb', 'term', 'theme', 'type', 'w', 'withcomments', 'withoutcomments', 'year' );
580
-
581
- /**
582
- * Filter the array of reserved terms.
583
- *
584
- * @since 3.0.2
585
- *
586
- * @param array $reserved_terms
587
- */
588
- $reserved_terms = apply_filters( 'wpmem_wp_reserved_terms', $reserved_terms );
589
-
590
- return $reserved_terms;
591
- }
592
- } // End of WP_Members_Admin_API class.
593
-
 
 
 
 
 
 
 
 
594
  // End of file.
1
+ <?php
2
+ /**
3
+ * The WP_Members Admin API Class.
4
+ *
5
+ * @package WP-Members
6
+ * @subpackage WP_Members Admin API Object Class
7
+ * @since 3.1.0
8
+ */
9
+
10
+ // Exit if accessed directly.
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit();
13
+ }
14
+
15
+ class WP_Members_Admin_API {
16
+
17
+ /**
18
+ * Container for tabs.
19
+ *
20
+ * @since 3.1.0
21
+ * @access public
22
+ * @var array
23
+ */
24
+ public $tabs = array();
25
+
26
+ /**
27
+ * Container for emails.
28
+ *
29
+ * @since 3.1.0
30
+ * @access public
31
+ * @var array
32
+ */
33
+ public $emails = array();
34
+
35
+ /**
36
+ * Container for dialogs.
37
+ *
38
+ * @since 3.1.1
39
+ * @access public
40
+ * @var array
41
+ */
42
+ public $dialogs = array();
43
+
44
+ /**
45
+ * Plugin initialization function.
46
+ *
47
+ * @since 3.1.0
48
+ */
49
+ function __construct() {
50
+
51
+ // Load dependencies.
52
+ $this->load_dependencies();
53
+
54
+ // Load admin hooks.
55
+ $this->load_hooks();
56
+
57
+ // Load default tabs.
58
+ $tabs = $this->default_tabs();
59
+
60
+ // Load default emails.
61
+ $emails = $this->default_emails();
62
+
63
+ // Load default dialogs.
64
+ $dialogs = $this->default_dialogs();
65
+
66
+ global $wpmem;
67
+ $wpmem->membership->admin = new WP_Members_Products_Admin();
68
+ }
69
+
70
+ /**
71
+ * Load dependencies.
72
+ *
73
+ * @since 3.1.0
74
+ * @since 3.1.1 Added tab-about.php.
75
+ * @since 3.1.7 Loads all admin dependent files.
76
+ * @since 3.2.9 Removed tab-about.php until we can re-do it.
77
+ */
78
+ function load_dependencies() {
79
+
80
+ include_once( WPMEM_PATH . 'admin/admin.php' );
81
+ include_once( WPMEM_PATH . 'admin/users.php' );
82
+ include_once( WPMEM_PATH . 'admin/includes/class-wp-members-user-search.php' );
83
+ include_once( WPMEM_PATH . 'admin/includes/class-wp-members-products-admin.php' );
84
+ include_once( WPMEM_PATH . 'admin/dialogs.php' );
85
+ include_once( WPMEM_PATH . 'admin/post.php' );
86
+ include_once( WPMEM_PATH . 'admin/includes/api.php' );
87
+ include_once( WPMEM_PATH . 'admin/tab-fields.php' ); // Fields tab is used for field reorder (which is ! wpmem-settings).
88
+ if ( 'wpmem-settings' == wpmem_get( 'page', false, 'get' ) ) {
89
+ include_once( WPMEM_PATH . 'admin/tab-options.php' );
90
+ include_once( WPMEM_PATH . 'admin/tab-emails.php' );
91
+ include_once( WPMEM_PATH . 'admin/tab-captcha.php' );
92
+ // include_once( WPMEM_PATH . 'admin/tab-about.php' );
93
+ include_once( WPMEM_PATH . 'admin/tab-dialogs.php' );
94
+ include_once( WPMEM_PATH . 'admin/tab-dropins.php' );
95
+ }
96
+ }
97
+
98
+ /**
99
+ * Load admin.
100
+ *
101
+ * @since 3.1.0
102
+ * @since 3.1.7 Loads all admin hooks.
103
+ *
104
+ * @global object $wpmem
105
+ */
106
+ function load_hooks() {
107
+
108
+ global $wpmem;
109
+
110
+ add_action( 'admin_enqueue_scripts', array( $this, 'dashboard_enqueue_scripts' ) );
111
+ add_action( 'wp_ajax_wpmem_a_field_reorder', 'wpmem_a_do_field_reorder' );
112
+ add_action( 'user_new_form', 'wpmem_admin_add_new_user' );
113
+ add_filter( 'plugin_action_links', array( $this, 'plugin_links' ), 10, 2 );
114
+ // add_filter( 'wpmem_admin_tabs', 'wpmem_add_about_tab' );
115
+
116
+ add_action( 'wpmem_admin_do_tab', 'wpmem_a_options_tab', 1 );
117
+ add_action( 'wpmem_admin_do_tab', 'wpmem_a_dialogs_tab', 10 );
118
+ add_action( 'wpmem_admin_do_tab', 'wpmem_a_emails_tab', 15 );
119
+ // add_action( 'wpmem_admin_do_tab', 'wpmem_a_about_tab', 999, 1 );
120
+
121
+ // If user has a role that cannot edit users, set profile actions for non-admins.
122
+
123
+ // User actions and filters.
124
+ add_action( 'user_edit_form_tag', array( 'WP_Members_User_Profile', 'add_multipart' ) );
125
+ add_action( 'show_user_profile', array( 'WP_Members_User_Profile', 'profile' ) );
126
+ add_action( 'edit_user_profile', array( 'WP_Members_User_Profile', 'profile' ) );
127
+ add_action( 'profile_update', array( 'WP_Members_User_Profile', 'update' ) );
128
+ add_action( 'edit_user_profile', array( 'WP_Members_User_Profile', '_profile_tabs' ), 99 );
129
+
130
+ if ( current_user_can( 'list_users' ) ) {
131
+ add_action( 'admin_footer-users.php', 'wpmem_bulk_user_action' );
132
+ add_action( 'load-users.php', 'wpmem_users_page_load' );
133
+ add_action( 'admin_notices', 'wpmem_users_admin_notices' );
134
+ add_filter( 'views_users', 'wpmem_users_views' );
135
+ add_filter( 'manage_users_columns', 'wpmem_add_user_column' );
136
+ add_filter( 'manage_users_custom_column', 'wpmem_add_user_column_content', 10, 3 );
137
+ add_action( 'wpmem_post_register_data', 'wpmem_set_new_user_non_active' );
138
+ add_action( 'wpmem_user_activated', 'wpmem_set_activated_user' );
139
+ add_action( 'wpmem_user_deactivated', 'wpmem_set_deactivated_user' );
140
+ add_filter( 'user_row_actions', 'wpmem_insert_activate_link', 10, 2 );
141
+ add_action( 'wpmem_admin_after_profile', array( 'WP_Members_User_Profile', '_show_activate' ), 7 );
142
+ add_action( 'wpmem_admin_after_profile', array( 'WP_Members_User_Profile', '_show_expiration' ), 8 );
143
+ add_action( 'wpmem_admin_after_profile', array( 'WP_Members_User_Profile', '_show_ip' ), 9 );
144
+ if ( 1 == $wpmem->enable_products ) {
145
+ add_action( 'wpmem_admin_after_profile', array( 'WP_Members_User_Profile', '_show_product' ), 10 );
146
+ }
147
+ }
148
+
149
+ // If user has a role that can edit posts, add the block/unblock meta boxes and custom post/page columns.
150
+ if ( current_user_can( 'edit_posts' ) ) {
151
+ // Post actions and filters.
152
+ add_action( 'add_meta_boxes', 'wpmem_block_meta_add' );
153
+ add_action( 'save_post', 'wpmem_block_meta_save' );
154
+ add_filter( 'manage_posts_columns', 'wpmem_post_columns' );
155
+ add_action( 'manage_posts_custom_column', 'wpmem_post_columns_content', 10, 2 );
156
+ add_filter( 'manage_pages_columns', 'wpmem_post_columns' );
157
+ add_action( 'manage_pages_custom_column', 'wpmem_post_columns_content', 10, 2 );
158
+ add_action( 'admin_footer-edit.php', 'wpmem_bulk_posts_action' );
159
+ add_action( 'load-edit.php', 'wpmem_posts_page_load' );
160
+ add_action( 'admin_notices', 'wpmem_posts_admin_notices' );
161
+ add_action( 'load-post.php', 'wpmem_load_tinymce' );
162
+ add_action( 'load-post-new.php', 'wpmem_load_tinymce' );
163
+ }
164
+
165
+ if ( ! is_multisite() && current_user_can( 'manage_options' ) ) {
166
+ add_action('wp_dashboard_setup', 'butlerblog_dashboard_widget');
167
+ }
168
+
169
+ } // End of load_hooks()
170
+
171
+ /**
172
+ * Display admin tabs.
173
+ *
174
+ * @since 3.1.0
175
+ *
176
+ * @param string $current The current tab being displayed (default: options).
177
+ */
178
+ function do_tabs( $current = 'options' ) {
179
+
180
+ /**
181
+ * Filter the admin tabs for the plugin settings page.
182
+ *
183
+ * @since 2.8.0
184
+ *
185
+ * @param array $tabs An array of the tabs to be displayed on the plugin settings page.
186
+ */
187
+ $this->tabs = apply_filters( 'wpmem_admin_tabs', $this->tabs );
188
+
189
+ $links = array();
190
+ foreach ( $this->tabs as $tab => $name ) {
191
+ $link_args = array( 'page' => 'wpmem-settings', 'tab' => $tab );
192
+ $link = add_query_arg( $link_args, admin_url( 'options-general.php' ) );
193
+ $class = ( $tab == $current ) ? 'nav-tab nav-tab-active' : 'nav-tab';
194
+ $links[] = sprintf( '<a class="%s" href="%s">%s</a>', $class, $link, $name );
195
+ }
196
+
197
+ echo '<h2 class="nav-tab-wrapper">';
198
+ foreach ( $links as $link ) {
199
+ echo $link;
200
+ }
201
+ echo '</h2>';
202
+ }
203
+
204
+ /**
205
+ * Adds custom email dialog to the Emails tab.
206
+ *
207
+ * @since 3.1.0
208
+ *
209
+ * @param array $args Settings array for the email.
210
+ */
211
+ function do_email_input( $args ) { ?>
212
+ <tr valign="top"><td colspan="2"><strong><?php echo esc_html( $args['heading'] ); ?></strong></td></tr>
213
+ <tr valign="top">
214
+ <th scope="row"><?php echo esc_html( $args['subject_label'] ); ?></th>
215
+ <td><input type="text" name="<?php echo esc_attr( $args['subject_input'] ); ?>" size="80" value="<?php echo esc_attr( wp_unslash( $args['subject_value'] ) ); ?>"></td>
216
+ </tr>
217
+ <tr valign="top">
218
+ <th scope="row"><?php echo esc_html( $args['body_label'] ); ?></th>
219
+ <td><textarea name="<?php echo esc_attr( $args['body_input'] ); ?>" rows="12" cols="50" id="" class="large-text code"><?php echo esc_textarea( wp_unslash( $args['body_value'] ) ); ?></textarea></td>
220
+ </tr>
221
+ <tr><td colspan="2"><hr /></td></tr><?php
222
+ }
223
+
224
+ /**
225
+ * Saves custom email settings.
226
+ *
227
+ * @since 3.1.0
228
+ *
229
+ * @param array $args Settings array for the email.
230
+ */
231
+ function email_update( $args ) {
232
+ $settings = array(
233
+ 'subj' => sanitize_text_field( wpmem_get( $args['subject_input'] ) ),
234
+ 'body' => wp_kses( wpmem_get( $args['body_input'] ), 'post' ),
235
+ );
236
+ update_option( $args['name'], $settings, true );
237
+ $this->emails[ $args['name'] ]['subject_value'] = $settings['subj'];
238
+ $this->emails[ $args['name'] ]['body_value'] = $settings['body'];
239
+ return;
240
+ }
241
+
242
+ /**
243
+ * Handles custom email settings.
244
+ *
245
+ * @since 3.1.0
246
+ *
247
+ * @param array $args Settings array for the email.
248
+ * @return array $args
249
+ */
250
+ function add_email( $args ) {
251
+
252
+ // Get saved settings.
253
+ $settings = get_option( $args['name'] );
254
+
255
+ $defaults = array(
256
+ 'name' => $args['name'],
257
+ 'heading' => __( 'Custom email', 'wp-members' ),
258
+ 'subject_label' => __( 'Subject', 'wp-members' ),
259
+ 'subject_input' => $args['name'] . '_subject',
260
+ 'subject_value' => ( $settings ) ? $settings['subj'] : __( 'Subject', 'wp-members' ),
261
+ 'body_label' => __( 'Body', 'wp-members' ),
262
+ 'body_input' => $args['name'] . '_body',
263
+ 'body_value' => ( $settings ) ? $settings['body'] : __( 'Your custom email message content.', 'wp-members' ),
264
+ );
265
+
266
+ // Merge args with settings.
267
+ $args = wp_parse_args( $args, $defaults );
268
+
269
+ $this->emails[ $args['name'] ] = $args;
270
+
271
+ return $args;
272
+ }
273
+
274
+ /**
275
+ * Adds dialogs to the Dialogs tab.
276
+ *
277
+ * @since 3.1.1
278
+ *
279
+ * @param array $args Settings array for the dialog.
280
+ */
281
+ function do_dialog_input( $args ) { ?>
282
+ <tr valign="top">
283
+ <th scope="row"><?php echo esc_html( $args['label'] ); ?></th>
284
+ <td><textarea name="<?php echo esc_attr( $args['name'] . "_dialog" ); ?>" rows="3" cols="50" id="" class="large-text code"><?php echo esc_textarea( wp_unslash( $args['value'] ) ); ?></textarea></td>
285
+ </tr><?php
286
+ }
287
+
288
+ /**
289
+ * Saves custom dialog settings.
290
+ *
291
+ * @since 3.1.1
292
+ */
293
+ function dialog_update() {
294
+ $settings = array();
295
+ foreach ( $this->dialogs as $dialog ) {
296
+ if ( isset( $_POST[ $dialog['name'] . '_dialog' ] ) ) {
297
+ $settings[ $dialog['name'] ] = wp_kses( $_POST[ $dialog['name'] . '_dialog' ], 'post' );
298
+ }
299
+ }
300
+ update_option( 'wpmembers_dialogs', $settings, true );
301
+ // Refresh settings
302
+ $this->default_dialogs();
303
+ return;
304
+ }
305
+
306
+ /**
307
+ * Handles custom dialog settings.
308
+ *
309
+ * @since 3.1.1
310
+ *
311
+ * @param array $args Settings array for the dialog.
312
+ * @return array $args
313
+ */
314
+ function add_dialog( $args ) {
315
+ global $wpmem;
316
+ if ( is_array( $args ) && isset( $args['label'] ) ) {
317
+ $defaults = array(
318
+ 'name' => $args['name'],
319
+ 'label' => $args['label'],
320
+ //'input' => $args['name'] . '_dialog',
321
+ 'value' => $args['value'],
322
+ //'value' => ( $args['value'] ) ? $args['value'] : $wpmem->get_text( $key ),
323
+ );
324
+
325
+ // Merge args with settings.
326
+ $args = wp_parse_args( $args, $defaults );
327
+
328
+ $this->dialogs[ $args['name'] ] = $args;
329
+ }
330
+
331
+ //return $args;
332
+ }
333
+
334
+ /**
335
+ * Settings for default tabs.
336
+ *
337
+ * @since 3.1.0
338
+ */
339
+ function default_tabs() {
340
+ $this->tabs = array(
341
+ 'options' => 'WP-Members ' . __( 'Options', 'wp-members' ),
342
+ 'fields' => __( 'Fields', 'wp-members' ),
343
+ 'dialogs' => __( 'Dialogs', 'wp-members' ),
344
+ 'emails' => __( 'Emails', 'wp-members' ),
345
+ );
346
+ }
347
+
348
+ /**
349
+ * Settings for default emails.
350
+ *
351
+ * @since 3.1.0
352
+ */
353
+ function default_emails() {
354
+ global $wpmem;
355
+
356
+ if ( $wpmem->mod_reg == 0 ) {
357
+
358
+ $this->add_email( array(
359
+ 'name' => 'wpmembers_email_newreg',
360
+ 'heading' => __( "New Registration", 'wp-members' ),
361
+ 'subject_input' => 'wpmembers_email_newreg_subj',
362
+ 'body_input' => 'wpmembers_email_newreg_body',
363
+ ) );
364
+
365
+ } else {
366
+
367
+ $this->add_email( array(
368
+ 'name' => 'wpmembers_email_newmod',
369
+ 'heading' => __( "Registration is Moderated", 'wp-members' ),
370
+ 'subject_input' => 'wpmembers_email_newmod_subj',
371
+ 'body_input' => 'wpmembers_email_newmod_body',
372
+ ) );
373
+ $this->add_email( array(
374
+ 'name' => 'wpmembers_email_appmod',
375
+ 'heading' => __( "Registration is Moderated, User is Approved", 'wp-members' ),
376
+ 'subject_input' => 'wpmembers_email_appmod_subj',
377
+ 'body_input' => 'wpmembers_email_appmod_body',
378
+ ) );
379
+ }
380
+
381
+ $this->add_email( array(
382
+ 'name' => 'wpmembers_email_repass',
383
+ 'heading' => __( "Password Reset", 'wp-members' ),
384
+ 'subject_input' => 'wpmembers_email_repass_subj',
385
+ 'body_input' => 'wpmembers_email_repass_body',
386
+ ) );
387
+
388
+ $this->add_email( array(
389
+ 'name' => 'wpmembers_email_getuser',
390
+ 'heading' => __( "Retrieve Username", 'wp-members' ),
391
+ 'subject_input' => 'wpmembers_email_getuser_subj',
392
+ 'body_input' => 'wpmembers_email_getuser_body',
393
+ ) );
394
+
395
+ if ( $wpmem->notify == 1 ) {
396
+ $this->add_email( array(
397
+ 'name' => 'wpmembers_email_notify',
398
+ 'heading' => __( "Admin Notification", 'wp-members' ),
399
+ 'subject_input' => 'wpmembers_email_notify_subj',
400
+ 'body_input' => 'wpmembers_email_notify_body',
401
+ ) );
402
+ }
403
+
404
+ }
405
+
406
+ /**
407
+ * Settings for default dialogs.
408
+ *
409
+ * @since 3.1.1
410
+ */
411
+ function default_dialogs() {
412
+ global $wpmem;
413
+
414
+ /**
415
+ * Filter the dialog array to add custom dialogs.
416
+ *
417
+ * @since 3.1.1
418
+ *
419
+ * @param array $dialog_array
420
+ */
421
+ $dialogs = apply_filters( 'wpmem_dialogs', get_option( 'wpmembers_dialogs' ) );
422
+
423
+ $dialog_labels = array(
424
+ 'restricted_msg' => __( "Restricted post (or page), displays above the login/registration form", 'wp-members' ),
425
+ 'user' => __( "Username is taken", 'wp-members' ),
426
+ 'email' => __( "Email is registered", 'wp-members' ),
427
+ 'success' => __( "Registration completed", 'wp-members' ),
428
+ 'editsuccess' => __( "User update", 'wp-members' ),
429
+ 'pwdchangerr' => __( "Passwords did not match", 'wp-members' ),
430
+ 'pwdchangesuccess' => __( "Password changes", 'wp-members' ),
431
+ 'pwdreseterr' => __( "Username or email do not exist when trying to reset forgotten password", 'wp-members' ),
432
+ 'pwdresetsuccess' => __( "Password reset", 'wp-members' ),
433
+ );
434
+
435
+ foreach ( $dialogs as $key => $val ) {
436
+ if ( array_key_exists( $key, $dialog_labels ) ) {
437
+ $dialogs[ $key ] = array(
438
+ 'name' => $key,
439
+ 'label' => $dialog_labels[ $key ],
440
+ 'value' => $dialogs[ $key ],
441
+ );
442
+ }
443
+ }
444
+
445
+ foreach ( $dialogs as $val ) {
446
+ $this->add_dialog( $val );
447
+ }
448
+ }
449
+
450
+
451
+ /**
452
+ * Get the current form.
453
+ *
454
+ * @since 3.1.2
455
+ *
456
+ * @todo Work on multi-form project, no current milestone.
457
+ */
458
+ function get_form( $form = 'default' ) {
459
+ /*
460
+ $current_form = ( isset( $_GET['form'] ) ) ? $_GET['form'] : $form;
461
+ $wpmem_forms = get_option( 'wpmembers_forms' );
462
+ $fields = $wpmem_forms[ $current_form ];
463
+ $this->current_form = $current_form;
464
+ $this->current_form_fields = $fields;
465
+ */
466
+ $this->current_form = sanitize_text_field( wpmem_get( 'form', $form, 'get' ) ); //( isset( $_GET['form'] ) ) ? $_GET['form'] : $form;
467
+ global $wpmem;
468
+ // Add numeric array form fields as associative
469
+ //foreach( $wpmem->fields as $field ) {
470
+ // $wpmem->fields[ $field[2] ] = $field;
471
+ //}
472
+ $this->current_form_fields = wpmem_fields();
473
+ }
474
+
475
+ /**
476
+ * Build admin panel form action url.
477
+ *
478
+ * @since 3.1.8
479
+ *
480
+ * @global string $pagenow
481
+ * @global string $plugin_page
482
+ * @global object $wpmem The WP_Members Object.
483
+ * @param mixed $args Array of additional arguments|boolean. Default: false.
484
+ * @return string $url
485
+ */
486
+ function form_post_url( $args = false ) {
487
+ global $pagenow, $plugin_page, $wpmem;
488
+ $tab = sanitize_text_field( wpmem_get( 'tab', false, 'get' ) );
489
+ $params = array( 'page' => $plugin_page );
490
+ if ( $tab ) {
491
+ $params['tab'] = $tab;
492
+ }
493
+ if ( $args ) {
494
+ foreach( $args as $key => $val ) {
495
+ $params[ $key ] = $val;
496
+ }
497
+ }
498
+ $url = add_query_arg( $params, admin_url( $pagenow ) );
499
+ return esc_url( $url );
500
+ }
501
+
502
+ /**
503
+ * Enqueues the admin javascript and css files.
504
+ *
505
+ * Replaces wpmem_admin_enqueue_scripts().
506
+ * Only loads the js and css on admin screens that use them.
507
+ *
508
+ * @since 3.1.7
509
+ * @since 3.2.0 Moved into admin object, renamed dashboard_enqueue_scripts().
510
+ * @since 3.2.1 Load js for post.php hook.
511
+ *
512
+ * @global object $current_screen
513
+ * @global object $wpmem
514
+ * @param string $hook The admin screen hook being loaded.
515
+ */
516
+ function dashboard_enqueue_scripts( $hook ) {
517
+ global $current_screen, $wpmem;
518
+ if ( 'edit.php' == $hook || 'settings_page_wpmem-settings' == $hook || 'post.php' == $hook || 'post-new.php' == $hook || 'user-edit.php' == $hook || 'profile.php' == $hook ) {
519
+ wp_enqueue_style( 'wpmem-admin', WPMEM_DIR . 'admin/css/admin.css', '', WPMEM_VERSION );
520
+ }
521
+ if ( 'settings_page_wpmem-settings' == $hook || 'post.php' == $hook || 'post-new.php' == $hook ) {
522
+ wp_enqueue_script( 'wpmem-admin', WPMEM_DIR . 'admin/js/admin.js', '', WPMEM_VERSION );
523
+ }
524
+ if ( ( 'post.php' == $hook || 'post-new.php' == $hook ) && 1 == $wpmem->enable_products ) {
525
+ if ( ! wp_script_is( 'select2', 'registered' ) ) {
526
+ wp_register_style( 'select2css', WPMEM_DIR . 'admin/css/select2.min.css', false, '4.0.5', 'all' );
527
+ wp_register_script( 'select2', WPMEM_DIR . 'admin/js/select2.min.js', array( 'jquery' ), '4.0.5', true );
528
+ wp_enqueue_style( 'select2css' );
529
+ wp_enqueue_script( 'select2' );
530
+ }
531
+ }
532
+ if ( 'user-edit' == $current_screen->id ) {
533
+ wp_enqueue_script( 'jquery' );
534
+ wp_enqueue_script( 'jquery-ui-core' ); // enqueue jQuery UI Core
535
+ wp_enqueue_script( 'jquery-ui-tabs' ); // enqueue jQuery UI Tabs
536
+ wp_enqueue_script( 'jquery-ui-datepicker' ); // enqueue jQuery UI Datepicker
537
+
538
+ if ( ! wp_script_is( 'jquery-ui', 'enqueued' ) ) {
539
+ wp_register_style( 'jquery-ui', WPMEM_DIR . 'admin/css/jquery-ui.min.css' );
540
+ }
541
+ wp_enqueue_style( 'jquery-ui' );
542
+ }
543
+ if ( 'settings_page_wpmem-settings' == $hook ) {
544
+ wp_enqueue_script( 'jquery' );
545
+ wp_enqueue_script( 'jquery-ui-core' );// enqueue jQuery UI Core
546
+ wp_enqueue_script( 'jquery-ui-dialog' );
547
+
548
+ if ( ! wp_script_is( 'jquery-ui', 'enqueued' ) ) {
549
+ wp_register_style( 'jquery-ui', WPMEM_DIR . 'admin/css/jquery-ui.min.css' );
550
+ }
551
+ wp_enqueue_style( 'jquery-ui' );
552
+
553
+ }
554
+ }
555
+
556
+ /**
557
+ * Filter to add link to settings from plugin panel.
558
+ *
559
+ * @since 2.4.0
560
+ * @since 3.2.0 Moved to admin API class, renamed from wpmem_admin_plugin_links().
561
+ *
562
+ * @param array $links
563
+ * @param string $file
564
+ * @return array $links
565
+ */
566
+ function plugin_links( $links, $file ) {
567
+ static $wpmem_plugin;
568
+ if ( ! $wpmem_plugin ) {
569
+ $wpmem_plugin = plugin_basename( WPMEM_PATH . '/wp-members.php' );
570
+ }
571
+ if ( $file == $wpmem_plugin ) {
572
+ $settings_link = '<a href="' . add_query_arg( 'page', 'wpmem-settings', 'options-general.php' ) . '">' . __( 'Settings', 'wp-members' ) . '</a>';
573
+ $links = array_merge( array( $settings_link ), $links );
574
+ }
575
+ return $links;
576
+ }
577
+
578
+ /**
579
+ * Returns an array of WordPress reserved terms.
580
+ *
581
+ * @since 3.0.2
582
+ * @since 3.2.3 Moved to WP_Members_Admin_API class.
583
+ *
584
+ * @return array An array of WordPress reserved terms.
585
+ */
586
+ function wp_reserved_terms() {
587
+ $reserved_terms = array( 'attachment', 'attachment_id', 'author', 'author_name', 'calendar', 'cat', 'category', 'category__and', 'category__in', 'category__not_in', 'category_name', 'comments_per_page', 'comments_popup', 'customize_messenger_channel', 'customized', 'cpage', 'day', 'debug', 'error', 'exact', 'feed', 'fields', 'hour', 'link_category', 'm', 'minute', 'monthnum', 'more', 'name', 'nav_menu', 'nonce', 'nopaging', 'offset', 'order', 'orderby', 'p', 'page', 'page_id', 'paged', 'pagename', 'pb', 'perm', 'post', 'post__in', 'post__not_in', 'post_format', 'post_mime_type', 'post_status', 'post_tag', 'post_type', 'posts', 'posts_per_archive_page', 'posts_per_page', 'preview', 'robots', 'role', 's', 'search', 'second', 'sentence', 'showposts', 'static', 'subpost', 'subpost_id', 'tag', 'tag__and', 'tag__in', 'tag__not_in', 'tag_id', 'tag_slug__and', 'tag_slug__in', 'taxonomy', 'tb', 'term', 'theme', 'type', 'w', 'withcomments', 'withoutcomments', 'year' );
588
+
589
+ /**
590
+ * Filter the array of reserved terms.
591
+ *
592
+ * @since 3.0.2
593
+ *
594
+ * @param array $reserved_terms
595
+ */
596
+ $reserved_terms = apply_filters( 'wpmem_wp_reserved_terms', $reserved_terms );
597
+
598
+ return $reserved_terms;
599
+ }
600
+ } // End of WP_Members_Admin_API class.
601
+
602
  // End of file.
admin/js/select2.js ADDED
@@ -0,0 +1,5746 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * Select2 4.0.5
3
+ * https://select2.github.io
4
+ *
5
+ * Released under the MIT license
6
+ * https://github.com/select2/select2/blob/master/LICENSE.md
7
+ */
8
+ (function (factory) {
9
+ if (typeof define === 'function' && define.amd) {
10
+ // AMD. Register as an anonymous module.
11
+ define(['jquery'], factory);
12
+ } else if (typeof module === 'object' && module.exports) {
13
+ // Node/CommonJS
14
+ module.exports = function (root, jQuery) {
15
+ if (jQuery === undefined) {
16
+ // require('jQuery') returns a factory that requires window to
17
+ // build a jQuery instance, we normalize how we use modules
18
+ // that require this pattern but the window provided is a noop
19
+ // if it's defined (how jquery works)
20
+ if (typeof window !== 'undefined') {
21
+ jQuery = require('jquery');
22
+ }
23
+ else {
24
+ jQuery = require('jquery')(root);
25
+ }
26
+ }
27
+ factory(jQuery);
28
+ return jQuery;
29
+ };
30
+ } else {
31
+ // Browser globals
32
+ factory(jQuery);
33
+ }
34
+ } (function (jQuery) {
35
+ // This is needed so we can catch the AMD loader configuration and use it
36
+ // The inner file should be wrapped (by `banner.start.js`) in a function that
37
+ // returns the AMD loader references.
38
+ var S2 =(function () {
39
+ // Restore the Select2 AMD loader so it can be used
40
+ // Needed mostly in the language files, where the loader is not inserted
41
+ if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {
42
+ var S2 = jQuery.fn.select2.amd;
43
+ }
44
+ var S2;(function () { if (!S2 || !S2.requirejs) {
45
+ if (!S2) { S2 = {}; } else { require = S2; }
46
+ /**
47
+ * @license almond 0.3.3 Copyright jQuery Foundation and other contributors.
48
+ * Released under MIT license, http://github.com/requirejs/almond/LICENSE
49
+ */
50
+ //Going sloppy to avoid 'use strict' string cost, but strict practices should
51
+ //be followed.
52
+ /*global setTimeout: false */
53
+
54
+ var requirejs, require, define;
55
+ (function (undef) {
56
+ var main, req, makeMap, handlers,
57
+ defined = {},
58
+ waiting = {},
59
+ config = {},
60
+ defining = {},
61
+ hasOwn = Object.prototype.hasOwnProperty,
62
+ aps = [].slice,
63
+ jsSuffixRegExp = /\.js$/;
64
+
65
+ function hasProp(obj, prop) {
66
+ return hasOwn.call(obj, prop);
67
+ }
68
+
69
+ /**
70
+ * Given a relative module name, like ./something, normalize it to
71
+ * a real name that can be mapped to a path.
72
+ * @param {String} name the relative name
73
+ * @param {String} baseName a real name that the name arg is relative
74
+ * to.
75
+ * @returns {String} normalized name
76
+ */
77
+ function normalize(name, baseName) {
78
+ var nameParts, nameSegment, mapValue, foundMap, lastIndex,
79
+ foundI, foundStarMap, starI, i, j, part, normalizedBaseParts,
80
+ baseParts = baseName && baseName.split("/"),
81
+ map = config.map,
82
+ starMap = (map && map['*']) || {};
83
+
84
+ //Adjust any relative paths.
85
+ if (name) {
86
+ name = name.split('/');
87
+ lastIndex = name.length - 1;
88
+
89
+ // If wanting node ID compatibility, strip .js from end
90
+ // of IDs. Have to do this here, and not in nameToUrl
91
+ // because node allows either .js or non .js to map
92
+ // to same file.
93
+ if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
94
+ name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
95
+ }
96
+
97
+ // Starts with a '.' so need the baseName
98
+ if (name[0].charAt(0) === '.' && baseParts) {
99
+ //Convert baseName to array, and lop off the last part,
100
+ //so that . matches that 'directory' and not name of the baseName's
101
+ //module. For instance, baseName of 'one/two/three', maps to
102
+ //'one/two/three.js', but we want the directory, 'one/two' for
103
+ //this normalization.
104
+ normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
105
+ name = normalizedBaseParts.concat(name);
106
+ }
107
+
108
+ //start trimDots
109
+ for (i = 0; i < name.length; i++) {
110
+ part = name[i];
111
+ if (part === '.') {
112
+ name.splice(i, 1);
113
+ i -= 1;
114
+ } else if (part === '..') {
115
+ // If at the start, or previous value is still ..,
116
+ // keep them so that when converted to a path it may
117
+ // still work when converted to a path, even though
118
+ // as an ID it is less than ideal. In larger point
119
+ // releases, may be better to just kick out an error.
120
+ if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') {
121
+ continue;
122
+ } else if (i > 0) {
123
+ name.splice(i - 1, 2);
124
+ i -= 2;
125
+ }
126
+ }
127
+ }
128
+ //end trimDots
129
+
130
+ name = name.join('/');
131
+ }
132
+
133
+ //Apply map config if available.
134
+ if ((baseParts || starMap) && map) {
135
+ nameParts = name.split('/');
136
+
137
+ for (i = nameParts.length; i > 0; i -= 1) {
138
+ nameSegment = nameParts.slice(0, i).join("/");
139
+
140
+ if (baseParts) {
141
+ //Find the longest baseName segment match in the config.
142
+ //So, do joins on the biggest to smallest lengths of baseParts.
143
+ for (j = baseParts.length; j > 0; j -= 1) {
144
+ mapValue = map[baseParts.slice(0, j).join('/')];
145
+
146
+ //baseName segment has config, find if it has one for
147
+ //this name.
148
+ if (mapValue) {
149
+ mapValue = mapValue[nameSegment];
150
+ if (mapValue) {
151
+ //Match, update name to the new value.
152
+ foundMap = mapValue;
153
+ foundI = i;
154
+ break;
155
+ }
156
+ }
157
+ }
158
+ }
159
+
160
+ if (foundMap) {
161
+ break;
162
+ }
163
+
164
+ //Check for a star map match, but just hold on to it,
165
+ //if there is a shorter segment match later in a matching
166
+ //config, then favor over this star map.
167
+ if (!foundStarMap && starMap && starMap[nameSegment]) {
168
+ foundStarMap = starMap[nameSegment];
169
+ starI = i;
170
+ }
171
+ }
172
+
173
+ if (!foundMap && foundStarMap) {
174
+ foundMap = foundStarMap;
175
+ foundI = starI;
176
+ }
177
+
178
+ if (foundMap) {
179
+ nameParts.splice(0, foundI, foundMap);
180
+ name = nameParts.join('/');
181
+ }
182
+ }
183
+
184
+ return name;
185
+ }
186
+
187
+ function makeRequire(relName, forceSync) {
188
+ return function () {
189
+ //A version of a require function that passes a moduleName
190
+ //value for items that may need to
191
+ //look up paths relative to the moduleName
192
+ var args = aps.call(arguments, 0);
193
+
194
+ //If first arg is not require('string'), and there is only
195
+ //one arg, it is the array form without a callback. Insert
196
+ //a null so that the following concat is correct.
197
+ if (typeof args[0] !== 'string' && args.length === 1) {
198
+ args.push(null);
199
+ }
200
+ return req.apply(undef, args.concat([relName, forceSync]));
201
+ };
202
+ }
203
+
204
+ function makeNormalize(relName) {
205
+ return function (name) {
206
+ return normalize(name, relName);
207
+ };
208
+ }
209
+
210
+ function makeLoad(depName) {
211
+ return function (value) {
212
+ defined[depName] = value;
213
+ };
214
+ }
215
+
216
+ function callDep(name) {
217
+ if (hasProp(waiting, name)) {
218
+ var args = waiting[name];
219
+ delete waiting[name];
220
+ defining[name] = true;
221
+ main.apply(undef, args);
222
+ }
223
+
224
+ if (!hasProp(defined, name) && !hasProp(defining, name)) {
225
+ throw new Error('No ' + name);
226
+ }
227
+ return defined[name];
228
+ }
229
+
230
+ //Turns a plugin!resource to [plugin, resource]
231
+ //with the plugin being undefined if the name
232
+ //did not have a plugin prefix.
233
+ function splitPrefix(name) {
234
+ var prefix,
235
+ index = name ? name.indexOf('!') : -1;
236
+ if (index > -1) {
237
+ prefix = name.substring(0, index);
238
+ name = name.substring(index + 1, name.length);
239
+ }
240
+ return [prefix, name];
241
+ }
242
+
243
+ //Creates a parts array for a relName where first part is plugin ID,
244
+ //second part is resource ID. Assumes relName has already been normalized.
245
+ function makeRelParts(relName) {
246
+ return relName ? splitPrefix(relName) : [];
247
+ }
248
+
249
+ /**
250
+ * Makes a name map, normalizing the name, and using a plugin
251
+ * for normalization if necessary. Grabs a ref to plugin
252
+ * too, as an optimization.
253
+ */
254
+ makeMap = function (name, relParts) {
255
+ var plugin,
256
+ parts = splitPrefix(name),
257
+ prefix = parts[0],
258
+ relResourceName = relParts[1];
259
+
260
+ name = parts[1];
261
+
262
+ if (prefix) {
263
+ prefix = normalize(prefix, relResourceName);
264
+ plugin = callDep(prefix);
265
+ }
266
+
267
+ //Normalize according
268
+ if (prefix) {
269
+ if (plugin && plugin.normalize) {
270
+ name = plugin.normalize(name, makeNormalize(relResourceName));
271
+ } else {
272
+ name = normalize(name, relResourceName);
273
+ }
274
+ } else {
275
+ name = normalize(name, relResourceName);
276
+ parts = splitPrefix(name);
277
+ prefix = parts[0];
278
+ name = parts[1];
279
+ if (prefix) {
280
+ plugin = callDep(prefix);
281
+ }
282
+ }
283
+
284
+ //Using ridiculous property names for space reasons
285
+ return {
286
+ f: prefix ? prefix + '!' + name : name, //fullName
287
+ n: name,
288
+ pr: prefix,
289
+ p: plugin
290
+ };
291
+ };
292
+
293
+ function makeConfig(name) {
294
+ return function () {
295
+ return (config && config.config && config.config[name]) || {};
296
+ };
297
+ }
298
+
299
+ handlers = {
300
+ require: function (name) {
301
+ return makeRequire(name);
302
+ },
303
+ exports: function (name) {
304
+ var e = defined[name];
305
+ if (typeof e !== 'undefined') {
306
+ return e;
307
+ } else {
308
+ return (defined[name] = {});
309
+ }
310
+ },
311
+ module: function (name) {
312
+ return {
313
+ id: name,
314
+ uri: '',
315
+ exports: defined[name],
316
+ config: makeConfig(name)
317
+ };
318
+ }
319
+ };
320
+
321
+ main = function (name, deps, callback, relName) {
322
+ var cjsModule, depName, ret, map, i, relParts,
323
+ args = [],
324
+ callbackType = typeof callback,
325
+ usingExports;
326
+
327
+ //Use name if no relName
328
+ relName = relName || name;
329
+ relParts = makeRelParts(relName);
330
+
331
+ //Call the callback to define the module, if necessary.
332
+ if (callbackType === 'undefined' || callbackType === 'function') {
333
+ //Pull out the defined dependencies and pass the ordered
334
+ //values to the callback.
335
+ //Default to [require, exports, module] if no deps
336
+ deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
337
+ for (i = 0; i < deps.length; i += 1) {
338
+ map = makeMap(deps[i], relParts);
339
+ depName = map.f;
340
+
341
+ //Fast path CommonJS standard dependencies.
342
+ if (depName === "require") {
343
+ args[i] = handlers.require(name);
344
+ } else if (depName === "exports") {
345
+ //CommonJS module spec 1.1
346
+ args[i] = handlers.exports(name);
347
+ usingExports = true;
348
+ } else if (depName === "module") {
349
+ //CommonJS module spec 1.1
350
+ cjsModule = args[i] = handlers.module(name);
351
+ } else if (hasProp(defined, depName) ||
352
+ hasProp(waiting, depName) ||
353
+ hasProp(defining, depName)) {
354
+ args[i] = callDep(depName);
355
+ } else if (map.p) {
356
+ map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
357
+ args[i] = defined[depName];
358
+ } else {
359
+ throw new Error(name + ' missing ' + depName);
360
+ }
361
+ }
362
+
363
+ ret = callback ? callback.apply(defined[name], args) : undefined;
364
+
365
+ if (name) {
366
+ //If setting exports via "module" is in play,
367
+ //favor that over return value and exports. After that,
368
+ //favor a non-undefined return value over exports use.
369
+ if (cjsModule && cjsModule.exports !== undef &&
370
+ cjsModule.exports !== defined[name]) {
371
+ defined[name] = cjsModule.exports;
372
+ } else if (ret !== undef || !usingExports) {
373
+ //Use the return value from the function.
374
+ defined[name] = ret;
375
+ }
376
+ }
377
+ } else if (name) {
378
+ //May just be an object definition for the module. Only
379
+ //worry about defining if have a module name.
380
+ defined[name] = callback;
381
+ }
382
+ };
383
+
384
+ requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
385
+ if (typeof deps === "string") {
386
+ if (handlers[deps]) {
387
+ //callback in this case is really relName
388
+ return handlers[deps](callback);
389
+ }
390
+ //Just return the module wanted. In this scenario, the
391
+ //deps arg is the module name, and second arg (if passed)
392
+ //is just the relName.
393
+ //Normalize module name, if it contains . or ..
394
+ return callDep(makeMap(deps, makeRelParts(callback)).f);
395
+ } else if (!deps.splice) {
396
+ //deps is a config object, not an array.
397
+ config = deps;
398
+ if (config.deps) {
399
+ req(config.deps, config.callback);
400
+ }
401
+ if (!callback) {
402
+ return;
403
+ }
404
+
405
+ if (callback.splice) {
406
+ //callback is an array, which means it is a dependency list.
407
+ //Adjust args if there are dependencies
408
+ deps = callback;
409
+ callback = relName;
410
+ relName = null;
411
+ } else {
412
+ deps = undef;
413
+ }
414
+ }
415
+
416
+ //Support require(['a'])
417
+ callback = callback || function () {};
418
+
419
+ //If relName is a function, it is an errback handler,
420
+ //so remove it.
421
+ if (typeof relName === 'function') {
422
+ relName = forceSync;
423
+ forceSync = alt;
424
+ }
425
+
426
+ //Simulate async callback;
427
+ if (forceSync) {
428
+ main(undef, deps, callback, relName);
429
+ } else {
430
+ //Using a non-zero value because of concern for what old browsers
431
+ //do, and latest browsers "upgrade" to 4 if lower value is used:
432
+ //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
433
+ //If want a value immediately, use require('id') instead -- something
434
+ //that works in almond on the global level, but not guaranteed and
435
+ //unlikely to work in other AMD implementations.
436
+ setTimeout(function () {
437
+ main(undef, deps, callback, relName);
438
+ }, 4);
439
+ }
440
+
441
+ return req;
442
+ };
443
+
444
+ /**
445
+ * Just drops the config on the floor, but returns req in case
446
+ * the config return value is used.
447
+ */
448
+ req.config = function (cfg) {
449
+ return req(cfg);
450
+ };
451
+
452
+ /**
453
+ * Expose module registry for debugging and tooling
454
+ */
455
+ requirejs._defined = defined;
456
+
457
+ define = function (name, deps, callback) {
458
+ if (typeof name !== 'string') {
459
+ throw new Error('See almond README: incorrect module build, no module name');
460
+ }
461
+
462
+ //This module may not have dependencies
463
+ if (!deps.splice) {
464
+ //deps is not an array, so probably means
465
+ //an object literal or factory function for
466
+ //the value. Adjust args.
467
+ callback = deps;
468
+ deps = [];
469
+ }
470
+
471
+ if (!hasProp(defined, name) && !hasProp(waiting, name)) {
472
+ waiting[name] = [name, deps, callback];
473
+ }
474
+ };
475
+
476
+ define.amd = {
477
+ jQuery: true
478
+ };
479
+ }());
480
+
481
+ S2.requirejs = requirejs;S2.require = require;S2.define = define;
482
+ }
483
+ }());
484
+ S2.define("almond", function(){});
485
+
486
+ /* global jQuery:false, $:false */
487
+ S2.define('jquery',[],function () {
488
+ var _$ = jQuery || $;
489
+
490
+ if (_$ == null && console && console.error) {
491
+ console.error(
492
+ 'Select2: An instance of jQuery or a jQuery-compatible library was not ' +
493
+ 'found. Make sure that you are including jQuery before Select2 on your ' +
494
+ 'web page.'
495
+ );
496
+ }
497
+
498
+ return _$;
499
+ });
500
+
501
+ S2.define('select2/utils',[
502
+ 'jquery'
503
+ ], function ($) {
504
+ var Utils = {};
505
+
506
+ Utils.Extend = function (ChildClass, SuperClass) {
507
+ var __hasProp = {}.hasOwnProperty;
508
+
509
+ function BaseConstructor () {
510
+ this.constructor = ChildClass;
511
+ }
512
+
513
+ for (var key in SuperClass) {
514
+ if (__hasProp.call(SuperClass, key)) {
515
+ ChildClass[key] = SuperClass[key];
516
+ }
517
+ }
518
+
519
+ BaseConstructor.prototype = SuperClass.prototype;
520
+ ChildClass.prototype = new BaseConstructor();
521
+ ChildClass.__super__ = SuperClass.prototype;
522
+
523
+ return ChildClass;
524
+ };
525
+
526
+ function getMethods (theClass) {
527
+ var proto = theClass.prototype;
528
+
529
+ var methods = [];
530
+
531
+ for (var methodName in proto) {
532
+ var m = proto[methodName];
533
+
534
+ if (typeof m !== 'function') {
535
+ continue;
536
+ }
537
+
538
+ if (methodName === 'constructor') {
539
+ continue;
540
+ }
541
+
542
+ methods.push(methodName);
543
+ }
544
+
545
+ return methods;
546
+ }
547
+
548
+ Utils.Decorate = function (SuperClass, DecoratorClass) {
549
+ var decoratedMethods = getMethods(DecoratorClass);
550
+ var superMethods = getMethods(SuperClass);
551
+
552
+ function DecoratedClass () {
553
+ var unshift = Array.prototype.unshift;
554
+
555
+ var argCount = DecoratorClass.prototype.constructor.length;
556
+
557
+ var calledConstructor = SuperClass.prototype.constructor;
558
+
559
+ if (argCount > 0) {
560
+ unshift.call(arguments, SuperClass.prototype.constructor);
561
+
562
+ calledConstructor = DecoratorClass.prototype.constructor;
563
+ }
564
+
565
+ calledConstructor.apply(this, arguments);
566
+ }
567
+
568
+ DecoratorClass.displayName = SuperClass.displayName;
569
+
570
+ function ctr () {
571
+ this.constructor = DecoratedClass;
572
+ }
573
+
574
+ DecoratedClass.prototype = new ctr();
575
+
576
+ for (var m = 0; m < superMethods.length; m++) {
577
+ var superMethod = superMethods[m];
578
+
579
+ DecoratedClass.prototype[superMethod] =
580
+ SuperClass.prototype[superMethod];
581
+ }
582
+
583
+ var calledMethod = function (methodName) {
584
+ // Stub out the original method if it's not decorating an actual method
585
+ var originalMethod = function () {};
586
+
587
+ if (methodName in DecoratedClass.prototype) {
588
+ originalMethod = DecoratedClass.prototype[methodName];
589
+ }
590
+
591
+ var decoratedMethod = DecoratorClass.prototype[methodName];
592
+
593
+ return function () {
594
+ var unshift = Array.prototype.unshift;
595
+
596
+ unshift.call(arguments, originalMethod);
597
+
598
+ return decoratedMethod.apply(this, arguments);
599
+ };
600
+ };
601
+
602
+ for (var d = 0; d < decoratedMethods.length; d++) {
603
+ var decoratedMethod = decoratedMethods[d];
604
+
605
+ DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);
606
+ }
607
+
608
+ return DecoratedClass;
609
+ };
610
+
611
+ var Observable = function () {
612
+ this.listeners = {};
613
+ };
614
+
615
+ Observable.prototype.on = function (event, callback) {
616
+ this.listeners = this.listeners || {};
617
+
618
+ if (event in this.listeners) {
619
+ this.listeners[event].push(callback);
620
+ } else {
621
+ this.listeners[event] = [callback];
622
+ }
623
+ };
624
+
625
+ Observable.prototype.trigger = function (event) {
626
+ var slice = Array.prototype.slice;
627
+ var params = slice.call(arguments, 1);
628
+
629
+ this.listeners = this.listeners || {};
630
+
631
+ // Params should always come in as an array
632
+ if (params == null) {
633
+ params = [];
634
+ }
635
+
636
+ // If there are no arguments to the event, use a temporary object
637
+ if (params.length === 0) {
638
+ params.push({});
639
+ }
640
+
641
+ // Set the `_type` of the first object to the event
642
+ params[0]._type = event;
643
+
644
+ if (event in this.listeners) {
645
+ this.invoke(this.listeners[event], slice.call(arguments, 1));
646
+ }
647
+
648
+ if ('*' in this.listeners) {
649
+ this.invoke(this.listeners['*'], arguments);
650
+ }
651
+ };
652
+
653
+ Observable.prototype.invoke = function (listeners, params) {
654
+ for (var i = 0, len = listeners.length; i < len; i++) {
655
+ listeners[i].apply(this, params);
656
+ }
657
+ };
658
+
659
+ Utils.Observable = Observable;
660
+
661
+ Utils.generateChars = function (length) {
662
+ var chars = '';
663
+
664
+ for (var i = 0; i < length; i++) {
665
+ var randomChar = Math.floor(Math.random() * 36);
666
+ chars += randomChar.toString(36);
667
+ }
668
+
669
+ return chars;
670
+ };
671
+
672
+ Utils.bind = function (func, context) {
673
+ return function () {
674
+ func.apply(context, arguments);
675
+ };
676
+ };
677
+
678
+ Utils._convertData = function (data) {
679
+ for (var originalKey in data) {
680
+ var keys = originalKey.split('-');
681
+
682
+ var dataLevel = data;
683
+
684
+ if (keys.length === 1) {
685
+ continue;
686
+ }
687
+
688
+ for (var k = 0; k < keys.length; k++) {
689
+ var key = keys[k];
690
+
691
+ // Lowercase the first letter
692
+ // By default, dash-separated becomes camelCase
693
+ key = key.substring(0, 1).toLowerCase() + key.substring(1);
694
+
695
+ if (!(key in dataLevel)) {
696
+ dataLevel[key] = {};
697
+ }
698
+
699
+ if (k == keys.length - 1) {
700
+ dataLevel[key] = data[originalKey];
701
+ }
702
+
703
+ dataLevel = dataLevel[key];
704
+ }
705
+
706
+ delete data[originalKey];
707
+ }
708
+
709
+ return data;
710
+ };
711
+
712
+ Utils.hasScroll = function (index, el) {
713
+ // Adapted from the function created by @ShadowScripter
714
+ // and adapted by @BillBarry on the Stack Exchange Code Review website.
715
+ // The original code can be found at
716
+ // http://codereview.stackexchange.com/q/13338
717
+ // and was designed to be used with the Sizzle selector engine.
718
+
719
+ var $el = $(el);
720
+ var overflowX = el.style.overflowX;
721
+ var overflowY = el.style.overflowY;
722
+
723
+ //Check both x and y declarations
724
+ if (overflowX === overflowY &&
725
+ (overflowY === 'hidden' || overflowY === 'visible')) {
726
+ return false;
727
+ }
728
+
729
+ if (overflowX === 'scroll' || overflowY === 'scroll') {
730
+ return true;
731
+ }
732
+
733
+ return ($el.innerHeight() < el.scrollHeight ||
734
+ $el.innerWidth() < el.scrollWidth);
735
+ };
736
+
737
+ Utils.escapeMarkup = function (markup) {
738
+ var replaceMap = {
739
+ '\\': '&#92;',
740
+ '&': '&amp;',
741
+ '<': '&lt;',
742
+ '>': '&gt;',
743
+ '"': '&quot;',
744
+ '\'': '&#39;',
745
+ '/': '&#47;'
746
+ };
747
+
748
+ // Do not try to escape the markup if it's not a string
749
+ if (typeof markup !== 'string') {
750
+ return markup;
751
+ }
752
+
753
+ return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
754
+ return replaceMap[match];
755
+ });
756
+ };
757
+
758
+ // Append an array of jQuery nodes to a given element.
759
+ Utils.appendMany = function ($element, $nodes) {
760
+ // jQuery 1.7.x does not support $.fn.append() with an array
761
+ // Fall back to a jQuery object collection using $.fn.add()
762
+ if ($.fn.jquery.substr(0, 3) === '1.7') {
763
+ var $jqNodes = $();
764
+
765
+ $.map($nodes, function (node) {
766
+ $jqNodes = $jqNodes.add(node);
767
+ });
768
+
769
+ $nodes = $jqNodes;
770
+ }
771
+
772
+ $element.append($nodes);
773
+ };
774
+
775
+ return Utils;
776
+ });
777
+
778
+ S2.define('select2/results',[
779
+ 'jquery',
780
+ './utils'
781
+ ], function ($, Utils) {
782
+ function Results ($element, options, dataAdapter) {
783
+ this.$element = $element;
784
+ this.data = dataAdapter;
785
+ this.options = options;
786
+
787
+ Results.__super__.constructor.call(this);
788
+ }
789
+
790
+ Utils.Extend(Results, Utils.Observable);
791
+
792
+ Results.prototype.render = function () {
793
+ var $results = $(
794
+ '<ul class="select2-results__options" role="tree"></ul>'
795
+ );
796
+
797
+ if (this.options.get('multiple')) {
798
+ $results.attr('aria-multiselectable', 'true');
799
+ }
800
+
801
+ this.$results = $results;
802
+
803
+ return $results;
804
+ };
805
+
806
+ Results.prototype.clear = function () {
807
+ this.$results.empty();
808
+ };
809
+
810
+ Results.prototype.displayMessage = function (params) {
811
+ var escapeMarkup = this.options.get('escapeMarkup');
812
+
813
+ this.clear();
814
+ this.hideLoading();
815
+
816
+ var $message = $(
817
+ '<li role="treeitem" aria-live="assertive"' +
818
+ ' class="select2-results__option"></li>'
819
+ );
820
+
821
+ var message = this.options.get('translations').get(params.message);
822
+
823
+ $message.append(
824
+ escapeMarkup(
825
+ message(params.args)
826
+ )
827
+ );
828
+
829
+ $message[0].className += ' select2-results__message';
830
+
831
+ this.$results.append($message);
832
+ };
833
+
834
+ Results.prototype.hideMessages = function () {
835
+ this.$results.find('.select2-results__message').remove();
836
+ };
837
+
838
+ Results.prototype.append = function (data) {
839
+ this.hideLoading();
840
+
841
+ var $options = [];
842
+
843
+ if (data.results == null || data.results.length === 0) {
844
+ if (this.$results.children().length === 0) {
845
+ this.trigger('results:message', {
846
+ message: 'noResults'
847
+ });
848
+ }
849
+
850
+ return;
851
+ }
852
+
853
+ data.results = this.sort(data.results);
854
+
855
+ for (var d = 0; d < data.results.length; d++) {
856
+ var item = data.results[d];
857
+
858
+ var $option = this.option(item);
859
+
860
+ $options.push($option);
861
+ }
862
+
863
+ this.$results.append($options);
864
+ };
865
+
866
+ Results.prototype.position = function ($results, $dropdown) {
867
+ var $resultsContainer = $dropdown.find('.select2-results');
868
+ $resultsContainer.append($results);
869
+ };
870
+
871
+ Results.prototype.sort = function (data) {
872
+ var sorter = this.options.get('sorter');
873
+
874
+ return sorter(data);
875
+ };
876
+
877
+ Results.prototype.highlightFirstItem = function () {
878
+ var $options = this.$results
879
+ .find('.select2-results__option[aria-selected]');
880
+
881
+ var $selected = $options.filter('[aria-selected=true]');
882
+
883
+ // Check if there are any selected options
884
+ if ($selected.length > 0) {
885
+ // If there are selected options, highlight the first
886
+ $selected.first().trigger('mouseenter');
887
+ } else {
888
+ // If there are no selected options, highlight the first option
889
+ // in the dropdown
890
+ $options.first().trigger('mouseenter');
891
+ }
892
+
893
+ this.ensureHighlightVisible();
894
+ };
895
+
896
+ Results.prototype.setClasses = function () {
897
+ var self = this;
898
+
899
+ this.data.current(function (selected) {
900
+ var selectedIds = $.map(selected, function (s) {
901
+ return s.id.toString();
902
+ });
903
+
904
+ var $options = self.$results
905
+ .find('.select2-results__option[aria-selected]');
906
+
907
+ $options.each(function () {
908
+ var $option = $(this);
909
+
910
+ var item = $.data(this, 'data');
911
+
912
+ // id needs to be converted to a string when comparing
913
+ var id = '' + item.id;
914
+
915
+ if ((item.element != null && item.element.selected) ||
916
+ (item.element == null && $.inArray(id, selectedIds) > -1)) {
917
+ $option.attr('aria-selected', 'true');
918
+ } else {
919
+ $option.attr('aria-selected', 'false');
920
+ }
921
+ });
922
+
923
+ });
924
+ };
925
+
926
+ Results.prototype.showLoading = function (params) {
927
+ this.hideLoading();
928
+
929
+ var loadingMore = this.options.get('translations').get('searching');
930
+
931
+ var loading = {
932
+ disabled: true,
933
+ loading: true,
934
+ text: loadingMore(params)
935
+ };
936
+ var $loading = this.option(loading);
937
+ $loading.className += ' loading-results';
938
+
939
+ this.$results.prepend($loading);
940
+ };
941
+
942
+ Results.prototype.hideLoading = function () {
943
+ this.$results.find('.loading-results').remove();
944
+ };
945
+
946
+ Results.prototype.option = function (data) {
947
+ var option = document.createElement('li');
948
+ option.className = 'select2-results__option';
949
+
950
+ var attrs = {
951
+ 'role': 'treeitem',
952
+ 'aria-selected': 'false'
953
+ };
954
+
955
+ if (data.disabled) {
956
+ delete attrs['aria-selected'];
957
+ attrs['aria-disabled'] = 'true';
958
+ }
959
+
960
+ if (data.id == null) {
961
+ delete attrs['aria-selected'];
962
+ }
963
+
964
+ if (data._resultId != null) {
965
+ option.id = data._resultId;
966
+ }
967
+
968
+ if (data.title) {
969
+ option.title = data.title;
970
+ }
971
+
972
+ if (data.children) {
973
+ attrs.role = 'group';
974
+ attrs['aria-label'] = data.text;
975
+ delete attrs['aria-selected'];
976
+ }
977
+
978
+ for (var attr in attrs) {
979
+ var val = attrs[attr];
980
+
981
+ option.setAttribute(attr, val);
982
+ }
983
+
984
+ if (data.children) {
985
+ var $option = $(option);
986
+
987
+ var label = document.createElement('strong');
988
+ label.className = 'select2-results__group';
989
+
990
+ var $label = $(label);
991
+ this.template(data, label);
992
+
993
+ var $children = [];
994
+
995
+ for (var c = 0; c < data.children.length; c++) {
996
+ var child = data.children[c];
997
+
998
+ var $child = this.option(child);
999
+
1000
+ $children.push($child);
1001
+ }
1002
+
1003
+ var $childrenContainer = $('<ul></ul>', {
1004
+ 'class': 'select2-results__options select2-results__options--nested'
1005
+ });
1006
+
1007
+ $childrenContainer.append($children);
1008
+
1009
+ $option.append(label);
1010
+ $option.append($childrenContainer);
1011
+ } else {
1012
+ this.template(data, option);
1013
+ }
1014
+
1015
+ $.data(option, 'data', data);
1016
+
1017
+ return option;
1018
+ };
1019
+
1020
+ Results.prototype.bind = function (container, $container) {
1021
+ var self = this;
1022
+
1023
+ var id = container.id + '-results';
1024
+
1025
+ this.$results.attr('id', id);
1026
+
1027
+ container.on('results:all', function (params) {
1028
+ self.clear();
1029
+ self.append(params.data);
1030
+
1031
+ if (container.isOpen()) {
1032
+ self.setClasses();
1033
+ self.highlightFirstItem();
1034
+ }
1035
+ });
1036
+
1037
+ container.on('results:append', function (params) {
1038
+ self.append(params.data);
1039
+
1040
+ if (container.isOpen()) {
1041
+ self.setClasses();
1042
+ }
1043
+ });
1044
+
1045
+ container.on('query', function (params) {
1046
+ self.hideMessages();
1047
+ self.showLoading(params);
1048
+ });
1049
+
1050
+ container.on('select', function () {
1051
+ if (!container.isOpen()) {
1052
+ return;
1053
+ }
1054
+
1055
+ self.setClasses();
1056
+ self.highlightFirstItem();
1057
+ });
1058
+
1059
+ container.on('unselect', function () {
1060
+ if (!container.isOpen()) {
1061
+ return;
1062
+ }
1063
+
1064
+ self.setClasses();
1065
+ self.highlightFirstItem();
1066
+ });
1067
+
1068
+ container.on('open', function () {
1069
+ // When the dropdown is open, aria-expended="true"
1070
+ self.$results.attr('aria-expanded', 'true');
1071
+ self.$results.attr('aria-hidden', 'false');
1072
+
1073
+ self.setClasses();
1074
+ self.ensureHighlightVisible();
1075
+ });
1076
+
1077
+ container.on('close', function () {
1078
+ // When the dropdown is closed, aria-expended="false"
1079
+ self.$results.attr('aria-expanded', 'false');
1080
+ self.$results.attr('aria-hidden', 'true');
1081
+ self.$results.removeAttr('aria-activedescendant');
1082
+ });
1083
+
1084
+ container.on('results:toggle', function () {
1085
+ var $highlighted = self.getHighlightedResults();
1086
+
1087
+ if ($highlighted.length === 0) {
1088
+ return;
1089
+ }
1090
+
1091
+ $highlighted.trigger('mouseup');
1092
+ });
1093
+
1094
+ container.on('results:select', function () {
1095
+ var $highlighted = self.getHighlightedResults();
1096
+
1097
+ if ($highlighted.length === 0) {
1098
+ return;
1099
+ }
1100
+
1101
+ var data = $highlighted.data('data');
1102
+
1103
+ if ($highlighted.attr('aria-selected') == 'true') {
1104
+ self.trigger('close', {});
1105
+ } else {
1106
+ self.trigger('select', {
1107
+ data: data
1108
+ });
1109
+ }
1110
+ });
1111
+
1112
+ container.on('results:previous', function () {
1113
+ var $highlighted = self.getHighlightedResults();
1114
+
1115
+ var $options = self.$results.find('[aria-selected]');
1116
+
1117
+ var currentIndex = $options.index($highlighted);
1118
+
1119
+ // If we are already at te top, don't move further
1120
+ if (currentIndex === 0) {
1121
+ return;
1122
+ }
1123
+
1124
+ var nextIndex = currentIndex - 1;
1125
+
1126
+ // If none are highlighted, highlight the first
1127
+ if ($highlighted.length === 0) {
1128
+ nextIndex = 0;
1129
+ }
1130
+
1131
+ var $next = $options.eq(nextIndex);
1132
+
1133
+ $next.trigger('mouseenter');
1134
+
1135
+ var currentOffset = self.$results.offset().top;
1136
+ var nextTop = $next.offset().top;
1137
+ var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset);
1138
+
1139
+ if (nextIndex === 0) {
1140
+ self.$results.scrollTop(0);
1141
+ } else if (nextTop - currentOffset < 0) {
1142
+ self.$results.scrollTop(nextOffset);
1143
+ }
1144
+ });
1145
+
1146
+ container.on('results:next', function () {
1147
+ var $highlighted = self.getHighlightedResults();
1148
+
1149
+ var $options = self.$results.find('[aria-selected]');
1150
+
1151
+ var currentIndex = $options.index($highlighted);
1152
+
1153
+ var nextIndex = currentIndex + 1;
1154
+
1155
+ // If we are at the last option, stay there
1156
+ if (nextIndex >= $options.length) {
1157
+ return;
1158
+ }
1159
+
1160
+ var $next = $options.eq(nextIndex);
1161
+
1162
+ $next.trigger('mouseenter');
1163
+
1164
+ var currentOffset = self.$results.offset().top +
1165
+ self.$results.outerHeight(false);
1166
+ var nextBottom = $next.offset().top + $next.outerHeight(false);
1167
+ var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset;
1168
+
1169
+ if (nextIndex === 0) {
1170
+ self.$results.scrollTop(0);
1171
+ } else if (nextBottom > currentOffset) {
1172
+ self.$results.scrollTop(nextOffset);
1173
+ }
1174
+ });
1175
+
1176
+ container.on('results:focus', function (params) {
1177
+ params.element.addClass('select2-results__option--highlighted');
1178
+ });
1179
+
1180
+ container.on('results:message', function (params) {
1181
+ self.displayMessage(params);
1182
+ });
1183
+
1184
+ if ($.fn.mousewheel) {
1185
+ this.$results.on('mousewheel', function (e) {
1186
+ var top = self.$results.scrollTop();
1187
+
1188
+ var bottom = self.$results.get(0).scrollHeight - top + e.deltaY;
1189
+
1190
+ var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0;
1191
+ var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height();
1192
+
1193
+ if (isAtTop) {
1194
+ self.$results.scrollTop(0);
1195
+
1196
+ e.preventDefault();
1197
+ e.stopPropagation();
1198
+ } else if (isAtBottom) {
1199
+ self.$results.scrollTop(
1200
+ self.$results.get(0).scrollHeight - self.$results.height()
1201
+ );
1202
+
1203
+ e.preventDefault();
1204
+ e.stopPropagation();
1205
+ }
1206
+ });
1207
+ }
1208
+
1209
+ this.$results.on('mouseup', '.select2-results__option[aria-selected]',
1210
+ function (evt) {
1211
+ var $this = $(this);
1212
+
1213
+ var data = $this.data('data');
1214
+
1215
+ if ($this.attr('aria-selected') === 'true') {
1216
+ if (self.options.get('multiple')) {
1217
+ self.trigger('unselect', {
1218
+ originalEvent: evt,
1219
+ data: data
1220
+ });
1221
+ } else {
1222
+ self.trigger('close', {});
1223
+ }
1224
+
1225
+ return;
1226
+ }
1227
+
1228
+ self.trigger('select', {
1229
+ originalEvent: evt,
1230
+ data: data
1231
+ });
1232
+ });
1233
+
1234
+ this.$results.on('mouseenter', '.select2-results__option[aria-selected]',
1235
+ function (evt) {
1236
+ var data = $(this).data('data');
1237
+
1238
+ self.getHighlightedResults()
1239
+ .removeClass('select2-results__option--highlighted');
1240
+
1241
+ self.trigger('results:focus', {
1242
+ data: data,
1243
+ element: $(this)
1244
+ });
1245
+ });
1246
+ };
1247
+
1248
+ Results.prototype.getHighlightedResults = function () {
1249
+ var $highlighted = this.$results
1250
+ .find('.select2-results__option--highlighted');
1251
+
1252
+ return $highlighted;
1253
+ };
1254
+
1255
+ Results.prototype.destroy = function () {
1256
+ this.$results.remove();
1257
+ };
1258
+
1259
+ Results.prototype.ensureHighlightVisible = function () {
1260
+ var $highlighted = this.getHighlightedResults();
1261
+
1262
+ if ($highlighted.length === 0) {
1263
+ return;
1264
+ }
1265
+
1266
+ var $options = this.$results.find('[aria-selected]');
1267
+
1268
+ var currentIndex = $options.index($highlighted);
1269
+
1270
+ var currentOffset = this.$results.offset().top;
1271
+ var nextTop = $highlighted.offset().top;
1272
+ var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset);
1273
+
1274
+ var offsetDelta = nextTop - currentOffset;
1275
+ nextOffset -= $highlighted.outerHeight(false) * 2;
1276
+
1277
+ if (currentIndex <= 2) {
1278
+ this.$results.scrollTop(0);
1279
+ } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {
1280
+ this.$results.scrollTop(nextOffset);
1281
+ }
1282
+ };
1283
+
1284
+ Results.prototype.template = function (result, container) {
1285
+ var template = this.options.get('templateResult');
1286
+ var escapeMarkup = this.options.get('escapeMarkup');
1287
+
1288
+ var content = template(result, container);
1289
+
1290
+ if (content == null) {
1291
+ container.style.display = 'none';
1292
+ } else if (typeof content === 'string') {
1293
+ container.innerHTML = escapeMarkup(content);
1294
+ } else {
1295
+ $(container).append(content);
1296
+ }
1297
+ };
1298
+
1299
+ return Results;
1300
+ });
1301
+
1302
+ S2.define('select2/keys',[
1303
+
1304
+ ], function () {
1305
+ var KEYS = {
1306
+ BACKSPACE: 8,
1307
+ TAB: 9,
1308
+ ENTER: 13,
1309
+ SHIFT: 16,
1310
+ CTRL: 17,
1311
+ ALT: 18,
1312
+ ESC: 27,
1313
+ SPACE: 32,
1314
+ PAGE_UP: 33,
1315
+ PAGE_DOWN: 34,
1316
+ END: 35,
1317
+ HOME: 36,
1318
+ LEFT: 37,
1319
+ UP: 38,
1320
+ RIGHT: 39,
1321
+ DOWN: 40,
1322
+ DELETE: 46
1323
+ };
1324
+
1325
+ return KEYS;
1326
+ });
1327
+
1328
+ S2.define('select2/selection/base',[
1329
+ 'jquery',
1330
+ '../utils',
1331
+ '../keys'
1332
+ ], function ($, Utils, KEYS) {
1333
+ function BaseSelection ($element, options) {
1334
+ this.$element = $element;
1335
+ this.options = options;
1336
+
1337
+ BaseSelection.__super__.constructor.call(this);
1338
+ }
1339
+
1340
+ Utils.Extend(BaseSelection, Utils.Observable);
1341
+
1342
+ BaseSelection.prototype.render = function () {
1343
+ var $selection = $(
1344
+ '<span class="select2-selection" role="combobox" ' +
1345
+ ' aria-haspopup="true" aria-expanded="false">' +
1346
+ '</span>'
1347
+ );
1348
+
1349
+ this._tabindex = 0;
1350
+
1351
+ if (this.$element.data('old-tabindex') != null) {
1352
+ this._tabindex = this.$element.data('old-tabindex');
1353
+ } else if (this.$element.attr('tabindex') != null) {
1354
+ this._tabindex = this.$element.attr('tabindex');
1355
+ }
1356
+
1357
+ $selection.attr('title', this.$element.attr('title'));
1358
+ $selection.attr('tabindex', this._tabindex);
1359
+
1360
+ this.$selection = $selection;
1361
+
1362
+ return $selection;
1363
+ };
1364
+
1365
+ BaseSelection.prototype.bind = function (container, $container) {
1366
+ var self = this;
1367
+
1368
+ var id = container.id + '-container';
1369
+ var resultsId = container.id + '-results';
1370
+
1371
+ this.container = container;
1372
+
1373
+ this.$selection.on('focus', function (evt) {
1374
+ self.trigger('focus', evt);
1375
+ });
1376
+
1377
+ this.$selection.on('blur', function (evt) {
1378
+ self._handleBlur(evt);
1379
+ });
1380
+
1381
+ this.$selection.on('keydown', function (evt) {
1382
+ self.trigger('keypress', evt);
1383
+
1384
+ if (evt.which === KEYS.SPACE) {
1385
+ evt.preventDefault();
1386
+ }
1387
+ });
1388
+
1389
+ container.on('results:focus', function (params) {
1390
+ self.$selection.attr('aria-activedescendant', params.data._resultId);
1391
+ });
1392
+
1393
+ container.on('selection:update', function (params) {
1394
+ self.update(params.data);
1395
+ });
1396
+
1397
+ container.on('open', function () {
1398
+ // When the dropdown is open, aria-expanded="true"
1399
+ self.$selection.attr('aria-expanded', 'true');
1400
+ self.$selection.attr('aria-owns', resultsId);
1401
+
1402
+ self._attachCloseHandler(container);
1403
+ });
1404
+
1405
+ container.on('close', function () {
1406
+ // When the dropdown is closed, aria-expanded="false"
1407
+ self.$selection.attr('aria-expanded', 'false');
1408
+ self.$selection.removeAttr('aria-activedescendant');
1409
+ self.$selection.removeAttr('aria-owns');
1410
+
1411
+ self.$selection.focus();
1412
+
1413
+ self._detachCloseHandler(container);
1414
+ });
1415
+
1416
+ container.on('enable', function () {
1417
+ self.$selection.attr('tabindex', self._tabindex);
1418
+ });
1419
+
1420
+ container.on('disable', function () {
1421
+ self.$selection.attr('tabindex', '-1');
1422
+ });
1423
+ };
1424
+
1425
+ BaseSelection.prototype._handleBlur = function (evt) {
1426
+ var self = this;
1427
+
1428
+ // This needs to be delayed as the active element is the body when the tab
1429
+ // key is pressed, possibly along with others.
1430
+ window.setTimeout(function () {
1431
+ // Don't trigger `blur` if the focus is still in the selection
1432
+ if (
1433
+ (document.activeElement == self.$selection[0]) ||
1434
+ ($.contains(self.$selection[0], document.activeElement))
1435
+ ) {
1436
+ return;
1437
+ }
1438
+
1439
+ self.trigger('blur', evt);
1440
+ }, 1);
1441
+ };
1442
+
1443
+ BaseSelection.prototype._attachCloseHandler = function (container) {
1444
+ var self = this;
1445
+
1446
+ $(document.body).on('mousedown.select2.' + container.id, function (e) {
1447
+ var $target = $(e.target);
1448
+
1449
+ var $select = $target.closest('.select2');
1450
+
1451
+ var $all = $('.select2.select2-container--open');
1452
+
1453
+ $all.each(function () {
1454
+ var $this = $(this);
1455
+
1456
+ if (this == $select[0]) {
1457
+ return;
1458
+ }
1459
+
1460
+ var $element = $this.data('element');
1461
+
1462
+ $element.select2('close');
1463
+ });
1464
+ });
1465
+ };
1466
+
1467
+ BaseSelection.prototype._detachCloseHandler = function (container) {
1468
+ $(document.body).off('mousedown.select2.' + container.id);
1469
+ };
1470
+
1471
+ BaseSelection.prototype.position = function ($selection, $container) {
1472
+ var $selectionContainer = $container.find('.selection');
1473
+ $selectionContainer.append($selection);
1474
+ };
1475
+
1476
+ BaseSelection.prototype.destroy = function () {
1477
+ this._detachCloseHandler(this.container);
1478
+ };
1479
+
1480
+ BaseSelection.prototype.update = function (data) {
1481
+ throw new Error('The `update` method must be defined in child classes.');
1482
+ };
1483
+
1484
+ return BaseSelection;
1485
+ });
1486
+
1487
+ S2.define('select2/selection/single',[
1488
+ 'jquery',
1489
+ './base',
1490
+ '../utils',
1491
+ '../keys'
1492
+ ], function ($, BaseSelection, Utils, KEYS) {
1493
+ function SingleSelection () {
1494
+ SingleSelection.__super__.constructor.apply(this, arguments);
1495
+ }
1496
+
1497
+ Utils.Extend(SingleSelection, BaseSelection);
1498
+
1499
+ SingleSelection.prototype.render = function () {
1500
+ var $selection = SingleSelection.__super__.render.call(this);
1501
+
1502
+ $selection.addClass('select2-selection--single');
1503
+
1504
+ $selection.html(
1505
+ '<span class="select2-selection__rendered"></span>' +
1506
+ '<span class="select2-selection__arrow" role="presentation">' +
1507
+ '<b role="presentation"></b>' +
1508
+ '</span>'
1509
+ );
1510
+
1511
+ return $selection;
1512
+ };
1513
+
1514
+ SingleSelection.prototype.bind = function (container, $container) {
1515
+ var self = this;
1516
+
1517
+ SingleSelection.__super__.bind.apply(this, arguments);
1518
+
1519
+ var id = container.id + '-container';
1520
+
1521
+ this.$selection.find('.select2-selection__rendered').attr('id', id);
1522
+ this.$selection.attr('aria-labelledby', id);
1523
+
1524
+ this.$selection.on('mousedown', function (evt) {
1525
+ // Only respond to left clicks
1526
+ if (evt.which !== 1) {
1527
+ return;
1528
+ }
1529
+
1530
+ self.trigger('toggle', {
1531
+ originalEvent: evt
1532
+ });
1533
+ });
1534
+
1535
+ this.$selection.on('focus', function (evt) {
1536
+ // User focuses on the container
1537
+ });
1538
+
1539
+ this.$selection.on('blur', function (evt) {
1540
+ // User exits the container
1541
+ });
1542
+
1543
+ container.on('focus', function (evt) {
1544
+ if (!container.isOpen()) {
1545
+ self.$selection.focus();
1546
+ }
1547
+ });
1548
+
1549
+ container.on('selection:update', function (params) {
1550
+ self.update(params.data);
1551
+ });
1552
+ };
1553
+
1554
+ SingleSelection.prototype.clear = function () {
1555
+ this.$selection.find('.select2-selection__rendered').empty();
1556
+ };
1557
+
1558
+ SingleSelection.prototype.display = function (data, container) {
1559
+ var template = this.options.get('templateSelection');
1560
+ var escapeMarkup = this.options.get('escapeMarkup');
1561
+
1562
+ return escapeMarkup(template(data, container));
1563
+ };
1564
+
1565
+ SingleSelection.prototype.selectionContainer = function () {
1566
+ return $('<span></span>');
1567
+ };
1568
+
1569
+ SingleSelection.prototype.update = function (data) {
1570
+ if (data.length === 0) {
1571
+ this.clear();
1572
+ return;
1573
+ }
1574
+
1575
+ var selection = data[0];
1576
+
1577
+ var $rendered = this.$selection.find('.select2-selection__rendered');
1578
+ var formatted = this.display(selection, $rendered);
1579
+
1580
+ $rendered.empty().append(formatted);
1581
+ $rendered.prop('title', selection.title || selection.text);
1582
+ };
1583
+
1584
+ return SingleSelection;
1585
+ });
1586
+
1587
+ S2.define('select2/selection/multiple',[
1588
+ 'jquery',
1589
+ './base',
1590
+ '../utils'
1591
+ ], function ($, BaseSelection, Utils) {
1592
+ function MultipleSelection ($element, options) {
1593
+ MultipleSelection.__super__.constructor.apply(this, arguments);
1594
+ }
1595
+
1596
+ Utils.Extend(MultipleSelection, BaseSelection);
1597
+
1598
+ MultipleSelection.prototype.render = function () {
1599
+ var $selection = MultipleSelection.__super__.render.call(this);
1600
+
1601
+ $selection.addClass('select2-selection--multiple');
1602
+
1603
+ $selection.html(
1604
+ '<ul class="select2-selection__rendered"></ul>'
1605
+ );
1606
+
1607
+ return $selection;
1608
+ };
1609
+
1610
+ MultipleSelection.prototype.bind = function (container, $container) {
1611
+ var self = this;
1612
+
1613
+ MultipleSelection.__super__.bind.apply(this, arguments);
1614
+
1615
+ this.$selection.on('click', function (evt) {
1616
+ self.trigger('toggle', {
1617
+ originalEvent: evt
1618
+ });
1619
+ });
1620
+
1621
+ this.$selection.on(
1622
+ 'click',
1623
+ '.select2-selection__choice__remove',
1624
+ function (evt) {
1625
+ // Ignore the event if it is disabled
1626
+ if (self.options.get('disabled')) {
1627
+ return;
1628
+ }
1629
+
1630
+ var $remove = $(this);
1631
+ var $selection = $remove.parent();
1632
+
1633
+ var data = $selection.data('data');
1634
+
1635
+ self.trigger('unselect', {
1636
+ originalEvent: evt,
1637
+ data: data
1638
+ });
1639
+ }
1640
+ );
1641
+ };
1642
+
1643
+ MultipleSelection.prototype.clear = function () {
1644
+ this.$selection.find('.select2-selection__rendered').empty();
1645
+ };
1646
+
1647
+ MultipleSelection.prototype.display = function (data, container) {
1648
+ var template = this.options.get('templateSelection');
1649
+ var escapeMarkup = this.options.get('escapeMarkup');
1650
+
1651
+ return escapeMarkup(template(data, container));
1652
+ };
1653
+
1654
+ MultipleSelection.prototype.selectionContainer = function () {
1655
+ var $container = $(
1656
+ '<li class="select2-selection__choice">' +
1657
+ '<span class="select2-selection__choice__remove" role="presentation">' +
1658
+ '&times;' +
1659
+ '</span>' +
1660
+ '</li>'
1661
+ );
1662
+
1663
+ return $container;
1664
+ };
1665
+
1666
+ MultipleSelection.prototype.update = function (data) {
1667
+ this.clear();
1668
+
1669
+ if (data.length === 0) {
1670
+ return;
1671
+ }
1672
+
1673
+ var $selections = [];
1674
+
1675
+ for (var d = 0; d < data.length; d++) {
1676
+ var selection = data[d];
1677
+
1678
+ var $selection = this.selectionContainer();
1679
+ var formatted = this.display(selection, $selection);
1680
+
1681
+ $selection.append(formatted);
1682
+ $selection.prop('title', selection.title || selection.text);
1683
+
1684
+ $selection.data('data', selection);
1685
+
1686
+ $selections.push($selection);
1687
+ }
1688
+
1689
+ var $rendered = this.$selection.find('.select2-selection__rendered');
1690
+
1691
+ Utils.appendMany($rendered, $selections);
1692
+ };
1693
+
1694
+ return MultipleSelection;
1695
+ });
1696
+
1697
+ S2.define('select2/selection/placeholder',[
1698
+ '../utils'
1699
+ ], function (Utils) {
1700
+ function Placeholder (decorated, $element, options) {
1701
+ this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
1702
+
1703
+ decorated.call(this, $element, options);
1704
+ }
1705
+
1706
+ Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {
1707
+ if (typeof placeholder === 'string') {
1708
+ placeholder = {
1709
+ id: '',
1710
+ text: placeholder
1711
+ };
1712
+ }
1713
+
1714
+ return placeholder;
1715
+ };
1716
+
1717
+ Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
1718
+ var $placeholder = this.selectionContainer();
1719
+
1720
+ $placeholder.html(this.display(placeholder));
1721
+ $placeholder.addClass('select2-selection__placeholder')
1722
+ .removeClass('select2-selection__choice');
1723
+
1724
+ return $placeholder;
1725
+ };
1726
+
1727
+ Placeholder.prototype.update = function (decorated, data) {
1728
+ var singlePlaceholder = (
1729
+ data.length == 1 && data[0].id != this.placeholder.id
1730
+ );
1731
+ var multipleSelections = data.length > 1;
1732
+
1733
+ if (multipleSelections || singlePlaceholder) {
1734
+ return decorated.call(this, data);
1735
+ }
1736
+
1737
+ this.clear();
1738
+
1739
+ var $placeholder = this.createPlaceholder(this.placeholder);
1740
+
1741
+ this.$selection.find('.select2-selection__rendered').append($placeholder);
1742
+ };
1743
+
1744
+ return Placeholder;
1745
+ });
1746
+
1747
+ S2.define('select2/selection/allowClear',[
1748
+ 'jquery',
1749
+ '../keys'
1750
+ ], function ($, KEYS) {
1751
+ function AllowClear () { }
1752
+
1753
+ AllowClear.prototype.bind = function (decorated, container, $container) {
1754
+ var self = this;
1755
+
1756
+ decorated.call(this, container, $container);
1757
+
1758
+ if (this.placeholder == null) {
1759
+ if (this.options.get('debug') && window.console && console.error) {
1760
+ console.error(
1761
+ 'Select2: The `allowClear` option should be used in combination ' +
1762
+ 'with the `placeholder` option.'
1763
+ );
1764
+ }
1765
+ }
1766
+
1767
+ this.$selection.on('mousedown', '.select2-selection__clear',
1768
+ function (evt) {
1769
+ self._handleClear(evt);
1770
+ });
1771
+
1772
+ container.on('keypress', function (evt) {
1773
+ self._handleKeyboardClear(evt, container);
1774
+ });
1775
+ };
1776
+
1777
+ AllowClear.prototype._handleClear = function (_, evt) {
1778
+ // Ignore the event if it is disabled
1779
+ if (this.options.get('disabled')) {
1780
+ return;
1781
+ }
1782
+
1783
+ var $clear = this.$selection.find('.select2-selection__clear');
1784
+
1785
+ // Ignore the event if nothing has been selected
1786
+ if ($clear.length === 0) {
1787
+ return;
1788
+ }
1789
+
1790
+ evt.stopPropagation();
1791
+
1792
+ var data = $clear.data('data');
1793
+
1794
+ for (var d = 0; d < data.length; d++) {
1795
+ var unselectData = {
1796
+ data: data[d]
1797
+ };
1798
+
1799
+ // Trigger the `unselect` event, so people can prevent it from being
1800
+ // cleared.
1801
+ this.trigger('unselect', unselectData);
1802
+
1803
+ // If the event was prevented, don't clear it out.
1804
+ if (unselectData.prevented) {
1805
+ return;
1806
+ }
1807
+ }
1808
+
1809
+ this.$element.val(this.placeholder.id).trigger('change');
1810
+
1811
+ this.trigger('toggle', {});
1812
+ };
1813
+
1814
+ AllowClear.prototype._handleKeyboardClear = function (_, evt, container) {
1815
+ if (container.isOpen()) {
1816
+ return;
1817
+ }
1818
+
1819
+ if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) {
1820
+ this._handleClear(evt);
1821
+ }
1822
+ };
1823
+
1824
+ AllowClear.prototype.update = function (decorated, data) {
1825
+ decorated.call(this, data);
1826
+
1827
+ if (this.$selection.find('.select2-selection__placeholder').length > 0 ||
1828
+ data.length === 0) {
1829
+ return;
1830
+ }
1831
+
1832
+ var $remove = $(
1833
+ '<span class="select2-selection__clear">' +
1834
+ '&times;' +
1835
+ '</span>'
1836
+ );
1837
+ $remove.data('data', data);
1838
+
1839
+ this.$selection.find('.select2-selection__rendered').prepend($remove);
1840
+ };
1841
+
1842
+ return AllowClear;
1843
+ });
1844
+
1845
+ S2.define('select2/selection/search',[
1846
+ 'jquery',
1847
+ '../utils',
1848
+ '../keys'
1849
+ ], function ($, Utils, KEYS) {
1850
+ function Search (decorated, $element, options) {
1851
+ decorated.call(this, $element, options);
1852
+ }
1853
+
1854
+ Search.prototype.render = function (decorated) {
1855
+ var $search = $(
1856
+ '<li class="select2-search select2-search--inline">' +
1857
+ '<input class="select2-search__field" type="search" tabindex="-1"' +
1858
+ ' autocomplete="off" autocorrect="off" autocapitalize="none"' +
1859
+ ' spellcheck="false" role="textbox" aria-autocomplete="list" />' +
1860
+ '</li>'
1861
+ );
1862
+
1863
+ this.$searchContainer = $search;
1864
+ this.$search = $search.find('input');
1865
+
1866
+ var $rendered = decorated.call(this);
1867
+
1868
+ this._transferTabIndex();
1869
+
1870
+ return $rendered;
1871
+ };
1872
+
1873
+ Search.prototype.bind = function (decorated, container, $container) {
1874
+ var self = this;
1875
+
1876
+ decorated.call(this, container, $container);
1877
+
1878
+ container.on('open', function () {
1879
+ self.$search.trigger('focus');
1880
+ });
1881
+
1882
+ container.on('close', function () {
1883
+ self.$search.val('');
1884
+ self.$search.removeAttr('aria-activedescendant');
1885
+ self.$search.trigger('focus');
1886
+ });
1887
+
1888
+ container.on('enable', function () {
1889
+ self.$search.prop('disabled', false);
1890
+
1891
+ self._transferTabIndex();
1892
+ });
1893
+
1894
+ container.on('disable', function () {
1895
+ self.$search.prop('disabled', true);
1896
+ });
1897
+
1898
+ container.on('focus', function (evt) {
1899
+ self.$search.trigger('focus');
1900
+ });
1901
+
1902
+ container.on('results:focus', function (params) {
1903
+ self.$search.attr('aria-activedescendant', params.id);
1904
+ });
1905
+
1906
+ this.$selection.on('focusin', '.select2-search--inline', function (evt) {
1907
+ self.trigger('focus', evt);
1908
+ });
1909
+
1910
+ this.$selection.on('focusout', '.select2-search--inline', function (evt) {
1911
+ self._handleBlur(evt);
1912
+ });
1913
+
1914
+ this.$selection.on('keydown', '.select2-search--inline', function (evt) {
1915
+ evt.stopPropagation();
1916
+
1917
+ self.trigger('keypress', evt);
1918
+
1919
+ self._keyUpPrevented = evt.isDefaultPrevented();
1920
+
1921
+ var key = evt.which;
1922
+
1923
+ if (key === KEYS.BACKSPACE && self.$search.val() === '') {
1924
+ var $previousChoice = self.$searchContainer
1925
+ .prev('.select2-selection__choice');
1926
+
1927
+ if ($previousChoice.length > 0) {
1928
+ var item = $previousChoice.data('data');
1929
+
1930
+ self.searchRemoveChoice(item);
1931
+
1932
+ evt.preventDefault();
1933
+ }
1934
+ }
1935
+ });
1936
+
1937
+ // Try to detect the IE version should the `documentMode` property that
1938
+ // is stored on the document. This is only implemented in IE and is
1939
+ // slightly cleaner than doing a user agent check.
1940
+ // This property is not available in Edge, but Edge also doesn't have
1941
+ // this bug.
1942
+ var msie = document.documentMode;
1943
+ var disableInputEvents = msie && msie <= 11;
1944
+
1945
+ // Workaround for browsers which do not support the `input` event
1946
+ // This will prevent double-triggering of events for browsers which support
1947
+ // both the `keyup` and `input` events.
1948
+ this.$selection.on(
1949
+ 'input.searchcheck',
1950
+ '.select2-search--inline',
1951
+ function (evt) {
1952
+ // IE will trigger the `input` event when a placeholder is used on a
1953
+ // search box. To get around this issue, we are forced to ignore all
1954
+ // `input` events in IE and keep using `keyup`.
1955
+ if (disableInputEvents) {
1956
+ self.$selection.off('input.search input.searchcheck');
1957
+ return;
1958
+ }
1959
+
1960
+ // Unbind the duplicated `keyup` event
1961
+ self.$selection.off('keyup.search');
1962
+ }
1963
+ );
1964
+
1965
+ this.$selection.on(
1966
+ 'keyup.search input.search',
1967
+ '.select2-search--inline',
1968
+ function (evt) {
1969
+ // IE will trigger the `input` event when a placeholder is used on a
1970
+ // search box. To get around this issue, we are forced to ignore all
1971
+ // `input` events in IE and keep using `keyup`.
1972
+ if (disableInputEvents && evt.type === 'input') {
1973
+ self.$selection.off('input.search input.searchcheck');
1974
+ return;
1975
+ }
1976
+
1977
+ var key = evt.which;
1978
+
1979
+ // We can freely ignore events from modifier keys
1980
+ if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) {
1981
+ return;
1982
+ }
1983
+
1984
+ // Tabbing will be handled during the `keydown` phase
1985
+ if (key == KEYS.TAB) {
1986
+ return;
1987
+ }
1988
+
1989
+ self.handleSearch(evt);
1990
+ }
1991
+ );
1992
+ };
1993
+
1994
+ /**
1995
+ * This method will transfer the tabindex attribute from the rendered
1996
+ * selection to the search box. This allows for the search box to be used as
1997
+ * the primary focus instead of the selection container.
1998
+ *
1999
+ * @private
2000
+ */
2001
+ Search.prototype._transferTabIndex = function (decorated) {
2002
+ this.$search.attr('tabindex', this.$selection.attr('tabindex'));
2003
+ this.$selection.attr('tabindex', '-1');
2004
+ };
2005
+
2006
+ Search.prototype.createPlaceholder = function (decorated, placeholder) {
2007
+ this.$search.attr('placeholder', placeholder.text);
2008
+ };
2009
+
2010
+ Search.prototype.update = function (decorated, data) {
2011
+ var searchHadFocus = this.$search[0] == document.activeElement;
2012
+
2013
+ this.$search.attr('placeholder', '');
2014
+
2015
+ decorated.call(this, data);
2016
+
2017
+ this.$selection.find('.select2-selection__rendered')
2018
+ .append(this.$searchContainer);
2019
+
2020
+ this.resizeSearch();
2021
+ if (searchHadFocus) {
2022
+ this.$search.focus();
2023
+ }
2024
+ };
2025
+
2026
+ Search.prototype.handleSearch = function () {
2027
+ this.resizeSearch();
2028
+
2029
+ if (!this._keyUpPrevented) {
2030
+ var input = this.$search.val();
2031
+
2032
+ this.trigger('query', {
2033
+ term: input
2034
+ });
2035
+ }
2036
+
2037
+ this._keyUpPrevented = false;
2038
+ };
2039
+
2040
+ Search.prototype.searchRemoveChoice = function (decorated, item) {
2041
+ this.trigger('unselect', {
2042
+ data: item
2043
+ });
2044
+
2045
+ this.$search.val(item.text);
2046
+ this.handleSearch();
2047
+ };
2048
+
2049
+ Search.prototype.resizeSearch = function () {
2050
+ this.$search.css('width', '25px');
2051
+
2052
+ var width = '';
2053
+
2054
+ if (this.$search.attr('placeholder') !== '') {
2055
+ width = this.$selection.find('.select2-selection__rendered').innerWidth();
2056
+ } else {
2057
+ var minimumWidth = this.$search.val().length + 1;
2058
+
2059
+ width = (minimumWidth * 0.75) + 'em';
2060
+ }
2061
+
2062
+ this.$search.css('width', width);
2063
+ };
2064
+
2065
+ return Search;
2066
+ });
2067
+
2068
+ S2.define('select2/selection/eventRelay',[
2069
+ 'jquery'
2070
+ ], function ($) {
2071
+ function EventRelay () { }
2072
+
2073
+ EventRelay.prototype.bind = function (decorated, container, $container) {
2074
+ var self = this;
2075
+ var relayEvents = [
2076
+ 'open', 'opening',
2077
+ 'close', 'closing',
2078
+ 'select', 'selecting',
2079
+ 'unselect', 'unselecting'
2080
+ ];
2081
+
2082
+ var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting'];
2083
+
2084
+ decorated.call(this, container, $container);
2085
+
2086
+ container.on('*', function (name, params) {
2087
+ // Ignore events that should not be relayed
2088
+ if ($.inArray(name, relayEvents) === -1) {
2089
+ return;
2090
+ }
2091
+
2092
+ // The parameters should always be an object
2093
+ params = params || {};
2094
+
2095
+ // Generate the jQuery event for the Select2 event
2096
+ var evt = $.Event('select2:' + name, {
2097
+ params: params
2098
+ });
2099
+
2100
+ self.$element.trigger(evt);
2101
+
2102
+ // Only handle preventable events if it was one
2103
+ if ($.inArray(name, preventableEvents) === -1) {
2104
+ return;
2105
+ }
2106
+
2107
+ params.prevented = evt.isDefaultPrevented();
2108
+ });
2109
+ };
2110
+
2111
+ return EventRelay;
2112
+ });
2113
+
2114
+ S2.define('select2/translation',[
2115
+ 'jquery',
2116
+ 'require'
2117
+ ], function ($, require) {
2118
+ function Translation (dict) {
2119
+ this.dict = dict || {};
2120
+ }
2121
+
2122
+ Translation.prototype.all = function () {
2123
+ return this.dict;
2124
+ };
2125
+
2126
+ Translation.prototype.get = function (key) {
2127
+ return this.dict[key];
2128
+ };
2129
+
2130
+ Translation.prototype.extend = function (translation) {
2131
+ this.dict = $.extend({}, translation.all(), this.dict);
2132
+ };
2133
+
2134
+ // Static functions
2135
+
2136
+ Translation._cache = {};
2137
+
2138
+ Translation.loadPath = function (path) {
2139
+ if (!(path in Translation._cache)) {
2140
+ var translations = require(path);
2141
+
2142
+ Translation._cache[path] = translations;
2143
+ }
2144
+
2145
+ return new Translation(Translation._cache[path]);
2146
+ };
2147
+
2148
+ return Translation;
2149
+ });
2150
+
2151
+ S2.define('select2/diacritics',[
2152
+
2153
+ ], function () {
2154
+ var diacritics = {
2155
+ '\u24B6': 'A',
2156
+ '\uFF21': 'A',
2157
+ '\u00C0': 'A',
2158
+ '\u00C1': 'A',
2159
+ '\u00C2': 'A',
2160
+ '\u1EA6': 'A',
2161
+ '\u1EA4': 'A',
2162
+ '\u1EAA': 'A',
2163
+ '\u1EA8': 'A',
2164
+ '\u00C3': 'A',
2165
+ '\u0100': 'A',
2166
+ '\u0102': 'A',
2167
+ '\u1EB0': 'A',
2168
+ '\u1EAE': 'A',
2169
+ '\u1EB4': 'A',
2170
+ '\u1EB2': 'A',
2171
+ '\u0226': 'A',
2172
+ '\u01E0': 'A',
2173
+ '\u00C4': 'A',
2174
+ '\u01DE': 'A',
2175
+ '\u1EA2': 'A',
2176
+ '\u00C5': 'A',
2177
+ '\u01FA': 'A',
2178
+ '\u01CD': 'A',
2179
+ '\u0200': 'A',
2180
+ '\u0202': 'A',
2181
+ '\u1EA0': 'A',
2182
+ '\u1EAC': 'A',
2183
+ '\u1EB6': 'A',
2184
+ '\u1E00': 'A',
2185
+ '\u0104': 'A',
2186
+ '\u023A': 'A',
2187
+ '\u2C6F': 'A',
2188
+ '\uA732': 'AA',
2189
+ '\u00C6': 'AE',
2190
+ '\u01FC': 'AE',
2191
+ '\u01E2': 'AE',
2192
+ '\uA734': 'AO',
2193
+ '\uA736': 'AU',
2194
+ '\uA738': 'AV',
2195
+ '\uA73A': 'AV',
2196
+ '\uA73C': 'AY',
2197
+ '\u24B7': 'B',
2198
+ '\uFF22': 'B',
2199
+ '\u1E02': 'B',
2200
+ '\u1E04': 'B',
2201
+ '\u1E06': 'B',
2202
+ '\u0243': 'B',
2203
+ '\u0182': 'B',
2204
+ '\u0181': 'B',
2205
+ '\u24B8': 'C',
2206
+ '\uFF23': 'C',
2207
+ '\u0106': 'C',
2208
+ '\u0108': 'C',
2209
+ '\u010A': 'C',
2210
+ '\u010C': 'C',
2211
+ '\u00C7': 'C',
2212
+ '\u1E08': 'C',
2213
+ '\u0187': 'C',
2214
+ '\u023B': 'C',
2215
+ '\uA73E': 'C',
2216
+ '\u24B9': 'D',
2217
+ '\uFF24': 'D',
2218
+ '\u1E0A': 'D',
2219
+ '\u010E': 'D',
2220
+ '\u1E0C': 'D',
2221
+ '\u1E10': 'D',
2222
+ '\u1E12': 'D',
2223
+ '\u1E0E': 'D',
2224
+ '\u0110': 'D',
2225
+ '\u018B': 'D',
2226
+ '\u018A': 'D',
2227
+ '\u0189': 'D',
2228
+ '\uA779': 'D',
2229
+ '\u01F1': 'DZ',
2230
+ '\u01C4': 'DZ',
2231
+ '\u01F2': 'Dz',
2232
+ '\u01C5': 'Dz',
2233
+ '\u24BA': 'E',
2234
+ '\uFF25': 'E',
2235
+ '\u00C8': 'E',
2236
+ '\u00C9': 'E',
2237
+ '\u00CA': 'E',
2238
+ '\u1EC0': 'E',
2239
+ '\u1EBE': 'E',
2240
+ '\u1EC4': 'E',
2241
+ '\u1EC2': 'E',
2242
+ '\u1EBC': 'E',
2243
+ '\u0112': 'E',
2244
+ '\u1E14': 'E',
2245
+ '\u1E16': 'E',
2246
+ '\u0114': 'E',
2247
+ '\u0116': 'E',
2248
+ '\u00CB': 'E',
2249
+ '\u1EBA': 'E',
2250
+ '\u011A': 'E',
2251
+ '\u0204': 'E',
2252
+ '\u0206': 'E',
2253
+ '\u1EB8': 'E',
2254
+ '\u1EC6': 'E',
2255
+ '\u0228': 'E',
2256
+ '\u1E1C': 'E',
2257
+ '\u0118': 'E',
2258
+ '\u1E18': 'E',
2259
+ '\u1E1A': 'E',
2260
+ '\u0190': 'E',
2261
+ '\u018E': 'E',
2262
+ '\u24BB': 'F',
2263
+ '\uFF26': 'F',
2264
+ '\u1E1E': 'F',
2265
+ '\u0191': 'F',
2266
+ '\uA77B': 'F',
2267
+ '\u24BC': 'G',
2268
+ '\uFF27': 'G',
2269
+ '\u01F4': 'G',
2270
+ '\u011C': 'G',
2271
+ '\u1E20': 'G',
2272
+ '\u011E': 'G',
2273
+ '\u0120': 'G',
2274
+ '\u01E6': 'G',
2275
+ '\u0122': 'G',
2276
+ '\u01E4': 'G',
2277
+ '\u0193': 'G',
2278
+ '\uA7A0': 'G',
2279
+ '\uA77D': 'G',
2280
+ '\uA77E': 'G',
2281
+ '\u24BD': 'H',
2282
+ '\uFF28': 'H',
2283
+ '\u0124': 'H',
2284
+ '\u1E22': 'H',
2285
+ '\u1E26': 'H',
2286
+ '\u021E': 'H',
2287
+ '\u1E24': 'H',
2288
+ '\u1E28': 'H',
2289
+ '\u1E2A': 'H',
2290
+ '\u0126': 'H',
2291
+ '\u2C67': 'H',
2292
+ '\u2C75': 'H',
2293
+ '\uA78D': 'H',
2294
+ '\u24BE': 'I',
2295
+ '\uFF29': 'I',
2296
+ '\u00CC': 'I',
2297
+ '\u00CD': 'I',
2298
+ '\u00CE': 'I',
2299
+ '\u0128': 'I',
2300
+ '\u012A': 'I',
2301
+ '\u012C': 'I',
2302
+ '\u0130': 'I',
2303
+ '\u00CF': 'I',
2304
+ '\u1E2E': 'I',
2305
+ '\u1EC8': 'I',
2306
+ '\u01CF': 'I',
2307
+ '\u0208': 'I',
2308
+ '\u020A': 'I',
2309
+ '\u1ECA': 'I',
2310
+ '\u012E': 'I',
2311
+ '\u1E2C': 'I',
2312
+ '\u0197': 'I',
2313
+ '\u24BF': 'J',
2314
+ '\uFF2A': 'J',
2315
+ '\u0134': 'J',
2316
+ '\u0248': 'J',
2317
+ '\u24C0': 'K',
2318
+ '\uFF2B': 'K',
2319
+ '\u1E30': 'K',
2320
+ '\u01E8': 'K',
2321
+ '\u1E32': 'K',
2322
+ '\u0136': 'K',
2323
+ '\u1E34': 'K',
2324
+ '\u0198': 'K',
2325
+ '\u2C69': 'K',
2326
+ '\uA740': 'K',
2327
+ '\uA742': 'K',
2328
+ '\uA744': 'K',
2329
+ '\uA7A2': 'K',
2330
+ '\u24C1': 'L',
2331
+ '\uFF2C': 'L',
2332
+ '\u013F': 'L',
2333
+ '\u0139': 'L',
2334
+ '\u013D': 'L',
2335
+ '\u1E36': 'L',
2336
+ '\u1E38': 'L',
2337
+ '\u013B': 'L',
2338
+ '\u1E3C': 'L',
2339
+ '\u1E3A': 'L',
2340
+ '\u0141': 'L',
2341
+ '\u023D': 'L',
2342
+ '\u2C62': 'L',
2343
+ '\u2C60': 'L',
2344
+ '\uA748': 'L',
2345
+ '\uA746': 'L',
2346
+ '\uA780': 'L',
2347
+ '\u01C7': 'LJ',
2348
+ '\u01C8': 'Lj',
2349
+ '\u24C2': 'M',
2350
+ '\uFF2D': 'M',
2351
+ '\u1E3E': 'M',
2352
+ '\u1E40': 'M',
2353
+ '\u1E42': 'M',
2354
+ '\u2C6E': 'M',
2355
+ '\u019C': 'M',
2356
+ '\u24C3': 'N',
2357
+ '\uFF2E': 'N',
2358
+ '\u01F8': 'N',
2359
+ '\u0143': 'N',
2360
+ '\u00D1': 'N',
2361
+ '\u1E44': 'N',
2362
+ '\u0147': 'N',
2363
+ '\u1E46': 'N',
2364
+ '\u0145': 'N',
2365
+ '\u1E4A': 'N',
2366
+ '\u1E48': 'N',
2367
+ '\u0220': 'N',
2368
+ '\u019D': 'N',
2369
+ '\uA790': 'N',
2370
+ '\uA7A4': 'N',
2371
+ '\u01CA': 'NJ',
2372
+ '\u01CB': 'Nj',
2373
+ '\u24C4': 'O',
2374
+ '\uFF2F': 'O',
2375
+ '\u00D2': 'O',
2376
+ '\u00D3': 'O',
2377
+ '\u00D4': 'O',
2378
+ '\u1ED2': 'O',
2379
+ '\u1ED0': 'O',
2380
+ '\u1ED6': 'O',
2381
+ '\u1ED4': 'O',
2382
+ '\u00D5': 'O',
2383
+ '\u1E4C': 'O',
2384
+ '\u022C': 'O',
2385
+ '\u1E4E': 'O',
2386
+ '\u014C': 'O',
2387
+ '\u1E50': 'O',
2388
+ '\u1E52': 'O',
2389
+ '\u014E': 'O',
2390
+ '\u022E': 'O',
2391
+ '\u0230': 'O',
2392
+ '\u00D6': 'O',
2393
+ '\u022A': 'O',
2394
+ '\u1ECE': 'O',
2395
+ '\u0150': 'O',
2396
+ '\u01D1': 'O',
2397
+ '\u020C': 'O',
2398
+ '\u020E': 'O',
2399
+ '\u01A0': 'O',
2400
+ '\u1EDC': 'O',
2401
+ '\u1EDA': 'O',
2402
+ '\u1EE0': 'O',
2403
+ '\u1EDE': 'O',
2404
+ '\u1EE2': 'O',
2405
+ '\u1ECC': 'O',
2406
+ '\u1ED8': 'O',
2407
+ '\u01EA': 'O',
2408
+ '\u01EC': 'O',
2409
+ '\u00D8': 'O',
2410
+ '\u01FE': 'O',
2411
+ '\u0186': 'O',
2412
+ '\u019F': 'O',
2413
+ '\uA74A': 'O',
2414
+ '\uA74C': 'O',
2415
+ '\u01A2': 'OI',
2416
+ '\uA74E': 'OO',
2417
+ '\u0222': 'OU',
2418
+ '\u24C5': 'P',
2419
+ '\uFF30': 'P',
2420
+ '\u1E54': 'P',
2421
+ '\u1E56': 'P',
2422
+ '\u01A4': 'P',
2423
+ '\u2C63': 'P',
2424
+ '\uA750': 'P',
2425
+ '\uA752': 'P',
2426
+ '\uA754': 'P',
2427
+ '\u24C6': 'Q',
2428
+ '\uFF31': 'Q',
2429
+ '\uA756': 'Q',
2430
+ '\uA758': 'Q',
2431
+ '\u024A': 'Q',
2432
+ '\u24C7': 'R',
2433
+ '\uFF32': 'R',
2434
+ '\u0154': 'R',
2435
+ '\u1E58': 'R',
2436
+ '\u0158': 'R',
2437
+ '\u0210': 'R',
2438
+ '\u0212': 'R',
2439
+ '\u1E5A': 'R',
2440
+ '\u1E5C': 'R',
2441
+ '\u0156': 'R',
2442
+ '\u1E5E': 'R',
2443
+ '\u024C': 'R',
2444
+ '\u2C64': 'R',
2445
+ '\uA75A': 'R',
2446
+ '\uA7A6': 'R',
2447
+ '\uA782': 'R',
2448
+ '\u24C8': 'S',
2449
+ '\uFF33': 'S',
2450
+ '\u1E9E': 'S',
2451
+ '\u015A': 'S',
2452
+ '\u1E64': 'S',
2453
+ '\u015C': 'S',
2454
+ '\u1E60': 'S',
2455
+ '\u0160': 'S',
2456
+ '\u1E66': 'S',
2457
+ '\u1E62': 'S',
2458
+ '\u1E68': 'S',
2459
+ '\u0218': 'S',
2460
+ '\u015E': 'S',
2461
+ '\u2C7E': 'S',
2462
+ '\uA7A8': 'S',
2463
+ '\uA784': 'S',
2464
+ '\u24C9': 'T',
2465
+ '\uFF34': 'T',
2466
+ '\u1E6A': 'T',
2467
+ '\u0164': 'T',
2468
+ '\u1E6C': 'T',
2469
+ '\u021A': 'T',
2470
+ '\u0162': 'T',
2471
+ '\u1E70': 'T',
2472
+ '\u1E6E': 'T',
2473
+ '\u0166': 'T',
2474
+ '\u01AC': 'T',
2475
+ '\u01AE': 'T',
2476
+ '\u023E': 'T',
2477
+ '\uA786': 'T',
2478
+ '\uA728': 'TZ',
2479
+ '\u24CA': 'U',
2480
+ '\uFF35': 'U',
2481
+ '\u00D9': 'U',
2482
+ '\u00DA': 'U',
2483
+ '\u00DB': 'U',
2484
+ '\u0168': 'U',
2485
+ '\u1E78': 'U',
2486
+ '\u016A': 'U',
2487
+ '\u1E7A': 'U',
2488
+ '\u016C': 'U',
2489
+ '\u00DC': 'U',
2490
+ '\u01DB': 'U',
2491
+ '\u01D7': 'U',
2492
+ '\u01D5': 'U',
2493
+ '\u01D9': 'U',
2494
+ '\u1EE6': 'U',
2495
+ '\u016E': 'U',
2496
+ '\u0170': 'U',
2497
+ '\u01D3': 'U',
2498
+ '\u0214': 'U',
2499
+ '\u0216': 'U',
2500
+ '\u01AF': 'U',
2501
+ '\u1EEA': 'U',
2502
+ '\u1EE8': 'U',
2503
+ '\u1EEE': 'U',
2504
+ '\u1EEC': 'U',
2505
+ '\u1EF0': 'U',
2506
+ '\u1EE4': 'U',
2507
+ '\u1E72': 'U',
2508
+ '\u0172': 'U',
2509
+ '\u1E76': 'U',
2510
+ '\u1E74': 'U',
2511
+ '\u0244': 'U',
2512
+ '\u24CB': 'V',
2513
+ '\uFF36': 'V',
2514
+ '\u1E7C': 'V',
2515
+ '\u1E7E': 'V',
2516
+ '\u01B2': 'V',
2517
+ '\uA75E': 'V',
2518
+ '\u0245': 'V',
2519
+ '\uA760': 'VY',
2520
+ '\u24CC': 'W',
2521
+ '\uFF37': 'W',
2522
+ '\u1E80': 'W',
2523
+ '\u1E82': 'W',
2524
+ '\u0174': 'W',
2525
+ '\u1E86': 'W',
2526
+ '\u1E84': 'W',
2527
+ '\u1E88': 'W',
2528
+ '\u2C72': 'W',
2529
+ '\u24CD': 'X',
2530
+ '\uFF38': 'X',
2531
+ '\u1E8A': 'X',
2532
+ '\u1E8C': 'X',
2533
+ '\u24CE': 'Y',
2534
+ '\uFF39': 'Y',
2535
+ '\u1EF2': 'Y',
2536
+ '\u00DD': 'Y',
2537
+ '\u0176': 'Y',
2538
+ '\u1EF8': 'Y',
2539
+ '\u0232': 'Y',
2540
+ '\u1E8E': 'Y',
2541
+ '\u0178': 'Y',
2542
+ '\u1EF6': 'Y',
2543
+ '\u1EF4': 'Y',
2544
+ '\u01B3': 'Y',
2545
+ '\u024E': 'Y',
2546
+ '\u1EFE': 'Y',
2547
+ '\u24CF': 'Z',
2548
+ '\uFF3A': 'Z',
2549
+ '\u0179': 'Z',
2550
+ '\u1E90': 'Z',
2551
+ '\u017B': 'Z',
2552
+ '\u017D': 'Z',
2553
+ '\u1E92': 'Z',
2554
+ '\u1E94': 'Z',
2555
+ '\u01B5': 'Z',
2556
+ '\u0224': 'Z',
2557
+ '\u2C7F': 'Z',
2558
+ '\u2C6B': 'Z',
2559
+ '\uA762': 'Z',
2560
+ '\u24D0': 'a',
2561
+ '\uFF41': 'a',
2562
+ '\u1E9A': 'a',
2563
+ '\u00E0': 'a',
2564
+ '\u00E1': 'a',
2565
+ '\u00E2': 'a',
2566
+ '\u1EA7': 'a',
2567
+ '\u1EA5': 'a',
2568
+ '\u1EAB': 'a',
2569
+ '\u1EA9': 'a',
2570
+ '\u00E3': 'a',
2571
+ '\u0101': 'a',
2572
+ '\u0103': 'a',
2573
+ '\u1EB1': 'a',
2574
+ '\u1EAF': 'a',
2575
+ '\u1EB5': 'a',
2576
+ '\u1EB3': 'a',
2577
+ '\u0227': 'a',
2578
+ '\u01E1': 'a',
2579
+ '\u00E4': 'a',
2580
+ '\u01DF': 'a',
2581
+ '\u1EA3': 'a',
2582
+ '\u00E5': 'a',
2583
+ '\u01FB': 'a',
2584
+ '\u01CE': 'a',
2585
+ '\u0201': 'a',
2586
+ '\u0203': 'a',
2587
+ '\u1EA1': 'a',
2588
+ '\u1EAD': 'a',
2589
+ '\u1EB7': 'a',
2590
+ '\u1E01': 'a',
2591
+ '\u0105': 'a',
2592
+ '\u2C65': 'a',
2593
+ '\u0250': 'a',
2594
+ '\uA733': 'aa',
2595
+ '\u00E6': 'ae',
2596
+ '\u01FD': 'ae',
2597
+ '\u01E3': 'ae',
2598
+ '\uA735': 'ao',
2599
+ '\uA737': 'au',
2600
+ '\uA739': 'av',
2601
+ '\uA73B': 'av',
2602
+ '\uA73D': 'ay',
2603
+ '\u24D1': 'b',
2604
+ '\uFF42': 'b',
2605
+ '\u1E03': 'b',
2606
+ '\u1E05': 'b',
2607
+ '\u1E07': 'b',
2608
+ '\u0180': 'b',
2609
+ '\u0183': 'b',
2610
+ '\u0253': 'b',
2611
+ '\u24D2': 'c',
2612
+ '\uFF43': 'c',
2613
+ '\u0107': 'c',
2614
+ '\u0109': 'c',
2615
+ '\u010B': 'c',
2616
+ '\u010D': 'c',
2617
+ '\u00E7': 'c',
2618
+ '\u1E09': 'c',
2619
+ '\u0188': 'c',
2620
+ '\u023C': 'c',
2621
+ '\uA73F': 'c',
2622
+ '\u2184': 'c',
2623
+ '\u24D3': 'd',
2624
+ '\uFF44': 'd',
2625
+ '\u1E0B': 'd',
2626
+ '\u010F': 'd',
2627
+ '\u1E0D': 'd',
2628
+ '\u1E11': 'd',
2629
+ '\u1E13': 'd',
2630
+ '\u1E0F': 'd',
2631
+ '\u0111': 'd',
2632
+ '\u018C': 'd',
2633
+ '\u0256': 'd',
2634
+ '\u0257': 'd',
2635
+ '\uA77A': 'd',
2636
+ '\u01F3': 'dz',
2637
+ '\u01C6': 'dz',
2638
+ '\u24D4': 'e',
2639
+ '\uFF45': 'e',
2640
+ '\u00E8': 'e',
2641
+ '\u00E9': 'e',
2642
+ '\u00EA': 'e',
2643
+ '\u1EC1': 'e',
2644
+ '\u1EBF': 'e',
2645
+ '\u1EC5': 'e',
2646
+ '\u1EC3': 'e',
2647
+ '\u1EBD': 'e',
2648
+ '\u0113': 'e',
2649
+ '\u1E15': 'e',
2650
+ '\u1E17': 'e',
2651
+ '\u0115': 'e',
2652
+ '\u0117': 'e',
2653
+ '\u00EB': 'e',
2654
+ '\u1EBB': 'e',
2655
+ '\u011B': 'e',
2656
+ '\u0205': 'e',
2657
+ '\u0207': 'e',
2658
+ '\u1EB9': 'e',
2659
+ '\u1EC7': 'e',
2660
+ '\u0229': 'e',
2661
+ '\u1E1D': 'e',
2662
+ '\u0119': 'e',
2663
+ '\u1E19': 'e',
2664
+ '\u1E1B': 'e',
2665
+ '\u0247': 'e',
2666
+ '\u025B': 'e',
2667
+ '\u01DD': 'e',
2668
+ '\u24D5': 'f',
2669
+ '\uFF46': 'f',
2670
+ '\u1E1F': 'f',
2671
+ '\u0192': 'f',
2672
+ '\uA77C': 'f',
2673
+ '\u24D6': 'g',
2674
+ '\uFF47': 'g',
2675
+ '\u01F5': 'g',
2676
+ '\u011D': 'g',
2677
+ '\u1E21': 'g',
2678
+ '\u011F': 'g',
2679
+ '\u0121': 'g',
2680
+ '\u01E7': 'g',
2681
+ '\u0123': 'g',
2682
+ '\u01E5': 'g',
2683
+ '\u0260': 'g',
2684
+ '\uA7A1': 'g',
2685
+ '\u1D79': 'g',
2686
+ '\uA77F': 'g',
2687
+ '\u24D7': 'h',
2688
+ '\uFF48': 'h',
2689
+ '\u0125': 'h',
2690
+ '\u1E23': 'h',
2691
+ '\u1E27': 'h',
2692
+ '\u021F': 'h',
2693
+ '\u1E25': 'h',
2694
+ '\u1E29': 'h',
2695
+ '\u1E2B': 'h',
2696
+ '\u1E96': 'h',
2697
+ '\u0127': 'h',
2698
+ '\u2C68': 'h',
2699
+ '\u2C76': 'h',
2700
+ '\u0265': 'h',
2701
+ '\u0195': 'hv',
2702
+ '\u24D8': 'i',
2703
+ '\uFF49': 'i',
2704
+ '\u00EC': 'i',
2705
+ '\u00ED': 'i',
2706
+ '\u00EE': 'i',
2707
+ '\u0129': 'i',
2708
+ '\u012B': 'i',
2709
+ '\u012D': 'i',
2710
+ '\u00EF': 'i',
2711
+ '\u1E2F': 'i',
2712
+ '\u1EC9': 'i',
2713
+ '\u01D0': 'i',
2714
+ '\u0209': 'i',
2715
+ '\u020B': 'i',
2716
+ '\u1ECB': 'i',
2717
+ '\u012F': 'i',
2718
+ '\u1E2D': 'i',
2719
+ '\u0268': 'i',
2720
+ '\u0131': 'i',
2721
+ '\u24D9': 'j',
2722
+ '\uFF4A': 'j',
2723
+ '\u0135': 'j',
2724
+ '\u01F0': 'j',
2725
+ '\u0249': 'j',
2726
+ '\u24DA': 'k',
2727
+ '\uFF4B': 'k',
2728
+ '\u1E31': 'k',
2729
+ '\u01E9': 'k',
2730
+ '\u1E33': 'k',
2731
+ '\u0137': 'k',
2732
+ '\u1E35': 'k',
2733
+ '\u0199': 'k',
2734
+ '\u2C6A': 'k',
2735
+ '\uA741': 'k',
2736
+ '\uA743': 'k',
2737
+ '\uA745': 'k',
2738
+ '\uA7A3': 'k',
2739
+ '\u24DB': 'l',
2740
+ '\uFF4C': 'l',
2741
+ '\u0140': 'l',
2742
+ '\u013A': 'l',
2743
+ '\u013E': 'l',
2744
+ '\u1E37': 'l',
2745
+ '\u1E39': 'l',
2746
+ '\u013C': 'l',
2747
+ '\u1E3D': 'l',
2748
+ '\u1E3B': 'l',
2749
+ '\u017F': 'l',
2750
+ '\u0142': 'l',
2751
+ '\u019A': 'l',
2752
+ '\u026B': 'l',
2753
+ '\u2C61': 'l',
2754
+ '\uA749': 'l',
2755
+ '\uA781': 'l',
2756
+ '\uA747': 'l',
2757
+ '\u01C9': 'lj',
2758
+ '\u24DC': 'm',
2759
+ '\uFF4D': 'm',
2760
+ '\u1E3F': 'm',
2761
+ '\u1E41': 'm',
2762
+ '\u1E43': 'm',
2763
+ '\u0271': 'm',
2764
+ '\u026F': 'm',
2765
+ '\u24DD': 'n',
2766
+ '\uFF4E': 'n',
2767
+ '\u01F9': 'n',
2768
+ '\u0144': 'n',
2769
+ '\u00F1': 'n',
2770
+ '\u1E45': 'n',
2771
+ '\u0148': 'n',
2772
+ '\u1E47': 'n',
2773
+ '\u0146': 'n',
2774
+ '\u1E4B': 'n',
2775
+ '\u1E49': 'n',
2776
+ '\u019E': 'n',
2777
+ '\u0272': 'n',
2778
+ '\u0149': 'n',
2779
+ '\uA791': 'n',
2780
+ '\uA7A5': 'n',
2781
+ '\u01CC': 'nj',
2782
+ '\u24DE': 'o',
2783
+ '\uFF4F': 'o',
2784
+ '\u00F2': 'o',
2785
+ '\u00F3': 'o',
2786
+ '\u00F4': 'o',
2787
+ '\u1ED3': 'o',
2788
+ '\u1ED1': 'o',
2789
+ '\u1ED7': 'o',
2790
+ '\u1ED5': 'o',
2791
+ '\u00F5': 'o',
2792
+ '\u1E4D': 'o',
2793
+ '\u022D': 'o',
2794
+ '\u1E4F': 'o',
2795
+ '\u014D': 'o',
2796
+ '\u1E51': 'o',
2797
+ '\u1E53': 'o',
2798
+ '\u014F': 'o',
2799
+ '\u022F': 'o',
2800
+ '\u0231': 'o',
2801
+ '\u00F6': 'o',
2802
+ '\u022B': 'o',
2803
+ '\u1ECF': 'o',
2804
+ '\u0151': 'o',
2805
+ '\u01D2': 'o',
2806
+ '\u020D': 'o',
2807
+ '\u020F': 'o',
2808
+ '\u01A1': 'o',
2809
+ '\u1EDD': 'o',
2810
+ '\u1EDB': 'o',
2811
+ '\u1EE1': 'o',
2812
+ '\u1EDF': 'o',
2813
+ '\u1EE3': 'o',
2814
+ '\u1ECD': 'o',
2815
+ '\u1ED9': 'o',
2816
+ '\u01EB': 'o',
2817
+ '\u01ED': 'o',
2818
+ '\u00F8': 'o',
2819
+ '\u01FF': 'o',
2820
+ '\u0254': 'o',
2821
+ '\uA74B': 'o',
2822
+ '\uA74D': 'o',
2823
+ '\u0275': 'o',
2824
+ '\u01A3': 'oi',
2825
+ '\u0223': 'ou',
2826
+ '\uA74F': 'oo',
2827
+ '\u24DF': 'p',
2828
+ '\uFF50': 'p',
2829
+ '\u1E55': 'p',
2830
+ '\u1E57': 'p',
2831
+ '\u01A5': 'p',
2832
+ '\u1D7D': 'p',
2833
+ '\uA751': 'p',
2834
+ '\uA753': 'p',
2835
+ '\uA755': 'p',
2836
+ '\u24E0': 'q',
2837
+ '\uFF51': 'q',
2838
+ '\u024B': 'q',
2839
+ '\uA757': 'q',
2840
+ '\uA759': 'q',
2841
+ '\u24E1': 'r',
2842
+ '\uFF52': 'r',
2843
+ '\u0155': 'r',
2844
+ '\u1E59': 'r',
2845
+ '\u0159': 'r',
2846
+ '\u0211': 'r',
2847
+ '\u0213': 'r',
2848
+ '\u1E5B': 'r',
2849
+ '\u1E5D': 'r',
2850
+ '\u0157': 'r',
2851
+ '\u1E5F': 'r',
2852
+ '\u024D': 'r',
2853
+ '\u027D': 'r',
2854
+ '\uA75B': 'r',
2855
+ '\uA7A7': 'r',
2856
+ '\uA783': 'r',
2857
+ '\u24E2': 's',
2858
+ '\uFF53': 's',
2859
+ '\u00DF': 's',
2860
+ '\u015B': 's',
2861
+ '\u1E65': 's',
2862
+ '\u015D': 's',
2863
+ '\u1E61': 's',
2864
+ '\u0161': 's',
2865
+ '\u1E67': 's',
2866
+ '\u1E63': 's',
2867
+ '\u1E69': 's',
2868
+ '\u0219': 's',
2869
+ '\u015F': 's',
2870
+ '\u023F': 's',
2871
+ '\uA7A9': 's',
2872
+ '\uA785': 's',
2873
+ '\u1E9B': 's',
2874
+ '\u24E3': 't',
2875
+ '\uFF54': 't',
2876
+ '\u1E6B': 't',
2877
+ '\u1E97': 't',
2878
+ '\u0165': 't',
2879
+ '\u1E6D': 't',
2880
+ '\u021B': 't',
2881
+ '\u0163': 't',
2882
+ '\u1E71': 't',
2883
+ '\u1E6F': 't',
2884
+ '\u0167': 't',
2885
+ '\u01AD': 't',
2886
+ '\u0288': 't',
2887
+ '\u2C66': 't',
2888
+ '\uA787': 't',
2889
+ '\uA729': 'tz',
2890
+ '\u24E4': 'u',
2891
+ '\uFF55': 'u',
2892
+ '\u00F9': 'u',
2893
+ '\u00FA': 'u',
2894
+ '\u00FB': 'u',
2895
+ '\u0169': 'u',
2896
+ '\u1E79': 'u',
2897
+ '\u016B': 'u',
2898
+ '\u1E7B': 'u',
2899
+ '\u016D': 'u',
2900
+ '\u00FC': 'u',
2901
+ '\u01DC': 'u',
2902
+ '\u01D8': 'u',
2903
+ '\u01D6': 'u',
2904
+ '\u01DA': 'u',
2905
+ '\u1EE7': 'u',
2906
+ '\u016F': 'u',
2907
+ '\u0171': 'u',
2908
+ '\u01D4': 'u',
2909
+ '\u0215': 'u',
2910
+ '\u0217': 'u',
2911
+ '\u01B0': 'u',
2912
+ '\u1EEB': 'u',
2913
+ '\u1EE9': 'u',
2914
+ '\u1EEF': 'u',
2915
+ '\u1EED': 'u',
2916
+ '\u1EF1': 'u',
2917
+ '\u1EE5': 'u',
2918
+ '\u1E73': 'u',
2919
+ '\u0173': 'u',
2920
+ '\u1E77': 'u',
2921
+ '\u1E75': 'u',
2922
+ '\u0289': 'u',
2923
+ '\u24E5': 'v',
2924
+ '\uFF56': 'v',
2925
+ '\u1E7D': 'v',
2926
+ '\u1E7F': 'v',
2927
+ '\u028B': 'v',
2928
+ '\uA75F': 'v',
2929
+ '\u028C': 'v',
2930
+ '\uA761': 'vy',
2931
+ '\u24E6': 'w',
2932
+ '\uFF57': 'w',
2933
+ '\u1E81': 'w',
2934
+ '\u1E83': 'w',
2935
+ '\u0175': 'w',
2936
+ '\u1E87': 'w',
2937
+ '\u1E85': 'w',
2938
+ '\u1E98': 'w',
2939
+ '\u1E89': 'w',
2940
+ '\u2C73': 'w',
2941
+ '\u24E7': 'x',
2942
+ '\uFF58': 'x',
2943
+ '\u1E8B': 'x',
2944
+ '\u1E8D': 'x',
2945
+ '\u24E8': 'y',
2946
+ '\uFF59': 'y',
2947
+ '\u1EF3': 'y',
2948
+ '\u00FD': 'y',
2949
+ '\u0177': 'y',
2950
+ '\u1EF9': 'y',
2951
+ '\u0233': 'y',
2952
+ '\u1E8F': 'y',
2953
+ '\u00FF': 'y',
2954
+ '\u1EF7': 'y',
2955
+ '\u1E99': 'y',
2956
+ '\u1EF5': 'y',
2957
+ '\u01B4': 'y',
2958
+ '\u024F': 'y',
2959
+ '\u1EFF': 'y',
2960
+ '\u24E9': 'z',
2961
+ '\uFF5A': 'z',
2962
+ '\u017A': 'z',
2963
+ '\u1E91': 'z',
2964
+ '\u017C': 'z',
2965
+ '\u017E': 'z',
2966
+ '\u1E93': 'z',
2967
+ '\u1E95': 'z',
2968
+ '\u01B6': 'z',
2969
+ '\u0225': 'z',
2970
+ '\u0240': 'z',
2971
+ '\u2C6C': 'z',
2972
+ '\uA763': 'z',
2973
+ '\u0386': '\u0391',
2974
+ '\u0388': '\u0395',
2975
+ '\u0389': '\u0397',
2976
+ '\u038A': '\u0399',
2977
+ '\u03AA': '\u0399',
2978
+ '\u038C': '\u039F',
2979
+ '\u038E': '\u03A5',
2980
+ '\u03AB': '\u03A5',
2981
+ '\u038F': '\u03A9',
2982
+ '\u03AC': '\u03B1',
2983
+ '\u03AD': '\u03B5',
2984
+ '\u03AE': '\u03B7',
2985
+ '\u03AF': '\u03B9',
2986
+ '\u03CA': '\u03B9',
2987
+ '\u0390': '\u03B9',
2988
+ '\u03CC': '\u03BF',
2989
+ '\u03CD': '\u03C5',
2990
+ '\u03CB': '\u03C5',
2991
+ '\u03B0': '\u03C5',
2992
+ '\u03C9': '\u03C9',
2993
+ '\u03C2': '\u03C3'
2994
+ };
2995
+
2996
+ return diacritics;
2997
+ });
2998
+
2999
+ S2.define('select2/data/base',[
3000
+ '../utils'
3001
+ ], function (Utils) {
3002
+ function BaseAdapter ($element, options) {
3003
+ BaseAdapter.__super__.constructor.call(this);
3004
+ }
3005
+
3006
+ Utils.Extend(BaseAdapter, Utils.Observable);
3007
+
3008
+ BaseAdapter.prototype.current = function (callback) {
3009
+ throw new Error('The `current` method must be defined in child classes.');
3010
+ };
3011
+
3012
+ BaseAdapter.prototype.query = function (params, callback) {
3013
+ throw new Error('The `query` method must be defined in child classes.');
3014
+ };
3015
+
3016
+ BaseAdapter.prototype.bind = function (container, $container) {
3017
+ // Can be implemented in subclasses
3018
+ };
3019
+
3020
+ BaseAdapter.prototype.destroy = function () {
3021
+ // Can be implemented in subclasses
3022
+ };
3023
+
3024
+ BaseAdapter.prototype.generateResultId = function (container, data) {
3025
+ var id = container.id + '-result-';
3026
+
3027
+ id += Utils.generateChars(4);
3028
+
3029
+ if (data.id != null) {
3030
+ id += '-' + data.id.toString();
3031
+ } else {
3032
+ id += '-' + Utils.generateChars(4);
3033
+ }
3034
+ return id;
3035
+ };
3036
+
3037
+ return BaseAdapter;
3038
+ });
3039
+
3040
+ S2.define('select2/data/select',[
3041
+ './base',
3042
+ '../utils',
3043
+ 'jquery'
3044
+ ], function (BaseAdapter, Utils, $) {
3045
+ function SelectAdapter ($element, options) {
3046
+ this.$element = $element;
3047
+ this.options = options;
3048
+
3049
+ SelectAdapter.__super__.constructor.call(this);
3050
+ }
3051
+
3052
+ Utils.Extend(SelectAdapter, BaseAdapter);
3053
+
3054
+ SelectAdapter.prototype.current = function (callback) {
3055
+ var data = [];
3056
+ var self = this;
3057
+
3058
+ this.$element.find(':selected').each(function () {
3059
+ var $option = $(this);
3060
+
3061
+ var option = self.item($option);
3062
+
3063
+ data.push(option);
3064
+ });
3065
+
3066
+ callback(data);
3067
+ };
3068
+
3069
+ SelectAdapter.prototype.select = function (data) {
3070
+ var self = this;
3071
+
3072
+ data.selected = true;
3073
+
3074
+ // If data.element is a DOM node, use it instead
3075
+ if ($(data.element).is('option')) {
3076
+ data.element.selected = true;
3077
+
3078
+ this.$element.trigger('change');
3079
+
3080
+ return;
3081
+ }
3082
+
3083
+ if (this.$element.prop('multiple')) {
3084
+ this.current(function (currentData) {
3085
+ var val = [];
3086
+
3087
+ data = [data];
3088
+ data.push.apply(data, currentData);
3089
+
3090
+ for (var d = 0; d < data.length; d++) {
3091
+ var id = data[d].id;
3092
+
3093
+ if ($.inArray(id, val) === -1) {
3094
+ val.push(id);
3095
+ }
3096
+ }
3097
+
3098
+ self.$element.val(val);
3099
+ self.$element.trigger('change');
3100
+ });
3101
+ } else {
3102
+ var val = data.id;
3103
+
3104
+ this.$element.val(val);
3105
+ this.$element.trigger('change');
3106
+ }
3107
+ };
3108
+
3109
+ SelectAdapter.prototype.unselect = function (data) {
3110
+ var self = this;
3111
+
3112
+ if (!this.$element.prop('multiple')) {
3113
+ return;
3114
+ }
3115
+
3116
+ data.selected = false;
3117
+
3118
+ if ($(data.element).is('option')) {
3119
+ data.element.selected = false;
3120
+
3121
+ this.$element.trigger('change');
3122
+
3123
+ return;
3124
+ }
3125
+
3126
+ this.current(function (currentData) {
3127
+ var val = [];
3128
+
3129
+ for (var d = 0; d < currentData.length; d++) {
3130
+ var id = currentData[d].id;
3131
+
3132
+ if (id !== data.id && $.inArray(id, val) === -1) {
3133
+ val.push(id);
3134
+ }
3135
+ }
3136
+
3137
+ self.$element.val(val);
3138
+
3139
+ self.$element.trigger('change');
3140
+ });
3141
+ };
3142
+
3143
+ SelectAdapter.prototype.bind = function (container, $container) {
3144
+ var self = this;
3145
+
3146
+ this.container = container;
3147
+
3148
+ container.on('select', function (params) {
3149
+ self.select(params.data);
3150
+ });
3151
+
3152
+ container.on('unselect', function (params) {
3153
+ self.unselect(params.data);
3154
+ });
3155
+ };
3156
+
3157
+ SelectAdapter.prototype.destroy = function () {
3158
+ // Remove anything added to child elements
3159
+ this.$element.find('*').each(function () {
3160
+ // Remove any custom data set by Select2
3161
+ $.removeData(this, 'data');
3162
+ });
3163
+ };
3164
+
3165
+ SelectAdapter.prototype.query = function (params, callback) {
3166
+ var data = [];
3167
+ var self = this;
3168
+
3169
+ var $options = this.$element.children();
3170
+
3171
+ $options.each(function () {
3172
+ var $option = $(this);
3173
+
3174
+ if (!$option.is('option') && !$option.is('optgroup')) {
3175
+ return;
3176
+ }
3177
+
3178
+ var option = self.item($option);
3179
+
3180
+ var matches = self.matches(params, option);
3181
+
3182
+ if (matches !== null) {
3183
+ data.push(matches);
3184
+ }
3185
+ });
3186
+
3187
+ callback({
3188
+ results: data
3189
+ });
3190
+ };
3191
+
3192
+ SelectAdapter.prototype.addOptions = function ($options) {
3193
+ Utils.appendMany(this.$element, $options);
3194
+ };
3195
+
3196
+ SelectAdapter.prototype.option = function (data) {
3197
+ var option;
3198
+
3199
+ if (data.children) {
3200
+ option = document.createElement('optgroup');
3201
+ option.label = data.text;
3202
+ } else {
3203
+ option = document.createElement('option');
3204
+
3205
+ if (option.textContent !== undefined) {
3206
+ option.textContent = data.text;
3207
+ } else {
3208
+ option.innerText = data.text;
3209
+ }
3210
+ }
3211
+
3212
+ if (data.id !== undefined) {
3213
+ option.value = data.id;
3214
+ }
3215
+
3216
+ if (data.disabled) {
3217
+ option.disabled = true;
3218
+ }
3219
+
3220
+ if (data.selected) {
3221
+ option.selected = true;
3222
+ }
3223
+
3224
+ if (data.title) {
3225
+ option.title = data.title;
3226
+ }
3227
+
3228
+ var $option = $(option);
3229
+
3230
+ var normalizedData = this._normalizeItem(data);
3231
+ normalizedData.element = option;
3232
+
3233
+ // Override the option's data with the combined data
3234
+ $.data(option, 'data', normalizedData);
3235
+
3236
+ return $option;
3237
+ };
3238
+
3239
+ SelectAdapter.prototype.item = function ($option) {
3240
+ var data = {};
3241
+
3242
+ data = $.data($option[0], 'data');
3243
+
3244
+ if (data != null) {
3245
+ return data;
3246
+ }
3247
+
3248
+ if ($option.is('option')) {
3249
+ data = {
3250
+ id: $option.val(),
3251
+ text: $option.text(),
3252
+ disabled: $option.prop('disabled'),
3253
+ selected: $option.prop('selected'),
3254
+ title: $option.prop('title')
3255
+ };
3256
+ } else if ($option.is('optgroup')) {
3257
+ data = {
3258
+ text: $option.prop('label'),
3259
+ children: [],
3260
+ title: $option.prop('title')
3261
+ };
3262
+
3263
+ var $children = $option.children('option');
3264
+ var children = [];
3265
+
3266
+ for (var c = 0; c < $children.length; c++) {
3267
+ var $child = $($children[c]);
3268
+
3269
+ var child = this.item($child);
3270
+
3271
+ children.push(child);
3272
+ }
3273
+
3274
+ data.children = children;
3275
+ }
3276
+
3277
+ data = this._normalizeItem(data);
3278
+ data.element = $option[0];
3279
+
3280
+ $.data($option[0], 'data', data);
3281
+
3282
+ return data;
3283
+ };
3284
+
3285
+ SelectAdapter.prototype._normalizeItem = function (item) {
3286
+ if (!$.isPlainObject(item)) {
3287
+ item = {
3288
+ id: item,
3289
+ text: item
3290
+ };
3291
+ }
3292
+
3293
+ item = $.extend({}, {
3294
+ text: ''
3295
+ }, item);
3296
+
3297
+ var defaults = {
3298
+ selected: false,
3299
+ disabled: false
3300
+ };
3301
+
3302
+ if (item.id != null) {
3303
+ item.id = item.id.toString();
3304
+ }
3305
+
3306
+ if (item.text != null) {
3307
+ item.text = item.text.toString();
3308
+ }
3309
+
3310
+ if (item._resultId == null && item.id && this.container != null) {
3311
+ item._resultId = this.generateResultId(this.container, item);
3312
+ }
3313
+
3314
+ return $.extend({}, defaults, item);
3315
+ };
3316
+
3317
+ SelectAdapter.prototype.matches = function (params, data) {
3318
+ var matcher = this.options.get('matcher');
3319
+
3320
+ return matcher(params, data);
3321
+ };
3322
+
3323
+ return SelectAdapter;
3324
+ });
3325
+
3326
+ S2.define('select2/data/array',[
3327
+ './select',
3328
+ '../utils',
3329
+ 'jquery'
3330
+ ], function (SelectAdapter, Utils, $) {
3331
+ function ArrayAdapter ($element, options) {
3332
+ var data = options.get('data') || [];
3333
+
3334
+ ArrayAdapter.__super__.constructor.call(this, $element, options);
3335
+
3336
+ this.addOptions(this.convertToOptions(data));
3337
+ }
3338
+
3339
+ Utils.Extend(ArrayAdapter, SelectAdapter);
3340
+
3341
+ ArrayAdapter.prototype.select = function (data) {
3342
+ var $option = this.$element.find('option').filter(function (i, elm) {
3343
+ return elm.value == data.id.toString();
3344
+ });
3345
+
3346
+ if ($option.length === 0) {
3347
+ $option = this.option(data);
3348
+
3349
+ this.addOptions($option);
3350
+ }
3351
+
3352
+ ArrayAdapter.__super__.select.call(this, data);
3353
+ };
3354
+
3355
+ ArrayAdapter.prototype.convertToOptions = function (data) {
3356
+ var self = this;
3357
+
3358
+ var $existing = this.$element.find('option');
3359
+ var existingIds = $existing.map(function () {
3360
+ return self.item($(this)).id;
3361
+ }).get();
3362
+
3363
+ var $options = [];
3364
+
3365
+ // Filter out all items except for the one passed in the argument
3366
+ function onlyItem (item) {
3367
+ return function () {
3368
+ return $(this).val() == item.id;
3369
+ };
3370
+ }
3371
+
3372
+ for (var d = 0; d < data.length; d++) {
3373
+ var item = this._normalizeItem(data[d]);
3374
+
3375
+ // Skip items which were pre-loaded, only merge the data
3376
+ if ($.inArray(item.id, existingIds) >= 0) {
3377
+ var $existingOption = $existing.filter(onlyItem(item));
3378
+
3379
+ var existingData = this.item($existingOption);
3380
+ var newData = $.extend(true, {}, item, existingData);
3381
+
3382
+ var $newOption = this.option(newData);
3383
+
3384
+ $existingOption.replaceWith($newOption);
3385
+
3386
+ continue;
3387
+ }
3388
+
3389
+ var $option = this.option(item);
3390
+
3391
+ if (item.children) {
3392
+ var $children = this.convertToOptions(item.children);
3393
+
3394
+ Utils.appendMany($option, $children);
3395
+ }
3396
+
3397
+ $options.push($option);
3398
+ }
3399
+
3400
+ return $options;
3401
+ };
3402
+
3403
+ return ArrayAdapter;
3404
+ });
3405
+
3406
+ S2.define('select2/data/ajax',[
3407
+ './array',
3408
+ '../utils',
3409
+ 'jquery'
3410
+ ], function (ArrayAdapter, Utils, $) {
3411
+ function AjaxAdapter ($element, options) {
3412
+ this.ajaxOptions = this._applyDefaults(options.get('ajax'));
3413
+
3414
+ if (this.ajaxOptions.processResults != null) {
3415
+ this.processResults = this.ajaxOptions.processResults;
3416
+ }
3417
+
3418
+ AjaxAdapter.__super__.constructor.call(this, $element, options);
3419
+ }
3420
+
3421
+ Utils.Extend(AjaxAdapter, ArrayAdapter);
3422
+
3423
+ AjaxAdapter.prototype._applyDefaults = function (options) {
3424
+ var defaults = {
3425
+ data: function (params) {
3426
+ return $.extend({}, params, {
3427
+ q: params.term
3428
+ });
3429
+ },
3430
+ transport: function (params, success, failure) {
3431
+ var $request = $.ajax(params);
3432
+
3433
+ $request.then(success);
3434
+ $request.fail(failure);
3435
+
3436
+ return $request;
3437
+ }
3438
+ };
3439
+
3440
+ return $.extend({}, defaults, options, true);
3441
+ };
3442
+
3443
+ AjaxAdapter.prototype.processResults = function (results) {
3444
+ return results;
3445
+ };
3446
+
3447
+ AjaxAdapter.prototype.query = function (params, callback) {
3448
+ var matches = [];
3449
+ var self = this;
3450
+
3451
+ if (this._request != null) {
3452
+ // JSONP requests cannot always be aborted
3453
+ if ($.isFunction(this._request.abort)) {
3454
+ this._request.abort();
3455
+ }
3456
+
3457
+ this._request = null;
3458
+ }
3459
+
3460
+ var options = $.extend({
3461
+ type: 'GET'
3462
+ }, this.ajaxOptions);
3463
+
3464
+ if (typeof options.url === 'function') {
3465
+ options.url = options.url.call(this.$element, params);
3466
+ }
3467
+
3468
+ if (typeof options.data === 'function') {
3469
+ options.data = options.data.call(this.$element, params);
3470
+ }
3471
+
3472
+ function request () {
3473
+ var $request = options.transport(options, function (data) {
3474
+ var results = self.processResults(data, params);
3475
+
3476
+ if (self.options.get('debug') && window.console && console.error) {
3477
+ // Check to make sure that the response included a `results` key.
3478
+ if (!results || !results.results || !$.isArray(results.results)) {
3479
+ console.error(
3480
+ 'Select2: The AJAX results did not return an array in the ' +
3481
+ '`results` key of the response.'
3482
+ );
3483
+ }
3484
+ }
3485
+
3486
+ callback(results);
3487
+ }, function () {
3488
+ // Attempt to detect if a request was aborted
3489
+ // Only works if the transport exposes a status property
3490
+ if ($request.status && $request.status === '0') {
3491
+ return;
3492
+ }
3493
+
3494
+ self.trigger('results:message', {
3495
+ message: 'errorLoading'
3496
+ });
3497
+ });
3498
+
3499
+ self._request = $request;
3500
+ }
3501
+
3502
+ if (this.ajaxOptions.delay && params.term != null) {
3503
+ if (this._queryTimeout) {
3504
+ window.clearTimeout(this._queryTimeout);
3505
+ }
3506
+
3507
+ this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);
3508
+ } else {
3509
+ request();
3510
+ }
3511
+ };
3512
+
3513
+ return AjaxAdapter;
3514
+ });
3515
+
3516
+ S2.define('select2/data/tags',[
3517
+ 'jquery'
3518
+ ], function ($) {
3519
+ function Tags (decorated, $element, options) {
3520
+ var tags = options.get('tags');
3521
+
3522
+ var createTag = options.get('createTag');
3523
+
3524
+ if (createTag !== undefined) {
3525
+ this.createTag = createTag;
3526
+ }
3527
+
3528
+ var insertTag = options.get('insertTag');
3529
+
3530
+ if (insertTag !== undefined) {
3531
+ this.insertTag = insertTag;
3532
+ }
3533
+
3534
+ decorated.call(this, $element, options);
3535
+
3536
+ if ($.isArray(tags)) {
3537
+ for (var t = 0; t < tags.length; t++) {
3538
+ var tag = tags[t];
3539
+ var item = this._normalizeItem(tag);
3540
+
3541
+ var $option = this.option(item);
3542
+
3543
+ this.$element.append($option);
3544
+ }
3545
+ }
3546
+ }
3547
+
3548
+ Tags.prototype.query = function (decorated, params, callback) {
3549
+ var self = this;
3550
+
3551
+ this._removeOldTags();
3552
+
3553
+ if (params.term == null || params.page != null) {
3554
+ decorated.call(this, params, callback);
3555
+ return;
3556
+ }
3557
+
3558
+ function wrapper (obj, child) {
3559
+ var data = obj.results;
3560
+
3561
+ for (var i = 0; i < data.length; i++) {
3562
+ var option = data[i];
3563
+
3564
+ var checkChildren = (
3565
+ option.children != null &&
3566
+ !wrapper({
3567
+ results: option.children
3568
+ }, true)
3569
+ );
3570
+
3571
+ var optionText = (option.text || '').toUpperCase();
3572
+ var paramsTerm = (params.term || '').toUpperCase();
3573
+
3574
+ var checkText = optionText === paramsTerm;
3575
+
3576
+ if (checkText || checkChildren) {
3577
+ if (child) {
3578
+ return false;
3579
+ }
3580
+
3581
+ obj.data = data;
3582
+ callback(obj);
3583
+
3584
+ return;
3585
+ }
3586
+ }
3587
+
3588
+ if (child) {
3589
+ return true;
3590
+ }
3591
+
3592
+ var tag = self.createTag(params);
3593
+
3594
+ if (tag != null) {
3595
+ var $option = self.option(tag);
3596
+ $option.attr('data-select2-tag', true);
3597
+
3598
+ self.addOptions([$option]);
3599
+
3600
+ self.insertTag(data, tag);
3601
+ }
3602
+
3603
+ obj.results = data;
3604
+
3605
+ callback(obj);
3606
+ }
3607
+
3608
+ decorated.call(this, params, wrapper);
3609
+ };
3610
+
3611
+ Tags.prototype.createTag = function (decorated, params) {
3612
+ var term = $.trim(params.term);
3613
+
3614
+ if (term === '') {
3615
+ return null;
3616
+ }
3617
+
3618
+ return {
3619
+ id: term,
3620
+ text: term
3621
+ };
3622
+ };
3623
+
3624
+ Tags.prototype.insertTag = function (_, data, tag) {
3625
+ data.unshift(tag);
3626
+ };
3627
+
3628
+ Tags.prototype._removeOldTags = function (_) {
3629
+ var tag = this._lastTag;
3630
+
3631
+ var $options = this.$element.find('option[data-select2-tag]');
3632
+
3633
+ $options.each(function () {
3634
+ if (this.selected) {
3635
+ return;
3636
+ }
3637
+
3638
+ $(this).remove();
3639
+ });
3640
+ };
3641
+
3642
+ return Tags;
3643
+ });
3644
+
3645
+ S2.define('select2/data/tokenizer',[
3646
+ 'jquery'
3647
+ ], function ($) {
3648
+ function Tokenizer (decorated, $element, options) {
3649
+ var tokenizer = options.get('tokenizer');
3650
+
3651
+ if (tokenizer !== undefined) {
3652
+ this.tokenizer = tokenizer;
3653
+ }
3654
+
3655
+ decorated.call(this, $element, options);
3656
+ }
3657
+
3658
+ Tokenizer.prototype.bind = function (decorated, container, $container) {
3659
+ decorated.call(this, container, $container);
3660
+
3661
+ this.$search = container.dropdown.$search || container.selection.$search ||
3662
+ $container.find('.select2-search__field');
3663
+ };
3664
+
3665
+ Tokenizer.prototype.query = function (decorated, params, callback) {
3666
+ var self = this;
3667
+
3668
+ function createAndSelect (data) {
3669
+ // Normalize the data object so we can use it for checks
3670
+ var item = self._normalizeItem(data);
3671
+
3672
+ // Check if the data object already exists as a tag
3673
+ // Select it if it doesn't
3674
+ var $existingOptions = self.$element.find('option').filter(function () {
3675
+ return $(this).val() === item.id;
3676
+ });
3677
+
3678
+ // If an existing option wasn't found for it, create the option
3679
+ if (!$existingOptions.length) {
3680
+ var $option = self.option(item);
3681
+ $option.attr('data-select2-tag', true);
3682
+
3683
+ self._removeOldTags();
3684
+ self.addOptions([$option]);
3685
+ }
3686
+
3687
+ // Select the item, now that we know there is an option for it
3688
+ select(item);
3689
+ }
3690
+
3691
+ function select (data) {
3692
+ self.trigger('select', {
3693
+ data: data
3694
+ });
3695
+ }
3696
+
3697
+ params.term = params.term || '';
3698
+
3699
+ var tokenData = this.tokenizer(params, this.options, createAndSelect);
3700
+
3701
+ if (tokenData.term !== params.term) {
3702
+ // Replace the search term if we have the search box
3703
+ if (this.$search.length) {
3704
+ this.$search.val(tokenData.term);
3705
+ this.$search.focus();
3706
+ }
3707
+
3708
+ params.term = tokenData.term;
3709
+ }
3710
+
3711
+ decorated.call(this, params, callback);
3712
+ };
3713
+
3714
+ Tokenizer.prototype.tokenizer = function (_, params, options, callback) {
3715
+ var separators = options.get('tokenSeparators') || [];
3716
+ var term = params.term;
3717
+ var i = 0;
3718
+
3719
+ var createTag = this.createTag || function (params) {
3720
+ return {
3721
+ id: params.term,
3722
+ text: params.term
3723
+ };
3724
+ };
3725
+
3726
+ while (i < term.length) {
3727
+ var termChar = term[i];
3728
+
3729
+ if ($.inArray(termChar, separators) === -1) {
3730
+ i++;
3731
+
3732
+ continue;
3733
+ }
3734
+
3735
+ var part = term.substr(0, i);
3736
+ var partParams = $.extend({}, params, {
3737
+ term: part
3738
+ });
3739
+
3740
+ var data = createTag(partParams);
3741
+
3742
+ if (data == null) {
3743
+ i++;
3744
+ continue;
3745
+ }
3746
+
3747
+ callback(data);
3748
+
3749
+ // Reset the term to not include the tokenized portion
3750
+ term = term.substr(i + 1) || '';
3751
+ i = 0;
3752
+ }
3753
+
3754
+ return {
3755
+ term: term
3756
+ };
3757
+ };
3758
+
3759
+ return Tokenizer;
3760
+ });
3761
+
3762
+ S2.define('select2/data/minimumInputLength',[
3763
+
3764
+ ], function () {
3765
+ function MinimumInputLength (decorated, $e, options) {
3766
+ this.minimumInputLength = options.get('minimumInputLength');
3767
+
3768
+ decorated.call(this, $e, options);
3769
+ }
3770
+
3771
+ MinimumInputLength.prototype.query = function (decorated, params, callback) {
3772
+ params.term = params.term || '';
3773
+
3774
+ if (params.term.length < this.minimumInputLength) {
3775
+ this.trigger('results:message', {
3776
+ message: 'inputTooShort',
3777
+ args: {
3778
+ minimum: this.minimumInputLength,
3779
+ input: params.term,
3780
+ params: params
3781
+ }
3782
+ });
3783
+
3784
+ return;
3785
+ }
3786
+
3787
+ decorated.call(this, params, callback);
3788
+ };
3789
+
3790
+ return MinimumInputLength;
3791
+ });
3792
+
3793
+ S2.define('select2/data/maximumInputLength',[
3794
+
3795
+ ], function () {
3796
+ function MaximumInputLength (decorated, $e, options) {
3797
+ this.maximumInputLength = options.get('maximumInputLength');
3798
+
3799
+ decorated.call(this, $e, options);
3800
+ }
3801
+
3802
+ MaximumInputLength.prototype.query = function (decorated, params, callback) {
3803
+ params.term = params.term || '';
3804
+
3805
+ if (this.maximumInputLength > 0 &&
3806
+ params.term.length > this.maximumInputLength) {
3807
+ this.trigger('results:message', {
3808
+ message: 'inputTooLong',
3809
+ args: {
3810
+ maximum: this.maximumInputLength,
3811
+ input: params.term,
3812
+ params: params
3813
+ }
3814
+ });
3815
+
3816
+ return;
3817
+ }
3818
+
3819
+ decorated.call(this, params, callback);
3820
+ };
3821
+
3822
+ return MaximumInputLength;
3823
+ });
3824
+
3825
+ S2.define('select2/data/maximumSelectionLength',[
3826
+
3827
+ ], function (){
3828
+ function MaximumSelectionLength (decorated, $e, options) {
3829
+ this.maximumSelectionLength = options.get('maximumSelectionLength');
3830
+
3831
+ decorated.call(this, $e, options);
3832
+ }
3833
+
3834
+ MaximumSelectionLength.prototype.query =
3835
+ function (decorated, params, callback) {
3836
+ var self = this;
3837
+
3838
+ this.current(function (currentData) {
3839
+ var count = currentData != null ? currentData.length : 0;
3840
+ if (self.maximumSelectionLength > 0 &&
3841
+ count >= self.maximumSelectionLength) {
3842
+ self.trigger('results:message', {
3843
+ message: 'maximumSelected',
3844
+ args: {
3845
+ maximum: self.maximumSelectionLength
3846
+ }
3847
+ });
3848
+ return;
3849
+ }
3850
+ decorated.call(self, params, callback);
3851
+ });
3852
+ };
3853
+
3854
+ return MaximumSelectionLength;
3855
+ });
3856
+
3857
+ S2.define('select2/dropdown',[
3858
+ 'jquery',
3859
+ './utils'
3860
+ ], function ($, Utils) {
3861
+ function Dropdown ($element, options) {
3862
+ this.$element = $element;
3863
+ this.options = options;
3864
+
3865
+ Dropdown.__super__.constructor.call(this);
3866
+ }
3867
+
3868
+ Utils.Extend(Dropdown, Utils.Observable);
3869
+
3870
+ Dropdown.prototype.render = function () {
3871
+ var $dropdown = $(
3872
+ '<span class="select2-dropdown">' +
3873
+ '<span class="select2-results"></span>' +
3874
+ '</span>'
3875
+ );
3876
+
3877
+ $dropdown.attr('dir', this.options.get('dir'));
3878
+
3879
+ this.$dropdown = $dropdown;
3880
+
3881
+ return $dropdown;
3882
+ };
3883
+
3884
+ Dropdown.prototype.bind = function () {
3885
+ // Should be implemented in subclasses
3886
+ };
3887
+
3888
+ Dropdown.prototype.position = function ($dropdown, $container) {
3889
+ // Should be implmented in subclasses
3890
+ };
3891
+
3892
+ Dropdown.prototype.destroy = function () {
3893
+ // Remove the dropdown from the DOM
3894
+ this.$dropdown.remove();
3895
+ };
3896
+
3897
+ return Dropdown;
3898
+ });
3899
+
3900
+ S2.define('select2/dropdown/search',[
3901
+ 'jquery',
3902
+ '../utils'
3903
+ ], function ($, Utils) {
3904
+ function Search () { }
3905
+
3906
+ Search.prototype.render = function (decorated) {
3907
+ var $rendered = decorated.call(this);
3908
+
3909
+ var $search = $(
3910
+ '<span class="select2-search select2-search--dropdown">' +
3911
+ '<input class="select2-search__field" type="search" tabindex="-1"' +
3912
+ ' autocomplete="off" autocorrect="off" autocapitalize="none"' +
3913
+ ' spellcheck="false" role="textbox" />' +
3914
+ '</span>'
3915
+ );
3916
+
3917
+ this.$searchContainer = $search;
3918
+ this.$search = $search.find('input');
3919
+
3920
+ $rendered.prepend($search);
3921
+
3922
+ return $rendered;
3923
+ };
3924
+
3925
+ Search.prototype.bind = function (decorated, container, $container) {
3926
+ var self = this;
3927
+
3928
+ decorated.call(this, container, $container);
3929
+
3930
+ this.$search.on('keydown', function (evt) {
3931
+ self.trigger('keypress', evt);
3932
+
3933
+ self._keyUpPrevented = evt.isDefaultPrevented();
3934
+ });
3935
+
3936
+ // Workaround for browsers which do not support the `input` event
3937
+ // This will prevent double-triggering of events for browsers which support
3938
+ // both the `keyup` and `input` events.
3939
+ this.$search.on('input', function (evt) {
3940
+ // Unbind the duplicated `keyup` event
3941
+ $(this).off('keyup');
3942
+ });
3943
+
3944
+ this.$search.on('keyup input', function (evt) {
3945
+ self.handleSearch(evt);
3946
+ });
3947
+
3948
+ container.on('open', function () {
3949
+ self.$search.attr('tabindex', 0);
3950
+
3951
+ self.$search.focus();
3952
+
3953
+ window.setTimeout(function () {
3954
+ self.$search.focus();
3955
+ }, 0);
3956
+ });
3957
+
3958
+ container.on('close', function () {
3959
+ self.$search.attr('tabindex', -1);
3960
+
3961
+ self.$search.val('');
3962
+ });
3963
+
3964
+ container.on('focus', function () {
3965
+ if (!container.isOpen()) {
3966
+ self.$search.focus();
3967
+ }
3968
+ });
3969
+
3970
+ container.on('results:all', function (params) {
3971
+ if (params.query.term == null || params.query.term === '') {
3972
+ var showSearch = self.showSearch(params);
3973
+
3974
+ if (showSearch) {
3975
+ self.$searchContainer.removeClass('select2-search--hide');
3976
+ } else {
3977
+ self.$searchContainer.addClass('select2-search--hide');
3978
+ }
3979
+ }
3980
+ });
3981
+ };
3982
+
3983
+ Search.prototype.handleSearch = function (evt) {
3984
+ if (!this._keyUpPrevented) {
3985
+ var input = this.$search.val();
3986
+
3987
+ this.trigger('query', {
3988
+ term: input
3989
+ });
3990
+ }
3991
+
3992
+ this._keyUpPrevented = false;
3993
+ };
3994
+
3995
+ Search.prototype.showSearch = function (_, params) {
3996
+ return true;
3997
+ };
3998
+
3999
+ return Search;
4000
+ });
4001
+
4002
+ S2.define('select2/dropdown/hidePlaceholder',[
4003
+
4004
+ ], function () {
4005
+ function HidePlaceholder (decorated, $element, options, dataAdapter) {
4006
+ this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
4007
+
4008
+ decorated.call(this, $element, options, dataAdapter);
4009
+ }
4010
+
4011
+ HidePlaceholder.prototype.append = function (decorated, data) {
4012
+ data.results = this.removePlaceholder(data.results);
4013
+
4014
+ decorated.call(this, data);
4015
+ };
4016
+
4017
+ HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {
4018
+ if (typeof placeholder === 'string') {
4019
+ placeholder = {
4020
+ id: '',
4021
+ text: placeholder
4022
+ };
4023
+ }
4024
+
4025
+ return placeholder;
4026
+ };
4027
+
4028
+ HidePlaceholder.prototype.removePlaceholder = function (_, data) {
4029
+ var modifiedData = data.slice(0);
4030
+
4031
+ for (var d = data.length - 1; d >= 0; d--) {
4032
+ var item = data[d];
4033
+
4034
+ if (this.placeholder.id === item.id) {
4035
+ modifiedData.splice(d, 1);
4036
+ }
4037
+ }
4038
+
4039
+ return modifiedData;
4040
+ };
4041
+
4042
+ return HidePlaceholder;
4043
+ });
4044
+
4045
+ S2.define('select2/dropdown/infiniteScroll',[
4046
+ 'jquery'
4047
+ ], function ($) {
4048
+ function InfiniteScroll (decorated, $element, options, dataAdapter) {
4049
+ this.lastParams = {};
4050
+
4051
+ decorated.call(this, $element, options, dataAdapter);
4052
+
4053
+ this.$loadingMore = this.createLoadingMore();
4054
+ this.loading = false;
4055
+ }
4056
+
4057
+ InfiniteScroll.prototype.append = function (decorated, data) {
4058
+ this.$loadingMore.remove();
4059
+ this.loading = false;
4060
+
4061
+ decorated.call(this, data);
4062
+
4063
+ if (this.showLoadingMore(data)) {
4064
+ this.$results.append(this.$loadingMore);
4065
+ }
4066
+ };
4067
+
4068
+ InfiniteScroll.prototype.bind = function (decorated, container, $container) {
4069
+ var self = this;
4070
+
4071
+ decorated.call(this, container, $container);
4072
+
4073
+ container.on('query', function (params) {
4074
+ self.lastParams = params;
4075
+ self.loading = true;
4076
+ });
4077
+
4078
+ container.on('query:append', function (params) {
4079
+ self.lastParams = params;
4080
+ self.loading = true;
4081
+ });
4082
+
4083
+ this.$results.on('scroll', function () {
4084
+ var isLoadMoreVisible = $.contains(
4085
+ document.documentElement,
4086
+ self.$loadingMore[0]
4087
+ );
4088
+
4089
+ if (self.loading || !isLoadMoreVisible) {
4090
+ return;
4091
+ }
4092
+
4093
+ var currentOffset = self.$results.offset().top +
4094
+ self.$results.outerHeight(false);
4095
+ var loadingMoreOffset = self.$loadingMore.offset().top +
4096
+ self.$loadingMore.outerHeight(false);
4097
+
4098
+ if (currentOffset + 50 >= loadingMoreOffset) {
4099
+ self.loadMore();
4100
+ }
4101
+ });
4102
+ };
4103
+
4104
+ InfiniteScroll.prototype.loadMore = function () {
4105
+ this.loading = true;
4106
+
4107
+ var params = $.extend({}, {page: 1}, this.lastParams);
4108
+
4109
+ params.page++;
4110
+
4111
+ this.trigger('query:append', params);
4112
+ };
4113
+
4114
+ InfiniteScroll.prototype.showLoadingMore = function (_, data) {
4115
+ return data.pagination && data.pagination.more;
4116
+ };
4117
+
4118
+ InfiniteScroll.prototype.createLoadingMore = function () {
4119
+ var $option = $(
4120
+ '<li ' +
4121
+ 'class="select2-results__option select2-results__option--load-more"' +
4122
+ 'role="treeitem" aria-disabled="true"></li>'
4123
+ );
4124
+
4125
+ var message = this.options.get('translations').get('loadingMore');
4126
+
4127
+ $option.html(message(this.lastParams));
4128
+
4129
+ return $option;
4130
+ };
4131
+
4132
+ return InfiniteScroll;
4133
+ });
4134
+
4135
+ S2.define('select2/dropdown/attachBody',[
4136
+ 'jquery',
4137
+ '../utils'
4138
+ ], function ($, Utils) {
4139
+ function AttachBody (decorated, $element, options) {
4140
+ this.$dropdownParent = options.get('dropdownParent') || $(document.body);
4141
+
4142
+ decorated.call(this, $element, options);
4143
+ }
4144
+
4145
+ AttachBody.prototype.bind = function (decorated, container, $container) {
4146
+ var self = this;
4147
+
4148
+ var setupResultsEvents = false;
4149
+
4150
+ decorated.call(this, container, $container);
4151
+
4152
+ container.on('open', function () {
4153
+ self._showDropdown();
4154
+ self._attachPositioningHandler(container);
4155
+
4156
+ if (!setupResultsEvents) {
4157
+ setupResultsEvents = true;
4158
+
4159
+ container.on('results:all', function () {
4160
+ self._positionDropdown();
4161
+ self._resizeDropdown();
4162
+ });
4163
+
4164
+ container.on('results:append', function () {
4165
+ self._positionDropdown();
4166
+ self._resizeDropdown();
4167
+ });
4168
+ }
4169
+ });
4170
+
4171
+ container.on('close', function () {
4172
+ self._hideDropdown();
4173
+ self._detachPositioningHandler(container);
4174
+ });
4175
+
4176
+ this.$dropdownContainer.on('mousedown', function (evt) {
4177
+ evt.stopPropagation();
4178
+ });
4179
+ };
4180
+
4181
+ AttachBody.prototype.destroy = function (decorated) {
4182
+ decorated.call(this);
4183
+
4184
+ this.$dropdownContainer.remove();
4185
+ };
4186
+
4187
+ AttachBody.prototype.position = function (decorated, $dropdown, $container) {
4188
+ // Clone all of the container classes
4189
+ $dropdown.attr('class', $container.attr('class'));
4190
+
4191
+ $dropdown.removeClass('select2');
4192
+ $dropdown.addClass('select2-container--open');
4193
+
4194
+ $dropdown.css({
4195
+ position: 'absolute',
4196
+ top: -999999
4197
+ });
4198
+
4199
+ this.$container = $container;
4200
+ };
4201
+
4202
+ AttachBody.prototype.render = function (decorated) {
4203
+ var $container = $('<span></span>');
4204
+
4205
+ var $dropdown = decorated.call(this);
4206
+ $container.append($dropdown);
4207
+
4208
+ this.$dropdownContainer = $container;
4209
+
4210
+ return $container;
4211
+ };
4212
+
4213
+ AttachBody.prototype._hideDropdown = function (decorated) {
4214
+ this.$dropdownContainer.detach();
4215
+ };
4216
+
4217
+ AttachBody.prototype._attachPositioningHandler =
4218
+ function (decorated, container) {
4219
+ var self = this;
4220
+
4221
+ var scrollEvent = 'scroll.select2.' + container.id;
4222
+ var resizeEvent = 'resize.select2.' + container.id;
4223
+ var orientationEvent = 'orientationchange.select2.' + container.id;
4224
+
4225
+ var $watchers = this.$container.parents().filter(Utils.hasScroll);
4226
+ $watchers.each(function () {
4227
+ $(this).data('select2-scroll-position', {
4228
+ x: $(this).scrollLeft(),
4229
+ y: $(this).scrollTop()
4230
+ });
4231
+ });
4232
+
4233
+ $watchers.on(scrollEvent, function (ev) {
4234
+ var position = $(this).data('select2-scroll-position');
4235
+ $(this).scrollTop(position.y);
4236
+ });
4237
+
4238
+ $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,
4239
+ function (e) {
4240
+ self._positionDropdown();
4241
+ self._resizeDropdown();
4242
+ });
4243
+ };
4244
+
4245
+ AttachBody.prototype._detachPositioningHandler =
4246
+ function (decorated, container) {
4247
+ var scrollEvent = 'scroll.select2.' + container.id;
4248
+ var resizeEvent = 'resize.select2.' + container.id;
4249
+ var orientationEvent = 'orientationchange.select2.' + container.id;
4250
+
4251
+ var $watchers = this.$container.parents().filter(Utils.hasScroll);
4252
+ $watchers.off(scrollEvent);
4253
+
4254
+ $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);
4255
+ };
4256
+
4257
+ AttachBody.prototype._positionDropdown = function () {
4258
+ var $window = $(window);
4259
+
4260
+ var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above');
4261
+ var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below');
4262
+
4263
+ var newDirection = null;
4264
+
4265
+ var offset = this.$container.offset();
4266
+
4267
+ offset.bottom = offset.top + this.$container.outerHeight(false);
4268
+
4269
+ var container = {
4270
+ height: this.$container.outerHeight(false)
4271
+ };
4272
+
4273
+ container.top = offset.top;
4274
+ container.bottom = offset.top + container.height;
4275
+
4276
+ var dropdown = {
4277
+ height: this.$dropdown.outerHeight(false)
4278
+ };
4279
+
4280
+ var viewport = {
4281
+ top: $window.scrollTop(),
4282
+ bottom: $window.scrollTop() + $window.height()
4283
+ };
4284
+
4285
+ var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);
4286
+ var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);
4287
+
4288
+ var css = {
4289
+ left: offset.left,
4290
+ top: container.bottom
4291
+ };
4292
+
4293
+ // Determine what the parent element is to use for calciulating the offset
4294
+ var $offsetParent = this.$dropdownParent;
4295
+
4296
+ // For statically positoned elements, we need to get the element
4297
+ // that is determining the offset
4298
+ if ($offsetParent.css('position') === 'static') {
4299
+ $offsetParent = $offsetParent.offsetParent();
4300
+ }
4301
+
4302
+ var parentOffset = $offsetParent.offset();
4303
+
4304
+ css.top -= parentOffset.top;
4305
+ css.left -= parentOffset.left;
4306
+
4307
+ if (!isCurrentlyAbove && !isCurrentlyBelow) {
4308
+ newDirection = 'below';
4309
+ }
4310
+
4311
+ if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {
4312
+ newDirection = 'above';
4313
+ } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {
4314
+ newDirection = 'below';
4315
+ }
4316
+
4317
+ if (newDirection == 'above' ||
4318
+ (isCurrentlyAbove && newDirection !== 'below')) {
4319
+ css.top = container.top - parentOffset.top - dropdown.height;
4320
+ }
4321
+
4322
+ if (newDirection != null) {
4323
+ this.$dropdown
4324
+ .removeClass('select2-dropdown--below select2-dropdown--above')
4325
+ .addClass('select2-dropdown--' + newDirection);
4326
+ this.$container
4327
+ .removeClass('select2-container--below select2-container--above')
4328
+ .addClass('select2-container--' + newDirection);
4329
+ }
4330
+
4331
+ this.$dropdownContainer.css(css);
4332
+ };
4333
+
4334
+ AttachBody.prototype._resizeDropdown = function () {
4335
+ var css = {
4336
+ width: this.$container.outerWidth(false) + 'px'
4337
+ };
4338
+
4339
+ if (this.options.get('dropdownAutoWidth')) {
4340
+ css.minWidth = css.width;
4341
+ css.position = 'relative';
4342
+ css.width = 'auto';
4343
+ }
4344
+
4345
+ this.$dropdown.css(css);
4346
+ };
4347
+
4348
+ AttachBody.prototype._showDropdown = function (decorated) {
4349
+ this.$dropdownContainer.appendTo(this.$dropdownParent);
4350
+
4351
+ this._positionDropdown();
4352
+ this._resizeDropdown();
4353
+ };
4354
+
4355
+ return AttachBody;
4356
+ });
4357
+
4358
+ S2.define('select2/dropdown/minimumResultsForSearch',[
4359
+
4360
+ ], function () {
4361
+ function countResults (data) {
4362
+ var count = 0;
4363
+
4364
+ for (var d = 0; d < data.length; d++) {
4365
+ var item = data[d];
4366
+
4367
+ if (item.children) {
4368
+ count += countResults(item.children);
4369
+ } else {
4370
+ count++;
4371
+ }
4372
+ }
4373
+
4374
+ return count;
4375
+ }
4376
+
4377
+ function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {
4378
+ this.minimumResultsForSearch = options.get('minimumResultsForSearch');
4379
+
4380
+ if (this.minimumResultsForSearch < 0) {
4381
+ this.minimumResultsForSearch = Infinity;
4382
+ }
4383
+
4384
+ decorated.call(this, $element, options, dataAdapter);
4385
+ }
4386
+
4387
+ MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {
4388
+ if (countResults(params.data.results) < this.minimumResultsForSearch) {
4389
+ return false;
4390
+ }
4391
+
4392
+ return decorated.call(this, params);
4393
+ };
4394
+
4395
+ return MinimumResultsForSearch;
4396
+ });
4397
+
4398
+ S2.define('select2/dropdown/selectOnClose',[
4399
+
4400
+ ], function () {
4401
+ function SelectOnClose () { }
4402
+
4403
+ SelectOnClose.prototype.bind = function (decorated, container, $container) {
4404
+ var self = this;
4405
+
4406
+ decorated.call(this, container, $container);
4407
+
4408
+ container.on('close', function (params) {
4409
+ self._handleSelectOnClose(params);
4410
+ });
4411
+ };
4412
+
4413
+ SelectOnClose.prototype._handleSelectOnClose = function (_, params) {
4414
+ if (params && params.originalSelect2Event != null) {
4415
+ var event = params.originalSelect2Event;
4416
+
4417
+ // Don't select an item if the close event was triggered from a select or
4418
+ // unselect event
4419
+ if (event._type === 'select' || event._type === 'unselect') {
4420
+ return;
4421
+ }
4422
+ }
4423
+
4424
+ var $highlightedResults = this.getHighlightedResults();
4425
+
4426
+ // Only select highlighted results
4427
+ if ($highlightedResults.length < 1) {
4428
+ return;
4429
+ }
4430
+
4431
+ var data = $highlightedResults.data('data');
4432
+
4433
+ // Don't re-select already selected resulte
4434
+ if (
4435
+ (data.element != null && data.element.selected) ||
4436
+ (data.element == null && data.selected)
4437
+ ) {
4438
+ return;
4439
+ }
4440
+
4441
+ this.trigger('select', {
4442
+ data: data
4443
+ });
4444
+ };
4445
+
4446
+ return SelectOnClose;
4447
+ });
4448
+
4449
+ S2.define('select2/dropdown/closeOnSelect',[
4450
+
4451
+ ], function () {
4452
+ function CloseOnSelect () { }
4453
+
4454
+ CloseOnSelect.prototype.bind = function (decorated, container, $container) {
4455
+ var self = this;
4456
+
4457
+ decorated.call(this, container, $container);
4458
+
4459
+ container.on('select', function (evt) {
4460
+ self._selectTriggered(evt);
4461
+ });
4462
+
4463
+ container.on('unselect', function (evt) {
4464
+ self._selectTriggered(evt);
4465
+ });
4466
+ };
4467
+
4468
+ CloseOnSelect.prototype._selectTriggered = function (_, evt) {
4469
+ var originalEvent = evt.originalEvent;
4470
+
4471
+ // Don't close if the control key is being held
4472
+ if (originalEvent && originalEvent.ctrlKey) {
4473
+ return;
4474
+ }
4475
+
4476
+ this.trigger('close', {
4477
+ originalEvent: originalEvent,
4478
+ originalSelect2Event: evt
4479
+ });
4480
+ };
4481
+
4482
+ return CloseOnSelect;
4483
+ });
4484
+
4485
+ S2.define('select2/i18n/en',[],function () {
4486
+ // English
4487
+ return {
4488
+ errorLoading: function () {
4489
+ return 'The results could not be loaded.';
4490
+ },
4491
+ inputTooLong: function (args) {
4492
+ var overChars = args.input.length - args.maximum;
4493
+
4494
+ var message = 'Please delete ' + overChars + ' character';
4495
+
4496
+ if (overChars != 1) {
4497
+ message += 's';
4498
+ }
4499
+
4500
+ return message;
4501
+ },
4502
+ inputTooShort: function (args) {
4503
+ var remainingChars = args.minimum - args.input.length;
4504
+
4505
+ var message = 'Please enter ' + remainingChars + ' or more characters';
4506
+
4507
+ return message;
4508
+ },
4509
+ loadingMore: function () {
4510
+ return 'Loading more results…';
4511
+ },
4512
+ maximumSelected: function (args) {
4513
+ var message = 'You can only select ' + args.maximum + ' item';
4514
+
4515
+ if (args.maximum != 1) {
4516
+ message += 's';
4517
+ }
4518
+
4519
+ return message;
4520
+ },
4521
+ noResults: function () {
4522
+ return 'No results found';
4523
+ },
4524
+ searching: function () {
4525
+ return 'Searching…';
4526
+ }
4527
+ };
4528
+ });
4529
+
4530
+ S2.define('select2/defaults',[
4531
+ 'jquery',
4532
+ 'require',
4533
+
4534
+ './results',
4535
+
4536
+ './selection/single',
4537
+ './selection/multiple',
4538
+ './selection/placeholder',
4539
+ './selection/allowClear',
4540
+ './selection/search',
4541
+ './selection/eventRelay',
4542
+
4543
+ './utils',
4544
+ './translation',
4545
+ './diacritics',
4546
+
4547
+ './data/select',
4548
+ './data/array',
4549
+ './data/ajax',
4550
+ './data/tags',
4551
+ './data/tokenizer',
4552
+ './data/minimumInputLength',
4553
+ './data/maximumInputLength',
4554
+ './data/maximumSelectionLength',
4555
+
4556
+ './dropdown',
4557
+ './dropdown/search',
4558
+ './dropdown/hidePlaceholder',
4559
+ './dropdown/infiniteScroll',
4560
+ './dropdown/attachBody',
4561
+ './dropdown/minimumResultsForSearch',
4562
+ './dropdown/selectOnClose',
4563
+ './dropdown/closeOnSelect',
4564
+
4565
+ './i18n/en'
4566
+ ], function ($, require,
4567
+
4568
+ ResultsList,
4569
+
4570
+ SingleSelection, MultipleSelection, Placeholder, AllowClear,
4571
+ SelectionSearch, EventRelay,
4572
+
4573
+ Utils, Translation, DIACRITICS,
4574
+
4575
+ SelectData, ArrayData, AjaxData, Tags, Tokenizer,
4576
+ MinimumInputLength, MaximumInputLength, MaximumSelectionLength,
4577
+
4578
+ Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
4579
+ AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,
4580
+
4581
+ EnglishTranslation) {
4582
+ function Defaults () {
4583
+ this.reset();
4584
+ }
4585
+
4586
+ Defaults.prototype.apply = function (options) {
4587
+ options = $.extend(true, {}, this.defaults, options);
4588
+
4589
+ if (options.dataAdapter == null) {
4590
+ if (options.ajax != null) {
4591
+ options.dataAdapter = AjaxData;
4592
+ } else if (options.data != null) {
4593
+ options.dataAdapter = ArrayData;
4594
+ } else {
4595
+ options.dataAdapter = SelectData;
4596
+ }
4597
+
4598
+ if (options.minimumInputLength > 0) {
4599
+ options.dataAdapter = Utils.Decorate(
4600
+ options.dataAdapter,
4601
+ MinimumInputLength
4602
+ );
4603
+ }
4604
+
4605
+ if (options.maximumInputLength > 0) {
4606
+ options.dataAdapter = Utils.Decorate(
4607
+ options.dataAdapter,
4608
+ MaximumInputLength
4609
+ );
4610
+ }
4611
+
4612
+ if (options.maximumSelectionLength > 0) {
4613
+ options.dataAdapter = Utils.Decorate(
4614
+ options.dataAdapter,
4615
+ MaximumSelectionLength
4616
+ );
4617
+ }
4618
+
4619
+ if (options.tags) {
4620
+ options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);
4621
+ }
4622
+
4623
+ if (options.tokenSeparators != null || options.tokenizer != null) {
4624
+ options.dataAdapter = Utils.Decorate(
4625
+ options.dataAdapter,
4626
+ Tokenizer
4627
+ );
4628
+ }
4629
+
4630
+ if (options.query != null) {
4631
+ var Query = require(options.amdBase + 'compat/query');
4632
+
4633
+ options.dataAdapter = Utils.Decorate(
4634
+ options.dataAdapter,
4635
+ Query
4636
+ );
4637
+ }
4638
+
4639
+ if (options.initSelection != null) {
4640
+ var InitSelection = require(options.amdBase + 'compat/initSelection');
4641
+
4642
+ options.dataAdapter = Utils.Decorate(
4643
+ options.dataAdapter,
4644
+ InitSelection
4645
+ );
4646
+ }
4647
+ }
4648
+
4649
+ if (options.resultsAdapter == null) {
4650
+ options.resultsAdapter = ResultsList;
4651
+
4652
+ if (options.ajax != null) {
4653
+ options.resultsAdapter = Utils.Decorate(
4654
+ options.resultsAdapter,
4655
+ InfiniteScroll
4656
+ );
4657
+ }
4658
+
4659
+ if (options.placeholder != null) {
4660
+ options.resultsAdapter = Utils.Decorate(
4661
+ options.resultsAdapter,
4662
+ HidePlaceholder
4663
+ );
4664
+ }
4665
+
4666
+ if (options.selectOnClose) {
4667
+ options.resultsAdapter = Utils.Decorate(
4668
+ options.resultsAdapter,
4669
+ SelectOnClose
4670
+ );
4671
+ }
4672
+ }
4673
+
4674
+ if (options.dropdownAdapter == null) {
4675
+ if (options.multiple) {
4676
+ options.dropdownAdapter = Dropdown;
4677
+ } else {
4678
+ var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);
4679
+
4680
+ options.dropdownAdapter = SearchableDropdown;
4681
+ }
4682
+
4683
+ if (options.minimumResultsForSearch !== 0) {
4684
+ options.dropdownAdapter = Utils.Decorate(
4685
+ options.dropdownAdapter,
4686
+ MinimumResultsForSearch
4687
+ );
4688
+ }
4689
+
4690
+ if (options.closeOnSelect) {
4691
+ options.dropdownAdapter = Utils.Decorate(
4692
+ options.dropdownAdapter,
4693
+ CloseOnSelect
4694
+ );
4695
+ }
4696
+
4697
+ if (
4698
+ options.dropdownCssClass != null ||
4699
+ options.dropdownCss != null ||
4700
+ options.adaptDropdownCssClass != null
4701
+ ) {
4702
+ var DropdownCSS = require(options.amdBase + 'compat/dropdownCss');
4703
+
4704
+ options.dropdownAdapter = Utils.Decorate(
4705
+ options.dropdownAdapter,
4706
+ DropdownCSS
4707
+ );
4708
+ }
4709
+
4710
+ options.dropdownAdapter = Utils.Decorate(
4711
+ options.dropdownAdapter,
4712
+ AttachBody
4713
+ );
4714
+ }
4715
+
4716
+ if (options.selectionAdapter == null) {
4717
+ if (options.multiple) {
4718
+ options.selectionAdapter = MultipleSelection;
4719
+ } else {
4720
+ options.selectionAdapter = SingleSelection;
4721
+ }
4722
+
4723
+ // Add the placeholder mixin if a placeholder was specified
4724
+ if (options.placeholder != null) {
4725
+ options.selectionAdapter = Utils.Decorate(
4726
+ options.selectionAdapter,
4727
+ Placeholder
4728
+ );
4729
+ }
4730
+
4731
+ if (options.allowClear) {
4732
+ options.selectionAdapter = Utils.Decorate(
4733
+ options.selectionAdapter,
4734
+ AllowClear
4735
+ );
4736
+ }
4737
+
4738
+ if (options.multiple) {
4739
+ options.selectionAdapter = Utils.Decorate(
4740
+ options.selectionAdapter,
4741
+ SelectionSearch
4742
+ );
4743
+ }
4744
+
4745
+ if (
4746
+ options.containerCssClass != null ||
4747
+ options.containerCss != null ||
4748
+ options.adaptContainerCssClass != null
4749
+ ) {
4750
+ var ContainerCSS = require(options.amdBase + 'compat/containerCss');
4751
+
4752
+ options.selectionAdapter = Utils.Decorate(
4753
+ options.selectionAdapter,
4754
+ ContainerCSS
4755
+ );
4756
+ }
4757
+
4758
+ options.selectionAdapter = Utils.Decorate(
4759
+ options.selectionAdapter,
4760
+ EventRelay
4761
+ );
4762
+ }
4763
+
4764
+ if (typeof options.language === 'string') {
4765
+ // Check if the language is specified with a region
4766
+ if (options.language.indexOf('-') > 0) {
4767
+ // Extract the region information if it is included
4768
+ var languageParts = options.language.split('-');
4769
+ var baseLanguage = languageParts[0];
4770
+
4771
+ options.language = [options.language, baseLanguage];
4772
+ } else {
4773
+ options.language = [options.language];
4774
+ }
4775
+ }
4776
+
4777
+ if ($.isArray(options.language)) {
4778
+ var languages = new Translation();
4779
+ options.language.push('en');
4780
+
4781
+ var languageNames = options.language;
4782
+
4783
+ for (var l = 0; l < languageNames.length; l++) {
4784
+ var name = languageNames[l];
4785
+ var language = {};
4786
+
4787
+ try {
4788
+ // Try to load it with the original name
4789
+ language = Translation.loadPath(name);
4790
+ } catch (e) {
4791
+ try {
4792
+ // If we couldn't load it, check if it wasn't the full path
4793
+ name = this.defaults.amdLanguageBase + name;
4794
+ language = Translation.loadPath(name);
4795
+ } catch (ex) {
4796
+ // The translation could not be loaded at all. Sometimes this is
4797
+ // because of a configuration problem, other times this can be
4798
+ // because of how Select2 helps load all possible translation files.
4799
+ if (options.debug && window.console && console.warn) {
4800
+ console.warn(
4801
+ 'Select2: The language file for "' + name + '" could not be ' +
4802
+ 'automatically loaded. A fallback will be used instead.'
4803
+ );
4804
+ }
4805
+
4806
+ continue;
4807
+ }
4808
+ }
4809
+
4810
+ languages.extend(language);
4811
+ }
4812
+
4813
+ options.translations = languages;
4814
+ } else {
4815
+ var baseTranslation = Translation.loadPath(
4816
+ this.defaults.amdLanguageBase + 'en'
4817
+ );
4818
+ var customTranslation = new Translation(options.language);
4819
+
4820
+ customTranslation.extend(baseTranslation);
4821
+
4822
+ options.translations = customTranslation;
4823
+ }
4824
+
4825
+ return options;
4826
+ };
4827
+
4828
+ Defaults.prototype.reset = function () {
4829
+ function stripDiacritics (text) {
4830
+ // Used 'uni range + named function' from http://jsperf.com/diacritics/18
4831
+ function match(a) {
4832
+ return DIACRITICS[a] || a;
4833
+ }
4834
+
4835
+ return text.replace(/[^\u0000-\u007E]/g, match);
4836
+ }
4837
+
4838
+ function matcher (params, data) {
4839
+ // Always return the object if there is nothing to compare
4840
+ if ($.trim(params.term) === '') {
4841
+ return data;
4842
+ }
4843
+
4844
+ // Do a recursive check for options with children
4845
+ if (data.children && data.children.length > 0) {
4846
+ // Clone the data object if there are children
4847
+ // This is required as we modify the object to remove any non-matches
4848
+ var match = $.extend(true, {}, data);
4849
+
4850
+ // Check each child of the option
4851
+ for (var c = data.children.length - 1; c >= 0; c--) {
4852
+ var child = data.children[c];
4853
+
4854
+ var matches = matcher(params, child);
4855
+
4856
+ // If there wasn't a match, remove the object in the array
4857
+ if (matches == null) {
4858
+ match.children.splice(c, 1);
4859
+ }
4860
+ }
4861
+
4862
+ // If any children matched, return the new object
4863
+ if (match.children.length > 0) {
4864
+ return match;
4865
+ }
4866
+
4867
+ // If there were no matching children, check just the plain object
4868
+ return matcher(params, match);
4869
+ }
4870
+
4871
+ var original = stripDiacritics(data.text).toUpperCase();
4872
+ var term = stripDiacritics(params.term).toUpperCase();
4873
+
4874
+ // Check if the text contains the term
4875
+ if (original.indexOf(term) > -1) {
4876
+ return data;
4877
+ }
4878
+
4879
+ // If it doesn't contain the term, don't return anything
4880
+ return null;
4881
+ }
4882
+
4883
+ this.defaults = {
4884
+ amdBase: './',
4885
+ amdLanguageBase: './i18n/',
4886
+ closeOnSelect: true,
4887
+ debug: false,
4888
+ dropdownAutoWidth: false,
4889
+ escapeMarkup: Utils.escapeMarkup,
4890
+ language: EnglishTranslation,
4891
+ matcher: matcher,
4892
+ minimumInputLength: 0,
4893
+ maximumInputLength: 0,
4894
+ maximumSelectionLength: 0,
4895
+ minimumResultsForSearch: 0,
4896
+ selectOnClose: false,
4897
+ sorter: function (data) {
4898
+ return data;
4899
+ },
4900
+ templateResult: function (result) {
4901
+ return result.text;
4902
+ },
4903
+ templateSelection: function (selection) {
4904
+ return selection.text;
4905
+ },
4906
+ theme: 'default',
4907
+ width: 'resolve'
4908
+ };
4909
+ };
4910
+
4911
+ Defaults.prototype.set = function (key, value) {
4912
+ var camelKey = $.camelCase(key);
4913
+
4914
+ var data = {};
4915
+ data[camelKey] = value;
4916
+
4917
+ var convertedData = Utils._convertData(data);
4918
+
4919
+ $.extend(this.defaults, convertedData);
4920
+ };
4921
+
4922
+ var defaults = new Defaults();
4923
+
4924
+ return defaults;
4925
+ });
4926
+
4927
+ S2.define('select2/options',[
4928
+ 'require',
4929
+ 'jquery',
4930
+ './defaults',
4931
+ './utils'
4932
+ ], function (require, $, Defaults, Utils) {
4933
+ function Options (options, $element) {
4934
+ this.options = options;
4935
+
4936
+ if ($element != null) {
4937
+ this.fromElement($element);
4938
+ }
4939
+
4940
+ this.options = Defaults.apply(this.options);
4941
+
4942
+ if ($element && $element.is('input')) {
4943
+ var InputCompat = require(this.get('amdBase') + 'compat/inputData');
4944
+
4945
+ this.options.dataAdapter = Utils.Decorate(
4946
+ this.options.dataAdapter,
4947
+ InputCompat
4948
+ );
4949
+ }
4950
+ }
4951
+
4952
+ Options.prototype.fromElement = function ($e) {
4953
+ var excludedData = ['select2'];
4954
+
4955
+ if (this.options.multiple == null) {
4956
+ this.options.multiple = $e.prop('multiple');
4957
+ }
4958
+
4959
+ if (this.options.disabled == null) {
4960
+ this.options.disabled = $e.prop('disabled');
4961
+ }
4962
+
4963
+ if (this.options.language == null) {
4964
+ if ($e.prop('lang')) {
4965
+ this.options.language = $e.prop('lang').toLowerCase();
4966
+ } else if ($e.closest('[lang]').prop('lang')) {
4967
+ this.options.language = $e.closest('[lang]').prop('lang');
4968
+ }
4969
+ }
4970
+
4971
+ if (this.options.dir == null) {
4972
+ if ($e.prop('dir')) {
4973
+ this.options.dir = $e.prop('dir');
4974
+ } else if ($e.closest('[dir]').prop('dir')) {
4975
+ this.options.dir = $e.closest('[dir]').prop('dir');
4976
+ } else {
4977
+ this.options.dir = 'ltr';
4978
+ }
4979
+ }
4980
+
4981
+ $e.prop('disabled', this.options.disabled);
4982
+ $e.prop('multiple', this.options.multiple);
4983
+
4984
+ if ($e.data('select2Tags')) {
4985
+ if (this.options.debug && window.console && console.warn) {
4986
+ console.warn(
4987
+ 'Select2: The `data-select2-tags` attribute has been changed to ' +
4988
+ 'use the `data-data` and `data-tags="true"` attributes and will be ' +
4989
+ 'removed in future versions of Select2.'
4990
+ );
4991
+ }
4992
+
4993
+ $e.data('data', $e.data('select2Tags'));
4994
+ $e.data('tags', true);
4995
+ }
4996
+
4997
+ if ($e.data('ajaxUrl')) {
4998
+ if (this.options.debug && window.console && console.warn) {
4999
+ console.warn(
5000
+ 'Select2: The `data-ajax-url` attribute has been changed to ' +
5001
+ '`data-ajax--url` and support for the old attribute will be removed' +
5002
+ ' in future versions of Select2.'
5003
+ );
5004
+ }
5005
+
5006
+ $e.attr('ajax--url', $e.data('ajaxUrl'));
5007
+ $e.data('ajax--url', $e.data('ajaxUrl'));
5008
+ }
5009
+
5010
+ var dataset = {};
5011
+
5012
+ // Prefer the element's `dataset` attribute if it exists
5013
+ // jQuery 1.x does not correctly handle data attributes with multiple dashes
5014
+ if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {
5015
+ dataset = $.extend(true, {}, $e[0].dataset, $e.data());
5016
+ } else {
5017
+ dataset = $e.data();
5018
+ }
5019
+
5020
+ var data = $.extend(true, {}, dataset);
5021
+
5022
+ data = Utils._convertData(data);
5023
+
5024
+ for (var key in data) {
5025
+ if ($.inArray(key, excludedData) > -1) {
5026
+ continue;
5027
+ }
5028
+
5029
+ if ($.isPlainObject(this.options[key])) {
5030
+ $.extend(this.options[key], data[key]);
5031
+ } else {
5032
+ this.options[key] = data[key];
5033
+ }
5034
+ }
5035
+
5036
+ return this;
5037
+ };
5038
+
5039
+ Options.prototype.get = function (key) {
5040
+ return this.options[key];
5041
+ };
5042
+
5043
+ Options.prototype.set = function (key, val) {
5044
+ this.options[key] = val;
5045
+ };
5046
+
5047
+ return Options;
5048
+ });
5049
+
5050
+ S2.define('select2/core',[
5051
+ 'jquery',
5052
+ './options',
5053
+ './utils',
5054
+ './keys'
5055
+ ], function ($, Options, Utils, KEYS) {
5056
+ var Select2 = function ($element, options) {
5057
+ if ($element.data('select2') != null) {
5058
+ $element.data('select2').destroy();
5059
+ }
5060
+
5061
+ this.$element = $element;
5062
+
5063
+ this.id = this._generateId($element);
5064
+
5065
+ options = options || {};
5066
+
5067
+ this.options = new Options(options, $element);
5068
+
5069
+ Select2.__super__.constructor.call(this);
5070
+
5071
+ // Set up the tabindex
5072
+
5073
+ var tabindex = $element.attr('tabindex') || 0;
5074
+ $element.data('old-tabindex', tabindex);
5075
+ $element.attr('tabindex', '-1');
5076
+
5077
+ // Set up containers and adapters
5078
+
5079
+ var DataAdapter = this.options.get('dataAdapter');
5080
+ this.dataAdapter = new DataAdapter($element, this.options);
5081
+
5082
+ var $container = this.render();
5083
+
5084
+ this._placeContainer($container);
5085
+
5086
+ var SelectionAdapter = this.options.get('selectionAdapter');
5087
+ this.selection = new SelectionAdapter($element, this.options);
5088
+ this.$selection = this.selection.render();
5089
+
5090
+ this.selection.position(this.$selection, $container);
5091
+
5092
+ var DropdownAdapter = this.options.get('dropdownAdapter');
5093
+ this.dropdown = new DropdownAdapter($element, this.options);
5094
+ this.$dropdown = this.dropdown.render();
5095
+
5096
+ this.dropdown.position(this.$dropdown, $container);
5097
+
5098
+ var ResultsAdapter = this.options.get('resultsAdapter');
5099
+ this.results = new ResultsAdapter($element, this.options, this.dataAdapter);
5100
+ this.$results = this.results.render();
5101
+
5102
+ this.results.position(this.$results, this.$dropdown);
5103
+
5104
+ // Bind events
5105
+
5106
+ var self = this;
5107
+
5108
+ // Bind the container to all of the adapters
5109
+ this._bindAdapters();
5110
+
5111
+ // Register any DOM event handlers
5112
+ this._registerDomEvents();
5113
+
5114
+ // Register any internal event handlers
5115
+ this._registerDataEvents();
5116
+ this._registerSelectionEvents();
5117
+ this._registerDropdownEvents();
5118
+ this._registerResultsEvents();
5119
+ this._registerEvents();
5120
+
5121
+ // Set the initial state
5122
+ this.dataAdapter.current(function (initialData) {
5123
+ self.trigger('selection:update', {
5124
+ data: initialData
5125
+ });
5126
+ });
5127
+
5128
+ // Hide the original select
5129
+ $element.addClass('select2-hidden-accessible');
5130
+ $element.attr('aria-hidden', 'true');
5131
+
5132
+ // Synchronize any monitored attributes
5133
+ this._syncAttributes();
5134
+
5135
+ $element.data('select2', this);
5136
+ };
5137
+
5138
+ Utils.Extend(Select2, Utils.Observable);
5139
+
5140
+ Select2.prototype._generateId = function ($element) {
5141
+ var id = '';
5142
+
5143
+ if ($element.attr('id') != null) {
5144
+ id = $element.attr('id');
5145
+ } else if ($element.attr('name') != null) {
5146
+ id = $element.attr('name') + '-' + Utils.generateChars(2);
5147
+ } else {
5148
+ id = Utils.generateChars(4);
5149
+ }
5150
+
5151
+ id = id.replace(/(:|\.|\[|\]|,)/g, '');
5152
+ id = 'select2-' + id;
5153
+
5154
+ return id;
5155
+ };
5156
+
5157
+ Select2.prototype._placeContainer = function ($container) {
5158
+ $container.insertAfter(this.$element);
5159
+
5160
+ var width = this._resolveWidth(this.$element, this.options.get('width'));
5161
+
5162
+ if (width != null) {
5163
+ $container.css('width', width);
5164
+ }
5165
+ };
5166
+
5167
+ Select2.prototype._resolveWidth = function ($element, method) {
5168
+ var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
5169
+
5170
+ if (method == 'resolve') {
5171
+ var styleWidth = this._resolveWidth($element, 'style');
5172
+
5173
+ if (styleWidth != null) {
5174
+ return styleWidth;
5175
+ }
5176
+
5177
+ return this._resolveWidth($element, 'element');
5178
+ }
5179
+
5180
+ if (method == 'element') {
5181
+ var elementWidth = $element.outerWidth(false);
5182
+
5183
+ if (elementWidth <= 0) {
5184
+ return 'auto';
5185
+ }
5186
+
5187
+ return elementWidth + 'px';
5188
+ }
5189
+
5190
+ if (method == 'style') {
5191
+ var style = $element.attr('style');
5192
+
5193
+ if (typeof(style) !== 'string') {
5194
+ return null;
5195
+ }
5196
+
5197
+ var attrs = style.split(';');
5198
+
5199
+ for (var i = 0, l = attrs.length; i < l; i = i + 1) {
5200
+ var attr = attrs[i].replace(/\s/g, '');
5201
+ var matches = attr.match(WIDTH);
5202
+
5203
+ if (matches !== null && matches.length >= 1) {
5204
+ return matches[1];
5205
+ }
5206
+ }
5207
+
5208
+ return null;
5209
+ }
5210
+
5211
+ return method;
5212
+ };
5213
+
5214
+ Select2.prototype._bindAdapters = function () {
5215
+ this.dataAdapter.bind(this, this.$container);
5216
+ this.selection.bind(this, this.$container);
5217
+
5218
+ this.dropdown.bind(this, this.$container);
5219
+ this.results.bind(this, this.$container);
5220
+ };
5221
+
5222
+ Select2.prototype._registerDomEvents = function () {
5223
+ var self = this;
5224
+
5225
+ this.$element.on('change.select2', function () {
5226
+ self.dataAdapter.current(function (data) {
5227
+ self.trigger('selection:update', {
5228
+ data: data
5229
+ });
5230
+ });
5231
+ });
5232
+
5233
+ this.$element.on('focus.select2', function (evt) {
5234
+ self.trigger('focus', evt);
5235
+ });
5236
+
5237
+ this._syncA = Utils.bind(this._syncAttributes, this);
5238
+ this._syncS = Utils.bind(this._syncSubtree, this);
5239
+
5240
+ if (this.$element[0].attachEvent) {
5241
+ this.$element[0].attachEvent('onpropertychange', this._syncA);
5242
+ }
5243
+
5244
+ var observer = window.MutationObserver ||
5245
+ window.WebKitMutationObserver ||
5246
+ window.MozMutationObserver
5247
+ ;
5248
+
5249
+ if (observer != null) {
5250
+ this._observer = new observer(function (mutations) {
5251
+ $.each(mutations, self._syncA);
5252
+ $.each(mutations, self._syncS);
5253
+ });
5254
+ this._observer.observe(this.$element[0], {
5255
+ attributes: true,
5256
+ childList: true,
5257
+ subtree: false
5258
+ });
5259
+ } else if (this.$element[0].addEventListener) {
5260
+ this.$element[0].addEventListener(
5261
+ 'DOMAttrModified',
5262
+ self._syncA,
5263
+ false
5264
+ );
5265
+ this.$element[0].addEventListener(
5266
+ 'DOMNodeInserted',
5267
+ self._syncS,
5268
+ false
5269
+ );
5270
+ this.$element[0].addEventListener(
5271
+ 'DOMNodeRemoved',
5272
+ self._syncS,
5273
+ false
5274
+ );
5275
+ }
5276
+ };
5277
+
5278
+ Select2.prototype._registerDataEvents = function () {
5279
+ var self = this;
5280
+
5281
+ this.dataAdapter.on('*', function (name, params) {
5282
+ self.trigger(name, params);
5283
+ });
5284
+ };
5285
+
5286
+ Select2.prototype._registerSelectionEvents = function () {
5287
+ var self = this;
5288
+ var nonRelayEvents = ['toggle', 'focus'];
5289
+
5290
+ this.selection.on('toggle', function () {
5291
+ self.toggleDropdown();
5292
+ });
5293
+
5294
+ this.selection.on('focus', function (params) {
5295
+ self.focus(params);
5296
+ });
5297
+
5298
+ this.selection.on('*', function (name, params) {
5299
+ if ($.inArray(name, nonRelayEvents) !== -1) {
5300
+ return;
5301
+ }
5302
+
5303
+ self.trigger(name, params);
5304
+ });
5305
+ };
5306
+
5307
+ Select2.prototype._registerDropdownEvents = function () {
5308
+ var self = this;
5309
+
5310
+ this.dropdown.on('*', function (name, params) {
5311
+ self.trigger(name, params);
5312
+ });
5313
+ };
5314
+
5315
+ Select2.prototype._registerResultsEvents = function () {
5316
+ var self = this;
5317
+
5318
+ this.results.on('*', function (name, params) {
5319
+ self.trigger(name, params);
5320
+ });
5321
+ };
5322
+
5323
+ Select2.prototype._registerEvents = function () {
5324
+ var self = this;
5325
+
5326
+ this.on('open', function () {
5327
+ self.$container.addClass('select2-container--open');
5328
+ });
5329
+
5330
+ this.on('close', function () {
5331
+ self.$container.removeClass('select2-container--open');
5332
+ });
5333
+
5334
+ this.on('enable', function () {
5335
+ self.$container.removeClass('select2-container--disabled');
5336
+ });
5337
+
5338
+ this.on('disable', function () {
5339
+ self.$container.addClass('select2-container--disabled');
5340
+ });
5341
+
5342
+ this.on('blur', function () {
5343
+ self.$container.removeClass('select2-container--focus');
5344
+ });
5345
+
5346
+ this.on('query', function (params) {
5347
+ if (!self.isOpen()) {
5348
+ self.trigger('open', {});
5349
+ }
5350
+
5351
+ this.dataAdapter.query(params, function (data) {
5352
+ self.trigger('results:all', {
5353
+ data: data,
5354
+ query: params
5355
+ });
5356
+ });
5357
+ });
5358
+
5359
+ this.on('query:append', function (params) {
5360
+ this.dataAdapter.query(params, function (data) {
5361
+ self.trigger('results:append', {
5362
+ data: data,
5363
+ query: params
5364
+ });
5365
+ });
5366
+ });
5367
+
5368
+ this.on('keypress', function (evt) {
5369
+ var key = evt.which;
5370
+
5371
+ if (self.isOpen()) {
5372
+ if (key === KEYS.ESC || key === KEYS.TAB ||
5373
+ (key === KEYS.UP && evt.altKey)) {
5374
+ self.close();
5375
+
5376
+ evt.preventDefault();
5377
+ } else if (key === KEYS.ENTER) {
5378
+ self.trigger('results:select', {});
5379
+
5380
+ evt.preventDefault();
5381
+ } else if ((key === KEYS.SPACE && evt.ctrlKey)) {
5382
+ self.trigger('results:toggle', {});
5383
+
5384
+ evt.preventDefault();
5385
+ } else if (key === KEYS.UP) {
5386
+ self.trigger('results:previous', {});
5387
+
5388
+ evt.preventDefault();
5389
+ } else if (key === KEYS.DOWN) {
5390
+ self.trigger('results:next', {});
5391
+
5392
+ evt.preventDefault();
5393
+ }
5394
+ } else {
5395
+ if (key === KEYS.ENTER || key === KEYS.SPACE ||
5396
+ (key === KEYS.DOWN && evt.altKey)) {
5397
+ self.open();
5398
+
5399
+ evt.preventDefault();
5400
+ }
5401
+ }
5402
+ });
5403
+ };
5404
+
5405
+ Select2.prototype._syncAttributes = function () {
5406
+ this.options.set('disabled', this.$element.prop('disabled'));
5407
+
5408
+ if (this.options.get('disabled')) {
5409
+ if (this.isOpen()) {
5410
+ this.close();
5411
+ }
5412
+
5413
+ this.trigger('disable', {});
5414
+ } else {
5415
+ this.trigger('enable', {});
5416
+ }
5417
+ };
5418
+
5419
+ Select2.prototype._syncSubtree = function (evt, mutations) {
5420
+ var changed = false;
5421
+ var self = this;
5422
+
5423
+ // Ignore any mutation events raised for elements that aren't options or
5424
+ // optgroups. This handles the case when the select element is destroyed
5425
+ if (
5426
+ evt && evt.target && (
5427
+ evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP'
5428
+ )
5429
+ ) {
5430
+ return;
5431
+ }
5432
+
5433
+ if (!mutations) {
5434
+ // If mutation events aren't supported, then we can only assume that the
5435
+ // change affected the selections
5436
+ changed = true;
5437
+ } else if (mutations.addedNodes && mutations.addedNodes.length > 0) {
5438
+ for (var n = 0; n < mutations.addedNodes.length; n++) {
5439
+ var node = mutations.addedNodes[n];
5440
+
5441
+ if (node.selected) {
5442
+ changed = true;
5443
+ }
5444
+ }
5445
+ } else if (mutations.removedNodes && mutations.removedNodes.length > 0) {
5446
+ changed = true;
5447
+ }
5448
+
5449
+ // Only re-pull the data if we think there is a change
5450
+ if (changed) {
5451
+ this.dataAdapter.current(function (currentData) {
5452
+ self.trigger('selection:update', {
5453
+ data: currentData
5454
+ });
5455
+ });
5456
+ }
5457
+ };
5458
+
5459
+ /**
5460
+ * Override the trigger method to automatically trigger pre-events when
5461
+ * there are events that can be prevented.
5462
+ */
5463
+ Select2.prototype.trigger = function (name, args) {
5464
+ var actualTrigger = Select2.__super__.trigger;
5465
+ var preTriggerMap = {
5466
+ 'open': 'opening',
5467
+ 'close': 'closing',
5468
+ 'select': 'selecting',
5469
+ 'unselect': 'unselecting'
5470
+ };
5471
+
5472
+ if (args === undefined) {
5473
+ args = {};
5474
+ }
5475
+
5476
+ if (name in preTriggerMap) {
5477
+ var preTriggerName = preTriggerMap[name];
5478
+ var preTriggerArgs = {
5479
+ prevented: false,
5480
+ name: name,
5481
+ args: args
5482
+ };
5483
+
5484
+ actualTrigger.call(this, preTriggerName, preTriggerArgs);
5485
+
5486
+ if (preTriggerArgs.prevented) {
5487
+ args.prevented = true;
5488
+
5489
+ return;
5490
+ }
5491
+ }
5492
+
5493
+ actualTrigger.call(this, name, args);
5494
+ };
5495
+
5496
+ Select2.prototype.toggleDropdown = function () {
5497
+ if (this.options.get('disabled')) {
5498
+ return;
5499
+ }
5500
+
5501
+ if (this.isOpen()) {
5502
+ this.close();
5503
+ } else {
5504
+ this.open();
5505
+ }
5506
+ };
5507
+
5508
+ Select2.prototype.open = function () {
5509
+ if (this.isOpen()) {
5510
+ return;
5511
+ }
5512
+
5513
+ this.trigger('query', {});
5514
+ };
5515
+
5516
+ Select2.prototype.close = function () {
5517
+ if (!this.isOpen()) {
5518
+ return;
5519
+ }
5520
+
5521
+ this.trigger('close', {});
5522
+ };
5523
+
5524
+ Select2.prototype.isOpen = function () {
5525
+ return this.$container.hasClass('select2-container--open');
5526
+ };
5527
+
5528
+ Select2.prototype.hasFocus = function () {
5529
+ return this.$container.hasClass('select2-container--focus');
5530
+ };
5531
+
5532
+ Select2.prototype.focus = function (data) {
5533
+ // No need to re-trigger focus events if we are already focused
5534
+ if (this.hasFocus()) {
5535
+ return;
5536
+ }
5537
+
5538
+ this.$container.addClass('select2-container--focus');
5539
+ this.trigger('focus', {});
5540
+ };
5541
+
5542
+ Select2.prototype.enable = function (args) {
5543
+ if (this.options.get('debug') && window.console && console.warn) {
5544
+ console.warn(
5545
+ 'Select2: The `select2("enable")` method has been deprecated and will' +
5546
+ ' be removed in later Select2 versions. Use $element.prop("disabled")' +
5547
+ ' instead.'
5548
+ );
5549
+ }
5550
+
5551
+ if (args == null || args.length === 0) {
5552
+ args = [true];
5553
+ }
5554
+
5555
+ var disabled = !args[0];
5556
+
5557
+ this.$element.prop('disabled', disabled);
5558
+ };
5559
+
5560
+ Select2.prototype.data = function () {
5561
+ if (this.options.get('debug') &&
5562
+ arguments.length > 0 && window.console && console.warn) {
5563
+ console.warn(
5564
+ 'Select2: Data can no longer be set using `select2("data")`. You ' +
5565
+ 'should consider setting the value instead using `$element.val()`.'
5566
+ );
5567
+ }
5568
+
5569
+ var data = [];
5570
+
5571
+ this.dataAdapter.current(function (currentData) {
5572
+ data = currentData;
5573
+ });
5574
+
5575
+ return data;
5576
+ };
5577
+
5578
+ Select2.prototype.val = function (args) {
5579
+ if (this.options.get('debug') && window.console && console.warn) {
5580
+ console.warn(
5581
+ 'Select2: The `select2("val")` method has been deprecated and will be' +
5582
+ ' removed in later Select2 versions. Use $element.val() instead.'
5583
+ );
5584
+ }
5585
+
5586
+ if (args == null || args.length === 0) {
5587
+ return this.$element.val();
5588
+ }
5589
+
5590
+ var newVal = args[0];
5591
+
5592
+ if ($.isArray(newVal)) {
5593
+ newVal = $.map(newVal, function (obj) {
5594
+ return obj.toString();
5595
+ });
5596
+ }
5597
+
5598
+ this.$element.val(newVal).trigger('change');
5599
+ };
5600
+
5601
+ Select2.prototype.destroy = function () {
5602
+ this.$container.remove();
5603
+
5604
+ if (this.$element[0].detachEvent) {
5605
+ this.$element[0].detachEvent('onpropertychange', this._syncA);
5606
+ }
5607
+
5608
+ if (this._observer != null) {
5609
+ this._observer.disconnect();
5610
+ this._observer = null;
5611
+ } else if (this.$element[0].removeEventListener) {
5612
+ this.$element[0]
5613
+ .removeEventListener('DOMAttrModified', this._syncA, false);
5614
+ this.$element[0]
5615
+ .removeEventListener('DOMNodeInserted', this._syncS, false);
5616
+ this.$element[0]
5617
+ .removeEventListener('DOMNodeRemoved', this._syncS, false);
5618
+ }
5619
+
5620
+ this._syncA = null;
5621
+ this._syncS = null;
5622
+
5623
+ this.$element.off('.select2');
5624
+ this.$element.attr('tabindex', this.$element.data('old-tabindex'));
5625
+
5626
+ this.$element.removeClass('select2-hidden-accessible');
5627
+ this.$element.attr('aria-hidden', 'false');
5628
+ this.$element.removeData('select2');
5629
+
5630
+ this.dataAdapter.destroy();
5631
+ this.selection.destroy();
5632
+ this.dropdown.destroy();
5633
+ this.results.destroy();
5634
+
5635
+ this.dataAdapter = null;
5636
+ this.selection = null;
5637
+ this.dropdown = null;
5638
+ this.results = null;
5639
+ };
5640
+
5641
+ Select2.prototype.render = function () {
5642
+ var $container = $(
5643
+ '<span class="select2 select2-container">' +
5644
+ '<span class="selection"></span>' +
5645
+ '<span class="dropdown-wrapper" aria-hidden="true"></span>' +
5646
+ '</span>'
5647
+ );
5648
+
5649
+ $container.attr('dir', this.options.get('dir'));
5650
+
5651
+ this.$container = $container;
5652
+
5653
+ this.$container.addClass('select2-container--' + this.options.get('theme'));
5654
+
5655
+ $container.data('element', this.$element);
5656
+
5657
+ return $container;
5658
+ };
5659
+
5660
+ return Select2;
5661
+ });
5662
+
5663
+ S2.define('jquery-mousewheel',[
5664
+ 'jquery'
5665
+ ], function ($) {
5666
+ // Used to shim jQuery.mousewheel for non-full builds.
5667
+ return $;
5668
+ });
5669
+
5670
+ S2.define('jquery.select2',[
5671
+ 'jquery',
5672
+ 'jquery-mousewheel',
5673
+
5674
+ './select2/core',
5675
+ './select2/defaults'
5676
+ ], function ($, _, Select2, Defaults) {
5677
+ if ($.fn.select2 == null) {
5678
+ // All methods that should return the element
5679
+ var thisMethods = ['open', 'close', 'destroy'];
5680
+
5681
+ $.fn.select2 = function (options) {
5682
+ options = options || {};
5683
+
5684
+ if (typeof options === 'object') {
5685
+ this.each(function () {
5686
+ var instanceOptions = $.extend(true, {}, options);
5687
+
5688
+ var instance = new Select2($(this), instanceOptions);
5689
+ });
5690
+
5691
+ return this;
5692
+ } else if (typeof options === 'string') {
5693
+ var ret;
5694
+ var args = Array.prototype.slice.call(arguments, 1);
5695
+
5696
+ this.each(function () {
5697
+ var instance = $(this).data('select2');
5698
+
5699
+ if (instance == null && window.console && console.error) {
5700
+ console.error(
5701
+ 'The select2(\'' + options + '\') method was called on an ' +
5702
+ 'element that is not using Select2.'
5703
+ );
5704
+ }
5705
+
5706
+ ret = instance[options].apply(instance, args);
5707
+ });
5708
+
5709
+ // Check if we should be returning `this`
5710
+ if ($.inArray(options, thisMethods) > -1) {
5711
+ return this;
5712
+ }
5713
+
5714
+ return ret;
5715
+ } else {
5716
+ throw new Error('Invalid arguments for Select2: ' + options);
5717
+ }
5718
+ };
5719
+ }
5720
+
5721
+ if ($.fn.select2.defaults == null) {
5722
+ $.fn.select2.defaults = Defaults;
5723
+ }
5724
+
5725
+ return Select2;
5726
+ });
5727
+
5728
+ // Return the AMD loader configuration so it can be used outside of this file
5729
+ return {
5730
+ define: S2.define,
5731
+ require: S2.require
5732
+ };
5733
+ }());
5734
+
5735
+ // Autoload the jQuery bindings
5736
+ // We know that all of the modules exist above this, so we're safe
5737
+ var select2 = S2.require('jquery.select2');
5738
+
5739
+ // Hold the AMD module references on the jQuery function that was just loaded
5740
+ // This allows Select2 to use the internal loader outside of this file, such
5741
+ // as in the language files.
5742
+ jQuery.fn.select2.amd = S2;
5743
+
5744
+ // Return the Select2 instance for anyone who is importing it.
5745
+ return select2;
5746
+ }));
admin/js/select2.min.js ADDED
@@ -0,0 +1 @@
 
1
+ /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=function(b,c){return void 0===c&&(c="undefined"!=typeof window?require("jquery"):require("jquery")(b)),a(c),c}:a(jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return v.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o=b&&b.split("/"),p=t.map,q=p&&p["*"]||{};if(a){for(a=a.split("/"),g=a.length-1,t.nodeIdCompat&&x.test(a[g])&&(a[g]=a[g].replace(x,"")),"."===a[0].charAt(0)&&o&&(n=o.slice(0,o.length-1),a=n.concat(a)),k=0;k<a.length;k++)if("."===(m=a[k]))a.splice(k,1),k-=1;else if(".."===m){if(0===k||1===k&&".."===a[2]||".."===a[k-1])continue;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}if((o||q)&&p){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),o)for(l=o.length;l>0;l-=1)if((e=p[o.slice(0,l).join("/")])&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&q&&q[d]&&(i=q[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=w.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),o.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){r[a]=b}}function j(a){if(e(s,a)){var c=s[a];delete s[a],u[a]=!0,n.apply(b,c)}if(!e(r,a)&&!e(u,a))throw new Error("No "+a);return r[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return a?k(a):[]}function m(a){return function(){return t&&t.config&&t.config[a]||{}}}var n,o,p,q,r={},s={},t={},u={},v=Object.prototype.hasOwnProperty,w=[].slice,x=/\.js$/;p=function(a,b){var c,d=k(a),e=d[0],g=b[1];return a=d[1],e&&(e=f(e,g),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(g)):f(a,g):(a=f(a,g),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},q={require:function(a){return g(a)},exports:function(a){var b=r[a];return void 0!==b?b:r[a]={}},module:function(a){return{id:a,uri:"",exports:r[a],config:m(a)}}},n=function(a,c,d,f){var h,k,m,n,o,t,v,w=[],x=typeof d;if(f=f||a,t=l(f),"undefined"===x||"function"===x){for(c=!c.length&&d.length?["require","exports","module"]:c,o=0;o<c.length;o+=1)if(n=p(c[o],t),"require"===(k=n.f))w[o]=q.require(a);else if("exports"===k)w[o]=q.exports(a),v=!0;else if("module"===k)h=w[o]=q.module(a);else if(e(r,k)||e(s,k)||e(u,k))w[o]=j(k);else{if(!n.p)throw new Error(a+" missing "+k);n.p.load(n.n,g(f,!0),i(k),{}),w[o]=r[k]}m=d?d.apply(r[a],w):void 0,a&&(h&&h.exports!==b&&h.exports!==r[a]?r[a]=h.exports:m===b&&v||(r[a]=m))}else a&&(r[a]=d)},a=c=o=function(a,c,d,e,f){if("string"==typeof a)return q[a]?q[a](c):j(p(a,l(c)).f);if(!a.splice){if(t=a,t.deps&&o(t.deps,t.callback),!c)return;c.splice?(a=c,c=d,d=null):a=b}return c=c||function(){},"function"==typeof d&&(d=e,e=f),e?n(b,a,c,d):setTimeout(function(){n(b,a,c,d)},4),o},o.config=function(a){return o(a)},a._defined=r,d=function(a,b,c){if("string"!=typeof a)throw new Error("See almond README: incorrect module build, no module name");b.splice||(c=b,b=[]),e(r,a)||e(s,a)||(s[a]=[a,b,c])},d.amd={jQuery:!0}}(),b.requirejs=a,b.require=c,b.define=d}}(),b.define("almond",function(){}),b.define("jquery",[],function(){var b=a||$;return null==b&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),b}),b.define("select2/utils",["jquery"],function(a){function b(a){var b=a.prototype,c=[];for(var d in b){"function"==typeof b[d]&&("constructor"!==d&&c.push(d))}return c}var c={};c.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},c.Decorate=function(a,c){function d(){var b=Array.prototype.unshift,d=c.prototype.constructor.length,e=a.prototype.constructor;d>0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=a.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){return Array.prototype.unshift.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var d=function(){this.listeners={}};return d.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},d.prototype.trigger=function(a){var b=Array.prototype.slice,c=b.call(arguments,1);this.listeners=this.listeners||{},null==c&&(c=[]),0===c.length&&c.push({}),c[0]._type=a,a in this.listeners&&this.invoke(this.listeners[a],b.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},d.prototype.invoke=function(a,b){for(var c=0,d=a.length;c<d;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;c<a;c++){b+=Math.floor(36*Math.random()).toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e<c.length;e++){var f=c[e];f=f.substring(0,1).toLowerCase()+f.substring(1),f in d||(d[f]={}),e==c.length-1&&(d[f]=a[b]),d=d[f]}delete a[b]}}return a},c.hasScroll=function(b,c){var d=a(c),e=c.style.overflowX,f=c.style.overflowY;return(e!==f||"hidden"!==f&&"visible"!==f)&&("scroll"===e||"scroll"===f||(d.innerHeight()<c.scrollHeight||d.innerWidth()<c.scrollWidth))},c.escapeMarkup=function(a){var b={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('<li role="treeitem" aria-live="assertive" class="select2-results__option"></li>'),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c<a.results.length;c++){var d=a.results[c],e=this.option(d);b.push(e)}this.$results.append(b)},c.prototype.position=function(a,b){b.find(".select2-results").append(a)},c.prototype.sort=function(a){return this.options.get("sorter")(a)},c.prototype.highlightFirstItem=function(){var a=this.$results.find(".select2-results__option[aria-selected]"),b=a.filter("[aria-selected=true]");b.length>0?b.first().trigger("mouseenter"):a.first().trigger("mouseenter"),this.ensureHighlightVisible()},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()});b.$results.find(".select2-results__option[aria-selected]").each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")})})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j<b.children.length;j++){var k=b.children[j],l=this.option(k);i.push(l)}var m=a("<ul></ul>",{class:"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("unselect",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):h-g<0&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");if("true"===c.attr("aria-selected"))return void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{}));d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){return this.$results.find(".select2-results__option--highlighted")},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),c<=2?this.$results.scrollTop(0):(g>this.$results.outerHeight()||g<0)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id,a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2");a(".select2.select2-container--open").each(function(){var b=a(this);this!=d[0]&&b.data("element").select2("close")})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){b.find(".selection").append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("focus",function(b){a.isOpen()||c.$selection.focus()}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection");return this.options.get("escapeMarkup")(c(a,b))},e.prototype.selectionContainer=function(){return a("<span></span>")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('<ul class="select2-selection__rendered"></ul>'),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection");return this.options.get("escapeMarkup")(c(a,b))},d.prototype.selectionContainer=function(){return a('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">&times;</span></li>')},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d<a.length;d++){var e=a[d],f=this.selectionContainer(),g=this.display(e,f);f.append(g),f.prop("title",e.title||e.text),f.data("data",e),b.push(f)}var h=this.$selection.find(".select2-selection__rendered");c.appendMany(h,b)}},d}),b.define("select2/selection/placeholder",["../utils"],function(a){function b(a,b,c){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c)}return b.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},b.prototype.createPlaceholder=function(a,b){var c=this.selectionContainer();return c.html(this.display(b)),c.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),c},b.prototype.update=function(a,b){var c=1==b.length&&b[0].id!=this.placeholder.id;if(b.length>1||c)return a.call(this,b);this.clear();var d=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(d)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e<d.length;e++){var f={data:d[e]};if(this.trigger("unselect",f),f.prevented)return}this.$element.val(this.placeholder.id).trigger("change"),this.trigger("toggle",{})}}},c.prototype._handleKeyboardClear=function(a,c,d){d.isOpen()||c.which!=b.DELETE&&c.which!=b.BACKSPACE||this._handleClear(c)},c.prototype.update=function(b,c){if(b.call(this,c),!(this.$selection.find(".select2-selection__placeholder").length>0||0===c.length)){var d=a('<span class="select2-selection__clear">&times;</span>');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" role="textbox" aria-autocomplete="list" /></li>');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){if(a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented(),a.which===c.BACKSPACE&&""===e.$search.val()){var b=e.$searchContainer.prev(".select2-selection__choice");if(b.length>0){var d=b.data("data");e.searchRemoveChoice(d),a.preventDefault()}}});var f=document.documentMode,g=f&&f<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){if(g)return void e.$selection.off("input.search input.searchcheck");e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{a=.75*(this.$search.val().length+1)+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){return{"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"}}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),null!=c.id?d+="-"+c.id.toString():d+="-"+a.generateChars(4),d},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f<a.length;f++){var g=a[f].id;-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")});else{var d=a.id;this.$element.val(d),this.$element.trigger("change")}},d.prototype.unselect=function(a){var b=this;if(this.$element.prop("multiple")){if(a.selected=!1,c(a.element).is("option"))return a.element.selected=!1,void this.$element.trigger("change");this.current(function(d){for(var e=[],f=0;f<d.length;f++){var g=d[f].id;g!==a.id&&-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")})}},d.prototype.bind=function(a,b){var c=this;this.container=a,a.on("select",function(a){c.select(a.data)}),a.on("unselect",function(a){c.unselect(a.data)})},d.prototype.destroy=function(){this.$element.find("*").each(function(){c.removeData(this,"data")})},d.prototype.query=function(a,b){var d=[],e=this;this.$element.children().each(function(){var b=c(this);if(b.is("option")||b.is("optgroup")){var f=e.item(b),g=e.matches(a,f);null!==g&&d.push(g)}}),b({results:d})},d.prototype.addOptions=function(a){b.appendMany(this.$element,a)},d.prototype.option=function(a){var b;a.children?(b=document.createElement("optgroup"),b.label=a.text):(b=document.createElement("option"),void 0!==b.textContent?b.textContent=a.text:b.innerText=a.text),void 0!==a.id&&(b.value=a.id),a.disabled&&(b.disabled=!0),a.selected&&(b.selected=!0),a.title&&(b.title=a.title);var d=c(b),e=this._normalizeItem(a);return e.element=b,c.data(b,"data",e),d},d.prototype.item=function(a){var b={};if(null!=(b=c.data(a[0],"data")))return b;if(a.is("option"))b={id:a.val(),text:a.text(),disabled:a.prop("disabled"),selected:a.prop("selected"),title:a.prop("title")};else if(a.is("optgroup")){b={text:a.prop("label"),children:[],title:a.prop("title")};for(var d=a.children("option"),e=[],f=0;f<d.length;f++){var g=c(d[f]),h=this.item(g);e.push(h)}b.children=e}return b=this._normalizeItem(b),b.element=a[0],c.data(a[0],"data",b),b},d.prototype._normalizeItem=function(a){c.isPlainObject(a)||(a={id:a,text:a}),a=c.extend({},{text:""},a);var b={selected:!1,disabled:!1};return null!=a.id&&(a.id=a.id.toString()),null!=a.text&&(a.text=a.text.toString()),null==a._resultId&&a.id&&null!=this.container&&(a._resultId=this.generateResultId(this.container,a)),c.extend({},b,a)},d.prototype.matches=function(a,b){return this.options.get("matcher")(a,b)},d}),b.define("select2/data/array",["./select","../utils","jquery"],function(a,b,c){function d(a,b){var c=b.get("data")||[];d.__super__.constructor.call(this,a,b),this.addOptions(this.convertToOptions(c))}return b.Extend(d,a),d.prototype.select=function(a){var b=this.$element.find("option").filter(function(b,c){return c.value==a.id.toString()});0===b.length&&(b=this.option(a),this.addOptions(b)),d.__super__.select.call(this,a)},d.prototype.convertToOptions=function(a){function d(a){return function(){return c(this).val()==a.id}}for(var e=this,f=this.$element.find("option"),g=f.map(function(){return e.item(c(this)).id}).get(),h=[],i=0;i<a.length;i++){var j=this._normalizeItem(a[i]);if(c.inArray(j.id,g)>=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){d.status&&"0"===d.status||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h<e.length;h++){var i=e[h],j=this._normalizeItem(i),k=this.option(j);this.$element.append(k)}}return b.prototype.query=function(a,b,c){function d(a,f){for(var g=a.results,h=0;h<g.length;h++){var i=g[h],j=null!=i.children&&!d({results:i.children},!0);if((i.text||"").toUpperCase()===(b.term||"").toUpperCase()||j)return!f&&(a.data=g,void c(a))}if(f)return!0;var k=e.createTag(b);if(null!=k){var l=e.option(k);l.attr("data-select2-tag",!0),e.addOptions([l]),e.insertTag(g,k)}a.results=g,c(a)}var e=this;if(this._removeOldTags(),null==b.term||null!=b.page)return void a.call(this,b,c);a.call(this,b,d)},b.prototype.createTag=function(b,c){var d=a.trim(c.term);return""===d?null:{id:d,text:d}},b.prototype.insertTag=function(a,b,c){b.unshift(c)},b.prototype._removeOldTags=function(b){this._lastTag;this.$element.find("option[data-select2-tag]").each(function(){this.selected||a(this).remove()})},b}),b.define("select2/data/tokenizer",["jquery"],function(a){function b(a,b,c){var d=c.get("tokenizer");void 0!==d&&(this.tokenizer=d),a.call(this,b,c)}return b.prototype.bind=function(a,b,c){a.call(this,b,c),this.$search=b.dropdown.$search||b.selection.$search||c.find(".select2-search__field")},b.prototype.query=function(b,c,d){function e(b){var c=g._normalizeItem(b);if(!g.$element.find("option").filter(function(){return a(this).val()===c.id}).length){var d=g.option(c);d.attr("data-select2-tag",!0),g._removeOldTags(),g.addOptions([d])}f(c)}function f(a){g.trigger("select",{data:a})}var g=this;c.term=c.term||"";var h=this.tokenizer(c,this.options,e);h.term!==c.term&&(this.$search.length&&(this.$search.val(h.term),this.$search.focus()),c.term=h.term),b.call(this,c,d)},b.prototype.tokenizer=function(b,c,d,e){for(var f=d.get("tokenSeparators")||[],g=c.term,h=0,i=this.createTag||function(a){return{id:a.term,text:a.term}};h<g.length;){var j=g[h];if(-1!==a.inArray(j,f)){var k=g.substr(0,h),l=a.extend({},c,{term:k}),m=i(l);null!=m?(e(m),g=g.substr(h+1)||"",h=0):h++}else h++}return{term:g}},b}),b.define("select2/data/minimumInputLength",[],function(){function a(a,b,c){this.minimumInputLength=c.get("minimumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){if(b.term=b.term||"",b.term.length<this.minimumInputLength)return void this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:b.term,params:b}});a.call(this,b,c)},a}),b.define("select2/data/maximumInputLength",[],function(){function a(a,b,c){this.maximumInputLength=c.get("maximumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){if(b.term=b.term||"",this.maximumInputLength>0&&b.term.length>this.maximumInputLength)return void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}});a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;if(d.maximumSelectionLength>0&&f>=d.maximumSelectionLength)return void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}});a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<span class="select2-dropdown"><span class="select2-results"></span></span>');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("focus",function(){c.isOpen()||e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){e.showSearch(a)?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){e.$results.offset().top+e.$results.outerHeight(!1)+50>=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1)&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('<li class="select2-results__option select2-results__option--load-more"role="treeitem" aria-disabled="true"></li>'),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a("<span></span>"),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id;this.$container.parents().filter(b.hasScroll).off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.top<f.top-h.height,k=i.bottom>f.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d<b.length;d++){var e=b[d];e.children?c+=a(e.children):c++}return c}function b(a,b,c,d){this.minimumResultsForSearch=c.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),a.call(this,b,c,d)}return b.prototype.showSearch=function(b,c){return!(a(c.data.results)<this.minimumResultsForSearch)&&b.call(this,c)},b}),b.define("select2/dropdown/selectOnClose",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("close",function(a){d._handleSelectOnClose(a)})},a.prototype._handleSelectOnClose=function(a,b){if(b&&null!=b.originalSelect2Event){var c=b.originalSelect2Event;if("select"===c._type||"unselect"===c._type)return}var d=this.getHighlightedResults();if(!(d.length<1)){var e=d.data("data");null!=e.element&&e.element.selected||null==e.element&&e.selected||this.trigger("select",{data:e})}},a}),b.define("select2/dropdown/closeOnSelect",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("select",function(a){d._selectTriggered(a)}),b.on("unselect",function(a){d._selectTriggered(a)})},a.prototype._selectTriggered=function(a,b){var c=b.originalEvent;c&&c.ctrlKey||this.trigger("close",{originalEvent:c,originalSelect2Event:b})},a}),b.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(a){var b=a.input.length-a.maximum,c="Please delete "+b+" character";return 1!=b&&(c+="s"),c},inputTooShort:function(a){return"Please enter "+(a.minimum-a.input.length)+" or more characters"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(a){var b="You can only select "+a.maximum+" item";return 1!=a.maximum&&(b+="s"),b},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),b.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C){function D(){this.reset()}return D.prototype.apply=function(l){if(l=a.extend(!0,{},this.defaults,l),null==l.dataAdapter){if(null!=l.ajax?l.dataAdapter=o:null!=l.data?l.dataAdapter=n:l.dataAdapter=m,l.minimumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),null==l.tokenSeparators&&null==l.tokenizer||(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L<K.length;L++){var M=K[L],N={};try{N=k.loadPath(M)}catch(a){try{M=this.defaults.amdLanguageBase+M,N=k.loadPath(M)}catch(a){l.debug&&window.console&&console.warn&&console.warn('Select2: The language file for "'+M+'" could not be automatically loaded. A fallback will be used instead.');continue}}J.extend(N)}l.translations=J}else{var O=k.loadPath(this.defaults.amdLanguageBase+"en"),P=new k(l.language);P.extend(O),l.translations=P}return l},D.prototype.reset=function(){function b(a){function b(a){return l[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function c(d,e){if(""===a.trim(d.term))return e;if(e.children&&e.children.length>0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){null==c(d,e.children[g])&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var h=b(e.text).toUpperCase(),i=b(d.term).toUpperCase();return h.indexOf(i)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)},new D}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return e<=0?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;h<i;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e<b.addedNodes.length;e++){var f=b.addedNodes[e];f.selected&&(c=!0)}else b.removedNodes&&b.removedNodes.length>0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),null!=a&&0!==a.length||(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},e.prototype.render=function(){var b=a('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("jquery-mousewheel",["jquery"],function(a){return a}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if("object"==typeof(b=b||{}))return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d,f=Array.prototype.slice.call(arguments,1);return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2."),d=c[b].apply(c,f)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c});
admin/tab-about.php DELETED
@@ -1,117 +0,0 @@
1
- <?php
2
- // Exit if accessed directly.
3
- if ( ! defined( 'ABSPATH' ) ) {
4
- exit();
5
- }
6
-
7
- /**
8
- * Creates the About tab.
9
- *
10
- * @since 3.1.1
11
- *
12
- * @param string $tab The admin tab being displayed.
13
- * @return string|bool The about tab, otherwise false.
14
- */
15
- function wpmem_a_about_tab( $tab ) {
16
- if ( $tab == 'about' ) {
17
- // Render the about tab.
18
- return wpmem_a_build_about_tab();
19
- } else {
20
- return false;
21
- }
22
- }
23
-
24
-
25
- /**
26
- * Adds the About tab.
27
- *
28
- * @since 3.1.1
29
- *
30
- * @param array $tabs The array of tabs for the admin panel.
31
- * @return array The updated array of tabs for the admin panel.
32
- */
33
- function wpmem_add_about_tab( $tabs ) {
34
- return array_merge( $tabs, array( 'about' => __( 'About WP-Members', 'wp-members' ) ) );
35
- }
36
-
37
-
38
- function wpmem_a_build_about_tab() { ?>
39
- <div class="metabox-holder has-right-sidebar">
40
- <div class="post-body"><div class="post-body-content">
41
- <div class="postbox"><div class="inside">
42
- <div style="width:20%;max-width:300px;min-width:200px;padding:10px;margin:10px;float:right;">
43
- <?php wpmem_a_meta_box(); ?>
44
- <?php wpmem_a_rating_box(); ?>
45
- <?php wpmem_a_rss_box(); ?>
46
- <div class="postbox"><div class="inside">
47
- <h4><a href="http://rkt.bz/3O">WordPass</a></h4>
48
- <p>Default random passwords can be difficult to for users to use. WordPass simplifies this process by using words to create passwords. Passwords will be generated in the style of 2*Kayak29, 2Bigcranium2#, or %36POTATOE6.
49
- </p>
50
- <p>This plugin works with WordPress as well as with any plugin that uses the WordPress password generation function.</p>
51
- <p><strong><a href="http://rkt.bz/3O">Try WordPass Free!</a></strong></p>
52
- </div></div>
53
- </div>
54
- <h2><?php _e( 'About WP-Members', 'wp-members' ); ?></h2>
55
- <p>WP-Members is a WordPress membership plugin that is simple to use but incorporates a powerful API for customization.
56
- A simple installation can be up and running in minutes. Yet, using the plugin's API, filters, and actions, the plugin can
57
- be customized without touching the main plugin files.</p>
58
- <p>Introduced publicly in 2006, WP-Members was the first WordPress Membership plugin and through support of the WP community it continues to grow
59
- and be developed. <strong>Why put your trust in an unknown? WP-Members has a <?php echo date('Y') - date('Y', strtotime('2006-01-01')); ?> year track record of active development and support.</strong></p>
60
- <p><strong><a href="https://rkt.bz/KB">Plugin Documentation</a></strong> |
61
- <strong><a href="https://rkt.bz/join">Premium Support &amp; Extensions</a></strong></p>
62
- <h2>Priority Support</h2>
63
- <p>If you want to make the most out of WP-Members, subscribing to Priority Support is a great way to do that. You'll not only get priority email support, but also a member-only forum
64
- and access to the member's only site with a code library of tutorials and customizations. You can also subscribe to the WP-Members Pro Bundle to get everything Priority Support has to offer
65
- PLUS all of the premium extensions as well.<br /><br />
66
- <a href="https://rkt.bz/join"><strong>Check out the Premium Support options here</strong></a>.<br /><strong>NEW!! <a href="https://rkt.bz/121">One-on-one Consulting Now Available</a>!</strong></p>
67
- <h2>Premium Extensions</h2>
68
- <table>
69
- <tr>
70
- <td><a href="https://rkt.bz/0h"><img src="https://rocketgeek.com/wp/wp-content/uploads/2018/01/advanced_options-80x80.png" /></a></td>
71
- <td><strong><a href="https://rkt.bz/0h">Advanced Options</a></strong><br />
72
- This exclusive extension adds a host of additional features to the plugin that are as simple to set up as checking a box. Hides the dashboard,
73
- override WP default URLs for login and registration, disable certain WP defaults, change WP-Members defaults, notify admin on user profile
74
- update, integrate with other popular plugins like WooCommerce, BuddyPress, and ACF (Advanced Custom Fields), and more. See a list
75
- of available settings here.</td>
76
- </tr>
77
- <tr>
78
- <td><a href="https://rkt.bz/UF"><img src="https://rocketgeek.com/wp/wp-content/uploads/2018/01/download_protect-80x80.png" /></a></td>
79
- <td><strong><a href="https://rkt.bz/UF">Download Protect</a></strong><br />Adds file restriction to the core WP-Members functionality. Restrict file downloads to registered users and track download activity.</td>
80
- </tr>
81
- <tr>
82
- <td><a href="https://rkt.bz/IP"><img src="https://rocketgeek.com/wp/wp-content/uploads/2018/01/invitation_codes-80x80.png" /></a></td>
83
- <td><strong><a href="https://rkt.bz/IP">Invite Codes</a></strong><br />Create invite codes for registration. Use to track sign-ups, or require a valid invite code in order to register.</td>
84
- </tr>
85
- <tr>
86
- <td><a href="https://rkt.bz/C6"><img src="https://rocketgeek.com/wp/wp-content/uploads/2018/01/wpmembers_security-80x80.png" /></a></td>
87
- <td><strong><a href="https://rkt.bz/C6">Security</a></strong><br />Set password expirations, require strong passwords, restrict concurrent logins, block specific IPs or email addresses from registering, restrict usernames like "admin" or "support" from being registered. This extension allows you to block IPs, emails, and restrict username selection.</td>
88
- </tr>
89
- <tr>
90
- <td><a href="https://rkt.bz/cA"><img src="https://rocketgeek.com/wp/wp-content/uploads/2018/01/wpmembers_editor-80x80.png" /></a></td>
91
- <td><strong><a href="https://rkt.bz/cA">Text String Editor</a><br />Provides a simple way to edit all of the plugin's user-facing text strings. Includes text that is used in the various forms, custom messages, form headings, etc.</strong></td>
92
- </tr>
93
- <tr>
94
- <td><a href="https://rkt.bz/fh"><img src="https://rocketgeek.com/wp/wp-content/uploads/2018/01/wpmembers_userlist-80x80.png" /></a></td>
95
- <td><strong><a href="https://rkt.bz/fh">User List</a></strong><br />Provides a configurable shortcode to create user/member directories. The extension allows you to set defaults for the shortcode and to override any of those defaults with shortcode parameters for an unlimited number of lists.</td>
96
- </tr>
97
- <tr>
98
- <td><a href="https://rkt.bz/aU"><img src="https://rocketgeek.com/wp/wp-content/uploads/2018/01/wpmembers_user_tracking-80x80.png" /></a></td>
99
- <td><strong><a href="https://rkt.bz/aU">User Tracking</a></strong><br />Tracks site usage by registered logged in users. Review what pages a user is viewing, download data as CSV.</td>
100
- </tr>
101
- <tr>
102
- <td><a href="https://rkt.bz/3b"><img src="https://rocketgeek.com/wp/wp-content/uploads/2017/12/mailchimp_logo-80x80.png" /></a></td>
103
- <td><strong><a href="https://rkt.bz/3b">MailChimp Integration</a></strong><br />Integrate MainChimp newsletter signup directly into your WP-Members registration form and allow users to subscribe/unsubscribe from their profile.</td>
104
- </tr>
105
- <tr>
106
- <td><a href="https://rkt.bz/r3"><img src="https://rocketgeek.com/wp/wp-content/uploads/2017/12/paypal_PNG22-80x80.png" /></a></td>
107
- <td><strong><a href="https://rkt.bz/r3">PayPal Subscriptions</a></strong><br />Start charging for access to your membership site. Easy to set up and manages user expiration dates. Uses basic PayPal IPN (Instant Payment Notification).</td>
108
- </tr>
109
- <tr>
110
- <td><a href="https://rkt.bz/r3"><img src="https://rocketgeek.com/wp/wp-content/uploads/2018/01/salesforce-80x80.png" /></a></td>
111
- <td><strong><a href="https://rkt.bz/r3">Salesforce Integration</a></strong><br />Integrates Salesforce Web-to-Lead with the WP-Members registration form data.</td>
112
- </tr>
113
- </table>
114
- </div>
115
- </div>
116
- </div></div></div><?php
117
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/tab-fields.php CHANGED
@@ -362,12 +362,12 @@ echo $field['values'][ $row ]; echo ( $row == count( $field['values'] )- 1 ) ?
362
  } }
363
  } else {
364
  if (version_compare(PHP_VERSION, '5.3.0') >= 0) { ?>
365
- <---- Select One ---->|,
366
  Choice One|choice_one,
367
  "1,000|one_thousand",
368
  "1,000-10,000|1,000-10,000",
369
  Last Row|last_row<?php } else { ?>
370
- <---- Select One ---->|,
371
  Choice One|choice_one,
372
  Choice 2|choice_two,
373
  Last Row|last_row<?php } } ?></textarea>
@@ -824,7 +824,7 @@ function wpmem_admin_fields_update() {
824
  || $type == 'multicheckbox'
825
  ) {
826
  // Get the values.
827
- $str = stripslashes( $_POST['add_dropdown_value'] );
828
  // Remove linebreaks.
829
  $str = trim( str_replace( array("\r", "\r\n", "\n"), '', $str ) );
830
  // Create array.
362
  } }
363
  } else {
364
  if (version_compare(PHP_VERSION, '5.3.0') >= 0) { ?>
365
+ ---- Select One ----|,
366
  Choice One|choice_one,
367
  "1,000|one_thousand",
368
  "1,000-10,000|1,000-10,000",
369
  Last Row|last_row<?php } else { ?>
370
+ ---- Select One ----|,
371
  Choice One|choice_one,
372
  Choice 2|choice_two,
373
  Last Row|last_row<?php } } ?></textarea>
824
  || $type == 'multicheckbox'
825
  ) {
826
  // Get the values.
827
+ $str = stripslashes( sanitize_textarea_field( $_POST['add_dropdown_value'] ) );
828
  // Remove linebreaks.
829
  $str = trim( str_replace( array("\r", "\r\n", "\n"), '', $str ) );
830
  // Create array.
admin/users.php CHANGED
@@ -172,7 +172,7 @@ function wpmem_users_page_load() {
172
  check_admin_referer( 'activate-user' );
173
 
174
  // Get the users.
175
- $users = $_REQUEST['user'];
176
 
177
  // Check to see if the user is already activated, if not, activate.
178
  if ( 'activate-single' == $action && 1 != get_user_meta( $users, 'active', true ) ) {
172
  check_admin_referer( 'activate-user' );
173
 
174
  // Get the users.
175
+ $users = filter_var( $_REQUEST['user'], FILTER_VALIDATE_INT );
176
 
177
  // Check to see if the user is already activated, if not, activate.
178
  if ( 'activate-single' == $action && 1 != get_user_meta( $users, 'active', true ) ) {
changelog.txt CHANGED
@@ -103,9 +103,9 @@
103
  = 3.1.5 =
104
 
105
  * Addressed some security issues to prevent XSS vulnerabilities.
106
- * Updated [wpmem_show_count] shortcode to include count of total blog users and users by role. See: http://rkt.bz/xC
107
- * Updated [wpmem_field] shortcode to accept [wpmem_field meta_key] instead of [wpmem_field field="meta_key"] (although the latter will still work). See http://rkt.bz/ae
108
- * Updated [wpmem_loginout] shortcode with some improvements to function code and link text attributes. See: http://rkt.bz/29
109
  * Updated auto excerpt for improved functionality, uses wp_trim_words(), deprecated add_ellipsis, strip_tags, close_tags, parse_shortcodes, strip_shortcodes for filter (these were never documented so it is unlikely that anyone uses them).
110
  * Updated hidden field type, now allows adding hidden fields to the registration form.
111
  * Compartmentalized installation of initial settings.
@@ -243,7 +243,7 @@ This package contains several fixes, some new filters, new field types and other
243
  * Changes in core to use fields from WP_Members class (preparing for new form field process).
244
  * Reviews and updates to code standards and inline documentation.
245
  * Fix for password reset (typo in object name checking for moderated registration)
246
- * Fix for PayPal extension (http://rkt.bz/r3); added logic to avoid errors if the PayPal extension is disabled but the main option setting remained turned on.
247
 
248
  = 3.0.6 =
249
 
@@ -265,7 +265,7 @@ This package contains several fixes, some new filters, new field types and other
265
 
266
  = 3.0.4 =
267
 
268
- * Reintroduced the global action variable $wpmem_a for backward compatibility with certain add-ons, most notably the WP-Members MailChimp extension ( see http://rkt.bz/3b ). Users of this extension should upgrade. This variable had been replaced with the new WP-Members object class introduced in 3.0. However, users of older extensions and those that may have customziations with logic may be using this variable, so rather than force updating and upgrading, it is being added back in.
269
  * Change to the priority of functions hooked to the the_content filter. Lowering the priority should better integrate the plugin with various builder plugins and other processes that currently filter the_content after WP-Members since the content will now be filtered later in the process. This also should improve situations where in the past the on-the-fly texturization shortcode for the WP-Members forms might remain unparsed.
270
 
271
  = 3.0.3 =
103
  = 3.1.5 =
104
 
105
  * Addressed some security issues to prevent XSS vulnerabilities.
106
+ * Updated [wpmem_show_count] shortcode to include count of total blog users and users by role. See: https://rocketgeek.com/plugins/wp-members/docs/shortcodes/other-shortcodes/
107
+ * Updated [wpmem_field] shortcode to accept [wpmem_field meta_key] instead of [wpmem_field field="meta_key"] (although the latter will still work). See https://rocketgeek.com/plugins/wp-members/docs/shortcodes/field-shortcodes/
108
+ * Updated [wpmem_loginout] shortcode with some improvements to function code and link text attributes. See: https://rocketgeek.com/plugins/wp-members/docs/shortcodes/other-shortcodes/
109
  * Updated auto excerpt for improved functionality, uses wp_trim_words(), deprecated add_ellipsis, strip_tags, close_tags, parse_shortcodes, strip_shortcodes for filter (these were never documented so it is unlikely that anyone uses them).
110
  * Updated hidden field type, now allows adding hidden fields to the registration form.
111
  * Compartmentalized installation of initial settings.
243
  * Changes in core to use fields from WP_Members class (preparing for new form field process).
244
  * Reviews and updates to code standards and inline documentation.
245
  * Fix for password reset (typo in object name checking for moderated registration)
246
+ * Fix for PayPal extension (https://rocketgeek.com/plugins/wp-members-paypal-subscriptions/); added logic to avoid errors if the PayPal extension is disabled but the main option setting remained turned on.
247
 
248
  = 3.0.6 =
249
 
265
 
266
  = 3.0.4 =
267
 
268
+ * Reintroduced the global action variable $wpmem_a for backward compatibility with certain add-ons, most notably the WP-Members MailChimp extension ( see https://rocketgeek.com/plugins/wp-members-mailchimp-integration/ ). Users of this extension should upgrade. This variable had been replaced with the new WP-Members object class introduced in 3.0. However, users of older extensions and those that may have customziations with logic may be using this variable, so rather than force updating and upgrading, it is being added back in.
269
  * Change to the priority of functions hooked to the the_content filter. Lowering the priority should better integrate the plugin with various builder plugins and other processes that currently filter the_content after WP-Members since the content will now be filtered later in the process. This also should improve situations where in the past the on-the-fly texturization shortcode for the WP-Members forms might remain unparsed.
270
 
271
  = 3.0.3 =
inc/api-forms.php CHANGED
@@ -165,4 +165,40 @@ function wpmem_fields( $tag = '', $form = 'default' ) {
165
  * @param string $tag (optional)
166
  */
167
  return apply_filters( 'wpmem_fields', $wpmem->fields, $tag );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  }
165
  * @param string $tag (optional)
166
  */
167
  return apply_filters( 'wpmem_fields', $wpmem->fields, $tag );
168
+ }
169
+
170
+ /**
171
+ * Sanitizes classes passed to the WP-Members form building functions.
172
+ *
173
+ * This generally uses just sanitize_html_class() but allows for
174
+ * whitespace so multiple classes can be passed (such as "regular-text code").
175
+ * This is an API wrapper for WP_Members_Forms::sanitize_class().
176
+ *
177
+ * @since 3.2.9
178
+ *
179
+ * @global object $wpmem
180
+ *
181
+ * @param string $class
182
+ * @return string sanitized_class
183
+ */
184
+ function wpmem_sanitize_class( $class ) {
185
+ global $wpmem;
186
+ return $wpmem->forms->sanitize_class( $class );
187
+ }
188
+
189
+ /**
190
+ * Sanitizes the text in an array.
191
+ *
192
+ * This is an API wrapper for WP_Members_Forms::sanitize_array().
193
+ *
194
+ * @since 3.2.9
195
+ *
196
+ * @global object $wpmem
197
+ *
198
+ * @param array $data
199
+ * @return array $data
200
+ */
201
+ function wpmem_sanitize_array( $data ) {
202
+ global $wpmem;
203
+ return $wpmem->forms->sanitize_array( $data );
204
  }
inc/class-wp-members-forms.php CHANGED
@@ -72,6 +72,7 @@ class WP_Members_Forms {
72
  $placeholder = ( isset( $args['placeholder'] ) ) ? $args['placeholder'] : false;
73
  $pattern = ( isset( $args['pattern'] ) ) ? $args['pattern'] : false;
74
  $title = ( isset( $args['title'] ) ) ? $args['title'] : false;
 
75
 
76
  // Handle field creation by type.
77
  switch ( $type ) {
@@ -118,8 +119,17 @@ class WP_Members_Forms {
118
 
119
  case "image":
120
  case "file":
121
- $class = ( 'textbox' == $class ) ? "file" : $this->sanitize_class( $class );
122
- $str = "<input name=\"$name\" type=\"file\" id=\"$id\" value=\"$value\" class=\"$class\"" . ( ( $required ) ? " required " : "" ) . " />";
 
 
 
 
 
 
 
 
 
123
  break;
124
 
125
  case "checkbox":
@@ -293,6 +303,54 @@ class WP_Members_Forms {
293
  return $sanitized_class;
294
  }
295
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  /**
297
  * Uploads file from the user.
298
  *
@@ -904,16 +962,16 @@ class WP_Members_Forms {
904
 
905
  } else {
906
  if ( 'file' == $field['type'] ) {
907
- $val = ( isset( $_FILES[ $meta_key ]['name'] ) ) ? $_FILES[ $meta_key ]['name'] : '' ;
908
  } else {
909
- $val = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
910
  }
911
  }
912
 
913
  // Does the tos field.
914
  if ( 'tos' == $meta_key ) {
915
 
916
- $val = sanitize_text_field( wpmem_get( $meta_key, '' ) );
917
 
918
  // Should be checked by default? and only if form hasn't been submitted.
919
  $val = ( ! $_POST && $field['checked_default'] ) ? $field['checked_value'] : $val;
@@ -932,7 +990,7 @@ class WP_Members_Forms {
932
  $tos_link_url = do_shortcode( $tos_content );
933
  $tos_link_tag = '<a href="' . esc_url( $tos_link_url ) . '" target="_blank">';
934
  } else {
935
- $tos_link_url = WPMEM_DIR . "/wp-members-tos.php";
936
  $tos_link_tag = "<a href=\"#\" onClick=\"window.open('" . $tos_link_url . "','mywindow');\">";
937
  }
938
 
@@ -982,7 +1040,9 @@ class WP_Members_Forms {
982
  $valtochk = $val;
983
  $val = $field['checked_value'];
984
  // if it should it be checked by default (& only if form not submitted), then override above...
985
- if ( $field['checked_default'] && ( ! $_POST && $tag != 'edit' ) ) { $val = $valtochk = $field['checked_value']; }
 
 
986
  }
987
 
988
  // For dropdown select.
@@ -991,7 +1051,9 @@ class WP_Members_Forms {
991
  $val = $field['values'];
992
  }
993
 
994
- if ( ! isset( $valtochk ) ) { $valtochk = ''; }
 
 
995
 
996
  if ( 'edit' == $tag && ( 'file' == $field['type'] || 'image' == $field['type'] ) ) {
997
 
@@ -1004,14 +1066,15 @@ class WP_Members_Forms {
1004
  }
1005
  $input.= '<br />' . $wpmem->get_text( 'profile_upload' ) . '<br />';
1006
  $input.= wpmem_form_field( array(
1007
- 'name' => $meta_key,
1008
- 'type' => $field['type'],
1009
- 'value' => $val,
1010
- 'compare' => $valtochk,
 
1011
  ) );
1012
 
1013
  } else {
1014
-
1015
  // For all other input types.
1016
  $formfield_args = array(
1017
  'name' => $meta_key, // ( 'username' == $meta_key ) ? 'user_login' : $meta_key,
@@ -1027,6 +1090,7 @@ class WP_Members_Forms {
1027
  'max' => ( isset( $field['max'] ) ) ? $field['max'] : false,
1028
  'rows' => ( isset( $field['rows'] ) ) ? $field['rows'] : false,
1029
  'cols' => ( isset( $field['cols'] ) ) ? $field['cols'] : false,
 
1030
  );
1031
  if ( 'multicheckbox' == $field['type'] || 'multiselect' == $field['type'] ) {
1032
  $formfield_args['delimiter'] = $field['delimiter'];
72
  $placeholder = ( isset( $args['placeholder'] ) ) ? $args['placeholder'] : false;
73
  $pattern = ( isset( $args['pattern'] ) ) ? $args['pattern'] : false;
74
  $title = ( isset( $args['title'] ) ) ? $args['title'] : false;
75
+ $file_types = ( isset( $args['file_types'] ) ) ? $args['file_types'] : false;
76
 
77
  // Handle field creation by type.
78
  switch ( $type ) {
119
 
120
  case "image":
121
  case "file":
122
+ if ( $file_types ) {
123
+ $file_types = explode( '|', $file_types );
124
+ foreach( $file_types as $file_type ) {
125
+ $array[] = "." . $file_type;
126
+ }
127
+ $accept = ' accept="' . implode( ",", $array ) . '"';
128
+ } else {
129
+ $accept = '';
130
+ }
131
+ $class = ( 'textbox' == $class ) ? "file" : $this->sanitize_class( $class );
132
+ $str = "<input name=\"$name\" type=\"file\" id=\"$id\" value=\"" . esc_attr( $value ) . "\" class=\"$class\"$accept" . ( ( $required ) ? " required " : "" ) . " />";
133
  break;
134
 
135
  case "checkbox":
303
  return $sanitized_class;
304
  }
305
  }
306
+
307
+ /**
308
+ * Sanitizes the text in an array.
309
+ *
310
+ * @since 3.2.9
311
+ *
312
+ * @param array $data
313
+ * @return array $data
314
+ */
315
+ function sanitize_array( $data ) {
316
+ if ( is_array( $data ) ) {
317
+ foreach( $data as $key => $val ) {
318
+ $data[ $key ] = sanitize_text_field( $val );
319
+ }
320
+ }
321
+ return $data;
322
+ }
323
+
324
+ /**
325
+ * Sanitizes field based on field type.
326
+ *
327
+ * @since 3.2.9
328
+ *
329
+ * @param string $data
330
+ * @param string $type
331
+ * @return string $sanitized_data
332
+ */
333
+ function sanitize_field( $data, $type ) {
334
+
335
+ switch ( $type ) {
336
+
337
+ case 'multiselect':
338
+ case 'multicheckbox':
339
+ $sanitized_data = $this->sanitize_array( $data );
340
+ break;
341
+
342
+ case 'textarea':
343
+ $sanitized_data = sanitize_textarea_field( $data );
344
+ break;
345
+
346
+ default:
347
+ $sanitized_data = sanitize_text_field( $data );
348
+ break;
349
+ }
350
+
351
+ return $sanitized_data;
352
+ }
353
+
354
  /**
355
  * Uploads file from the user.
356
  *
962
 
963
  } else {
964
  if ( 'file' == $field['type'] ) {
965
+ $val = ( isset( $_FILES[ $meta_key ]['name'] ) ) ? sanitize_file_name( $_FILES[ $meta_key ]['name'] ) : '' ;
966
  } else {
967
+ $val = ( isset( $_POST[ $meta_key ] ) ) ? $this->sanitize_field( $_POST[ $meta_key ], $field['type'] ) : '';
968
  }
969
  }
970
 
971
  // Does the tos field.
972
  if ( 'tos' == $meta_key ) {
973
 
974
+ // $val = sanitize_text_field( wpmem_get( $meta_key, '' ) );
975
 
976
  // Should be checked by default? and only if form hasn't been submitted.
977
  $val = ( ! $_POST && $field['checked_default'] ) ? $field['checked_value'] : $val;
990
  $tos_link_url = do_shortcode( $tos_content );
991
  $tos_link_tag = '<a href="' . esc_url( $tos_link_url ) . '" target="_blank">';
992
  } else {
993
+ $tos_link_url = add_query_arg( 'tos', 'display' );//WPMEM_DIR . "/wp-members-tos.php";
994
  $tos_link_tag = "<a href=\"#\" onClick=\"window.open('" . $tos_link_url . "','mywindow');\">";
995
  }
996
 
1040
  $valtochk = $val;
1041
  $val = $field['checked_value'];
1042
  // if it should it be checked by default (& only if form not submitted), then override above...
1043
+ if ( $field['checked_default'] && ( ! $_POST && $tag != 'edit' ) ) {
1044
+ $val = $valtochk = $field['checked_value'];
1045
+ }
1046
  }
1047
 
1048
  // For dropdown select.
1051
  $val = $field['values'];
1052
  }
1053
 
1054
+ if ( ! isset( $valtochk ) ) {
1055
+ $valtochk = '';
1056
+ }
1057
 
1058
  if ( 'edit' == $tag && ( 'file' == $field['type'] || 'image' == $field['type'] ) ) {
1059
 
1066
  }
1067
  $input.= '<br />' . $wpmem->get_text( 'profile_upload' ) . '<br />';
1068
  $input.= wpmem_form_field( array(
1069
+ 'name' => $meta_key,
1070
+ 'type' => $field['type'],
1071
+ 'value' => $val,
1072
+ 'compare' => $valtochk,
1073
+ 'file_types' => $field['file_types'],
1074
  ) );
1075
 
1076
  } else {
1077
+
1078
  // For all other input types.
1079
  $formfield_args = array(
1080
  'name' => $meta_key, // ( 'username' == $meta_key ) ? 'user_login' : $meta_key,
1090
  'max' => ( isset( $field['max'] ) ) ? $field['max'] : false,
1091
  'rows' => ( isset( $field['rows'] ) ) ? $field['rows'] : false,
1092
  'cols' => ( isset( $field['cols'] ) ) ? $field['cols'] : false,
1093
+ 'file_types' => ( isset( $field['file_types'] ) ) ? $field['file_types'] : false,
1094
  );
1095
  if ( 'multicheckbox' == $field['type'] || 'multiselect' == $field['type'] ) {
1096
  $formfield_args['delimiter'] = $field['delimiter'];
inc/class-wp-members-shortcodes.php CHANGED
@@ -215,6 +215,8 @@ class WP_Members_Shortcodes {
215
  * @type string $sub
216
  * @type string $meta_key
217
  * @type string $meta_value
 
 
218
  * }
219
  * @param string $content
220
  * @param string $tag
@@ -282,9 +284,10 @@ class WP_Members_Shortcodes {
282
  }
283
 
284
  // If there is a product attribute.
285
- if ( isset( $atts['product'] ) ) {
286
  // @todo What if attribute is comma separated/multiple?
287
- if ( wpmem_user_has_access( $atts['product'] ) ) {
 
288
  $do_return = true;
289
  }
290
  }
215
  * @type string $sub
216
  * @type string $meta_key
217
  * @type string $meta_value
218
+ * @type string $product
219
+ * @type string $membership
220
  * }
221
  * @param string $content
222
  * @param string $tag
284
  }
285
 
286
  // If there is a product attribute.
287
+ if ( isset( $atts['product'] ) || isset( $atts['membership'] ) ) {
288
  // @todo What if attribute is comma separated/multiple?
289
+ $membership = ( isset( $atts['membership'] ) ) ? $atts['membership'] : $atts['product'];
290
+ if ( wpmem_user_has_access( $membership ) ) {
291
  $do_return = true;
292
  }
293
  }
inc/class-wp-members-user-profile.php CHANGED
@@ -377,13 +377,20 @@ class WP_Members_User_Profile {
377
  // Update products.
378
  if ( isset( $_POST['_wpmem_membership_product'] ) ) {
379
  foreach ( $_POST['_wpmem_membership_product'] as $product_key => $product_value ) {
 
 
380
  // Enable or Disable?
381
  if ( 'enable' == $product_value ) {
382
  // Does product require a role?
383
  if ( false !== $wpmem->membership->products[ $product_key ]['role'] ) {
384
  wpmem_update_user_role( $user_id, $wpmem->membership->products[ $product_key ]['role'], 'add' );
385
  }
386
- $wpmem->user->set_user_product( $product_key, $user_id );
 
 
 
 
 
387
  }
388
  if ( 'disable' == $product_value ) {
389
  $wpmem->user->remove_user_product( $product_key, $user_id );
@@ -535,19 +542,40 @@ class WP_Members_User_Profile {
535
  <option value="disable">' . __( 'Disable', 'wp-members' ) . '</option>
536
  </select></td><td style="padding:0px 0px;">' . $value['title'] . '</td>
537
  <td style="padding:0px 0px;">';
 
 
 
 
 
 
538
  if ( isset( $user_products[ $key ] ) ) {
539
  echo '<span id="wpmem_product_enabled" class="dashicons dashicons-yes"></span>';
540
  if ( $user_products[ $key ] !== true ) {
541
- echo __( 'Expires:', 'wp-members' ) . ' ' . $user_products[ $key ];
 
542
  } else {
543
  _e( 'Enabled', 'wp-members' );
544
  }
545
  } else {
546
- echo "&nbsp;";
547
- }
 
 
 
 
 
 
548
  echo '</td></tr>';
549
  }
550
- ?></table></td>
 
 
 
 
 
 
 
 
551
  </tr>
552
  <?php
553
  }
377
  // Update products.
378
  if ( isset( $_POST['_wpmem_membership_product'] ) ) {
379
  foreach ( $_POST['_wpmem_membership_product'] as $product_key => $product_value ) {
380
+ // Sanitize.
381
+ $product_key = sanitize_text_field( $product_key );
382
  // Enable or Disable?
383
  if ( 'enable' == $product_value ) {
384
  // Does product require a role?
385
  if ( false !== $wpmem->membership->products[ $product_key ]['role'] ) {
386
  wpmem_update_user_role( $user_id, $wpmem->membership->products[ $product_key ]['role'], 'add' );
387
  }
388
+ // Do we need to set a specific date?
389
+ if ( isset( $_POST[ '_wpmem_membership_product_expiration_' . $product_key ] ) ) {
390
+ wpmem_set_user_product( $product_key, $user_id, sanitize_text_field( $_POST[ '_wpmem_membership_product_expiration_' . $product_key ] ) );
391
+ } else {
392
+ wpmem_set_user_product( $product_key, $user_id );
393
+ }
394
  }
395
  if ( 'disable' == $product_value ) {
396
  $wpmem->user->remove_user_product( $product_key, $user_id );
542
  <option value="disable">' . __( 'Disable', 'wp-members' ) . '</option>
543
  </select></td><td style="padding:0px 0px;">' . $value['title'] . '</td>
544
  <td style="padding:0px 0px;">';
545
+
546
+ // If user has date, display that; otherwise placeholder
547
+ $date_value = ( isset( $user_products[ $key ] ) ) ? $user_products[ $key ] : "";
548
+ $placeholder = ( ! isset( $user_products[ $key ] ) ) ? 'placeholder="' . __( 'Date', 'wp-members' ) . '" ' : '';
549
+ $product_date_field = ' <input type="text" name="_wpmem_membership_product_expiration_' . $key . '" value="' . $date_value . '" class="wpmem_datepicker" ' . $placeholder . '/>';
550
+
551
  if ( isset( $user_products[ $key ] ) ) {
552
  echo '<span id="wpmem_product_enabled" class="dashicons dashicons-yes"></span>';
553
  if ( $user_products[ $key ] !== true ) {
554
+ echo __( 'Expires:', 'wp-members' );
555
+ echo $product_date_field;
556
  } else {
557
  _e( 'Enabled', 'wp-members' );
558
  }
559
  } else {
560
+ if ( isset( $value['expires'] ) && ! empty( $value['expires'] ) ) {
561
+ echo '<span id="wpmem_product_enabled" class="dashicons"></span>';
562
+ echo __( 'Expires:', 'wp-members' );
563
+ echo $product_date_field;
564
+ } else {
565
+ echo "&nbsp;";
566
+ }
567
+ }
568
  echo '</td></tr>';
569
  }
570
+
571
+ ?></table>
572
+ <script>
573
+ jQuery(function() {
574
+ jQuery( ".wpmem_datepicker" ).datepicker({
575
+ dateFormat : "mm/dd/yy"
576
+ });
577
+ });
578
+ </script></td>
579
  </tr>
580
  <?php
581
  }
inc/class-wp-members-user.php CHANGED
@@ -251,11 +251,17 @@ class WP_Members_User {
251
  */
252
  function password_update( $action ) {
253
  if ( isset( $_POST['formsubmit'] ) ) {
254
- $params = ( 'reset' == $action ) ? array( 'user', 'email' ) : array( 'pass1', 'pass2' );
255
- $args = array(
256
- $params[0] => wpmem_get( $params[0], false ),
257
- $params[1] => wpmem_get( $params[1], false ),
258
- );
 
 
 
 
 
 
259
  return ( 'reset' == $action ) ? $this->password_reset( $args ) : $this->password_change( $args );
260
  }
261
  return;
251
  */
252
  function password_update( $action ) {
253
  if ( isset( $_POST['formsubmit'] ) ) {
254
+ if ( 'reset' == $action ) {
255
+ $args = array(
256
+ 'user' => sanitize_user( wpmem_get( 'user', false ) ),
257
+ 'email' => sanitize_email( wpmem_get( 'email', false ) ),
258
+ );
259
+ } else {
260
+ $args = array(
261
+ 'pass1' => wpmem_get( 'pass1', false ),
262
+ 'pass2' => wpmem_get( 'pass2', false ),
263
+ );
264
+ }
265
  return ( 'reset' == $action ) ? $this->password_reset( $args ) : $this->password_change( $args );
266
  }
267
  return;
inc/class-wp-members.php CHANGED
@@ -1,1734 +1,1759 @@
1
- <?php
2
- /**
3
- * The WP_Members Class.
4
- *
5
- * This is the main WP_Members object class. This class contains functions
6
- * for loading settings, shortcodes, hooks to WP, plugin dropins, constants,
7
- * and registration fields. It also manages whether content should be blocked.
8
- *
9
- * @package WP-Members
10
- * @subpackage WP_Members Object Class
11
- * @since 3.0.0
12
- */
13
-
14
- // Exit if accessed directly.
15
- if ( ! defined( 'ABSPATH' ) ) {
16
- exit();
17
- }
18
-
19
- class WP_Members {
20
-
21
- /**
22
- * Plugin version.
23
- *
24
- * @since 3.0.0
25
- * @access public
26
- * @var string
27
- */
28
- public $version = WPMEM_VERSION;
29
-
30
- /**
31
- * Database version
32
- *
33
- * @since 3.2.2
34
- * @access public
35
- * @var string
36
- */
37
- public $db_version = WPMEM_DB_VERSION;
38
-
39
- /**
40
- * Content block settings.
41
- *
42
- * @since 3.0.0
43
- * @access public
44
- * @var array
45
- */
46
- public $block;
47
-
48
- /**
49
- * Excerpt settings.
50
- *
51
- * @since 3.0.0
52
- * @access public
53
- * @var array
54
- */
55
- public $show_excerpt;
56
-
57
- /**
58
- * Show login form settings.
59
- *
60
- * @since 3.0.0
61
- * @access public
62
- * @var array
63
- */
64
- public $show_login;
65
-
66
- /**
67
- * Show registration form settings.
68
- *
69
- * @since 3.0.0
70
- * @access public
71
- * @var array
72
- */
73
- public $show_reg;
74
-
75
- /**
76
- * Auto-excerpt settings.
77
- *
78
- * @since 3.0.0
79
- * @access public
80
- * @var array
81
- */
82
- public $autoex;
83
-
84
- /**
85
- * Notify admin settings.
86
- *
87
- * @since 3.0.0
88
- * @access public
89
- * @var string
90
- */
91
- public $notify;
92
-
93
- /**
94
- * Moderated registration settings.
95
- *
96
- * @since 3.0.0
97
- * @access public
98
- * @var string
99
- */
100
- public $mod_reg;
101
-
102
- /**
103
- * Captcha settings.
104
- *
105
- * @since 3.0.0
106
- * @access public
107
- * @var array
108
- */
109
- public $captcha;
110
-
111
- /**
112
- * Enable expiration extension settings.
113
- *
114
- * @since 3.0.0
115
- * @access public
116
- * @var string
117
- */
118
- public $use_exp;
119
-
120
- /**
121
- * Expiration extension enable trial period.
122
- *
123
- * @since 3.0.0
124
- * @access public
125
- * @var string
126
- */
127
- public $use_trial;
128
-
129
- /**
130
- *
131
- *
132
- * @since 3.0.0
133
- * @access public
134
- * @var array
135
- */
136
- public $warnings;
137
-
138
- /**
139
- * Enable drop-ins setting.
140
- *
141
- * @since 3.1.9
142
- * @access public
143
- * @var string
144
- */
145
- public $dropins = 0;
146
-
147
- /**
148
- * Container for enabled dropins.
149
- *
150
- * @since 3.1.9
151
- * @access public
152
- * @var array
153
- */
154
- public $dropins_enabled = array();
155
-
156
- /**
157
- * Current plugin action container.
158
- *
159
- * @since 3.0.0
160
- * @access public
161
- * @var string
162
- */
163
- public $action;
164
-
165
- /**
166
- * Regchk container.
167
- *
168
- * @since 3.0.0
169
- * @access public
170
- * @var string
171
- */
172
- public $regchk;
173
-
174
- /**
175
- * User page settings.
176
- *
177
- * @since 3.0.0
178
- * @access public
179
- * @var array
180
- */
181
- public $user_pages;
182
-
183
- /**
184
- * Custom Post Type settings.
185
- *
186
- * @since 3.0.0
187
- * @access public
188
- * @var array
189
- */
190
- public $post_types;
191
-
192
- /**
193
- * Setting for applying texturization.
194
- *
195
- * @since 3.1.7
196
- * @access public
197
- * @var boolean
198
- */
199
- public $texturize;
200
-
201
- /**
202
- * Enable product creation.
203
- *
204
- * @since 3.2.0
205
- * @access public
206
- * @var boolean
207
- */
208
- public $enable_products;
209
-
210
- /**
211
- * Enable logged-in menu clones.
212
- *
213
- * @since 3.2.0
214
- * @access public
215
- * @var string
216
- */
217
- public $clone_menus;
218
-
219
- /**
220
- * Container for error messages.
221
- *
222
- * @since 3.2.0
223
- * @access public
224
- * @var string
225
- */
226
- public $error;
227
-
228
- /**
229
- * Plugin initialization function.
230
- *
231
- * @since 3.0.0
232
- * @since 3.1.6 Dependencies now loaded by object.
233
- */
234
- function __construct() {
235
-
236
- // Load dependent files.
237
- $this->load_dependencies();
238
-
239
- /**
240
- * Filter the options before they are loaded into constants.
241
- *
242
- * @since 2.9.0
243
- * @since 3.0.0 Moved to the WP_Members class.
244
- *
245
- * @param array $this->settings An array of the WP-Members settings.
246
- */
247
- $settings = apply_filters( 'wpmem_settings', get_option( 'wpmembers_settings' ) );
248
-
249
- // Validate that v3 settings are loaded.
250
- if ( ! isset( $settings['version'] )
251
- || $settings['version'] != $this->version
252
- || ! isset( $settings['db_version'] )
253
- || $settings['db_version'] != $this->db_version ) {
254
- /**
255
- * Load installation routine.
256
- */
257
- require_once( WPMEM_PATH . 'inc/install.php' );
258
- // Update settings.
259
- /** This filter is documented in /inc/class-wp-members.php */
260
- $settings = apply_filters( 'wpmem_settings', wpmem_do_install() );
261
- }
262
-
263
- // Assemble settings.
264
- foreach ( $settings as $key => $val ) {
265
- $this->$key = $val;
266
- }
267
-
268
- $this->load_user_pages();
269
- $this->cssurl = ( isset( $this->style ) && $this->style == 'use_custom' ) ? $this->cssurl : $this->style; // Set the stylesheet.
270
- $this->forms = new WP_Members_Forms; // Load forms.
271
- $this->api = new WP_Members_API; // Load api.
272
- $this->user = new WP_Members_User( $this ); // Load user functions.
273
- $this->shortcodes = new WP_Members_Shortcodes(); // Load shortcodes.
274
- $this->membership = new WP_Members_Products(); // Load membership plans
275
- $this->email = new WP_Members_Email; // Load email functions
276
- $this->menus = ( $this->clone_menus ) ? new WP_Members_Menus() : null; // Load clone menus.
277
-
278
- /**
279
- * Fires after main settings are loaded.
280
- *
281
- * @since 3.0
282
- * @deprecated 3.2.0 Use wpmem_after_init instead.
283
- */
284
- do_action( 'wpmem_settings_loaded' );
285
-
286
- // Preload the expiration module, if available.
287
- $exp_active = ( function_exists( 'wpmem_exp_init' ) || function_exists( 'wpmem_set_exp' ) ) ? true : false;
288
- define( 'WPMEM_EXP_MODULE', $exp_active );
289
-
290
- // Load actions and filters.
291
- $this->load_hooks();
292
-
293
- // Load contants.
294
- $this->load_constants();
295
-
296
- // Load dropins.
297
- if ( $this->dropins ) {
298
- $this->load_dropins();
299
- }
300
- }
301
-
302
- /**
303
- * Plugin initialization function to load hooks.
304
- *
305
- * @since 3.0.0
306
- */
307
- function load_hooks() {
308
-
309
- /**
310
- * Fires before action and filter hooks load.
311
- *
312
- * @since 3.0.0
313
- * @since 3.1.6 Fires before hooks load.
314
- */
315
- do_action( 'wpmem_load_hooks' );
316
-
317
- // Add actions.
318
- add_action( 'template_redirect', array( $this, 'get_action' ) );
319
- add_action( 'widgets_init', array( $this, 'widget_init' ) ); // initializes the widget
320
- add_action( 'admin_init', array( $this, 'load_admin' ) ); // check user role to load correct dashboard
321
- add_action( 'admin_menu', 'wpmem_admin_options' ); // adds admin menu
322
- add_action( 'user_register', 'wpmem_wp_reg_finalize' ); // handles wp native registration
323
- add_action( 'login_enqueue_scripts', 'wpmem_wplogin_stylesheet' ); // styles the native registration
324
- add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ) ); // Enqueues the stylesheet.
325
- add_action( 'wp_enqueue_scripts', array( $this, 'loginout_script' ) );
326
- add_action( 'init', array( $this, 'load_textdomain' ) ); //add_action( 'plugins_loaded', 'wpmem_load_textdomain' );
327
- add_action( 'init', array( $this->membership, 'add_cpt' ), 0 ); // Adds membership plans custom post type.
328
- add_action( 'pre_get_posts', array( $this, 'do_hide_posts' ) );
329
- add_action( 'customize_register', array( $this, 'customizer_settings' ) );
330
-
331
- if ( is_user_logged_in() ) {
332
- add_action( 'wpmem_pwd_change', array( $this->user, 'set_password' ), 9, 2 );
333
- add_action( 'wpmem_pwd_change', array( $this->user, 'set_as_logged_in' ), 10 );
334
- }
335
-
336
- // Add filters.
337
- add_filter( 'the_content', array( $this, 'do_securify' ), 99 );
338
- add_filter( 'allow_password_reset', array( $this->user, 'no_reset' ) ); // no password reset for non-activated users
339
- add_filter( 'register_form', 'wpmem_wp_register_form' ); // adds fields to the default wp registration
340
- add_action( 'woocommerce_register_form', 'wpmem_woo_register_form' );
341
- add_filter( 'registration_errors', 'wpmem_wp_reg_validate', 10, 3 ); // native registration validation
342
- add_filter( 'comments_open', array( $this, 'do_securify_comments' ), 99 ); // securifies the comments
343
- add_filter( 'wpmem_securify', array( $this, 'reg_securify' ) ); // adds success message on login form if redirected
344
- //add_filter( 'query_vars', array( $this, 'add_query_vars' ), 10, 2 ); // adds custom query vars
345
- add_filter( 'get_pages', array( $this, 'filter_get_pages' ) );
346
- add_filter( 'wp_get_nav_menu_items', array( $this, 'filter_nav_menu_items' ), null, 3 );
347
- add_filter( 'get_previous_post_where', array( $this, 'filter_get_adjacent_post_where' ) );
348
- add_filter( 'get_next_post_where', array( $this, 'filter_get_adjacent_post_where' ) );
349
-
350
- // If registration is moderated, check for activation (blocks backend login by non-activated users).
351
- if ( $this->mod_reg == 1 ) {
352
- add_filter( 'authenticate', array( $this->user, 'check_activated' ), 99, 3 );
353
- }
354
-
355
- /**
356
- * Fires after action and filter hooks load.
357
- *
358
- * @since 3.0.0
359
- * @since 3.1.6 Was wpmem_load_hooks, now wpmem_hooks_loaded.
360
- */
361
- do_action( 'wpmem_hooks_loaded' );
362
- }
363
-
364
- /**
365
- * Load drop-ins.
366
- *
367
- * @since 3.0.0
368
- *
369
- * @todo This is experimental. The function and its operation is subject to change.
370
- */
371
- function load_dropins() {
372
-
373
- /**
374
- * Fires before dropins load (for adding additional drop-ins).
375
- *
376
- * @since 3.0.0
377
- * @since 3.1.6 Fires before dropins.
378
- */
379
- do_action( 'wpmem_load_dropins' );
380
-
381
- /**
382
- * Filters the drop-in file folder.
383
- *
384
- * @since 3.0.0
385
- *
386
- * @param string $folder The drop-in file folder.
387
- */
388
- $folder = apply_filters( 'wpmem_dropin_folder', WPMEM_DROPIN_DIR );
389
-
390
- // Load any drop-ins.
391
- $settings = get_option( 'wpmembers_dropins' );
392
- $this->dropins_enabled = ( $settings ) ? $settings : array();
393
- if ( ! empty( $this->dropins_enabled ) ) {
394
- foreach ( $this->dropins_enabled as $filename ) {
395
- $dropin = $folder . $filename;
396
- if ( file_exists( $dropin ) ) {
397
- include_once( $dropin );
398
- }
399
- }
400
- }
401
-
402
- /**
403
- * Fires before dropins load (for adding additional drop-ins).
404
- *
405
- * @since 3.0.0
406
- * @since 3.1.6 Was wpmem_load_dropins, now wpmem_dropins_loaded.
407
- */
408
- do_action( 'wpmem_dropins_loaded' );
409
- }
410
-
411
- /**
412
- * Loads pre-3.0 constants (included primarily for add-on compatibility).
413
- *
414
- * @since 3.0.0
415
- */
416
- function load_constants() {
417
- ( ! defined( 'WPMEM_BLOCK_POSTS' ) ) ? define( 'WPMEM_BLOCK_POSTS', $this->block['post'] ) : ''; // @todo Can deprecate? Probably 3.3
418
- ( ! defined( 'WPMEM_BLOCK_PAGES' ) ) ? define( 'WPMEM_BLOCK_PAGES', $this->block['page'] ) : ''; // @todo Can deprecate? Probably 3.3
419
- ( ! defined( 'WPMEM_SHOW_EXCERPT' ) ) ? define( 'WPMEM_SHOW_EXCERPT', $this->show_excerpt['post'] ) : ''; // @todo Can deprecate? Probably 3.3
420
- ( ! defined( 'WPMEM_NOTIFY_ADMIN' ) ) ? define( 'WPMEM_NOTIFY_ADMIN', $this->notify ) : ''; // @todo Can deprecate? Probably 3.3
421
- ( ! defined( 'WPMEM_MOD_REG' ) ) ? define( 'WPMEM_MOD_REG', $this->mod_reg ) : ''; // @todo Can deprecate? Probably 3.3
422
- ( ! defined( 'WPMEM_CAPTCHA' ) ) ? define( 'WPMEM_CAPTCHA', $this->captcha ) : ''; // @todo Can deprecate? Probably 3.3
423
- ( ! defined( 'WPMEM_NO_REG' ) ) ? define( 'WPMEM_NO_REG', ( -1 * $this->show_reg['post'] ) ) : ''; // @todo Can deprecate? Probably 3.3
424
- ( ! defined( 'WPMEM_USE_EXP' ) ) ? define( 'WPMEM_USE_EXP', $this->use_exp ) : '';
425
- ( ! defined( 'WPMEM_USE_TRL' ) ) ? define( 'WPMEM_USE_TRL', $this->use_trial ) : '';
426
- ( ! defined( 'WPMEM_IGNORE_WARN' ) ) ? define( 'WPMEM_IGNORE_WARN', $this->warnings ) : ''; // @todo Can deprecate? Probably 3.3
427
-
428
- ( ! defined( 'WPMEM_MSURL' ) ) ? define( 'WPMEM_MSURL', $this->user_pages['profile'] ) : ''; // @todo Can deprecate? Probably 3.3
429
- ( ! defined( 'WPMEM_REGURL' ) ) ? define( 'WPMEM_REGURL', $this->user_pages['register'] ) : ''; // @todo Can deprecate? Probably 3.3
430
- ( ! defined( 'WPMEM_LOGURL' ) ) ? define( 'WPMEM_LOGURL', $this->user_pages['login'] ) : ''; // @todo Can deprecate? Probably 3.3
431
-
432
- ( ! defined( 'WPMEM_DROPIN_DIR' ) ) ? define( 'WPMEM_DROPIN_DIR', WP_PLUGIN_DIR . '/wp-members-dropins/' ) : '';
433
-
434
- define( 'WPMEM_CSSURL', $this->cssurl );
435
- }
436
-
437
- /**
438
- * Load dependent files.
439
- *
440
- * @since 3.1.6
441
- */
442
- function load_dependencies() {
443
-
444
- /**
445
- * Filter the location and name of the pluggable file.
446
- *
447
- * @since 2.9.0
448
- * @since 3.1.6 Moved in load order to come before dependencies.
449
- *
450
- * @param string The path to WP-Members plugin functions file.
451
- */
452
- $wpmem_pluggable = apply_filters( 'wpmem_plugins_file', WP_PLUGIN_DIR . '/wp-members-pluggable.php' );
453
-
454
- // Preload any custom functions, if available.
455
- if ( file_exists( $wpmem_pluggable ) ) {
456
- include( $wpmem_pluggable );
457
- }
458
-
459
- require_once( WPMEM_PATH . 'inc/class-wp-members-api.php' );
460
- require_once( WPMEM_PATH . 'inc/class-wp-members-email.php' );
461
- require_once( WPMEM_PATH . 'inc/class-wp-members-forms.php' );
462
- require_once( WPMEM_PATH . 'inc/class-wp-members-menus.php' );
463
- require_once( WPMEM_PATH . 'inc/class-wp-members-products.php' );
464
- require_once( WPMEM_PATH . 'inc/class-wp-members-shortcodes.php' );
465
- require_once( WPMEM_PATH . 'inc/class-wp-members-user.php' );
466
- require_once( WPMEM_PATH . 'inc/class-wp-members-user-profile.php' );
467
- require_once( WPMEM_PATH . 'inc/class-wp-members-widget.php' );
468
- require_once( WPMEM_PATH . 'inc/api.php' );
469
- require_once( WPMEM_PATH . 'inc/api-email.php' );
470
- require_once( WPMEM_PATH . 'inc/api-forms.php' );
471
- require_once( WPMEM_PATH . 'inc/api-users.php' );
472
- require_once( WPMEM_PATH . 'inc/api-utilities.php' );
473
- require_once( WPMEM_PATH . 'inc/forms.php' );
474
- require_once( WPMEM_PATH . 'inc/dialogs.php' );
475
- require_once( WPMEM_PATH . 'inc/wp-registration.php' );
476
- require_once( WPMEM_PATH . 'inc/deprecated.php' );
477
- //require_once( WPMEM_PATH . 'inc/core.php' ); // @deprectated 3.2.4
478
- //require_once( WPMEM_PATH . 'inc/utilities.php' ); // @deprecated 3.2.3
479
- //require_once( WPMEM_PATH . 'inc/sidebar.php' ); // @deprecated 3.2.0
480
- //require_once( WPMEM_PATH . 'inc/shortcodes.php' ); // @deprecated 3.2.0
481
- //require_once( WPMEM_PATH . 'inc/email.php' ); // @deprecated 3.2.0
482
- //require_once( WPMEM_PATH . 'inc/users.php' ); // @deprecated 3.1.9
483
-
484
- }
485
-
486
- /**
487
- * Load admin API and dependencies.
488
- *
489
- * Determines which scripts to load and actions to use based on the
490
- * current users capabilities.
491
- *
492
- * @since 2.5.2
493
- * @since 3.1.0 Added admin api object.
494
- * @since 3.1.7 Moved from main plugin file as wpmem_chk_admin() to main object.
495
- */
496
- function load_admin() {
497
-
498
- /**
499
- * Fires before initialization of admin options.
500
- *
501
- * @since 2.9.0
502
- */
503
- do_action( 'wpmem_pre_admin_init' );
504
-
505
- // Initilize the admin api.
506
- $this->load_admin_api();
507
-
508
- /**
509
- * Fires after initialization of admin options.
510
- *
511
- * @since 2.9.0
512
- */
513
- do_action( 'wpmem_after_admin_init' );
514
- }
515
-
516
- /**
517
- * Gets the requested action.
518
- *
519
- * @since 3.0.0
520
- *
521
- * @global string $wpmem_a The WP-Members action variable.
522
- */
523
- function get_action() {
524
-
525
- // Get the action being done (if any).
526
- $this->action = sanitize_text_field( wpmem_get( 'a', '', 'request' ) );
527
-
528
- // For backward compatibility with processes that check $wpmem_a.
529
- global $wpmem_a;
530
- $wpmem_a = $this->action;
531
-
532
- /**
533
- * Fires when the wpmem action is retrieved.
534
- *
535
- * @since 3.1.7
536
- */
537
- do_action( 'wpmem_get_action' );
538
-
539
- // Get the regchk value (if any).
540
- $this->regchk = $this->get_regchk( $this->action );
541
- }
542
-
543
- /**
544
- * Gets the regchk value.
545
- *
546
- * regchk is a legacy variable that contains information about the current
547
- * action being performed. Login, logout, password, registration, profile
548
- * update functions all return a specific value that is stored in regchk.
549
- * This value and information about the current action can then be used to
550
- * determine what content is to be displayed by the securify function.
551
- *
552
- * @since 3.0.0
553
- *
554
- * @global string $wpmem_a The WP-Members action variable.
555
- *
556
- * @param string $action The current action.
557
- * @return string The regchk value.
558
- */
559
- function get_regchk( $action ) {
560
-
561
- switch ( $action ) {
562
-
563
- case 'login':
564
- $regchk = $this->user->login();
565
- break;
566
-
567
- case 'logout':
568
- $regchk = $this->user->logout();
569
- break;
570
-
571
- case 'pwdchange':
572
- $regchk = $this->user->password_update( 'change' );
573
- break;
574
-
575
- case 'pwdreset':
576
- $regchk = $this->user->password_update( 'reset' );
577
- break;
578
-
579
- case 'getusername':
580
- $regchk = $this->user->retrieve_username();
581
- break;
582
-
583
- case 'register':
584
- case 'update':
585
- require_once( WPMEM_PATH . 'inc/register.php' );
586
- $regchk = wpmem_registration( $action );
587
- break;
588
-
589
- default:
590
- $regchk = ( isset( $regchk ) ) ? $regchk : '';
591
- break;
592
- }
593
-
594
- /**
595
- * Filter wpmem_regchk.
596
- *
597
- * The value of regchk is determined by functions that may be run in the get_regchk function.
598
- * This value determines what happens in the wpmem_securify() function.
599
- *
600
- * @since 2.9.0
601
- * @since 3.0.0 Moved to get_regchk() in WP_Members object.
602
- *
603
- * @param string $this->regchk The value of wpmem_regchk.
604
- * @param string $this->action The $wpmem_a action.
605
- */
606
- $regchk = apply_filters( 'wpmem_regchk', $regchk, $action );
607
-
608
- // Legacy global variable for use with older extensions.
609
- global $wpmem_regchk;
610
- $wpmem_regchk = $regchk;
611
-
612
- return $regchk;
613
- }
614
-
615
- /**
616
- * Determines if content should be blocked.
617
- *
618
- * This function was originally stand alone in the core file and
619
- * was moved to the WP_Members class in 3.0.
620
- *
621
- * @since 3.0.0
622
- *
623
- * @global object $post The WordPress Post object.
624
- * @return bool $block true|false
625
- */
626
- function is_blocked() {
627
-
628
- global $post;
629
-
630
- if ( $post ) {
631
-
632
- // Backward compatibility for old block/unblock meta.
633
- $meta = get_post_meta( $post->ID, '_wpmem_block', true );
634
- if ( ! $meta ) {
635
- // Check for old meta.
636
- $old_block = get_post_meta( $post->ID, 'block', true );
637
- $old_unblock = get_post_meta( $post->ID, 'unblock', true );
638
- $meta = ( $old_block ) ? 1 : ( ( $old_unblock ) ? 0 : $meta );
639
- }
640
-
641
- // Setup defaults.
642
- $defaults = array(
643
- 'post_id' => $post->ID,
644
- 'post_type' => $post->post_type,
645
- 'block' => ( isset( $this->block[ $post->post_type ] ) && $this->block[ $post->post_type ] == 1 ) ? true : false,
646
- 'block_meta' => $meta, // @todo get_post_meta( $post->ID, '_wpmem_block', true ),
647
- 'block_type' => ( isset( $this->block[ $post->post_type ] ) ) ? $this->block[ $post->post_type ] : 0,
648
- );
649
-
650
- /**
651
- * Filter the block arguments.
652
- *
653
- * @since 2.9.8
654
- * @since 3.0.0 Moved to is_blocked() in WP_Members object.
655
- *
656
- * @param array $args Null.
657
- * @param array $defaults Although you are not filtering the defaults, knowing what they are can assist developing more powerful functions.
658
- */
659
- $args = apply_filters( 'wpmem_block_args', '', $defaults );
660
-
661
- // Merge $args with defaults.
662
- $args = ( wp_parse_args( $args, $defaults ) );
663
-
664
- if ( is_single() || is_page() ) {
665
- switch( $args['block_type'] ) {
666
- case 1: // If content is blocked by default.
667
- $args['block'] = ( $args['block_meta'] == '0' ) ? false : $args['block'];
668
- break;
669
- case 0 : // If content is unblocked by default.
670
- $args['block'] = ( $args['block_meta'] == '1' ) ? true : $args['block'];
671
- break;
672
- }
673
-
674
- } else {
675
- $args['block'] = false;
676
- }
677
-
678
- } else {
679
- $args = array( 'block' => false );
680
- }
681
-
682
- // Don't block user pages.
683
- $args['block'] = ( in_array( get_permalink(), $this->user_pages ) ) ? false : $args['block'];
684
-
685
- /**
686
- * Filter the block boolean.
687
- *
688
- * @since 2.7.5
689
- *
690
- * @param bool $args['block']
691
- * @param array $args
692
- */
693
- return apply_filters( 'wpmem_block', $args['block'], $args );
694
- }
695
-
696
- /**
697
- * The Securify Content Filter.
698
- *
699
- * This is the primary function that picks up where get_action() leaves off.
700
- * Determines whether content is shown or hidden for both post and pages. This
701
- * is a filter function for the_content.
702
- *
703
- * @link https://developer.wordpress.org/reference/functions/the_content/
704
- * @link https://developer.wordpress.org/reference/hooks/the_content/
705
- *
706
- * @since 3.0.0
707
- *
708
- * @global object $post The WordPress Post object.
709
- * @global object $wpmem The WP_Members object.
710
- * @global string $wpmem_themsg Contains messages to be output.
711
- * @param string $content
712
- * @return string $content
713
- */
714
- function do_securify( $content = null ) {
715
-
716
- global $post, $wpmem, $wpmem_themsg;
717
-
718
- $content = ( is_single() || is_page() ) ? $content : wpmem_do_excerpt( $content );
719
-
720
- if ( ( ! has_shortcode( $content, 'wp-members' ) ) ) {
721
-
722
- if ( $this->regchk == "captcha" ) {
723
- global $wpmem_captcha_err;
724
- $wpmem_themsg = $wpmem->get_text( 'reg_captcha_err' ) . '<br /><br />' . $wpmem_captcha_err;
725
- }
726
-
727
- // Block/unblock Posts.
728
- if ( ! is_user_logged_in() && $this->is_blocked() == true ) {
729
-
730
- //Show the login and registration forms.
731
- if ( $this->regchk ) {
732
-
733
- // Empty content in any of these scenarios.
734
- $content = '';
735
-
736
- switch ( $this->regchk ) {
737
-
738
- case "loginfailed":
739
- $content = wpmem_inc_loginfailed();
740
- break;
741
-
742
- case "success":
743
- $content = wpmem_inc_regmessage( $this->regchk, $wpmem_themsg );
744
- $content = $content . wpmem_inc_login();
745
- break;
746
-
747
- default:
748
- $content = wpmem_inc_regmessage( $this->regchk, $wpmem_themsg );
749
- $content = $content . wpmem_inc_registration();
750
- break;
751
- }
752
-
753
- } else {
754
-
755
- // Toggle shows excerpt above login/reg on posts/pages.
756
- global $wp_query;
757
- if ( isset( $wp_query->query_vars['page'] ) && $wp_query->query_vars['page'] > 1 ) {
758
-
759
- // Shuts down excerpts on multipage posts if not on first page.
760
- $content = '';
761
-
762
- } elseif ( isset( $this->show_excerpt[ $post->post_type ] ) && $this->show_excerpt[ $post->post_type ] == 1 ) {
763
-
764
- if ( ! stristr( $content, '<span id="more' ) ) {
765
- $content = wpmem_do_excerpt( $content );
766
- } else {
767
- $len = strpos( $content, '<span id="more' );
768
- $content = substr( $content, 0, $len );
769
- }
770
-
771
- } else {
772
-
773
- // Empty all content.
774
- $content = '';
775
-
776
- }
777
-
778
- $content = ( isset( $this->show_login[ $post->post_type ] ) && $this->show_login[ $post->post_type ] == 1 ) ? $content . wpmem_inc_login() : $content . wpmem_inc_login( 'page', '', 'hide' );
779
-
780
- $content = ( isset( $this->show_reg[ $post->post_type ] ) && $this->show_reg[ $post->post_type ] == 1 ) ? $content . wpmem_inc_registration() : $content;
781
- }
782
-
783
- // Protects comments if expiration module is used and user is expired.
784
- } elseif ( is_user_logged_in() && $this->is_blocked() == true ){
785
-
786
- if ( $this->use_exp == 1 && function_exists( 'wpmem_do_expmessage' ) ) {
787
- /**
788
- * Filters the user expired message used by the PayPal extension.
789
- *
790
- * @since 3.2.0
791
- *
792
- * @param string $message
793
- * @param string $content
794
- */
795
- $content = apply_filters( 'wpmem_do_expmessage', wpmem_do_expmessage( $content ), $content );
796
- }
797
- }
798
- }
799
-
800
- /**
801
- * Filter the value of $content after wpmem_securify has run.
802
- *
803
- * @since 2.7.7
804
- * @since 3.0.0 Moved to new method in WP_Members Class.
805
- *
806
- * @param string $content The content after securify has run.
807
- */
808
- $content = apply_filters( 'wpmem_securify', $content );
809
-
810
- if ( 1 == $this->texturize && strstr( $content, '[wpmem_txt]' ) ) {
811
- // Fix the wptexturize.
812
- remove_filter( 'the_content', 'wpautop' );
813
- remove_filter( 'the_content', 'wptexturize' );
814
- add_filter( 'the_content', array( $this, 'texturize' ), 999 );
815
- }
816
-
817
- return $content;
818
-
819
- }
820
-
821
- /**
822
- * Securifies the comments.
823
- *
824
- * If the user is not logged in and the content is blocked
825
- * (i.e. wpmem->is_blocked() returns true), function loads a
826
- * dummy/empty comments template.
827
- *
828
- * @since 2.9.9
829
- * @since 3.2.0 Moved wpmem_securify_comments() to main class, renamed.
830
- *
831
- * @return bool $open true if current post is open for comments, otherwise false.
832
- */
833
- function do_securify_comments( $open ) {
834
-
835
- $open = ( ! is_user_logged_in() && wpmem_is_blocked() ) ? false : $open;
836
-
837
- /**
838
- * Filters whether comments are open or not.
839
- *
840
- * @since 3.0.0
841
- * @since 3.2.0 Moved to main class.
842
- *
843
- * @param bool $open true if current post is open for comments, otherwise false.
844
- */
845
- $open = apply_filters( 'wpmem_securify_comments', $open );
846
-
847
- if ( ! $open ) {
848
- /** This filter is documented in wp-includes/comment-template.php */
849
- add_filter( 'comments_array', array( $this, 'do_securify_comments_array' ), 10, 2 );
850
- }
851
-
852
- return $open;
853
- }
854
-
855
- /**
856
- * Empties the comments array if content is blocked.
857
- *
858
- * @since 3.0.1
859
- * @since 3.2.0 Moved wpmem_securify_comments_array() to main class, renamed.
860
- *
861
- * @global object $wpmem The WP-Members object class.
862
- *
863
- * @return array $comments The comments array.
864
- */
865
- function do_securify_comments_array( $comments , $post_id ) {
866
- $comments = ( ! is_user_logged_in() && wpmem_is_blocked() ) ? array() : $comments;
867
- return $comments;
868
- }
869
-
870
- /**
871
- * Adds the successful registration message on the login page if reg_nonce validates.
872
- *
873
- * @since 3.1.7
874
- * @since 3.2.0 Moved to wpmem object, renamed reg_securify()
875
- *
876
- * @param string $content
877
- * @return string $content
878
- */
879
- function reg_securify( $content ) {
880
- global $wpmem, $wpmem_themsg;
881
- $nonce = wpmem_get( 'reg_nonce', false, 'get' );
882
- if ( $nonce && wp_verify_nonce( $nonce, 'register_redirect' ) ) {
883
- $content = wpmem_inc_regmessage( 'success', $wpmem_themsg );
884
- $content = $content . wpmem_inc_login();
885
- }
886
- return $content;
887
- }
888
-
889
- /**
890
- * Gets an array of hidden post IDs.
891
- *
892
- * @since 3.2.0
893
- *
894
- * @global object $wpdb
895
- * @return array $hidden
896
- */
897
- function hidden_posts() {
898
- global $wpdb;
899
- $hidden = get_transient( '_wpmem_hidden_posts' );
900
- if ( false === $hidden ) {
901
- $hidden = $this->update_hidden_posts();
902
- }
903
- return $hidden;
904
- }
905
-
906
- /**
907
- * Updates the hidden post array transient.
908
- *
909
- * @since 3.2.0
910
- *
911
- * @global object $wpdb
912
- * @return array $hidden
913
- */
914
- function update_hidden_posts() {
915
- global $wpdb;
916
- $hidden = array();
917
- $results = $wpdb->get_results( "SELECT post_id FROM " . $wpdb->prefix . "postmeta WHERE meta_key = '_wpmem_block' AND meta_value = 2" );
918
- foreach( $results as $result ) {
919
- $hidden[] = $result->post_id;
920
- }
921
- set_transient( '_wpmem_hidden_posts', $hidden, 60*5 );
922
- return $hidden;
923
- }
924
-
925
- /**
926
- * Gets an array of hidden post IDs.
927
- *
928
- * @since 3.2.0
929
- *
930
- * @return array $hidden
931
- */
932
- function get_hidden_posts() {
933
- $hidden = array();
934
- if ( ! is_admin() && ( ! is_user_logged_in() ) ) {
935
- $hidden = $this->hidden_posts();
936
- }
937
- // @todo Possibly separate query here to check. If the user IS logged in, check what posts they DON'T have access to.
938
- if ( ! is_admin() && is_user_logged_in() && 1 == $this->enable_products ) {
939
- // Get user product access.
940
- // @todo This maybe should be a transient stored in the user object.
941
- $hidden = $this->hidden_posts();
942
- $hidden = ( is_array( $hidden ) ) ? $hidden : array();
943
- foreach ( $this->membership->products as $key => $value ) {
944
- if ( isset( $this->user->access[ $key ] ) && ( true === $this->user->access[ $key ] || $this->user->is_current( $this->user->access[ $key ] ) ) ) {
945
- foreach ( $hidden as $post_id ) {
946
- if ( 1 == get_post_meta( $post_id, $this->membership->post_stem . $key, true ) ) {
947
- $hidden_key = array_search( $post_id, $hidden );
948
- unset( $hidden[ $hidden_key ] );
949
- }
950
- }
951
- }
952
- }
953
- }
954
- return $hidden;
955
- }
956
-
957
- /**
958
- * Hides posts based on settings and meta.
959
- *
960
- * @since 3.2.0
961
- *
962
- * @param array $query
963
- * @return array $query
964
- */
965
- function do_hide_posts( $query ) {
966
- $hidden_posts = $this->get_hidden_posts();
967
- if ( ! empty( $hidden_posts ) ) {
968
- $query->set( 'post__not_in', $hidden_posts );
969
- }
970
- return $query;
971
- }
972
-
973
- /**
974
- * Filter to hide pages for get_pages().
975
- *
976
- * @since 3.2.0
977
- *
978
- * @global object $wpdb
979
- * @param array $pages
980
- * @return array $pages
981
- */
982
- function filter_get_pages( $pages ) {
983
- $hidden_posts = $this->get_hidden_posts();
984
- if ( ! empty ( $hidden_posts ) ) {
985
- $new_pages = array();
986
- foreach ( $pages as $key => $page ) {
987
- if ( ! in_array( $page->ID, $hidden_posts ) ) {
988
- $new_pages[ $key ] = $page;
989
- }
990
- }
991
- $pages = $new_pages;
992
- }
993
- return $pages;
994
- }
995
-
996
- /**
997
- * Filter to hide menu items.
998
- *
999
- * @since 3.2.0
1000
- *
1001
- * @param array $items
1002
- * @param $menu
1003
- * @param array $args
1004
- * @return array $items
1005
- */
1006
- function filter_nav_menu_items( $items, $menu, $args ) {
1007
- $hidden_posts = $this->get_hidden_posts();
1008
- if ( ! empty( $hidden_posts ) ) {
1009
- foreach ( $items as $key => $item ) {
1010
- if ( in_array( $item->object_id, $hidden_posts ) ) {
1011
- unset( $items[ $key ] );
1012
- }
1013
- }
1014
- }
1015
- return $items;
1016
- }
1017
-
1018
- /**
1019
- * Filter to remove hidden posts from prev/next links.
1020
- *
1021
- * @since 3.2.4
1022
- *
1023
- * @global object $wpmem
1024
- * @param string $where
1025
- * @return string $where
1026
- */
1027
- function filter_get_adjacent_post_where( $where ) {
1028
- global $wpmem;
1029
- $hidden_posts = $this->get_hidden_posts();
1030
- if ( ! empty( $hidden_posts ) ) {
1031
- $hidden = implode( ",", $hidden_posts );
1032
- $where = $where . " AND p.ID NOT IN ( $hidden )";
1033
- }
1034
- return $where;
1035
- }
1036
-
1037
- /**
1038
- * Sets the registration fields.
1039
- *
1040
- * @since 3.0.0
1041
- * @since 3.1.5 Added $form argument.
1042
- *
1043
- * @param string $form The form being generated.
1044
- */
1045
- function load_fields( $form = 'default' ) {
1046
-
1047
- // Get stored fields settings.
1048
- $fields = get_option( 'wpmembers_fields' );
1049
-
1050
- // Validate fields settings.
1051
- if ( ! isset( $fields ) || empty( $fields ) ) {
1052
- // Update settings.
1053
- $fields = array( array( 10, 'Email', 'user_email', 'email', 'y', 'y', 'y' ) );
1054
- }
1055
-
1056
- // Add new field array keys
1057
- foreach ( $fields as $key => $val ) {
1058
-
1059
- // Key fields with meta key.
1060
- $meta_key = $val[2];
1061
-
1062
- // Old format, new key.
1063
- foreach ( $val as $subkey => $subval ) {
1064
- $this->fields[ $meta_key ][ $subkey ] = $subval;
1065
- }
1066
-
1067
- // Setup field properties.
1068
- $this->fields[ $meta_key ]['label'] = $val[1];
1069
- $this->fields[ $meta_key ]['type'] = $val[3];
1070
- $this->fields[ $meta_key ]['register'] = ( 'y' == $val[4] ) ? true : false;
1071
- $this->fields[ $meta_key ]['required'] = ( 'y' == $val[5] ) ? true : false;
1072
- $this->fields[ $meta_key ]['profile'] = '';
1073
- $this->fields[ $meta_key ]['native'] = ( 'y' == $val[6] ) ? true : false;
1074
-
1075
- // Certain field types have additional properties.
1076
- switch ( $val[3] ) {
1077
-
1078
- case 'checkbox':
1079
- $this->fields[ $meta_key ]['checked_value'] = $val[7];
1080
- $this->fields[ $meta_key ]['checked_default'] = ( 'y' == $val[8] ) ? true : false;
1081
- break;
1082
-
1083
- case 'select':
1084
- case 'multiselect':
1085
- case 'multicheckbox':
1086
- case 'radio':
1087
- // Correct a malformed value (if last value is empty due to a trailing comma).
1088
- if ( '' == end( $val[7] ) ) {
1089
- array_pop( $val[7] );
1090
- $this->fields[ $meta_key ][7] = $val[7];
1091
- }
1092
- $this->fields[ $meta_key ]['values'] = $val[7];
1093
- $this->fields[ $meta_key ]['delimiter'] = ( isset( $val[8] ) ) ? $val[8] : '|';
1094
- $this->fields[ $meta_key ]['options'] = array();
1095
- foreach ( $val[7] as $value ) {
1096
- $pieces = explode( '|', trim( $value ) );
1097
- if ( isset( $pieces[1] ) && $pieces[1] != '' ) {
1098
- $this->fields[ $meta_key ]['options'][ $pieces[1] ] = $pieces[0];
1099
- }
1100
- }
1101
- break;
1102
-
1103
- case 'file':
1104
- case 'image':
1105
- $this->fields[ $meta_key ]['file_types'] = $val[7];
1106
- break;
1107
-
1108
- case 'hidden':
1109
- $this->fields[ $meta_key ]['value'] = $val[7];
1110
- break;
1111
-
1112
- }
1113
- }
1114
- }
1115
-
1116
- /**
1117
- * Get excluded meta fields.
1118
- *
1119
- * @since 3.0.0
1120
- *
1121
- * @param string $tag A tag so we know where the function is being used.
1122
- * @return array The excluded fields.
1123
- */
1124
- function excluded_fields( $tag ) {
1125
-
1126
- // Default excluded fields.
1127
- $excluded_fields = array( 'password', 'confirm_password', 'confirm_email', 'password_confirm', 'email_confirm' );
1128
-
1129
- if ( 'update' == $tag || 'admin-profile' == $tag || 'user-profile' == $tag || 'wp-register' == $tag ) {
1130
- $excluded_fields[] = 'username';
1131
- }
1132
-
1133
- if ( 'admin-profile' == $tag || 'user-profile' == $tag ) {
1134
- array_push( $excluded_fields, 'first_name', 'last_name', 'nickname', 'display_name', 'user_email', 'description', 'user_url' );
1135
- }
1136
-
1137
- /**
1138
- * Filter the fields to be excluded when user is created/updated.
1139
- *
1140
- * @since 2.9.3
1141
- * @since 3.0.0 Moved to new method in WP_Members Class.
1142
- *
1143
- * @param array An array of the field meta names to exclude.
1144
- * @param string $tag A tag so we know where the function is being used.
1145
- */
1146
- $excluded_fields = apply_filters( 'wpmem_exclude_fields', $excluded_fields, $tag );
1147
-
1148
- // Return excluded fields.
1149
- return $excluded_fields;
1150
- }
1151
-
1152
- /**
1153
- * Set page locations.
1154
- *
1155
- * Handles numeric page IDs while maintaining
1156
- * compatibility with old full url settings.
1157
- *
1158
- * @since 3.0.8
1159
- */
1160
- function load_user_pages() {
1161
- foreach ( $this->user_pages as $key => $val ) {
1162
- if ( is_numeric( $val ) ) {
1163
- $this->user_pages[ $key ] = get_page_link( $val );
1164
- }
1165
- }
1166
- }
1167
-
1168
- /**
1169
- * Returns a requested text string.
1170
- *
1171
- * This function manages all of the front-end facing text.
1172
- * All defaults can be filtered using wpmem_default_text_strings.
1173
- *
1174
- * @since 3.1.0
1175
- *
1176
- * @param string $str
1177
- * @return string $text
1178
- */
1179
- function get_text( $str ) {
1180
-
1181
- // Default Form Fields.
1182
- $default_form_fields = array(
1183
- 'first_name' => __( 'First Name', 'wp-members' ),
1184
- 'last_name' => __( 'Last Name', 'wp-members' ),
1185
- 'addr1' => __( 'Address 1', 'wp-members' ),
1186
- 'addr2' => __( 'Address 2', 'wp-members' ),
1187
- 'city' => __( 'City', 'wp-members' ),
1188
- 'thestate' => __( 'State', 'wp-members' ),
1189
- 'zip' => __( 'Zip', 'wp-members' ),
1190
- 'country' => __( 'Country', 'wp-members' ),
1191
- 'phone1' => __( 'Day Phone', 'wp-members' ),
1192
- 'user_email' => __( 'Email', 'wp-members' ),
1193
- 'confirm_email' => __( 'Confirm Email', 'wp-members' ),
1194
- 'user_url' => __( 'Website', 'wp-members' ),
1195
- 'description' => __( 'Biographical Info', 'wp-members' ),
1196
- 'password' => __( 'Password', 'wp-members' ),
1197
- 'confirm_password' => __( 'Confirm Password', 'wp-members' ),
1198
- 'tos' => __( 'TOS', 'wp-members' ),
1199
- );
1200
-
1201
- /*
1202
- * Strings to be added or removed in future versions, included so they will
1203
- * be in the translation template.
1204
- * @todo Check whether any of these should be removed.
1205
- */
1206
- $benign_strings = array(
1207
- __( 'No fields selected for deletion', 'wp-members' ),
1208
- __( 'You are not logged in.', 'wp-members' ), // Technically removed 3.5
1209
- );
1210
-
1211
- $defaults = array(
1212
-
1213
- // Login form.
1214
- 'login_heading' => __( 'Existing Users Log In', 'wp-members' ),
1215
- 'login_username' => __( 'Username or Email', 'wp-members' ),
1216
- 'login_password' => __( 'Password', 'wp-members' ),
1217
- 'login_button' => __( 'Log In', 'wp-members' ),
1218
- 'remember_me' => __( 'Remember Me', 'wp-members' ),
1219
- 'forgot_link_before' => __( 'Forgot password?', 'wp-members' ) . '&nbsp;',
1220
- 'forgot_link' => __( 'Click here to reset', 'wp-members' ),
1221
- 'register_link_before' => __( 'New User?', 'wp-members' ) . '&nbsp;',
1222
- 'register_link' => __( 'Click here to register', 'wp-members' ),
1223
-
1224
- // Password change form.
1225
- 'pwdchg_heading' => __( 'Change Password', 'wp-members' ),
1226
- 'pwdchg_password1' => __( 'New password', 'wp-members' ),
1227
- 'pwdchg_password2' => __( 'Confirm new password', 'wp-members' ),
1228
- 'pwdchg_button' => __( 'Update Password', 'wp-members' ),
1229
-
1230
- // Password reset form.
1231
- 'pwdreset_heading' => __( 'Reset Forgotten Password', 'wp-members' ),
1232
- 'pwdreset_username' => __( 'Username', 'wp-members' ),
1233
- 'pwdreset_email' => __( 'Email', 'wp-members' ),
1234
- 'pwdreset_button' => __( 'Reset Password' ),
1235
- 'username_link_before' => __( 'Forgot username?', 'wp-members' ) . '&nbsp;',
1236
- 'username_link' => __( 'Click here', 'wp-members' ),
1237
-
1238
- // Retrieve username form.
1239
- 'username_heading' => __( 'Retrieve username', 'wp-members' ),
1240
- 'username_email' => __( 'Email Address', 'wp-members' ),
1241
- 'username_button' => __( 'Retrieve username', 'wp-members' ),
1242
-
1243
- // Register form.
1244
- 'register_heading' => __( 'New User Registration', 'wp-members' ),
1245
- 'register_username' => __( 'Choose a Username', 'wp-members' ),
1246
- 'register_rscaptcha' => __( 'Input the code:', 'wp-members' ),
1247
- 'register_tos' => __( 'Please indicate that you agree to the %s Terms of Service %s', 'wp-members' ), // @note: if default changes, default check after wpmem_tos_link_txt must change.
1248
- 'register_clear' => __( 'Reset Form', 'wp-members' ),
1249
- 'register_submit' => __( 'Register', 'wp-members' ),
1250
- 'register_req_mark' => '<span class="req">*</span>',
1251
- 'register_required' => '<span class="req">*</span>' . __( 'Required field', 'wp-members' ),
1252
-
1253
- // User profile update form.
1254
- 'profile_heading' => __( 'Edit Your Information', 'wp-members' ),
1255
- 'profile_username' => __( 'Username', 'wp-members' ),
1256
- 'profile_submit' => __( 'Update Profile', 'wp-members' ),
1257
- 'profile_upload' => __( 'Update this file', 'wp-members' ),
1258
-
1259
- // Error messages and dialogs.
1260
- 'login_failed_heading' => __( 'Login Failed!', 'wp-members' ),
1261
- 'login_failed' => __( 'You entered an invalid username or password.', 'wp-members' ),
1262
- 'login_failed_link' => __( 'Click here to continue.', 'wp-members' ),
1263
- 'pwdchangempty' => __( 'Password fields cannot be empty', 'wp-members' ),
1264
- 'usernamefailed' => __( 'Sorry, that email address was not found.', 'wp-members' ),
1265
- 'usernamesuccess' => __( 'An email was sent to %s with your username.', 'wp-members' ),
1266
- 'reg_empty_field' => __( 'Sorry, %s is a required field.', 'wp-members' ),
1267
- 'reg_valid_email' => __( 'You must enter a valid email address.', 'wp-members' ),
1268
- 'reg_non_alphanumeric' => __( 'The username cannot include non-alphanumeric characters.', 'wp-members' ),
1269
- 'reg_empty_username' => __( 'Sorry, username is a required field', 'wp-members' ),
1270
- 'reg_password_match' => __( 'Passwords did not match.', 'wp-members' ),
1271
- 'reg_email_match' => __( 'Emails did not match.', 'wp-members' ),
1272
- 'reg_empty_captcha' => __( 'You must complete the CAPTCHA form.', 'wp-members' ),
1273
- 'reg_invalid_captcha' => __( 'CAPTCHA was not valid.', 'wp-members' ),
1274
- 'reg_generic' => __( 'There was an error processing the form.', 'wp-members' ),
1275
- 'reg_captcha_err' => __( 'There was an error with the CAPTCHA form.', 'wp-members' ),
1276
-
1277
- // Links.
1278
- 'profile_edit' => __( 'Edit My Information', 'wp-members' ),
1279
- 'profile_password' => __( 'Change Password', 'wp-members' ),
1280
- 'register_status' => __( 'You are logged in as %s', 'wp-members' ),
1281
- 'register_logout' => __( 'Click to log out.', 'wp-members' ),
1282
- 'register_continue' => __( 'Begin using the site.', 'wp-members' ),
1283
- 'login_welcome' => __( 'You are logged in as %s', 'wp-members' ),
1284
- 'login_logout' => __( 'Click to log out', 'wp-members' ),
1285
- 'status_welcome' => __( 'You are logged in as %s', 'wp-members' ),
1286
- 'status_logout' => __( 'click to log out', 'wp-members' ),
1287
- 'menu_logout' => __( 'Log Out', 'wp-members' ),
1288
-
1289
- // Widget.
1290
- 'sb_status' => __( 'You are logged in as %s', 'wp-members' ),
1291
- 'sb_logout' => __( 'click here to log out', 'wp-members' ),
1292
- 'sb_login_failed' => __( 'Login Failed!<br />You entered an invalid username or password.', 'wp-members' ),
1293
- 'sb_not_logged_in' => '',
1294
- 'sb_login_username' => __( 'Username or Email', 'wp-members' ),
1295
- 'sb_login_password' => __( 'Password', 'wp-members' ),
1296
- 'sb_login_button' => __( 'log in', 'wp-members' ),
1297
- 'sb_login_forgot' => __( 'Forgot?', 'wp-members' ),
1298
- 'sb_login_register' => __( 'Register', 'wp-members' ),
1299
-
1300
- // Default Dialogs.
1301
- 'restricted_msg' => __( "This content is restricted to site members. If you are an existing user, please log in. New users may register below.", 'wp-members' ),
1302
- 'success' => __( "Congratulations! Your registration was successful.<br /><br />You may now log in using the password that was emailed to you.", 'wp-members' ),
1303
-
1304
- // @todo Under consideration for removal from the Dialogs tab.
1305
- 'user' => __( "Sorry, that username is taken, please try another.", 'wp-members' ),
1306
- 'email' => __( "Sorry, that email address already has an account.<br />Please try another.", 'wp-members' ),
1307
- 'editsuccess' => __( "Your information was updated!", 'wp-members' ),
1308
-
1309
- // @todo These are defaults and are under consideration for removal from the dialogs tab, possibly as we change the password reset to a link based process.
1310
- 'pwdchangerr' => __( "Passwords did not match.<br /><br />Please try again.", 'wp-members' ),
1311
- 'pwdchangesuccess' => __( "Password successfully changed!", 'wp-members' ),
1312
- 'pwdreseterr' => __( "Either the username or email address do not exist in our records.", 'wp-members' ),
1313
- 'pwdresetsuccess' => __( "Password successfully reset!<br /><br />An email containing a new password has been sent to the email address on file for your account.", 'wp-members' ),
1314
-
1315
- 'product_restricted' => __( "Sorry, you do not have access to this content.", 'wp-members' ),
1316
-
1317
- ); // End of $defaults array.
1318
-
1319
- /**
1320
- * Filter default terms.
1321
- *
1322
- * @since 3.1.0
1323
- * @deprecated 3.2.7 Use wpmem_default_text instead.
1324
- */
1325
- $text = apply_filters( 'wpmem_default_text_strings', '' );
1326
-
1327
- // Merge filtered $terms with $defaults.
1328
- $text = wp_parse_args( $text, $defaults );
1329
-
1330
- /**
1331
- * Filter the default terms.
1332
- *
1333
- * Replaces 'wpmem_default_text_strings' so that multiple filters could
1334
- * be run. This allows for custom filters when also running the Text
1335
- * String Editor extension.
1336
- *
1337
- * @since 3.2.7
1338
- */
1339
- $text = apply_filters( 'wpmem_default_text', $text );
1340
-
1341
- // Return the requested text string.
1342
- return $text[ $str ];
1343
-
1344
- } // End of get_text().
1345
-
1346
- /**
1347
- * Load the admin api.
1348
- *
1349
- * @since 3.1.0
1350
- */
1351
- function load_admin_api() {
1352
- if ( is_admin() ) {
1353
- /**
1354
- * Load the admin api class.
1355
- *
1356
- * @since 3.1.0
1357
- */
1358
- include_once( WPMEM_PATH . 'admin/includes/class-wp-members-admin-api.php' );
1359
- $this->admin = new WP_Members_Admin_API;
1360
- }
1361
- }
1362
-
1363
- /**
1364
- * Initializes the WP-Members widget.
1365
- *
1366
- * @since 3.2.0 Replaces widget_wpmemwidget_init
1367
- */
1368
- public function widget_init() {
1369
- // Register the WP-Members widget.
1370
- register_widget( 'widget_wpmemwidget' );
1371
- }
1372
-
1373
- /**
1374
- * Adds WP-Members query vars to WP's public query vars.
1375
- *
1376
- * @since 3.2.0
1377
- *
1378
- * @see https://codex.wordpress.org/Plugin_API/Filter_Reference/query_vars
1379
- *
1380
- * @param array $qvars
1381
- */
1382
- public function add_query_vars ( $qvars ) {
1383
- $qvars[] = 'a'; // The WP-Members action variable.
1384
- return $qvars;
1385
- }
1386
-
1387
- /**
1388
- * Enqueues login/out script for the footer.
1389
- *
1390
- * @since 3.2.0
1391
- */
1392
- public function loginout_script() {
1393
- if ( is_user_logged_in() ) {
1394
- wp_enqueue_script( 'jquery' );
1395
- add_action( 'wp_footer', array( $this, 'do_loginout_script' ), 50 );
1396
- }
1397
- }
1398
-
1399
- /**
1400
- * Outputs login/out script for the footer.
1401
- *
1402
- * @since 3.2.0
1403
- *
1404
- * @global object $wpmem
1405
- */
1406
- public function do_loginout_script() {
1407
- global $wpmem;
1408
- $logout = apply_filters( 'wpmem_logout_link', add_query_arg( 'a', 'logout' ) );
1409
- ?><script type="text/javascript">
1410
- jQuery('.wpmem_loginout').html('<a class="login_button" href="<?php echo $logout; ?>"><?php echo $this->get_text( 'menu_logout' ); ?></a>');
1411
- </script><?php
1412
- }
1413
-
1414
- /**
1415
- * Adds WP-Members controls to the Customizer
1416
- *
1417
- * @since 3.2.0
1418
- *
1419
- * @param object $wp_customize The Customizer object.
1420
- */
1421
- function customizer_settings( $wp_customize ) {
1422
- $wp_customize->add_section( 'wp_members' , array(
1423
- 'title' => 'WP-Members',
1424
- 'priority' => 190,
1425
- ) );
1426
-
1427
- // Add settings for output description
1428
- $wp_customize->add_setting( 'wpmem_show_logged_out_state', array(
1429
- 'default' => '1',
1430
- 'type' => 'theme_mod', //'option'
1431
- 'capability' => 'edit_theme_options',
1432
- 'transport' => 'refresh',
1433
- ) );
1434
-
1435
- // Add settings for output description
1436
- $wp_customize->add_setting( 'wpmem_show_form_message_dialog', array(
1437
- 'default' => '1',
1438
- 'type' => 'theme_mod', //'option'
1439
- 'capability' => 'edit_theme_options',
1440
- 'transport' => 'refresh',
1441
- ) );
1442
-
1443
- // Add control and output for select field
1444
- $wp_customize->add_control( 'wpmem_show_form_logged_out', array(
1445
- 'label' => __( 'Show forms as logged out', 'wp-members' ),
1446
- 'section' => 'wp_members',
1447
- 'settings' => 'wpmem_show_logged_out_state',
1448
- 'type' => 'checkbox',
1449
- 'std' => '1'
1450
- ) );
1451
-
1452
- // Add control for showing dialog
1453
- $wp_customize->add_control( 'wpmem_show_form_dialog', array(
1454
- 'label' => __( 'Show form message dialog', 'wp-members' ),
1455
- 'section' => 'wp_members',
1456
- 'settings' => 'wpmem_show_form_message_dialog',
1457
- 'type' => 'checkbox',
1458
- 'std' => '0'
1459
- ) );
1460
- }
1461
-
1462
- /**
1463
- * Overrides the wptexturize filter.
1464
- *
1465
- * Currently only used for the login form to remove the <br> tag that WP puts in after the "Remember Me".
1466
- *
1467
- * @since 2.6.4
1468
- * @since 3.2.3 Moved to WP_Members class.
1469
- *
1470
- * @todo Possibly deprecate or severely alter this process as its need may be obsolete.
1471
- *
1472
- * @param string $content
1473
- * @return string $new_content
1474
- */
1475
- function texturize( $content ) {
1476
-
1477
- $new_content = '';
1478
- $pattern_full = '{(\[wpmem_txt\].*?\[/wpmem_txt\])}is';
1479
- $pattern_contents = '{\[wpmem_txt\](.*?)\[/wpmem_txt\]}is';
1480
- $pieces = preg_split( $pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE );
1481
-
1482
- foreach ( $pieces as $piece ) {
1483
- if ( preg_match( $pattern_contents, $piece, $matches ) ) {
1484
- $new_content .= $matches[1];
1485
- } else {
1486
- $new_content .= wptexturize( wpautop( $piece ) );
1487
- }
1488
- }
1489
-
1490
- return $new_content;
1491
- }
1492
-
1493
- /**
1494
- * Loads the stylesheet for tableless forms.
1495
- *
1496
- * @since 2.6
1497
- * @since 3.2.3 Moved to WP_Members class.
1498
- *
1499
- * @global object $wpmem The WP_Members object.
1500
- */
1501
- function enqueue_style() {
1502
- global $wpmem;
1503
- wp_enqueue_style ( 'wp-members', wpmem_force_ssl( $wpmem->cssurl ), '', WPMEM_VERSION );
1504
- }
1505
-
1506
- /**
1507
- * Creates an excerpt on the fly if there is no 'more' tag.
1508
- *
1509
- * @since 2.6
1510
- * @since 3.2.3 Moved to WP_Members class.
1511
- * @since 3.2.5 Check if post object exists.
1512
- *
1513
- * @global object $post The post object.
1514
- * @global object $wpmem The WP_Members object.
1515
- *
1516
- * @param string $content
1517
- * @return string $content
1518
- */
1519
- function do_excerpt( $content ) {
1520
-
1521
- global $post, $more, $wpmem;
1522
-
1523
- if ( is_object( $post ) ) {
1524
-
1525
- $post_id = $post->ID;
1526
- $post_type = $post->post_type;
1527
-
1528
- $autoex = ( isset( $wpmem->autoex[ $post->post_type ] ) && 1 == $wpmem->autoex[ $post->post_type ]['enabled'] ) ? $wpmem->autoex[ $post->post_type ] : false;
1529
-
1530
- // Is there already a 'more' link in the content?
1531
- $has_more_link = ( stristr( $content, 'class="more-link"' ) ) ? true : false;
1532
-
1533
- // If auto_ex is on.
1534
- if ( $autoex ) {
1535
-
1536
- // Build an excerpt if one does not exist.
1537
- if ( ! $has_more_link ) {
1538
-
1539
- $is_singular = ( is_singular( $post->post_type ) ) ? true : false;
1540
-
1541
- if ( $is_singular ) {
1542
- // If it's a single post, we don't need the 'more' link.
1543
- $more_link_text = '';
1544
- $more_link = '';
1545
- } else {
1546
- // The default $more_link_text.
1547
- if ( isset( $wpmem->autoex[ $post->post_type ]['text'] ) && '' != $wpmem->autoex[ $post->post_type ]['text'] ) {
1548
- $more_link_text = __( $wpmem->autoex[ $post->post_type ]['text'], 'wp-members' );
1549
- } else {
1550
- $more_link_text = __( '(more&hellip;)' );
1551
- }
1552
- // The default $more_link.
1553
- $more_link = ' <a href="'. get_permalink( $post->ID ) . '" class="more-link">' . $more_link_text . '</a>';
1554
- }
1555
-
1556
- // Apply the_content_more_link filter if one exists (will match up all 'more' link text).
1557
- /** This filter is documented in /wp-includes/post-template.php */
1558
- $more_link = apply_filters( 'the_content_more_link', $more_link, $more_link_text );
1559
-
1560
- $defaults = array(
1561
- 'length' => $autoex['length'],
1562
- 'more_link' => $more_link,
1563
- 'blocked_only' => false,
1564
- );
1565
- /**
1566
- * Filter auto excerpt defaults.
1567
- *
1568
- * @since 3.0.9
1569
- * @since 3.1.5 Deprecated add_ellipsis, strip_tags, close_tags, parse_shortcodes, strip_shortcodes.
1570
- *
1571
- * @param array {
1572
- * An array of settings to override the function defaults.
1573
- *
1574
- * @type int $length The default length of the excerpt.
1575
- * @type string $more_link The more link HTML.
1576
- * @type boolean $blocked_only Run autoexcerpt only on blocked content. default: false.
1577
- * }
1578
- * @param string $post->ID The post ID.
1579
- * @param string $post->post_type The content's post type.
1580
- */
1581
- $args = apply_filters( 'wpmem_auto_excerpt_args', '', $post->ID, $post->post_type );
1582
-
1583
- // Merge settings.
1584
- $args = wp_parse_args( $args, $defaults );
1585
-
1586
- // Are we only excerpting blocked content?
1587
- if ( $args['blocked_only'] ) {
1588
- $post_meta = get_post_meta( $post->ID, '_wpmem_block', true );
1589
- if ( 1 == $wpmem->block[ $post->post_type ] ) {
1590
- // Post type is blocked, if post meta unblocks it, don't do excerpt.
1591
- $do_excerpt = ( "0" == $post_meta ) ? false : true;
1592
- } else {
1593
- // Post type is unblocked, if post meta blocks it, do excerpt.
1594
- $do_excerpt = ( "1" == $post_meta ) ? true : false;
1595
- }
1596
- } else {
1597
- $do_excerpt = true;
1598
- }
1599
-
1600
- if ( $do_excerpt ) {
1601
- $content = wp_trim_words( $content, $args['length'], $args['more_link'] );
1602
- // Check if the more link was added (note: singular has no more_link):
1603
- if ( ! $is_singular && ! strpos( $content, $args['more_link'] ) ) {
1604
- $content = $content . $args['more_link'];
1605
- }
1606
- }
1607
- }
1608
- }
1609
- } else {
1610
- $post_id = false;
1611
- $post_type = false;
1612
- }
1613
-
1614
- /**
1615
- * Filter the auto excerpt.
1616
- *
1617
- * @since 2.8.1
1618
- * @since 3.0.9 Added post ID and post type parameters.
1619
- * @since 3.2.5 Post ID and post type may be false if there is no post object.
1620
- *
1621
- * @param string $content The content excerpt.
1622
- * @param string $post_id The post ID.
1623
- * @param string $post_type The content's post type.
1624
- */
1625
- $content = apply_filters( 'wpmem_auto_excerpt', $content, $post_id, $post_type );
1626
-
1627
- // Return the excerpt.
1628
- return $content;
1629
- }
1630
-
1631
- /**
1632
- * Convert form tag.
1633
- *
1634
- * @todo This is temporary to handle form tag conversion.
1635
- *
1636
- * @since 3.1.7
1637
- * @since 3.2.3 Moved to WP_Members class.
1638
- *
1639
- * @param string $tag
1640
- * @return string $tag
1641
- */
1642
- function convert_tag( $tag ) {
1643
- switch ( $tag ) {
1644
- case 'new':
1645
- return 'register';
1646
- break;
1647
- case 'edit':
1648
- case 'update':
1649
- return 'profile';
1650
- break;
1651
- case 'wp':
1652
- case 'wp_validate':
1653
- case 'wp_finalize':
1654
- return 'register_wp';
1655
- break;
1656
- case 'dashboard_profile':
1657
- case 'dashboard_profile_update':
1658
- return 'profile_dashboard';
1659
- break;
1660
- case 'admin_profile':
1661
- case 'admin_profile_update':
1662
- return 'profile_admin';
1663
- break;
1664
- default:
1665
- return $tag;
1666
- break;
1667
- }
1668
- return $tag;
1669
- }
1670
-
1671
- /**
1672
- * Loads translation files.
1673
- *
1674
- * @since 3.0.0
1675
- * @since 3.2.5 Moved to main object, dropped wpmem_ stem.
1676
- */
1677
- function load_textdomain() {
1678
-
1679
- // @see: https://ulrich.pogson.ch/load-theme-plugin-translations for notes on changes.
1680
-
1681
- // Plugin textdomain.
1682
- $domain = 'wp-members';
1683
-
1684
- // Wordpress locale.
1685
- /** This filter is documented in wp-includes/l10n.php */
1686
- $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
1687
-
1688
- /**
1689
- * Filter translation file.
1690
- *
1691
- * If the translate.wordpress.org language pack is available, it will
1692
- * be /wp-content/languages/plugins/wp-members-{locale}.mo by default.
1693
- * You can filter this if you want to load a language pack from a
1694
- * different location (or different file name).
1695
- *
1696
- * @since 3.0.0
1697
- * @since 3.2.0 Added locale as a parameter.
1698
- *
1699
- * @param string $file The translation file to load.
1700
- * @param string $locale The current locale.
1701
- */
1702
- $file = apply_filters( 'wpmem_localization_file', trailingslashit( WP_LANG_DIR ) . 'plugins/' . $domain . '-' . $locale . '.mo', $locale );
1703
-
1704
- $loaded = load_textdomain( $domain, $file );
1705
- if ( $loaded ) {
1706
- return $loaded;
1707
- } else {
1708
-
1709
- /*
1710
- * If there is no wordpress.org language pack or the filtered
1711
- * language file does not load, $loaded will be false and will
1712
- * end up here to attempt to load one of the legacy language
1713
- * packs. Note that the legacy language files are no longer
1714
- * actively maintained and may not contain all strings.
1715
- * The directory that the file will load from can be changed
1716
- * using the wpmem_localization_dir filter.
1717
- */
1718
-
1719
- /**
1720
- * Filter translation directory.
1721
- *
1722
- * @since 3.0.3
1723
- * @since 3.2.0 Added locale as a parameter.
1724
- *
1725
- * @param string $dir The translation directory.
1726
- * @param string $locale The current locale.
1727
- */
1728
- $dir = apply_filters( 'wpmem_localization_dir', dirname( plugin_basename( __FILE__ ) ) . '/lang/', $locale );
1729
- load_plugin_textdomain( $domain, FALSE, $dir );
1730
- }
1731
- return;
1732
- }
1733
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1734
  } // End of WP_Members class.
1
+ <?php
2
+ /**
3
+ * The WP_Members Class.
4
+ *
5
+ * This is the main WP_Members object class. This class contains functions
6
+ * for loading settings, shortcodes, hooks to WP, plugin dropins, constants,
7
+ * and registration fields. It also manages whether content should be blocked.
8
+ *
9
+ * @package WP-Members
10
+ * @subpackage WP_Members Object Class
11
+ * @since 3.0.0
12
+ */
13
+
14
+ // Exit if accessed directly.
15
+ if ( ! defined( 'ABSPATH' ) ) {
16
+ exit();
17
+ }
18
+
19
+ class WP_Members {
20
+
21
+ /**
22
+ * Plugin version.
23
+ *
24
+ * @since 3.0.0
25
+ * @access public
26
+ * @var string
27
+ */
28
+ public $version = WPMEM_VERSION;
29
+
30
+ /**
31
+ * Database version
32
+ *
33
+ * @since 3.2.2
34
+ * @access public
35
+ * @var string
36
+ */
37
+ public $db_version = WPMEM_DB_VERSION;
38
+
39
+ /**
40
+ * Content block settings.
41
+ *
42
+ * @since 3.0.0
43
+ * @access public
44
+ * @var array
45
+ */
46
+ public $block;
47
+
48
+ /**
49
+ * Excerpt settings.
50
+ *
51
+ * @since 3.0.0
52
+ * @access public
53
+ * @var array
54
+ */
55
+ public $show_excerpt;
56
+
57
+ /**
58
+ * Show login form settings.
59
+ *
60
+ * @since 3.0.0
61
+ * @access public
62
+ * @var array
63
+ */
64
+ public $show_login;
65
+
66
+ /**
67
+ * Show registration form settings.
68
+ *
69
+ * @since 3.0.0
70
+ * @access public
71
+ * @var array
72
+ */
73
+ public $show_reg;
74
+
75
+ /**
76
+ * Auto-excerpt settings.
77
+ *
78
+ * @since 3.0.0
79
+ * @access public
80
+ * @var array
81
+ */
82
+ public $autoex;
83
+
84
+ /**
85
+ * Notify admin settings.
86
+ *
87
+ * @since 3.0.0
88
+ * @access public
89
+ * @var string
90
+ */
91
+ public $notify;
92
+
93
+ /**
94
+ * Moderated registration settings.
95
+ *
96
+ * @since 3.0.0
97
+ * @access public
98
+ * @var string
99
+ */
100
+ public $mod_reg;
101
+
102
+ /**
103
+ * Captcha settings.
104
+ *
105
+ * @since 3.0.0
106
+ * @access public
107
+ * @var array
108
+ */
109
+ public $captcha;
110
+
111
+ /**
112
+ * Enable expiration extension settings.
113
+ *
114
+ * @since 3.0.0
115
+ * @access public
116
+ * @var string
117
+ */
118
+ public $use_exp;
119
+
120
+ /**
121
+ * Expiration extension enable trial period.
122
+ *
123
+ * @since 3.0.0
124
+ * @access public
125
+ * @var string
126
+ */
127
+ public $use_trial;
128
+
129
+ /**
130
+ *
131
+ *
132
+ * @since 3.0.0
133
+ * @access public
134
+ * @var array
135
+ */
136
+ public $warnings;
137
+
138
+ /**
139
+ * Enable drop-ins setting.
140
+ *
141
+ * @since 3.1.9
142
+ * @access public
143
+ * @var string
144
+ */
145
+ public $dropins = 0;
146
+
147
+ /**
148
+ * Container for enabled dropins.
149
+ *
150
+ * @since 3.1.9
151
+ * @access public
152
+ * @var array
153
+ */
154
+ public $dropins_enabled = array();
155
+
156
+ /**
157
+ * Current plugin action container.
158
+ *
159
+ * @since 3.0.0
160
+ * @access public
161
+ * @var string
162
+ */
163
+ public $action;
164
+
165
+ /**
166
+ * Regchk container.
167
+ *
168
+ * @since 3.0.0
169
+ * @access public
170
+ * @var string
171
+ */
172
+ public $regchk;
173
+
174
+ /**
175
+ * User page settings.
176
+ *
177
+ * @since 3.0.0
178
+ * @access public
179
+ * @var array
180
+ */
181
+ public $user_pages;
182
+
183
+ /**
184
+ * Custom Post Type settings.
185
+ *
186
+ * @since 3.0.0
187
+ * @access public
188
+ * @var array
189
+ */
190
+ public $post_types;
191
+
192
+ /**
193
+ * Setting for applying texturization.
194
+ *
195
+ * @since 3.1.7
196
+ * @access public
197
+ * @var boolean
198
+ */
199
+ public $texturize;
200
+
201
+ /**
202
+ * Enable product creation.
203
+ *
204
+ * @since 3.2.0
205
+ * @access public
206
+ * @var boolean
207
+ */
208
+ public $enable_products;
209
+
210
+ /**
211
+ * Enable logged-in menu clones.
212
+ *
213
+ * @since 3.2.0
214
+ * @access public
215
+ * @var string
216
+ */
217
+ public $clone_menus;
218
+
219
+ /**
220
+ * Container for error messages.
221
+ *
222
+ * @since 3.2.0
223
+ * @access public
224
+ * @var string
225
+ */
226
+ public $error;
227
+
228
+ /**
229
+ * Plugin initialization function.
230
+ *
231
+ * @since 3.0.0
232
+ * @since 3.1.6 Dependencies now loaded by object.
233
+ */
234
+ function __construct() {
235
+
236
+ // Load dependent files.
237
+ $this->load_dependencies();
238
+
239
+ /**
240
+ * Filter the options before they are loaded into constants.
241
+ *
242
+ * @since 2.9.0
243
+ * @since 3.0.0 Moved to the WP_Members class.
244
+ *
245
+ * @param array $this->settings An array of the WP-Members settings.
246
+ */
247
+ $settings = apply_filters( 'wpmem_settings', get_option( 'wpmembers_settings' ) );
248
+
249
+ // Validate that v3 settings are loaded.
250
+ if ( ! isset( $settings['version'] )
251
+ || $settings['version'] != $this->version
252
+ || ! isset( $settings['db_version'] )
253
+ || $settings['db_version'] != $this->db_version ) {
254
+ /**
255
+ * Load installation routine.
256
+ */
257
+ require_once( WPMEM_PATH . 'inc/install.php' );
258
+ // Update settings.
259
+ /** This filter is documented in /inc/class-wp-members.php */
260
+ $settings = apply_filters( 'wpmem_settings', wpmem_do_install() );
261
+ }
262
+
263
+ // Assemble settings.
264
+ foreach ( $settings as $key => $val ) {
265
+ $this->$key = $val;
266
+ }
267
+
268
+ $this->load_user_pages();
269
+ $this->cssurl = ( isset( $this->style ) && $this->style == 'use_custom' ) ? $this->cssurl : $this->style; // Set the stylesheet.
270
+ $this->forms = new WP_Members_Forms; // Load forms.
271
+ $this->api = new WP_Members_API; // Load api.
272
+ $this->user = new WP_Members_User( $this ); // Load user functions.
273
+ $this->shortcodes = new WP_Members_Shortcodes(); // Load shortcodes.
274
+ $this->membership = new WP_Members_Products(); // Load membership plans
275
+ $this->email = new WP_Members_Email; // Load email functions
276
+ $this->menus = ( $this->clone_menus ) ? new WP_Members_Menus() : null; // Load clone menus.
277
+
278
+ /**
279
+ * Fires after main settings are loaded.
280
+ *
281
+ * @since 3.0
282
+ * @deprecated 3.2.0 Use wpmem_after_init instead.
283
+ */
284
+ do_action( 'wpmem_settings_loaded' );
285
+
286
+ // Preload the expiration module, if available.
287
+ $exp_active = ( function_exists( 'wpmem_exp_init' ) || function_exists( 'wpmem_set_exp' ) ) ? true : false;
288
+ define( 'WPMEM_EXP_MODULE', $exp_active );
289
+
290
+ // Load actions and filters.
291
+ $this->load_hooks();
292
+
293
+ // Load contants.
294
+ $this->load_constants();
295
+
296
+ // Load dropins.
297
+ if ( $this->dropins ) {
298
+ $this->load_dropins();
299
+ }
300
+
301
+ // Check for anything that we should stop execution for (currently just the default tos).
302
+ if ( 'display' == wpmem_get( 'tos', false, 'get' ) ) {
303
+
304
+ // If themes are not loaded, we don't need them.
305
+ $user_themes = ( ! defined( 'WP_USE_THEMES' ) ) ? define( 'WP_USE_THEMES', false ) : '';
306
+ $this->load_default_tos();
307
+ die();
308
+ }
309
+ }
310
+
311
+ /**
312
+ * Plugin initialization function to load hooks.
313
+ *
314
+ * @since 3.0.0
315
+ */
316
+ function load_hooks() {
317
+
318
+ /**
319
+ * Fires before action and filter hooks load.
320
+ *
321
+ * @since 3.0.0
322
+ * @since 3.1.6 Fires before hooks load.
323
+ */
324
+ do_action( 'wpmem_load_hooks' );
325
+
326
+ // Add actions.
327
+ add_action( 'template_redirect', array( $this, 'get_action' ) );
328
+ add_action( 'widgets_init', array( $this, 'widget_init' ) ); // initializes the widget
329
+ add_action( 'admin_init', array( $this, 'load_admin' ) ); // check user role to load correct dashboard
330
+ add_action( 'admin_menu', 'wpmem_admin_options' ); // adds admin menu
331
+ add_action( 'user_register', 'wpmem_wp_reg_finalize' ); // handles wp native registration
332
+ add_action( 'login_enqueue_scripts', 'wpmem_wplogin_stylesheet' ); // styles the native registration
333
+ add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ) ); // Enqueues the stylesheet.
334
+ add_action( 'wp_enqueue_scripts', array( $this, 'loginout_script' ) );
335
+ add_action( 'init', array( $this, 'load_textdomain' ) ); //add_action( 'plugins_loaded', 'wpmem_load_textdomain' );
336
+ add_action( 'init', array( $this->membership, 'add_cpt' ), 0 ); // Adds membership plans custom post type.
337
+ add_action( 'pre_get_posts', array( $this, 'do_hide_posts' ) );
338
+ add_action( 'customize_register', array( $this, 'customizer_settings' ) );
339
+
340
+ if ( is_user_logged_in() ) {
341
+ add_action( 'wpmem_pwd_change', array( $this->user, 'set_password' ), 9, 2 );
342
+ add_action( 'wpmem_pwd_change', array( $this->user, 'set_as_logged_in' ), 10 );
343
+ }
344
+
345
+ // Add filters.
346
+ add_filter( 'the_content', array( $this, 'do_securify' ), 99 );
347
+ add_filter( 'allow_password_reset', array( $this->user, 'no_reset' ) ); // no password reset for non-activated users
348
+ add_filter( 'register_form', 'wpmem_wp_register_form' ); // adds fields to the default wp registration
349
+ add_action( 'woocommerce_register_form', 'wpmem_woo_register_form' );
350
+ add_filter( 'registration_errors', 'wpmem_wp_reg_validate', 10, 3 ); // native registration validation
351
+ add_filter( 'comments_open', array( $this, 'do_securify_comments' ), 99 ); // securifies the comments
352
+ add_filter( 'wpmem_securify', array( $this, 'reg_securify' ) ); // adds success message on login form if redirected
353
+ //add_filter( 'query_vars', array( $this, 'add_query_vars' ), 10, 2 ); // adds custom query vars
354
+ add_filter( 'get_pages', array( $this, 'filter_get_pages' ) );
355
+ add_filter( 'wp_get_nav_menu_items', array( $this, 'filter_nav_menu_items' ), null, 3 );
356
+ add_filter( 'get_previous_post_where', array( $this, 'filter_get_adjacent_post_where' ) );
357
+ add_filter( 'get_next_post_where', array( $this, 'filter_get_adjacent_post_where' ) );
358
+
359
+ // If registration is moderated, check for activation (blocks backend login by non-activated users).
360
+ if ( $this->mod_reg == 1 ) {
361
+ add_filter( 'authenticate', array( $this->user, 'check_activated' ), 99, 3 );
362
+ }
363
+
364
+ /**
365
+ * Fires after action and filter hooks load.
366
+ *
367
+ * @since 3.0.0
368
+ * @since 3.1.6 Was wpmem_load_hooks, now wpmem_hooks_loaded.
369
+ */
370
+ do_action( 'wpmem_hooks_loaded' );
371
+ }
372
+
373
+ /**
374
+ * Load drop-ins.
375
+ *
376
+ * @since 3.0.0
377
+ *
378
+ * @todo This is experimental. The function and its operation is subject to change.
379
+ */
380
+ function load_dropins() {
381
+
382
+ /**
383
+ * Fires before dropins load (for adding additional drop-ins).
384
+ *
385
+ * @since 3.0.0
386
+ * @since 3.1.6 Fires before dropins.
387
+ */
388
+ do_action( 'wpmem_load_dropins' );
389
+
390
+ /**
391
+ * Filters the drop-in file folder.
392
+ *
393
+ * @since 3.0.0
394
+ *
395
+ * @param string $folder The drop-in file folder.
396
+ */
397
+ $folder = apply_filters( 'wpmem_dropin_folder', WPMEM_DROPIN_DIR );
398
+
399
+ // Load any drop-ins.
400
+ $settings = get_option( 'wpmembers_dropins' );
401
+ $this->dropins_enabled = ( $settings ) ? $settings : array();
402
+ if ( ! empty( $this->dropins_enabled ) ) {
403
+ foreach ( $this->dropins_enabled as $filename ) {
404
+ $dropin = $folder . $filename;
405
+ if ( file_exists( $dropin ) ) {
406
+ include_once( $dropin );
407
+ }
408
+ }
409
+ }
410
+
411
+ /**
412
+ * Fires before dropins load (for adding additional drop-ins).
413
+ *
414
+ * @since 3.0.0
415
+ * @since 3.1.6 Was wpmem_load_dropins, now wpmem_dropins_loaded.
416
+ */
417
+ do_action( 'wpmem_dropins_loaded' );
418
+ }
419
+
420
+ /**
421
+ * Loads pre-3.0 constants (included primarily for add-on compatibility).
422
+ *
423
+ * @since 3.0.0
424
+ */
425
+ function load_constants() {
426
+ ( ! defined( 'WPMEM_BLOCK_POSTS' ) ) ? define( 'WPMEM_BLOCK_POSTS', $this->block['post'] ) : ''; // @todo Can deprecate? Probably 3.3
427
+ ( ! defined( 'WPMEM_BLOCK_PAGES' ) ) ? define( 'WPMEM_BLOCK_PAGES', $this->block['page'] ) : ''; // @todo Can deprecate? Probably 3.3
428
+ ( ! defined( 'WPMEM_SHOW_EXCERPT' ) ) ? define( 'WPMEM_SHOW_EXCERPT', $this->show_excerpt['post'] ) : ''; // @todo Can deprecate? Probably 3.3
429
+ ( ! defined( 'WPMEM_NOTIFY_ADMIN' ) ) ? define( 'WPMEM_NOTIFY_ADMIN', $this->notify ) : ''; // @todo Can deprecate? Probably 3.3
430
+ ( ! defined( 'WPMEM_MOD_REG' ) ) ? define( 'WPMEM_MOD_REG', $this->mod_reg ) : ''; // @todo Can deprecate? Probably 3.3
431
+ ( ! defined( 'WPMEM_CAPTCHA' ) ) ? define( 'WPMEM_CAPTCHA', $this->captcha ) : ''; // @todo Can deprecate? Probably 3.3
432
+ ( ! defined( 'WPMEM_NO_REG' ) ) ? define( 'WPMEM_NO_REG', ( -1 * $this->show_reg['post'] ) ) : ''; // @todo Can deprecate? Probably 3.3
433
+ ( ! defined( 'WPMEM_USE_EXP' ) ) ? define( 'WPMEM_USE_EXP', $this->use_exp ) : '';
434
+ ( ! defined( 'WPMEM_USE_TRL' ) ) ? define( 'WPMEM_USE_TRL', $this->use_trial ) : '';
435
+ ( ! defined( 'WPMEM_IGNORE_WARN' ) ) ? define( 'WPMEM_IGNORE_WARN', $this->warnings ) : ''; // @todo Can deprecate? Probably 3.3
436
+
437
+ ( ! defined( 'WPMEM_MSURL' ) ) ? define( 'WPMEM_MSURL', $this->user_pages['profile'] ) : ''; // @todo Can deprecate? Probably 3.3
438
+ ( ! defined( 'WPMEM_REGURL' ) ) ? define( 'WPMEM_REGURL', $this->user_pages['register'] ) : ''; // @todo Can deprecate? Probably 3.3
439
+ ( ! defined( 'WPMEM_LOGURL' ) ) ? define( 'WPMEM_LOGURL', $this->user_pages['login'] ) : ''; // @todo Can deprecate? Probably 3.3
440
+
441
+ ( ! defined( 'WPMEM_DROPIN_DIR' ) ) ? define( 'WPMEM_DROPIN_DIR', WP_PLUGIN_DIR . '/wp-members-dropins/' ) : '';
442
+
443
+ define( 'WPMEM_CSSURL', $this->cssurl );
444
+ }
445
+
446
+ /**
447
+ * Load dependent files.
448
+ *
449
+ * @since 3.1.6
450
+ */
451
+ function load_dependencies() {
452
+
453
+ /**
454
+ * Filter the location and name of the pluggable file.
455
+ *
456
+ * @since 2.9.0
457
+ * @since 3.1.6 Moved in load order to come before dependencies.
458
+ *
459
+ * @param string The path to WP-Members plugin functions file.
460
+ */
461
+ $wpmem_pluggable = apply_filters( 'wpmem_plugins_file', WP_PLUGIN_DIR . '/wp-members-pluggable.php' );
462
+
463
+ // Preload any custom functions, if available.
464
+ if ( file_exists( $wpmem_pluggable ) ) {
465
+ include( $wpmem_pluggable );
466
+ }
467
+
468
+ require_once( WPMEM_PATH . 'inc/class-wp-members-api.php' );
469
+ require_once( WPMEM_PATH . 'inc/class-wp-members-email.php' );
470
+ require_once( WPMEM_PATH . 'inc/class-wp-members-forms.php' );
471
+ require_once( WPMEM_PATH . 'inc/class-wp-members-menus.php' );
472
+ require_once( WPMEM_PATH . 'inc/class-wp-members-products.php' );
473
+ require_once( WPMEM_PATH . 'inc/class-wp-members-shortcodes.php' );
474
+ require_once( WPMEM_PATH . 'inc/class-wp-members-user.php' );
475
+ require_once( WPMEM_PATH . 'inc/class-wp-members-user-profile.php' );
476
+ require_once( WPMEM_PATH . 'inc/class-wp-members-widget.php' );
477
+ require_once( WPMEM_PATH . 'inc/api.php' );
478
+ require_once( WPMEM_PATH . 'inc/api-email.php' );
479
+ require_once( WPMEM_PATH . 'inc/api-forms.php' );
480
+ require_once( WPMEM_PATH . 'inc/api-users.php' );
481
+ require_once( WPMEM_PATH . 'inc/api-utilities.php' );
482
+ require_once( WPMEM_PATH . 'inc/forms.php' );
483
+ require_once( WPMEM_PATH . 'inc/dialogs.php' );
484
+ require_once( WPMEM_PATH . 'inc/wp-registration.php' );
485
+ require_once( WPMEM_PATH . 'inc/deprecated.php' );
486
+ //require_once( WPMEM_PATH . 'inc/core.php' ); // @deprectated 3.2.4
487
+ //require_once( WPMEM_PATH . 'inc/utilities.php' ); // @deprecated 3.2.3
488
+ //require_once( WPMEM_PATH . 'inc/sidebar.php' ); // @deprecated 3.2.0
489
+ //require_once( WPMEM_PATH . 'inc/shortcodes.php' ); // @deprecated 3.2.0
490
+ //require_once( WPMEM_PATH . 'inc/email.php' ); // @deprecated 3.2.0
491
+ //require_once( WPMEM_PATH . 'inc/users.php' ); // @deprecated 3.1.9
492
+
493
+ }
494
+
495
+ /**
496
+ * Load admin API and dependencies.
497
+ *
498
+ * Determines which scripts to load and actions to use based on the
499
+ * current users capabilities.
500
+ *
501
+ * @since 2.5.2
502
+ * @since 3.1.0 Added admin api object.
503
+ * @since 3.1.7 Moved from main plugin file as wpmem_chk_admin() to main object.
504
+ */
505
+ function load_admin() {
506
+
507
+ /**
508
+ * Fires before initialization of admin options.
509
+ *
510
+ * @since 2.9.0
511
+ */
512
+ do_action( 'wpmem_pre_admin_init' );
513
+
514
+ // Initilize the admin api.
515
+ $this->load_admin_api();
516
+
517
+ /**
518
+ * Fires after initialization of admin options.
519
+ *
520
+ * @since 2.9.0
521
+ */
522
+ do_action( 'wpmem_after_admin_init' );
523
+ }
524
+
525
+ /**
526
+ * Gets the requested action.
527
+ *
528
+ * @since 3.0.0
529
+ *
530
+ * @global string $wpmem_a The WP-Members action variable.
531
+ */
532
+ function get_action() {
533
+
534
+ // Get the action being done (if any).
535
+ $this->action = sanitize_text_field( wpmem_get( 'a', '', 'request' ) );
536
+
537
+ // For backward compatibility with processes that check $wpmem_a.
538
+ global $wpmem_a;
539
+ $wpmem_a = $this->action;
540
+
541
+ /**
542
+ * Fires when the wpmem action is retrieved.
543
+ *
544
+ * @since 3.1.7
545
+ */
546
+ do_action( 'wpmem_get_action' );
547
+
548
+ // Get the regchk value (if any).
549
+ $this->regchk = $this->get_regchk( $this->action );
550
+ }
551
+
552
+ /**
553
+ * Gets the regchk value.
554
+ *
555
+ * regchk is a legacy variable that contains information about the current
556
+ * action being performed. Login, logout, password, registration, profile
557
+ * update functions all return a specific value that is stored in regchk.
558
+ * This value and information about the current action can then be used to
559
+ * determine what content is to be displayed by the securify function.
560
+ *
561
+ * @since 3.0.0
562
+ *
563
+ * @global string $wpmem_a The WP-Members action variable.
564
+ *
565
+ * @param string $action The current action.
566
+ * @return string The regchk value.
567
+ */
568
+ function get_regchk( $action ) {
569
+
570
+ switch ( $action ) {
571
+
572
+ case 'login':
573
+ $regchk = $this->user->login();
574
+ break;
575
+
576
+ case 'logout':
577
+ $regchk = $this->user->logout();
578
+ break;
579
+
580
+ case 'pwdchange':
581
+ $regchk = $this->user->password_update( 'change' );
582
+ break;
583
+
584
+ case 'pwdreset':
585
+ $regchk = $this->user->password_update( 'reset' );
586
+ break;
587
+
588
+ case 'getusername':
589
+ $regchk = $this->user->retrieve_username();
590
+ break;
591
+
592
+ case 'register':
593
+ case 'update':
594
+ require_once( WPMEM_PATH . 'inc/register.php' );
595
+ $regchk = wpmem_registration( $action );
596
+ break;
597
+
598
+ default:
599
+ $regchk = ( isset( $regchk ) ) ? $regchk : '';
600
+ break;
601
+ }
602
+
603
+ /**
604
+ * Filter wpmem_regchk.
605
+ *
606
+ * The value of regchk is determined by functions that may be run in the get_regchk function.
607
+ * This value determines what happens in the wpmem_securify() function.
608
+ *
609
+ * @since 2.9.0
610
+ * @since 3.0.0 Moved to get_regchk() in WP_Members object.
611
+ *
612
+ * @param string $this->regchk The value of wpmem_regchk.
613
+ * @param string $this->action The $wpmem_a action.
614
+ */
615
+ $regchk = apply_filters( 'wpmem_regchk', $regchk, $action );
616
+
617
+ // Legacy global variable for use with older extensions.
618
+ global $wpmem_regchk;
619
+ $wpmem_regchk = $regchk;
620
+
621
+ return $regchk;
622
+ }
623
+
624
+ /**
625
+ * Determines if content should be blocked.
626
+ *
627
+ * This function was originally stand alone in the core file and
628
+ * was moved to the WP_Members class in 3.0.
629
+ *
630
+ * @since 3.0.0
631
+ *
632
+ * @global object $post The WordPress Post object.
633
+ * @return bool $block true|false
634
+ */
635
+ function is_blocked() {
636
+
637
+ global $post;
638
+
639
+ if ( $post ) {
640
+
641
+ // Backward compatibility for old block/unblock meta.
642
+ $meta = get_post_meta( $post->ID, '_wpmem_block', true );
643
+ if ( ! $meta ) {
644
+ // Check for old meta.
645
+ $old_block = get_post_meta( $post->ID, 'block', true );
646
+ $old_unblock = get_post_meta( $post->ID, 'unblock', true );
647
+ $meta = ( $old_block ) ? 1 : ( ( $old_unblock ) ? 0 : $meta );
648
+ }
649
+
650
+ // Setup defaults.
651
+ $defaults = array(
652
+ 'post_id' => $post->ID,
653
+ 'post_type' => $post->post_type,
654
+ 'block' => ( isset( $this->block[ $post->post_type ] ) && $this->block[ $post->post_type ] == 1 ) ? true : false,
655
+ 'block_meta' => $meta, // @todo get_post_meta( $post->ID, '_wpmem_block', true ),
656
+ 'block_type' => ( isset( $this->block[ $post->post_type ] ) ) ? $this->block[ $post->post_type ] : 0,
657
+ );
658
+
659
+ /**
660
+ * Filter the block arguments.
661
+ *
662
+ * @since 2.9.8
663
+ * @since 3.0.0 Moved to is_blocked() in WP_Members object.
664
+ *
665
+ * @param array $args Null.
666
+ * @param array $defaults Although you are not filtering the defaults, knowing what they are can assist developing more powerful functions.
667
+ */
668
+ $args = apply_filters( 'wpmem_block_args', '', $defaults );
669
+
670
+ // Merge $args with defaults.
671
+ $args = ( wp_parse_args( $args, $defaults ) );
672
+
673
+ if ( is_single() || is_page() ) {
674
+ switch( $args['block_type'] ) {
675
+ case 1: // If content is blocked by default.
676
+ $args['block'] = ( $args['block_meta'] == '0' ) ? false : $args['block'];
677
+ break;
678
+ case 0 : // If content is unblocked by default.
679
+ $args['block'] = ( $args['block_meta'] == '1' ) ? true : $args['block'];
680
+ break;
681
+ }
682
+
683
+ } else {
684
+ $args['block'] = false;
685
+ }
686
+
687
+ } else {
688
+ $args = array( 'block' => false );
689
+ }
690
+
691
+ // Don't block user pages.
692
+ $args['block'] = ( in_array( get_permalink(), $this->user_pages ) ) ? false : $args['block'];
693
+
694
+ /**
695
+ * Filter the block boolean.
696
+ *
697
+ * @since 2.7.5
698
+ *
699
+ * @param bool $args['block']
700
+ * @param array $args
701
+ */
702
+ return apply_filters( 'wpmem_block', $args['block'], $args );
703
+ }
704
+
705
+ /**
706
+ * The Securify Content Filter.
707
+ *
708
+ * This is the primary function that picks up where get_action() leaves off.
709
+ * Determines whether content is shown or hidden for both post and pages. This
710
+ * is a filter function for the_content.
711
+ *
712
+ * @link https://developer.wordpress.org/reference/functions/the_content/
713
+ * @link https://developer.wordpress.org/reference/hooks/the_content/
714
+ *
715
+ * @since 3.0.0
716
+ *
717
+ * @global object $post The WordPress Post object.
718
+ * @global object $wpmem The WP_Members object.
719
+ * @global string $wpmem_themsg Contains messages to be output.
720
+ * @param string $content
721
+ * @return string $content
722
+ */
723
+ function do_securify( $content = null ) {
724
+
725
+ global $post, $wpmem, $wpmem_themsg;
726
+
727
+ $content = ( is_single() || is_page() ) ? $content : wpmem_do_excerpt( $content );
728
+
729
+ if ( ( ! has_shortcode( $content, 'wp-members' ) ) ) {
730
+
731
+ if ( $this->regchk == "captcha" ) {
732
+ global $wpmem_captcha_err;
733
+ $wpmem_themsg = $wpmem->get_text( 'reg_captcha_err' ) . '<br /><br />' . $wpmem_captcha_err;
734
+ }
735
+
736
+ // Block/unblock Posts.
737
+ if ( ! is_user_logged_in() && $this->is_blocked() == true ) {
738
+
739
+ //Show the login and registration forms.
740
+ if ( $this->regchk ) {
741
+
742
+ // Empty content in any of these scenarios.
743
+ $content = '';
744
+
745
+ switch ( $this->regchk ) {
746
+
747
+ case "loginfailed":
748
+ $content = wpmem_inc_loginfailed();
749
+ break;
750
+
751
+ case "success":
752
+ $content = wpmem_inc_regmessage( $this->regchk, $wpmem_themsg );
753
+ $content = $content . wpmem_inc_login();
754
+ break;
755
+
756
+ default:
757
+ $content = wpmem_inc_regmessage( $this->regchk, $wpmem_themsg );
758
+ $content = $content . wpmem_inc_registration();
759
+ break;
760
+ }
761
+
762
+ } else {
763
+
764
+ // Toggle shows excerpt above login/reg on posts/pages.
765
+ global $wp_query;
766
+ if ( isset( $wp_query->query_vars['page'] ) && $wp_query->query_vars['page'] > 1 ) {
767
+
768
+ // Shuts down excerpts on multipage posts if not on first page.
769
+ $content = '';
770
+
771
+ } elseif ( isset( $this->show_excerpt[ $post->post_type ] ) && $this->show_excerpt[ $post->post_type ] == 1 ) {
772
+
773
+ if ( ! stristr( $content, '<span id="more' ) ) {
774
+ $content = wpmem_do_excerpt( $content );
775
+ } else {
776
+ $len = strpos( $content, '<span id="more' );
777
+ $content = substr( $content, 0, $len );
778
+ }
779
+
780
+ } else {
781
+
782
+ // Empty all content.
783
+ $content = '';
784
+
785
+ }
786
+
787
+ $content = ( isset( $this->show_login[ $post->post_type ] ) && $this->show_login[ $post->post_type ] == 1 ) ? $content . wpmem_inc_login() : $content . wpmem_inc_login( 'page', '', 'hide' );
788
+
789
+ $content = ( isset( $this->show_reg[ $post->post_type ] ) && $this->show_reg[ $post->post_type ] == 1 ) ? $content . wpmem_inc_registration() : $content;
790
+ }
791
+
792
+ // Protects comments if expiration module is used and user is expired.
793
+ } elseif ( is_user_logged_in() && $this->is_blocked() == true ){
794
+
795
+ if ( $this->use_exp == 1 && function_exists( 'wpmem_do_expmessage' ) ) {
796
+ /**
797
+ * Filters the user expired message used by the PayPal extension.
798
+ *
799
+ * @since 3.2.0
800
+ *
801
+ * @param string $message
802
+ * @param string $content
803
+ */
804
+ $content = apply_filters( 'wpmem_do_expmessage', wpmem_do_expmessage( $content ), $content );
805
+ }
806
+ }
807
+ }
808
+
809
+ /**
810
+ * Filter the value of $content after wpmem_securify has run.
811
+ *
812
+ * @since 2.7.7
813
+ * @since 3.0.0 Moved to new method in WP_Members Class.
814
+ *
815
+ * @param string $content The content after securify has run.
816
+ */
817
+ $content = apply_filters( 'wpmem_securify', $content );
818
+
819
+ if ( 1 == $this->texturize && strstr( $content, '[wpmem_txt]' ) ) {
820
+ // Fix the wptexturize.
821
+ remove_filter( 'the_content', 'wpautop' );
822
+ remove_filter( 'the_content', 'wptexturize' );
823
+ add_filter( 'the_content', array( $this, 'texturize' ), 999 );
824
+ }
825
+
826
+ return $content;
827
+
828
+ }
829
+
830
+ /**
831
+ * Securifies the comments.
832
+ *
833
+ * If the user is not logged in and the content is blocked
834
+ * (i.e. wpmem->is_blocked() returns true), function loads a
835
+ * dummy/empty comments template.
836
+ *
837
+ * @since 2.9.9
838
+ * @since 3.2.0 Moved wpmem_securify_comments() to main class, renamed.
839
+ *
840
+ * @return bool $open true if current post is open for comments, otherwise false.
841
+ */
842
+ function do_securify_comments( $open ) {
843
+
844
+ $open = ( ! is_user_logged_in() && wpmem_is_blocked() ) ? false : $open;
845
+
846
+ /**
847
+ * Filters whether comments are open or not.
848
+ *
849
+ * @since 3.0.0
850
+ * @since 3.2.0 Moved to main class.
851
+ *
852
+ * @param bool $open true if current post is open for comments, otherwise false.
853
+ */
854
+ $open = apply_filters( 'wpmem_securify_comments', $open );
855
+
856
+ if ( ! $open ) {
857
+ /** This filter is documented in wp-includes/comment-template.php */
858
+ add_filter( 'comments_array', array( $this, 'do_securify_comments_array' ), 10, 2 );
859
+ }
860
+
861
+ return $open;
862
+ }
863
+
864
+ /**
865
+ * Empties the comments array if content is blocked.
866
+ *
867
+ * @since 3.0.1
868
+ * @since 3.2.0 Moved wpmem_securify_comments_array() to main class, renamed.
869
+ *
870
+ * @global object $wpmem The WP-Members object class.
871
+ *
872
+ * @return array $comments The comments array.
873
+ */
874
+ function do_securify_comments_array( $comments , $post_id ) {
875
+ $comments = ( ! is_user_logged_in() && wpmem_is_blocked() ) ? array() : $comments;
876
+ return $comments;
877
+ }
878
+
879
+ /**
880
+ * Adds the successful registration message on the login page if reg_nonce validates.
881
+ *
882
+ * @since 3.1.7
883
+ * @since 3.2.0 Moved to wpmem object, renamed reg_securify()
884
+ *
885
+ * @param string $content
886
+ * @return string $content
887
+ */
888
+ function reg_securify( $content ) {
889
+ global $wpmem, $wpmem_themsg;
890
+ $nonce = wpmem_get( 'reg_nonce', false, 'get' );
891
+ if ( $nonce && wp_verify_nonce( $nonce, 'register_redirect' ) ) {
892
+ $content = wpmem_inc_regmessage( 'success', $wpmem_themsg );
893
+ $content = $content . wpmem_inc_login();
894
+ }
895
+ return $content;
896
+ }
897
+
898
+ /**
899
+ * Gets an array of hidden post IDs.
900
+ *
901
+ * @since 3.2.0
902
+ *
903
+ * @global object $wpdb
904
+ * @return array $hidden
905
+ */
906
+ function hidden_posts() {
907
+ global $wpdb;
908
+ $hidden = get_transient( '_wpmem_hidden_posts' );
909
+ if ( false === $hidden ) {
910
+ $hidden = $this->update_hidden_posts();
911
+ }
912
+ return $hidden;
913
+ }
914
+
915
+ /**
916
+ * Updates the hidden post array transient.
917
+ *
918
+ * @since 3.2.0
919
+ *
920
+ * @global object $wpdb
921
+ * @return array $hidden
922
+ */
923
+ function update_hidden_posts() {
924
+ global $wpdb;
925
+ $hidden = array();
926
+ $results = $wpdb->get_results( "SELECT post_id FROM " . $wpdb->prefix . "postmeta WHERE meta_key = '_wpmem_block' AND meta_value = 2" );
927
+ foreach( $results as $result ) {
928
+ $hidden[] = $result->post_id;
929
+ }
930
+ set_transient( '_wpmem_hidden_posts', $hidden, 60*5 );
931
+ return $hidden;
932
+ }
933
+
934
+ /**
935
+ * Gets an array of hidden post IDs.
936
+ *
937
+ * @since 3.2.0
938
+ *
939
+ * @return array $hidden
940
+ */
941
+ function get_hidden_posts() {
942
+ $hidden = array();
943
+ if ( ! is_admin() && ( ! is_user_logged_in() ) ) {
944
+ $hidden = $this->hidden_posts();
945
+ }
946
+ // @todo Possibly separate query here to check. If the user IS logged in, check what posts they DON'T have access to.
947
+ if ( ! is_admin() && is_user_logged_in() && 1 == $this->enable_products ) {
948
+ // Get user product access.
949
+ // @todo This maybe should be a transient stored in the user object.
950
+ $hidden = $this->hidden_posts();
951
+ $hidden = ( is_array( $hidden ) ) ? $hidden : array();
952
+ foreach ( $this->membership->products as $key => $value ) {
953
+ if ( isset( $this->user->access[ $key ] ) && ( true === $this->user->access[ $key ] || $this->user->is_current( $this->user->access[ $key ] ) ) ) {
954
+ foreach ( $hidden as $post_id ) {
955
+ if ( 1 == get_post_meta( $post_id, $this->membership->post_stem . $key, true ) ) {
956
+ $hidden_key = array_search( $post_id, $hidden );
957
+ unset( $hidden[ $hidden_key ] );
958
+ }
959
+ }
960
+ }
961
+ }
962
+ }
963
+ return $hidden;
964
+ }
965
+
966
+ /**
967
+ * Hides posts based on settings and meta.
968
+ *
969
+ * @since 3.2.0
970
+ *
971
+ * @param array $query
972
+ * @return array $query
973
+ */
974
+ function do_hide_posts( $query ) {
975
+ $hidden_posts = $this->get_hidden_posts();
976
+ if ( ! empty( $hidden_posts ) ) {
977
+ $query->set( 'post__not_in', $hidden_posts );
978
+ }
979
+ return $query;
980
+ }
981
+
982
+ /**
983
+ * Filter to hide pages for get_pages().
984
+ *
985
+ * @since 3.2.0
986
+ *
987
+ * @global object $wpdb
988
+ * @param array $pages
989
+ * @return array $pages
990
+ */
991
+ function filter_get_pages( $pages ) {
992
+ $hidden_posts = $this->get_hidden_posts();
993
+ if ( ! empty ( $hidden_posts ) ) {
994
+ $new_pages = array();
995
+ foreach ( $pages as $key => $page ) {
996
+ if ( ! in_array( $page->ID, $hidden_posts ) ) {
997
+ $new_pages[ $key ] = $page;
998
+ }
999
+ }
1000
+ $pages = $new_pages;
1001
+ }
1002
+ return $pages;
1003
+ }
1004
+
1005
+ /**
1006
+ * Filter to hide menu items.
1007
+ *
1008
+ * @since 3.2.0
1009
+ *
1010
+ * @param array $items
1011
+ * @param $menu
1012
+ * @param array $args
1013
+ * @return array $items
1014
+ */
1015
+ function filter_nav_menu_items( $items, $menu, $args ) {
1016
+ $hidden_posts = $this->get_hidden_posts();
1017
+ if ( ! empty( $hidden_posts ) ) {
1018
+ foreach ( $items as $key => $item ) {
1019
+ if ( in_array( $item->object_id, $hidden_posts ) ) {
1020
+ unset( $items[ $key ] );
1021
+ }
1022
+ }
1023
+ }
1024
+ return $items;
1025
+ }
1026
+
1027
+ /**
1028
+ * Filter to remove hidden posts from prev/next links.
1029
+ *
1030
+ * @since 3.2.4
1031
+ *
1032
+ * @global object $wpmem
1033
+ * @param string $where
1034
+ * @return string $where
1035
+ */
1036
+ function filter_get_adjacent_post_where( $where ) {
1037
+ global $wpmem;
1038
+ $hidden_posts = $this->get_hidden_posts();
1039
+ if ( ! empty( $hidden_posts ) ) {
1040
+ $hidden = implode( ",", $hidden_posts );
1041
+ $where = $where . " AND p.ID NOT IN ( $hidden )";
1042
+ }
1043
+ return $where;
1044
+ }
1045
+
1046
+ /**
1047
+ * Sets the registration fields.
1048
+ *
1049
+ * @since 3.0.0
1050
+ * @since 3.1.5 Added $form argument.
1051
+ *
1052
+ * @param string $form The form being generated.
1053
+ */
1054
+ function load_fields( $form = 'default' ) {
1055
+
1056
+ // Get stored fields settings.
1057
+ $fields = get_option( 'wpmembers_fields' );
1058
+
1059
+ // Validate fields settings.
1060
+ if ( ! isset( $fields ) || empty( $fields ) ) {
1061
+ // Update settings.
1062
+ $fields = array( array( 10, 'Email', 'user_email', 'email', 'y', 'y', 'y' ) );
1063
+ }
1064
+
1065
+ // Add new field array keys
1066
+ foreach ( $fields as $key => $val ) {
1067
+
1068
+ // Key fields with meta key.
1069
+ $meta_key = $val[2];
1070
+
1071
+ // Old format, new key.
1072
+ foreach ( $val as $subkey => $subval ) {
1073
+ $this->fields[ $meta_key ][ $subkey ] = $subval;
1074
+ }
1075
+
1076
+ // Setup field properties.
1077
+ $this->fields[ $meta_key ]['label'] = $val[1];
1078
+ $this->fields[ $meta_key ]['type'] = $val[3];
1079
+ $this->fields[ $meta_key ]['register'] = ( 'y' == $val[4] ) ? true : false;
1080
+ $this->fields[ $meta_key ]['required'] = ( 'y' == $val[5] ) ? true : false;
1081
+ $this->fields[ $meta_key ]['profile'] = '';
1082
+ $this->fields[ $meta_key ]['native'] = ( 'y' == $val[6] ) ? true : false;
1083
+
1084
+ // Certain field types have additional properties.
1085
+ switch ( $val[3] ) {
1086
+
1087
+ case 'checkbox':
1088
+ $this->fields[ $meta_key ]['checked_value'] = $val[7];
1089
+ $this->fields[ $meta_key ]['checked_default'] = ( 'y' == $val[8] ) ? true : false;
1090
+ break;
1091
+
1092
+ case 'select':
1093
+ case 'multiselect':
1094
+ case 'multicheckbox':
1095
+ case 'radio':
1096
+ // Correct a malformed value (if last value is empty due to a trailing comma).
1097
+ if ( '' == end( $val[7] ) ) {
1098
+ array_pop( $val[7] );
1099
+ $this->fields[ $meta_key ][7] = $val[7];
1100
+ }
1101
+ $this->fields[ $meta_key ]['values'] = $val[7];
1102
+ $this->fields[ $meta_key ]['delimiter'] = ( isset( $val[8] ) ) ? $val[8] : '|';
1103
+ $this->fields[ $meta_key ]['options'] = array();
1104
+ foreach ( $val[7] as $value ) {
1105
+ $pieces = explode( '|', trim( $value ) );
1106
+ if ( isset( $pieces[1] ) && $pieces[1] != '' ) {
1107
+ $this->fields[ $meta_key ]['options'][ $pieces[1] ] = $pieces[0];
1108
+ }
1109
+ }
1110
+ break;
1111
+
1112
+ case 'file':
1113
+ case 'image':
1114
+ $this->fields[ $meta_key ]['file_types'] = $val[7];
1115
+ break;
1116
+
1117
+ case 'hidden':
1118
+ $this->fields[ $meta_key ]['value'] = $val[7];
1119
+ break;
1120
+
1121
+ }
1122
+ }
1123
+ }
1124
+
1125
+ /**
1126
+ * Get excluded meta fields.
1127
+ *
1128
+ * @since 3.0.0
1129
+ *
1130
+ * @param string $tag A tag so we know where the function is being used.
1131
+ * @return array The excluded fields.
1132
+ */
1133
+ function excluded_fields( $tag ) {
1134
+
1135
+ // Default excluded fields.
1136
+ $excluded_fields = array( 'password', 'confirm_password', 'confirm_email', 'password_confirm', 'email_confirm' );
1137
+
1138
+ if ( 'update' == $tag || 'admin-profile' == $tag || 'user-profile' == $tag || 'wp-register' == $tag ) {
1139
+ $excluded_fields[] = 'username';
1140
+ }
1141
+
1142
+ if ( 'admin-profile' == $tag || 'user-profile' == $tag ) {
1143
+ array_push( $excluded_fields, 'first_name', 'last_name', 'nickname', 'display_name', 'user_email', 'description', 'user_url' );
1144
+ }
1145
+
1146
+ /**
1147
+ * Filter the fields to be excluded when user is created/updated.
1148
+ *
1149
+ * @since 2.9.3
1150
+ * @since 3.0.0 Moved to new method in WP_Members Class.
1151
+ *
1152
+ * @param array An array of the field meta names to exclude.
1153
+ * @param string $tag A tag so we know where the function is being used.
1154
+ */
1155
+ $excluded_fields = apply_filters( 'wpmem_exclude_fields', $excluded_fields, $tag );
1156
+
1157
+ // Return excluded fields.
1158
+ return $excluded_fields;
1159
+ }
1160
+
1161
+ /**
1162
+ * Set page locations.
1163
+ *
1164
+ * Handles numeric page IDs while maintaining
1165
+ * compatibility with old full url settings.
1166
+ *
1167
+ * @since 3.0.8
1168
+ */
1169
+ function load_user_pages() {
1170
+ foreach ( $this->user_pages as $key => $val ) {
1171
+ if ( is_numeric( $val ) ) {
1172
+ $this->user_pages[ $key ] = get_page_link( $val );
1173
+ }
1174
+ }
1175
+ }
1176
+
1177
+ /**
1178
+ * Returns a requested text string.
1179
+ *
1180
+ * This function manages all of the front-end facing text.
1181
+ * All defaults can be filtered using wpmem_default_text_strings.
1182
+ *
1183
+ * @since 3.1.0
1184
+ *
1185
+ * @param string $str
1186
+ * @return string $text
1187
+ */
1188
+ function get_text( $str ) {
1189
+
1190
+ // Default Form Fields.
1191
+ $default_form_fields = array(
1192
+ 'first_name' => __( 'First Name', 'wp-members' ),
1193
+ 'last_name' => __( 'Last Name', 'wp-members' ),
1194
+ 'addr1' => __( 'Address 1', 'wp-members' ),
1195
+ 'addr2' => __( 'Address 2', 'wp-members' ),
1196
+ 'city' => __( 'City', 'wp-members' ),
1197
+ 'thestate' => __( 'State', 'wp-members' ),
1198
+ 'zip' => __( 'Zip', 'wp-members' ),
1199
+ 'country' => __( 'Country', 'wp-members' ),
1200
+ 'phone1' => __( 'Day Phone', 'wp-members' ),
1201
+ 'user_email' => __( 'Email', 'wp-members' ),
1202
+ 'confirm_email' => __( 'Confirm Email', 'wp-members' ),
1203
+ 'user_url' => __( 'Website', 'wp-members' ),
1204
+ 'description' => __( 'Biographical Info', 'wp-members' ),
1205
+ 'password' => __( 'Password', 'wp-members' ),
1206
+ 'confirm_password' => __( 'Confirm Password', 'wp-members' ),
1207
+ 'tos' => __( 'TOS', 'wp-members' ),
1208
+ );
1209
+
1210
+ /*
1211
+ * Strings to be added or removed in future versions, included so they will
1212
+ * be in the translation template.
1213
+ * @todo Check whether any of these should be removed.
1214
+ */
1215
+ $benign_strings = array(
1216
+ __( 'No fields selected for deletion', 'wp-members' ),
1217
+ __( 'You are not logged in.', 'wp-members' ), // Technically removed 3.5
1218
+ );
1219
+
1220
+ $defaults = array(
1221
+
1222
+ // Login form.
1223
+ 'login_heading' => __( 'Existing Users Log In', 'wp-members' ),
1224
+ 'login_username' => __( 'Username or Email', 'wp-members' ),
1225
+ 'login_password' => __( 'Password', 'wp-members' ),
1226
+ 'login_button' => __( 'Log In', 'wp-members' ),
1227
+ 'remember_me' => __( 'Remember Me', 'wp-members' ),
1228
+ 'forgot_link_before' => __( 'Forgot password?', 'wp-members' ) . '&nbsp;',
1229
+ 'forgot_link' => __( 'Click here to reset', 'wp-members' ),
1230
+ 'register_link_before' => __( 'New User?', 'wp-members' ) . '&nbsp;',
1231
+ 'register_link' => __( 'Click here to register', 'wp-members' ),
1232
+
1233
+ // Password change form.
1234
+ 'pwdchg_heading' => __( 'Change Password', 'wp-members' ),
1235
+ 'pwdchg_password1' => __( 'New password', 'wp-members' ),
1236
+ 'pwdchg_password2' => __( 'Confirm new password', 'wp-members' ),
1237
+ 'pwdchg_button' => __( 'Update Password', 'wp-members' ),
1238
+
1239
+ // Password reset form.
1240
+ 'pwdreset_heading' => __( 'Reset Forgotten Password', 'wp-members' ),
1241
+ 'pwdreset_username' => __( 'Username', 'wp-members' ),
1242
+ 'pwdreset_email' => __( 'Email', 'wp-members' ),
1243
+ 'pwdreset_button' => __( 'Reset Password' ),
1244
+ 'username_link_before' => __( 'Forgot username?', 'wp-members' ) . '&nbsp;',
1245
+ 'username_link' => __( 'Click here', 'wp-members' ),
1246
+
1247
+ // Retrieve username form.
1248
+ 'username_heading' => __( 'Retrieve username', 'wp-members' ),
1249
+ 'username_email' => __( 'Email Address', 'wp-members' ),
1250
+ 'username_button' => __( 'Retrieve username', 'wp-members' ),
1251
+
1252
+ // Register form.
1253
+ 'register_heading' => __( 'New User Registration', 'wp-members' ),
1254
+ 'register_username' => __( 'Choose a Username', 'wp-members' ),
1255
+ 'register_rscaptcha' => __( 'Input the code:', 'wp-members' ),
1256
+ 'register_tos' => __( 'Please indicate that you agree to the %s Terms of Service %s', 'wp-members' ), // @note: if default changes, default check after wpmem_tos_link_txt must change.
1257
+ 'register_clear' => __( 'Reset Form', 'wp-members' ),
1258
+ 'register_submit' => __( 'Register', 'wp-members' ),
1259
+ 'register_req_mark' => '<span class="req">*</span>',
1260
+ 'register_required' => '<span class="req">*</span>' . __( 'Required field', 'wp-members' ),
1261
+
1262
+ // User profile update form.
1263
+ 'profile_heading' => __( 'Edit Your Information', 'wp-members' ),
1264
+ 'profile_username' => __( 'Username', 'wp-members' ),
1265
+ 'profile_submit' => __( 'Update Profile', 'wp-members' ),
1266
+ 'profile_upload' => __( 'Update this file', 'wp-members' ),
1267
+
1268
+ // Error messages and dialogs.
1269
+ 'login_failed_heading' => __( 'Login Failed!', 'wp-members' ),
1270
+ 'login_failed' => __( 'You entered an invalid username or password.', 'wp-members' ),
1271
+ 'login_failed_link' => __( 'Click here to continue.', 'wp-members' ),
1272
+ 'pwdchangempty' => __( 'Password fields cannot be empty', 'wp-members' ),
1273
+ 'usernamefailed' => __( 'Sorry, that email address was not found.', 'wp-members' ),
1274
+ 'usernamesuccess' => __( 'An email was sent to %s with your username.', 'wp-members' ),
1275
+ 'reg_empty_field' => __( 'Sorry, %s is a required field.', 'wp-members' ),
1276
+ 'reg_valid_email' => __( 'You must enter a valid email address.', 'wp-members' ),
1277
+ 'reg_non_alphanumeric' => __( 'The username cannot include non-alphanumeric characters.', 'wp-members' ),
1278
+ 'reg_empty_username' => __( 'Sorry, username is a required field', 'wp-members' ),
1279
+ 'reg_password_match' => __( 'Passwords did not match.', 'wp-members' ),
1280
+ 'reg_email_match' => __( 'Emails did not match.', 'wp-members' ),
1281
+ 'reg_empty_captcha' => __( 'You must complete the CAPTCHA form.', 'wp-members' ),
1282
+ 'reg_invalid_captcha' => __( 'CAPTCHA was not valid.', 'wp-members' ),
1283
+ 'reg_generic' => __( 'There was an error processing the form.', 'wp-members' ),
1284
+ 'reg_captcha_err' => __( 'There was an error with the CAPTCHA form.', 'wp-members' ),
1285
+ 'reg_file_type' => __( 'Sorry, you can only upload the following file types for the %s field: %s.', 'wp-members' ),
1286
+
1287
+ // Links.
1288
+ 'profile_edit' => __( 'Edit My Information', 'wp-members' ),
1289
+ 'profile_password' => __( 'Change Password', 'wp-members' ),
1290
+ 'register_status' => __( 'You are logged in as %s', 'wp-members' ),
1291
+ 'register_logout' => __( 'Click to log out.', 'wp-members' ),
1292
+ 'register_continue' => __( 'Begin using the site.', 'wp-members' ),
1293
+ 'login_welcome' => __( 'You are logged in as %s', 'wp-members' ),
1294
+ 'login_logout' => __( 'Click to log out', 'wp-members' ),
1295
+ 'status_welcome' => __( 'You are logged in as %s', 'wp-members' ),
1296
+ 'status_logout' => __( 'click to log out', 'wp-members' ),
1297
+ 'menu_logout' => __( 'Log Out', 'wp-members' ),
1298
+
1299
+ // Widget.
1300
+ 'sb_status' => __( 'You are logged in as %s', 'wp-members' ),
1301
+ 'sb_logout' => __( 'click here to log out', 'wp-members' ),
1302
+ 'sb_login_failed' => __( 'Login Failed!<br />You entered an invalid username or password.', 'wp-members' ),
1303
+ 'sb_not_logged_in' => '',
1304
+ 'sb_login_username' => __( 'Username or Email', 'wp-members' ),
1305
+ 'sb_login_password' => __( 'Password', 'wp-members' ),
1306
+ 'sb_login_button' => __( 'log in', 'wp-members' ),
1307
+ 'sb_login_forgot' => __( 'Forgot?', 'wp-members' ),
1308
+ 'sb_login_register' => __( 'Register', 'wp-members' ),
1309
+
1310
+ // Default Dialogs.
1311
+ 'restricted_msg' => __( "This content is restricted to site members. If you are an existing user, please log in. New users may register below.", 'wp-members' ),
1312
+ 'success' => __( "Congratulations! Your registration was successful.<br /><br />You may now log in using the password that was emailed to you.", 'wp-members' ),
1313
+
1314
+ // @todo Under consideration for removal from the Dialogs tab.
1315
+ 'user' => __( "Sorry, that username is taken, please try another.", 'wp-members' ),
1316
+ 'email' => __( "Sorry, that email address already has an account.<br />Please try another.", 'wp-members' ),
1317
+ 'editsuccess' => __( "Your information was updated!", 'wp-members' ),
1318
+
1319
+ // @todo These are defaults and are under consideration for removal from the dialogs tab, possibly as we change the password reset to a link based process.
1320
+ 'pwdchangerr' => __( "Passwords did not match.<br /><br />Please try again.", 'wp-members' ),
1321
+ 'pwdchangesuccess' => __( "Password successfully changed!", 'wp-members' ),
1322
+ 'pwdreseterr' => __( "Either the username or email address do not exist in our records.", 'wp-members' ),
1323
+ 'pwdresetsuccess' => __( "Password successfully reset!<br /><br />An email containing a new password has been sent to the email address on file for your account.", 'wp-members' ),
1324
+
1325
+ 'product_restricted' => __( "Sorry, you do not have access to this content.", 'wp-members' ),
1326
+
1327
+ ); // End of $defaults array.
1328
+
1329
+ /**
1330
+ * Filter default terms.
1331
+ *
1332
+ * @since 3.1.0
1333
+ * @deprecated 3.2.7 Use wpmem_default_text instead.
1334
+ */
1335
+ $text = apply_filters( 'wpmem_default_text_strings', '' );
1336
+
1337
+ // Merge filtered $terms with $defaults.
1338
+ $text = wp_parse_args( $text, $defaults );
1339
+
1340
+ /**
1341
+ * Filter the default terms.
1342
+ *
1343
+ * Replaces 'wpmem_default_text_strings' so that multiple filters could
1344
+ * be run. This allows for custom filters when also running the Text
1345
+ * String Editor extension.
1346
+ *
1347
+ * @since 3.2.7
1348
+ */
1349
+ $text = apply_filters( 'wpmem_default_text', $text );
1350
+
1351
+ // Return the requested text string.
1352
+ return $text[ $str ];
1353
+
1354
+ } // End of get_text().
1355
+
1356
+ /**
1357
+ * Load the admin api.
1358
+ *
1359
+ * @since 3.1.0
1360
+ */
1361
+ function load_admin_api() {
1362
+ if ( is_admin() ) {
1363
+ /**
1364
+ * Load the admin api class.
1365
+ *
1366
+ * @since 3.1.0
1367
+ */
1368
+ include_once( WPMEM_PATH . 'admin/includes/class-wp-members-admin-api.php' );
1369
+ $this->admin = new WP_Members_Admin_API;
1370
+ }
1371
+ }
1372
+
1373
+ /**
1374
+ * Initializes the WP-Members widget.
1375
+ *
1376
+ * @since 3.2.0 Replaces widget_wpmemwidget_init
1377
+ */
1378
+ public function widget_init() {
1379
+ // Register the WP-Members widget.
1380
+ register_widget( 'widget_wpmemwidget' );
1381
+ }
1382
+
1383
+ /**
1384
+ * Adds WP-Members query vars to WP's public query vars.
1385
+ *
1386
+ * @since 3.2.0
1387
+ *
1388
+ * @see https://codex.wordpress.org/Plugin_API/Filter_Reference/query_vars
1389
+ *
1390
+ * @param array $qvars
1391
+ */
1392
+ public function add_query_vars ( $qvars ) {
1393
+ $qvars[] = 'a'; // The WP-Members action variable.
1394
+ return $qvars;
1395
+ }
1396
+
1397
+ /**
1398
+ * Enqueues login/out script for the footer.
1399
+ *
1400
+ * @since 3.2.0
1401
+ */
1402
+ public function loginout_script() {
1403
+ if ( is_user_logged_in() ) {
1404
+ wp_enqueue_script( 'jquery' );
1405
+ add_action( 'wp_footer', array( $this, 'do_loginout_script' ), 50 );
1406
+ }
1407
+ }
1408
+
1409
+ /**
1410
+ * Outputs login/out script for the footer.
1411
+ *
1412
+ * @since 3.2.0
1413
+ *
1414
+ * @global object $wpmem
1415
+ */
1416
+ public function do_loginout_script() {
1417
+ global $wpmem;
1418
+ $logout = apply_filters( 'wpmem_logout_link', add_query_arg( 'a', 'logout' ) );
1419
+ ?><script type="text/javascript">
1420
+ jQuery('.wpmem_loginout').html('<a class="login_button" href="<?php echo $logout; ?>"><?php echo $this->get_text( 'menu_logout' ); ?></a>');
1421
+ </script><?php
1422
+ }
1423
+
1424
+ /**
1425
+ * Adds WP-Members controls to the Customizer
1426
+ *
1427
+ * @since 3.2.0
1428
+ *
1429
+ * @param object $wp_customize The Customizer object.
1430
+ */
1431
+ function customizer_settings( $wp_customize ) {
1432
+ $wp_customize->add_section( 'wp_members' , array(
1433
+ 'title' => 'WP-Members',
1434
+ 'priority' => 190,
1435
+ ) );
1436
+
1437
+ // Add settings for output description
1438
+ $wp_customize->add_setting( 'wpmem_show_logged_out_state', array(
1439
+ 'default' => '1',
1440
+ 'type' => 'theme_mod', //'option'
1441
+ 'capability' => 'edit_theme_options',
1442
+ 'transport' => 'refresh',
1443
+ ) );
1444
+
1445
+ // Add settings for output description
1446
+ $wp_customize->add_setting( 'wpmem_show_form_message_dialog', array(
1447
+ 'default' => '1',
1448
+ 'type' => 'theme_mod', //'option'
1449
+ 'capability' => 'edit_theme_options',
1450
+ 'transport' => 'refresh',
1451
+ ) );
1452
+
1453
+ // Add control and output for select field
1454
+ $wp_customize->add_control( 'wpmem_show_form_logged_out', array(
1455
+ 'label' => __( 'Show forms as logged out', 'wp-members' ),
1456
+ 'section' => 'wp_members',
1457
+ 'settings' => 'wpmem_show_logged_out_state',
1458
+ 'type' => 'checkbox',
1459
+ 'std' => '1'
1460
+ ) );
1461
+
1462
+ // Add control for showing dialog
1463
+ $wp_customize->add_control( 'wpmem_show_form_dialog', array(
1464
+ 'label' => __( 'Show form message dialog', 'wp-members' ),
1465
+ 'section' => 'wp_members',
1466
+ 'settings' => 'wpmem_show_form_message_dialog',
1467
+ 'type' => 'checkbox',
1468
+ 'std' => '0'
1469
+ ) );
1470
+ }
1471
+
1472
+ /**
1473
+ * Overrides the wptexturize filter.
1474
+ *
1475
+ * Currently only used for the login form to remove the <br> tag that WP puts in after the "Remember Me".
1476
+ *
1477
+ * @since 2.6.4
1478
+ * @since 3.2.3 Moved to WP_Members class.
1479
+ *
1480
+ * @todo Possibly deprecate or severely alter this process as its need may be obsolete.
1481
+ *
1482
+ * @param string $content
1483
+ * @return string $new_content
1484
+ */
1485
+ function texturize( $content ) {
1486
+
1487
+ $new_content = '';
1488
+ $pattern_full = '{(\[wpmem_txt\].*?\[/wpmem_txt\])}is';
1489
+ $pattern_contents = '{\[wpmem_txt\](.*?)\[/wpmem_txt\]}is';
1490
+ $pieces = preg_split( $pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE );
1491
+
1492
+ foreach ( $pieces as $piece ) {
1493
+ if ( preg_match( $pattern_contents, $piece, $matches ) ) {
1494
+ $new_content .= $matches[1];
1495
+ } else {
1496
+ $new_content .= wptexturize( wpautop( $piece ) );
1497
+ }
1498
+ }
1499
+
1500
+ return $new_content;
1501
+ }
1502
+
1503
+ /**
1504
+ * Loads the stylesheet for tableless forms.
1505
+ *
1506
+ * @since 2.6
1507
+ * @since 3.2.3 Moved to WP_Members class.
1508
+ *
1509
+ * @global object $wpmem The WP_Members object.
1510
+ */
1511
+ function enqueue_style() {
1512
+ global $wpmem;
1513
+ wp_enqueue_style ( 'wp-members', wpmem_force_ssl( $wpmem->cssurl ), '', WPMEM_VERSION );
1514
+ }
1515
+
1516
+ /**
1517
+ * Creates an excerpt on the fly if there is no 'more' tag.
1518
+ *
1519
+ * @since 2.6
1520
+ * @since 3.2.3 Moved to WP_Members class.
1521
+ * @since 3.2.5 Check if post object exists.
1522
+ *
1523
+ * @global object $post The post object.
1524
+ * @global object $wpmem The WP_Members object.
1525
+ *
1526
+ * @param string $content
1527
+ * @return string $content
1528
+ */
1529
+ function do_excerpt( $content ) {
1530
+
1531
+ global $post, $more, $wpmem;
1532
+
1533
+ if ( is_object( $post ) ) {
1534
+
1535
+ $post_id = $post->ID;
1536
+ $post_type = $post->post_type;
1537
+
1538
+ $autoex = ( isset( $wpmem->autoex[ $post->post_type ] ) && 1 == $wpmem->autoex[ $post->post_type ]['enabled'] ) ? $wpmem->autoex[ $post->post_type ] : false;
1539
+
1540
+ // Is there already a 'more' link in the content?
1541
+ $has_more_link = ( stristr( $content, 'class="more-link"' ) ) ? true : false;
1542
+
1543
+ // If auto_ex is on.
1544
+ if ( $autoex ) {
1545
+
1546
+ // Build an excerpt if one does not exist.
1547
+ if ( ! $has_more_link ) {
1548
+
1549
+ $is_singular = ( is_singular( $post->post_type ) ) ? true : false;
1550
+
1551
+ if ( $is_singular ) {
1552
+ // If it's a single post, we don't need the 'more' link.
1553
+ $more_link_text = '';
1554
+ $more_link = '';
1555
+ } else {
1556
+ // The default $more_link_text.
1557
+ if ( isset( $wpmem->autoex[ $post->post_type ]['text'] ) && '' != $wpmem->autoex[ $post->post_type ]['text'] ) {
1558
+ $more_link_text = __( $wpmem->autoex[ $post->post_type ]['text'], 'wp-members' );
1559
+ } else {
1560
+ $more_link_text = __( '(more&hellip;)' );
1561
+ }
1562
+ // The default $more_link.
1563
+ $more_link = ' <a href="'. get_permalink( $post->ID ) . '" class="more-link">' . $more_link_text . '</a>';
1564
+ }
1565
+
1566
+ // Apply the_content_more_link filter if one exists (will match up all 'more' link text).
1567
+ /** This filter is documented in /wp-includes/post-template.php */
1568
+ $more_link = apply_filters( 'the_content_more_link', $more_link, $more_link_text );
1569
+
1570
+ $defaults = array(
1571
+ 'length' => $autoex['length'],
1572
+ 'more_link' => $more_link,
1573
+ 'blocked_only' => false,
1574
+ );
1575
+ /**
1576
+ * Filter auto excerpt defaults.
1577
+ *
1578
+ * @since 3.0.9
1579
+ * @since 3.1.5 Deprecated add_ellipsis, strip_tags, close_tags, parse_shortcodes, strip_shortcodes.
1580
+ *
1581
+ * @param array {
1582
+ * An array of settings to override the function defaults.
1583
+ *
1584
+ * @type int $length The default length of the excerpt.
1585
+ * @type string $more_link The more link HTML.
1586
+ * @type boolean $blocked_only Run autoexcerpt only on blocked content. default: false.
1587
+ * }
1588
+ * @param string $post->ID The post ID.
1589
+ * @param string $post->post_type The content's post type.
1590
+ */
1591
+ $args = apply_filters( 'wpmem_auto_excerpt_args', '', $post->ID, $post->post_type );
1592
+
1593
+ // Merge settings.
1594
+ $args = wp_parse_args( $args, $defaults );
1595
+
1596
+ // Are we only excerpting blocked content?
1597
+ if ( $args['blocked_only'] ) {
1598
+ $post_meta = get_post_meta( $post->ID, '_wpmem_block', true );
1599
+ if ( 1 == $wpmem->block[ $post->post_type ] ) {
1600
+ // Post type is blocked, if post meta unblocks it, don't do excerpt.
1601
+ $do_excerpt = ( "0" == $post_meta ) ? false : true;
1602
+ } else {
1603
+ // Post type is unblocked, if post meta blocks it, do excerpt.
1604
+ $do_excerpt = ( "1" == $post_meta ) ? true : false;
1605
+ }
1606
+ } else {
1607
+ $do_excerpt = true;
1608
+ }
1609
+
1610
+ if ( $do_excerpt ) {
1611
+ $content = wp_trim_words( $content, $args['length'], $args['more_link'] );
1612
+ // Check if the more link was added (note: singular has no more_link):
1613
+ if ( ! $is_singular && ! strpos( $content, $args['more_link'] ) ) {
1614
+ $content = $content . $args['more_link'];
1615
+ }
1616
+ }
1617
+ }
1618
+ }
1619
+ } else {
1620
+ $post_id = false;
1621
+ $post_type = false;
1622
+ }
1623
+
1624
+ /**
1625
+ * Filter the auto excerpt.
1626
+ *
1627
+ * @since 2.8.1
1628
+ * @since 3.0.9 Added post ID and post type parameters.
1629
+ * @since 3.2.5 Post ID and post type may be false if there is no post object.
1630
+ *
1631
+ * @param string $content The content excerpt.
1632
+ * @param string $post_id The post ID.
1633
+ * @param string $post_type The content's post type.
1634
+ */
1635
+ $content = apply_filters( 'wpmem_auto_excerpt', $content, $post_id, $post_type );
1636
+
1637
+ // Return the excerpt.
1638
+ return $content;
1639
+ }
1640
+
1641
+ /**
1642
+ * Convert form tag.
1643
+ *
1644
+ * @todo This is temporary to handle form tag conversion.
1645
+ *
1646
+ * @since 3.1.7
1647
+ * @since 3.2.3 Moved to WP_Members class.
1648
+ *
1649
+ * @param string $tag
1650
+ * @return string $tag
1651
+ */
1652
+ function convert_tag( $tag ) {
1653
+ switch ( $tag ) {
1654
+ case 'new':
1655
+ return 'register';
1656
+ break;
1657
+ case 'edit':
1658
+ case 'update':
1659
+ return 'profile';
1660
+ break;
1661
+ case 'wp':
1662
+ case 'wp_validate':
1663
+ case 'wp_finalize':
1664
+ return 'register_wp';
1665
+ break;
1666
+ case 'dashboard_profile':
1667
+ case 'dashboard_profile_update':
1668
+ return 'profile_dashboard';
1669
+ break;
1670
+ case 'admin_profile':
1671
+ case 'admin_profile_update':
1672
+ return 'profile_admin';
1673
+ break;
1674
+ default:
1675
+ return $tag;
1676
+ break;
1677
+ }
1678
+ return $tag;
1679
+ }
1680
+
1681
+ /**
1682
+ * Loads translation files.
1683
+ *
1684
+ * @since 3.0.0
1685
+ * @since 3.2.5 Moved to main object, dropped wpmem_ stem.
1686
+ */
1687
+ function load_textdomain() {
1688
+
1689
+ // @see: https://ulrich.pogson.ch/load-theme-plugin-translations for notes on changes.
1690
+
1691
+ // Plugin textdomain.
1692
+ $domain = 'wp-members';
1693
+
1694
+ // Wordpress locale.
1695
+ /** This filter is documented in wp-includes/l10n.php */
1696
+ $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
1697
+
1698
+ /**
1699
+ * Filter translation file.
1700
+ *
1701
+ * If the translate.wordpress.org language pack is available, it will
1702
+ * be /wp-content/languages/plugins/wp-members-{locale}.mo by default.
1703
+ * You can filter this if you want to load a language pack from a
1704
+ * different location (or different file name).
1705
+ *
1706
+ * @since 3.0.0
1707
+ * @since 3.2.0 Added locale as a parameter.
1708
+ *
1709
+ * @param string $file The translation file to load.
1710
+ * @param string $locale The current locale.
1711
+ */
1712
+ $file = apply_filters( 'wpmem_localization_file', trailingslashit( WP_LANG_DIR ) . 'plugins/' . $domain . '-' . $locale . '.mo', $locale );
1713
+
1714
+ $loaded = load_textdomain( $domain, $file );
1715
+ if ( $loaded ) {
1716
+ return $loaded;
1717
+ } else {
1718
+
1719
+ /*
1720
+ * If there is no wordpress.org language pack or the filtered
1721
+ * language file does not load, $loaded will be false and will
1722
+ * end up here to attempt to load one of the legacy language
1723
+ * packs. Note that the legacy language files are no longer
1724
+ * actively maintained and may not contain all strings.
1725
+ * The directory that the file will load from can be changed
1726
+ * using the wpmem_localization_dir filter.
1727
+ */
1728
+
1729
+ /**
1730
+ * Filter translation directory.
1731
+ *
1732
+ * @since 3.0.3
1733
+ * @since 3.2.0 Added locale as a parameter.
1734
+ *
1735
+ * @param string $dir The translation directory.
1736
+ * @param string $locale The current locale.
1737
+ */
1738
+ $dir = apply_filters( 'wpmem_localization_dir', basename( WPMEM_PATH ) . '/lang/', $locale );
1739
+ load_plugin_textdomain( $domain, FALSE, $dir );
1740
+ }
1741
+ return;
1742
+ }
1743
+
1744
+ /**
1745
+ * Load default tos template.
1746
+ *
1747
+ * @since 3.2.8
1748
+ */
1749
+ function load_default_tos() {
1750
+ // Check for custom template or load default.
1751
+ $custom_template = get_stylesheet_directory() . '/wp-members/templates/tos.php';
1752
+ if ( file_exists( $custom_template ) ) {
1753
+ require_once( $custom_template );
1754
+ } else {
1755
+ require_once( WPMEM_PATH . 'inc/template_tos.php' );
1756
+ }
1757
+ }
1758
+
1759
  } // End of WP_Members class.
inc/deprecated.php CHANGED
@@ -71,7 +71,7 @@ if ( ! function_exists( 'wpmem_shortcode' ) ):
71
  function wpmem_shortcode( $attr, $content = null, $tag = 'wp-members' ) {
72
 
73
  $error = "wpmem_shortcode() is deprecated as of WP-Members 3.1.2. The [wp-members] shortcode tag should be replaced. ";
74
- $error.= 'See replacement shortcodes: http://rkt.bz/logsc ';
75
  $error.= "post ID: " . get_the_ID() . " ";
76
  $error.= "page url: " . wpmem_current_url();
77
  wpmem_write_log( $error );
71
  function wpmem_shortcode( $attr, $content = null, $tag = 'wp-members' ) {
72
 
73
  $error = "wpmem_shortcode() is deprecated as of WP-Members 3.1.2. The [wp-members] shortcode tag should be replaced. ";
74
+ $error.= 'See replacement shortcodes: https://rocketgeek.com/shortcodes/list-of-replacement-shortcodes/';
75
  $error.= "post ID: " . get_the_ID() . " ";
76
  $error.= "page url: " . wpmem_current_url();
77
  wpmem_write_log( $error );
inc/dialogs.php CHANGED
@@ -525,7 +525,7 @@ function wpmem_page_forgot_username( $wpmem_regchk, $content ) {
525
  break;
526
 
527
  case "usernamesuccess":
528
- $email = ( isset( $_POST['user_email'] ) ) ? $_POST['user_email'] : '';
529
  $msg = sprintf( $wpmem->get_text( 'usernamesuccess' ), $email );
530
  $content = $content . wpmem_inc_regmessage( 'usernamesuccess', $msg );
531
  $wpmem->regchk = ''; // Clear regchk.
525
  break;
526
 
527
  case "usernamesuccess":
528
+ $email = ( isset( $_POST['user_email'] ) ) ? sanitize_email( $_POST['user_email'] ) : '';
529
  $msg = sprintf( $wpmem->get_text( 'usernamesuccess' ), $email );
530
  $content = $content . wpmem_inc_regmessage( 'usernamesuccess', $msg );
531
  $wpmem->regchk = ''; // Clear regchk.
inc/register.php CHANGED
@@ -84,10 +84,10 @@ function wpmem_registration( $tag ) {
84
  case 'multiselect':
85
  case 'multicheckbox':
86
  $delimiter = ( isset( $field['delimiter'] ) ) ? $field['delimiter'] : '|';
87
- $wpmem->user->post_data[ $meta_key ] = ( isset( $_POST[ $meta_key ] ) ) ? implode( $delimiter, $_POST[ $meta_key ] ) : '';
88
  break;
89
  case 'textarea':
90
- $wpmem->user->post_data[ $meta_key ] = $_POST[ $meta_key ];
91
  break;
92
  default:
93
  $wpmem->user->post_data[ $meta_key ] = sanitize_text_field( $_POST[ $meta_key ] );
@@ -129,7 +129,7 @@ function wpmem_registration( $tag ) {
129
  // Check for required fields, reverse the array for logical error message order.
130
  foreach ( array_reverse( $wpmem->fields ) as $meta_key => $field ) {
131
  // Validation if the field is required.
132
- if ( $field['required'] ) { // @todo - verify $field['required']
133
  if ( 'file' == $field['type'] || 'image' == $field['type'] ) {
134
  // If this is a new registration.
135
  if ( 'register' == $tag ) {
@@ -145,6 +145,17 @@ function wpmem_registration( $tag ) {
145
  }
146
  }
147
  }
 
 
 
 
 
 
 
 
 
 
 
148
  }
149
 
150
  switch ( $tag ) {
84
  case 'multiselect':
85
  case 'multicheckbox':
86
  $delimiter = ( isset( $field['delimiter'] ) ) ? $field['delimiter'] : '|';
87
+ $wpmem->user->post_data[ $meta_key ] = ( isset( $_POST[ $meta_key ] ) ) ? implode( $delimiter, wpmem_sanitize_array( $_POST[ $meta_key ] ) ) : '';
88
  break;
89
  case 'textarea':
90
+ $wpmem->user->post_data[ $meta_key ] = sanitize_textarea_field( $_POST[ $meta_key ] );
91
  break;
92
  default:
93
  $wpmem->user->post_data[ $meta_key ] = sanitize_text_field( $_POST[ $meta_key ] );
129
  // Check for required fields, reverse the array for logical error message order.
130
  foreach ( array_reverse( $wpmem->fields ) as $meta_key => $field ) {
131
  // Validation if the field is required.
132
+ if ( $field['required'] ) {
133
  if ( 'file' == $field['type'] || 'image' == $field['type'] ) {
134
  // If this is a new registration.
135
  if ( 'register' == $tag ) {
145
  }
146
  }
147
  }
148
+
149
+ // Validate file field type.
150
+ if ( 'file' == $field['type'] || 'image' == $field['type'] ) {
151
+ $file_types = explode( '|', $field['file_types'] );
152
+ $msg_types = implode( ', ', $file_types );
153
+ if ( ! empty( $_FILES[ $meta_key ]['name'] ) ) {
154
+ if ( ! in_array( $_FILES[ $meta_key ]['type'], $file_types ) ) {
155
+ $wpmem_themsg = sprintf( $wpmem->get_text( 'reg_file_type' ), __( $field['label'], 'wp-members' ), str_replace( '|', ',', $msg_types ) );
156
+ }
157
+ }
158
+ }
159
  }
160
 
161
  switch ( $tag ) {
wp-members-tos.php → inc/template_tos.php RENAMED
@@ -1,42 +1,39 @@
1
- <?php
2
- /**
3
- * WP-Members TOS Page
4
- *
5
- * Generates teh Terms of Service pop-up.
6
- *
7
- * This file is part of the WP-Members plugin by Chad Butler
8
- * You can find out more about this plugin at https://rocketgeek.com
9
- * Copyright (c) 2006-2019 Chad Butler
10
- * WP-Members(tm) is a trademark of butlerblog.com
11
- *
12
- * @package WP-Members
13
- * @author Chad Butler
14
- * @copyright 2006-2019
15
- */
16
-
17
- define ( 'WP_USE_THEMES', false );
18
- require( '../../../wp-blog-header.php' );
19
- ?>
20
-
21
- <html>
22
- <head>
23
- <title><?php _e( 'Terms of Service', 'wp-members' ); ?> | <?php bloginfo( 'name' ); ?></title>
24
- </head>
25
-
26
- <body>
27
-
28
- <?php
29
-
30
- $wpmem_tos = get_option( 'wpmembers_tos' );
31
-
32
- echo stripslashes( $wpmem_tos );
33
-
34
- print ( '<br /><br />' );
35
- printf( __('%sclose%s', 'wp-members'), '[<a href="javascript:self.close()">', '</a>]' );
36
- print ( '&nbsp;&nbsp;' );
37
- printf( __('%sprint%s', 'wp-members'), '[<a href="javascript:window.print()">', '</a>]' );
38
-
39
- ?>
40
-
41
- </body>
42
  </html>
1
+ <?php
2
+ /**
3
+ * WP-Members TOS Page
4
+ *
5
+ * Generates teh Terms of Service pop-up.
6
+ *
7
+ * This file is part of the WP-Members plugin by Chad Butler
8
+ * You can find out more about this plugin at https://rocketgeek.com
9
+ * Copyright (c) 2006-2019 Chad Butler
10
+ * WP-Members(tm) is a trademark of butlerblog.com
11
+ *
12
+ * @package WP-Members
13
+ * @author Chad Butler
14
+ * @copyright 2006-2019
15
+ */
16
+ ?>
17
+
18
+ <html>
19
+ <head>
20
+ <title><?php _e( 'Terms of Service', 'wp-members' ); ?> | <?php bloginfo( 'name' ); ?></title>
21
+ </head>
22
+
23
+ <body>
24
+
25
+ <?php
26
+
27
+ $wpmem_tos = get_option( 'wpmembers_tos' );
28
+
29
+ echo stripslashes( $wpmem_tos );
30
+
31
+ print ( '<br /><br />' );
32
+ printf( __('%sclose%s', 'wp-members'), '[<a href="javascript:self.close()">', '</a>]' );
33
+ print ( '&nbsp;&nbsp;' );
34
+ printf( __('%sprint%s', 'wp-members'), '[<a href="javascript:window.print()">', '</a>]' );
35
+
36
+ ?>
37
+
38
+ </body>
 
 
 
39
  </html>
inc/wp-registration.php CHANGED
@@ -123,7 +123,7 @@ function wpmem_do_wp_register_form( $process = 'wp' ) {
123
  switch ( $field['type'] ) {
124
 
125
  case( 'select' ):
126
- $val = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
127
  $input = wpmem_create_formfield( $meta_key, $field['type'], $field['values'], $val );
128
  break;
129
 
@@ -137,7 +137,7 @@ function wpmem_do_wp_register_form( $process = 'wp' ) {
137
  case( 'multicheckbox' ):
138
  case( 'radio' ):
139
  $row_before = '<p class="' . $field['type'] . '">';
140
- $valtochk = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : ''; // @todo Should this be escaped?
141
  $formfield_args = array(
142
  'name' => $meta_key,
143
  'type' => $field['type'],
@@ -241,7 +241,7 @@ function wpmem_do_wp_newuser_form() {
241
  switch ( $field['type'] ) {
242
 
243
  case( 'select' ):
244
- $val = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
245
  echo wpmem_create_formfield( $meta_key, $field['type'], $field['values'], $val );
246
  break;
247
 
@@ -252,7 +252,7 @@ function wpmem_do_wp_newuser_form() {
252
  break;
253
 
254
  case( 'checkbox' ):
255
- $val = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
256
  $val = ( ! $_POST && $field['checked_default'] ) ? $field['checked_value'] : $val;
257
  echo wpmem_create_formfield( $meta_key, $field['type'], $field['checked_value'], $val );
258
  break;
@@ -260,7 +260,7 @@ function wpmem_do_wp_newuser_form() {
260
  case( 'multiselect' ):
261
  case( 'multicheckbox' ):
262
  case( 'radio' ):
263
- $valtochk = ( isset( $_POST[ $meta_key ] ) ) ? $_POST[ $meta_key ] : '';
264
  $formfield_args = array(
265
  'name' => $meta_key,
266
  'type' => $field['type'],
123
  switch ( $field['type'] ) {
124
 
125
  case( 'select' ):
126
+ $val = ( isset( $_POST[ $meta_key ] ) ) ? sanitize_text_field( $_POST[ $meta_key ] ) : '';
127
  $input = wpmem_create_formfield( $meta_key, $field['type'], $field['values'], $val );
128
  break;
129
 
137
  case( 'multicheckbox' ):
138
  case( 'radio' ):
139
  $row_before = '<p class="' . $field['type'] . '">';
140
+ $valtochk = ( isset( $_POST[ $meta_key ] ) ) ? sanitize_text_field( $_POST[ $meta_key ] ) : '';
141
  $formfield_args = array(
142
  'name' => $meta_key,
143
  'type' => $field['type'],
241
  switch ( $field['type'] ) {
242
 
243
  case( 'select' ):
244
+ $val = ( isset( $_POST[ $meta_key ] ) ) ? sanitize_text_field( $_POST[ $meta_key ] ) : '';
245
  echo wpmem_create_formfield( $meta_key, $field['type'], $field['values'], $val );
246
  break;
247
 
252
  break;
253
 
254
  case( 'checkbox' ):
255
+ $val = ( isset( $_POST[ $meta_key ] ) ) ? sanitize_text_field( $_POST[ $meta_key ] ) : '';
256
  $val = ( ! $_POST && $field['checked_default'] ) ? $field['checked_value'] : $val;
257
  echo wpmem_create_formfield( $meta_key, $field['type'], $field['checked_value'], $val );
258
  break;
260
  case( 'multiselect' ):
261
  case( 'multicheckbox' ):
262
  case( 'radio' ):
263
+ $valtochk = ( isset( $_POST[ $meta_key ] ) ) ? sanitize_text_field( $_POST[ $meta_key ] ) : '';
264
  $formfield_args = array(
265
  'name' => $meta_key,
266
  'type' => $field['type'],
lang/wp-members-ko_KR.mo CHANGED
Binary file
lang/wp-members-ko_KR.po CHANGED
@@ -3,7 +3,7 @@ msgstr ""
3
  "Project-Id-Version: WP-Members v3.2.6\n"
4
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-members\n"
5
  "POT-Creation-Date: 2019-04-02 08:55-0400\n"
6
- "PO-Revision-Date: 2019-04-02 09:55-0400\n"
7
  "Last-Translator: \n"
8
  "Language-Team: Venusian <martian36@naver.com>\n"
9
  "Language: ko_KR\n"
@@ -1441,7 +1441,7 @@ msgstr "로그인"
1441
 
1442
  #: inc/api.php:305
1443
  msgid "log out"
1444
- msgstr ""
1445
 
1446
  #: inc/class-wp-members-forms.php:961 inc/class-wp-members.php:1247
1447
  #: inc/wp-registration.php:77
@@ -1555,11 +1555,11 @@ msgstr ""
1555
  #: inc/class-wp-members-shortcodes.php:745 inc/class-wp-members.php:1249
1556
  #: inc/class-wp-members.php:1298 inc/wp-registration.php:366
1557
  msgid "Register"
1558
- msgstr ""
1559
 
1560
  #: inc/class-wp-members-shortcodes.php:748 inc/class-wp-members.php:1217
1561
  msgid "Log In"
1562
- msgstr ""
1563
 
1564
  # @ wp-members
1565
  #: inc/class-wp-members-user-profile.php:38 inc/deprecated.php:315
@@ -1677,7 +1677,7 @@ msgstr ""
1677
 
1678
  #: inc/class-wp-members.php:1193
1679
  msgid "Confirm Email"
1680
- msgstr ""
1681
 
1682
  #: inc/class-wp-members.php:1194
1683
  msgid "Website"
@@ -1690,11 +1690,11 @@ msgstr "자기 소개"
1690
  #: inc/class-wp-members.php:1196 inc/class-wp-members.php:1216
1691
  #: inc/class-wp-members.php:1295
1692
  msgid "Password"
1693
- msgstr ""
1694
 
1695
  #: inc/class-wp-members.php:1197
1696
  msgid "Confirm Password"
1697
- msgstr ""
1698
 
1699
  # @ wp-members
1700
  #: inc/class-wp-members.php:1208
@@ -1708,11 +1708,11 @@ msgstr "기존 사용자 로그인"
1708
 
1709
  #: inc/class-wp-members.php:1215 inc/class-wp-members.php:1294
1710
  msgid "Username or Email"
1711
- msgstr ""
1712
 
1713
  #: inc/class-wp-members.php:1218
1714
  msgid "Remember Me"
1715
- msgstr ""
1716
 
1717
  # @ wp-members
1718
  #: inc/class-wp-members.php:1219
@@ -1745,7 +1745,7 @@ msgstr ""
1745
 
1746
  #: inc/class-wp-members.php:1227
1747
  msgid "Confirm new password"
1748
- msgstr ""
1749
 
1750
  # @ wp-members
1751
  #: inc/class-wp-members.php:1228
@@ -1763,7 +1763,7 @@ msgstr ""
1763
 
1764
  #: inc/class-wp-members.php:1235
1765
  msgid "Forgot username?"
1766
- msgstr ""
1767
 
1768
  #: inc/class-wp-members.php:1236
1769
  msgid "Click here"
@@ -1923,7 +1923,7 @@ msgstr "로그아웃 하려면 클릭"
1923
 
1924
  #: inc/class-wp-members.php:1287
1925
  msgid "Log Out"
1926
- msgstr ""
1927
 
1928
  # @ wp-members
1929
  #: inc/class-wp-members.php:1291
3
  "Project-Id-Version: WP-Members v3.2.6\n"
4
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-members\n"
5
  "POT-Creation-Date: 2019-04-02 08:55-0400\n"
6
+ "PO-Revision-Date: 2019-06-19 08:52-0400\n"
7
  "Last-Translator: \n"
8
  "Language-Team: Venusian <martian36@naver.com>\n"
9
  "Language: ko_KR\n"
1441
 
1442
  #: inc/api.php:305
1443
  msgid "log out"
1444
+ msgstr "로그아웃"
1445
 
1446
  #: inc/class-wp-members-forms.php:961 inc/class-wp-members.php:1247
1447
  #: inc/wp-registration.php:77
1555
  #: inc/class-wp-members-shortcodes.php:745 inc/class-wp-members.php:1249
1556
  #: inc/class-wp-members.php:1298 inc/wp-registration.php:366
1557
  msgid "Register"
1558
+ msgstr "회원가입"
1559
 
1560
  #: inc/class-wp-members-shortcodes.php:748 inc/class-wp-members.php:1217
1561
  msgid "Log In"
1562
+ msgstr "로그인"
1563
 
1564
  # @ wp-members
1565
  #: inc/class-wp-members-user-profile.php:38 inc/deprecated.php:315
1677
 
1678
  #: inc/class-wp-members.php:1193
1679
  msgid "Confirm Email"
1680
+ msgstr "이메일 확인"
1681
 
1682
  #: inc/class-wp-members.php:1194
1683
  msgid "Website"
1690
  #: inc/class-wp-members.php:1196 inc/class-wp-members.php:1216
1691
  #: inc/class-wp-members.php:1295
1692
  msgid "Password"
1693
+ msgstr "비밀번호"
1694
 
1695
  #: inc/class-wp-members.php:1197
1696
  msgid "Confirm Password"
1697
+ msgstr "비밀번호 확인"
1698
 
1699
  # @ wp-members
1700
  #: inc/class-wp-members.php:1208
1708
 
1709
  #: inc/class-wp-members.php:1215 inc/class-wp-members.php:1294
1710
  msgid "Username or Email"
1711
+ msgstr "아이디 또는 이메일 "
1712
 
1713
  #: inc/class-wp-members.php:1218
1714
  msgid "Remember Me"
1715
+ msgstr "기억하기"
1716
 
1717
  # @ wp-members
1718
  #: inc/class-wp-members.php:1219
1745
 
1746
  #: inc/class-wp-members.php:1227
1747
  msgid "Confirm new password"
1748
+ msgstr "새 비밀번호 확인"
1749
 
1750
  # @ wp-members
1751
  #: inc/class-wp-members.php:1228
1763
 
1764
  #: inc/class-wp-members.php:1235
1765
  msgid "Forgot username?"
1766
+ msgstr "사용자 이름을 잊으셨나요?"
1767
 
1768
  #: inc/class-wp-members.php:1236
1769
  msgid "Click here"
1923
 
1924
  #: inc/class-wp-members.php:1287
1925
  msgid "Log Out"
1926
+ msgstr "로그아웃"
1927
 
1928
  # @ wp-members
1929
  #: inc/class-wp-members.php:1291
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: cbutlerjr
3
  Tags: access, authentication, content, login, member, membership, password, protect, register, registration, restriction, subscriber
4
  Requires at least: 4.0
5
  Tested up to: 5.2
6
- Stable tag: 3.2.8
7
  License: GPLv2
8
 
9
  == Description ==
@@ -27,37 +27,37 @@ __Simple to install and configure - yet customizable and scalable!__
27
  * Notify admin of new user registrations
28
  * Hold new registrations for admin approval
29
  * Create post excerpt teaser content automatically
30
- * [Shortcodes for login, registration, content restriction, and more](https://rkt.bz/docssc)
31
- * Create powerful customizations with [more than 120 action and filter hooks](https://rkt.bz/hooks)
32
- * [A library of API functions for extensibility](https://rkt.bz/api)
33
 
34
  WP-Members allows you to restrict content as restricted or hidden, limiting access to registered users.
35
 
36
- A full Users Guide is [available here](https://rkt.bz/docs). The guide outlines the installation process, and also documents how to use all of the settings.
37
 
38
- Get support along with all of the plugin's premium extensions in one [cost saving Pro Bundle!](https://rkt.bz/pro)
39
 
40
  = Premium Support =
41
 
42
- Premium support subscribers have access to priority email support, examples, tutorials, and code snippets that will help you extend and customize the base plugin using the plugin's framework. [Visit the site for more info](https://rkt.bz/getsupport).
43
 
44
  = Premium Extensions =
45
 
46
  The plugin has several premium extensions for additional functionality. You can purchase any of them individually, or get them all for a significant discount in the Pro Bundle.
47
 
48
- * [Advanced Options](https://rkt.bz/advanced) - adds additional settings to WP-Members for redirecting core WP created URLs, redirecting restricted content, hiding the WP toolbar, and more! Also includes integrations with popular plugins like WooCommerce, BuddyPress, bbPress, ADF, Easy Digital Downloads, and The Events Calendar.
49
- * [Download Protect](https://rkt.bz/downloadprotect) - Allows you to restrict access to specific files, requiring the user to be logged in to access.
50
- * [Invite Codes](https://rkt.bz/invitecodes) - set up invitation codes to restrict registration to only those with a valide invite code.
51
- * [MailChimp Integration](https://rkt.bz/mailchimp) - add MailChimp list subscription to your registation form.
52
- * [Memberships for WooCommerce](https://rkt.bz/fR) - Sell memberships through WooCommerce.
53
- * [PayPal Subscriptions](https://rkt.bz/paypal) - Sell restricted content access through PayPal.
54
- * [Security](https://rkt.bz/security) - adds a number of security features to the plugin such as preventing concurrent logins, registration form honey pot (spam blocker), require passwords be changed on first use, require passwords to be changed after defined period of time, require strong passwords, block registration by IP and email, restrict specified usernames from being registered.
55
- * [Text Editor](https://rkt.bz/te) - Adds an editor to the WP-Members admin panel to easily customize all user facing strings in the plugin.
56
- * [User List](https://rkt.bz/userlist) - Display lists of users on your site. Great for creating user directories with detailed and customizable profiles.
57
- * [User Tracking](https://rkt.bz/usertrack) - Track what pages logged in users are visting and when.
58
- * [WordPass Pro](https://rkt.bz/3O) - Change your random password generator from gibberish to word-based passwords (can be used with or without WP-Members).
59
 
60
- Get support along with all of the plugin's premium extensions in one [cost saving Pro Bundle!](https://rkt.bz/pro)
61
 
62
 
63
  == Installation ==
@@ -66,7 +66,7 @@ WP-Members is designed to run "out-of-the-box" with no modifications to your WP
66
 
67
  = Basic Install: =
68
 
69
- The best way to begin is to review the [Initial Setup Video](https://rkt.bz/videos). There is also a complete [Users Guide available](https://rkt.bz/docs) that covers all of the plugin's features in depth.
70
 
71
  1. Upload the `/wp-members/` directory and its contents to the `/wp-content/plugins/` directory
72
  2. Activate the plugin through the 'Plugins' menu in WordPress&reg;
@@ -88,9 +88,9 @@ There are also some special pages that can be created with simple shortcodes:
88
  * A User Profile page where registered members can edit their information and change/reset their password: [wpmem_profile]
89
  * A Registration page available for those that need a specific URL for registrations (such as email marketing or banner ad landing pages). Note: this is strictly optional as a registration form can also be included by default on blocked content pages: [wpmem_form register]
90
  * A Login page. This is also an optional page as the login form is included by default on blocked content. But if you need a specific login page, this can be created with a simple shortcode: [wpmem_form login]
91
- * [And more shortcodes are available](https://rkt.bz/docssc)!
92
 
93
- Powerful cusotmizations can be constructed with [over 120 action and filter hooks](https://rkt.bz/hooks), as well as user accessible functions.
94
 
95
 
96
  == Frequently Asked Questions ==
@@ -101,7 +101,7 @@ The FAQs are maintained at https://rocketgeek.com/plugins/wp-members/docs/faqs/
101
  == Upgrade Notice ==
102
 
103
  WP-Members 3.2.0 is a major update. See changelog for important details. Minimum WP version is 4.0.
104
- WP-Members 3.2.8 is a security release. See changelog for details.
105
 
106
  == Screenshots ==
107
 
@@ -124,8 +124,22 @@ WP-Members 3.2.8 is a security release. See changelog for details.
124
 
125
  == Changelog ==
126
 
 
 
 
 
 
 
 
 
 
 
 
127
  = 3.2.8 =
128
 
 
 
 
129
  * Fixed potential security issues to prevent CSRF (Cross Site Request Forgery).
130
 
131
  = 3.2.7 =
3
  Tags: access, authentication, content, login, member, membership, password, protect, register, registration, restriction, subscriber
4
  Requires at least: 4.0
5
  Tested up to: 5.2
6
+ Stable tag: 3.2.9
7
  License: GPLv2
8
 
9
  == Description ==
27
  * Notify admin of new user registrations
28
  * Hold new registrations for admin approval
29
  * Create post excerpt teaser content automatically
30
+ * [Shortcodes for login, registration, content restriction, and more](https://rocketgeek.com/plugins/wp-members/docs/shortcodes/)
31
+ * Create powerful customizations with [more than 120 action and filter hooks](https://rocketgeek.com/plugins/wp-members/docs/filter-hooks/)
32
+ * [A library of API functions for extensibility](https://rocketgeek.com/plugins/wp-members/docs/api-functions/)
33
 
34
  WP-Members allows you to restrict content as restricted or hidden, limiting access to registered users.
35
 
36
+ A full Users Guide is [available here](https://rocketgeek.com/plugins/wp-members/docs/). The guide outlines the installation process, and also documents how to use all of the settings.
37
 
38
+ Get support along with all of the plugin's premium extensions in one [cost saving Pro Bundle!](https://rocketgeek.com/product/wp-members-pro-bundle/)
39
 
40
  = Premium Support =
41
 
42
+ Premium support subscribers have access to priority email support, examples, tutorials, and code snippets that will help you extend and customize the base plugin using the plugin's framework. [Visit the site for more info](https://rocketgeek.com/plugins/wp-members/support-options/).
43
 
44
  = Premium Extensions =
45
 
46
  The plugin has several premium extensions for additional functionality. You can purchase any of them individually, or get them all for a significant discount in the Pro Bundle.
47
 
48
+ * [Advanced Options](https://rocketgeek.com/plugins/wp-members-advanced-options/) - adds additional settings to WP-Members for redirecting core WP created URLs, redirecting restricted content, hiding the WP toolbar, and more! Also includes integrations with popular plugins like WooCommerce, BuddyPress, bbPress, ADF, Easy Digital Downloads, and The Events Calendar.
49
+ * [Download Protect](https://rocketgeek.com/plugins/wp-members-download-protect/) - Allows you to restrict access to specific files, requiring the user to be logged in to access.
50
+ * [Invite Codes](https://rocketgeek.com/plugins/wp-members-invite-codes/) - set up invitation codes to restrict registration to only those with a valide invite code.
51
+ * [MailChimp Integration](https://rocketgeek.com/plugins/wp-members-mailchimp-integration/) - add MailChimp list subscription to your registation form.
52
+ * [Memberships for WooCommerce](https://rocketgeek.com/plugins/wp-members-memberships-for-woocommerce/) - Sell memberships through WooCommerce.
53
+ * [PayPal Subscriptions](https://rocketgeek.com/plugins/wp-members-paypal-subscriptions/) - Sell restricted content access through PayPal.
54
+ * [Security](https://rocketgeek.com/plugins/wp-members-security/) - adds a number of security features to the plugin such as preventing concurrent logins, registration form honey pot (spam blocker), require passwords be changed on first use, require passwords to be changed after defined period of time, require strong passwords, block registration by IP and email, restrict specified usernames from being registered.
55
+ * [Text Editor](https://rocketgeek.com/plugins/wp-members-text-editor/) - Adds an editor to the WP-Members admin panel to easily customize all user facing strings in the plugin.
56
+ * [User List](https://rocketgeek.com/plugins/wp-members-user-list/) - Display lists of users on your site. Great for creating user directories with detailed and customizable profiles.
57
+ * [User Tracking](https://rocketgeek.com/plugins/wp-members-user-tracking/) - Track what pages logged in users are visting and when.
58
+ * [WordPass Pro](https://rocketgeek.com/plugins/wordpass/) - Change your random password generator from gibberish to word-based passwords (can be used with or without WP-Members).
59
 
60
+ Get support along with all of the plugin's premium extensions in one [cost saving Pro Bundle!](https://rocketgeek.com/product/wp-members-pro-bundle/)
61
 
62
 
63
  == Installation ==
66
 
67
  = Basic Install: =
68
 
69
+ The best way to begin is to review the [Initial Setup Video](https://rocketgeek.com/plugins/wp-members/docs/videos/). There is also a complete [Users Guide available](https://rocketgeek.com/plugins/wp-members/docs/) that covers all of the plugin's features in depth.
70
 
71
  1. Upload the `/wp-members/` directory and its contents to the `/wp-content/plugins/` directory
72
  2. Activate the plugin through the 'Plugins' menu in WordPress&reg;
88
  * A User Profile page where registered members can edit their information and change/reset their password: [wpmem_profile]
89
  * A Registration page available for those that need a specific URL for registrations (such as email marketing or banner ad landing pages). Note: this is strictly optional as a registration form can also be included by default on blocked content pages: [wpmem_form register]
90
  * A Login page. This is also an optional page as the login form is included by default on blocked content. But if you need a specific login page, this can be created with a simple shortcode: [wpmem_form login]
91
+ * [And more shortcodes are available](https://rocketgeek.com/plugins/wp-members/docs/shortcodes/)!
92
 
93
+ Powerful cusotmizations can be constructed with [over 120 action and filter hooks](https://rocketgeek.com/plugins/wp-members/docs/filter-hooks/), as well as user accessible functions.
94
 
95
 
96
  == Frequently Asked Questions ==
101
  == Upgrade Notice ==
102
 
103
  WP-Members 3.2.0 is a major update. See changelog for important details. Minimum WP version is 4.0.
104
+ WP-Members 3.2.9 is a fix release. See changelog for details.
105
 
106
  == Screenshots ==
107
 
124
 
125
  == Changelog ==
126
 
127
+ = 3.2.9 =
128
+
129
+ * Load jQuery UI and Select2 libraries locally (if they have not already been enqueued).
130
+ * Use (local) template file for default tos field link (can be customized and saved in theme folder).
131
+ * Added new sanitization functions to API: wpmem_sanitize_class() and wpmem_sanitize_array().
132
+ * Review and cleanup of form data sanitization.
133
+ * Improved file/image field upload file type validation.
134
+ * Fixed issue with loading legacy translation files.
135
+ * Added "membership" attribute to [wpmem_logged_in] shortcode (same as "product" attribute, they are interchangeable).
136
+ * Added datepicker for setting user expiration (when membership products are used).
137
+
138
  = 3.2.8 =
139
 
140
+ * Include jQuery UI CSS and Select2 library locally.
141
+ * Updated default TOS to a template file.
142
+ * Added additional data sanitization.
143
  * Fixed potential security issues to prevent CSRF (Cross Site Request Forgery).
144
 
145
  = 3.2.7 =
wp-members.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP-Members
4
  Plugin URI: https://rocketgeek.com
5
  Description: WP access restriction and user registration. For more information on plugin features, refer to <a href="https://rocketgeek.com/plugins/wp-members/users-guide/">the online Users Guide</a>. A <a href="https://rocketgeek.com/plugins/wp-members/quick-start-guide/">Quick Start Guide</a> is also available. WP-Members(tm) is a trademark of butlerblog.com.
6
- Version: 3.2.8
7
  Author: Chad Butler
8
  Author URI: http://butlerblog.com/
9
  Text Domain: wp-members
@@ -66,7 +66,7 @@ if ( ! defined( 'ABSPATH' ) ) {
66
  }
67
 
68
  // Initialize constants.
69
- define( 'WPMEM_VERSION', '3.2.8' );
70
  define( 'WPMEM_DB_VERSION', '2.1.4' );
71
  define( 'WPMEM_DIR', plugin_dir_url ( __FILE__ ) );
72
  define( 'WPMEM_PATH', plugin_dir_path( __FILE__ ) );
3
  Plugin Name: WP-Members
4
  Plugin URI: https://rocketgeek.com
5
  Description: WP access restriction and user registration. For more information on plugin features, refer to <a href="https://rocketgeek.com/plugins/wp-members/users-guide/">the online Users Guide</a>. A <a href="https://rocketgeek.com/plugins/wp-members/quick-start-guide/">Quick Start Guide</a> is also available. WP-Members(tm) is a trademark of butlerblog.com.
6
+ Version: 3.2.9
7
  Author: Chad Butler
8
  Author URI: http://butlerblog.com/
9
  Text Domain: wp-members
66
  }
67
 
68
  // Initialize constants.
69
+ define( 'WPMEM_VERSION', '3.2.9' );
70
  define( 'WPMEM_DB_VERSION', '2.1.4' );
71
  define( 'WPMEM_DIR', plugin_dir_url ( __FILE__ ) );
72
  define( 'WPMEM_PATH', plugin_dir_path( __FILE__ ) );